#!/bin/bash
#
# Copyright (c) 2019-2020 Oracle and/or its affiliates. All rights reserved.
# Licensed under the GNU General Public License Version 2 as shown at https://oss.oracle.com/licenses/GPL-2.

cert="$1"
key="$2"
ca="$3"
endpoint="$4"
output="$5"

whitelist="/var/olcne/scratch/etcd.backup"

if ! echo "$whitelist" | grep -q -x "$output"; then
	echo "$output cannot be written by this script"
fi

ETCDCTL_API=3 etcdctl --cert="$cert" --key="$key" --cacert="$ca" --endpoints="$endpoint" snapshot save "$output"
