Search in sources :

Example 1 with PlatformAccessConfigsResponse

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

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

the class EnvironmentPlatformResourceController method getAccessConfigs.

@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformAccessConfigsResponse getAccessConfigs(@ResourceCrn String environmentCrn, String region, String platformVariant, String availabilityZone, AccessConfigTypeQueryParam accessConfigType) {
    String accountId = getAccountId();
    validateEnvironmentCrnPattern(environmentCrn);
    PlatformResourceRequest request = platformParameterService.getPlatformResourceRequestByEnvironment(accountId, environmentCrn, 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) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 3 with PlatformAccessConfigsResponse

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

the class CloudAccessConfigsToPlatformAccessConfigsV1ResponseConverter method convert.

public PlatformAccessConfigsResponse convert(CloudAccessConfigs source) {
    PlatformAccessConfigsResponse platformAccessConfigsResponse = new PlatformAccessConfigsResponse();
    List<AccessConfigResponse> result = new ArrayList<>();
    for (CloudAccessConfig entry : source.getCloudAccessConfigs()) {
        AccessConfigResponse actual = new AccessConfigResponse(entry.getName(), entry.getId(), entry.getProperties());
        result.add(actual);
    }
    result.sort(new AccessConfigResponseComparator());
    platformAccessConfigsResponse.setAccessConfigs(result);
    return platformAccessConfigsResponse;
}
Also used : AccessConfigResponseComparator(com.sequenceiq.environment.api.v1.platformresource.model.AccessConfigResponseComparator) CloudAccessConfig(com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfig) ArrayList(java.util.ArrayList) PlatformAccessConfigsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformAccessConfigsResponse) AccessConfigResponse(com.sequenceiq.environment.api.v1.platformresource.model.AccessConfigResponse)

Aggregations

PlatformAccessConfigsResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformAccessConfigsResponse)3 CloudAccessConfigs (com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs)2 PlatformResourceRequest (com.sequenceiq.environment.platformresource.PlatformResourceRequest)2 CheckPermissionByResourceCrn (com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)1 CustomPermissionCheck (com.sequenceiq.authorization.annotation.CustomPermissionCheck)1 CloudAccessConfig (com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfig)1 AccessConfigResponse (com.sequenceiq.environment.api.v1.platformresource.model.AccessConfigResponse)1 AccessConfigResponseComparator (com.sequenceiq.environment.api.v1.platformresource.model.AccessConfigResponseComparator)1 ArrayList (java.util.ArrayList)1