Search in sources :

Example 11 with SecurityGroup

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

the class AWSSecurityGroupEnumerationAdapterService method createResponse.

/**
 * Having the enumerated SecurityGroup Ids, query the States and provide them in the response
 */
private DeferredResult<AWSSecurityGroupEnumerationResponse> createResponse(SecurityGroupEnumContext context) {
    AWSSecurityGroupEnumerationResponse response = new AWSSecurityGroupEnumerationResponse();
    if (context.enumExternalResourcesIds == null || context.enumExternalResourcesIds.isEmpty()) {
        DeferredResult<AWSSecurityGroupEnumerationResponse> deferredResult = new DeferredResult<>();
        deferredResult.complete(response);
        return deferredResult;
    }
    Query.Builder findSecurityGroupStates = Builder.create().addKindFieldClause(SecurityGroupState.class).addFieldClause(ResourceState.FIELD_NAME_COMPUTE_HOST_LINK, context.request.parentCompute.documentSelfLink).addInClause(SecurityGroupState.FIELD_NAME_ID, context.enumExternalResourcesIds);
    QueryTop<SecurityGroupState> querySecurityGroupStates = new QueryTop<>(context.service.getHost(), findSecurityGroupStates.build(), SecurityGroupState.class, context.request.parentCompute.tenantLinks).setMaxResultsLimit(context.enumExternalResourcesIds.size());
    querySecurityGroupStates.setClusterType(ServiceTypeCluster.INVENTORY_SERVICE);
    return querySecurityGroupStates.queryDocuments(sgState -> response.securityGroupStates.put(sgState.id, sgState.documentSelfLink)).thenApply(aVoid -> response);
}
Also used : ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) AWS_SECURITY_GROUP_ADAPTER(com.vmware.photon.controller.model.adapters.awsadapter.AWSUriPaths.AWS_SECURITY_GROUP_ADAPTER) BaseComputeEnumerationAdapterContext(com.vmware.photon.controller.model.adapters.util.enums.BaseComputeEnumerationAdapterContext) ServiceTypeCluster(com.vmware.photon.controller.model.util.ClusterUtil.ServiceTypeCluster) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SecurityGroupState(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState) Rule(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState.Rule) AWSConstants(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants) Utils(com.vmware.xenon.common.Utils) Query(com.vmware.xenon.services.common.QueryTask.Query) EnumerationStages(com.vmware.photon.controller.model.adapters.util.enums.EnumerationStages) DescribeSecurityGroupsResult(com.amazonaws.services.ec2.model.DescribeSecurityGroupsResult) Map(java.util.Map) DescribeSecurityGroupsRequest(com.amazonaws.services.ec2.model.DescribeSecurityGroupsRequest) EnumerationAction(com.vmware.photon.controller.model.adapterapi.EnumerationAction) AssertUtil(com.vmware.photon.controller.model.util.AssertUtil) AWSSecurityGroupUtils.generateSecurityRuleFromAWSIpPermission(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSSecurityGroupUtils.generateSecurityRuleFromAWSIpPermission) TagsUtil.newTagState(com.vmware.photon.controller.model.adapters.util.TagsUtil.newTagState) AWSClientManager(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManager) ResourceState(com.vmware.photon.controller.model.resources.ResourceState) StatelessService(com.vmware.xenon.common.StatelessService) AdapterUriUtil(com.vmware.photon.controller.model.adapters.util.AdapterUriUtil) Operation(com.vmware.xenon.common.Operation) SecurityGroup(com.amazonaws.services.ec2.model.SecurityGroup) QueryTop(com.vmware.photon.controller.model.query.QueryUtils.QueryTop) TagService(com.vmware.photon.controller.model.resources.TagService) Tag(com.amazonaws.services.ec2.model.Tag) DeferredResult(com.vmware.xenon.common.DeferredResult) AWSResourceType.ec2_security_group(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWSResourceType.ec2_security_group) TAG_KEY_TYPE(com.vmware.photon.controller.model.constants.PhotonModelConstants.TAG_KEY_TYPE) ComputeEnumerateAdapterRequest(com.vmware.photon.controller.model.adapters.util.ComputeEnumerateAdapterRequest) AWSClientManagerFactory(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManagerFactory) Builder(com.vmware.xenon.services.common.QueryTask.Query.Builder) IpPermission(com.amazonaws.services.ec2.model.IpPermission) AWSUriPaths(com.vmware.photon.controller.model.adapters.awsadapter.AWSUriPaths) AWSDeferredResultAsyncHandler(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSDeferredResultAsyncHandler) FACTORY_LINK(com.vmware.photon.controller.model.resources.SecurityGroupService.FACTORY_LINK) AmazonEC2AsyncClient(com.amazonaws.services.ec2.AmazonEC2AsyncClient) Query(com.vmware.xenon.services.common.QueryTask.Query) SecurityGroupState(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState) Builder(com.vmware.xenon.services.common.QueryTask.Query.Builder) DeferredResult(com.vmware.xenon.common.DeferredResult)

