Search in sources :

Example 41 with Instance

use of com.google.api.services.notebooks.v1.model.Instance in project airavata by apache.

the class AmazonUtil method loadInstances.

/**
 * Load instances
 *
 * @return list of instances
 */
public static List<Instance> loadInstances() {
    List<Instance> resultList = new ArrayList<Instance>();
    DescribeInstancesResult describeInstancesResult = getEC2Client().describeInstances();
    List<Reservation> reservations = describeInstancesResult.getReservations();
    for (Iterator<Reservation> iterator = reservations.iterator(); iterator.hasNext(); ) {
        Reservation reservation = iterator.next();
        for (Instance instance : reservation.getInstances()) {
            resultList.add(instance);
        }
    }
    return resultList;
}
Also used : DescribeInstancesResult(com.amazonaws.services.ec2.model.DescribeInstancesResult) Reservation(com.amazonaws.services.ec2.model.Reservation) Instance(com.amazonaws.services.ec2.model.Instance) ArrayList(java.util.ArrayList)

Example 42 with Instance

use of com.google.api.services.notebooks.v1.model.Instance in project photon-model by vmware.

the class AWSRemoteCleanup method deleteAwsEc2instances.

private void deleteAwsEc2instances(List<String> vpcIdsToBeDeleted, DescribeInstancesResult describeInstancesResult, AmazonEC2 ec2Client) {
    List<String> instanceIdsToBeDeleted = new ArrayList<>();
    List<Reservation> reservations = describeInstancesResult.getReservations();
    for (Reservation reservation : reservations) {
        List<Instance> instances = reservation.getInstances();
        for (Instance instance : instances) {
            long instanceLaunchTimeMicros = TimeUnit.MILLISECONDS.toMicros(instance.getLaunchTime().getTime());
            long timeDifference = Utils.getNowMicrosUtc() - instanceLaunchTimeMicros;
            if (timeDifference > TimeUnit.HOURS.toMicros(1) && vpcIdsToBeDeleted.contains(instance.getVpcId()) && shouldDelete(instance)) {
                this.host.log(Level.INFO, "Marking %s instance for deletion", instance.getInstanceId());
                instanceIdsToBeDeleted.add(instance.getInstanceId());
            }
        }
    }
    triggerEC2Deletion(instanceIdsToBeDeleted, ec2Client);
}
Also used : Reservation(com.amazonaws.services.ec2.model.Reservation) Instance(com.amazonaws.services.ec2.model.Instance) ArrayList(java.util.ArrayList)

Example 43 with Instance

use of com.google.api.services.notebooks.v1.model.Instance in project photon-model by vmware.

the class AWSResetServiceTest method setVMSecurityGroupsToBeDeleted.

