All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 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 getter(Function g) { return obj -> g.apply((CreateAccessPointRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends S3ControlRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The Amazon Web Services account ID for the account that owns the specified access point. *

* * @param accountId * The Amazon Web Services account ID for the account that owns the specified access point. * @return Returns a reference to this object so that method calls can be chained together. */ Builder accountId(String accountId); /** *

* The name you want to assign to this access point. *

* * @param name * The name you want to assign to this access point. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String 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. *

* * @param bucket * 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 Returns a reference to this object so that method calls can be chained together. */ Builder bucket(String 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. *

*
* * @param vpcConfiguration * 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 Returns a reference to this object so that method calls can be chained together. */ Builder vpcConfiguration(VpcConfiguration vpcConfiguration); /** *

* 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. *

*
This is a convenience method that creates an instance of the {@link VpcConfiguration.Builder} * avoiding the need to create one manually via {@link VpcConfiguration#builder()}. * *

* When the {@link Consumer} completes, {@link VpcConfiguration.Builder#build()} is called immediately and its * result is passed to {@link #vpcConfiguration(VpcConfiguration)}. * * @param vpcConfiguration * a consumer that will call methods on {@link VpcConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #vpcConfiguration(VpcConfiguration) */ default Builder vpcConfiguration(Consumer vpcConfiguration) { return vpcConfiguration(VpcConfiguration.builder().applyMutation(vpcConfiguration).build()); } /** *

* The PublicAccessBlock configuration that you want to apply to the access point. *

* * @param publicAccessBlockConfiguration * The PublicAccessBlock configuration that you want to apply to the access point. * @return Returns a reference to this object so that method calls can be chained together. */ Builder publicAccessBlockConfiguration(PublicAccessBlockConfiguration publicAccessBlockConfiguration); /** *

* The PublicAccessBlock configuration that you want to apply to the access point. *

* This is a convenience method that creates an instance of the {@link PublicAccessBlockConfiguration.Builder} * avoiding the need to create one manually via {@link PublicAccessBlockConfiguration#builder()}. * *

* When the {@link Consumer} completes, {@link PublicAccessBlockConfiguration.Builder#build()} is called * immediately and its result is passed to * {@link #publicAccessBlockConfiguration(PublicAccessBlockConfiguration)}. * * @param publicAccessBlockConfiguration * a consumer that will call methods on {@link PublicAccessBlockConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #publicAccessBlockConfiguration(PublicAccessBlockConfiguration) */ default Builder publicAccessBlockConfiguration( Consumer publicAccessBlockConfiguration) { return publicAccessBlockConfiguration(PublicAccessBlockConfiguration.builder() .applyMutation(publicAccessBlockConfiguration).build()); } /** *

* The Amazon Web Services account ID associated with the S3 bucket associated with this access point. *

* * @param bucketAccountId * The Amazon Web Services account ID associated with the S3 bucket associated with this access point. * @return Returns a reference to this object so that method calls can be chained together. */ Builder bucketAccountId(String bucketAccountId); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends S3ControlRequest.BuilderImpl implements Builder { private String accountId; private String name; private String bucket; private VpcConfiguration vpcConfiguration; private PublicAccessBlockConfiguration publicAccessBlockConfiguration; private String bucketAccountId; private BuilderImpl() { } private BuilderImpl(CreateAccessPointRequest model) { super(model); accountId(model.accountId); name(model.name); bucket(model.bucket); vpcConfiguration(model.vpcConfiguration); publicAccessBlockConfiguration(model.publicAccessBlockConfiguration); bucketAccountId(model.bucketAccountId); } public final String getAccountId() { return accountId; } public final void setAccountId(String accountId) { this.accountId = accountId; } @Override public final Builder accountId(String accountId) { this.accountId = accountId; return this; } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getBucket() { return bucket; } public final void setBucket(String bucket) { this.bucket = bucket; } @Override public final Builder bucket(String bucket) { this.bucket = bucket; return this; } public final VpcConfiguration.Builder getVpcConfiguration() { return vpcConfiguration != null ? vpcConfiguration.toBuilder() : null; } public final void setVpcConfiguration(VpcConfiguration.BuilderImpl vpcConfiguration) { this.vpcConfiguration = vpcConfiguration != null ? vpcConfiguration.build() : null; } @Override public final Builder vpcConfiguration(VpcConfiguration vpcConfiguration) { this.vpcConfiguration = vpcConfiguration; return this; } public final PublicAccessBlockConfiguration.Builder getPublicAccessBlockConfiguration() { return publicAccessBlockConfiguration != null ? publicAccessBlockConfiguration.toBuilder() : null; } public final void setPublicAccessBlockConfiguration( PublicAccessBlockConfiguration.BuilderImpl publicAccessBlockConfiguration) { this.publicAccessBlockConfiguration = publicAccessBlockConfiguration != null ? publicAccessBlockConfiguration.build() : null; } @Override public final Builder publicAccessBlockConfiguration(PublicAccessBlockConfiguration publicAccessBlockConfiguration) { this.publicAccessBlockConfiguration = publicAccessBlockConfiguration; return this; } public final String getBucketAccountId() { return bucketAccountId; } public final void setBucketAccountId(String bucketAccountId) { this.bucketAccountId = bucketAccountId; } @Override public final Builder bucketAccountId(String bucketAccountId) { this.bucketAccountId = bucketAccountId; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CreateAccessPointRequest build() { return new CreateAccessPointRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy