【VMware Cloud Director】プロバイダーユーザーによるテナント情報の取得(API)

プロバイダーユーザーにてAPIを実行するとプロバイダー環境の情報のみが取得され、テナント環境の情報が取得できない場合がある

その際、ヘッダーにて”X-Vmware-Vcloud-Tenant-Context: {ORG_ID}”を指定すると、該当組織のテナント環境情報が取得できる。

例:ロール情報の取得

・ヘッダー無しの場合

# curl -k --header "Accept: application/*;version=37.0" --header "Authorization: Bearer xxx" --request GET https://172.16.20.20/cloudapi/1.0.0/roles

※レスポンス(プロバイダーのロールが出力される)
{
   "resultTotal":3,
   "pageCount":1,
   "page":1,
   "pageSize":25,
   "associations":null,
   "values":[
      {
         "name":"Defer to Identity Provider",
         "id":"urn:vcloud:role:8a11069f-d822-4591-9558-a3a2cb029df1",
         "description":"Rights will be determined based on information received from IDP",
         "bundleKey":"ROLE_DEFER_TO_IDP",
         "readOnly":true
      },
      {
         "name":"clone:System Administrator",
         "id":"urn:vcloud:role:ea28e568-9dc2-4373-9f5f-3f127e71609b",
         "description":"Built-in rights for administering this installation",
         "bundleKey":"com.vmware.vcloud.undefined.key",
         "readOnly":false
      },
      {
         "name":"System Administrator",
         "id":"urn:vcloud:role:67e119b7-083b-349e-8dfd-6cf0c19b83cf",
         "description":"Built-in rights for administering this installation",
         "bundleKey":"ROLE_SYSTEM_ADMINISTRATOR",
         "readOnly":true
      }
   ]
}

・ヘッダーありの場合

# curl -k --header "X-Vmware-Vcloud-Tenant-Context: 6ccb9c49-55f4-4591-83c3-c63b1e295287" --header"Accept: application/*;version=37.0" --header "Authorization: Bearer xxx" --request GET https://172.16.20.20/cloudapi/1.0.0/roles

※レスポンス(プロバイダーのロールが出力される)
{
   "resultTotal":7,
   "pageCount":1,
   "page":1,
   "pageSize":25,
   "associations":null,
   "values":[
      {
         "name":"Organization Administrator",
         "id":"urn:vcloud:role:38da3903-2149-30ac-a523-8e535480d094",
         "description":"Built-in rights for administering an organization",
         "bundleKey":"ROLE_ORGANIZATION_ADMINISTRATOR",
         "readOnly":true
      },
      {
         "name":"Catalog Author",
         "id":"urn:vcloud:role:03158989-6bc5-3f94-86bf-462ee51d5f1d",
         "description":"Rights given to a user who creates and publishes new catalogs",
         "bundleKey":"ROLE_CATALOG_AUTHOR",
         "readOnly":true
      },
      {
         "name":"vApp Author",
         "id":"urn:vcloud:role:f810ab9b-628e-3d36-8868-b04c3a188a5b",
         "description":"Rights given to a user who uses catalogs and creates vApps",
         "bundleKey":"ROLE_VAPP_AUTHOR",
         "readOnly":true
      },
      {
         "name":"vApp User",
         "id":"urn:vcloud:role:6aba7036-821f-374f-966f-f97d0a705315",
         "description":"Rights given to a user who uses vApps created by others",
         "bundleKey":"ROLE_VAPP_USER",
         "readOnly":true
      },
      {
         "name":"Console Access Only",
         "id":"urn:vcloud:role:0370fc96-7392-3801-9c1e-9366945d54e8",
         "description":"Rights given to a user who can only view virtual machine state and properties and use the guest OS",
         "bundleKey":"ROLE_CONSOLE_ACCESS_ONLY",
         "readOnly":true
      },
      {
         "name":"Defer to Identity Provider",
         "id":"urn:vcloud:role:656e8ef0-7527-356a-a25c-9cb9044a676b",
         "description":"Rights will be determined based on information received from IDP",
         "bundleKey":"ROLE_DEFER_TO_IDP",
         "readOnly":true
      },
      {
         "name":"clone:Organization Administrator",
         "id":"urn:vcloud:role:e32010df-22da-414a-b6fb-0e3625d378dd",
         "description":"Built-in rights for administering an organization",
         "bundleKey":"com.vmware.vcloud.undefined.key",
         "readOnly":false
      }
   ]
}

※ORG_IDの取得方法

# curl -k --header "Accept: application/*;version=37.0" --header "Authorization: Bearer xxx" --request GET https://172.16.20.20/api/org

※レスポンス(抜粋)
    <Org href="https://172.16.20.20/api/org/6ccb9c49-55f4-4591-83c3-c63b1e295287" type="application/vnd.vmware.vcloud.org+xml" name="ORG01"/>