use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class SdxController method resize.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.RESIZE_DATALAKE)
public SdxClusterResponse resize(@ResourceName String name, SdxClusterResizeRequest resizeSdxClusterRequest) {
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
Pair<SdxCluster, FlowIdentifier> result = sdxService.resizeSdx(userCrn, name, resizeSdxClusterRequest);
SdxCluster sdxCluster = result.getLeft();
metricService.incrementMetricCounter(MetricType.EXTERNAL_SDX_REQUESTED, sdxCluster);
SdxClusterResponse sdxClusterResponse = sdxClusterConverter.sdxClusterToResponse(sdxCluster);
sdxClusterResponse.setName(sdxCluster.getClusterName());
sdxClusterResponse.setFlowIdentifier(result.getRight());
return sdxClusterResponse;
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class SdxBackupController method backupDatabaseByName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.BACKUP_DATALAKE)
public SdxDatabaseBackupResponse backupDatabaseByName(@ResourceName String name, String backupId, String backupLocation) {
SdxCluster sdxCluster = getSdxClusterByName(name);
try {
SdxDatabaseBackupStatusResponse response = sdxBackupRestoreService.getDatabaseBackupStatus(sdxCluster, backupId);
SdxDatabaseBackupResponse sdxDatabaseBackupResponse = new SdxDatabaseBackupResponse();
sdxDatabaseBackupResponse.setOperationId(backupId);
return sdxDatabaseBackupResponse;
} catch (NotFoundException notFoundException) {
SdxDatabaseBackupRequest backupRequest = new SdxDatabaseBackupRequest();
backupRequest.setBackupId(backupId);
backupRequest.setBackupLocation(backupLocation);
backupRequest.setCloseConnections(true);
return sdxBackupRestoreService.triggerDatabaseBackup(sdxCluster, backupRequest);
}
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class SdxController method getDetail.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DETAILED_DATALAKE)
public SdxClusterDetailResponse getDetail(@ResourceName String name, Set<String> entries) {
SdxCluster sdxCluster = getSdxClusterByName(name);
StackV4Response stackV4Response = sdxService.getDetail(name, entries, sdxCluster.getAccountId());
SdxClusterResponse sdxClusterResponse = sdxClusterConverter.sdxClusterToResponse(sdxCluster);
return SdxClusterDetailResponse.create(sdxClusterResponse, stackV4Response);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class ImageCatalogV4Controller method getImageByCatalogNameAndImageId.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_IMAGE_CATALOG)
public ImagesV4Response getImageByCatalogNameAndImageId(Long workspaceId, @ResourceName String name, String imageId, @AccountId String accountId) throws Exception {
StatedImage statedImage = imageCatalogService.getImageByCatalogName(restRequestThreadLocalService.getRequestedWorkspaceId(), imageId, name);
Images images = new Images(List.of(), List.of(statedImage.getImage()), List.of(), Set.of());
return imagesToImagesV4ResponseConverter.convert(images);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class RecipesV4Controller method deleteByName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DELETE_RECIPE)
public RecipeV4Response deleteByName(Long workspaceId, @ResourceName String name) {
Recipe deleted = recipeService.delete(NameOrCrn.ofName(name), restRequestThreadLocalService.getRequestedWorkspaceId());
notify(ResourceEvent.RECIPE_DELETED);
return recipeToRecipeV4ResponseConverter.convert(deleted);
}
Aggregations