VMware {code} Community
damienalbert
Contributor
Contributor

Implementation of vCloud Extensibility with vRealize Orchestration

Hello, i'm trying to implement an extension of vCloud Director API based on this material: https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/vcat/vmware-vcloud-api-extension-w... but with a vRealize Orchestrator Implementation

My example handle a request originated by the AMQP broker but i don't figure how to correctly responds back to vCD.

Here is the Javascript of the code i used in the workflow:

var props = subscription.retrieveLastOnMessageTrigger();

var messageBody = props.body;

var headers = props.headers;

var properties = props.properties;

var reply_to = props.properties.reply_to;

var replyToExchange = props.headers.replyToExchange;

var correlation_id = props.properties.correlation_id;

var replyToRoutingKey = props.properties.replyToRoutingKey;

var id = JSON.parse(props.body)[0].id;

var user = JSON.parse(props.body)[1].user;

var org = JSON.parse(props.body)[1].org;

System.log("id : " + id);

System.log("user : " + user);

System.log("replyToRoutingKey : " + replyToRoutingKey);

System.log("correlation_id : " + correlation_id);

System.log("replyToExchange : " + replyToExchange);

System.log("reply_to : " + reply_to);

System.log("headers : "+headers.keys)

System.log("properties : "+properties.keys)

System.log("messageBody : "+messageBody)

System.log("#################");

var respHeaders = {"Content-Type":"application/vnd.vmware.vcloud.org+xml;version=30.0"};

var msg = new AMQPMessage();

var prop = new Properties();

prop.put("correlation_id", correlation_id);

msg.properties = prop;

var body = [{"id":id, "headers":{"Content-Type":"application/vnd.vmware.vcloud.org+xml;version=30.0"}, "request":false, "statusCode":200}];

msg.bodyAsText = JSON.stringify(body);

System.log("msg : " + msg);

broker.send(replyToExchange, replyToRoutingKey, msg);

broker.send(replyToExchange, "testResponse", msg);

Has someone deal with this kind of implementation (API extensibility) with vRO ? Some hint about the correct Javascript syntax ?

Thanks

Regards,

Damien ALBERT

0 Kudos
0 Replies