Example 12 with SecurityGroup

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

the class AWSSecurityGroupClient method getDefaultSecurityGroup.

public SecurityGroup getDefaultSecurityGroup(String vpcId) {
    SecurityGroup cellGroup = null;
    DescribeSecurityGroupsRequest req = new DescribeSecurityGroupsRequest().withFilters(new Filter("group-name", Collections.singletonList(DEFAULT_SECURITY_GROUP_NAME)));
    if (vpcId != null) {
        req.withFilters(new Filter("vpc-id", Collections.singletonList(vpcId)));
    }
    DescribeSecurityGroupsResult cellGroups = this.client.describeSecurityGroups(req);
    if (cellGroups != null && !cellGroups.getSecurityGroups().isEmpty()) {
        cellGroup = cellGroups.getSecurityGroups().get(0);
    }
    return cellGroup;
}
Also used : DescribeSecurityGroupsRequest(com.amazonaws.services.ec2.model.DescribeSecurityGroupsRequest) Filter(com.amazonaws.services.ec2.model.Filter) SecurityGroup(com.amazonaws.services.ec2.model.SecurityGroup) DescribeSecurityGroupsResult(com.amazonaws.services.ec2.model.DescribeSecurityGroupsResult)

Example 13 with SecurityGroup

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

the class AWSSecurityGroupClient method getSecurityGroup.

public SecurityGroup getSecurityGroup(String name, String vpcId) {
    SecurityGroup cellGroup = null;
    DescribeSecurityGroupsRequest req = new DescribeSecurityGroupsRequest().withFilters(new Filter("group-name", Collections.singletonList(name)));
    if (vpcId != null) {
        req.withFilters(new Filter("vpc-id", Collections.singletonList(vpcId)));
    }
    DescribeSecurityGroupsResult cellGroups = this.client.describeSecurityGroups(req);
    if (cellGroups != null && !cellGroups.getSecurityGroups().isEmpty()) {
        cellGroup = cellGroups.getSecurityGroups().get(0);
    }
    return cellGroup;
}
Also used : DescribeSecurityGroupsRequest(com.amazonaws.services.ec2.model.DescribeSecurityGroupsRequest) Filter(com.amazonaws.services.ec2.model.Filter) SecurityGroup(com.amazonaws.services.ec2.model.SecurityGroup) DescribeSecurityGroupsResult(com.amazonaws.services.ec2.model.DescribeSecurityGroupsResult)

Example 14 with SecurityGroup

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

the class TestAWSSetupUtils method setUpTestVpc.

public static void setUpTestVpc(AmazonEC2AsyncClient client, Map<String, Object> awsTestContext, boolean isMock, String zoneId) {
    // If the pre-set VPC does not exist, get the test VPC for the given account and use it in the tests.
    if (!isMock && !vpcIdExists(client, AWS_DEFAULT_VPC_ID)) {
        String vpcId = createorGetVPCForAccount(client);
        awsTestContext.put(VPC_KEY, vpcId);
        Subnet subnet = createOrGetSubnet(client, AWS_DEFAULT_SUBNET_CIDR, vpcId, zoneId);
        awsTestContext.put(SUBNET_KEY, subnet.getSubnetId());
        String internetGatewayId = createOrGetInternetGatewayForGivenVPC(client, vpcId);
        awsTestContext.put(INTERNET_GATEWAY_KEY, internetGatewayId);
        SecurityGroup sg = createOrGetDefaultSecurityGroupForGivenVPC(client, vpcId);
        awsTestContext.put(SECURITY_GROUP_KEY, sg.getGroupId());
        awsTestContext.put(SECURITY_GROUP_NAME_KEY, sg.getGroupName());
        NetSpec network = new NetSpec(vpcId, vpcId, AWS_DEFAULT_VPC_CIDR);
        List<NetSpec> subnets = new ArrayList<>();
        subnets.add(new NetSpec(subnet.getSubnetId(), AWS_DEFAULT_SUBNET_NAME, subnet.getCidrBlock(), zoneId == null ? TestAWSSetupUtils.zoneId + avalabilityZoneIdentifier : zoneId));
        NicSpec nicSpec = NicSpec.create().withSubnetSpec(subnets.get(0)).withDynamicIpAssignment();
        awsTestContext.put(NIC_SPECS_KEY, new AwsNicSpecs(network, Collections.singletonList(nicSpec)));
        return;
    }
    awsTestContext.put(VPC_KEY, AWS_DEFAULT_VPC_ID);
    awsTestContext.put(NIC_SPECS_KEY, SINGLE_NIC_SPEC);
    awsTestContext.put(SUBNET_KEY, AWS_DEFAULT_SUBNET_ID);
    awsTestContext.put(SECURITY_GROUP_KEY, AWS_DEFAULT_GROUP_ID);
    awsTestContext.put(SECURITY_GROUP_NAME_KEY, AWS_DEFAULT_GROUP_NAME);
}
Also used : NetSpec(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.AwsNicSpecs.NetSpec) ArrayList(java.util.ArrayList) Subnet(com.amazonaws.services.ec2.model.Subnet) SecurityGroup(com.amazonaws.services.ec2.model.SecurityGroup) NicSpec(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.AwsNicSpecs.NicSpec)

