daniyalahmad
Contributor
Contributor

vCD sdk finding provider vdc

Hi,

Is there a way we could find the provider VDC for a given VDC?

I looked into com.vmware.vcloud.sdk.Vdc object but couldn't find it.

Thanks

Daniyal

Tags (2)
0 Kudos
4 Replies
rkamal
VMware Employee
VMware Employee

Vdc is the User API helper class.

Try AdminVdc -> getProviderVdcRef();

Regards,

Rajesh Kamal.

daniyalahmad
Contributor
Contributor

Thanks for the reply Rajesh.

What would be the correct approach to go by the vdc-helper-class to obtain the admin object on a specific VDC?

0 Kudos
rkamal
VMware Employee
VMware Employee

You can create the vdc, adminvdc helper clases using the reference or id.

Vdc -> getVdcByReference(client, vdcRef)

       -> getVdcById(client, vdcId)

AdminVdc -> getAdminVdcByReference(client, adminVdcRef)

                -> getAdminVdcById(client, adminVdcId)

vdcRef, adminVdcRef - from Organization, AdminOrg helper classes.

These can also be searched/queried using the query service. Refer to the query service sample.

vdcId, adminVdcId - from Vdc, AdminVdc -> getResource() -> getId()

These can also be searched/queried using the query service. Refer to the query service sample.

daniyalahmad
Contributor
Contributor

Thanks Rajesh for your suggestions, I was able to find the Provider VDC for a specific VDC by playing around with the admin vdc object:

VcloudAdmin vcloudAdmin = vcloudClient

.getVcloudAdmin();

for (ReferenceType adminOrgRef : vcloudAdmin.getAdminOrgRefs()) {

AdminOrganization adminOrg = AdminOrganization.getAdminOrgByReference(vcloudClient, adminOrgRef);

System.

out.println("Organization Name::adminOrgRef.getName(): " + adminOrgRef.getName());

for (ReferenceType adminVdcRef : adminOrg.getAdminVdcRefs()) {

AdminVdc adminVdc = AdminVdc.getAdminVdcByReference(vcloudClient, adminVdcRef);

System.

out.println("VDC name::adminVdc.getProviderVdcRef().getName() = " + adminVdc.getResource().getName());

System.

out.println("Provider VDC name::adminVdc.getProviderVdcRef().getName() = " + adminVdc.getProviderVdcRef().getName());

}

}

0 Kudos