Hi,
Some context:
To automate builds in Nutanix CALM, from within a jira workflow transition, we have to perform some API calls. With call A, we retreive some variables
FYI: call A: https://server.domain.com:9440/api/nutanix/v3/blueprints/ which allows us to retreive variable "deployment_create_list" amongst others.
if(cont){
try{
br = Utils.get(postCalmBluePrintApplicationProfileUrl+bluePrintUuid, authStr);
while ((input = br.readLine())!=null){
def jsonSlurper = new JsonSlurper();
def obj = jsonSlurper.parseText(input);
log.error("INFO "+obj.status.resources.app_profile_list[0].uuid);
appProfileUuid = obj.status.resources.app_profile_list[0].uuid;
for(def variable in obj.status.resources.app_profile_list[0].variable_list){
mappingVariables[variable.name]=variable.uuid;
}
SDLName = obj.spec.resources.substrate_definition_list[0].name
SDLUUID = obj.spec.resources.substrate_definition_list[0].uuid
projectUuid = obj.metadata.project_reference.uuid
deployment_in_bp = obj.spec.resources.app_profile_list[0].deployment_create_list;
}
br.close();
With call B, we start the automated build in Nutanix CALM. Parameter deployment_create_list is required.
Call B: https://server.domain.com:9440/api/nutanix/v3/blueprints/.
Issue:
The value that we retreive from the first call for deployment_create_list is a list, not JSON format:
[
[uuid:e12c83cc-bb59-4431-bafb-4c23442734bc, name:e64c0010_deployment, action_list: [], package_local_reference_list: [
[kind:app_package, name:Package1, uuid:c096e8f0-df68-484b-8537-b53553bcff23
]
], default_replicas: 1, depends_on_list: [], min_replicas: 1, published_service_local_reference_list: [], max_replicas: 1, substrate_local_reference: [kind:app_substrate, name:Windows, uuid: 5339883c-ddfa-4c8d-9046-e806d7563a94
], type:GREENFIELD, variable_list: [], description:
],
[uuid:a918774b-ae59-4e0b-894a-09d49a0bf3c9, name:e1c6e997_deployment, action_list: [], package_local_reference_list: [
[kind:app_package, name:Package2, uuid: 773890ad-ad1c-4ac8-a1e7-74ff26db7ec3
]
], default_replicas: 1, depends_on_list: [], min_replicas: 1, published_service_local_reference_list: [], max_replicas: 1, substrate_local_reference: [kind:app_substrate, name:Ansible MGMT VM, uuid:f61dd8f9-d9ba-407d-9f86-401a176f26c7
], type:GREENFIELD, variable_list: [], description:
]
]
Call B requires this value to be in JSON format.
Anyone an idea on how we can transform this value in the most simple way to JSON format? Looks like now we have to iterate through it to "manually" convert it to JSON.
Thank you in advance!