I'm trying to use this to lookup a catalog resource by its requestId but I get an error saying "Invalid data access API usage exception raised during retrieving data" . This is how I put together the request:
var service = host.createCatalogClient().getCatalogConsumerResourceService();
var filter = new Array();
filter[0] = vCACCAFEFilterParam.equal("requestId", vCACCAFEFilterParam.string(requestId));
var query = vCACCAFEOdataQuery.query().addFilter(filter);
var items = service.getResourcesList(new vCACCAFEPageOdataRequest(query))
Any clue why this throws this error? Seems like it should work.
I also tried using the request service
var requestService = host.createCatalogClient().getCatalogConsumerRequestService();
var resources = requestService.getResourcesProvisionedByRequest(requestId);
But I'm not sure where to go with the result. The result is a com.vmware.vcac.platform.rest.client.services.PagedResourcesWrapper which I am not sure how to handle.
Hello
I may be wrong but it seams you forget ",null" here the var resources = requestService.getResourcesProvisionedByRequest(requestId);
From my understanding of your needs yo,u should look at this (https://www.helloitscraig.co.uk/2016/03/get-resources-provisioned-vra-request.html and vRO API Explorer by Flores and Dr Ruurd of ITQ😞
/*
Name: getResourcesProvisionedByRequest
Input: vCACCAFEHost - vCACCAFE:VCACHost
Input: requestId - String
Output: void
Description: Get catalog item resources provisioned from a request
*/
var _requestId = "bc147f2c-1995-442b-8fc9-c769ec9bf9f4";
//Create an instance of vCACCAFECatalogClient
var _client = vCACCAFEHost.createCatalogClient();
//Create an instance of vCACCAFECatalogConsumerRequestService
var _requestService = _client.getCatalogConsumerRequestService();
//getResourcesProvisionedByRequest returns type vCACCAFEPagedResources .getContent() will return an array of vCACCAFECatalogResource
var _resources = _requestService.getResourcesProvisionedByRequest(_requestId, null).getContent();
//Loop through results
for (var i = 0; i < _resources.length; i++){
System.log("Id: " + _resources[i].id);
System.log("Name: " + _resources[i].name);
}
Hello
I may be wrong but it seams you forget ",null" here the var resources = requestService.getResourcesProvisionedByRequest(requestId);
From my understanding of your needs yo,u should look at this (https://www.helloitscraig.co.uk/2016/03/get-resources-provisioned-vra-request.html and vRO API Explorer by Flores and Dr Ruurd of ITQ😞
/*
Name: getResourcesProvisionedByRequest
Input: vCACCAFEHost - vCACCAFE:VCACHost
Input: requestId - String
Output: void
Description: Get catalog item resources provisioned from a request
*/
var _requestId = "bc147f2c-1995-442b-8fc9-c769ec9bf9f4";
//Create an instance of vCACCAFECatalogClient
var _client = vCACCAFEHost.createCatalogClient();
//Create an instance of vCACCAFECatalogConsumerRequestService
var _requestService = _client.getCatalogConsumerRequestService();
//getResourcesProvisionedByRequest returns type vCACCAFEPagedResources .getContent() will return an array of vCACCAFECatalogResource
var _resources = _requestService.getResourcesProvisionedByRequest(_requestId, null).getContent();
//Loop through results
for (var i = 0; i < _resources.length; i++){
System.log("Id: " + _resources[i].id);
System.log("Name: " + _resources[i].name);
}
Thank you! It was the missing parameter. I sure wish that was handled more gracefully!
Do you know if they are a similar method to get the same information, but for a request in progress ?
When I run this solution in a In progress request, I don't get any information After the request was approved by my post approval policy, I run the same workflow and all the ressources are there. It's like we need to finish successfully the deployment to get the ressource information of the request.
When I use the "Post Aproval Policy" my EB just show a couple of information, but not the ressources Ex. VM Name. And as the VM Name is assigned dinamically, I don't have this information in the request.
Thanks
To the best of my knowledge no catalog resource exists until after the request is complete. I have some activities that just query the request status and once completed then grab the resource.