Search in sources :

Example 1 with SecretProviderCredentials

use of alien4cloud.deployment.model.SecretProviderCredentials in project alien4cloud by alien4cloud.

the class ApplicationsDeploymentStepDefinitions method iUpdateTheDeploymentWithTheFollowingCredentialsDefinedByTheSecretProviderPlugin.

@When("^I update the deployment with the following credentials defined by the secret provider plugin \"([^\"]*)\"$")
public void iUpdateTheDeploymentWithTheFollowingCredentialsDefinedByTheSecretProviderPlugin(String pluginName, DataTable table) throws Throwable {
    SecretProviderCredentials secretProviderCredentials = new SecretProviderCredentials();
    secretProviderCredentials.setPluginName(pluginName);
    secretProviderCredentials.setCredentials(DataTableUtils.dataTableToMap(table));
    doUpdateDeployment(ApplicationStepDefinitions.CURRENT_APPLICATION.getName(), null, secretProviderCredentials);
}
Also used : SecretProviderCredentials(alien4cloud.deployment.model.SecretProviderCredentials) When(cucumber.api.java.en.When)

Example 2 with SecretProviderCredentials

use of alien4cloud.deployment.model.SecretProviderCredentials in project alien4cloud by alien4cloud.

the class ApplicationDeploymentController method doDeploy.

private RestResponse<?> doDeploy(DeployApplicationRequest deployApplicationRequest, Application application, ApplicationEnvironment environment, Topology topology) {
    DeploymentTopologyDTO deploymentTopologyDTO = deploymentTopologyDTOBuilder.prepareDeployment(topology, application, environment);
    TopologyValidationResult validation = deploymentTopologyDTO.getValidation();
    // if not valid, then return validation errors
    if (!validation.isValid()) {
        return RestResponseBuilder.<TopologyValidationResult>builder().error(new RestError(RestErrorCode.INVALID_DEPLOYMENT_TOPOLOGY.getCode(), "The deployment topology for the application <" + application.getName() + "> on the environment <" + environment.getName() + "> is not valid.")).data(validation).build();
    }
    User deployer = AuthorizationUtil.getCurrentUser();
    // commit and push the deployment configuration data
    GitLocation location = gitLocationDao.findDeploymentSetupLocation(application.getId(), environment.getId());
    localGitManager.commitAndPush(location, deployer.getUsername(), deployer.getEmail(), "Deployment " + DateTime.now(DateTimeZone.UTC));
    // the request contains secret provider credentials?
    SecretProviderCredentials secretProviderCredentials = null;
    if (deployApplicationRequest.getSecretProviderCredentials() != null && deployApplicationRequest.getSecretProviderPluginName() != null) {
        secretProviderCredentials = new SecretProviderCredentials();
        secretProviderCredentials.setCredentials(deployApplicationRequest.getSecretProviderCredentials());
        secretProviderCredentials.setPluginName(deployApplicationRequest.getSecretProviderPluginName());
    }
    // process with the deployment
    deployService.deploy(deployer, secretProviderCredentials, deploymentTopologyDTO.getTopology(), application);
    return RestResponseBuilder.<Void>builder().build();
}
Also used : TopologyValidationResult(alien4cloud.topology.TopologyValidationResult) SecretProviderCredentials(alien4cloud.deployment.model.SecretProviderCredentials) User(alien4cloud.security.model.User) RestError(alien4cloud.rest.model.RestError) DeploymentTopologyDTO(alien4cloud.deployment.DeploymentTopologyDTO) GitLocation(org.alien4cloud.git.model.GitLocation)

Aggregations

SecretProviderCredentials (alien4cloud.deployment.model.SecretProviderCredentials)2 DeploymentTopologyDTO (alien4cloud.deployment.DeploymentTopologyDTO)1 RestError (alien4cloud.rest.model.RestError)1 User (alien4cloud.security.model.User)1 TopologyValidationResult (alien4cloud.topology.TopologyValidationResult)1 When (cucumber.api.java.en.When)1 GitLocation (org.alien4cloud.git.model.GitLocation)1