Search in sources :

Example 6 with AwsCredentialParameters

use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters in project cloudbreak by hortonworks.

the class AuditCredentialAuthorizationIntegrationTest method getAwsKeyBasedCredentialParameters.

private AwsCredentialParameters getAwsKeyBasedCredentialParameters() {
    AwsCredentialParameters aws = new AwsCredentialParameters();
    aws.setGovCloud(false);
    KeyBasedParameters keyBased = new KeyBasedParameters();
    keyBased.setAccessKey("accessKey");
    keyBased.setSecretKey("secretKey");
    aws.setKeyBased(keyBased);
    return aws;
}
Also used : KeyBasedParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.KeyBasedParameters) AwsCredentialParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters)

Example 7 with AwsCredentialParameters

use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters in project cloudbreak by hortonworks.

the class CredentialAuthorizationIntegrationTest method getAwsKeyBasedCredentialParameters.

private AwsCredentialParameters getAwsKeyBasedCredentialParameters() {
    AwsCredentialParameters aws = new AwsCredentialParameters();
    aws.setGovCloud(false);
    KeyBasedParameters keyBased = new KeyBasedParameters();
    keyBased.setAccessKey("accessKey");
    keyBased.setSecretKey("secretKey");
    aws.setKeyBased(keyBased);
    return aws;
}
Also used : KeyBasedParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.KeyBasedParameters) AwsCredentialParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters)

Example 8 with AwsCredentialParameters

use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters in project cloudbreak by hortonworks.

the class AwsCredentialV1ParametersToAwsCredentialAttributesConverter method convert.

public AwsCredentialParameters convert(AwsCredentialAttributes source) {
    AwsCredentialParameters response = new AwsCredentialParameters();
    doIfNotNull(source.getKeyBased(), params -> response.setKeyBased(getKeyBased(params)));
    doIfNotNull(source.getRoleBased(), params -> response.setRoleBased(getRoleBased(params)));
    return response;
}
Also used : AwsCredentialParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters)

Example 9 with AwsCredentialParameters

use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters in project cloudbreak by hortonworks.

the class CredentialValidator method validateAwsCredentialRequest.

public ValidationResult validateAwsCredentialRequest(CredentialRequest credentialRequest) {
    ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
    resultBuilder.ifError(() -> !CloudPlatform.AWS.name().equalsIgnoreCase(credentialRequest.getCloudPlatform()), "Credential request is not for AWS.");
    resultBuilder.ifError(() -> StringUtils.isBlank(Optional.ofNullable(credentialRequest.getAws()).map(AwsCredentialParameters::getRoleBased).map(RoleBasedParameters::getRoleArn).orElse(null)), "Role ARN is not found in credential request.");
    return resultBuilder.build();
}
Also used : ValidationResultBuilder(com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder) AwsCredentialParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters)

Example 10 with AwsCredentialParameters

use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters in project cloudbreak by hortonworks.

the class AwsCloudProvider method awsCredentialDetailsArn.

public AwsCredentialParameters awsCredentialDetailsArn() {
    AwsCredentialParameters parameters = new AwsCredentialParameters();
    RoleBasedParameters roleBasedCredentialParameters = new RoleBasedParameters();
    String roleArn = awsProperties.getCredential().getRoleArn();
    roleBasedCredentialParameters.setRoleArn(roleArn);
    parameters.setRoleBased(roleBasedCredentialParameters);
    return parameters;
}
Also used : RoleBasedParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.RoleBasedParameters) AwsCredentialParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters)

Aggregations

AwsCredentialParameters (com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters)11 KeyBasedParameters (com.sequenceiq.environment.api.v1.credential.model.parameters.aws.KeyBasedParameters)4 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)3 RoleBasedParameters (com.sequenceiq.environment.api.v1.credential.model.parameters.aws.RoleBasedParameters)3 CredentialRequest (com.sequenceiq.environment.api.v1.credential.model.request.CredentialRequest)3 Test (org.junit.jupiter.api.Test)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 ValidationResultBuilder (com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder)1