VMware Cloud Community
ransalman
Contributor
Contributor
Jump to solution

Get vCloud VM Custom Properties

Hi

I'm trying to get the custom properties (product section) from a vCloud VM via the api, I can get the label and description but the value I get is undefined.

When trying to retrieve the custom proporties via vmtoolsd inside the guest os I can see the value as it should be but I need to get the value from the vCo via vCloud API.

Thanks.

Reply
0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Hi,

To get a value I do like this:

if ((!vApp) || !(parameterKey)) {
    return null;
}
//System.log(vApp.toXml());
var productSections = vApp.getProductSections();

for each ( var productSection in productSections) {
    var catList = productSection.categoryOrProperty;
    var elements = catList.find(new VclProductSectionProperty()) ;
    for each ( var cat in elements ) {
        if ( cat.key == parameterKey ) {
            return cat.valueAttrib;
        }
    }
}
return null;

This is inside a "getVAppCustomParameterValue" action with vApp and parameterKey as an input and a string returned.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

Reply
0 Kudos
3 Replies
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Hi,

To get a value I do like this:

if ((!vApp) || !(parameterKey)) {
    return null;
}
//System.log(vApp.toXml());
var productSections = vApp.getProductSections();

for each ( var productSection in productSections) {
    var catList = productSection.categoryOrProperty;
    var elements = catList.find(new VclProductSectionProperty()) ;
    for each ( var cat in elements ) {
        if ( cat.key == parameterKey ) {
            return cat.valueAttrib;
        }
    }
}
return null;

This is inside a "getVAppCustomParameterValue" action with vApp and parameterKey as an input and a string returned.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
ransalman
Contributor
Contributor
Jump to solution

Thanks!

Reply
0 Kudos
Deva77340
Contributor
Contributor
Jump to solution

Hi Christophe,

How do you get any information in tab Guest Properties from vApp ?

Regards,

Reply
0 Kudos