Search in sources :

Example 1 with AwsCredentialParameters

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

the class CredentialValidatorTest method testValidateAwsCredentialRequestKeyBased.

@Test
void testValidateAwsCredentialRequestKeyBased() {
    CredentialRequest request = new CredentialRequest();
    request.setCloudPlatform("AWS");
    request.setAws(new AwsCredentialParameters());
    ValidationResult result = underTest.validateAwsCredentialRequest(request);
    assertTrue(result.hasError());
    assertEquals("Role ARN is not found in credential request.", result.getErrors().get(0));
}
Also used : CredentialRequest(com.sequenceiq.environment.api.v1.credential.model.request.CredentialRequest) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) AwsCredentialParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with AwsCredentialParameters

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

the class AwsCloudProvider method awsCredentialDetailsKey.

public AwsCredentialParameters awsCredentialDetailsKey() {
    AwsCredentialParameters parameters = new AwsCredentialParameters();
    KeyBasedParameters keyBasedCredentialParameters = new KeyBasedParameters();
    String accessKeyId = awsProperties.getCredential().getAccessKeyId();
    keyBasedCredentialParameters.setAccessKey(accessKeyId);
    String secretKey = awsProperties.getCredential().getSecretKey();
    keyBasedCredentialParameters.setSecretKey(secretKey);
    parameters.setKeyBased(keyBasedCredentialParameters);
    return parameters;
}
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 3 with AwsCredentialParameters

use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters 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());
}
Also used : CredentialRequest(com.sequenceiq.environment.api.v1.credential.model.request.CredentialRequest) RoleBasedParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.RoleBasedParameters) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) AwsCredentialParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with AwsCredentialParameters

use of com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters 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));
}
Also used : CredentialRequest(com.sequenceiq.environment.api.v1.credential.model.request.CredentialRequest) RoleBasedParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.RoleBasedParameters) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) AwsCredentialParameters(com.sequenceiq.environment.api.v1.credential.model.parameters.aws.AwsCredentialParameters) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with AwsCredentialParameters

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

the class EnvironmentServiceIntegrationTest method getAwsKeyBasedCredentialParameters.

private AwsCredentialParameters getAwsKeyBasedCredentialParameters(boolean govCloud, String yyy, String zzzz) {
    AwsCredentialParameters aws = new AwsCredentialParameters();
    aws.setGovCloud(govCloud);
    KeyBasedParameters keyBased = new KeyBasedParameters();
    keyBased.setAccessKey(yyy);
    keyBased.setSecretKey(zzzz);
    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)

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