Search in sources :

Example 1 with CustomPermissionCheck

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

the class CredentialPlatformResourceController method getCloudSshKeys.

@Override
@CustomPermissionCheck
public PlatformSshKeysResponse getCloudSshKeys(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/ssh_keys, request: {}", request);
    CloudSshKeys sshKeys = platformParameterService.getCloudSshKeys(request);
    PlatformSshKeysResponse response = cloudSshKeysToPlatformSshKeysV1ResponseConverter.convert(sshKeys);
    LOGGER.info("Resp /platform_resources/ssh_keys, request: {}, sshKeys: {}", request, sshKeys);
    return response;
}
Also used : CloudSshKeys(com.sequenceiq.cloudbreak.cloud.model.CloudSshKeys) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) PlatformSshKeysResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformSshKeysResponse) CustomPermissionCheck(com.sequenceiq.authorization.annotation.CustomPermissionCheck)

Example 2 with CustomPermissionCheck

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

the class CredentialPlatformResourceController method getRegionsByCredential.

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

Example 3 with CustomPermissionCheck

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

the class CredentialPlatformResourceController method getAccessConfigs.

@Override
@CustomPermissionCheck
public PlatformAccessConfigsResponse getAccessConfigs(String credentialName, String credentialCrn, String region, String platformVariant, String availabilityZone, AccessConfigTypeQueryParam accessConfigType) {
    customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
    String accountId = getAccountId();
    PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, region, platformVariant, availabilityZone, null, accessConfigType);
    LOGGER.info("Get /platform_resources/access_configs, request: {}", request);
    CloudAccessConfigs accessConfigs = platformParameterService.getAccessConfigs(request);
    PlatformAccessConfigsResponse response = cloudAccessConfigsToPlatformAccessConfigsV1ResponseConverter.convert(accessConfigs);
    LOGGER.info("Resp /platform_resources/access_configs, request: {}, accessConfigs: {}, response: {}", request, accessConfigs, response);
    return response;
}
Also used : PlatformAccessConfigsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformAccessConfigsResponse) CloudAccessConfigs(com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) CustomPermissionCheck(com.sequenceiq.authorization.annotation.CustomPermissionCheck)

Example 4 with CustomPermissionCheck

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

the class CredentialPlatformResourceController method getCloudNetworks.

@Override
@CustomPermissionCheck
public PlatformNetworksResponse getCloudNetworks(String credentialName, String credentialCrn, String region, String platformVariant, String availabilityZone, String networkId, String subnetIds, String sharedProjectId) {
    customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
    String accountId = getAccountId();
    Map<String, String> filter = new HashMap<>();
    if (!Strings.isNullOrEmpty(subnetIds)) {
        filter.put(NetworkConstants.SUBNET_IDS, subnetIds);
    }
    if (!Strings.isNullOrEmpty(networkId)) {
        filter.put("networkId", networkId);
    }
    PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, region, platformVariant, availabilityZone, sharedProjectId, filter, null, CdpResourceType.DEFAULT);
    LOGGER.info("Get /platform_resources/networks, request: {}", request);
    CloudNetworks networks = platformParameterService.getCloudNetworks(request);
    PlatformNetworksResponse response = cloudNetworksToPlatformNetworksV1ResponseConverter.convert(networks);
    LOGGER.info("Resp /platform_resources/networks, request: {}, networks: {}, response: {}", request, networks, response);
    return response;
}
Also used : HashMap(java.util.HashMap) CloudNetworks(com.sequenceiq.cloudbreak.cloud.model.CloudNetworks) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) PlatformNetworksResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformNetworksResponse) CustomPermissionCheck(com.sequenceiq.authorization.annotation.CustomPermissionCheck)

Example 5 with CustomPermissionCheck

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

the class CredentialPlatformResourceController method getIpPoolsCredentialId.

@Override
@CustomPermissionCheck
public PlatformIpPoolsResponse getIpPoolsCredentialId(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/ip_pools, request: {}", request);
    CloudIpPools ipPools = platformParameterService.getIpPoolsCredentialId(request);
    PlatformIpPoolsResponse response = cloudIpPoolsToPlatformIpPoolsV1ResponseConverter.convert(ipPools);
    LOGGER.info("Resp /platform_resources/ip_pools, request: {}, ipPools: {}, response: {}", request, ipPools, response);
    return response;
}
Also used : PlatformIpPoolsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformIpPoolsResponse) CloudIpPools(com.sequenceiq.cloudbreak.cloud.model.CloudIpPools) PlatformResourceRequest(com.sequenceiq.environment.platformresource.PlatformResourceRequest) 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