Search in sources :

Example 1 with AzureCredentialPrerequisites

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

Example 2 with AzureCredentialPrerequisites

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);
}
Also used : AzureCredentialPrerequisites(com.sequenceiq.cloudbreak.cloud.response.AzureCredentialPrerequisites) CredentialPrerequisitesResponse(com.sequenceiq.cloudbreak.cloud.response.CredentialPrerequisitesResponse)

Aggregations

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