Search in sources :

Example 1 with GcpCredentialPrerequisites

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

the class GcpCredentialConnectorTest method testPrerequisites.

@Test
public void testPrerequisites() {
    final AuthenticatedContext authContext = createAuthContext();
    when(gcpPlatformParameters.getPrerequisitesCreationCommand(CredentialType.ENVIRONMENT)).thenReturn("prerequisites");
    CredentialPrerequisitesResponse prerequisites = underTest.getPrerequisites(authContext.getCloudContext(), "externalId", "auditExternalId", "deploymentAddress", CredentialType.ENVIRONMENT);
    CredentialPrerequisitesResponse credentialPrerequisitesResponse = new CredentialPrerequisitesResponse("platform", new GcpCredentialPrerequisites(Base64.encodeBase64String("prerequisites".getBytes())));
    Assert.assertEquals(credentialPrerequisitesResponse, prerequisites);
}
Also used : GcpCredentialPrerequisites(com.sequenceiq.cloudbreak.cloud.response.GcpCredentialPrerequisites) CredentialPrerequisitesResponse(com.sequenceiq.cloudbreak.cloud.response.CredentialPrerequisitesResponse) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) Test(org.junit.jupiter.api.Test)

Example 2 with GcpCredentialPrerequisites

use of com.sequenceiq.cloudbreak.cloud.response.GcpCredentialPrerequisites 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 3 with GcpCredentialPrerequisites

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

the class GcpCredentialConnector method getPrerequisites.

@Override
public CredentialPrerequisitesResponse getPrerequisites(CloudContext cloudContext, String externalId, String auditExternalId, String deploymentAddress, CredentialType type) {
    String prerequisitesCreationCommand = gcpPlatformParameters.getPrerequisitesCreationCommand(type);
    GcpCredentialPrerequisites gcpPrereqs = new GcpCredentialPrerequisites(Base64.encodeBase64String(prerequisitesCreationCommand.getBytes()));
    return new CredentialPrerequisitesResponse(cloudContext.getPlatform().value(), gcpPrereqs);
}
Also used : GcpCredentialPrerequisites(com.sequenceiq.cloudbreak.cloud.response.GcpCredentialPrerequisites) CredentialPrerequisitesResponse(com.sequenceiq.cloudbreak.cloud.response.CredentialPrerequisitesResponse)

Aggregations

CredentialPrerequisitesResponse (com.sequenceiq.cloudbreak.cloud.response.CredentialPrerequisitesResponse)3 GcpCredentialPrerequisites (com.sequenceiq.cloudbreak.cloud.response.GcpCredentialPrerequisites)3 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)1 AwsCredentialPrerequisites (com.sequenceiq.cloudbreak.cloud.response.AwsCredentialPrerequisites)1 AzureCredentialPrerequisites (com.sequenceiq.cloudbreak.cloud.response.AzureCredentialPrerequisites)1 Test (org.junit.jupiter.api.Test)1