software.amazon.awssdk.services.s3outposts.model.Endpoint Maven / Gradle / Ivy
Show all versions of s3outposts 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.s3outposts.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;
/**
*
* S3 on Outposts access points simplify managing data access at scale for shared datasets in Amazon S3 on Outposts. S3
* on Outposts uses endpoints to connect to Outposts buckets so that you can perform actions within your virtual private
* cloud (VPC).
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Endpoint implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ENDPOINT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointArn").getter(getter(Endpoint::endpointArn)).setter(setter(Builder::endpointArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointArn").build()).build();
private static final SdkField OUTPOSTS_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OutpostsId").getter(getter(Endpoint::outpostsId)).setter(setter(Builder::outpostsId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutpostsId").build()).build();
private static final SdkField CIDR_BLOCK_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CidrBlock").getter(getter(Endpoint::cidrBlock)).setter(setter(Builder::cidrBlock))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CidrBlock").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(Endpoint::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(Endpoint::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField> NETWORK_INTERFACES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("NetworkInterfaces")
.getter(getter(Endpoint::networkInterfaces))
.setter(setter(Builder::networkInterfaces))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkInterfaces").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(NetworkInterface::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ENDPOINT_ARN_FIELD,
OUTPOSTS_ID_FIELD, CIDR_BLOCK_FIELD, STATUS_FIELD, CREATION_TIME_FIELD, NETWORK_INTERFACES_FIELD));
private static final long serialVersionUID = 1L;
private final String endpointArn;
private final String outpostsId;
private final String cidrBlock;
private final String status;
private final Instant creationTime;
private final List networkInterfaces;
private Endpoint(BuilderImpl builder) {
this.endpointArn = builder.endpointArn;
this.outpostsId = builder.outpostsId;
this.cidrBlock = builder.cidrBlock;
this.status = builder.status;
this.creationTime = builder.creationTime;
this.networkInterfaces = builder.networkInterfaces;
}
/**
*
* The Amazon Resource Name (ARN) of the endpoint.
*
*
* @return The Amazon Resource Name (ARN) of the endpoint.
*/
public final String endpointArn() {
return endpointArn;
}
/**
*
* The ID of the AWS Outpost.
*
*
* @return The ID of the AWS Outpost.
*/
public final String outpostsId() {
return outpostsId;
}
/**
*
* The VPC CIDR committed by this endpoint.
*
*
* @return The VPC CIDR committed by this endpoint.
*/
public final String cidrBlock() {
return cidrBlock;
}
/**
*
* The status of the endpoint.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link EndpointStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the endpoint.
* @see EndpointStatus
*/
public final EndpointStatus status() {
return EndpointStatus.fromValue(status);
}
/**
*
* The status of the endpoint.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link EndpointStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the endpoint.
* @see EndpointStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The time the endpoint was created.
*
*
* @return The time the endpoint was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
* Returns true if the NetworkInterfaces 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 final boolean hasNetworkInterfaces() {
return networkInterfaces != null && !(networkInterfaces instanceof SdkAutoConstructList);
}
/**
*
* The network interface of the endpoint.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasNetworkInterfaces()} to see if a value was sent in this field.
*
*
* @return The network interface of the endpoint.
*/
public final List networkInterfaces() {
return networkInterfaces;
}
@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(endpointArn());
hashCode = 31 * hashCode + Objects.hashCode(outpostsId());
hashCode = 31 * hashCode + Objects.hashCode(cidrBlock());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(hasNetworkInterfaces() ? networkInterfaces() : 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 Endpoint)) {
return false;
}
Endpoint other = (Endpoint) obj;
return Objects.equals(endpointArn(), other.endpointArn()) && Objects.equals(outpostsId(), other.outpostsId())
&& Objects.equals(cidrBlock(), other.cidrBlock()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(creationTime(), other.creationTime()) && hasNetworkInterfaces() == other.hasNetworkInterfaces()
&& Objects.equals(networkInterfaces(), other.networkInterfaces());
}
/**
* 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("Endpoint").add("EndpointArn", endpointArn()).add("OutpostsId", outpostsId())
.add("CidrBlock", cidrBlock()).add("Status", statusAsString()).add("CreationTime", creationTime())
.add("NetworkInterfaces", hasNetworkInterfaces() ? networkInterfaces() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "EndpointArn":
return Optional.ofNullable(clazz.cast(endpointArn()));
case "OutpostsId":
return Optional.ofNullable(clazz.cast(outpostsId()));
case "CidrBlock":
return Optional.ofNullable(clazz.cast(cidrBlock()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "NetworkInterfaces":
return Optional.ofNullable(clazz.cast(networkInterfaces()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function