Last active
July 10, 2018 18:48
-
-
Save cdelashmutt-pivotal/ae780a4119740db7209b7f5e18e148f3 to your computer and use it in GitHub Desktop.
OpsMan API Call to convert retrieved properties on a staged time to the format needed for setting those properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
opsman_host_or_ip=YOUR_OPSMAN_IP_OR_HOSTNAME | |
uaac target "https://$opsman_host_or_ip/uaa" --skip-ssl-validation | |
uaac token owner get opsman <OPS-MAN-ADMIN-USER> | |
#Client secret: JUST_PRESS_ENTER | |
#Password: YOUR_PASSWORD_HERE | |
access_token=$(uaac context | grep access_token | tr -d " " | cut -d ':' -f 2) | |
product_guid=$(curl "https://$opsman_host_or_ip/api/v0/staged/products" -X GET -H "Authorization: Bearer $access_token" -k | jq -r '.[] | select(.type=="some-product-name")| .guid') | |
curl "https://$opsman_host_or_ip/api/v0/staged/products/$product_guid/properties" -X GET -H "Authorization: Bearer $access_token" -k | jq '.properties | to_entries | map(select(.key | match("^your-regex-here.*$"))) | from_entries | map_values({value: .value}) | {properties: .}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment