Search in sources :

Example 41 with CloudCredential

use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.

the class AwsMetaDataCollectorTest method authenticatedContext.

private AuthenticatedContext authenticatedContext() {
    Location location = Location.location(Region.region("region"), AvailabilityZone.availabilityZone("az"));
    CloudContext cloudContext = new CloudContext(5L, "name", "platform", "owner", "variant", location);
    CloudCredential cc = new CloudCredential(1L, null, null);
    return new AuthenticatedContext(cloudContext, cc);
}
Also used : CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) Location(com.sequenceiq.cloudbreak.cloud.model.Location)

Example 42 with CloudCredential

use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.

the class AwsPlatformResourcesTest method collectAccessConfigsWhenUserGetServiceExceptionToGetInfoThenItShouldReturnEmptyList.

@Test
public void collectAccessConfigsWhenUserGetServiceExceptionToGetInfoThenItShouldReturnEmptyList() throws Exception {
    BadRequestException badRequestException = new BadRequestException("BadRequestException problem.");
    when(awsClient.createAmazonIdentityManagement(any(AwsCredentialView.class))).thenReturn(amazonCFClient);
    when(amazonCFClient.listInstanceProfiles()).thenThrow(badRequestException);
    thrown.expect(CloudConnectorException.class);
    thrown.expectMessage("Could not get instance profile roles from Amazon: BadRequestException problem.");
    CloudAccessConfigs cloudAccessConfigs = underTest.accessConfigs(new CloudCredential(1L, "aws-credential"), region("London"), new HashMap<>());
    Assert.assertEquals(0, cloudAccessConfigs.getCloudAccessConfigs().size());
}
Also used : AwsCredentialView(com.sequenceiq.cloudbreak.cloud.aws.view.AwsCredentialView) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) BadRequestException(javax.ws.rs.BadRequestException) CloudAccessConfigs(com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs) Test(org.junit.Test)

Example 43 with CloudCredential

use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.

the class AwsPlatformResourcesTest method collectAccessConfigsWhenUserGetAmazonExceptionToGetInfoThenItShouldReturnEmptyList.

@Test
public void collectAccessConfigsWhenUserGetAmazonExceptionToGetInfoThenItShouldReturnEmptyList() throws Exception {
    AmazonServiceException amazonServiceException = new AmazonServiceException("Amazon problem.");
    amazonServiceException.setStatusCode(404);
    amazonServiceException.setErrorMessage("Amazon problem.");
    when(awsClient.createAmazonIdentityManagement(any(AwsCredentialView.class))).thenReturn(amazonCFClient);
    when(amazonCFClient.listInstanceProfiles()).thenThrow(amazonServiceException);
    thrown.expect(CloudConnectorException.class);
    thrown.expectMessage("Could not get instance profile roles from Amazon: Amazon problem.");
    CloudAccessConfigs cloudAccessConfigs = underTest.accessConfigs(new CloudCredential(1L, "aws-credential"), region("London"), new HashMap<>());
    Assert.assertEquals(0, cloudAccessConfigs.getCloudAccessConfigs().size());
}
Also used : AwsCredentialView(com.sequenceiq.cloudbreak.cloud.aws.view.AwsCredentialView) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) AmazonServiceException(com.amazonaws.AmazonServiceException) CloudAccessConfigs(com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs) Test(org.junit.Test)

Example 44 with CloudCredential

use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.

the class AwsTagPreparationServiceTest method authenticatedContext.

private AuthenticatedContext authenticatedContext() {
    CloudContext cloudContext = new CloudContext(1L, "testname", "AWS", "owner");
    CloudCredential cloudCredential = new CloudCredential(1L, "credentialname");
    return new AuthenticatedContext(cloudContext, cloudCredential);
}
Also used : CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)

Example 45 with CloudCredential

use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.

the class CloudFormationTemplateBuilderTest method authenticatedContext.

private AuthenticatedContext authenticatedContext() {
    Location location = Location.location(Region.region("region"), AvailabilityZone.availabilityZone("az"));
    CloudContext cloudContext = new CloudContext(5L, "name", "platform", "owner", "variant", location);
    CloudCredential cc = new CloudCredential(1L, null);
    return new AuthenticatedContext(cloudContext, cc);
}
Also used : CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) Location(com.sequenceiq.cloudbreak.cloud.model.Location)

Aggregations

CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)47 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)27 Location (com.sequenceiq.cloudbreak.cloud.model.Location)18 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)10 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)9 OperationException (com.sequenceiq.cloudbreak.service.stack.connector.OperationException)9 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)8 Stack (com.sequenceiq.cloudbreak.domain.Stack)8 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)7 CloudAccessConfigs (com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs)7 HashSet (java.util.HashSet)7 Compute (com.google.api.services.compute.Compute)6 CloudResource (com.sequenceiq.cloudbreak.cloud.model.CloudResource)6 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)6 AwsCredentialView (com.sequenceiq.cloudbreak.cloud.aws.view.AwsCredentialView)5 CloudRegions (com.sequenceiq.cloudbreak.cloud.model.CloudRegions)5 AvailabilityZone (com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone)4 CloudVmTypes (com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes)4 Strings (com.google.common.base.Strings)3