Search in sources :

Example 1 with DescribeInstancesRequest

use of software.amazon.awssdk.services.ec2.model.DescribeInstancesRequest in project druid by druid-io.

the class EC2AutoScaler method terminate.

@Override
public AutoScalingData terminate(List<String> ips) {
    if (ips.isEmpty()) {
        return new AutoScalingData(Lists.<String>newArrayList());
    }
    DescribeInstancesResult result = amazonEC2Client.describeInstances(new DescribeInstancesRequest().withFilters(new Filter("private-ip-address", ips)));
    List<Instance> instances = Lists.newArrayList();
    for (Reservation reservation : result.getReservations()) {
        instances.addAll(reservation.getInstances());
    }
    try {
        return terminateWithIds(Lists.transform(instances, new Function<Instance, String>() {

            @Override
            public String apply(Instance input) {
                return input.getInstanceId();
            }
        }));
    } catch (Exception e) {
        log.error(e, "Unable to terminate any instances.");
    }
    return null;
}
Also used : DescribeInstancesResult(com.amazonaws.services.ec2.model.DescribeInstancesResult) Function(com.google.common.base.Function) Reservation(com.amazonaws.services.ec2.model.Reservation) AutoScalingData(io.druid.indexing.overlord.autoscaling.AutoScalingData) Filter(com.amazonaws.services.ec2.model.Filter) Instance(com.amazonaws.services.ec2.model.Instance) DescribeInstancesRequest(com.amazonaws.services.ec2.model.DescribeInstancesRequest)

Example 2 with DescribeInstancesRequest

use of software.amazon.awssdk.services.ec2.model.DescribeInstancesRequest in project incubator-gobblin by apache.

the class AWSSdkClient method getInstancesForGroup.

/**
 * Get list of EC2 {@link Instance}s for a auto scaling group
 *
 * @param groupName Auto scaling group name
 * @param status Instance status (eg. running)
 * @return List of EC2 instances found for the input auto scaling group
 */
public List<Instance> getInstancesForGroup(String groupName, String status) {
    final AmazonEC2 amazonEC2 = getEc2Client();
    final DescribeInstancesResult instancesResult = amazonEC2.describeInstances(new DescribeInstancesRequest().withFilters(new Filter().withName("tag:aws:autoscaling:groupName").withValues(groupName)));
    final List<Instance> instances = new ArrayList<>();
    for (Reservation reservation : instancesResult.getReservations()) {
        for (Instance instance : reservation.getInstances()) {
            if (null == status || null == instance.getState() || status.equals(instance.getState().getName())) {
                instances.add(instance);
                LOGGER.info("Found instance: " + instance + " which qualified filter: " + status);
            } else {
                LOGGER.info("Found instance: " + instance + " but did not qualify for filter: " + status);
            }
        }
    }
    return instances;
}
Also used : DescribeInstancesResult(com.amazonaws.services.ec2.model.DescribeInstancesResult) Reservation(com.amazonaws.services.ec2.model.Reservation) Filter(com.amazonaws.services.ec2.model.Filter) Instance(com.amazonaws.services.ec2.model.Instance) ArrayList(java.util.ArrayList) AmazonEC2(com.amazonaws.services.ec2.AmazonEC2) DescribeInstancesRequest(com.amazonaws.services.ec2.model.DescribeInstancesRequest)

Example 3 with DescribeInstancesRequest

use of software.amazon.awssdk.services.ec2.model.DescribeInstancesRequest in project photon-model by vmware.

the class AWSRemoteCleanup method cleanUpVpc.

/**
 * Cleaning all VPC's that are not tagged with a name: enumtest-vpc or a default VPC in US_EAST_1 region
 * Deleting a VPC would require its dependencies to be deleted in the following order:
 * 1) EC2 Instances
 * 2) NAT Gateway
 * 3) Internet Gateway
 * 4) VPN Gateway
 * 5) Network ACL's
 * 6) Security Group ( not deleting default SG)
 * 7) Subnets
 * NOTE: Not deleting RouteTables currently
 */
