software.amazon.awssdk.services.networkmanager.model.Site 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.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 site.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Site implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField SITE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Site::siteId)).setter(setter(Builder::siteId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SiteId").build()).build();
private static final SdkField SITE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Site::siteArn)).setter(setter(Builder::siteArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SiteArn").build()).build();
private static final SdkField GLOBAL_NETWORK_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Site::globalNetworkId)).setter(setter(Builder::globalNetworkId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalNetworkId").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Site::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField LOCATION_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(Site::location)).setter(setter(Builder::location)).constructor(Location::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Location").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(Site::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(Site::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(Site::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(SITE_ID_FIELD, SITE_ARN_FIELD,
GLOBAL_NETWORK_ID_FIELD, DESCRIPTION_FIELD, LOCATION_FIELD, CREATED_AT_FIELD, STATE_FIELD, TAGS_FIELD));
private static final long serialVersionUID = 1L;
private final String siteId;
private final String siteArn;
private final String globalNetworkId;
private final String description;
private final Location location;
private final Instant createdAt;
private final String state;
private final List tags;
private Site(BuilderImpl builder) {
this.siteId = builder.siteId;
this.siteArn = builder.siteArn;
this.globalNetworkId = builder.globalNetworkId;
this.description = builder.description;
this.location = builder.location;
this.createdAt = builder.createdAt;
this.state = builder.state;
this.tags = builder.tags;
}
/**
*
* The ID of the site.
*
*
* @return The ID of the site.
*/
public String siteId() {
return siteId;
}
/**
*
* The Amazon Resource Name (ARN) of the site.
*
*
* @return The Amazon Resource Name (ARN) of the site.
*/
public String siteArn() {
return siteArn;
}
/**
*
* The ID of the global network.
*
*
* @return The ID of the global network.
*/
public String globalNetworkId() {
return globalNetworkId;
}
/**
*
* The description of the site.
*
*
* @return The description of the site.
*/
public String description() {
return description;
}
/**
*
* The location of the site.
*
*
* @return The location of the site.
*/
public Location location() {
return location;
}
/**
*
* The date and time that the site was created.
*
*
* @return The date and time that the site was created.
*/
public Instant createdAt() {
return createdAt;
}
/**
*
* The state of the site.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link SiteState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the site.
* @see SiteState
*/
public SiteState state() {
return SiteState.fromValue(state);
}
/**
*
* The state of the site.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link SiteState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the site.
* @see SiteState
*/
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 site.
*
*
* 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 site.
*/
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(siteId());
hashCode = 31 * hashCode + Objects.hashCode(siteArn());
hashCode = 31 * hashCode + Objects.hashCode(globalNetworkId());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(location());
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 Site)) {
return false;
}
Site other = (Site) obj;
return Objects.equals(siteId(), other.siteId()) && Objects.equals(siteArn(), other.siteArn())
&& Objects.equals(globalNetworkId(), other.globalNetworkId())
&& Objects.equals(description(), other.description()) && Objects.equals(location(), other.location())
&& 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("Site").add("SiteId", siteId()).add("SiteArn", siteArn())
.add("GlobalNetworkId", globalNetworkId()).add("Description", description()).add("Location", location())
.add("CreatedAt", createdAt()).add("State", stateAsString()).add("Tags", tags()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SiteId":
return Optional.ofNullable(clazz.cast(siteId()));
case "SiteArn":
return Optional.ofNullable(clazz.cast(siteArn()));
case "GlobalNetworkId":
return Optional.ofNullable(clazz.cast(globalNetworkId()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Location":
return Optional.ofNullable(clazz.cast(location()));
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