pub struct CreateBucketFluentBuilder { /* private fields */ }
Expand description

Fluent builder constructing a request to CreateBucket.

Creates a new S3 bucket. To create a bucket, you must register with Amazon S3 and have a valid Amazon Web Services Access Key ID to authenticate requests. Anonymous requests are never allowed to create buckets. By creating the bucket, you become the bucket owner.

Not every string is an acceptable bucket name. For information about bucket naming restrictions, see Bucket naming rules.

If you want to create an Amazon S3 on Outposts bucket, see Create Bucket.

By default, the bucket is created in the US East (N. Virginia) Region. You can optionally specify a Region in the request body. To constrain the bucket creation to a specific Region, you can use LocationConstraint condition key. You might choose a Region to optimize latency, minimize costs, or address regulatory requirements. For example, if you reside in Europe, you will probably find it advantageous to create buckets in the Europe (Ireland) Region. For more information, see Accessing a bucket.

If you send your create bucket request to the s3.amazonaws.com endpoint, the request goes to the us-east-1 Region. Accordingly, the signature calculations in Signature Version 4 must use us-east-1 as the Region, even if the location constraint in the request specifies another Region where the bucket is to be created. If you create a bucket in a Region other than US East (N. Virginia), your application must be able to handle 307 redirect. For more information, see Virtual hosting of buckets.

Permissions

In addition to s3:CreateBucket, the following permissions are required when your CreateBucket request includes specific headers:

  • Access control lists (ACLs) - If your CreateBucket request specifies access control list (ACL) permissions and the ACL is public-read, public-read-write, authenticated-read, or if you specify access permissions explicitly through any other ACL, both s3:CreateBucket and s3:PutBucketAcl permissions are needed. If the ACL for the CreateBucket request is private or if the request doesn't specify any ACLs, only s3:CreateBucket permission is needed.

  • Object Lock - If ObjectLockEnabledForBucket is set to true in your CreateBucket request, s3:PutBucketObjectLockConfiguration and s3:PutBucketVersioning permissions are required.

  • S3 Object Ownership - If your CreateBucket request includes the x-amz-object-ownership header, then the s3:PutBucketOwnershipControls permission is required. By default, ObjectOwnership is set to BucketOWnerEnforced and ACLs are disabled. We recommend keeping ACLs disabled, except in uncommon use cases where you must control access for each object individually. If you want to change the ObjectOwnership setting, you can use the x-amz-object-ownership header in your CreateBucket request to set the ObjectOwnership setting of your choice. For more information about S3 Object Ownership, see Controlling object ownership in the Amazon S3 User Guide.

  • S3 Block Public Access - If your specific use case requires granting public access to your S3 resources, you can disable Block Public Access. You can create a new bucket with Block Public Access enabled, then separately call the DeletePublicAccessBlock API. To use this operation, you must have the s3:PutBucketPublicAccessBlock permission. By default, all Block Public Access settings are enabled for new buckets. To avoid inadvertent exposure of your resources, we recommend keeping the S3 Block Public Access settings enabled. For more information about S3 Block Public Access, see Blocking public access to your Amazon S3 storage in the Amazon S3 User Guide.

If your CreateBucket request sets BucketOwnerEnforced for Amazon S3 Object Ownership and specifies a bucket ACL that provides access to an external Amazon Web Services account, your request fails with a 400 error and returns the InvalidBucketAcLWithObjectOwnership error code. For more information, see Setting Object Ownership on an existing bucket in the Amazon S3 User Guide.

The following operations are related to CreateBucket:

Implementations§

§

impl CreateBucketFluentBuilder

pub fn as_input(&self) -> &CreateBucketInputBuilder

Access the CreateBucket as a reference.

pub async fn send( self ) -> impl Future<Output = Result<CreateBucketOutput, SdkError<CreateBucketError, Response<SdkBody>>>>

Sends the request and returns the response.

If an error occurs, an SdkError will be returned with additional details that can be matched against.

By default, any retryable failures will be retried twice. Retry behavior is configurable with the RetryConfig, which can be set when configuring the client.

pub async fn customize( self ) -> impl Future<Output = Result<CustomizableOperation<CreateBucketOutput, CreateBucketError, CreateBucketFluentBuilder>, SdkError<CreateBucketError, Response>>>

Consumes this builder, creating a customizable operation that can be modified before being sent.

pub fn acl(self, input: BucketCannedAcl) -> CreateBucketFluentBuilder

The canned ACL to apply to the bucket.

pub fn set_acl( self, input: Option<BucketCannedAcl> ) -> CreateBucketFluentBuilder

The canned ACL to apply to the bucket.

pub fn get_acl(&self) -> &Option<BucketCannedAcl>

The canned ACL to apply to the bucket.

pub fn bucket(self, input: impl Into<String>) -> CreateBucketFluentBuilder

The name of the bucket to create.

pub fn set_bucket(self, input: Option<String>) -> CreateBucketFluentBuilder

The name of the bucket to create.