@Test
public void cleanUpVpc() {
    if (this.isMock) {
        return;
    }
    AmazonEC2 usEastEc2Client = this.ec2Clients.get(US_EAST_1_TAG);
    DescribeVpcsResult vpcsResult = usEastEc2Client.describeVpcs();
    List<Vpc> vpcs = vpcsResult.getVpcs();
    List<String> vpcIdsToBeDeleted = new ArrayList<>();
    List<String> enumTestVpcIds = new ArrayList<>();
    try {
        vpcs.stream().forEach(vpc -> {
            vpc.getTags().stream().filter(tag -> tag.getKey().equalsIgnoreCase(NAME_TAG_KEY) && this.vpcTagsNotToBeDeleted.contains(tag.getValue().toLowerCase())).forEach(tag -> enumTestVpcIds.add(vpc.getVpcId()));
            if (!vpc.getIsDefault()) {
                vpcIdsToBeDeleted.add(vpc.getVpcId());
            }
        });
        vpcIdsToBeDeleted.removeAll(enumTestVpcIds);
        vpcIdsToBeDeleted.stream().forEach(vpcId -> {
            DescribeInstancesRequest instancesRequest = new DescribeInstancesRequest().withFilters(new Filter(VPC_KEY, Collections.singletonList(vpcId)));
            DescribeInstancesResult instancesResult = usEastEc2Client.describeInstances(instancesRequest);
            deleteAwsEc2instances(vpcIdsToBeDeleted, instancesResult, usEastEc2Client);
            deleteNATGateway(vpcId, usEastEc2Client);
            deleteNetworkInterfaces(vpcId, usEastEc2Client);
            deleteInternetGateways(vpcId, usEastEc2Client);
            deleteVirtualPrivateGateways(vpcId, usEastEc2Client);
            disassociateAndDeleteNetworkACLs(vpcId, usEastEc2Client);
            deleteSecurityGroups(vpcId, usEastEc2Client);
            deleteSubnets(vpcId, usEastEc2Client);
            DeleteVpcRequest deleteVpcRequest = new DeleteVpcRequest().withVpcId(vpcId);
            this.host.log("Terminating stale vpc: %s", vpcId);
            usEastEc2Client.deleteVpc(deleteVpcRequest);
        });
    } catch (Exception e) {
        this.host.log(Level.INFO, e.getMessage());
    }
}
Also used : DescribeVpcsResult(com.amazonaws.services.ec2.model.DescribeVpcsResult) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) DescribeNetworkAclsResult(com.amazonaws.services.ec2.model.DescribeNetworkAclsResult) DescribeSubnetsRequest(com.amazonaws.services.ec2.model.DescribeSubnetsRequest) DeleteVpnGatewayRequest(com.amazonaws.services.ec2.model.DeleteVpnGatewayRequest) TerminateInstancesResult(com.amazonaws.services.ec2.model.TerminateInstancesResult) ReleaseAddressRequest(com.amazonaws.services.ec2.model.ReleaseAddressRequest) DescribeSubnetsResult(com.amazonaws.services.ec2.model.DescribeSubnetsResult) CommandLineArgumentParser(com.vmware.xenon.common.CommandLineArgumentParser) Utils(com.vmware.xenon.common.Utils) DescribeNetworkAclsRequest(com.amazonaws.services.ec2.model.DescribeNetworkAclsRequest) DescribeInstancesRequest(com.amazonaws.services.ec2.model.DescribeInstancesRequest) Map(java.util.Map) DescribeNetworkInterfacesResult(com.amazonaws.services.ec2.model.DescribeNetworkInterfacesResult) DeleteSubnetRequest(com.amazonaws.services.ec2.model.DeleteSubnetRequest) Reservation(com.amazonaws.services.ec2.model.Reservation) DeleteVpcRequest(com.amazonaws.services.ec2.model.DeleteVpcRequest) DescribeInternetGatewaysResult(com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult) DescribeVolumesResult(com.amazonaws.services.ec2.model.DescribeVolumesResult) DescribeInstancesResult(com.amazonaws.services.ec2.model.DescribeInstancesResult) AmazonS3Client(com.amazonaws.services.s3.AmazonS3Client) DeleteNetworkInterfaceRequest(com.amazonaws.services.ec2.model.DeleteNetworkInterfaceRequest) List(java.util.List) Tag(com.amazonaws.services.ec2.model.Tag) DeleteInternetGatewayRequest(com.amazonaws.services.ec2.model.DeleteInternetGatewayRequest) BasicTestCase(com.vmware.xenon.common.BasicTestCase) HashMap(java.util.HashMap) DeleteNetworkAclRequest(com.amazonaws.services.ec2.model.DeleteNetworkAclRequest) DescribeNetworkInterfacesRequest(com.amazonaws.services.ec2.model.DescribeNetworkInterfacesRequest) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) Regions(com.amazonaws.regions.Regions) DescribeVpcsResult(com.amazonaws.services.ec2.model.DescribeVpcsResult) DisassociateAddressRequest(com.amazonaws.services.ec2.model.DisassociateAddressRequest) DescribeSecurityGroupsResult(com.amazonaws.services.ec2.model.DescribeSecurityGroupsResult) AmazonEC2(com.amazonaws.services.ec2.AmazonEC2) DescribeSecurityGroupsRequest(com.amazonaws.services.ec2.model.DescribeSecurityGroupsRequest) Filter(com.amazonaws.services.ec2.model.Filter) Volume(com.amazonaws.services.ec2.model.Volume) DescribeVpnGatewaysResult(com.amazonaws.services.ec2.model.DescribeVpnGatewaysResult) Instance(com.amazonaws.services.ec2.model.Instance) Before(org.junit.Before) Vpc(com.amazonaws.services.ec2.model.Vpc) DescribeNatGatewaysResult(com.amazonaws.services.ec2.model.DescribeNatGatewaysResult) Test(org.junit.Test) DescribeAddressesRequest(com.amazonaws.services.ec2.model.DescribeAddressesRequest) DetachInternetGatewayRequest(com.amazonaws.services.ec2.model.DetachInternetGatewayRequest) DetachVpnGatewayRequest(com.amazonaws.services.ec2.model.DetachVpnGatewayRequest) TerminateInstancesRequest(com.amazonaws.services.ec2.model.TerminateInstancesRequest) DeleteNatGatewayRequest(com.amazonaws.services.ec2.model.DeleteNatGatewayRequest) Bucket(com.amazonaws.services.s3.model.Bucket) DeleteSecurityGroupRequest(com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest) DescribeNatGatewaysRequest(com.amazonaws.services.ec2.model.DescribeNatGatewaysRequest) TimeUnit(java.util.concurrent.TimeUnit) DescribeVpnGatewaysRequest(com.amazonaws.services.ec2.model.DescribeVpnGatewaysRequest) DeleteVolumeRequest(com.amazonaws.services.ec2.model.DeleteVolumeRequest) DescribeAddressesResult(com.amazonaws.services.ec2.model.DescribeAddressesResult) Collections(java.util.Collections) DescribeInternetGatewaysRequest(com.amazonaws.services.ec2.model.DescribeInternetGatewaysRequest) Vpc(com.amazonaws.services.ec2.model.Vpc) ArrayList(java.util.ArrayList) AmazonEC2(com.amazonaws.services.ec2.AmazonEC2) DescribeInstancesRequest(com.amazonaws.services.ec2.model.DescribeInstancesRequest) DescribeInstancesResult(com.amazonaws.services.ec2.model.DescribeInstancesResult) Filter(com.amazonaws.services.ec2.model.Filter) DeleteVpcRequest(com.amazonaws.services.ec2.model.DeleteVpcRequest) Test(org.junit.Test)

