software.amazon.awssdk.services.s3control.model.CreateAccessPointRequest 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.s3control.model;
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.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateAccessPointRequest extends S3ControlRequest implements
ToCopyableBuilder {
private static final SdkField ACCOUNT_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("AccountId")
.getter(getter(CreateAccessPointRequest::accountId))
.setter(setter(Builder::accountId))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-account-id")
.unmarshallLocationName("x-amz-account-id").build()).build();
private static final SdkField NAME_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Name")
.getter(getter(CreateAccessPointRequest::name))
.setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("name").unmarshallLocationName("name")
.build()).build();
private static final SdkField BUCKET_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Bucket")
.getter(getter(CreateAccessPointRequest::bucket))
.setter(setter(Builder::bucket))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Bucket")
.unmarshallLocationName("Bucket").build()).build();
private static final SdkField VPC_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("VpcConfiguration")
.getter(getter(CreateAccessPointRequest::vpcConfiguration))
.setter(setter(Builder::vpcConfiguration))
.constructor(VpcConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcConfiguration")
.unmarshallLocationName("VpcConfiguration").build()).build();
private static final SdkField PUBLIC_ACCESS_BLOCK_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("PublicAccessBlockConfiguration")
.getter(getter(CreateAccessPointRequest::publicAccessBlockConfiguration))
.setter(setter(Builder::publicAccessBlockConfiguration))
.constructor(PublicAccessBlockConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PublicAccessBlockConfiguration")
.unmarshallLocationName("PublicAccessBlockConfiguration").build()).build();
private static final SdkField BUCKET_ACCOUNT_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("BucketAccountId")
.getter(getter(CreateAccessPointRequest::bucketAccountId))
.setter(setter(Builder::bucketAccountId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BucketAccountId")
.unmarshallLocationName("BucketAccountId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACCOUNT_ID_FIELD, NAME_FIELD,
BUCKET_FIELD, VPC_CONFIGURATION_FIELD, PUBLIC_ACCESS_BLOCK_CONFIGURATION_FIELD, BUCKET_ACCOUNT_ID_FIELD));
private final String accountId;
private final String name;
private final String bucket;
private final VpcConfiguration vpcConfiguration;
private final PublicAccessBlockConfiguration publicAccessBlockConfiguration;
private final String bucketAccountId;
private CreateAccessPointRequest(BuilderImpl builder) {
super(builder);
this.accountId = builder.accountId;
this.name = builder.name;
this.bucket = builder.bucket;
this.vpcConfiguration = builder.vpcConfiguration;
this.publicAccessBlockConfiguration = builder.publicAccessBlockConfiguration;
this.bucketAccountId = builder.bucketAccountId;
}
/**
*
* The Amazon Web Services account ID for the account that owns the specified access point.
*
*
* @return The Amazon Web Services account ID for the account that owns the specified access point.
*/
public final String accountId() {
return accountId;
}
/**
*
* The name you want to assign to this access point.
*
*
* @return The name you want to assign to this access point.
*/
public final String name() {
return name;
}
/**
*
* The name of the bucket that you want to associate this access point with.
*
*
* For using this parameter with Amazon S3 on Outposts with the REST API, you must specify the name and the
* x-amz-outpost-id as well.
*
*
* For using this parameter with S3 on Outposts with the Amazon Web Services SDK and CLI, you must specify the ARN
* of the bucket accessed in the format
* arn:aws:s3-outposts:<Region>:<account-id>:outpost/<outpost-id>/bucket/<my-bucket-name>
* . For example, to access the bucket reports
through outpost my-outpost
owned by account
* 123456789012
in Region us-west-2
, use the URL encoding of
* arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports
. The value must be URL
* encoded.
*
*
* @return The name of the bucket that you want to associate this access point with.
*
* For using this parameter with Amazon S3 on Outposts with the REST API, you must specify the name and the
* x-amz-outpost-id as well.
*
*
* For using this parameter with S3 on Outposts with the Amazon Web Services SDK and CLI, you must specify
* the ARN of the bucket accessed in the format
* arn:aws:s3-outposts:<Region>:<account-id>:outpost/<outpost-id>/bucket/<my-bucket-name>
* . For example, to access the bucket reports
through outpost my-outpost
owned by
* account 123456789012
in Region us-west-2
, use the URL encoding of
* arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports
. The value must
* be URL encoded.
*/
public final String bucket() {
return bucket;
}
/**
*
* If you include this field, Amazon S3 restricts access to this access point to requests from the specified virtual
* private cloud (VPC).
*
*
*
* This is required for creating an access point for Amazon S3 on Outposts buckets.
*
*
*
* @return If you include this field, Amazon S3 restricts access to this access point to requests from the specified
* virtual private cloud (VPC).
*
* This is required for creating an access point for Amazon S3 on Outposts buckets.
*
*/
public final VpcConfiguration vpcConfiguration() {
return vpcConfiguration;
}
/**
*
* The PublicAccessBlock
configuration that you want to apply to the access point.
*
*
* @return The PublicAccessBlock
configuration that you want to apply to the access point.
*/
public final PublicAccessBlockConfiguration publicAccessBlockConfiguration() {
return publicAccessBlockConfiguration;
}
/**
*
* The Amazon Web Services account ID associated with the S3 bucket associated with this access point.
*
*
* @return The Amazon Web Services account ID associated with the S3 bucket associated with this access point.
*/
public final String bucketAccountId() {
return bucketAccountId;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(accountId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(bucket());
hashCode = 31 * hashCode + Objects.hashCode(vpcConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(publicAccessBlockConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(bucketAccountId());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateAccessPointRequest)) {
return false;
}
CreateAccessPointRequest other = (CreateAccessPointRequest) obj;
return Objects.equals(accountId(), other.accountId()) && Objects.equals(name(), other.name())
&& Objects.equals(bucket(), other.bucket()) && Objects.equals(vpcConfiguration(), other.vpcConfiguration())
&& Objects.equals(publicAccessBlockConfiguration(), other.publicAccessBlockConfiguration())
&& Objects.equals(bucketAccountId(), other.bucketAccountId());
}
/**
* 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("CreateAccessPointRequest").add("AccountId", accountId()).add("Name", name())
.add("Bucket", bucket()).add("VpcConfiguration", vpcConfiguration())
.add("PublicAccessBlockConfiguration", publicAccessBlockConfiguration())
.add("BucketAccountId", bucketAccountId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AccountId":
return Optional.ofNullable(clazz.cast(accountId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Bucket":
return Optional.ofNullable(clazz.cast(bucket()));
case "VpcConfiguration":
return Optional.ofNullable(clazz.cast(vpcConfiguration()));
case "PublicAccessBlockConfiguration":
return Optional.ofNullable(clazz.cast(publicAccessBlockConfiguration()));
case "BucketAccountId":
return Optional.ofNullable(clazz.cast(bucketAccountId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function