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.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*
* Amazon S3 on Outposts Access Points simplify managing data access at scale for shared datasets in 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). For more information, see Accessing S3 on Outposts
* using VPC-only access points in the Amazon Simple Storage Service User Guide.
*
*/
@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 SdkField VPC_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("VpcId")
.getter(getter(Endpoint::vpcId)).setter(setter(Builder::vpcId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcId").build()).build();
private static final SdkField SUBNET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SubnetId").getter(getter(Endpoint::subnetId)).setter(setter(Builder::subnetId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubnetId").build()).build();
private static final SdkField SECURITY_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SecurityGroupId").getter(getter(Endpoint::securityGroupId)).setter(setter(Builder::securityGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecurityGroupId").build()).build();
private static final SdkField ACCESS_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AccessType").getter(getter(Endpoint::accessTypeAsString)).setter(setter(Builder::accessType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AccessType").build()).build();
private static final SdkField CUSTOMER_OWNED_IPV4_POOL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CustomerOwnedIpv4Pool").getter(getter(Endpoint::customerOwnedIpv4Pool))
.setter(setter(Builder::customerOwnedIpv4Pool))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CustomerOwnedIpv4Pool").build())
.build();
private static final SdkField FAILED_REASON_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("FailedReason").getter(getter(Endpoint::failedReason)).setter(setter(Builder::failedReason))
.constructor(FailedReason::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailedReason").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, VPC_ID_FIELD,
SUBNET_ID_FIELD, SECURITY_GROUP_ID_FIELD, ACCESS_TYPE_FIELD, CUSTOMER_OWNED_IPV4_POOL_FIELD, FAILED_REASON_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("EndpointArn", ENDPOINT_ARN_FIELD);
put("OutpostsId", OUTPOSTS_ID_FIELD);
put("CidrBlock", CIDR_BLOCK_FIELD);
put("Status", STATUS_FIELD);
put("CreationTime", CREATION_TIME_FIELD);
put("NetworkInterfaces", NETWORK_INTERFACES_FIELD);
put("VpcId", VPC_ID_FIELD);
put("SubnetId", SUBNET_ID_FIELD);
put("SecurityGroupId", SECURITY_GROUP_ID_FIELD);
put("AccessType", ACCESS_TYPE_FIELD);
put("CustomerOwnedIpv4Pool", CUSTOMER_OWNED_IPV4_POOL_FIELD);
put("FailedReason", FAILED_REASON_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 final String vpcId;
private final String subnetId;
private final String securityGroupId;
private final String accessType;
private final String customerOwnedIpv4Pool;
private final FailedReason failedReason;
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;
this.vpcId = builder.vpcId;
this.subnetId = builder.subnetId;
this.securityGroupId = builder.securityGroupId;
this.accessType = builder.accessType;
this.customerOwnedIpv4Pool = builder.customerOwnedIpv4Pool;
this.failedReason = builder.failedReason;
}
/**
*
* 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 Outposts.
*
*
* @return The ID of the Outposts.
*/
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;
}
/**
* For responses, this returns true if the service returned a value for the NetworkInterfaces 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 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.
*
*
* 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 #hasNetworkInterfaces} method.
*
*
* @return The network interface of the endpoint.
*/
public final List networkInterfaces() {
return networkInterfaces;
}
/**
*
* The ID of the VPC used for the endpoint.
*
*
* @return The ID of the VPC used for the endpoint.
*/
public final String vpcId() {
return vpcId;
}
/**
*
* The ID of the subnet used for the endpoint.
*
*
* @return The ID of the subnet used for the endpoint.
*/
public final String subnetId() {
return subnetId;
}
/**
*
* The ID of the security group used for the endpoint.
*
*
* @return The ID of the security group used for the endpoint.
*/
public final String securityGroupId() {
return securityGroupId;
}
/**
*
* The type of connectivity used to access the Amazon S3 on Outposts endpoint.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #accessType} will
* return {@link EndpointAccessType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #accessTypeAsString}.
*
*
* @return The type of connectivity used to access the Amazon S3 on Outposts endpoint.
* @see EndpointAccessType
*/
public final EndpointAccessType accessType() {
return EndpointAccessType.fromValue(accessType);
}
/**
*
* The type of connectivity used to access the Amazon S3 on Outposts endpoint.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #accessType} will
* return {@link EndpointAccessType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #accessTypeAsString}.
*
*
* @return The type of connectivity used to access the Amazon S3 on Outposts endpoint.
* @see EndpointAccessType
*/
public final String accessTypeAsString() {
return accessType;
}
/**
*
* The ID of the customer-owned IPv4 address pool used for the endpoint.
*
*
* @return The ID of the customer-owned IPv4 address pool used for the endpoint.
*/
public final String customerOwnedIpv4Pool() {
return customerOwnedIpv4Pool;
}
/**
*
* The failure reason, if any, for a create or delete endpoint operation.
*
*
* @return The failure reason, if any, for a create or delete endpoint operation.
*/
public final FailedReason failedReason() {
return failedReason;
}
@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);
hashCode = 31 * hashCode + Objects.hashCode(vpcId());
hashCode = 31 * hashCode + Objects.hashCode(subnetId());
hashCode = 31 * hashCode + Objects.hashCode(securityGroupId());
hashCode = 31 * hashCode + Objects.hashCode(accessTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(customerOwnedIpv4Pool());
hashCode = 31 * hashCode + Objects.hashCode(failedReason());
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()) && Objects.equals(vpcId(), other.vpcId())
&& Objects.equals(subnetId(), other.subnetId()) && Objects.equals(securityGroupId(), other.securityGroupId())
&& Objects.equals(accessTypeAsString(), other.accessTypeAsString())
&& Objects.equals(customerOwnedIpv4Pool(), other.customerOwnedIpv4Pool())
&& Objects.equals(failedReason(), other.failedReason());
}
/**
* 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).add("VpcId", vpcId())
.add("SubnetId", subnetId()).add("SecurityGroupId", securityGroupId()).add("AccessType", accessTypeAsString())
.add("CustomerOwnedIpv4Pool", customerOwnedIpv4Pool()).add("FailedReason", failedReason()).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()));
case "VpcId":
return Optional.ofNullable(clazz.cast(vpcId()));
case "SubnetId":
return Optional.ofNullable(clazz.cast(subnetId()));
case "SecurityGroupId":
return Optional.ofNullable(clazz.cast(securityGroupId()));
case "AccessType":
return Optional.ofNullable(clazz.cast(accessTypeAsString()));
case "CustomerOwnedIpv4Pool":
return Optional.ofNullable(clazz.cast(customerOwnedIpv4Pool()));
case "FailedReason":
return Optional.ofNullable(clazz.cast(failedReason()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function