annotate scripts/list-document-store-snapshots.sh @ 470:e8c329fe641d

USASR-5154 add apt-get
author belknapSSDT <zach.belknap@mcoecn.org>
date Thu, 28 Sep 2023 15:03:21 -0400
parents 52c2ec5ddeb5
children
rev   line source
424
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
1 #!/bin/bash
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
2
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
3 projectDir=${1:-$PWD}
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
4 detailedView=${2:-false}
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
5
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
6 cd "$projectDir" || echo "Unable to change to project directory: $projectDir"
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
7
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
8 function prop {
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
9 grep "${1}" .env/ssdt-document-store-shared.properties|cut -d'=' -f2
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
10 }
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
11
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
12 entityId=$(prop 'entityId' | tr -d '"')
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
13 repository="${entityId}_fs_backup"
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
14 certificate=${projectDir}/http_ca.crt
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
15 baseUrl="https://$(prop 'DOCUMENTSTORE_ELASTIC_HOST' | tr -d '"'):$(prop 'DOCUMENTSTORE_ELASTIC_PORT' | tr -d '"')"
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
16 elasticPassword=$(prop 'ELASTIC_PASSWORD' | tr -d '"')
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
17
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
18 options="pretty&verbose=${detailedView}&index_names=${detailedView}&ignore_unavailable=true"
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
19
52c2ec5ddeb5 DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff changeset
20 curl --cacert "${certificate}" -s -u elastic:"${elasticPassword}" -X GET "${baseUrl}/_snapshot/${repository}/_all?${options}"