
software.amazon.awssdk.services.directconnect.model.DirectConnectGatewayAssociationProposal Maven / Gradle / Ivy
Show all versions of directconnect Show documentation
/*
* 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.directconnect.model;
import java.io.Serializable;
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;
/**
*
* Information about the proposal request to attach a virtual private gateway to a Direct Connect gateway.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DirectConnectGatewayAssociationProposal implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField PROPOSAL_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("proposalId").getter(getter(DirectConnectGatewayAssociationProposal::proposalId))
.setter(setter(Builder::proposalId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("proposalId").build()).build();
private static final SdkField DIRECT_CONNECT_GATEWAY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("directConnectGatewayId").getter(getter(DirectConnectGatewayAssociationProposal::directConnectGatewayId))
.setter(setter(Builder::directConnectGatewayId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("directConnectGatewayId").build())
.build();
private static final SdkField DIRECT_CONNECT_GATEWAY_OWNER_ACCOUNT_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("directConnectGatewayOwnerAccount")
.getter(getter(DirectConnectGatewayAssociationProposal::directConnectGatewayOwnerAccount))
.setter(setter(Builder::directConnectGatewayOwnerAccount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("directConnectGatewayOwnerAccount")
.build()).build();
private static final SdkField PROPOSAL_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("proposalState").getter(getter(DirectConnectGatewayAssociationProposal::proposalStateAsString))
.setter(setter(Builder::proposalState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("proposalState").build()).build();
private static final SdkField ASSOCIATED_GATEWAY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("associatedGateway")
.getter(getter(DirectConnectGatewayAssociationProposal::associatedGateway))
.setter(setter(Builder::associatedGateway)).constructor(AssociatedGateway::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("associatedGateway").build()).build();
private static final SdkField> EXISTING_ALLOWED_PREFIXES_TO_DIRECT_CONNECT_GATEWAY_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("existingAllowedPrefixesToDirectConnectGateway")
.getter(getter(DirectConnectGatewayAssociationProposal::existingAllowedPrefixesToDirectConnectGateway))
.setter(setter(Builder::existingAllowedPrefixesToDirectConnectGateway))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("existingAllowedPrefixesToDirectConnectGateway").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(RouteFilterPrefix::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> REQUESTED_ALLOWED_PREFIXES_TO_DIRECT_CONNECT_GATEWAY_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("requestedAllowedPrefixesToDirectConnectGateway")
.getter(getter(DirectConnectGatewayAssociationProposal::requestedAllowedPrefixesToDirectConnectGateway))
.setter(setter(Builder::requestedAllowedPrefixesToDirectConnectGateway))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("requestedAllowedPrefixesToDirectConnectGateway").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(RouteFilterPrefix::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PROPOSAL_ID_FIELD,
DIRECT_CONNECT_GATEWAY_ID_FIELD, DIRECT_CONNECT_GATEWAY_OWNER_ACCOUNT_FIELD, PROPOSAL_STATE_FIELD,
ASSOCIATED_GATEWAY_FIELD, EXISTING_ALLOWED_PREFIXES_TO_DIRECT_CONNECT_GATEWAY_FIELD,
REQUESTED_ALLOWED_PREFIXES_TO_DIRECT_CONNECT_GATEWAY_FIELD));
private static final long serialVersionUID = 1L;
private final String proposalId;
private final String directConnectGatewayId;
private final String directConnectGatewayOwnerAccount;
private final String proposalState;
private final AssociatedGateway associatedGateway;
private final List existingAllowedPrefixesToDirectConnectGateway;
private final List requestedAllowedPrefixesToDirectConnectGateway;
private DirectConnectGatewayAssociationProposal(BuilderImpl builder) {
this.proposalId = builder.proposalId;
this.directConnectGatewayId = builder.directConnectGatewayId;
this.directConnectGatewayOwnerAccount = builder.directConnectGatewayOwnerAccount;
this.proposalState = builder.proposalState;
this.associatedGateway = builder.associatedGateway;
this.existingAllowedPrefixesToDirectConnectGateway = builder.existingAllowedPrefixesToDirectConnectGateway;
this.requestedAllowedPrefixesToDirectConnectGateway = builder.requestedAllowedPrefixesToDirectConnectGateway;
}
/**
*
* The ID of the association proposal.
*
*
* @return The ID of the association proposal.
*/
public final String proposalId() {
return proposalId;
}
/**
*
* The ID of the Direct Connect gateway.
*
*
* @return The ID of the Direct Connect gateway.
*/
public final String directConnectGatewayId() {
return directConnectGatewayId;
}
/**
*
* The ID of the Amazon Web Services account that owns the Direct Connect gateway.
*
*
* @return The ID of the Amazon Web Services account that owns the Direct Connect gateway.
*/
public final String directConnectGatewayOwnerAccount() {
return directConnectGatewayOwnerAccount;
}
/**
*
* The state of the proposal. The following are possible values:
*
*
* -
*
* accepted
: The proposal has been accepted. The Direct Connect gateway association is available to use
* in this state.
*
*
* -
*
* deleted
: The proposal has been deleted by the owner that made the proposal. The Direct Connect
* gateway association cannot be used in this state.
*
*
* -
*
* requested
: The proposal has been requested. The Direct Connect gateway association cannot be used in
* this state.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #proposalState}
* will return {@link DirectConnectGatewayAssociationProposalState#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #proposalStateAsString}.
*
*
* @return The state of the proposal. The following are possible values:
*
* -
*
* accepted
: The proposal has been accepted. The Direct Connect gateway association is
* available to use in this state.
*
*
* -
*
* deleted
: The proposal has been deleted by the owner that made the proposal. The Direct
* Connect gateway association cannot be used in this state.
*
*
* -
*
* requested
: The proposal has been requested. The Direct Connect gateway association cannot be
* used in this state.
*
*
* @see DirectConnectGatewayAssociationProposalState
*/
public final DirectConnectGatewayAssociationProposalState proposalState() {
return DirectConnectGatewayAssociationProposalState.fromValue(proposalState);
}
/**
*
* The state of the proposal. The following are possible values:
*
*
* -
*
* accepted
: The proposal has been accepted. The Direct Connect gateway association is available to use
* in this state.
*
*
* -
*
* deleted
: The proposal has been deleted by the owner that made the proposal. The Direct Connect
* gateway association cannot be used in this state.
*
*
* -
*
* requested
: The proposal has been requested. The Direct Connect gateway association cannot be used in
* this state.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #proposalState}
* will return {@link DirectConnectGatewayAssociationProposalState#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #proposalStateAsString}.
*
*
* @return The state of the proposal. The following are possible values:
*
* -
*
* accepted
: The proposal has been accepted. The Direct Connect gateway association is
* available to use in this state.
*
*
* -
*
* deleted
: The proposal has been deleted by the owner that made the proposal. The Direct
* Connect gateway association cannot be used in this state.
*
*
* -
*
* requested
: The proposal has been requested. The Direct Connect gateway association cannot be
* used in this state.
*
*
* @see DirectConnectGatewayAssociationProposalState
*/
public final String proposalStateAsString() {
return proposalState;
}
/**
*
* Information about the associated gateway.
*
*
* @return Information about the associated gateway.
*/
public final AssociatedGateway associatedGateway() {
return associatedGateway;
}
/**
* For responses, this returns true if the service returned a value for the
* ExistingAllowedPrefixesToDirectConnectGateway 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 hasExistingAllowedPrefixesToDirectConnectGateway() {
return existingAllowedPrefixesToDirectConnectGateway != null
&& !(existingAllowedPrefixesToDirectConnectGateway instanceof SdkAutoConstructList);
}
/**
*
* The existing Amazon VPC prefixes advertised to the Direct Connect gateway.
*
*
* 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 #hasExistingAllowedPrefixesToDirectConnectGateway} method.
*
*
* @return The existing Amazon VPC prefixes advertised to the Direct Connect gateway.
*/
public final List existingAllowedPrefixesToDirectConnectGateway() {
return existingAllowedPrefixesToDirectConnectGateway;
}
/**
* For responses, this returns true if the service returned a value for the
* RequestedAllowedPrefixesToDirectConnectGateway 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 hasRequestedAllowedPrefixesToDirectConnectGateway() {
return requestedAllowedPrefixesToDirectConnectGateway != null
&& !(requestedAllowedPrefixesToDirectConnectGateway instanceof SdkAutoConstructList);
}
/**
*
* The Amazon VPC prefixes to advertise to the Direct Connect gateway.
*
*
* 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 #hasRequestedAllowedPrefixesToDirectConnectGateway} method.
*
*
* @return The Amazon VPC prefixes to advertise to the Direct Connect gateway.
*/
public final List requestedAllowedPrefixesToDirectConnectGateway() {
return requestedAllowedPrefixesToDirectConnectGateway;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(proposalId());
hashCode = 31 * hashCode + Objects.hashCode(directConnectGatewayId());
hashCode = 31 * hashCode + Objects.hashCode(directConnectGatewayOwnerAccount());
hashCode = 31 * hashCode + Objects.hashCode(proposalStateAsString());
hashCode = 31 * hashCode + Objects.hashCode(associatedGateway());
hashCode = 31
* hashCode
+ Objects
.hashCode(hasExistingAllowedPrefixesToDirectConnectGateway() ? existingAllowedPrefixesToDirectConnectGateway()
: null);
hashCode = 31
* hashCode
+ Objects
.hashCode(hasRequestedAllowedPrefixesToDirectConnectGateway() ? requestedAllowedPrefixesToDirectConnectGateway()
: null);
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 DirectConnectGatewayAssociationProposal)) {
return false;
}
DirectConnectGatewayAssociationProposal other = (DirectConnectGatewayAssociationProposal) obj;
return Objects.equals(proposalId(), other.proposalId())
&& Objects.equals(directConnectGatewayId(), other.directConnectGatewayId())
&& Objects.equals(directConnectGatewayOwnerAccount(), other.directConnectGatewayOwnerAccount())
&& Objects.equals(proposalStateAsString(), other.proposalStateAsString())
&& Objects.equals(associatedGateway(), other.associatedGateway())
&& hasExistingAllowedPrefixesToDirectConnectGateway() == other.hasExistingAllowedPrefixesToDirectConnectGateway()
&& Objects.equals(existingAllowedPrefixesToDirectConnectGateway(),
other.existingAllowedPrefixesToDirectConnectGateway())
&& hasRequestedAllowedPrefixesToDirectConnectGateway() == other
.hasRequestedAllowedPrefixesToDirectConnectGateway()
&& Objects.equals(requestedAllowedPrefixesToDirectConnectGateway(),
other.requestedAllowedPrefixesToDirectConnectGateway());
}
/**
* 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("DirectConnectGatewayAssociationProposal")
.add("ProposalId", proposalId())
.add("DirectConnectGatewayId", directConnectGatewayId())
.add("DirectConnectGatewayOwnerAccount", directConnectGatewayOwnerAccount())
.add("ProposalState", proposalStateAsString())
.add("AssociatedGateway", associatedGateway())
.add("ExistingAllowedPrefixesToDirectConnectGateway",
hasExistingAllowedPrefixesToDirectConnectGateway() ? existingAllowedPrefixesToDirectConnectGateway()
: null)
.add("RequestedAllowedPrefixesToDirectConnectGateway",
hasRequestedAllowedPrefixesToDirectConnectGateway() ? requestedAllowedPrefixesToDirectConnectGateway()
: null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "proposalId":
return Optional.ofNullable(clazz.cast(proposalId()));
case "directConnectGatewayId":
return Optional.ofNullable(clazz.cast(directConnectGatewayId()));
case "directConnectGatewayOwnerAccount":
return Optional.ofNullable(clazz.cast(directConnectGatewayOwnerAccount()));
case "proposalState":
return Optional.ofNullable(clazz.cast(proposalStateAsString()));
case "associatedGateway":
return Optional.ofNullable(clazz.cast(associatedGateway()));
case "existingAllowedPrefixesToDirectConnectGateway":
return Optional.ofNullable(clazz.cast(existingAllowedPrefixesToDirectConnectGateway()));
case "requestedAllowedPrefixesToDirectConnectGateway":
return Optional.ofNullable(clazz.cast(requestedAllowedPrefixesToDirectConnectGateway()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function