Search in sources :

Example 1 with AwsCredentialPrerequisites

use of com.sequenceiq.cloudbreak.cloud.response.AwsCredentialPrerequisites in project cloudbreak by hortonworks.

the class AwsCredentialConnector method getPrerequisites.

@Override
public CredentialPrerequisitesResponse getPrerequisites(CloudContext cloudContext, String externalId, String auditExternalId, String deploymentAddress, CredentialType type) {
    String policyJson;
    String actualExternalId;
    boolean govCloud = cloudContext.isGovCloud();
    switch(type) {
        case ENVIRONMENT:
            policyJson = awsPlatformParameters.getCredentialPoliciesJson().get(getPolicyType(govCloud));
            actualExternalId = externalId;
            break;
        case AUDIT:
            policyJson = awsPlatformParameters.getAuditPoliciesJson().get(getPolicyType(govCloud));
            actualExternalId = auditExternalId;
            break;
        default:
            policyJson = null;
            actualExternalId = null;
    }
    AwsCredentialPrerequisites awsPrerequisites = new AwsCredentialPrerequisites(actualExternalId, policyJson);
    awsPrerequisites.setPolicies(collectNecessaryPolicies(govCloud));
    return new CredentialPrerequisitesResponse(cloudContext.getPlatform().value(), getAccountId(govCloud), awsPrerequisites);
}
Also used : AwsCredentialPrerequisites(com.sequenceiq.cloudbreak.cloud.response.AwsCredentialPrerequisites) CredentialPrerequisitesResponse(com.sequenceiq.cloudbreak.cloud.response.CredentialPrerequisitesResponse)

Example 2 with AwsCredentialPrerequisites

use of com.sequenceiq.cloudbreak.cloud.response.AwsCredentialPrerequisites in project cloudbreak by hortonworks.

the class CredentialExperienceTest method getCredentialPrerequisitesResponse.

private CredentialPrerequisitesResponse getCredentialPrerequisitesResponse(String cloudProvider, String policy) {
    CredentialPrerequisitesResponse response = new CredentialPrerequisitesResponse();
    switch(cloudProvider) {
        case "AWS":
            response.setAws(new AwsCredentialPrerequisites());
            response.getAws().setPolicyJson(policy);
            response.getAws().setPolicies(Map.of("Environment", MINIMAL_POLICY));
            break;
        case "AZURE":
            response.setAzure(new AzureCredentialPrerequisites());
            response.getAzure().setRoleDefitionJson(policy);
            break;
        case "GCP":
            response.setGcp(new GcpCredentialPrerequisites());
            break;
        default:
    }
    return response;
}
Also used : AzureCredentialPrerequisites(com.sequenceiq.cloudbreak.cloud.response.AzureCredentialPrerequisites) GcpCredentialPrerequisites(com.sequenceiq.cloudbreak.cloud.response.GcpCredentialPrerequisites) CredentialPrerequisitesResponse(com.sequenceiq.cloudbreak.cloud.response.CredentialPrerequisitesResponse) AwsCredentialPrerequisites(com.sequenceiq.cloudbreak.cloud.response.AwsCredentialPrerequisites)

Aggregations

AwsCredentialPrerequisites (com.sequenceiq.cloudbreak.cloud.response.AwsCredentialPrerequisites)2 CredentialPrerequisitesResponse (com.sequenceiq.cloudbreak.cloud.response.CredentialPrerequisitesResponse)2 AzureCredentialPrerequisites (com.sequenceiq.cloudbreak.cloud.response.AzureCredentialPrerequisites)1 GcpCredentialPrerequisites (com.sequenceiq.cloudbreak.cloud.response.GcpCredentialPrerequisites)1