Get Geo Inventory
Scenario Overview
Once Geo mode has been enabled, the user may want to fetch the currently active geo inventory file. This API returns the inventory file from the cluster. In such cases the client provides the request payload listed JSON file. The complete request could fail or succeed.
Prerequisites
Before running this example, ensure to obtain access token. Refer 'Getting Started' section.
Get Geo Inventory
Run the script get_geo_inventory.sh from the example directory.
cd cnc-geo-redundancy-api-examples;./get_geo_inventory.sh
Script Details
#!/bin/bash
. ./cnc-api-common.sh
get_geo_inventory() {
# assume cnc jwt is obtained prior to invoking this method by executing get-cnc-jwt.sh script
# read from jwt file and export it as AUTH_TOKEN_HDR
export_jwt
# STEP 1 : User to update input json with details of job to be created in the file CNC_API_INPUT
# STEP 2 : trigger get_geo_inventory API
# STEP 3 : store the output in CNC_API_OUTPUT file
CNC_GEO_REDUNDANCY_API=$CNC_GEO_REDUNDANCY_API_CTX/geomode/inventory/query
CNC_API_INPUT="@$PRJ/input/get_geo_inventory.json"
CNC_API_OUTPUT="$PRJ/output/get_geo_inventory.json"
http_post $CNC_GEO_REDUNDANCY_API $CNC_API_INPUT $CNC_API_OUTPUT
}
get_geo_inventory