use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class CredentialV1Controller method getByName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL)
public CredentialResponse getByName(@ResourceName String credentialName) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential credential = credentialService.getByNameForAccountId(credentialName, accountId, ENVIRONMENT);
return credentialConverter.convert(credential);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class DistroXV1Controller method putScalingByName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.SCALE_DATAHUB)
public FlowIdentifier putScalingByName(@ResourceName String name, @Valid DistroXScaleV1Request updateRequest) {
StackScaleV4Request stackScaleV4Request = scaleRequestConverter.convert(updateRequest);
stackScaleV4Request.setStackId(stackOperations.getStackByName(name).getId());
return stackOperations.putScaling(NameOrCrn.ofName(name), getWorkspaceIdForCurrentUser(), stackScaleV4Request);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class SdxRestoreController method restoreDatabaseByName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.RESTORE_DATALAKE)
public SdxDatabaseRestoreResponse restoreDatabaseByName(@ResourceName String name, String backupId, String restoreId, String backupLocation) {
SdxCluster sdxCluster = getSdxClusterByName(name);
try {
sdxBackupRestoreService.getDatabaseRestoreStatus(sdxCluster, restoreId);
SdxDatabaseRestoreResponse sdxDatabaseRestoreResponse = new SdxDatabaseRestoreResponse();
sdxDatabaseRestoreResponse.setOperationId(restoreId);
return sdxDatabaseRestoreResponse;
} catch (NotFoundException notFoundException) {
return sdxBackupRestoreService.triggerDatabaseRestore(sdxCluster, backupId, restoreId, backupLocation);
}
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class SdxBackupController method backupDatabaseByNameInternal.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.BACKUP_DATALAKE)
public SdxDatabaseBackupResponse backupDatabaseByNameInternal(@ResourceName String name, SdxDatabaseBackupRequest backupRequest) {
SdxCluster sdxCluster = getSdxClusterByName(name);
String backupId = backupRequest.getBackupId();
try {
SdxDatabaseBackupStatusResponse response = sdxBackupRestoreService.getDatabaseBackupStatus(sdxCluster, backupId);
SdxDatabaseBackupResponse sdxDatabaseBackupResponse = new SdxDatabaseBackupResponse();
sdxDatabaseBackupResponse.setOperationId(backupId);
return sdxDatabaseBackupResponse;
} catch (NotFoundException notFoundException) {
return sdxBackupRestoreService.triggerDatabaseBackup(sdxCluster, backupRequest);
}
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class SdxController method changeImageCatalog.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.CHANGE_IMAGE_CATALOG_DATALAKE)
@CheckPermissionByRequestProperty(type = NAME, path = "imageCatalog", action = DESCRIBE_IMAGE_CATALOG)
public void changeImageCatalog(@ResourceName String name, @RequestObject SdxChangeImageCatalogRequest changeImageCatalogRequest) {
SdxCluster sdxCluster = getSdxClusterByName(name);
sdxImageCatalogService.changeImageCatalog(sdxCluster, changeImageCatalogRequest.getImageCatalog());
}
Aggregations