Search in sources :

Example 1 with CheckPermissionByResourceName

use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.

the class EnvironmentController method updateAwsDiskEncryptionParametersByEnvironmentName.

@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.UPDATE_AWS_DISK_ENCRYPTION_PARAMETERS)
public DetailedEnvironmentResponse updateAwsDiskEncryptionParametersByEnvironmentName(@ResourceName String environmentName, @RequestObject @Valid UpdateAwsDiskEncryptionParametersRequest request) {
    String accountId = ThreadBasedUserCrnProvider.getAccountId();
    UpdateAwsDiskEncryptionParametersDto dto = environmentApiConverter.convertUpdateAwsDiskEncryptionParametersDto(request);
    EnvironmentDto result = environmentModificationService.updateAwsDiskEncryptionParametersByEnvironmentName(accountId, environmentName, dto);
    return environmentResponseConverter.dtoToDetailedResponse(result);
}
Also used : UpdateAwsDiskEncryptionParametersDto(com.sequenceiq.environment.environment.dto.UpdateAwsDiskEncryptionParametersDto) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Example 2 with CheckPermissionByResourceName

use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.

the class ImageCatalogV4Controller method deleteByName.

@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DELETE_IMAGE_CATALOG)
public ImageCatalogV4Response deleteByName(Long workspaceId, @ResourceName String name) {
    ImageCatalog deleted = imageCatalogService.delete(NameOrCrn.ofName(name), restRequestThreadLocalService.getRequestedWorkspaceId());
    notify(ResourceEvent.IMAGE_CATALOG_DELETED);
    return imageCatalogToImageCatalogV4ResponseConverter.convert(deleted);
}
Also used : ImageCatalog(com.sequenceiq.cloudbreak.domain.ImageCatalog) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Example 3 with CheckPermissionByResourceName

use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.

the class ImageCatalogV4Controller method getByName.

@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_IMAGE_CATALOG)
public ImageCatalogV4Response getByName(Long workspaceId, @ResourceName String name, Boolean withImages) {
    ImageCatalog catalog = imageCatalogService.getImageCatalogByName(NameOrCrn.ofName(name), restRequestThreadLocalService.getRequestedWorkspaceId());
    ImageCatalogV4Response imageCatalogResponse = imageCatalogToImageCatalogV4ResponseConverter.convert(catalog);
    Images images = imageCatalogService.propagateImagesIfRequested(restRequestThreadLocalService.getRequestedWorkspaceId(), name, 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) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Example 4 with CheckPermissionByResourceName

use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.

the class BlueprintV4Controller method getParameters.

@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CLUSTER_TEMPLATE)
public ParametersQueryV4Response getParameters(Long workspaceId, @ResourceName String name) {
    ParametersQueryV4Response parametersQueryV4Response = new ParametersQueryV4Response();
    parametersQueryV4Response.setCustom(blueprintService.queryCustomParametersMap(name, restRequestThreadLocalService.getRequestedWorkspaceId()));
    return parametersQueryV4Response;
}
Also used : ParametersQueryV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ParametersQueryV4Response) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Example 5 with CheckPermissionByResourceName

use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.

the class CustomImageCatalogV4Controller method getCustomImage.

@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_IMAGE_CATALOG)
public CustomImageCatalogV4GetImageResponse getCustomImage(@ResourceName String name, String imageId, @AccountId String accountId) {
    CustomImage customImage = customImageCatalogService.getCustomImage(restRequestThreadLocalService.getRequestedWorkspaceId(), name, imageId);
    Image sourceImage = customImageCatalogService.getSourceImage(customImage);
    CustomImageCatalogV4GetImageResponse response = customImageToCustomImageCatalogV4GetImageResponseConverter.convert(customImage);
    response.setSourceImageDate(sourceImage.getCreated());
    return response;
}
Also used : CustomImage(com.sequenceiq.cloudbreak.domain.CustomImage) CustomImageCatalogV4GetImageResponse(com.sequenceiq.cloudbreak.api.endpoint.v4.customimage.response.CustomImageCatalogV4GetImageResponse) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) CustomImage(com.sequenceiq.cloudbreak.domain.CustomImage) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Aggregations

CheckPermissionByResourceName (com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)29 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)7 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)6 Credential (com.sequenceiq.environment.credential.domain.Credential)4 NotFoundException (com.sequenceiq.cloudbreak.common.exception.NotFoundException)3 CustomImage (com.sequenceiq.cloudbreak.domain.CustomImage)3 CheckPermissionByRequestProperty (com.sequenceiq.authorization.annotation.CheckPermissionByRequestProperty)2 Images (com.sequenceiq.cloudbreak.cloud.model.catalog.Images)2 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)2 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)2 SdxDatabaseBackupResponse (com.sequenceiq.sdx.api.model.SdxDatabaseBackupResponse)2 SdxDatabaseBackupStatusResponse (com.sequenceiq.sdx.api.model.SdxDatabaseBackupStatusResponse)2 ClusterTemplateV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.clustertemplate.responses.ClusterTemplateV4Response)1 CustomImageCatalogV4GetImageResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.customimage.response.CustomImageCatalogV4GetImageResponse)1 ImageCatalogV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Response)1 StackScaleV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackScaleV4Request)1 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)1 ParametersQueryV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ParametersQueryV4Response)1 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1