software.amazon.awssdk.services.networkmanager.model.Link Maven / Gradle / Ivy
Show all versions of networkmanager 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.networkmanager.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 link.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Link implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField LINK_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Link::linkId)).setter(setter(Builder::linkId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LinkId").build()).build();
private static final SdkField LINK_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Link::linkArn)).setter(setter(Builder::linkArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LinkArn").build()).build();
private static final SdkField GLOBAL_NETWORK_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Link::globalNetworkId)).setter(setter(Builder::globalNetworkId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalNetworkId").build()).build();
private static final SdkField SITE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Link::siteId)).setter(setter(Builder::siteId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SiteId").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Link::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Link::type)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField BANDWIDTH_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(Link::bandwidth)).setter(setter(Builder::bandwidth)).constructor(Bandwidth::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Bandwidth").build()).build();
private static final SdkField PROVIDER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Link::provider)).setter(setter(Builder::provider))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Provider").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(Link::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedAt").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Link::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(Link::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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LINK_ID_FIELD, LINK_ARN_FIELD,
GLOBAL_NETWORK_ID_FIELD, SITE_ID_FIELD, DESCRIPTION_FIELD, TYPE_FIELD, BANDWIDTH_FIELD, PROVIDER_FIELD,
CREATED_AT_FIELD, STATE_FIELD, TAGS_FIELD));
private static final long serialVersionUID = 1L;
private final String linkId;
private final String linkArn;
private final String globalNetworkId;
private final String siteId;
private final String description;
private final String type;
private final Bandwidth bandwidth;
private final String provider;
private final Instant createdAt;
private final String state;
private final List tags;
private Link(BuilderImpl builder) {
this.linkId = builder.linkId;
this.linkArn = builder.linkArn;
this.globalNetworkId = builder.globalNetworkId;
this.siteId = builder.siteId;
this.description = builder.description;
this.type = builder.type;
this.bandwidth = builder.bandwidth;
this.provider = builder.provider;
this.createdAt = builder.createdAt;
this.state = builder.state;
this.tags = builder.tags;
}
/**
*
* The ID of the link.
*
*
* @return The ID of the link.
*/
public String linkId() {
return linkId;
}
/**
*
* The Amazon Resource Name (ARN) of the link.
*
*
* @return The Amazon Resource Name (ARN) of the link.
*/
public String linkArn() {
return linkArn;
}
/**
*
* The ID of the global network.
*
*
* @return The ID of the global network.
*/
public String globalNetworkId() {
return globalNetworkId;
}
/**
*
* The ID of the site.
*
*
* @return The ID of the site.
*/
public String siteId() {
return siteId;
}
/**
*
* The description of the link.
*
*
* @return The description of the link.
*/
public String description() {
return description;
}
/**
*
* The type of the link.
*
*
* @return The type of the link.
*/
public String type() {
return type;
}
/**
*
* The bandwidth for the link.
*
*
* @return The bandwidth for the link.
*/
public Bandwidth bandwidth() {
return bandwidth;
}
/**
*
* The provider of the link.
*
*
* @return The provider of the link.
*/
public String provider() {
return provider;
}
/**
*
* The date and time that the link was created.
*
*
* @return The date and time that the link was created.
*/
public Instant createdAt() {
return createdAt;
}
/**
*
* The state of the link.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link LinkState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the link.
* @see LinkState
*/
public LinkState state() {
return LinkState.fromValue(state);
}
/**
*
* The state of the link.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link LinkState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the link.
* @see LinkState
*/
public String stateAsString() {
return state;
}
/**
* 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 for the link.
*
*
* 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 for the link.
*/
public List tags() {
return tags;
}
@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 + Objects.hashCode(linkId());
hashCode = 31 * hashCode + Objects.hashCode(linkArn());
hashCode = 31 * hashCode + Objects.hashCode(globalNetworkId());
hashCode = 31 * hashCode + Objects.hashCode(siteId());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(type());
hashCode = 31 * hashCode + Objects.hashCode(bandwidth());
hashCode = 31 * hashCode + Objects.hashCode(provider());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(tags());
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 Link)) {
return false;
}
Link other = (Link) obj;
return Objects.equals(linkId(), other.linkId()) && Objects.equals(linkArn(), other.linkArn())
&& Objects.equals(globalNetworkId(), other.globalNetworkId()) && Objects.equals(siteId(), other.siteId())
&& Objects.equals(description(), other.description()) && Objects.equals(type(), other.type())
&& Objects.equals(bandwidth(), other.bandwidth()) && Objects.equals(provider(), other.provider())
&& Objects.equals(createdAt(), other.createdAt()) && Objects.equals(stateAsString(), other.stateAsString())
&& Objects.equals(tags(), other.tags());
}
/**
* 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("Link").add("LinkId", linkId()).add("LinkArn", linkArn())
.add("GlobalNetworkId", globalNetworkId()).add("SiteId", siteId()).add("Description", description())
.add("Type", type()).add("Bandwidth", bandwidth()).add("Provider", provider()).add("CreatedAt", createdAt())
.add("State", stateAsString()).add("Tags", tags()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LinkId":
return Optional.ofNullable(clazz.cast(linkId()));
case "LinkArn":
return Optional.ofNullable(clazz.cast(linkArn()));
case "GlobalNetworkId":
return Optional.ofNullable(clazz.cast(globalNetworkId()));
case "SiteId":
return Optional.ofNullable(clazz.cast(siteId()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Type":
return Optional.ofNullable(clazz.cast(type()));
case "Bandwidth":
return Optional.ofNullable(clazz.cast(bandwidth()));
case "Provider":
return Optional.ofNullable(clazz.cast(provider()));
case "CreatedAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function