Search in sources :

Example 6 with CustomPermissionCheck

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

the class CredentialPlatformResourceController method getVmTypesByCredential.

@Override
@CustomPermissionCheck
public PlatformVmtypesResponse getVmTypesByCredential(String credentialName, String credentialCrn, String region, String platformVariant, String availabilityZone, CdpResourceType cdpResourceType) {
    customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
    String accountId = getAccountId();
    PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, region, platformVariant, availabilityZone, null, new HashMap<>(), null, cdpResourceType);
    LOGGER.info("Get /platform_resources/machine_types, request: {}", request);
    CloudVmTypes cloudVmTypes = platformParameterService.getVmTypesByCredential(request);
    PlatformVmtypesResponse response = cloudVmTypesToPlatformVmTypesV1ResponseConverter.convert(cloudVmTypes);
    LOGGER.info("Resp /platform_resources/machine_types, request: {}, cloudVmTypes: {}, response: {}", request, cloudVmTypes, response);
    return response;
}
Also used : CloudVmTypes(com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes) PlatformVmtypesResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformVmtypesResponse) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) CustomPermissionCheck(com.sequenceiq.authorization.annotation.CustomPermissionCheck)

Example 7 with CustomPermissionCheck

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

the class CredentialPlatformResourceController method getNoSqlTables.

@Override
@CustomPermissionCheck
public PlatformNoSqlTablesResponse getNoSqlTables(String credentialName, String credentialCrn, String region, String platformVariant, String availabilityZone) {
    customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
    String accountId = getAccountId();
    PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, region, platformVariant, availabilityZone);
    LOGGER.info("Get /platform_resources/nosql_tables, request: {}", request);
    CloudNoSqlTables noSqlTables = platformParameterService.getNoSqlTables(request);
    PlatformNoSqlTablesResponse response = cloudNoSqlTablesToPlatformNoSqlTablesV1ResponseConverter.convert(noSqlTables);
    LOGGER.info("Resp /platform_resources/nosql_tables, request: {}, noSqlTables: {}, response: {}", request, noSqlTables, response);
    return response;
}
Also used : CloudNoSqlTables(com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTables) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) PlatformNoSqlTablesResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformNoSqlTablesResponse) CustomPermissionCheck(com.sequenceiq.authorization.annotation.CustomPermissionCheck)

Example 8 with CustomPermissionCheck

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

the class CredentialPlatformResourceController method getGatewaysCredentialId.

@Override
@CustomPermissionCheck
public PlatformGatewaysResponse getGatewaysCredentialId(String credentialName, String credentialCrn, String region, String platformVariant, String availabilityZone) {
    customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
    String accountId = getAccountId();
    PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, region, platformVariant, availabilityZone);
    LOGGER.info("Get /platform_resources/gateways, request: {}", request);
    CloudGateWays gateways = platformParameterService.getGatewaysCredentialId(request);
    PlatformGatewaysResponse response = cloudGatewayssToPlatformGatewaysV1ResponseConverter.convert(gateways);
    LOGGER.info("Resp /platform_resources/gateways, request: {}, ipPools: {}, response: {}", request, gateways, response);
    return response;
}
Also used : PlatformGatewaysResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformGatewaysResponse) CloudGateWays(com.sequenceiq.cloudbreak.cloud.model.CloudGateWays) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) CustomPermissionCheck(com.sequenceiq.authorization.annotation.CustomPermissionCheck)

Example 9 with CustomPermissionCheck

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

the class CredentialPlatformResourceController method getEncryptionKeys.

@Override
@CustomPermissionCheck
public PlatformEncryptionKeysResponse getEncryptionKeys(String credentialName, String credentialCrn, String region, String platformVariant, String availabilityZone) {
    customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
    String accountId = getAccountId();
    PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, region, platformVariant, availabilityZone);
    LOGGER.info("Get /platform_resources/encryption_keys, request: {}", request);
    CloudEncryptionKeys encryptionKeys = platformParameterService.getEncryptionKeys(request);
    PlatformEncryptionKeysResponse response = cloudEncryptionKeysToPlatformEncryptionKeysV1ResponseConverter.convert(encryptionKeys);
    LOGGER.info("Resp /platform_resources/encryption_keys, request: {}, ipPools: {}, response: {}", request, encryptionKeys, response);
    return response;
}
Also used : PlatformEncryptionKeysResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformEncryptionKeysResponse) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) CloudEncryptionKeys(com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKeys) CustomPermissionCheck(com.sequenceiq.authorization.annotation.CustomPermissionCheck)

Example 10 with CustomPermissionCheck

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

the class CredentialPlatformResourceController method getPrivateDnsZones.

@Override
@CustomPermissionCheck
public PlatformPrivateDnsZonesResponse getPrivateDnsZones(String credentialName, String credentialCrn, String platformVariant) {
    customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
    String accountId = getAccountId();
    PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, platformVariant, CdpResourceType.DEFAULT);
    LOGGER.debug("Get /platform_resources/private_dns_zones, request: {}", request);
    CloudPrivateDnsZones privateDnsZones = platformParameterService.getPrivateDnsZones(request);
    List<PlatformPrivateDnsZoneResponse> platformPrivateDnsZones = privateDnsZones.getPrivateDnsZones().stream().map(pdz -> new PlatformPrivateDnsZoneResponse(pdz.getPrivateDnsZoneId())).collect(Collectors.toList());
    PlatformPrivateDnsZonesResponse response = new PlatformPrivateDnsZonesResponse(platformPrivateDnsZones);
    LOGGER.debug("Resp /platform_resources/private_dns_zones, request: {}, privateDnsZones: {}, response: {}", request, privateDnsZones, response);
    return response;
}
Also used : PlatformPrivateDnsZoneResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformPrivateDnsZoneResponse) CloudVmTypes(com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes) CloudEncryptionKeysToPlatformEncryptionKeysV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudEncryptionKeysToPlatformEncryptionKeysV1ResponseConverter) TagSpecificationsToTagSpecificationsV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.TagSpecificationsToTagSpecificationsV1ResponseConverter) LoggerFactory(org.slf4j.LoggerFactory) CustomCheckUtil(com.sequenceiq.authorization.service.CustomCheckUtil) PlatformGatewaysResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformGatewaysResponse) PlatformParameters(com.sequenceiq.cloudbreak.cloud.PlatformParameters) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) CdpResourceType(com.sequenceiq.common.api.type.CdpResourceType) CloudSshKeys(com.sequenceiq.cloudbreak.cloud.model.CloudSshKeys) AccessConfigTypeQueryParam(com.sequenceiq.environment.api.v1.platformresource.model.AccessConfigTypeQueryParam) PlatformDisksResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformDisksResponse) Map(java.util.Map) BadRequestException(javax.ws.rs.BadRequestException) PlatformNetworksResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformNetworksResponse) TxType(javax.transaction.Transactional.TxType) PlatformParameterService(com.sequenceiq.environment.platformresource.PlatformParameterService) Transactional(javax.transaction.Transactional) DisableCheckPermissions(com.sequenceiq.authorization.annotation.DisableCheckPermissions) CloudSshKeysToPlatformSshKeysV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudSshKeysToPlatformSshKeysV1ResponseConverter) CloudEncryptionKeys(com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKeys) Platform(com.sequenceiq.cloudbreak.cloud.model.Platform) CloudResourceGroups(com.sequenceiq.cloudbreak.cloud.model.resourcegroup.CloudResourceGroups) CloudAccessConfigsToPlatformAccessConfigsV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudAccessConfigsToPlatformAccessConfigsV1ResponseConverter) PlatformEncryptionKeysResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformEncryptionKeysResponse) Crn(com.sequenceiq.cloudbreak.auth.crn.Crn) Collectors(java.util.stream.Collectors) CloudIpPoolsToPlatformIpPoolsV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudIpPoolsToPlatformIpPoolsV1ResponseConverter) CloudNoSqlTables(com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTables) PlatformPrivateDnsZonesResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformPrivateDnsZonesResponse) List(java.util.List) CloudPrivateDnsZones(com.sequenceiq.cloudbreak.cloud.model.dns.CloudPrivateDnsZones) CloudSecurityGroupsToPlatformSecurityGroupsV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudSecurityGroupsToPlatformSecurityGroupsV1ResponseConverter) CloudVmTypesToPlatformVmTypesV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudVmTypesToPlatformVmTypesV1ResponseConverter) PlatformResourceGroupsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformResourceGroupsResponse) NetworkConstants(com.sequenceiq.cloudbreak.common.network.NetworkConstants) CloudIpPools(com.sequenceiq.cloudbreak.cloud.model.CloudIpPools) CredentialPlatformResourceEndpoint(com.sequenceiq.environment.api.v1.platformresource.CredentialPlatformResourceEndpoint) PlatformDisksToPlatformDisksV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.PlatformDisksToPlatformDisksV1ResponseConverter) HashMap(java.util.HashMap) Controller(org.springframework.stereotype.Controller) CloudGateWays(com.sequenceiq.cloudbreak.cloud.model.CloudGateWays) CloudNetworks(com.sequenceiq.cloudbreak.cloud.model.CloudNetworks) CloudRegions(com.sequenceiq.cloudbreak.cloud.model.CloudRegions) PlatformDisks(com.sequenceiq.cloudbreak.cloud.model.PlatformDisks) PlatformVmtypesResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformVmtypesResponse) Inject(javax.inject.Inject) Strings(com.google.common.base.Strings) CustomPermissionCheck(com.sequenceiq.authorization.annotation.CustomPermissionCheck) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) PlatformAccessConfigsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformAccessConfigsResponse) CommonPermissionCheckingUtils(com.sequenceiq.authorization.service.CommonPermissionCheckingUtils) CloudNoSqlTablesToPlatformNoSqlTablesV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudNoSqlTablesToPlatformNoSqlTablesV1ResponseConverter) PlatformIpPoolsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformIpPoolsResponse) PlatformRegionsToRegionV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.PlatformRegionsToRegionV1ResponseConverter) Logger(org.slf4j.Logger) CloudAccessConfigs(com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs) RegionResponse(com.sequenceiq.environment.api.v1.platformresource.model.RegionResponse) CrnParseException(com.sequenceiq.cloudbreak.auth.crn.CrnParseException) PlatformResourceGroupResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformResourceGroupResponse) TagSpecificationsResponse(com.sequenceiq.environment.api.v1.platformresource.model.TagSpecificationsResponse) CloudSecurityGroups(com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroups) CloudNetworksToPlatformNetworksV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudNetworksToPlatformNetworksV1ResponseConverter) PlatformSshKeysResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformSshKeysResponse) AuthorizationResourceAction(com.sequenceiq.authorization.resource.AuthorizationResourceAction) PlatformSecurityGroupsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformSecurityGroupsResponse) CloudGatewayssToPlatformGatewaysV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudGatewayssToPlatformGatewaysV1ResponseConverter) PlatformNoSqlTablesResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformNoSqlTablesResponse) PlatformPrivateDnsZonesResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformPrivateDnsZonesResponse) PlatformPrivateDnsZoneResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformPrivateDnsZoneResponse) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) CloudPrivateDnsZones(com.sequenceiq.cloudbreak.cloud.model.dns.CloudPrivateDnsZones) CustomPermissionCheck(com.sequenceiq.authorization.annotation.CustomPermissionCheck)

Aggregations

CustomPermissionCheck (com.sequenceiq.authorization.annotation.CustomPermissionCheck)15 PlatformResourceRequest (com.sequenceiq.environment.platformresource.PlatformResourceRequest)12 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)3 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 PlatformNetworksResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformNetworksResponse)3 PlatformNoSqlTablesResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformNoSqlTablesResponse)3 PlatformSecurityGroupsResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformSecurityGroupsResponse)3