Example 15 with SecurityGroup

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

the class TestAWSSetupUtils method createOrGetDefaultSecurityGroupForGivenVPC.

/**
 * Returns an existing security group for a VPC if it exists otherwise creates a new security group.
 */
public static SecurityGroup createOrGetDefaultSecurityGroupForGivenVPC(AmazonEC2AsyncClient client, String vpcID) {
    List<SecurityGroup> securityGroupsInVPC = client.describeSecurityGroups().getSecurityGroups().stream().filter(sg -> sg.getVpcId().equals(vpcID)).collect(Collectors.toList());
    if (securityGroupsInVPC != null && !securityGroupsInVPC.isEmpty()) {
        for (SecurityGroup sg : securityGroupsInVPC) {
            // Do not use newly provisioned security groups as this could interfere with the cleanup logic of other tests.
            if (!sg.getGroupName().startsWith(AWS_NEW_GROUP_PREFIX)) {
                return sg;
            }
        }
    }
    String securityGroupId = new AWSSecurityGroupClient(client).createDefaultSecurityGroup(vpcID);
    tagResources(client, Arrays.asList(securityGroupId), TAG_KEY_FOR_TEST_RESOURCES, TAG_VALUE_FOR_TEST_RESOURCES + TAG_SG);
    DescribeSecurityGroupsResult result = client.describeSecurityGroups(new DescribeSecurityGroupsRequest().withGroupIds(Arrays.asList(securityGroupId)));
    return result.getSecurityGroups().get(0);
}
Also used : 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) DescribeSecurityGroupsRequest(com.amazonaws.services.ec2.model.DescribeSecurityGroupsRequest) AWSSecurityGroupClient(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSSecurityGroupClient) SecurityGroup(com.amazonaws.services.ec2.model.SecurityGroup) DescribeSecurityGroupsResult(com.amazonaws.services.ec2.model.DescribeSecurityGroupsResult)

Aggregations

SecurityGroup (com.amazonaws.services.ec2.model.SecurityGroup)31 DescribeSecurityGroupsResult (com.amazonaws.services.ec2.model.DescribeSecurityGroupsResult)12 DescribeSecurityGroupsRequest (com.amazonaws.services.ec2.model.DescribeSecurityGroupsRequest)11 Test (org.junit.Test)10 IpPermission (com.amazonaws.services.ec2.model.IpPermission)9 ArrayList (java.util.ArrayList)8 Instance (com.amazonaws.services.ec2.model.Instance)7 HashMap (java.util.HashMap)7 AmazonEC2AsyncClient (com.amazonaws.services.ec2.AmazonEC2AsyncClient)6 SecurityGroupState (com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState)6 Operation (com.vmware.xenon.common.Operation)6 Utils (com.vmware.xenon.common.Utils)6 Map (java.util.Map)6 Filter (com.amazonaws.services.ec2.model.Filter)5 Collections (java.util.Collections)5 List (java.util.List)5 TimeUnit (java.util.concurrent.TimeUnit)5 Level (java.util.logging.Level)5 Collectors (java.util.stream.Collectors)5 Before (org.junit.Before)5