Set Mime Type for Resource Element in vRealize Orchestrator

A resource element allows for the use of external objects as attributes in workflows created independently of vRealize Orchestrator. For example, items such as JSON templates.  By importing the external object as a resource element allows for changes to the object and for those changes to be propagated to all workflows that use the resource elements.

When importing the external object as a resource element, the mime type is set from the content of the external object. In some instances, the mime type maybe incorrectly set during the initial import of the external object as a resource. So how do you we update this to be the correct type?

Unfortunately this is not available from vRealize Orchestrator UI, so for my use case I created a module action that will allow for the mime type to updated and set to the correct type. The module action requires for the resource element and the mime type to be specified as input parameters. For a valid list of mime types, refer to Basics of HTTP – Mime Types

In this instance I am going to run the workflow that executes the module action, to set an existing resource element that has been previously imported named ‘Test Resource Element.json’ which has the mime type set to ‘application/octect-stream’ to a mime type of ‘text/plain’.

Following successful execution of the workflow, we can confirm that the mime type of the resource element has now been updated to ‘text/plain’ as per the console log output from the mime type of the resource element.

[2017-09-13 17:19:21.130] [D] The resource element Test Resource Element.json has been returned with the mime type application/octet-stream
[2017-09-13 17:19:21.156] [I] The resource element Test Resource Element.json mime type type has been set to text/plain

The package which contains the module action and workflow item is available at com.deangrant.library.vro

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s