use of alien4cloud.model.deployment.Deployment in project alien4cloud by alien4cloud.
the class ApplicationDeploymentController method getSecretProviderConfigurationsForCurrentDeployment.
@ApiOperation(value = "Get current secret provider configuration for the given application on the given cloud.", notes = "Application role required [ APPLICATION_MANAGER | APPLICATION_DEVOPS ] and Application environment role required [ DEPLOYMENT_MANAGER ]")
@RequestMapping(value = "/{applicationId:.+}/environments/{applicationEnvironmentId}/current-secret-provider-configurations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
public RestResponse<List<SecretCredentialInfo>> getSecretProviderConfigurationsForCurrentDeployment(@PathVariable String applicationId, @PathVariable String applicationEnvironmentId) {
Application application = applicationService.checkAndGetApplication(applicationId);
// get the topology from the version and the cloud from the environment
ApplicationEnvironment environment = applicationEnvironmentService.getEnvironmentByIdOrDefault(application.getId(), applicationEnvironmentId);
AuthorizationUtil.checkAuthorizationForEnvironment(application, environment, ApplicationEnvironmentRole.APPLICATION_USER);
Deployment deployment = deploymentService.getActiveDeployment(environment.getId());
List<SecretCredentialInfo> secretProviderConfigurations = Lists.newArrayList();
for (int i = 0; i < deployment.getLocationIds().length; i++) {
Location location = locationService.getOrFail(deployment.getLocationIds()[i]);
if (location.getSecretProviderConfiguration() != null) {
secretProviderConfigurations.add(secretProviderService.getSecretCredentialInfo(location.getSecretProviderConfiguration().getPluginName(), location.getSecretProviderConfiguration().getConfiguration()));
}
}
return RestResponseBuilder.<List<SecretCredentialInfo>>builder().data(secretProviderConfigurations).build();
}
use of alien4cloud.model.deployment.Deployment in project alien4cloud by alien4cloud.
the class ApplicationDeploymentController method getActiveDeployment.
/**
* Get only the active deployment for the given application on the given cloud
*
* @param applicationId id of the topology
* @return the active deployment
*/
@ApiOperation(value = "Get active deployment for the given application on the given cloud.", notes = "Application role required [ APPLICATION_MANAGER | APPLICATION_DEVOPS ] and Application environment role required [ DEPLOYMENT_MANAGER ]")
@RequestMapping(value = "/{applicationId:.+}/environments/{applicationEnvironmentId}/active-deployment", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
public RestResponse<Deployment> getActiveDeployment(@PathVariable String applicationId, @PathVariable String applicationEnvironmentId) {
Application application = applicationService.checkAndGetApplication(applicationId);
// get the topology from the version and the cloud from the environment
ApplicationEnvironment environment = applicationEnvironmentService.getEnvironmentByIdOrDefault(application.getId(), applicationEnvironmentId);
AuthorizationUtil.checkAuthorizationForEnvironment(application, environment, ApplicationEnvironmentRole.APPLICATION_USER);
Deployment deployment = deploymentService.getActiveDeployment(environment.getId());
return RestResponseBuilder.<Deployment>builder().data(deployment).build();
}
use of alien4cloud.model.deployment.Deployment in project alien4cloud by alien4cloud.
the class RuntimeController method getNonNativesNodes.
@ApiOperation(value = "Get non-natives node template of a topology.", notes = "Returns An map of non-natives {@link NodeTemplate}. Application role required [ APPLICATION_MANAGER | DEPLOYMENT_MANAGER ]")
@RequestMapping(value = "/{applicationId:.+?}/environment/{applicationEnvironmentId:.+?}/nonNatives", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
public RestResponse<Map<String, NodeTemplate>> getNonNativesNodes(@PathVariable String applicationId, @PathVariable String applicationEnvironmentId) {
Application application = applicationService.getOrFail(applicationId);
ApplicationEnvironment environment = applicationEnvironmentService.getEnvironmentByIdOrDefault(applicationId, applicationEnvironmentId);
AuthorizationUtil.checkAuthorizationForEnvironment(application, environment);
Deployment deployment = deploymentService.getActiveDeploymentOrFail(environment.getId());
DeploymentTopology deploymentTopology = deploymentRuntimeStateService.getRuntimeTopology(deployment.getId());
Map<String, NodeTemplate> nonNativesNode = topologyTreeBuilderService.getNonNativesNodes(deploymentTopology);
return RestResponseBuilder.<Map<String, NodeTemplate>>builder().data(nonNativesNode).build();
}
Aggregations