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