use of com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse in project cloudbreak by hortonworks.
the class EnvironmentServiceIntegrationTest method testCredentialGetByName.
@Test
public void testCredentialGetByName() {
credentialRepository.save(credential);
CredentialResponse results = client.credentialV1Endpoint().getByName(credential.getName());
assertTrue(results.getName().equals(credential.getName()), String.format("Result should have credential with name: %s", credential.getName()));
}
use of com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse in project cloudbreak by hortonworks.
the class ClusterCreationEnvironmentValidatorTest method getEnvironmentResponse.
private DetailedEnvironmentResponse getEnvironmentResponse() {
DetailedEnvironmentResponse environmentResponse = new DetailedEnvironmentResponse();
environmentResponse.setCloudPlatform("AWS");
environmentResponse.setCredential(new CredentialResponse());
CompactRegionResponse compactRegionResponse = new CompactRegionResponse();
compactRegionResponse.setNames(Lists.newArrayList("region1"));
environmentResponse.setRegions(compactRegionResponse);
return environmentResponse;
}
use of com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse in project cloudbreak by hortonworks.
the class StackAwsEncryptionValidatorTest method setup.
@Before
public void setup() {
CredentialResponse credentialResponse = new CredentialResponse();
credentialResponse.setName("cred");
when(subject.getEnvironmentCrn()).thenReturn(ENV_CRN);
when(subject.getRegion()).thenReturn("region");
when(subject.getResourceCrn()).thenReturn(ENV_CRN);
DetailedEnvironmentResponse environmentResponse = new DetailedEnvironmentResponse();
environmentResponse.setCredential(credentialResponse);
environmentResponse.setCrn(ENV_CRN);
when(entitlementService.awsNativeEnabled(anyString())).thenReturn(false);
when(environmentClientService.getByCrn(anyString())).thenReturn(environmentResponse);
when(templateRequestValidator.validate(any())).thenReturn(ValidationResult.builder().build());
}
use of com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse in project cloudbreak by hortonworks.
the class EnvironmentServiceDecorator method prepareEnvironmentAndCredentialName.
public void prepareEnvironmentAndCredentialName(StackV4Response stackResponse) {
try {
DetailedEnvironmentResponse byCrn = environmentClientService.getByCrn(stackResponse.getEnvironmentCrn());
stackResponse.setEnvironmentName(byCrn.getName());
CredentialResponse credential = byCrn.getCredential();
stackResponse.setGovCloud(credential.getGovCloud() == null ? false : credential.getGovCloud());
stackResponse.setCredentialName(credential.getName());
stackResponse.setCredentialCrn(credential.getCrn());
} catch (Exception e) {
LOGGER.warn("Environment deleted which had crn: {}.", stackResponse.getEnvironmentCrn());
}
}
use of com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse in project cloudbreak by hortonworks.
the class EnvironmentServiceDecorator method prepareEnvironmentAndCredential.
public void prepareEnvironmentAndCredential(Set<StackViewV4Response> stackViewResponses, DetailedEnvironmentResponse detailedEnvironmentResponse) {
for (StackViewV4Response stackViewResponse : stackViewResponses) {
if (detailedEnvironmentResponse != null) {
CredentialResponse credential = detailedEnvironmentResponse.getCredential();
stackViewResponse.setGovCloud(credential.getGovCloud() == null ? false : credential.getGovCloud());
stackViewResponse.setCredentialName(credential.getName());
stackViewResponse.setEnvironmentName(detailedEnvironmentResponse.getName());
}
}
}
Aggregations