private void setVMSecurityGroupsToBeDeleted(Instance instance, ComputeState vm) {
    // This assert is only suitable for real (non-mocking env).
    if (this.isMock) {
        return;
    }
    // Get the SecurityGroupStates that were provided in the request ComputeState
    Collector<SecurityGroupState, ?, Map<String, SecurityGroupState>> convertToMap = Collectors.<SecurityGroupState, String, SecurityGroupState>toMap(sg -> sg.name, sg -> sg);
    Map<String, SecurityGroupState> currentSGNamesToStates = vm.networkInterfaceLinks.stream().map(nicLink -> this.host.getServiceState(null, NetworkInterfaceState.class, UriUtils.buildUri(this.host, nicLink))).<// collect all SecurityGroup States from all NIC states
    SecurityGroupState>flatMap(nicState -> nicState.securityGroupLinks.stream().map(sgLink -> {
        SecurityGroupState sgState = this.host.getServiceState(null, SecurityGroupState.class, UriUtils.buildUri(this.host, sgLink));
        return sgState;
    })).collect(convertToMap);
    for (SecurityGroupState currentSGState : currentSGNamesToStates.values()) {
        // Ensure that the requested SecurityGroup was actually provisioned
        if (currentSGState.name.contains(TestAWSSetupUtils.AWS_NEW_GROUP_PREFIX)) {
            this.sgToCleanUp = currentSGState.id;
        }
    }
}
Also used : Service(com.vmware.xenon.common.Service) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) ProvisionComputeTaskService(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService) TestAWSSetupUtils.createAWSComputeHost(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.createAWSComputeHost) PhotonModelServices(com.vmware.photon.controller.model.PhotonModelServices) VerificationHost(com.vmware.xenon.common.test.VerificationHost) TestAWSSetupUtils.createAWSResourcePool(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.createAWSResourcePool) TestAWSSetupUtils.tearDownTestVpc(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.tearDownTestVpc) TestAWSSetupUtils.setUpTestVpc(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.setUpTestVpc) ResourceOperationRequest(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationRequest) CommandLineArgumentParser(com.vmware.xenon.common.CommandLineArgumentParser) Utils(com.vmware.xenon.common.Utils) TestAWSSetupUtils.verifyRemovalOfResourceState(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.verifyRemovalOfResourceState) Map(java.util.Map) After(org.junit.After) TestUtils.getExecutor(com.vmware.photon.controller.model.adapters.awsadapter.TestUtils.getExecutor) Collector(java.util.stream.Collector) ProvisioningUtils(com.vmware.photon.controller.model.tasks.ProvisioningUtils) AwsNicSpecs(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.AwsNicSpecs) EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) StatelessService(com.vmware.xenon.common.StatelessService) AWS_VM_REQUEST_TIMEOUT_MINUTES(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.AWS_VM_REQUEST_TIMEOUT_MINUTES) ResourceOperationResponse(com.vmware.photon.controller.model.adapterapi.ResourceOperationResponse) TestUtils(com.vmware.photon.controller.model.tasks.TestUtils) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) List(java.util.List) TestAWSSetupUtils.getVMState(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.getVMState) ResourceOperation(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperation) UriUtils(com.vmware.xenon.common.UriUtils) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) TaskState(com.vmware.xenon.common.TaskState) TestAWSSetupUtils.deleteSecurityGroupUsingEC2Client(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.deleteSecurityGroupUsingEC2Client) PhotonModelMetricServices(com.vmware.photon.controller.model.PhotonModelMetricServices) ResourcePoolState(com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState) HashMap(java.util.HashMap) TestAWSSetupUtils.zoneId(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.zoneId) Function(java.util.function.Function) ProvisionComputeTaskState(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) SecurityGroupState(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState) TestAWSSetupUtils.getAwsInstancesByIds(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.getAwsInstancesByIds) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) TestName(org.junit.rules.TestName) Instance(com.amazonaws.services.ec2.model.Instance) Before(org.junit.Before) TestAWSSetupUtils.createAWSAuthentication(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.createAWSAuthentication) PhotonModelTaskServices(com.vmware.photon.controller.model.tasks.PhotonModelTaskServices) Operation(com.vmware.xenon.common.Operation) TestAWSSetupUtils.getCompute(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.getCompute) Test(org.junit.Test) TimeUnit(java.util.concurrent.TimeUnit) TestAWSSetupUtils.createAWSVMResource(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.createAWSVMResource) Rule(org.junit.Rule) TestContext(com.vmware.xenon.common.test.TestContext) PhotonModelAdaptersRegistryAdapters(com.vmware.photon.controller.model.adapters.registry.PhotonModelAdaptersRegistryAdapters) TestAWSSetupUtils.regionId(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.regionId) TestAWSSetupUtils.setAwsClientMockInfo(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.setAwsClientMockInfo) Collections(java.util.Collections) AmazonEC2AsyncClient(com.amazonaws.services.ec2.AmazonEC2AsyncClient) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) SecurityGroupState(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState) Map(java.util.Map) HashMap(java.util.HashMap)

Example 44 with Instance

use of com.google.api.services.notebooks.v1.model.Instance in project photon-model by vmware.

the class AWSComputeStateCreationAdapterService method collectEbsDiskLinks.

/**
 * Collect EBS selfLinks by querying for all EBS disk IDs. Map these selfLinks to
 * their respective instances. These will be used for reconciliation with local state while
 * creating/updating compute state's diskLinks.
 */
