software.amazon.awssdk.services.directconnect.model.CreateConnectionResponse 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.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;
/**
*
* Information about an AWS Direct Connect connection.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateConnectionResponse extends DirectConnectResponse implements
ToCopyableBuilder {
private static final SdkField OWNER_ACCOUNT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ownerAccount").getter(getter(CreateConnectionResponse::ownerAccount))
.setter(setter(Builder::ownerAccount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ownerAccount").build()).build();
private static final SdkField CONNECTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectionId").getter(getter(CreateConnectionResponse::connectionId))
.setter(setter(Builder::connectionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectionId").build()).build();
private static final SdkField CONNECTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectionName").getter(getter(CreateConnectionResponse::connectionName))
.setter(setter(Builder::connectionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectionName").build()).build();
private static final SdkField CONNECTION_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectionState").getter(getter(CreateConnectionResponse::connectionStateAsString))
.setter(setter(Builder::connectionState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectionState").build()).build();
private static final SdkField REGION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("region")
.getter(getter(CreateConnectionResponse::region)).setter(setter(Builder::region))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("region").build()).build();
private static final SdkField LOCATION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("location").getter(getter(CreateConnectionResponse::location)).setter(setter(Builder::location))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("location").build()).build();
private static final SdkField BANDWIDTH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("bandwidth").getter(getter(CreateConnectionResponse::bandwidth)).setter(setter(Builder::bandwidth))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("bandwidth").build()).build();
private static final SdkField VLAN_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("vlan")
.getter(getter(CreateConnectionResponse::vlan)).setter(setter(Builder::vlan))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("vlan").build()).build();
private static final SdkField PARTNER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("partnerName").getter(getter(CreateConnectionResponse::partnerName)).setter(setter(Builder::partnerName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("partnerName").build()).build();
private static final SdkField LOA_ISSUE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("loaIssueTime").getter(getter(CreateConnectionResponse::loaIssueTime))
.setter(setter(Builder::loaIssueTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("loaIssueTime").build()).build();
private static final SdkField LAG_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("lagId")
.getter(getter(CreateConnectionResponse::lagId)).setter(setter(Builder::lagId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lagId").build()).build();
private static final SdkField AWS_DEVICE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("awsDevice").getter(getter(CreateConnectionResponse::awsDevice)).setter(setter(Builder::awsDevice))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("awsDevice").build()).build();
private static final SdkField JUMBO_FRAME_CAPABLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("jumboFrameCapable").getter(getter(CreateConnectionResponse::jumboFrameCapable))
.setter(setter(Builder::jumboFrameCapable))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jumboFrameCapable").build()).build();
private static final SdkField AWS_DEVICE_V2_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("awsDeviceV2").getter(getter(CreateConnectionResponse::awsDeviceV2)).setter(setter(Builder::awsDeviceV2))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("awsDeviceV2").build()).build();
private static final SdkField HAS_LOGICAL_REDUNDANCY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("hasLogicalRedundancy").getter(getter(CreateConnectionResponse::hasLogicalRedundancyAsString))
.setter(setter(Builder::hasLogicalRedundancy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("hasLogicalRedundancy").build())
.build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("tags")
.getter(getter(CreateConnectionResponse::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField PROVIDER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("providerName").getter(getter(CreateConnectionResponse::providerName))
.setter(setter(Builder::providerName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("providerName").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(OWNER_ACCOUNT_FIELD,
CONNECTION_ID_FIELD, CONNECTION_NAME_FIELD, CONNECTION_STATE_FIELD, REGION_FIELD, LOCATION_FIELD, BANDWIDTH_FIELD,
VLAN_FIELD, PARTNER_NAME_FIELD, LOA_ISSUE_TIME_FIELD, LAG_ID_FIELD, AWS_DEVICE_FIELD, JUMBO_FRAME_CAPABLE_FIELD,
AWS_DEVICE_V2_FIELD, HAS_LOGICAL_REDUNDANCY_FIELD, TAGS_FIELD, PROVIDER_NAME_FIELD));
private final String ownerAccount;
private final String connectionId;
private final String connectionName;
private final String connectionState;
private final String region;
private final String location;
private final String bandwidth;
private final Integer vlan;
private final String partnerName;
private final Instant loaIssueTime;
private final String lagId;
private final String awsDevice;
private final Boolean jumboFrameCapable;
private final String awsDeviceV2;
private final String hasLogicalRedundancy;
private final List tags;
private final String providerName;
private CreateConnectionResponse(BuilderImpl builder) {
super(builder);
this.ownerAccount = builder.ownerAccount;
this.connectionId = builder.connectionId;
this.connectionName = builder.connectionName;
this.connectionState = builder.connectionState;
this.region = builder.region;
this.location = builder.location;
this.bandwidth = builder.bandwidth;
this.vlan = builder.vlan;
this.partnerName = builder.partnerName;
this.loaIssueTime = builder.loaIssueTime;
this.lagId = builder.lagId;
this.awsDevice = builder.awsDevice;
this.jumboFrameCapable = builder.jumboFrameCapable;
this.awsDeviceV2 = builder.awsDeviceV2;
this.hasLogicalRedundancy = builder.hasLogicalRedundancy;
this.tags = builder.tags;
this.providerName = builder.providerName;
}
/**
*
* The ID of the AWS account that owns the connection.
*
*
* @return The ID of the AWS account that owns the connection.
*/
public String ownerAccount() {
return ownerAccount;
}
/**
*
* The ID of the connection.
*
*
* @return The ID of the connection.
*/
public String connectionId() {
return connectionId;
}
/**
*
* The name of the connection.
*
*
* @return The name of the connection.
*/
public String connectionName() {
return connectionName;
}
/**
*
* The state of the connection. The following are the possible values:
*
*
* -
*
* ordering
: The initial state of a hosted connection provisioned on an interconnect. The connection
* stays in the ordering state until the owner of the hosted connection confirms or declines the connection order.
*
*
* -
*
* requested
: The initial state of a standard connection. The connection stays in the requested state
* until the Letter of Authorization (LOA) is sent to the customer.
*
*
* -
*
* pending
: The connection has been approved and is being initialized.
*
*
* -
*
* available
: The network link is up and the connection is ready for use.
*
*
* -
*
* down
: The network link is down.
*
*
* -
*
* deleting
: The connection is being deleted.
*
*
* -
*
* deleted
: The connection has been deleted.
*
*
* -
*
* rejected
: A hosted connection in the ordering
state enters the rejected
* state if it is deleted by the customer.
*
*
* -
*
* unknown
: The state of the connection is not available.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #connectionState}
* will return {@link ConnectionState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #connectionStateAsString}.
*
*
* @return The state of the connection. The following are the possible values:
*
* -
*
* ordering
: The initial state of a hosted connection provisioned on an interconnect. The
* connection stays in the ordering state until the owner of the hosted connection confirms or declines the
* connection order.
*
*
* -
*
* requested
: The initial state of a standard connection. The connection stays in the requested
* state until the Letter of Authorization (LOA) is sent to the customer.
*
*
* -
*
* pending
: The connection has been approved and is being initialized.
*
*
* -
*
* available
: The network link is up and the connection is ready for use.
*
*
* -
*
* down
: The network link is down.
*
*
* -
*
* deleting
: The connection is being deleted.
*
*
* -
*
* deleted
: The connection has been deleted.
*
*
* -
*
* rejected
: A hosted connection in the ordering
state enters the
* rejected
state if it is deleted by the customer.
*
*
* -
*
* unknown
: The state of the connection is not available.
*
*
* @see ConnectionState
*/
public ConnectionState connectionState() {
return ConnectionState.fromValue(connectionState);
}
/**
*
* The state of the connection. The following are the possible values:
*
*
* -
*
* ordering
: The initial state of a hosted connection provisioned on an interconnect. The connection
* stays in the ordering state until the owner of the hosted connection confirms or declines the connection order.
*
*
* -
*
* requested
: The initial state of a standard connection. The connection stays in the requested state
* until the Letter of Authorization (LOA) is sent to the customer.
*
*
* -
*
* pending
: The connection has been approved and is being initialized.
*
*
* -
*
* available
: The network link is up and the connection is ready for use.
*
*
* -
*
* down
: The network link is down.
*
*
* -
*
* deleting
: The connection is being deleted.
*
*
* -
*
* deleted
: The connection has been deleted.
*
*
* -
*
* rejected
: A hosted connection in the ordering
state enters the rejected
* state if it is deleted by the customer.
*
*
* -
*
* unknown
: The state of the connection is not available.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #connectionState}
* will return {@link ConnectionState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #connectionStateAsString}.
*
*
* @return The state of the connection. The following are the possible values:
*
* -
*
* ordering
: The initial state of a hosted connection provisioned on an interconnect. The
* connection stays in the ordering state until the owner of the hosted connection confirms or declines the
* connection order.
*
*
* -
*
* requested
: The initial state of a standard connection. The connection stays in the requested
* state until the Letter of Authorization (LOA) is sent to the customer.
*
*
* -
*
* pending
: The connection has been approved and is being initialized.
*
*
* -
*
* available
: The network link is up and the connection is ready for use.
*
*
* -
*
* down
: The network link is down.
*
*
* -
*
* deleting
: The connection is being deleted.
*
*
* -
*
* deleted
: The connection has been deleted.
*
*
* -
*
* rejected
: A hosted connection in the ordering
state enters the
* rejected
state if it is deleted by the customer.
*
*
* -
*
* unknown
: The state of the connection is not available.
*
*
* @see ConnectionState
*/
public String connectionStateAsString() {
return connectionState;
}
/**
*
* The AWS Region where the connection is located.
*
*
* @return The AWS Region where the connection is located.
*/
public String region() {
return region;
}
/**
*
* The location of the connection.
*
*
* @return The location of the connection.
*/
public String location() {
return location;
}
/**
*
* The bandwidth of the connection.
*
*
* @return The bandwidth of the connection.
*/
public String bandwidth() {
return bandwidth;
}
/**
*
* The ID of the VLAN.
*
*
* @return The ID of the VLAN.
*/
public Integer vlan() {
return vlan;
}
/**
*
* The name of the AWS Direct Connect service provider associated with the connection.
*
*
* @return The name of the AWS Direct Connect service provider associated with the connection.
*/
public String partnerName() {
return partnerName;
}
/**
*
* The time of the most recent call to DescribeLoa for this connection.
*
*
* @return The time of the most recent call to DescribeLoa for this connection.
*/
public Instant loaIssueTime() {
return loaIssueTime;
}
/**
*
* The ID of the LAG.
*
*
* @return The ID of the LAG.
*/
public String lagId() {
return lagId;
}
/**
*
* The Direct Connect endpoint on which the physical connection terminates.
*
*
* @return The Direct Connect endpoint on which the physical connection terminates.
*/
public String awsDevice() {
return awsDevice;
}
/**
*
* Indicates whether jumbo frames (9001 MTU) are supported.
*
*
* @return Indicates whether jumbo frames (9001 MTU) are supported.
*/
public Boolean jumboFrameCapable() {
return jumboFrameCapable;
}
/**
*
* The Direct Connect endpoint on which the physical connection terminates.
*
*
* @return The Direct Connect endpoint on which the physical connection terminates.
*/
public String awsDeviceV2() {
return awsDeviceV2;
}
/**
*
* Indicates whether the connection supports a secondary BGP peer in the same address family (IPv4/IPv6).
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #hasLogicalRedundancy} will return {@link HasLogicalRedundancy#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #hasLogicalRedundancyAsString}.
*
*
* @return Indicates whether the connection supports a secondary BGP peer in the same address family (IPv4/IPv6).
* @see HasLogicalRedundancy
*/
public HasLogicalRedundancy hasLogicalRedundancy() {
return HasLogicalRedundancy.fromValue(hasLogicalRedundancy);
}
/**
*
* Indicates whether the connection supports a secondary BGP peer in the same address family (IPv4/IPv6).
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #hasLogicalRedundancy} will return {@link HasLogicalRedundancy#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #hasLogicalRedundancyAsString}.
*
*
* @return Indicates whether the connection supports a secondary BGP peer in the same address family (IPv4/IPv6).
* @see HasLogicalRedundancy
*/
public String hasLogicalRedundancyAsString() {
return hasLogicalRedundancy;
}
/**
* 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);
}
/**
*
* The tags associated with the connection.
*
*
* 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 The tags associated with the connection.
*/
public List tags() {
return tags;
}
/**
*
* The name of the service provider associated with the connection.
*
*
* @return The name of the service provider associated with the connection.
*/
public String providerName() {
return providerName;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(ownerAccount());
hashCode = 31 * hashCode + Objects.hashCode(connectionId());
hashCode = 31 * hashCode + Objects.hashCode(connectionName());
hashCode = 31 * hashCode + Objects.hashCode(connectionStateAsString());
hashCode = 31 * hashCode + Objects.hashCode(region());
hashCode = 31 * hashCode + Objects.hashCode(location());
hashCode = 31 * hashCode + Objects.hashCode(bandwidth());
hashCode = 31 * hashCode + Objects.hashCode(vlan());
hashCode = 31 * hashCode + Objects.hashCode(partnerName());
hashCode = 31 * hashCode + Objects.hashCode(loaIssueTime());
hashCode = 31 * hashCode + Objects.hashCode(lagId());
hashCode = 31 * hashCode + Objects.hashCode(awsDevice());
hashCode = 31 * hashCode + Objects.hashCode(jumboFrameCapable());
hashCode = 31 * hashCode + Objects.hashCode(awsDeviceV2());
hashCode = 31 * hashCode + Objects.hashCode(hasLogicalRedundancyAsString());
hashCode = 31 * hashCode + Objects.hashCode(tags());
hashCode = 31 * hashCode + Objects.hashCode(providerName());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateConnectionResponse)) {
return false;
}
CreateConnectionResponse other = (CreateConnectionResponse) obj;
return Objects.equals(ownerAccount(), other.ownerAccount()) && Objects.equals(connectionId(), other.connectionId())
&& Objects.equals(connectionName(), other.connectionName())
&& Objects.equals(connectionStateAsString(), other.connectionStateAsString())
&& Objects.equals(region(), other.region()) && Objects.equals(location(), other.location())
&& Objects.equals(bandwidth(), other.bandwidth()) && Objects.equals(vlan(), other.vlan())
&& Objects.equals(partnerName(), other.partnerName()) && Objects.equals(loaIssueTime(), other.loaIssueTime())
&& Objects.equals(lagId(), other.lagId()) && Objects.equals(awsDevice(), other.awsDevice())
&& Objects.equals(jumboFrameCapable(), other.jumboFrameCapable())
&& Objects.equals(awsDeviceV2(), other.awsDeviceV2())
&& Objects.equals(hasLogicalRedundancyAsString(), other.hasLogicalRedundancyAsString())
&& Objects.equals(tags(), other.tags()) && Objects.equals(providerName(), other.providerName());
}
/**
* 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("CreateConnectionResponse").add("OwnerAccount", ownerAccount())
.add("ConnectionId", connectionId()).add("ConnectionName", connectionName())
.add("ConnectionState", connectionStateAsString()).add("Region", region()).add("Location", location())
.add("Bandwidth", bandwidth()).add("Vlan", vlan()).add("PartnerName", partnerName())
.add("LoaIssueTime", loaIssueTime()).add("LagId", lagId()).add("AwsDevice", awsDevice())
.add("JumboFrameCapable", jumboFrameCapable()).add("AwsDeviceV2", awsDeviceV2())
.add("HasLogicalRedundancy", hasLogicalRedundancyAsString()).add("Tags", tags())
.add("ProviderName", providerName()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ownerAccount":
return Optional.ofNullable(clazz.cast(ownerAccount()));
case "connectionId":
return Optional.ofNullable(clazz.cast(connectionId()));
case "connectionName":
return Optional.ofNullable(clazz.cast(connectionName()));
case "connectionState":
return Optional.ofNullable(clazz.cast(connectionStateAsString()));
case "region":
return Optional.ofNullable(clazz.cast(region()));
case "location":
return Optional.ofNullable(clazz.cast(location()));
case "bandwidth":
return Optional.ofNullable(clazz.cast(bandwidth()));
case "vlan":
return Optional.ofNullable(clazz.cast(vlan()));
case "partnerName":
return Optional.ofNullable(clazz.cast(partnerName()));
case "loaIssueTime":
return Optional.ofNullable(clazz.cast(loaIssueTime()));
case "lagId":
return Optional.ofNullable(clazz.cast(lagId()));
case "awsDevice":
return Optional.ofNullable(clazz.cast(awsDevice()));
case "jumboFrameCapable":
return Optional.ofNullable(clazz.cast(jumboFrameCapable()));
case "awsDeviceV2":
return Optional.ofNullable(clazz.cast(awsDeviceV2()));
case "hasLogicalRedundancy":
return Optional.ofNullable(clazz.cast(hasLogicalRedundancyAsString()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
case "providerName":
return Optional.ofNullable(clazz.cast(providerName()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function