Struct aws_sdk_s3::client::fluent_builders::PutBucketCors [−][src]
pub struct PutBucketCors<C = DynConnector, M = AwsMiddleware, R = Standard> { /* fields omitted */ }
Expand description
Fluent builder constructing a request to PutBucketCors
.
Sets the cors
configuration for your bucket. If the configuration exists,
Amazon S3 replaces it.
To use this operation, you must be allowed to perform the s3:PutBucketCORS
action. By default, the bucket owner has this permission and can grant it to others.
You set this configuration on a bucket so that the bucket can service cross-origin
requests. For example, you might want to enable a request whose origin is
http://www.example.com
to access your Amazon S3 bucket at
my.example.bucket.com
by using the browser's XMLHttpRequest
capability.
To enable cross-origin resource sharing (CORS) on a bucket, you add the
cors
subresource to the bucket. The cors
subresource is an XML
document in which you configure rules that identify origins and the HTTP methods that can
be executed on your bucket. The document is limited to 64 KB in size.
When Amazon S3 receives a cross-origin request (or a pre-flight OPTIONS request) against a
bucket, it evaluates the cors
configuration on the bucket and uses the first
CORSRule
rule that matches the incoming browser request to enable a
cross-origin request. For a rule to match, the following conditions must be met:
-
The request's
Origin
header must matchAllowedOrigin
elements. -
The request method (for example, GET, PUT, HEAD, and so on) or the
Access-Control-Request-Method
header in case of a pre-flightOPTIONS
request must be one of theAllowedMethod
elements. -
Every header specified in the
Access-Control-Request-Headers
request header of a pre-flight request must match anAllowedHeader
element.
For more information about CORS, go to Enabling Cross-Origin Resource Sharing in the Amazon S3 User Guide.
Related Resources
Implementations
impl<C, M, R> PutBucketCors<C, M, R> where
C: SmithyConnector,
M: SmithyMiddleware<C>,
R: NewRequestPolicy,
impl<C, M, R> PutBucketCors<C, M, R> where
C: SmithyConnector,
M: SmithyMiddleware<C>,
R: NewRequestPolicy,
pub async fn send(
self
) -> Result<PutBucketCorsOutput, SdkError<PutBucketCorsError>> where
R::Policy: SmithyRetryPolicy<PutBucketCorsInputOperationOutputAlias, PutBucketCorsOutput, PutBucketCorsError, PutBucketCorsInputOperationRetryAlias>,
pub async fn send(
self
) -> Result<PutBucketCorsOutput, SdkError<PutBucketCorsError>> where
R::Policy: SmithyRetryPolicy<PutBucketCorsInputOperationOutputAlias, PutBucketCorsOutput, PutBucketCorsError, PutBucketCorsInputOperationRetryAlias>,
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.
Specifies the bucket impacted by the cors
configuration.
Specifies the bucket impacted by the cors
configuration.
Describes the cross-origin access configuration for objects in an Amazon S3 bucket. For more information, see Enabling Cross-Origin Resource Sharing in the Amazon S3 User Guide.
Describes the cross-origin access configuration for objects in an Amazon S3 bucket. For more information, see Enabling Cross-Origin Resource Sharing in the Amazon S3 User Guide.
The base64-encoded 128-bit MD5 digest of the data. This header must be used as a message integrity check to verify that the request body was not corrupted in transit. For more information, go to RFC 1864.
For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.
The base64-encoded 128-bit MD5 digest of the data. This header must be used as a message integrity check to verify that the request body was not corrupted in transit. For more information, go to RFC 1864.
For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.
The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied)
error.
The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied)
error.
Trait Implementations
Auto Trait Implementations
impl<C = DynConnector, M = AwsMiddleware, R = Standard> !RefUnwindSafe for PutBucketCors<C, M, R>
impl<C, M, R> Unpin for PutBucketCors<C, M, R>
impl<C = DynConnector, M = AwsMiddleware, R = Standard> !UnwindSafe for PutBucketCors<C, M, R>
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more