Skip to content

Instantly share code, notes, and snippets.

@gowatana
Created July 12, 2023 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gowatana/a9a65fa41f8cf90f53ef8ce2120e24f3 to your computer and use it in GitHub Desktop.
Save gowatana/a9a65fa41f8cf90f53ef8ce2120e24f3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Author: @gowatana
# Usage:
# 1) create ./id_and_key.txt
# 2) $ bash ./get_vmc-on-aws_estimated-charges.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)
# Get Charges
curl -s \
--url "https://console.cloud.vmware.com/csp/gateway/commerce/api/v1/orgs/$ORG_ID/estimated-charges" \
-X GET \
-H "Content-Type: application/json" \
-H "csp-auth-token: $ACCESS_TOKEN" \
| jq -r .
@gowatana
Copy link
Author

下記の投稿むけ。

VMware Cloud on AWS のコストを情報を REST API で見てみる。(curl / Ansible)
https://vm.gowatana.jp/entry/2023/07/13/084828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment