use of alien4cloud.rest.application.model.SetLocationPoliciesRequest in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method I_Set_the_following_location_policies_for_groups.
@When("^I Set the following location policies with orchestrator \"([^\"]*)\" for groups$")
public void I_Set_the_following_location_policies_for_groups(String orchestratorName, Map<String, String> locationPolicies) throws Throwable {
SetLocationPoliciesRequest request = new SetLocationPoliciesRequest();
String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
request.setOrchestratorId(orchestratorId);
Map<String, String> formatedPolicies = Maps.newHashMap();
for (Entry<String, String> entry : locationPolicies.entrySet()) {
formatedPolicies.put(entry.getKey(), Context.getInstance().getLocationId(orchestratorId, entry.getValue()));
}
request.setGroupsToLocations(formatedPolicies);
Application application = Context.getInstance().getApplication();
String environmentId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
String restUrl = String.format("/rest/v1/applications/%s/environments/%s/deployment-topology/location-policies", application.getId(), environmentId);
String response = Context.getRestClientInstance().postJSon(restUrl, JsonUtil.toString(request));
Context.getInstance().registerRestResponse(response);
}
Aggregations