Example 4 with DescribeInstancesRequest

use of software.amazon.awssdk.services.ec2.model.DescribeInstancesRequest in project photon-model by vmware.

the class AWSComputeDiskDay2Service method getAvailableDeviceName.

private String getAvailableDeviceName(DiskContext context, String instanceId) {
    DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest().withInstanceIds(instanceId);
    DescribeInstancesResult instancesResult = context.amazonEC2Client.describeInstances(describeInstancesRequest);
    List<InstanceBlockDeviceMapping> blockDeviceMappings = null;
    AWSSupportedOS platform = null;
    AWSSupportedVirtualizationTypes virtualizationTypes = null;
    String instanceType = null;
    for (Reservation reservation : instancesResult.getReservations()) {
        for (Instance instance : reservation.getInstances()) {
            if (instance.getInstanceId().equals(instanceId)) {
                blockDeviceMappings = instance.getBlockDeviceMappings();
                platform = AWSSupportedOS.get(instance.getPlatform());
                virtualizationTypes = AWSSupportedVirtualizationTypes.get(instance.getVirtualizationType());
                instanceType = instance.getInstanceType();
                break;
            }
        }
    }
    String deviceName = null;
    if (blockDeviceMappings != null) {
        List<String> usedDeviceNames = getUsedDeviceNames(blockDeviceMappings);
        List<String> availableDiskNames = AWSBlockDeviceNameMapper.getAvailableNames(platform, virtualizationTypes, AWSStorageType.EBS, instanceType, usedDeviceNames);
        deviceName = availableDiskNames.get(0);
    }
    return deviceName;
}
Also used : DescribeInstancesResult(com.amazonaws.services.ec2.model.DescribeInstancesResult) Reservation(com.amazonaws.services.ec2.model.Reservation) Instance(com.amazonaws.services.ec2.model.Instance) AWSSupportedVirtualizationTypes(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWSSupportedVirtualizationTypes) DescribeInstancesRequest(com.amazonaws.services.ec2.model.DescribeInstancesRequest) InstanceBlockDeviceMapping(com.amazonaws.services.ec2.model.InstanceBlockDeviceMapping) AWSSupportedOS(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWSSupportedOS)

