Search in sources :

Example 1 with UpdateLocationRequest

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

the class LocationsDefinitionsSteps method I_update_location_name_from_to_of_the_orchestrator.

@When("^I update location name from \"([^\"]*)\" to \"([^\"]*)\" of the orchestrator \"([^\"]*)\"$")
public void I_update_location_name_from_to_of_the_orchestrator(String locationName, String newName, String orchestratorName) throws Throwable {
    String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
    String locationId = getLocationIdFromName(orchestratorName, locationName);
    UpdateLocationRequest request = new UpdateLocationRequest();
    request.setName(newName);
    String restUrl = String.format("/rest/v1/orchestrators/%s/locations/%s", orchestratorId, locationId);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().putJSon(restUrl, JsonUtil.toString(request)));
}
Also used : UpdateLocationRequest(alien4cloud.rest.orchestrator.model.UpdateLocationRequest) When(cucumber.api.java.en.When)

Example 2 with UpdateLocationRequest

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

the class LocationSecretProviderSteps method iUseAsTheSecretProviderAndIUpdateTheConfigurationOfSecretProviderRelatedToTheLocationOfTheOrchestrator.

@And("^I use \"([^\"]*)\" as the secret provider and I update the configuration of secret provider related to the location \"([^\"]*)\" of the orchestrator \"([^\"]*)\"$")
public void iUseAsTheSecretProviderAndIUpdateTheConfigurationOfSecretProviderRelatedToTheLocationOfTheOrchestrator(String pluginName, String locationName, String orchestratorName, DataTable table) throws Throwable {
    String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
    String locationId = Context.getInstance().getLocationId(orchestratorId, locationName);
    String restUrl = String.format("/rest/v1/orchestrators/%s/locations/%s", orchestratorId, locationId);
    SecretProviderConfiguration secretProviderConfiguration = new SecretProviderConfiguration();
    secretProviderConfiguration.setPluginName(pluginName);
    Map<String, Object> configuration = DataTableUtils.dataTableToMap(table);
    // Read the certificate file by passing the path of this file
    configuration.put("certificate", new String(Files.readAllBytes(Paths.get((String) configuration.get("certificate")))));
    secretProviderConfiguration.setConfiguration(configuration);
    UpdateLocationRequest request = new UpdateLocationRequest();
    request.setName(locationName);
    request.setSecretProviderConfiguration(secretProviderConfiguration);
    String restResponse = Context.getRestClientInstance().putJSon(restUrl, JsonUtil.toString(request));
    Context.getInstance().registerRestResponse(restResponse);
}
Also used : UpdateLocationRequest(alien4cloud.rest.orchestrator.model.UpdateLocationRequest) SecretProviderConfiguration(alien4cloud.model.secret.SecretProviderConfiguration) And(cucumber.api.java.en.And)

Example 3 with UpdateLocationRequest

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

the class LocationsDefinitionsSteps method I_update_environment_type_to_of_the_location_of_the_orchestrator.

@When("^I update environment type to \"([^\"]*)\" of the location \"([^\"]*)\" of the orchestrator \"([^\"]*)\"$")
public void I_update_environment_type_to_of_the_location_of_the_orchestrator(String newEnvType, String locationName, String orchestratorName) throws Throwable {
    String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
    String locationId = getLocationIdFromName(orchestratorName, locationName);
    UpdateLocationRequest request = new UpdateLocationRequest();
    request.setEnvironmentType(newEnvType);
    String restUrl = String.format("/rest/v1/orchestrators/%s/locations/%s", orchestratorId, locationId);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().putJSon(restUrl, JsonUtil.toString(request)));
}
Also used : UpdateLocationRequest(alien4cloud.rest.orchestrator.model.UpdateLocationRequest) When(cucumber.api.java.en.When)

Aggregations

UpdateLocationRequest (alien4cloud.rest.orchestrator.model.UpdateLocationRequest)3 When (cucumber.api.java.en.When)2 SecretProviderConfiguration (alien4cloud.model.secret.SecretProviderConfiguration)1 And (cucumber.api.java.en.And)1