pub fn get_bucket(&self) -> &Option<String>

The name of the bucket to create.

pub fn create_bucket_configuration( self, input: CreateBucketConfiguration ) -> CreateBucketFluentBuilder

The configuration information for the bucket.

pub fn set_create_bucket_configuration( self, input: Option<CreateBucketConfiguration> ) -> CreateBucketFluentBuilder

The configuration information for the bucket.

pub fn get_create_bucket_configuration( &self ) -> &Option<CreateBucketConfiguration>

The configuration information for the bucket.

pub fn grant_full_control( self, input: impl Into<String> ) -> CreateBucketFluentBuilder

Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.

pub fn set_grant_full_control( self, input: Option<String> ) -> CreateBucketFluentBuilder

Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.

pub fn get_grant_full_control(&self) -> &Option<String>

Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.

pub fn grant_read(self, input: impl Into<String>) -> CreateBucketFluentBuilder

Allows grantee to list the objects in the bucket.

pub fn set_grant_read(self, input: Option<String>) -> CreateBucketFluentBuilder

Allows grantee to list the objects in the bucket.

pub fn get_grant_read(&self) -> &Option<String>

Allows grantee to list the objects in the bucket.

pub fn grant_read_acp( self, input: impl Into<String> ) -> CreateBucketFluentBuilder

Allows grantee to read the bucket ACL.

pub fn set_grant_read_acp( self, input: Option<String> ) -> CreateBucketFluentBuilder

Allows grantee to read the bucket ACL.

pub fn get_grant_read_acp(&self) -> &Option<String>

Allows grantee to read the bucket ACL.

pub fn grant_write(self, input: impl Into<String>) -> CreateBucketFluentBuilder

Allows grantee to create new objects in the bucket.

For the bucket and object owners of existing objects, also allows deletions and overwrites of those objects.

pub fn set_grant_write(self, input: Option<String>) -> CreateBucketFluentBuilder

Allows grantee to create new objects in the bucket.

For the bucket and object owners of existing objects, also allows deletions and overwrites of those objects.

pub fn get_grant_write(&self) -> &Option<String>

Allows grantee to create new objects in the bucket.

For the bucket and object owners of existing objects, also allows deletions and overwrites of those objects.

pub fn grant_write_acp( self, input: impl Into<String> ) -> CreateBucketFluentBuilder

Allows grantee to write the ACL for the applicable bucket.

pub fn set_grant_write_acp( self, input: Option<String> ) -> CreateBucketFluentBuilder

Allows grantee to write the ACL for the applicable bucket.

pub fn get_grant_write_acp(&self) -> &Option<String>

Allows grantee to write the ACL for the applicable bucket.

pub fn object_lock_enabled_for_bucket( self, input: bool ) -> CreateBucketFluentBuilder

Specifies whether you want S3 Object Lock to be enabled for the new bucket.

pub fn set_object_lock_enabled_for_bucket( self, input: Option<bool> ) -> CreateBucketFluentBuilder

Specifies whether you want S3 Object Lock to be enabled for the new bucket.

pub fn get_object_lock_enabled_for_bucket(&self) -> &Option<bool>

Specifies whether you want S3 Object Lock to be enabled for the new bucket.

pub fn object_ownership( self, input: ObjectOwnership ) -> CreateBucketFluentBuilder

The container element for object ownership for a bucket's ownership controls.

BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.

ObjectWriter - The uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.

BucketOwnerEnforced - Access control lists (ACLs) are disabled and no longer affect permissions. The bucket owner automatically owns and has full control over every object in the bucket. The bucket only accepts PUT requests that don't specify an ACL or bucket owner full control ACLs, such as the bucket-owner-full-control canned ACL or an equivalent form of this ACL expressed in the XML format.

pub fn set_object_ownership( self, input: Option<ObjectOwnership> ) -> CreateBucketFluentBuilder

The container element for object ownership for a bucket's ownership controls.

BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.

ObjectWriter - The uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.

BucketOwnerEnforced - Access control lists (ACLs) are disabled and no longer affect permissions. The bucket owner automatically owns and has full control over every object in the bucket. The bucket only accepts PUT requests that don't specify an ACL or bucket owner full control ACLs, such as the bucket-owner-full-control canned ACL or an equivalent form of this ACL expressed in the XML format.

pub fn get_object_ownership(&self) -> &Option<ObjectOwnership>

The container element for object ownership for a bucket's ownership controls.

BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.

ObjectWriter - The uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.

BucketOwnerEnforced - Access control lists (ACLs) are disabled and no longer affect permissions. The bucket owner automatically owns and has full control over every object in the bucket. The bucket only accepts PUT requests that don't specify an ACL or bucket owner full control ACLs, such as the bucket-owner-full-control canned ACL or an equivalent form of this ACL expressed in the XML format.

Trait Implementations§

§

impl Clone for CreateBucketFluentBuilder

§

fn clone(&self) -> CreateBucketFluentBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for CreateBucketFluentBuilder

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more