Search in sources :

Example 11 with CloudEncryptionKeys

use of com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKeys in project cloudbreak by hortonworks.

the class GetPlatformEncryptionKeysHandler method accept.

@Override
public void accept(Event<GetPlatformEncryptionKeysRequest> getPlatformEncryptionKeysRequest) {
    LOGGER.debug("Received event: {}", getPlatformEncryptionKeysRequest);
    GetPlatformEncryptionKeysRequest request = getPlatformEncryptionKeysRequest.getData();
    try {
        CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()), Variant.variant(request.getVariant()));
        CloudEncryptionKeys encryptionKeys = cloudPlatformConnectors.get(cloudPlatformVariant).platformResources().encryptionKeys(request.getExtendedCloudCredential(), Region.region(request.getRegion()), request.getFilters());
        GetPlatformEncryptionKeysResult getPlatformEncryptionKeysResult = new GetPlatformEncryptionKeysResult(request.getResourceId(), encryptionKeys);
        request.getResult().onNext(getPlatformEncryptionKeysResult);
        LOGGER.debug("Query platform encryption keys types finished.");
    } catch (Exception e) {
        request.getResult().onNext(new GetPlatformEncryptionKeysResult(e.getMessage(), e, request.getResourceId()));
    }
}
Also used : CloudPlatformVariant(com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant) GetPlatformEncryptionKeysRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformEncryptionKeysRequest) GetPlatformEncryptionKeysResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformEncryptionKeysResult) CloudEncryptionKeys(com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKeys)

Aggregations

CloudEncryptionKeys (com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKeys)11 CloudEncryptionKey (com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKey)6 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)3 PlatformEncryptionKeysResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformEncryptionKeysResponse)3 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)3 Test (org.junit.jupiter.api.Test)3 AliasListEntry (com.amazonaws.services.kms.model.AliasListEntry)2 DescribeKeyRequest (com.amazonaws.services.kms.model.DescribeKeyRequest)2 DescribeKeyResult (com.amazonaws.services.kms.model.DescribeKeyResult)2 ListAliasesRequest (com.amazonaws.services.kms.model.ListAliasesRequest)2 ListAliasesResult (com.amazonaws.services.kms.model.ListAliasesResult)2 ListKeysRequest (com.amazonaws.services.kms.model.ListKeysRequest)2 ListKeysResult (com.amazonaws.services.kms.model.ListKeysResult)2 AwsCredentialView (com.sequenceiq.cloudbreak.cloud.aws.common.view.AwsCredentialView)2 CloudPlatformVariant (com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant)2 EnvironmentValidationDto (com.sequenceiq.environment.environment.dto.EnvironmentValidationDto)2 PlatformResourceRequest (com.sequenceiq.environment.platformresource.PlatformResourceRequest)2 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 Supplier (java.util.function.Supplier)2