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);
}
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;
}
Aggregations