vRealize Orchestrator (vRO) Using Configuration Element Programmatically

We learned how to use the Configuration Element in my previous blog post. If you remember, it has created subfolders under the parent folder using the configuration element. In the previous article, we used the configuration element manually. Now, we will learn the configuration element in a programmable way.

Let’s Start Coding ­čÖé

I created a configuration element that has IP address and hostname attributes.

I created a workflow that adds IP address and hostname of the VM to the configuration element. First, I added the configuration element to the attribute. Now I can access this element with Scriptable task. Don’t forget to bind the element to Scriptable task.

The setAttributeWithKey function is contained in the ConfigurationElement class. Sets the attribute value of the configuration element for the specified key. Prototype is void setAttributeWithKey(string key , Object value , Object typeHint). typeHint is an optional parameter that allows you to specify the desired type of the configuration attribute. In this step, I added IP address and hostname of the VM to the configuration element.

getAttributeWithKey function returns the attribute of the configuration element for the specified key. Prototype is Attribute getAttributeWithKey(string key).

Let’s Run the Workflow

I choose the Virtual Machine.

Workflow worked and wrote the information to the Logs tab.

I check the attributes of the configuration element.

That’s all. We can now store the information of the virtual machine in a configuration element. You can find the workflow I wrote in this article on my GitHub.

Hopefully this post has been informative for you. If you have a question, opinion or request about the article, you can contact us from the comments below or my email address. If you think this post is informative to others, be social and share it on social media! Thank you for reading !!

Leave a Reply

Your email address will not be published. Required fields are marked *