use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.RoleBasedParameters in project cloudbreak by hortonworks.
the class CredentialValidatorTest method testValidateAwsCredentialRequestValid.
@Test
void testValidateAwsCredentialRequestValid() {
CredentialRequest request = new CredentialRequest();
request.setCloudPlatform("AWS");
AwsCredentialParameters aws = new AwsCredentialParameters();
RoleBasedParameters roleBased = new RoleBasedParameters();
roleBased.setRoleArn("arn");
aws.setRoleBased(roleBased);
request.setAws(aws);
ValidationResult result = underTest.validateAwsCredentialRequest(request);
assertFalse(result.hasError());
}
use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.RoleBasedParameters in project cloudbreak by hortonworks.
the class CredentialValidatorTest method testValidateAwsCredentialRequestNoArn.
@Test
void testValidateAwsCredentialRequestNoArn() {
CredentialRequest request = new CredentialRequest();
request.setCloudPlatform("AWS");
AwsCredentialParameters aws = new AwsCredentialParameters();
aws.setRoleBased(new RoleBasedParameters());
request.setAws(aws);
ValidationResult result = underTest.validateAwsCredentialRequest(request);
assertTrue(result.hasError());
assertEquals("Role ARN is not found in credential request.", result.getErrors().get(0));
}
use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.RoleBasedParameters in project cloudbreak by hortonworks.
the class AwsCredentialV1ParametersToAwsCredentialAttributesConverter method getRoleBased.
private RoleBasedParameters getRoleBased(RoleBasedCredentialAttributes source) {
RoleBasedParameters roleBased = new RoleBasedParameters();
roleBased.setRoleArn(source.getRoleArn());
return roleBased;
}
use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.RoleBasedParameters 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();
}
use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.RoleBasedParameters 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;
}
Aggregations