Mercurial > public > ssdt-docker
annotate scripts/list-document-store-snapshots.sh @ 497:fbeadb9f1e45
USASR-5154 revert
author | belknapSSDT <zach.belknap@mcoecn.org> |
---|---|
date | Fri, 29 Sep 2023 11:34:18 -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}" |