private void collectEbsDiskLinks(AWSComputeStateCreationContext context, AWSComputeStateCreationStage next) {
    List<String> diskIds = new ArrayList<>();
    Map<String, Instance> instancesByDiskIds = new HashMap<>();
    context.request.instancesToBeCreated.stream().forEach(instance -> {
        instance.getBlockDeviceMappings().stream().forEach(instanceBlockDeviceMapping -> {
            String id = instanceBlockDeviceMapping.getEbs().getVolumeId();
            instancesByDiskIds.put(id, instance);
            diskIds.add(id);
        });
    });
    context.request.instancesToBeUpdated.values().stream().forEach(instance -> {
        instance.getBlockDeviceMappings().stream().forEach(instanceBlockDeviceMapping -> {
            String id = instanceBlockDeviceMapping.getEbs().getVolumeId();
            instancesByDiskIds.put(id, instance);
            diskIds.add(id);
        });
    });
    // No disks found for current page of instances.
    if (diskIds.isEmpty()) {
        context.creationStage = next;
        handleComputeStateCreateOrUpdate(context);
        return;
    }
    Query ebsQuery = Query.Builder.create().addKindFieldClause(DiskState.class).addCollectionItemClause(ResourceState.FIELD_NAME_ENDPOINT_LINKS, context.request.endpointLink).addInClause(DiskState.FIELD_NAME_ID, diskIds).build();
    QueryTask ebsQueryTask = QueryTask.Builder.createDirectTask().setQuery(ebsQuery).addOption(QueryOption.EXPAND_CONTENT).build();
    ebsQueryTask.tenantLinks = context.request.tenantLinks;
    QueryUtils.startInventoryQueryTask(this, ebsQueryTask).whenComplete((qrt, e) -> {
        if (e != null) {
            logWarning("Error querying diskLinks for endpoint %s", context.request.endpointLink);
            context.creationStage = next;
            handleComputeStateCreateOrUpdate(context);
            return;
        }
        if (qrt.results != null && qrt.results.documentCount > 0) {
            qrt.results.documents.entrySet().forEach(entry -> {
                DiskState state = Utils.fromJson(entry.getValue(), DiskState.class);
                Instance instance = instancesByDiskIds.get(state.id);
                if (instance != null) {
                    if (context.diskLinksByInstances.containsKey(instance)) {
                        context.diskLinksByInstances.get(instance).add(entry.getKey());
                    } else {
                        context.diskLinksByInstances.put(instance, new ArrayList<>(Arrays.asList(entry.getKey())));
                    }
                }
            });
        }
        context.creationStage = next;
        handleComputeStateCreateOrUpdate(context);
    });
}
Also used : QueryTask(com.vmware.xenon.services.common.QueryTask) Query(com.vmware.xenon.services.common.QueryTask.Query) AWSEnumerationUtils.getCDsRepresentingVMsInLocalSystemCreatedByEnumerationQuery(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSEnumerationUtils.getCDsRepresentingVMsInLocalSystemCreatedByEnumerationQuery) Instance(com.amazonaws.services.ec2.model.Instance) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) ArrayList(java.util.ArrayList)

Example 45 with Instance

use of com.google.api.services.notebooks.v1.model.Instance in project photon-model by vmware.

the class AWSComputeStateCreationAdapterService method addUpdateOrRemoveNICStates.

/**
 * From the previously calculated NICs delta (based on whether the local state correspond to
 * existing AWS object, the AWS object was deleted, or a new AWS object was added): 1) Create,
 * update or delete NICState objects 2) Update the CS's references to the added or removed
 * NetworkInterfaceStates
 */
