VMware Cloud Community
anoopvb
Enthusiast
Enthusiast
Jump to solution

Custom properties on a REST host?

Hi.

I was playing with vRA and noticed that REST hosts have a "custom properties" tab.

What is the purpose of these custom properties?

I was thinking about storing a user/pass as a custom property as well as some other data.

Is this what that's for? If so, how do i add custom properties?

and then how do i retrieve those custom properties in a script?

thank you.

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Server scripting object provides the following scripting API to work with custom properties:

// set the value of the custom property

var mypropvalue = ..;

Server.setCustomProperty(myobject, "mypropname", mypropvalue);

// retrieve the value of the custom property

var mypropvalue = Server.getCustomProperty(myobject, "mypropname");

// remove the custom property

Server.removeCustomProperty(myobject, "mypropname");

Above, myobject is the object you want to set the property on (eg. your REST host), mypropname is the name of the custom property, and mypropvalue is the value you want to set.

They are not specific to REST hosts; they are available to all vRO objects.

View solution in original post

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Server scripting object provides the following scripting API to work with custom properties:

// set the value of the custom property

var mypropvalue = ..;

Server.setCustomProperty(myobject, "mypropname", mypropvalue);

// retrieve the value of the custom property

var mypropvalue = Server.getCustomProperty(myobject, "mypropname");

// remove the custom property

Server.removeCustomProperty(myobject, "mypropname");

Above, myobject is the object you want to set the property on (eg. your REST host), mypropname is the name of the custom property, and mypropvalue is the value you want to set.

They are not specific to REST hosts; they are available to all vRO objects.

0 Kudos
anoopvb
Enthusiast
Enthusiast
Jump to solution

Ah ok. Thank you.

So i probably can't set it to be a securestring unless i do that part manually.

thank you.

0 Kudos