/** * Simplified method form for invoking the DescribeSubnets operation. * * @see #describeSubnetsAsync(DescribeSubnetsRequest) */ @Override public java.util.concurrent.Future<DescribeSubnetsResult> describeSubnetsAsync() { return describeSubnetsAsync(new DescribeSubnetsRequest()); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getFilters() == null) ? 0 : getFilters().hashCode()); hashCode = prime * hashCode + ((getSubnetIds() == null) ? 0 : getSubnetIds().hashCode()); return hashCode; }
/** * <p> * One or more subnet IDs. * </p> * <p> * Default: Describes all your subnets. * </p> * * @param subnetIds * One or more subnet IDs.</p> * <p> * Default: Describes all your subnets. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeSubnetsRequest withSubnetIds(java.util.Collection<String> subnetIds) { setSubnetIds(subnetIds); return this; }
DescribeSubnetsRequest describeSubnetsRequest = new DescribeSubnetsRequest(); describeSubnetsRequest.setSubnetIds(subnetIds); try
/** * Get a list of security group ids for the slave */ private List<String> getEc2SecurityGroups(AmazonEC2 ec2) throws AmazonClientException{ List<String> group_ids = new ArrayList<String>(); DescribeSecurityGroupsResult group_result = getSecurityGroupsBy("group-name", securityGroupSet, ec2); if (group_result.getSecurityGroups().size() == 0) { group_result = getSecurityGroupsBy("group-id", securityGroupSet, ec2); } for (SecurityGroup group : group_result.getSecurityGroups()) { if (group.getVpcId() != null && !group.getVpcId().isEmpty()) { List<Filter> filters = new ArrayList<Filter>(); filters.add(new Filter("vpc-id").withValues(group.getVpcId())); filters.add(new Filter("state").withValues("available")); filters.add(new Filter("subnet-id").withValues(getSubnetId())); DescribeSubnetsRequest subnet_req = new DescribeSubnetsRequest(); subnet_req.withFilters(filters); DescribeSubnetsResult subnet_result = ec2.describeSubnets(subnet_req); List<Subnet> subnets = subnet_result.getSubnets(); if(subnets != null && !subnets.isEmpty()) { group_ids.add(group.getGroupId()); } } } if (securityGroupSet.size() != group_ids.size()) { throw new AmazonClientException( "Security groups must all be VPC security groups to work in a VPC context" ); } return group_ids; }
/** * One or more subnet IDs. <p>Default: Describes all your subnets. * <p> * Returns a reference to this object so that method calls can be chained together. * * @param subnetIds One or more subnet IDs. <p>Default: Describes all your subnets. * * @return A reference to this updated object so that method calls can be chained * together. */ public DescribeSubnetsRequest withSubnetIds(String... subnetIds) { if (getSubnetIds() == null) setSubnetIds(new java.util.ArrayList<String>(subnetIds.length)); for (String value : subnetIds) { getSubnetIds().add(value); } return this; }
/** * * @param subnetIds * @param ec2Client * @return */ public List<Subnet> getSubnets(List<String> subnetIds, AmazonEC2 ec2Client) { DescribeSubnetsRequest request = new DescribeSubnetsRequest(); if (subnetIds != null && !subnetIds.isEmpty()) { request = request.withSubnetIds(subnetIds); } DescribeSubnetsResult result = ec2Client.describeSubnets(request); return result.getSubnets(); }
if (getFilters() == null) setFilters(new java.util.ArrayList<Filter>(filters.length)); for (Filter value : filters) { getFilters().add(value);
setFilters(filters); return this;
List<String> requestedSubnetIds = describeSubnetsRequest.getSubnetIds();
DescribeSubnetsRequest describeSubnetsRequest = new DescribeSubnetsRequest(); describeSubnetsRequest.setSubnetIds(subnetIds); try
/** * Get a list of security group ids for the slave */ private List<String> getEc2SecurityGroups(AmazonEC2 ec2) throws AmazonClientException { List<String> groupIds = new ArrayList<String>(); DescribeSecurityGroupsResult groupResult = getSecurityGroupsBy("group-name", securityGroupSet, ec2); if (groupResult.getSecurityGroups().size() == 0) { groupResult = getSecurityGroupsBy("group-id", securityGroupSet, ec2); } for (SecurityGroup group : groupResult.getSecurityGroups()) { if (group.getVpcId() != null && !group.getVpcId().isEmpty()) { List<Filter> filters = new ArrayList<Filter>(); filters.add(new Filter("vpc-id").withValues(group.getVpcId())); filters.add(new Filter("state").withValues("available")); filters.add(new Filter("subnet-id").withValues(getCurrentSubnetId())); DescribeSubnetsRequest subnetReq = new DescribeSubnetsRequest(); subnetReq.withFilters(filters); DescribeSubnetsResult subnetResult = ec2.describeSubnets(subnetReq); List<Subnet> subnets = subnetResult.getSubnets(); if (subnets != null && !subnets.isEmpty()) { groupIds.add(group.getGroupId()); } } } if (securityGroupSet.size() != groupIds.size()) { throw new AmazonClientException("Security groups must all be VPC security groups to work in a VPC context"); } return groupIds; }
setFilters(new com.amazonaws.internal.SdkInternalList<Filter>(filters.length));
/** * Simplified method form for invoking the DescribeSubnets operation with an AsyncHandler. * * @see #describeSubnetsAsync(DescribeSubnetsRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<DescribeSubnetsResult> describeSubnetsAsync( com.amazonaws.handlers.AsyncHandler<DescribeSubnetsRequest, DescribeSubnetsResult> asyncHandler) { return describeSubnetsAsync(new DescribeSubnetsRequest(), asyncHandler); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeSubnetsRequest == false) return false; DescribeSubnetsRequest other = (DescribeSubnetsRequest) obj; if (other.getFilters() == null ^ this.getFilters() == null) return false; if (other.getFilters() != null && other.getFilters().equals(this.getFilters()) == false) return false; if (other.getSubnetIds() == null ^ this.getSubnetIds() == null) return false; if (other.getSubnetIds() != null && other.getSubnetIds().equals(this.getSubnetIds()) == false) return false; return true; }
/** * <p> * One or more subnet IDs. * </p> * <p> * Default: Describes all your subnets. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setSubnetIds(java.util.Collection)} or {@link #withSubnetIds(java.util.Collection)} if you want to * override the existing values. * </p> * * @param subnetIds * One or more subnet IDs.</p> * <p> * Default: Describes all your subnets. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeSubnetsRequest withSubnetIds(String... subnetIds) { if (this.subnetIds == null) { setSubnetIds(new com.amazonaws.internal.SdkInternalList<String>(subnetIds.length)); } for (String ele : subnetIds) { this.subnetIds.add(ele); } return this; }
setFilters(filters); return this;
@Override public DescribeSubnetsResult describeSubnets() { return describeSubnets(new DescribeSubnetsRequest()); }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getFilters() != null) sb.append("Filters: ").append(getFilters()).append(","); if (getSubnetIds() != null) sb.append("SubnetIds: ").append(getSubnetIds()); sb.append("}"); return sb.toString(); }
/** * <p> * One or more subnet IDs. * </p> * <p> * Default: Describes all your subnets. * </p> * * @param subnetIds * One or more subnet IDs.</p> * <p> * Default: Describes all your subnets. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeSubnetsRequest withSubnetIds(java.util.Collection<String> subnetIds) { setSubnetIds(subnetIds); return this; }