use of com.sequenceiq.cloudbreak.domain.Resource in project cloudbreak by hortonworks.
the class StackToStackResponseConverterTest method createSource.
@Override
public Stack createSource() {
Stack stack = TestUtil.stack();
Cluster cluster = TestUtil.cluster(TestUtil.blueprint(), stack, 1L);
stack.setCluster(cluster);
stack.setAvailabilityZone("avZone");
Network network = new Network();
network.setId(1L);
stack.setNetwork(network);
stack.setFailurePolicy(new FailurePolicy());
Orchestrator orchestrator = new Orchestrator();
orchestrator.setId(1L);
orchestrator.setApiEndpoint("endpoint");
orchestrator.setType("type");
stack.setOrchestrator(orchestrator);
stack.setParameters(new HashMap<>());
stack.setCloudPlatform("OPENSTACK");
stack.setGatewayPort(9443);
stack.setCustomDomain("custom.domain");
stack.setCustomHostname("hostname");
stack.setStackAuthentication(new StackAuthentication());
stack.getStackAuthentication().setPublicKey("rsakey");
stack.getStackAuthentication().setLoginUserName("cloudbreak");
stack.setHostgroupNameAsHostname(false);
stack.setClusterNameAsSubdomain(false);
Resource s3ArnResource = new Resource(ResourceType.S3_ACCESS_ROLE_ARN, "s3Arn", stack);
stack.setResources(Collections.singleton(s3ArnResource));
return stack;
}
use of com.sequenceiq.cloudbreak.domain.Resource in project cloudbreak by hortonworks.
the class StackUpscaleService method transformResults.
private Set<Resource> transformResults(Iterable<CloudResourceStatus> cloudResourceStatuses, Stack stack) {
Set<Resource> retSet = new HashSet<>();
for (CloudResourceStatus cloudResourceStatus : cloudResourceStatuses) {
if (!cloudResourceStatus.isFailed()) {
CloudResource cloudResource = cloudResourceStatus.getCloudResource();
Resource resource = new Resource(cloudResource.getType(), cloudResource.getName(), cloudResource.getReference(), cloudResource.getStatus(), stack, null);
retSet.add(resource);
}
}
return retSet;
}
use of com.sequenceiq.cloudbreak.domain.Resource in project cloudbreak by hortonworks.
the class TestUtil method gcpResource.
public static Resource gcpResource(Long id, String instanceGroup) {
Resource resource = new Resource();
resource.setId(id);
resource.setStack(stack());
resource.setInstanceGroup(instanceGroup);
resource.setResourceName("testResource");
resource.setResourceType(ResourceType.GCP_INSTANCE);
return resource;
}
use of com.sequenceiq.cloudbreak.domain.Resource in project cloudbreak by hortonworks.
the class CloudResourceToResourceConverter method convert.
@Override
public Resource convert(CloudResource source) {
Resource domainResource = new Resource();
domainResource.setResourceType(source.getType());
domainResource.setResourceName(source.getName());
domainResource.setResourceReference(source.getReference());
domainResource.setResourceStatus(source.getStatus());
domainResource.setInstanceGroup(source.getGroup());
return domainResource;
}
use of com.sequenceiq.cloudbreak.domain.Resource in project cloudbreak by hortonworks.
the class CloudResourcePersisterService method delete.
@Override
public ResourceNotification delete(ResourceNotification notification) {
LOGGER.debug("Resource deletion notification received: {}", notification);
Long stackId = notification.getCloudContext().getId();
CloudResource cloudResource = notification.getCloudResource();
ResourceRepository repository = getResourceRepository();
Resource resource = repository.findByStackIdAndNameAndType(stackId, cloudResource.getName(), cloudResource.getType());
if (resource != null) {
repository.delete(resource);
}
return notification;
}
Aggregations