-
-
Save gowatana/39420edbe1a4dedec09e51b398db5478 to your computer and use it in GitHub Desktop.
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 | |
# Author: @gowatana | |
# Usage: | |
# 1) create ./id_and_key.txt | |
# 2) $ bash ./get_vmc-on-aws_current_cost.sh | |
source ./id_and_key.txt | |
# Get Access token | |
ACCESS_TOKEN=$(curl -s \ | |
--url "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize" \ | |
-X POST \ | |
-H "accept: application/json" \ | |
-d "refresh_token=$API_TOKEN" \ | |
| jq -r .access_token) | |
curl -s \ | |
--url "https://console.cloud.vmware.com/csp/gateway/commerce/api/v3/orgs/$ORG_ID/billing-accounts/$BILLING_ACCOUNT_ID/current-costs" \ | |
-H 'authority: console.cloud.vmware.com' \ | |
-H 'accept: application/json, text/plain, */*' \ | |
-H "csp-auth-token: $ACCESS_TOKEN" \ | |
| jq -r . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
下記の投稿むけ。
VMware Cloud on AWS のコストを情報を REST API で見てみる。(curl / Ansible)
https://vm.gowatana.jp/entry/2023/07/13/084828