
software.amazon.awssdk.services.accessanalyzer.model.S3AccessPointConfiguration 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.accessanalyzer.model;
import java.io.Serializable;
import java.util.Arrays;
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 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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The configuration for an Amazon S3 access point or multi-region access point for the bucket. You can propose up to 10
* access points or multi-region access points per bucket. If the proposed Amazon S3 access point configuration is for
* an existing bucket, the access preview uses the proposed access point configuration in place of the existing access
* points. To propose an access point without a policy, you can provide an empty string as the access point policy. For
* more information, see Creating
* access points. For more information about access point policy limits, see Access points
* restrictions and limitations.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class S3AccessPointConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ACCESS_POINT_POLICY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("accessPointPolicy").getter(getter(S3AccessPointConfiguration::accessPointPolicy))
.setter(setter(Builder::accessPointPolicy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("accessPointPolicy").build()).build();
private static final SdkField PUBLIC_ACCESS_BLOCK_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("publicAccessBlock")
.getter(getter(S3AccessPointConfiguration::publicAccessBlock)).setter(setter(Builder::publicAccessBlock))
.constructor(S3PublicAccessBlockConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("publicAccessBlock").build()).build();
private static final SdkField NETWORK_ORIGIN_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("networkOrigin")
.getter(getter(S3AccessPointConfiguration::networkOrigin)).setter(setter(Builder::networkOrigin))
.constructor(NetworkOriginConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("networkOrigin").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACCESS_POINT_POLICY_FIELD,
PUBLIC_ACCESS_BLOCK_FIELD, NETWORK_ORIGIN_FIELD));
private static final long serialVersionUID = 1L;
private final String accessPointPolicy;
private final S3PublicAccessBlockConfiguration publicAccessBlock;
private final NetworkOriginConfiguration networkOrigin;
private S3AccessPointConfiguration(BuilderImpl builder) {
this.accessPointPolicy = builder.accessPointPolicy;
this.publicAccessBlock = builder.publicAccessBlock;
this.networkOrigin = builder.networkOrigin;
}
/**
*
* The access point or multi-region access point policy.
*
*
* @return The access point or multi-region access point policy.
*/
public final String accessPointPolicy() {
return accessPointPolicy;
}
/**
*
* The proposed S3PublicAccessBlock
configuration to apply to this Amazon S3 access point or
* multi-region access point.
*
*
* @return The proposed S3PublicAccessBlock
configuration to apply to this Amazon S3 access point or
* multi-region access point.
*/
public final S3PublicAccessBlockConfiguration publicAccessBlock() {
return publicAccessBlock;
}
/**
*
* The proposed Internet
and VpcConfiguration
to apply to this Amazon S3 access point.
* VpcConfiguration
does not apply to multi-region access points. If the access preview is for a new
* resource and neither is specified, the access preview uses Internet
for the network origin. If the
* access preview is for an existing resource and neither is specified, the access preview uses the exiting network
* origin.
*
*
* @return The proposed Internet
and VpcConfiguration
to apply to this Amazon S3 access
* point. VpcConfiguration
does not apply to multi-region access points. If the access preview
* is for a new resource and neither is specified, the access preview uses Internet
for the
* network origin. If the access preview is for an existing resource and neither is specified, the access
* preview uses the exiting network origin.
*/
public final NetworkOriginConfiguration networkOrigin() {
return networkOrigin;
}
@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(accessPointPolicy());
hashCode = 31 * hashCode + Objects.hashCode(publicAccessBlock());
hashCode = 31 * hashCode + Objects.hashCode(networkOrigin());
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 S3AccessPointConfiguration)) {
return false;
}
S3AccessPointConfiguration other = (S3AccessPointConfiguration) obj;
return Objects.equals(accessPointPolicy(), other.accessPointPolicy())
&& Objects.equals(publicAccessBlock(), other.publicAccessBlock())
&& Objects.equals(networkOrigin(), other.networkOrigin());
}
/**
* 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("S3AccessPointConfiguration").add("AccessPointPolicy", accessPointPolicy())
.add("PublicAccessBlock", publicAccessBlock()).add("NetworkOrigin", networkOrigin()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "accessPointPolicy":
return Optional.ofNullable(clazz.cast(accessPointPolicy()));
case "publicAccessBlock":
return Optional.ofNullable(clazz.cast(publicAccessBlock()));
case "networkOrigin":
return Optional.ofNullable(clazz.cast(networkOrigin()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function