use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformEncryptionKeysResponse in project cloudbreak by hortonworks.
the class PlatformResourceClientService method getEncryptionKeys.
public CloudEncryptionKeys getEncryptionKeys(String envCrn, String region) {
LOGGER.info("Fetch encryption keys by environment crn: {} and region: {}", envCrn, region);
PlatformEncryptionKeysResponse encryptionKeys = environmentPlatformResourceEndpoint.getEncryptionKeys(envCrn, region, null, null);
Set<CloudEncryptionKey> keys = encryptionKeys.getEncryptionKeyConfigs().stream().map(response -> new CloudEncryptionKey(response.getName(), response.getId(), response.getDescription(), response.getDisplayName(), response.getProperties())).collect(Collectors.toSet());
return new CloudEncryptionKeys(keys);
}
use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformEncryptionKeysResponse in project cloudbreak by hortonworks.
the class CloudEncryptionKeysToPlatformEncryptionKeysV1ResponseConverter method convert.
public PlatformEncryptionKeysResponse convert(CloudEncryptionKeys source) {
PlatformEncryptionKeysResponse platformEncryptionKeysResponse = new PlatformEncryptionKeysResponse();
Set<EncryptionKeyConfigResponse> result = new HashSet<>();
for (CloudEncryptionKey entry : source.getCloudEncryptionKeys()) {
EncryptionKeyConfigResponse actual = new EncryptionKeyConfigResponse(entry.getName(), entry.getId(), entry.getDescription(), entry.getDisplayName(), entry.getProperties());
result.add(actual);
}
platformEncryptionKeysResponse.setEncryptionKeyConfigs(result);
return platformEncryptionKeysResponse;
}
use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformEncryptionKeysResponse 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;
}
use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformEncryptionKeysResponse in project cloudbreak by hortonworks.
the class EnvironmentPlatformResourceController method getEncryptionKeys.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformEncryptionKeysResponse getEncryptionKeys(@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/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;
}
Aggregations