private Map<String, Map<String, Collection<Object>>> addUpdateOrRemoveNICStates(AWSComputeStateCreationContext context, Instance instance, Map<String, List<Integer>> nicsDeviceIndexDeltaMap, String existingEndpointLink, Set<String> endpointLinks) {
    List<NetworkInterfaceState> existingNicStates = context.request.nicStatesToBeUpdated.get(instance.getInstanceId());
    // Generate operation for adding NIC state and description, and retain its link to add to
    // the CS
    List<Integer> deviceIndexesToAdd = nicsDeviceIndexDeltaMap.get(ADD_NIC_STATES);
    Collection<Object> networkInterfaceLinksToBeAdded = instance.getNetworkInterfaces().stream().filter(awsNic -> deviceIndexesToAdd.contains(awsNic.getAttachment().getDeviceIndex()) && context.request.enumeratedNetworks != null && context.request.enumeratedNetworks.subnets != null && context.request.enumeratedNetworks.subnets.containsKey(awsNic.getSubnetId())).map(awsNic -> createNICStateAndDescription(context, awsNic, existingEndpointLink, endpointLinks)).map(addedNicState -> UriUtils.buildUriPath(NetworkInterfaceService.FACTORY_LINK, addedNicState.documentSelfLink)).collect(Collectors.toList());
    // Generate operation for removing NIC states, and retain its link to remove from the CS {{
    List<Integer> deviceIndexesToRemove = nicsDeviceIndexDeltaMap.get(REMOVE_NIC_STATES);
    Collection<Object> networkInterfaceLinksToBeRemoved = deviceIndexesToRemove.stream().map(deviceIndexToRemove -> {
        NetworkInterfaceState stateToDelete = existingNicStates.stream().filter(existNicState -> existNicState.deviceIndex == deviceIndexToRemove).findFirst().orElse(null);
        return stateToDelete;
    }).filter(existingNicState -> existingNicState != null).map(existingNicState -> deleteNICState(context, existingNicState)).map(existingNicState -> existingNicState.documentSelfLink).collect(Collectors.toList());
    // Generate operation for updating NIC states, no links should be updated on CS in this case
    List<Integer> deviceIndexesToUpdate = nicsDeviceIndexDeltaMap.get(UPDATE_NIC_STATES);
    deviceIndexesToUpdate.stream().map(deviceIndexToUpdate -> existingNicStates.stream().filter(existNicState -> existNicState.deviceIndex == deviceIndexToUpdate).findFirst().orElse(null)).filter(existingNicState -> existingNicState != null).forEach(existingNicState -> updateNICState(context, instance, existingNicState));
    if (context.request.nicStatesToBeDeleted.size() > 0 && context.request.nicStatesToBeDeleted.get(instance.getInstanceId()) != null) {
        this.logInfo(() -> String.format("Compute %s failed to discover %d nics", instance.getInstanceId(), context.request.nicStatesToBeDeleted.get(instance.getInstanceId()).size()));
        networkInterfaceLinksToBeRemoved.addAll(context.request.nicStatesToBeDeleted.get(instance.getInstanceId()));
    }
    Map<String, Map<String, Collection<Object>>> nicsDeltaMap = new HashMap<>();
    // only add the collections to the delta map in case there is something to add/remove
    if (!networkInterfaceLinksToBeRemoved.isEmpty()) {
        Map<String, Collection<Object>> collectionsToRemoveMap = new HashMap<>();
        collectionsToRemoveMap.put(ComputeState.FIELD_NAME_NETWORK_INTERFACE_LINKS, networkInterfaceLinksToBeRemoved);
        nicsDeltaMap.put(REMOVE_NIC_STATES, collectionsToRemoveMap);
    }
    if (!networkInterfaceLinksToBeAdded.isEmpty()) {
        Map<String, Collection<Object>> collectionsToAddMap = new HashMap<>();
        collectionsToAddMap.put(ComputeState.FIELD_NAME_NETWORK_INTERFACE_LINKS, networkInterfaceLinksToBeAdded);
        nicsDeltaMap.put(ADD_NIC_STATES, collectionsToAddMap);
    }
    return nicsDeltaMap;
}
Also used : AdapterUtils.createDeleteOperation(com.vmware.photon.controller.model.adapters.util.AdapterUtils.createDeleteOperation) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) Arrays(java.util.Arrays) QueryTask(com.vmware.xenon.services.common.QueryTask) InstanceDescKey(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSEnumerationUtils.InstanceDescKey) AWSEnumerationUtils(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSEnumerationUtils) StringUtils(org.apache.commons.lang3.StringUtils) AWSEnumerationUtils.getKeyForComputeDescriptionFromCD(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSEnumerationUtils.getKeyForComputeDescriptionFromCD) Utils(com.vmware.xenon.common.Utils) Map(java.util.Map) GroupIdentifier(com.amazonaws.services.ec2.model.GroupIdentifier) AdapterUtils.createPatchOperation(com.vmware.photon.controller.model.adapters.util.AdapterUtils.createPatchOperation) URI(java.net.URI) TagsUtil.newTagState(com.vmware.photon.controller.model.adapters.util.TagsUtil.newTagState) AWSClientManager(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManager) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) StatelessService(com.vmware.xenon.common.StatelessService) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) UUID(java.util.UUID) AdapterUtils.getDeletionState(com.vmware.photon.controller.model.adapters.util.AdapterUtils.getDeletionState) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) NetworkInterfaceService(com.vmware.photon.controller.model.resources.NetworkInterfaceService) TagService(com.vmware.photon.controller.model.resources.TagService) Tag(com.amazonaws.services.ec2.model.Tag) DeferredResult(com.vmware.xenon.common.DeferredResult) UriUtils(com.vmware.xenon.common.UriUtils) TAG_KEY_TYPE(com.vmware.photon.controller.model.constants.PhotonModelConstants.TAG_KEY_TYPE) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) QueryOption(com.vmware.xenon.services.common.QueryTask.QuerySpecification.QueryOption) AWSEnumerationUtils.mapInstanceToComputeState(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSEnumerationUtils.mapInstanceToComputeState) ZoneData(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSEnumerationUtils.ZoneData) InstanceNetworkInterface(com.amazonaws.services.ec2.model.InstanceNetworkInterface) AWSResourceType.ec2_instance(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWSResourceType.ec2_instance) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) AWSConstants(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants) TagState(com.vmware.photon.controller.model.resources.TagService.TagState) AWSResourceType.ec2_net_interface(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWSResourceType.ec2_net_interface) ServiceStateCollectionUpdateRequest(com.vmware.xenon.common.ServiceStateCollectionUpdateRequest) Query(com.vmware.xenon.services.common.QueryTask.Query) TagsUtil.updateLocalTagStates(com.vmware.photon.controller.model.adapters.util.TagsUtil.updateLocalTagStates) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) AdapterUtils.createPostOperation(com.vmware.photon.controller.model.adapters.util.AdapterUtils.createPostOperation) AWSEnumerationUtils.getRepresentativeListOfCDsFromInstanceList(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSEnumerationUtils.getRepresentativeListOfCDsFromInstanceList) BiConsumer(java.util.function.BiConsumer) Instance(com.amazonaws.services.ec2.model.Instance) AWSSecurityGroupEnumerationResponse(com.vmware.photon.controller.model.adapters.awsadapter.enumeration.AWSSecurityGroupEnumerationAdapterService.AWSSecurityGroupEnumerationResponse) ResourceState(com.vmware.photon.controller.model.resources.ResourceState) Operation(com.vmware.xenon.common.Operation) QueryUtils(com.vmware.photon.controller.model.query.QueryUtils) AWSNetworkEnumerationResponse(com.vmware.photon.controller.model.adapters.awsadapter.enumeration.AWSNetworkStateEnumerationAdapterService.AWSNetworkEnumerationResponse) TimeUnit(java.util.concurrent.TimeUnit) AWSEnumerationUtils.getCDsRepresentingVMsInLocalSystemCreatedByEnumerationQuery(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSEnumerationUtils.getCDsRepresentingVMsInLocalSystemCreatedByEnumerationQuery) AWSClientManagerFactory(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManagerFactory) Collections(java.util.Collections) AWSUriPaths(com.vmware.photon.controller.model.adapters.awsadapter.AWSUriPaths) OperationJoin(com.vmware.xenon.common.OperationJoin) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Collection(java.util.Collection) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap)

Aggregations

Instance (com.amazonaws.services.ec2.model.Instance)185 Reservation (com.amazonaws.services.ec2.model.Reservation)84 ArrayList (java.util.ArrayList)82 DescribeInstancesResult (com.amazonaws.services.ec2.model.DescribeInstancesResult)71 DescribeInstancesRequest (com.amazonaws.services.ec2.model.DescribeInstancesRequest)48 List (java.util.List)48 Tag (com.amazonaws.services.ec2.model.Tag)41 Test (org.junit.jupiter.api.Test)38 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)36 Map (java.util.Map)36 Collectors (java.util.stream.Collectors)32 HashMap (java.util.HashMap)26 Filter (com.amazonaws.services.ec2.model.Filter)25 Set (java.util.Set)23 CloudResource (com.sequenceiq.cloudbreak.cloud.model.CloudResource)22 CloudVmMetaDataStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus)20 AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)18 InstanceState (com.amazonaws.services.ec2.model.InstanceState)18 Volume (com.amazonaws.services.ec2.model.Volume)18 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)18