Quantcast
Channel: VMware Communities : All Content - vRealize Automation Tools
Viewing all articles
Browse latest Browse all 9859

vRA 7 - requestCatalogItem and Pass Properties to Blueprint Component

$
0
0

In vRA 6.x we wrap all of our IaaS blueprints with ASD and ultimately deployed VMs using Action item “requestCatalotItem” from a vRO workflow.  Since all of our IaaS blueprints in 6.x included a single vSphere VM, we simply build the Properties input value for requestCatalogItem using “put” for each key/value pair:

var inputs = new Properties();

  1. inputs.put("provider-blueprintId", "1fb93e9b-7aa6-4c85-a427-560361467f94");
  2. inputs.put("provider-VirtualMachine.Admin.Owner", new vCACCAFEStringLiteral(requestedFor).getValue());
  3. Etc.

 

In vRA 7 the virtual machine blueprint is now one component of a deployment.  A simple request now looks something like:

 

    {

"@type": "CatalogItemRequest",

"id": "144e6880-1e89-4b0d-8029-8490d2942d6f",

"iconId": "00a5dcbd-f65b-46eb-802f-96badc1bf17a",

"version": 6,

"requestNumber": 366,

"state": "SUCCESSFUL",

"description": "",

"reasons": "",

"requestedFor": "svc-vcloud@xxxxxxx",

"requestedBy": "svc-vcloud@xxxxxxx",

"organization":

        {

"tenantRef": "vsphere.local",

"tenantLabel": "vsphere.local",

            "subtenantRef": "aad7014e-425e-490b-818b-64548afbc22e",

"subtenantLabel": "Test Group"

        },

"requestorEntitlementId": "59a31e5e-c9ae-477b-82a3-17d9b8bc6946",

"preApprovalId": null,

"postApprovalId": null,

        "dateCreated": "2016-01-30T04:15:26.144Z",

"lastUpdated": "2016-01-30T04:24:19.267Z",

"dateSubmitted": "2016-01-30T04:15:26.144Z",

"dateApproved": null,

"dateCompleted": "2016-01-30T04:24:19.267Z",

"quote":

        {

        },

"requestCompletion":

        {

"requestCompletionState": "SUCCESSFUL",

"completionDetails": "",

"resourceBindingIds": null

        },

"requestData":

        {

"entries":

            [

               {

                    "key": "provider-CentOS_6.5",

                    "value":

                    {

                        "type": "complex",

"componentTypeId": null,

"componentId": null,

                        "classId": "UNKNOWN",

                        "typeFilter": null,

                        "values":

                        {

"entries":

                            [

                                {

                                    "key": "cpu",

"value":

                                    {

"type": "integer",

"value": 2

                                    }

                                },

                                {

"key": "memory",

"value":

                                    {

"type": "integer",

"value": 2048

                                    }

                                },

                                {

                                    "key": "storage",

"value":

                                    {

"type": "integer",

"value": 20

                                    }

                                }

                            ]

                        }

                    }

                }

            ]

        },

"retriesRemaining": 3,

"requestedItemName": "DEV CentOS_6.5",

"requestedItemDescription": "",

"components": null,

"stateName": "Successful",

"catalogItemProviderBinding":

        {

"bindingId": "vsphere.local!::!CloneCentOS65",

"providerRef":

            {

"id": "19eb1719-f6b8-4a9f-8e03-2b3d8fbb8f1c",

"label": "Blueprint Service"

            }

        },

"executionStatus": "STOPPED",

"waitingStatus": "NOT_WAITING",

"approvalStatus": "POST_APPROVED",

        "phase": "SUCCESSFUL",

"catalogItemRef":

        {

"id": "00a5dcbd-f65b-46eb-802f-96badc1bf17a",

"label": "DEV CentOS_6.5"

        }

    }

 

What I’m struggling to do in version 7 is add key/value pairs to the entries array of the blueprint component, provider-CentOS_6.5 in the example above (red text). 

For example, if I want to add a key/value pair in 6.x I would use “ inputs.put("provider-Custom.Cmdb.PatchWeek", new vCACCAFEStringLiteral(patchWeek).getValue());”. Doing this in version 7 you end up with the property assigned to requestData instead of added to entries under "key": "provider-CentOS_6.5".

I’m sure it’s possible to do this in version 7 using vRO and requestCatalogItem but I’m struggling to get my code to work. 

 

Does anyone have suggestions for adding properties to a component within a deployment using a method similar to what I did in 6.x?


Viewing all articles
Browse latest Browse all 9859

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>