All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.ec2.model.VpcPeeringConnectionVpcInfo Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with Amazon EC2 Service

The newest version!
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.ec2.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Describes a VPC in a VPC peering connection. *

*/ @Generated("software.amazon.awssdk:codegen") public final class VpcPeeringConnectionVpcInfo implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CIDR_BLOCK_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("CidrBlock") .getter(getter(VpcPeeringConnectionVpcInfo::cidrBlock)) .setter(setter(Builder::cidrBlock)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CidrBlock") .unmarshallLocationName("cidrBlock").build()).build(); private static final SdkField> IPV6_CIDR_BLOCK_SET_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Ipv6CidrBlockSet") .getter(getter(VpcPeeringConnectionVpcInfo::ipv6CidrBlockSet)) .setter(setter(Builder::ipv6CidrBlockSet)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Ipv6CidrBlockSet") .unmarshallLocationName("ipv6CidrBlockSet").build(), ListTrait .builder() .memberLocationName("item") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Ipv6CidrBlock::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Item").unmarshallLocationName("item").build()).build()) .build()).build(); private static final SdkField> CIDR_BLOCK_SET_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("CidrBlockSet") .getter(getter(VpcPeeringConnectionVpcInfo::cidrBlockSet)) .setter(setter(Builder::cidrBlockSet)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CidrBlockSet") .unmarshallLocationName("cidrBlockSet").build(), ListTrait .builder() .memberLocationName("item") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(CidrBlock::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Item").unmarshallLocationName("item").build()).build()) .build()).build(); private static final SdkField OWNER_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("OwnerId") .getter(getter(VpcPeeringConnectionVpcInfo::ownerId)) .setter(setter(Builder::ownerId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OwnerId") .unmarshallLocationName("ownerId").build()).build(); private static final SdkField PEERING_OPTIONS_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("PeeringOptions") .getter(getter(VpcPeeringConnectionVpcInfo::peeringOptions)) .setter(setter(Builder::peeringOptions)) .constructor(VpcPeeringConnectionOptionsDescription::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PeeringOptions") .unmarshallLocationName("peeringOptions").build()).build(); private static final SdkField VPC_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("VpcId") .getter(getter(VpcPeeringConnectionVpcInfo::vpcId)) .setter(setter(Builder::vpcId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcId") .unmarshallLocationName("vpcId").build()).build(); private static final SdkField REGION_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("Region") .getter(getter(VpcPeeringConnectionVpcInfo::region)) .setter(setter(Builder::region)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Region") .unmarshallLocationName("region").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CIDR_BLOCK_FIELD, IPV6_CIDR_BLOCK_SET_FIELD, CIDR_BLOCK_SET_FIELD, OWNER_ID_FIELD, PEERING_OPTIONS_FIELD, VPC_ID_FIELD, REGION_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("CidrBlock", CIDR_BLOCK_FIELD); put("Ipv6CidrBlockSet", IPV6_CIDR_BLOCK_SET_FIELD); put("CidrBlockSet", CIDR_BLOCK_SET_FIELD); put("OwnerId", OWNER_ID_FIELD); put("PeeringOptions", PEERING_OPTIONS_FIELD); put("VpcId", VPC_ID_FIELD); put("Region", REGION_FIELD); } }); private static final long serialVersionUID = 1L; private final String cidrBlock; private final List ipv6CidrBlockSet; private final List cidrBlockSet; private final String ownerId; private final VpcPeeringConnectionOptionsDescription peeringOptions; private final String vpcId; private final String region; private VpcPeeringConnectionVpcInfo(BuilderImpl builder) { this.cidrBlock = builder.cidrBlock; this.ipv6CidrBlockSet = builder.ipv6CidrBlockSet; this.cidrBlockSet = builder.cidrBlockSet; this.ownerId = builder.ownerId; this.peeringOptions = builder.peeringOptions; this.vpcId = builder.vpcId; this.region = builder.region; } /** *

* The IPv4 CIDR block for the VPC. *

* * @return The IPv4 CIDR block for the VPC. */ public final String cidrBlock() { return cidrBlock; } /** * For responses, this returns true if the service returned a value for the Ipv6CidrBlockSet property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasIpv6CidrBlockSet() { return ipv6CidrBlockSet != null && !(ipv6CidrBlockSet instanceof SdkAutoConstructList); } /** *

* The IPv6 CIDR block for the VPC. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasIpv6CidrBlockSet} method. *

* * @return The IPv6 CIDR block for the VPC. */ public final List ipv6CidrBlockSet() { return ipv6CidrBlockSet; } /** * For responses, this returns true if the service returned a value for the CidrBlockSet property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasCidrBlockSet() { return cidrBlockSet != null && !(cidrBlockSet instanceof SdkAutoConstructList); } /** *

* Information about the IPv4 CIDR blocks for the VPC. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasCidrBlockSet} method. *

* * @return Information about the IPv4 CIDR blocks for the VPC. */ public final List cidrBlockSet() { return cidrBlockSet; } /** *

* The ID of the Amazon Web Services account that owns the VPC. *

* * @return The ID of the Amazon Web Services account that owns the VPC. */ public final String ownerId() { return ownerId; } /** *

* Information about the VPC peering connection options for the accepter or requester VPC. *

* * @return Information about the VPC peering connection options for the accepter or requester VPC. */ public final VpcPeeringConnectionOptionsDescription peeringOptions() { return peeringOptions; } /** *

* The ID of the VPC. *

* * @return The ID of the VPC. */ public final String vpcId() { return vpcId; } /** *

* The Region in which the VPC is located. *

* * @return The Region in which the VPC is located. */ public final String region() { return region; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(cidrBlock()); hashCode = 31 * hashCode + Objects.hashCode(hasIpv6CidrBlockSet() ? ipv6CidrBlockSet() : null); hashCode = 31 * hashCode + Objects.hashCode(hasCidrBlockSet() ? cidrBlockSet() : null); hashCode = 31 * hashCode + Objects.hashCode(ownerId()); hashCode = 31 * hashCode + Objects.hashCode(peeringOptions()); hashCode = 31 * hashCode + Objects.hashCode(vpcId()); hashCode = 31 * hashCode + Objects.hashCode(region()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof VpcPeeringConnectionVpcInfo)) { return false; } VpcPeeringConnectionVpcInfo other = (VpcPeeringConnectionVpcInfo) obj; return Objects.equals(cidrBlock(), other.cidrBlock()) && hasIpv6CidrBlockSet() == other.hasIpv6CidrBlockSet() && Objects.equals(ipv6CidrBlockSet(), other.ipv6CidrBlockSet()) && hasCidrBlockSet() == other.hasCidrBlockSet() && Objects.equals(cidrBlockSet(), other.cidrBlockSet()) && Objects.equals(ownerId(), other.ownerId()) && Objects.equals(peeringOptions(), other.peeringOptions()) && Objects.equals(vpcId(), other.vpcId()) && Objects.equals(region(), other.region()); } /** * 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. */ @Override public final String toString() { return ToString.builder("VpcPeeringConnectionVpcInfo").add("CidrBlock", cidrBlock()) .add("Ipv6CidrBlockSet", hasIpv6CidrBlockSet() ? ipv6CidrBlockSet() : null) .add("CidrBlockSet", hasCidrBlockSet() ? cidrBlockSet() : null).add("OwnerId", ownerId()) .add("PeeringOptions", peeringOptions()).add("VpcId", vpcId()).add("Region", region()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "CidrBlock": return Optional.ofNullable(clazz.cast(cidrBlock())); case "Ipv6CidrBlockSet": return Optional.ofNullable(clazz.cast(ipv6CidrBlockSet())); case "CidrBlockSet": return Optional.ofNullable(clazz.cast(cidrBlockSet())); case "OwnerId": return Optional.ofNullable(clazz.cast(ownerId())); case "PeeringOptions": return Optional.ofNullable(clazz.cast(peeringOptions())); case "VpcId": return Optional.ofNullable(clazz.cast(vpcId())); case "Region": return Optional.ofNullable(clazz.cast(region())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((VpcPeeringConnectionVpcInfo) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The IPv4 CIDR block for the VPC. *

* * @param cidrBlock * The IPv4 CIDR block for the VPC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cidrBlock(String cidrBlock); /** *

* The IPv6 CIDR block for the VPC. *

* * @param ipv6CidrBlockSet * The IPv6 CIDR block for the VPC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ipv6CidrBlockSet(Collection ipv6CidrBlockSet); /** *

* The IPv6 CIDR block for the VPC. *

* * @param ipv6CidrBlockSet * The IPv6 CIDR block for the VPC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ipv6CidrBlockSet(Ipv6CidrBlock... ipv6CidrBlockSet); /** *

* The IPv6 CIDR block for the VPC. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.ec2.model.Ipv6CidrBlock.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.ec2.model.Ipv6CidrBlock#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.ec2.model.Ipv6CidrBlock.Builder#build()} is called immediately and its * result is passed to {@link #ipv6CidrBlockSet(List)}. * * @param ipv6CidrBlockSet * a consumer that will call methods on * {@link software.amazon.awssdk.services.ec2.model.Ipv6CidrBlock.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #ipv6CidrBlockSet(java.util.Collection) */ Builder ipv6CidrBlockSet(Consumer... ipv6CidrBlockSet); /** *

* Information about the IPv4 CIDR blocks for the VPC. *

* * @param cidrBlockSet * Information about the IPv4 CIDR blocks for the VPC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cidrBlockSet(Collection cidrBlockSet); /** *

* Information about the IPv4 CIDR blocks for the VPC. *

* * @param cidrBlockSet * Information about the IPv4 CIDR blocks for the VPC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cidrBlockSet(CidrBlock... cidrBlockSet); /** *

* Information about the IPv4 CIDR blocks for the VPC. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.ec2.model.CidrBlock.Builder} avoiding the need to create one manually * via {@link software.amazon.awssdk.services.ec2.model.CidrBlock#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.ec2.model.CidrBlock.Builder#build()} is called immediately and its * result is passed to {@link #cidrBlockSet(List)}. * * @param cidrBlockSet * a consumer that will call methods on * {@link software.amazon.awssdk.services.ec2.model.CidrBlock.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #cidrBlockSet(java.util.Collection) */ Builder cidrBlockSet(Consumer... cidrBlockSet); /** *

* The ID of the Amazon Web Services account that owns the VPC. *

* * @param ownerId * The ID of the Amazon Web Services account that owns the VPC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ownerId(String ownerId); /** *

* Information about the VPC peering connection options for the accepter or requester VPC. *

* * @param peeringOptions * Information about the VPC peering connection options for the accepter or requester VPC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder peeringOptions(VpcPeeringConnectionOptionsDescription peeringOptions); /** *

* Information about the VPC peering connection options for the accepter or requester VPC. *

* This is a convenience method that creates an instance of the * {@link VpcPeeringConnectionOptionsDescription.Builder} avoiding the need to create one manually via * {@link VpcPeeringConnectionOptionsDescription#builder()}. * *

* When the {@link Consumer} completes, {@link VpcPeeringConnectionOptionsDescription.Builder#build()} is called * immediately and its result is passed to {@link #peeringOptions(VpcPeeringConnectionOptionsDescription)}. * * @param peeringOptions * a consumer that will call methods on {@link VpcPeeringConnectionOptionsDescription.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #peeringOptions(VpcPeeringConnectionOptionsDescription) */ default Builder peeringOptions(Consumer peeringOptions) { return peeringOptions(VpcPeeringConnectionOptionsDescription.builder().applyMutation(peeringOptions).build()); } /** *

* The ID of the VPC. *

* * @param vpcId * The ID of the VPC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder vpcId(String vpcId); /** *

* The Region in which the VPC is located. *

* * @param region * The Region in which the VPC is located. * @return Returns a reference to this object so that method calls can be chained together. */ Builder region(String region); } static final class BuilderImpl implements Builder { private String cidrBlock; private List ipv6CidrBlockSet = DefaultSdkAutoConstructList.getInstance(); private List cidrBlockSet = DefaultSdkAutoConstructList.getInstance(); private String ownerId; private VpcPeeringConnectionOptionsDescription peeringOptions; private String vpcId; private String region; private BuilderImpl() { } private BuilderImpl(VpcPeeringConnectionVpcInfo model) { cidrBlock(model.cidrBlock); ipv6CidrBlockSet(model.ipv6CidrBlockSet); cidrBlockSet(model.cidrBlockSet); ownerId(model.ownerId); peeringOptions(model.peeringOptions); vpcId(model.vpcId); region(model.region); } public final String getCidrBlock() { return cidrBlock; } public final void setCidrBlock(String cidrBlock) { this.cidrBlock = cidrBlock; } @Override public final Builder cidrBlock(String cidrBlock) { this.cidrBlock = cidrBlock; return this; } public final List getIpv6CidrBlockSet() { List result = Ipv6CidrBlockSetCopier.copyToBuilder(this.ipv6CidrBlockSet); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setIpv6CidrBlockSet(Collection ipv6CidrBlockSet) { this.ipv6CidrBlockSet = Ipv6CidrBlockSetCopier.copyFromBuilder(ipv6CidrBlockSet); } @Override public final Builder ipv6CidrBlockSet(Collection ipv6CidrBlockSet) { this.ipv6CidrBlockSet = Ipv6CidrBlockSetCopier.copy(ipv6CidrBlockSet); return this; } @Override @SafeVarargs public final Builder ipv6CidrBlockSet(Ipv6CidrBlock... ipv6CidrBlockSet) { ipv6CidrBlockSet(Arrays.asList(ipv6CidrBlockSet)); return this; } @Override @SafeVarargs public final Builder ipv6CidrBlockSet(Consumer... ipv6CidrBlockSet) { ipv6CidrBlockSet(Stream.of(ipv6CidrBlockSet).map(c -> Ipv6CidrBlock.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final List getCidrBlockSet() { List result = CidrBlockSetCopier.copyToBuilder(this.cidrBlockSet); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setCidrBlockSet(Collection cidrBlockSet) { this.cidrBlockSet = CidrBlockSetCopier.copyFromBuilder(cidrBlockSet); } @Override public final Builder cidrBlockSet(Collection cidrBlockSet) { this.cidrBlockSet = CidrBlockSetCopier.copy(cidrBlockSet); return this; } @Override @SafeVarargs public final Builder cidrBlockSet(CidrBlock... cidrBlockSet) { cidrBlockSet(Arrays.asList(cidrBlockSet)); return this; } @Override @SafeVarargs public final Builder cidrBlockSet(Consumer... cidrBlockSet) { cidrBlockSet(Stream.of(cidrBlockSet).map(c -> CidrBlock.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final String getOwnerId() { return ownerId; } public final void setOwnerId(String ownerId) { this.ownerId = ownerId; } @Override public final Builder ownerId(String ownerId) { this.ownerId = ownerId; return this; } public final VpcPeeringConnectionOptionsDescription.Builder getPeeringOptions() { return peeringOptions != null ? peeringOptions.toBuilder() : null; } public final void setPeeringOptions(VpcPeeringConnectionOptionsDescription.BuilderImpl peeringOptions) { this.peeringOptions = peeringOptions != null ? peeringOptions.build() : null; } @Override public final Builder peeringOptions(VpcPeeringConnectionOptionsDescription peeringOptions) { this.peeringOptions = peeringOptions; return this; } public final String getVpcId() { return vpcId; } public final void setVpcId(String vpcId) { this.vpcId = vpcId; } @Override public final Builder vpcId(String vpcId) { this.vpcId = vpcId; return this; } public final String getRegion() { return region; } public final void setRegion(String region) { this.region = region; } @Override public final Builder region(String region) { this.region = region; return this; } @Override public VpcPeeringConnectionVpcInfo build() { return new VpcPeeringConnectionVpcInfo(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy