use of com.sequenceiq.cloudbreak.cloud.response.AzureCredentialPrerequisites 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;
}
use of com.sequenceiq.cloudbreak.cloud.response.AzureCredentialPrerequisites in project cloudbreak by hortonworks.
the class AzureCredentialConnector method getPrerequisites.
@Override
public CredentialPrerequisitesResponse getPrerequisites(CloudContext cloudContext, String externalId, String auditExternalId, String deploymentAddress, CredentialType type) {
String credentialCreationCommand = appCreationCommand.generateEnvironmentCredentialCommand(deploymentAddress);
String auditCredentialCreationCommand = appCreationCommand.generateAuditCredentialCommand(deploymentAddress);
String encodedCommand;
String roleDefJson;
switch(type) {
case ENVIRONMENT:
roleDefJson = azurePlatformParameters.getRoleDefJson();
encodedCommand = Base64.encodeBase64String(credentialCreationCommand.getBytes());
break;
case AUDIT:
roleDefJson = azurePlatformParameters.getAuditRoleDefJson();
encodedCommand = Base64.encodeBase64String(auditCredentialCreationCommand.getBytes());
break;
default:
encodedCommand = null;
roleDefJson = null;
break;
}
AzureCredentialPrerequisites azurePrerequisites = new AzureCredentialPrerequisites(encodedCommand, roleDefJson);
return new CredentialPrerequisitesResponse(cloudContext.getPlatform().value(), azurePrerequisites);
}
Aggregations