VMware Cloud Community
legioon
Enthusiast
Enthusiast

How to get Vdc storage profile information where catalog located.

Hi all,

I have some catalogs in organization. ( Windows, Linux etc...).  I want to get the Vdc storage profile information where catalog located.

var reference = catalog.toAdminObject().catalogStorageProfiles.vdcStorageProfile;

var storageProfiles = vdcHost.getEntityByReference(VclFinderType.VDC_STORAGE_PROFILE, reference);

System.log(storageProfiles.name);

System.log(reference); returns " DynamicWrapper (Instance) : [VclObjectList]-[class com.vmware.vmo.plugin.vcloud.model.VCloudExtensibleListDecorator] -- VALUE : com.vmware.vmo.plugin.vcloud.model.VCloudExtensibleListDecorator@35ac2905"

vdcStorageProfile is reffering VclObjectList when click.

pastedImage_19.png

But, I need to reference of vdc storage profile like this ; DynamicWrapper (Instance) : [VclVdcStorageProfile]-[class com.vmware.vmo.plugin.vcloud.model.VdcStorageProfile] -- VALUE : com.vmware.vmo.plugin.vcloud.model.VdcStorageProfile@c0e8b9d8

What is wrong ?

Reply
0 Kudos
1 Reply
imtrinity94
Enthusiast
Enthusiast

You have to use method to convert reference to Object types. There is no other way.
 
 
//Input vdc of type vCloud:Vdc & vcdHost of Type vCloud:Host
//Code:
var vdcStorageProfile = vdc.vdcStorageProfiles.vdcStorageProfile;
var arr = vdcStorageProfile.enumerate();
for (var i = 0; i< arr.length; i++){
    System.log(arr[i]);
    System.log(vcdHost.getEntityByReference(VclFinderType.VDC_STORAGE_PROFILE, arr[i]));
}
//Output
2021-05-18 09:36:42.858 -04:00INFO__item_stack:/item1
2021-05-18 09:36:44.642 -04:00INFODynamicWrapper (Instance) : [VclReference]-[class com.vmware.vmo.plugin.vcloud.model.schema.objects.Reference] -- VALUE : com.vmware.vmo.plugin.vcloud.model.schema.objects.Reference@70919aa8
2021-05-18 09:36:47.549 -04:00INFODynamicWrapper (Instance) : [VclVdcStorageProfile]-[class com.vmware.vmo.plugin.vcloud.model.VdcStorageProfile] -- VALUE : com.vmware.vmo.plugin.vcloud.model.VdcStorageProfile@764dd78e
2021-05-18 09:36:47.553 -04:00INFODynamicWrapper (Instance) : [VclReference]-[class com.vmware.vmo.plugin.vcloud.model.schema.objects.Reference] -- VALUE : com.vmware.vmo.plugin.vcloud.model.schema.objects.Reference@37e424eb
2021-05-18 09:36:50.325 -04:00INFODynamicWrapper (Instance) : [VclVdcStorageProfile]-[class com.vmware.vmo.plugin.vcloud.model.VdcStorageProfile] -- VALUE : com.vmware.vmo.plugin.vcloud.model.VdcStorageProfile@595f66c2
2021-05-18 09:36:50.334 -04:00INFO__item_stack:/item0
 

Mayank Goyal
vRO Engineer
https://www.linkedin.com/in/mayankgoyal1994/
https://cloudblogger.co.in/
Reply
0 Kudos