VMware Cloud Community
iguy
Enthusiast
Enthusiast

How to go from Service Name to acquire the Blueprint ID?

I've been working on an ansible module for vRA to use internally in a reasonably flexible way.  Since the REST API utilizes a payload approach I can setup the flow to work well with vRA so far following the lifecycle of a request.  The challenge I run into is the (this could be the wrong terminology) blueprint ID name does not match the service name and I see no way via the API today to find this relationship.  

The example code here is a good example:
 

https://gist.github.com/55a18615fac6c659e3e7524090efe605  (Basically the question is where does vSphere_Machine_1 come from and how can I get it programmatically?)

Efffectively:

1. Login and get a Bearer Token
2. Get the catalog views for an ODATA query based on the name of the request (this is the name you see in the UI in the portal)

3. Get that request template using the ID from the previous request

Then everything I"ve seen before to navigate down into the JSON for this request, it has something that is effectively the blueprint ID (which is not the GUID of the request).   This can look something like this:
 

 "reasons": null,
    "data": {
        "CENTOS_7_POSIX": {
            "componentTypeId": "com.vmware.csp.component.cafe.composition",
            "componentId": null,
            "classId": "Blueprint.Component.Declaration",

 --- 

...[some header json]

    "data": {

        "CENTOS_7_POSIX": {

            "componentTypeId": "com.vmware.csp.component.cafe.composition",

  ... [lots more json]

}

---

Then to update and use this request I need to be able to reference the "CENTOS_7_POSIX".  

ie.  $Form.data.CENTOS_7_POSIX.data.cpu = 12

 

How do I find the translation table in the API from the name of the service request to what CENTOS_7_POSIX equivalent is?  

0 Kudos
1 Reply
rwk1982
Enthusiast
Enthusiast

Hello!

The "vSphere_Machine_1" is the Name of one Component of the Blueprint and its defined by the user who created the Blueprint (in your Case: CENTOS_7_POSIX). A Blueprint can have more than one Component but the Name must be unique within one Blueprint. You can get all Component Names from the json response with "$Form.data.psobject.properties.name".

Robert

Drink coffee.. Do stupid things faster with more energy...
0 Kudos