use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class AutoscaleV4Controller method stopInstancesForClusterCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.SCALE_DATAHUB)
public void stopInstancesForClusterCrn(@TenantAwareParam @ResourceCrn String clusterCrn, @NotEmpty List<String> instanceIds, Boolean forced, ScalingStrategy scalingStrategy) {
LOGGER.info("stopInstancesForClusterCrn. ScalingStrategy={}, forced={}, clusterCrn={}, instanceIds=[{}]", scalingStrategy, forced, clusterCrn, instanceIds);
stackCommonService.stopMultipleInstancesInWorkspace(NameOrCrn.ofCrn(clusterCrn), restRequestThreadLocalService.getRequestedWorkspaceId(), new HashSet(instanceIds), forced);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class EnvironmentController method updateAwsDiskEncryptionParametersByEnvironmentCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.UPDATE_AWS_DISK_ENCRYPTION_PARAMETERS)
public DetailedEnvironmentResponse updateAwsDiskEncryptionParametersByEnvironmentCrn(@ValidCrn(resource = CrnResourceDescriptor.ENVIRONMENT) @ResourceCrn String crn, @RequestObject @Valid UpdateAwsDiskEncryptionParametersRequest request) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
UpdateAwsDiskEncryptionParametersDto dto = environmentApiConverter.convertUpdateAwsDiskEncryptionParametersDto(request);
EnvironmentDto result = environmentModificationService.updateAwsDiskEncryptionParametersByEnvironmentCrn(accountId, crn, dto);
return environmentResponseConverter.dtoToDetailedResponse(result);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class ImageCatalogV4Controller method getByCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_IMAGE_CATALOG)
public ImageCatalogV4Response getByCrn(Long workspaceId, @ResourceCrn String crn, Boolean withImages) {
ImageCatalog catalog = imageCatalogService.getImageCatalogByName(NameOrCrn.ofCrn(crn), restRequestThreadLocalService.getRequestedWorkspaceId());
ImageCatalogV4Response imageCatalogResponse = imageCatalogToImageCatalogV4ResponseConverter.convert(catalog);
Images images = imageCatalogService.propagateImagesIfRequested(restRequestThreadLocalService.getRequestedWorkspaceId(), catalog.getName(), withImages);
if (images != null) {
imageCatalogResponse.setImages(imagesToImagesV4ResponseConverter.convert(images));
}
return imageCatalogResponse;
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class RecipesV4Controller method deleteByCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_RECIPE)
public RecipeV4Response deleteByCrn(Long workspaceId, @NotNull @ResourceCrn String crn) {
Recipe deleted = recipeService.delete(NameOrCrn.ofCrn(crn), restRequestThreadLocalService.getRequestedWorkspaceId());
notify(ResourceEvent.RECIPE_DELETED);
return recipeToRecipeV4ResponseConverter.convert(deleted);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class BlueprintV4Controller method deleteByCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_CLUSTER_TEMPLATE)
public BlueprintV4Response deleteByCrn(Long workspaceId, @NotNull @ResourceCrn @TenantAwareParam String crn) {
Blueprint deleted = blueprintService.deleteByWorkspace(NameOrCrn.ofCrn(crn), restRequestThreadLocalService.getRequestedWorkspaceId());
notify(ResourceEvent.BLUEPRINT_DELETED);
return blueprintToBlueprintV4ResponseConverter.convert(deleted);
}
Aggregations