1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

12. IBM Cloud: VMware as a Service(VMWaaS) - VMWaaS APIの実行例

Last updated at Posted at 2024-03-14

1. はじめに

今まで色々な作業をVMware Console(VMware Cloud Director)を使って操作してきましたが、作業内容によってはAPIを使った自動化作業を実施したいということもあるでしょう。今回は、VMware as a ServiceのAPIを呼び出す方法を紹介したいと思います。

過去の記事はこちら。

2. 実行例

  • VMware as a ServiceにはCLIが存在しないので、直接APIを呼び出す必要がある。
  • VMware as a ServiceのAPI Referenceはこちら
  • IBM Cloud のIAM tokenの取得方法はこちらを参照。
IAM tokenの取得方法
$ APIKEY=xxxxxx
$ iam_token=`curl -sX POST \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=${APIKEY}" \
  https://iam.cloud.ibm.com/identity/token | jq -r '.access_token' `
$ echo ${iam_token}
VMWaaS APIの実行例
$ curl -X GET 'https://api.us-south.vmware.cloud.ibm.com/v1/director_sites' -H "authorization: Bearer ${iam_token}" -H 'Content-Type:application/json'
{
  "director_sites": [
    {
      "crn": "crn:v1:bluemix:public:vmware:us-south:a/f7ae49cc04f348edb34ac01af90ee00e::directorsite:40e701cd-ef86-4d5e-a847-e7c336f11f27",
      "enable_vcda": true,
      "href": "https://api.us-south.vmware.cloud.ibm.com/director_sites/40e701cd-ef86-4d5e-a847-e7c336f11f27",
      "id": "40e701cd-ef86-4d5e-a847-e7c336f11f27",
      "ip_allow_list": [],
      "name": "IBM VMwaaS Multitenant - DAL",
      "ordered_at": "2023-08-30T21:06:09.100407+00:00",
      "private_only": false,
      "provisioned_at": "2023-09-08T21:19:36.140204+00:00",
      "pvdcs": [
        {
          "data_center_name": "dal10",
          "href": "https://api.us-south.vmware.cloud.ibm.com/director_sites/40e701cd-ef86-4d5e-a847-e7c336f11f27/pvdcs/f864f016-2c34-4658-95e7-dd3363408d76",
          "id": "f864f016-2c34-4658-95e7-dd3363408d76",
          "name": "DAL10",
          "private_only": false,
          "provider_types": [
            {
              "name": "on_demand"
            },
            {
              "name": "reserved"
            }
          ],
          "provisioned_at": "2023-09-27T17:59:35.433022+00:00"
        },
        {
          "data_center_name": "dal12",
          "href": "https://api.us-south.vmware.cloud.ibm.com/director_sites/40e701cd-ef86-4d5e-a847-e7c336f11f27/pvdcs/5b4af31c-383b-422b-b297-0ea6ed8af479",
          "id": "5b4af31c-383b-422b-b297-0ea6ed8af479",
          "name": "DAL12",
          "private_only": false,
          "provider_types": [
            {
              "name": "on_demand"
            },
            {
              "name": "reserved"
            }
          ],
          "provisioned_at": "2023-08-30T21:06:09.117160+00:00"
        }
      ],
      "resource_group": {
        "crn": "crn:v1:bluemix:public:resource-controller::a/f7ae49cc04f348edb34ac01af90ee00e::resource-group:224c64825a154252a864241890de793e",
        "id": "224c64825a154252a864241890de793e",
        "name": "Dallas MZR"
      },
      "rhel_vm_activation_key": "ic4v_vmwaas_8ed285a1-b804-4f6c-bad7-783b25605194",
      "services": [],
      "status": "ready_to_use",
      "type": "multitenant"
    }
  ]
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?