Example 5 with DescribeInstancesRequest

use of software.amazon.awssdk.services.ec2.model.DescribeInstancesRequest in project photon-model by vmware.

the class TestAWSSetupUtils method getAwsInstancesByIds.

/**
 * Method to get Instance details directly from Amazon
 *
 * @throws Throwable
 */
public static List<Instance> getAwsInstancesByIds(AmazonEC2AsyncClient client, VerificationHost host, List<String> instanceIds) throws Throwable {
    host.log("Getting instances with ids " + instanceIds + " from the AWS endpoint using the EC2 client.");
    DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest().withInstanceIds(instanceIds);
    DescribeInstancesResult describeInstancesResult = client.describeInstances(describeInstancesRequest);
    return describeInstancesResult.getReservations().stream().flatMap(r -> r.getInstances().stream()).collect(Collectors.toList());
}
Also used : DescribeInstancesResult(com.amazonaws.services.ec2.model.DescribeInstancesResult) CreateLoadBalancerResult(com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerResult) Arrays(java.util.Arrays) ProvisionComputeTaskService(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService) DescribeSubnetsRequest(com.amazonaws.services.ec2.model.DescribeSubnetsRequest) IpAssignment(com.vmware.photon.controller.model.resources.NetworkInterfaceDescriptionService.IpAssignment) TerminateInstancesResult(com.amazonaws.services.ec2.model.TerminateInstancesResult) VerificationHost(com.vmware.xenon.common.test.VerificationHost) CreateLoadBalancerRequest(com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerRequest) AttachInternetGatewayRequest(com.amazonaws.services.ec2.model.AttachInternetGatewayRequest) StopInstancesRequest(com.amazonaws.services.ec2.model.StopInstancesRequest) DescribeSubnetsResult(com.amazonaws.services.ec2.model.DescribeSubnetsResult) InetAddress(java.net.InetAddress) AWSEnumerationAndDeletionAdapterService(com.vmware.photon.controller.model.adapters.awsadapter.enumeration.AWSEnumerationAndDeletionAdapterService) Utils(com.vmware.xenon.common.Utils) BlockDeviceMapping(com.amazonaws.services.ec2.model.BlockDeviceMapping) LoadBalancerState(com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) DescribeInstancesRequest(com.amazonaws.services.ec2.model.DescribeInstancesRequest) Map(java.util.Map) ImageService(com.vmware.photon.controller.model.resources.ImageService) ServiceDocumentQueryResult(com.vmware.xenon.common.ServiceDocumentQueryResult) ProvisioningUtils(com.vmware.photon.controller.model.tasks.ProvisioningUtils) Path(java.nio.file.Path) AWSComputeStateCreationAdapterService(com.vmware.photon.controller.model.adapters.awsadapter.enumeration.AWSComputeStateCreationAdapterService) EnumSet(java.util.EnumSet) ResourceEnumerationTaskService(com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService) AWSComputeDescriptionEnumerationAdapterService(com.vmware.photon.controller.model.adapters.awsadapter.enumeration.AWSComputeDescriptionEnumerationAdapterService) SubnetService(com.vmware.photon.controller.model.resources.SubnetService) DeleteVpcRequest(com.amazonaws.services.ec2.model.DeleteVpcRequest) CreateNetworkInterfaceResult(com.amazonaws.services.ec2.model.CreateNetworkInterfaceResult) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) Set(java.util.Set) SecurityGroup(com.amazonaws.services.ec2.model.SecurityGroup) DeleteNetworkInterfaceRequest(com.amazonaws.services.ec2.model.DeleteNetworkInterfaceRequest) ServiceStats(com.vmware.xenon.common.ServiceStats) URI_PARAM_ENDPOINT(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.URI_PARAM_ENDPOINT) AWSUtils.getRegionId(com.vmware.photon.controller.model.adapters.awsadapter.AWSUtils.getRegionId) NetworkInterfaceService(com.vmware.photon.controller.model.resources.NetworkInterfaceService) TagService(com.vmware.photon.controller.model.resources.TagService) AWSUtils.getAWSNonTerminatedInstancesFilter(com.vmware.photon.controller.model.adapters.awsadapter.AWSUtils.getAWSNonTerminatedInstancesFilter) ProvisioningUtils.getVMCount(com.vmware.photon.controller.model.tasks.ProvisioningUtils.getVMCount) Assert.assertFalse(org.junit.Assert.assertFalse) DetachNetworkInterfaceRequest(com.amazonaws.services.ec2.model.DetachNetworkInterfaceRequest) Tag(com.amazonaws.services.ec2.model.Tag) UriUtils(com.vmware.xenon.common.UriUtils) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) InstanceTypeList(com.vmware.photon.controller.model.support.InstanceTypeList) DeleteSnapshotRequest(com.amazonaws.services.ec2.model.DeleteSnapshotRequest) TaskState(com.vmware.xenon.common.TaskState) RunInstancesResult(com.amazonaws.services.ec2.model.RunInstancesResult) PRIVATE_KEY_KEY(com.vmware.photon.controller.model.adapterapi.EndpointConfigRequest.PRIVATE_KEY_KEY) CreateSubnetRequest(com.amazonaws.services.ec2.model.CreateSubnetRequest) InstanceNetworkInterface(com.amazonaws.services.ec2.model.InstanceNetworkInterface) NicSpec(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.AwsNicSpecs.NicSpec) DISK_IOPS(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.DISK_IOPS) ResourcePoolState(com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState) ComputeDescriptionService(com.vmware.photon.controller.model.resources.ComputeDescriptionService) SYSTEM(com.vmware.photon.controller.model.resources.TagService.TagState.TagOrigin.SYSTEM) AWSS3StorageEnumerationAdapterService(com.vmware.photon.controller.model.adapters.awsadapter.enumeration.AWSS3StorageEnumerationAdapterService) ArrayList(java.util.ArrayList) AWSEBSStorageEnumerationAdapterService(com.vmware.photon.controller.model.adapters.awsadapter.enumeration.AWSEBSStorageEnumerationAdapterService) SecurityGroupState(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState) Rule(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState.Rule) URI_PARAM_INSTANCE_TYPE(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.URI_PARAM_INSTANCE_TYPE) USER_DEFINED(com.vmware.photon.controller.model.resources.TagService.TagState.TagOrigin.USER_DEFINED) Query(com.vmware.xenon.services.common.QueryTask.Query) ResourceRemovalTaskState(com.vmware.photon.controller.model.tasks.ResourceRemovalTaskService.ResourceRemovalTaskState) DescribeSecurityGroupsResult(com.amazonaws.services.ec2.model.DescribeSecurityGroupsResult) DescribeSecurityGroupsRequest(com.amazonaws.services.ec2.model.DescribeSecurityGroupsRequest) DescribeVolumesRequest(com.amazonaws.services.ec2.model.DescribeVolumesRequest) Filter(com.amazonaws.services.ec2.model.Filter) Volume(com.amazonaws.services.ec2.model.Volume) CreateSnapshotResult(com.amazonaws.services.ec2.model.CreateSnapshotResult) CreateVpcRequest(com.amazonaws.services.ec2.model.CreateVpcRequest) AmazonEC2Client(com.amazonaws.services.ec2.AmazonEC2Client) ResourceState(com.vmware.photon.controller.model.resources.ResourceState) SecurityGroupService(com.vmware.photon.controller.model.resources.SecurityGroupService) Assert.assertTrue(org.junit.Assert.assertTrue) DetachInternetGatewayRequest(com.amazonaws.services.ec2.model.DetachInternetGatewayRequest) TerminateInstancesRequest(com.amazonaws.services.ec2.model.TerminateInstancesRequest) LocalDateTime(org.joda.time.LocalDateTime) UnknownHostException(java.net.UnknownHostException) NetworkService(com.vmware.photon.controller.model.resources.NetworkService) AttachNetworkInterfaceResult(com.amazonaws.services.ec2.model.AttachNetworkInterfaceResult) Assert.assertNull(org.junit.Assert.assertNull) NetworkInterfaceAttachmentChanges(com.amazonaws.services.ec2.model.NetworkInterfaceAttachmentChanges) Paths(java.nio.file.Paths) DescribeSnapshotsResult(com.amazonaws.services.ec2.model.DescribeSnapshotsResult) AsyncHandler(com.amazonaws.handlers.AsyncHandler) AmazonEC2Exception(com.amazonaws.services.ec2.model.AmazonEC2Exception) PhotonModelConstants(com.vmware.photon.controller.model.constants.PhotonModelConstants) CreateSnapshotRequest(com.amazonaws.services.ec2.model.CreateSnapshotRequest) NetworkState(com.vmware.photon.controller.model.resources.NetworkService.NetworkState) Assert(org.junit.Assert) QuerySpecification(com.vmware.xenon.services.common.QueryTask.QuerySpecification) Assert.assertEquals(org.junit.Assert.assertEquals) DISCOVERED(com.vmware.photon.controller.model.resources.TagService.TagState.TagOrigin.DISCOVERED) AmazonEC2AsyncClient(com.amazonaws.services.ec2.AmazonEC2AsyncClient) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) StopInstancesResult(com.amazonaws.services.ec2.model.StopInstancesResult) RegisterInstancesWithLoadBalancerRequest(com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerRequest) QueryTask(com.vmware.xenon.services.common.QueryTask) TimeoutException(java.util.concurrent.TimeoutException) StatsCollectionTaskState(com.vmware.photon.controller.model.tasks.monitoring.StatsCollectionTaskService.StatsCollectionTaskState) ServiceDocument(com.vmware.xenon.common.ServiceDocument) Random(java.util.Random) StatsAggregationTaskService(com.vmware.photon.controller.model.tasks.monitoring.StatsAggregationTaskService) ByteBuffer(java.nio.ByteBuffer) ComputeType(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription.ComputeType) EndpointAllocationTaskService(com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService) CreateTagsRequest(com.amazonaws.services.ec2.model.CreateTagsRequest) StatsAggregationTaskState(com.vmware.photon.controller.model.tasks.monitoring.StatsAggregationTaskService.StatsAggregationTaskState) DescribeInstanceStatusRequest(com.amazonaws.services.ec2.model.DescribeInstanceStatusRequest) CreateVolumeRequest(com.amazonaws.services.ec2.model.CreateVolumeRequest) EndpointService(com.vmware.photon.controller.model.resources.EndpointService) ResourcePoolService(com.vmware.photon.controller.model.resources.ResourcePoolService) ProvisionDiskTaskService(com.vmware.photon.controller.model.tasks.ProvisionDiskTaskService) URI(java.net.URI) DeleteSubnetRequest(com.amazonaws.services.ec2.model.DeleteSubnetRequest) StatsCollectionTaskService(com.vmware.photon.controller.model.tasks.monitoring.StatsCollectionTaskService) Reservation(com.amazonaws.services.ec2.model.Reservation) EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState) LoadBalancerService(com.vmware.photon.controller.model.resources.LoadBalancerService) EndpointAllocationTaskState(com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService.EndpointAllocationTaskState) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) NetworkInterfaceDescriptionService(com.vmware.photon.controller.model.resources.NetworkInterfaceDescriptionService) DeleteLoadBalancerRequest(com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest) DescribeVolumesResult(com.amazonaws.services.ec2.model.DescribeVolumesResult) TestUtils(com.vmware.photon.controller.model.tasks.TestUtils) DescribeInstancesResult(com.amazonaws.services.ec2.model.DescribeInstancesResult) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) Occurance(com.vmware.xenon.services.common.QueryTask.Query.Occurance) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) AmazonElasticLoadBalancingAsyncClient(com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingAsyncClient) List(java.util.List) Snapshot(com.amazonaws.services.ec2.model.Snapshot) DescribeSnapshotsRequest(com.amazonaws.services.ec2.model.DescribeSnapshotsRequest) TaskOption(com.vmware.photon.controller.model.tasks.TaskOption) DiskService(com.vmware.photon.controller.model.resources.DiskService) NetSpec(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.AwsNicSpecs.NetSpec) EndpointRemovalTaskState(com.vmware.photon.controller.model.tasks.EndpointRemovalTaskService.EndpointRemovalTaskState) ResourceRemovalTaskService(com.vmware.photon.controller.model.tasks.ResourceRemovalTaskService) DeleteInternetGatewayRequest(com.amazonaws.services.ec2.model.DeleteInternetGatewayRequest) HashMap(java.util.HashMap) CreateNetworkInterfaceRequest(com.amazonaws.services.ec2.model.CreateNetworkInterfaceRequest) AWSEnumerationAndCreationAdapterService(com.vmware.photon.controller.model.adapters.awsadapter.enumeration.AWSEnumerationAndCreationAdapterService) PRIVATE_KEYID_KEY(com.vmware.photon.controller.model.adapterapi.EndpointConfigRequest.PRIVATE_KEYID_KEY) CreateSubnetResult(com.amazonaws.services.ec2.model.CreateSubnetResult) RegisterInstancesWithLoadBalancerResult(com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerResult) ProvisionComputeTaskState(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState) Level(java.util.logging.Level) HashSet(java.util.HashSet) AttachNetworkInterfaceRequest(com.amazonaws.services.ec2.model.AttachNetworkInterfaceRequest) CreateVolumeResult(com.amazonaws.services.ec2.model.CreateVolumeResult) AWSSecurityGroupClient(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSSecurityGroupClient) AuthCredentialsService(com.vmware.xenon.services.common.AuthCredentialsService) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) EnumerationAction(com.vmware.photon.controller.model.adapterapi.EnumerationAction) EndpointType(com.vmware.photon.controller.model.constants.PhotonModelConstants.EndpointType) Subnet(com.amazonaws.services.ec2.model.Subnet) Listener(com.amazonaws.services.elasticloadbalancing.model.Listener) Instance(com.amazonaws.services.ec2.model.Instance) AWSConstants.getQueryResultLimit(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.getQueryResultLimit) ResourceEnumerationTaskState(com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService.ResourceEnumerationTaskState) Assert.assertNotNull(org.junit.Assert.assertNotNull) Vpc(com.amazonaws.services.ec2.model.Vpc) DescribeInstanceStatusResult(com.amazonaws.services.ec2.model.DescribeInstanceStatusResult) Operation(com.vmware.xenon.common.Operation) RunInstancesRequest(com.amazonaws.services.ec2.model.RunInstancesRequest) DeleteSecurityGroupRequest(com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest) AWS_VPC_ID_FILTER(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWS_VPC_ID_FILTER) ProvisioningUtils.createServiceURI(com.vmware.photon.controller.model.tasks.ProvisioningUtils.createServiceURI) TimeUnit(java.util.concurrent.TimeUnit) ModifyNetworkInterfaceAttributeRequest(com.amazonaws.services.ec2.model.ModifyNetworkInterfaceAttributeRequest) DeleteVolumeRequest(com.amazonaws.services.ec2.model.DeleteVolumeRequest) ImageState(com.vmware.photon.controller.model.resources.ImageService.ImageState) EndpointRemovalTaskService(com.vmware.photon.controller.model.tasks.EndpointRemovalTaskService) NetworkInterfaceDescription(com.vmware.photon.controller.model.resources.NetworkInterfaceDescriptionService.NetworkInterfaceDescription) AWSEnumerationAdapterService(com.vmware.photon.controller.model.adapters.awsadapter.enumeration.AWSEnumerationAdapterService) Collections(java.util.Collections) AWS_INVALID_VOLUME_ID_ERROR_CODE(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWS_INVALID_VOLUME_ID_ERROR_CODE) DescribeInstancesRequest(com.amazonaws.services.ec2.model.DescribeInstancesRequest)

