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

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

/*
 * 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.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
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 peering connection. *

*/ @Generated("software.amazon.awssdk:codegen") public final class VpcPeeringConnection implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ACCEPTER_VPC_INFO_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("AccepterVpcInfo") .getter(getter(VpcPeeringConnection::accepterVpcInfo)) .setter(setter(Builder::accepterVpcInfo)) .constructor(VpcPeeringConnectionVpcInfo::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AccepterVpcInfo") .unmarshallLocationName("accepterVpcInfo").build()).build(); private static final SdkField EXPIRATION_TIME_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("ExpirationTime") .getter(getter(VpcPeeringConnection::expirationTime)) .setter(setter(Builder::expirationTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpirationTime") .unmarshallLocationName("expirationTime").build()).build(); private static final SdkField REQUESTER_VPC_INFO_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("RequesterVpcInfo") .getter(getter(VpcPeeringConnection::requesterVpcInfo)) .setter(setter(Builder::requesterVpcInfo)) .constructor(VpcPeeringConnectionVpcInfo::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RequesterVpcInfo") .unmarshallLocationName("requesterVpcInfo").build()).build(); private static final SdkField STATUS_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("Status") .getter(getter(VpcPeeringConnection::status)) .setter(setter(Builder::status)) .constructor(VpcPeeringConnectionStateReason::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status") .unmarshallLocationName("status").build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Tags") .getter(getter(VpcPeeringConnection::tags)) .setter(setter(Builder::tags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TagSet") .unmarshallLocationName("tagSet").build(), ListTrait .builder() .memberLocationName("item") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Tag::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Item").unmarshallLocationName("item").build()).build()) .build()).build(); private static final SdkField VPC_PEERING_CONNECTION_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("VpcPeeringConnectionId") .getter(getter(VpcPeeringConnection::vpcPeeringConnectionId)) .setter(setter(Builder::vpcPeeringConnectionId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcPeeringConnectionId") .unmarshallLocationName("vpcPeeringConnectionId").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACCEPTER_VPC_INFO_FIELD, EXPIRATION_TIME_FIELD, REQUESTER_VPC_INFO_FIELD, STATUS_FIELD, TAGS_FIELD, VPC_PEERING_CONNECTION_ID_FIELD)); private static final long serialVersionUID = 1L; private final VpcPeeringConnectionVpcInfo accepterVpcInfo; private final Instant expirationTime; private final VpcPeeringConnectionVpcInfo requesterVpcInfo; private final VpcPeeringConnectionStateReason status; private final List tags; private final String vpcPeeringConnectionId; private VpcPeeringConnection(BuilderImpl builder) { this.accepterVpcInfo = builder.accepterVpcInfo; this.expirationTime = builder.expirationTime; this.requesterVpcInfo = builder.requesterVpcInfo; this.status = builder.status; this.tags = builder.tags; this.vpcPeeringConnectionId = builder.vpcPeeringConnectionId; } /** *

* Information about the accepter VPC. CIDR block information is only returned when describing an active VPC peering * connection. *

* * @return Information about the accepter VPC. CIDR block information is only returned when describing an active VPC * peering connection. */ public VpcPeeringConnectionVpcInfo accepterVpcInfo() { return accepterVpcInfo; } /** *

* The time that an unaccepted VPC peering connection will expire. *

* * @return The time that an unaccepted VPC peering connection will expire. */ public Instant expirationTime() { return expirationTime; } /** *

* Information about the requester VPC. CIDR block information is only returned when describing an active VPC * peering connection. *

* * @return Information about the requester VPC. CIDR block information is only returned when describing an active * VPC peering connection. */ public VpcPeeringConnectionVpcInfo requesterVpcInfo() { return requesterVpcInfo; } /** *

* The status of the VPC peering connection. *

* * @return The status of the VPC peering connection. */ public VpcPeeringConnectionStateReason status() { return status; } /** * Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not * specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructList); } /** *

* Any tags assigned to the resource. *

*

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

*

* You can use {@link #hasTags()} to see if a value was sent in this field. *

* * @return Any tags assigned to the resource. */ public List tags() { return tags; } /** *

* The ID of the VPC peering connection. *

* * @return The ID of the VPC peering connection. */ public String vpcPeeringConnectionId() { return vpcPeeringConnectionId; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(accepterVpcInfo()); hashCode = 31 * hashCode + Objects.hashCode(expirationTime()); hashCode = 31 * hashCode + Objects.hashCode(requesterVpcInfo()); hashCode = 31 * hashCode + Objects.hashCode(status()); hashCode = 31 * hashCode + Objects.hashCode(tags()); hashCode = 31 * hashCode + Objects.hashCode(vpcPeeringConnectionId()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof VpcPeeringConnection)) { return false; } VpcPeeringConnection other = (VpcPeeringConnection) obj; return Objects.equals(accepterVpcInfo(), other.accepterVpcInfo()) && Objects.equals(expirationTime(), other.expirationTime()) && Objects.equals(requesterVpcInfo(), other.requesterVpcInfo()) && Objects.equals(status(), other.status()) && Objects.equals(tags(), other.tags()) && Objects.equals(vpcPeeringConnectionId(), other.vpcPeeringConnectionId()); } /** * 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 String toString() { return ToString.builder("VpcPeeringConnection").add("AccepterVpcInfo", accepterVpcInfo()) .add("ExpirationTime", expirationTime()).add("RequesterVpcInfo", requesterVpcInfo()).add("Status", status()) .add("Tags", tags()).add("VpcPeeringConnectionId", vpcPeeringConnectionId()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "AccepterVpcInfo": return Optional.ofNullable(clazz.cast(accepterVpcInfo())); case "ExpirationTime": return Optional.ofNullable(clazz.cast(expirationTime())); case "RequesterVpcInfo": return Optional.ofNullable(clazz.cast(requesterVpcInfo())); case "Status": return Optional.ofNullable(clazz.cast(status())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); case "VpcPeeringConnectionId": return Optional.ofNullable(clazz.cast(vpcPeeringConnectionId())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((VpcPeeringConnection) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Information about the accepter VPC. CIDR block information is only returned when describing an active VPC * peering connection. *

* * @param accepterVpcInfo * Information about the accepter VPC. CIDR block information is only returned when describing an active * VPC peering connection. * @return Returns a reference to this object so that method calls can be chained together. */ Builder accepterVpcInfo(VpcPeeringConnectionVpcInfo accepterVpcInfo); /** *

* Information about the accepter VPC. CIDR block information is only returned when describing an active VPC * peering connection. *

* This is a convenience that creates an instance of the {@link VpcPeeringConnectionVpcInfo.Builder} avoiding * the need to create one manually via {@link VpcPeeringConnectionVpcInfo#builder()}. * * When the {@link Consumer} completes, {@link VpcPeeringConnectionVpcInfo.Builder#build()} is called * immediately and its result is passed to {@link #accepterVpcInfo(VpcPeeringConnectionVpcInfo)}. * * @param accepterVpcInfo * a consumer that will call methods on {@link VpcPeeringConnectionVpcInfo.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #accepterVpcInfo(VpcPeeringConnectionVpcInfo) */ default Builder accepterVpcInfo(Consumer accepterVpcInfo) { return accepterVpcInfo(VpcPeeringConnectionVpcInfo.builder().applyMutation(accepterVpcInfo).build()); } /** *

* The time that an unaccepted VPC peering connection will expire. *

* * @param expirationTime * The time that an unaccepted VPC peering connection will expire. * @return Returns a reference to this object so that method calls can be chained together. */ Builder expirationTime(Instant expirationTime); /** *

* Information about the requester VPC. CIDR block information is only returned when describing an active VPC * peering connection. *

* * @param requesterVpcInfo * Information about the requester VPC. CIDR block information is only returned when describing an active * VPC peering connection. * @return Returns a reference to this object so that method calls can be chained together. */ Builder requesterVpcInfo(VpcPeeringConnectionVpcInfo requesterVpcInfo); /** *

* Information about the requester VPC. CIDR block information is only returned when describing an active VPC * peering connection. *

* This is a convenience that creates an instance of the {@link VpcPeeringConnectionVpcInfo.Builder} avoiding * the need to create one manually via {@link VpcPeeringConnectionVpcInfo#builder()}. * * When the {@link Consumer} completes, {@link VpcPeeringConnectionVpcInfo.Builder#build()} is called * immediately and its result is passed to {@link #requesterVpcInfo(VpcPeeringConnectionVpcInfo)}. * * @param requesterVpcInfo * a consumer that will call methods on {@link VpcPeeringConnectionVpcInfo.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #requesterVpcInfo(VpcPeeringConnectionVpcInfo) */ default Builder requesterVpcInfo(Consumer requesterVpcInfo) { return requesterVpcInfo(VpcPeeringConnectionVpcInfo.builder().applyMutation(requesterVpcInfo).build()); } /** *

* The status of the VPC peering connection. *

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

* The status of the VPC peering connection. *

* This is a convenience that creates an instance of the {@link VpcPeeringConnectionStateReason.Builder} * avoiding the need to create one manually via {@link VpcPeeringConnectionStateReason#builder()}. * * When the {@link Consumer} completes, {@link VpcPeeringConnectionStateReason.Builder#build()} is called * immediately and its result is passed to {@link #status(VpcPeeringConnectionStateReason)}. * * @param status * a consumer that will call methods on {@link VpcPeeringConnectionStateReason.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #status(VpcPeeringConnectionStateReason) */ default Builder status(Consumer status) { return status(VpcPeeringConnectionStateReason.builder().applyMutation(status).build()); } /** *

* Any tags assigned to the resource. *

* * @param tags * Any tags assigned to the resource. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

* Any tags assigned to the resource. *

* * @param tags * Any tags assigned to the resource. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* Any tags assigned to the resource. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create * one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result * is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(List) */ Builder tags(Consumer... tags); /** *

* The ID of the VPC peering connection. *

* * @param vpcPeeringConnectionId * The ID of the VPC peering connection. * @return Returns a reference to this object so that method calls can be chained together. */ Builder vpcPeeringConnectionId(String vpcPeeringConnectionId); } static final class BuilderImpl implements Builder { private VpcPeeringConnectionVpcInfo accepterVpcInfo; private Instant expirationTime; private VpcPeeringConnectionVpcInfo requesterVpcInfo; private VpcPeeringConnectionStateReason status; private List tags = DefaultSdkAutoConstructList.getInstance(); private String vpcPeeringConnectionId; private BuilderImpl() { } private BuilderImpl(VpcPeeringConnection model) { accepterVpcInfo(model.accepterVpcInfo); expirationTime(model.expirationTime); requesterVpcInfo(model.requesterVpcInfo); status(model.status); tags(model.tags); vpcPeeringConnectionId(model.vpcPeeringConnectionId); } public final VpcPeeringConnectionVpcInfo.Builder getAccepterVpcInfo() { return accepterVpcInfo != null ? accepterVpcInfo.toBuilder() : null; } @Override public final Builder accepterVpcInfo(VpcPeeringConnectionVpcInfo accepterVpcInfo) { this.accepterVpcInfo = accepterVpcInfo; return this; } public final void setAccepterVpcInfo(VpcPeeringConnectionVpcInfo.BuilderImpl accepterVpcInfo) { this.accepterVpcInfo = accepterVpcInfo != null ? accepterVpcInfo.build() : null; } public final Instant getExpirationTime() { return expirationTime; } @Override public final Builder expirationTime(Instant expirationTime) { this.expirationTime = expirationTime; return this; } public final void setExpirationTime(Instant expirationTime) { this.expirationTime = expirationTime; } public final VpcPeeringConnectionVpcInfo.Builder getRequesterVpcInfo() { return requesterVpcInfo != null ? requesterVpcInfo.toBuilder() : null; } @Override public final Builder requesterVpcInfo(VpcPeeringConnectionVpcInfo requesterVpcInfo) { this.requesterVpcInfo = requesterVpcInfo; return this; } public final void setRequesterVpcInfo(VpcPeeringConnectionVpcInfo.BuilderImpl requesterVpcInfo) { this.requesterVpcInfo = requesterVpcInfo != null ? requesterVpcInfo.build() : null; } public final VpcPeeringConnectionStateReason.Builder getStatus() { return status != null ? status.toBuilder() : null; } @Override public final Builder status(VpcPeeringConnectionStateReason status) { this.status = status; return this; } public final void setStatus(VpcPeeringConnectionStateReason.BuilderImpl status) { this.status = status != null ? status.build() : null; } public final Collection getTags() { return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder tags(Collection tags) { this.tags = TagListCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } public final String getVpcPeeringConnectionId() { return vpcPeeringConnectionId; } @Override public final Builder vpcPeeringConnectionId(String vpcPeeringConnectionId) { this.vpcPeeringConnectionId = vpcPeeringConnectionId; return this; } public final void setVpcPeeringConnectionId(String vpcPeeringConnectionId) { this.vpcPeeringConnectionId = vpcPeeringConnectionId; } @Override public VpcPeeringConnection build() { return new VpcPeeringConnection(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy