Search in sources :

Example 1 with PlatformResourceGroupResponse

use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformResourceGroupResponse in project cloudbreak by hortonworks.

the class EnvironmentPlatformResourceController method getResourceGroups.

@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformResourceGroupsResponse getResourceGroups(@ResourceCrn String environmentCrn, String region, String platformVariant, String availabilityZone) {
    String accountId = getAccountId();
    validateEnvironmentCrnPattern(environmentCrn);
    PlatformResourceRequest request = platformParameterService.getPlatformResourceRequestByEnvironment(accountId, environmentCrn, region, platformVariant, availabilityZone, null);
    LOGGER.info("Get /platform_resources/resource_groups, request: {}", request);
    CloudResourceGroups resourceGroups = platformParameterService.getResourceGroups(request);
    List<PlatformResourceGroupResponse> platformResourceGroups = resourceGroups.getResourceGroups().stream().map(rg -> new PlatformResourceGroupResponse(rg.getName())).collect(Collectors.toList());
    PlatformResourceGroupsResponse response = new PlatformResourceGroupsResponse(platformResourceGroups);
    LOGGER.info("Resp /platform_resources/resource_groups, request: {}, resourceGroups: {}, response: {}", request, resourceGroups, response);
    return response;
}
Also used : PlatformPrivateDnsZoneResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformPrivateDnsZoneResponse) CloudVmTypes(com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes) ResourceCrn(com.sequenceiq.authorization.annotation.ResourceCrn) CloudEncryptionKeysToPlatformEncryptionKeysV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudEncryptionKeysToPlatformEncryptionKeysV1ResponseConverter) LoggerFactory(org.slf4j.LoggerFactory) PlatformGatewaysResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformGatewaysResponse) 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) 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) CloudSshKeysToPlatformSshKeysV1ResponseConverter(com.sequenceiq.environment.platformresource.v1.converter.CloudSshKeysToPlatformSshKeysV1ResponseConverter) CloudEncryptionKeys(com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKeys) 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) CloudIpPools(com.sequenceiq.cloudbreak.cloud.model.CloudIpPools) 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) PlatformVmtypesResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformVmtypesResponse) Inject(javax.inject.Inject) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) PlatformAccessConfigsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformAccessConfigsResponse) 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) EnvironmentPlatformResourceEndpoint(com.sequenceiq.environment.api.v1.platformresource.EnvironmentPlatformResourceEndpoint) 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) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn) 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) PlatformResourceGroupResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformResourceGroupResponse) CloudResourceGroups(com.sequenceiq.cloudbreak.cloud.model.resourcegroup.CloudResourceGroups) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) PlatformResourceGroupsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformResourceGroupsResponse) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 2 with PlatformResourceGroupResponse

use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformResourceGroupResponse in project cloudbreak by hortonworks.

the class CredentialPlatformResourceController method getResourceGroups.

@Override
@CustomPermissionCheck
public PlatformResourceGroupsResponse getResourceGroups(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, CdpResourceType.DEFAULT);
    LOGGER.info("Get /platform_resources/resource_groups, request: {}", request);
    CloudResourceGroups resourceGroups = platformParameterService.getResourceGroups(request);
    List<PlatformResourceGroupResponse> platformResourceGroups = resourceGroups.getResourceGroups().stream().map(rg -> new PlatformResourceGroupResponse(rg.getName())).collect(Collectors.toList());
    PlatformResourceGroupsResponse response = new PlatformResourceGroupsResponse(platformResourceGroups);
    LOGGER.info("Resp /platform_resources/resource_groups, request: {}, resourceGroups: {}, response: {}", request, resourceGroups, 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) PlatformResourceGroupResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformResourceGroupResponse) CloudResourceGroups(com.sequenceiq.cloudbreak.cloud.model.resourcegroup.CloudResourceGroups) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) PlatformResourceGroupsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformResourceGroupsResponse) CustomPermissionCheck(com.sequenceiq.authorization.annotation.CustomPermissionCheck)

Aggregations

AuthorizationResourceAction (com.sequenceiq.authorization.resource.AuthorizationResourceAction)2 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)2 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)2 CrnParseException (com.sequenceiq.cloudbreak.auth.crn.CrnParseException)2 CloudAccessConfigs (com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs)2 CloudEncryptionKeys (com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKeys)2 CloudGateWays (com.sequenceiq.cloudbreak.cloud.model.CloudGateWays)2 CloudIpPools (com.sequenceiq.cloudbreak.cloud.model.CloudIpPools)2 CloudNetworks (com.sequenceiq.cloudbreak.cloud.model.CloudNetworks)2 CloudRegions (com.sequenceiq.cloudbreak.cloud.model.CloudRegions)2 CloudSecurityGroups (com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroups)2 CloudSshKeys (com.sequenceiq.cloudbreak.cloud.model.CloudSshKeys)2 CloudVmTypes (com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes)2 CloudPrivateDnsZones (com.sequenceiq.cloudbreak.cloud.model.dns.CloudPrivateDnsZones)2 CloudNoSqlTables (com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTables)2 CloudResourceGroups (com.sequenceiq.cloudbreak.cloud.model.resourcegroup.CloudResourceGroups)2 CdpResourceType (com.sequenceiq.common.api.type.CdpResourceType)2 AccessConfigTypeQueryParam (com.sequenceiq.environment.api.v1.platformresource.model.AccessConfigTypeQueryParam)2 PlatformAccessConfigsResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformAccessConfigsResponse)2 PlatformEncryptionKeysResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformEncryptionKeysResponse)2