Search in sources :

Example 1 with PlatformGatewaysResponse

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

the class CloudGatewayssToPlatformGatewaysV1ResponseConverter method convert.

public PlatformGatewaysResponse convert(CloudGateWays source) {
    Map<String, Set<CloudGatewayRequest>> result = new HashMap<>();
    for (Entry<String, Set<CloudGateWay>> entry : source.getCloudGateWayResponses().entrySet()) {
        Set<CloudGatewayRequest> cloudGatewayJsons = new HashSet<>();
        for (CloudGateWay gateway : entry.getValue()) {
            CloudGatewayRequest actual = new CloudGatewayRequest(gateway.getName(), gateway.getId(), gateway.getProperties());
            cloudGatewayJsons.add(actual);
        }
        result.put(entry.getKey(), cloudGatewayJsons);
    }
    return new PlatformGatewaysResponse(result);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) CloudGatewayRequest(com.sequenceiq.environment.api.v1.platformresource.model.CloudGatewayRequest) HashMap(java.util.HashMap) PlatformGatewaysResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformGatewaysResponse) HashSet(java.util.HashSet) CloudGateWay(com.sequenceiq.cloudbreak.cloud.model.CloudGateWay)

Example 2 with PlatformGatewaysResponse

use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformGatewaysResponse 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 3 with PlatformGatewaysResponse

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

the class EnvironmentPlatformResourceController method getGatewaysCredentialId.

@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformGatewaysResponse getGatewaysCredentialId(@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/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) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Aggregations

PlatformGatewaysResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformGatewaysResponse)3 CloudGateWays (com.sequenceiq.cloudbreak.cloud.model.CloudGateWays)2 PlatformResourceRequest (com.sequenceiq.environment.platformresource.PlatformResourceRequest)2 CheckPermissionByResourceCrn (com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)1 CustomPermissionCheck (com.sequenceiq.authorization.annotation.CustomPermissionCheck)1 CloudGateWay (com.sequenceiq.cloudbreak.cloud.model.CloudGateWay)1 CloudGatewayRequest (com.sequenceiq.environment.api.v1.platformresource.model.CloudGatewayRequest)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1