Search in sources :

Example 1 with CheckPermissionByResourceCrn

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);
}
Also used : HashSet(java.util.HashSet) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 2 with CheckPermissionByResourceCrn

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);
}
Also used : UpdateAwsDiskEncryptionParametersDto(com.sequenceiq.environment.environment.dto.UpdateAwsDiskEncryptionParametersDto) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 3 with CheckPermissionByResourceCrn

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;
}
Also used : Images(com.sequenceiq.cloudbreak.cloud.model.catalog.Images) ImageCatalogV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Response) ImageCatalog(com.sequenceiq.cloudbreak.domain.ImageCatalog) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 4 with CheckPermissionByResourceCrn

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);
}
Also used : Recipe(com.sequenceiq.cloudbreak.domain.Recipe) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 5 with CheckPermissionByResourceCrn

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);
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Aggregations

CheckPermissionByResourceCrn (com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)36 PlatformResourceRequest (com.sequenceiq.environment.platformresource.PlatformResourceRequest)12 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)7 ResourceCrn (com.sequenceiq.authorization.annotation.ResourceCrn)4 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)4 Credential (com.sequenceiq.environment.credential.domain.Credential)4 CloudAccessConfigs (com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs)3 CloudEncryptionKeys (com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKeys)3 CloudGateWays (com.sequenceiq.cloudbreak.cloud.model.CloudGateWays)3 CloudIpPools (com.sequenceiq.cloudbreak.cloud.model.CloudIpPools)3 CloudNetworks (com.sequenceiq.cloudbreak.cloud.model.CloudNetworks)3 CloudRegions (com.sequenceiq.cloudbreak.cloud.model.CloudRegions)3 CloudSecurityGroups (com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroups)3 CloudSshKeys (com.sequenceiq.cloudbreak.cloud.model.CloudSshKeys)3 CloudVmTypes (com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes)3 CloudNoSqlTables (com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTables)3 PlatformAccessConfigsResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformAccessConfigsResponse)3 PlatformEncryptionKeysResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformEncryptionKeysResponse)3 PlatformGatewaysResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformGatewaysResponse)3 PlatformIpPoolsResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformIpPoolsResponse)3