/** * <p> * Any tags assigned to the subnet. * </p> * * @param tags * Any tags assigned to the subnet. * @return Returns a reference to this object so that method calls can be chained together. */ public Subnet withTags(java.util.Collection<Tag> tags) { setTags(tags); return this; }
/** * <p> * Any tags assigned to the subnet. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the * existing values. * </p> * * @param tags * Any tags assigned to the subnet. * @return Returns a reference to this object so that method calls can be chained together. */ public Subnet withTags(Tag... tags) { if (this.tags == null) { setTags(new com.amazonaws.internal.SdkInternalList<Tag>(tags.length)); } for (Tag ele : tags) { this.tags.add(ele); } return this; }
/** * Any tags assigned to the subnet. * <p> * Returns a reference to this object so that method calls can be chained together. * * @param tags Any tags assigned to the subnet. * * @return A reference to this updated object so that method calls can be chained * together. */ public Subnet withTags(Tag... tags) { if (getTags() == null) setTags(new java.util.ArrayList<Tag>(tags.length)); for (Tag value : tags) { getTags().add(value); } return this; }
/** * <p> * Any tags assigned to the subnet. * </p> * * @param tags * Any tags assigned to the subnet. * @return Returns a reference to this object so that method calls can be chained together. */ public Subnet withTags(java.util.Collection<Tag> tags) { setTags(tags); return this; }
/** * <p> * Any tags assigned to the subnet. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the * existing values. * </p> * * @param tags * Any tags assigned to the subnet. * @return Returns a reference to this object so that method calls can be chained together. */ public Subnet withTags(Tag... tags) { if (this.tags == null) { setTags(new com.amazonaws.internal.SdkInternalList<Tag>(tags.length)); } for (Tag ele : tags) { this.tags.add(ele); } return this; }
@Test public void testSerialization() throws JsonProcessingException { String account = "123456"; Regions region = Regions.US_WEST_1; SubnetScanner scanner = getProjector().createBuilder(AWSScannerBuilder.class).withAccountId(account).withRegion(region).build(SubnetScanner.class); Subnet subnet = new Subnet(); subnet.setAvailabilityZone("us-west-2a"); subnet.setCidrBlock("192.168.100.0/24"); subnet.setSubnetId("subnet-1234"); subnet.setVpcId("vpc-9876"); subnet.setTags(Lists.newArrayList(new Tag("fizz","buzz"),new Tag("foo","bar"))); JsonNode n = scanner.convertAwsObject(subnet, Region.getRegion(region)); prettyPrint(n); Assertions.assertThat(n.path("aws_vpcId").asText()).isEqualTo("vpc-9876"); Assertions.assertThat(n.path("aws_subnetId").asText()).isEqualTo("subnet-1234"); Assertions.assertThat(n.path("aws_region").asText()).isEqualTo(region.getName()); Assertions.assertThat(n.path("aws_account").asText()).isEqualTo(account); Assertions.assertThat(n.path("aws_arn").asText()).isEqualTo("arn:aws:ec2:us-west-1:123456:subnet/subnet-1234"); Assertions.assertThat(n.path("aws_tag_fizz").asText()).isEqualTo("buzz"); Assertions.assertThat(n.path("aws_cidrBlock").asText()).isEqualTo("192.168.100.0/24"); } }