Java Code Examples for com.amazonaws.services.ec2.model.Filter#setName()
The following examples show how to use
com.amazonaws.services.ec2.model.Filter#setName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SGLookupService.java From Gatekeeper with Apache License 2.0 | 6 votes |
private List<String> loadSgsForAccountRegion(AWSEnvironment environment) { logger.info("Grabbing SGs for environment " + environment); DescribeSecurityGroupsRequest describeSecurityGroupsRequest = new DescribeSecurityGroupsRequest(); Filter groupNameFilter = new Filter(); groupNameFilter.setName("group-name"); groupNameFilter.setValues(Arrays.asList(securityGroupNames.split(","))); AmazonEC2Client amazonEC2Client = awsSessionService.getEC2Session(environment); DescribeSecurityGroupsResult result = amazonEC2Client.describeSecurityGroups(describeSecurityGroupsRequest.withFilters(groupNameFilter)); logger.info("found " + result.getSecurityGroups().size() + " Security Groups with name(s) '" + securityGroupNames + "'"); return result.getSecurityGroups().stream() .map(SecurityGroup::getGroupId) .collect(Collectors.toList()); }
Example 2
Source File: PacmanEc2Utils.java From pacbot with Apache License 2.0 | 5 votes |
public static Filter setFilters(String filterName, String filterValue) { Filter filter = new Filter(); filter.setName(filterName); filter.setValues(Arrays.asList(filterValue)); return filter; }
Example 3
Source File: AwsPlatformResources.java From cloudbreak with Apache License 2.0 | 5 votes |
private DescribeAvailabilityZonesRequest getDescribeAvailabilityZonesRequest(AmazonEC2Client ec2Client, com.amazonaws.services.ec2.model.Region awsRegion) { DescribeAvailabilityZonesRequest describeAvailabilityZonesRequest = new DescribeAvailabilityZonesRequest(); ec2Client.setRegion(RegionUtils.getRegion(awsRegion.getRegionName())); Filter filter = new Filter(); filter.setName("region-name"); Collection<String> list = new ArrayList<>(); list.add(awsRegion.getRegionName()); filter.setValues(list); describeAvailabilityZonesRequest.withFilters(filter); return describeAvailabilityZonesRequest; }