Search in sources :

Example 21 with CheckPermissionByResourceCrn

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

the class EnvironmentPlatformResourceController method getSecurityGroups.

@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformSecurityGroupsResponse getSecurityGroups(@ResourceCrn String environmentCrn, String region, String platformVariant, String availabilityZone, String sharedProjectId) {
    String accountId = getAccountId();
    validateEnvironmentCrnPattern(environmentCrn);
    PlatformResourceRequest request = platformParameterService.getPlatformResourceRequestByEnvironment(accountId, environmentCrn, region, platformVariant, availabilityZone, sharedProjectId);
    LOGGER.info("Get /platform_resources/security_groups, request: {}", request);
    CloudSecurityGroups securityGroups = platformParameterService.getSecurityGroups(request);
    PlatformSecurityGroupsResponse response = cloudSecurityGroupsToPlatformSecurityGroupsV1ResponseConverter.convert(securityGroups);
    LOGGER.info("Resp /platform_resources/security_groups, request: {}, securityGroups: {}, response: {}", request, securityGroups, response);
    return response;
}
Also used : CloudSecurityGroups(com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroups) PlatformSecurityGroupsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformSecurityGroupsResponse) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 22 with CheckPermissionByResourceCrn

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

the class DistroXV1Controller method putScalingByCrn.

@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.SCALE_DATAHUB)
public void putScalingByCrn(@ValidCrn(resource = CrnResourceDescriptor.DATAHUB) @TenantAwareParam @ResourceCrn String crn, @Valid DistroXScaleV1Request updateRequest) {
    StackScaleV4Request stackScaleV4Request = scaleRequestConverter.convert(updateRequest);
    stackScaleV4Request.setStackId(stackOperations.getStackByCrn(crn).getId());
    stackOperations.putScaling(NameOrCrn.ofCrn(crn), getWorkspaceIdForCurrentUser(), stackScaleV4Request);
}
Also used : StackScaleV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackScaleV4Request) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 23 with CheckPermissionByResourceCrn

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

the class SdxController method getDetailByCrn.

@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_DETAILED_DATALAKE)
public SdxClusterDetailResponse getDetailByCrn(@TenantAwareParam @ResourceCrn String clusterCrn, Set<String> entries) {
    SdxCluster sdxCluster = getSdxClusterByCrn(clusterCrn);
    StackV4Response stackV4Response = sdxService.getDetail(sdxCluster.getClusterName(), entries, sdxCluster.getAccountId());
    SdxClusterResponse sdxClusterResponse = sdxClusterConverter.sdxClusterToResponse(sdxCluster);
    return SdxClusterDetailResponse.create(sdxClusterResponse, stackV4Response);
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 24 with CheckPermissionByResourceCrn

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

the class SdxController method renewCertificate.

@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.REPAIR_DATALAKE)
public FlowIdentifier renewCertificate(@ResourceCrn @TenantAwareParam String crn) {
    String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
    SdxCluster sdxCluster = sdxService.getByCrn(userCrn, crn);
    return certRenewalService.triggerRenewCertificate(sdxCluster, userCrn);
}
Also used : SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 25 with CheckPermissionByResourceCrn

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

the class ImageCatalogV4Controller method deleteByCrn.

@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_IMAGE_CATALOG)
public ImageCatalogV4Response deleteByCrn(Long workspaceId, @ResourceCrn String crn) {
    ImageCatalog deleted = imageCatalogService.delete(NameOrCrn.ofCrn(crn), restRequestThreadLocalService.getRequestedWorkspaceId());
    notify(ResourceEvent.IMAGE_CATALOG_DELETED);
    return imageCatalogToImageCatalogV4ResponseConverter.convert(deleted);
}
Also used : ImageCatalog(com.sequenceiq.cloudbreak.domain.ImageCatalog) 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