Aggregations

DescribeInstancesRequest (com.amazonaws.services.ec2.model.DescribeInstancesRequest)32 DescribeInstancesResult (com.amazonaws.services.ec2.model.DescribeInstancesResult)19 Instance (com.amazonaws.services.ec2.model.Instance)19 Filter (com.amazonaws.services.ec2.model.Filter)18 Reservation (com.amazonaws.services.ec2.model.Reservation)18 ArrayList (java.util.ArrayList)12 List (java.util.List)8 AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)6 Function (com.google.common.base.Function)6 AWSUtils.getAWSNonTerminatedInstancesFilter (com.vmware.photon.controller.model.adapters.awsadapter.AWSUtils.getAWSNonTerminatedInstancesFilter)6 HashMap (java.util.HashMap)5 Tag (com.amazonaws.services.ec2.model.Tag)4 AmazonEC2Exception (com.amazonaws.services.ec2.model.AmazonEC2Exception)3 FluentIterable (com.google.common.collect.FluentIterable)3 Map (java.util.Map)3 AmazonServiceException (com.amazonaws.AmazonServiceException)2 AWSStaticCredentialsProvider (com.amazonaws.auth.AWSStaticCredentialsProvider)2 DeleteInternetGatewayRequest (com.amazonaws.services.ec2.model.DeleteInternetGatewayRequest)2 DeleteNetworkInterfaceRequest (com.amazonaws.services.ec2.model.DeleteNetworkInterfaceRequest)2 DeleteSecurityGroupRequest (com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest)2