Search in sources :

Example 1 with CreateLocationResourceTemplateRequest

use of alien4cloud.rest.orchestrator.model.CreateLocationResourceTemplateRequest in project alien4cloud by alien4cloud.

the class AbstractLocationResourceSteps method createResourceTemplate.

public void createResourceTemplate(String resourceType, String resourceName, String archiveName, String archiveVersion, String orchestratorName, String locationName) throws IOException {
    String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
    String locationId = Context.getInstance().getLocationId(orchestratorId, locationName);
    String restUrl = String.format(getBaseUrlFormat(), orchestratorId, locationId);
    CreateLocationResourceTemplateRequest request = new CreateLocationResourceTemplateRequest();
    request.setResourceName(resourceName);
    request.setResourceType(resourceType);
    request.setArchiveName(archiveName);
    request.setArchiveVersion(archiveVersion);
    String resp = Context.getRestClientInstance().postJSon(restUrl, JsonUtil.toString(request));
    RestResponse<LocationResourceTemplateWithDependencies> response = JsonUtil.read(resp, LocationResourceTemplateWithDependencies.class, Context.getJsonMapper());
    if (response.getError() == null && response.getData() != null) {
        Context.getInstance().registerOrchestratorLocationResource(orchestratorId, locationId, response.getData().getResourceTemplate().getId(), resourceName);
    }
    Context.getInstance().registerRestResponse(resp);
}
Also used : CreateLocationResourceTemplateRequest(alien4cloud.rest.orchestrator.model.CreateLocationResourceTemplateRequest) LocationResourceTemplateWithDependencies(alien4cloud.model.orchestrators.locations.LocationResourceTemplateWithDependencies)

Aggregations

LocationResourceTemplateWithDependencies (alien4cloud.model.orchestrators.locations.LocationResourceTemplateWithDependencies)1 CreateLocationResourceTemplateRequest (alien4cloud.rest.orchestrator.model.CreateLocationResourceTemplateRequest)1