Skip to content

S3  >  Operations  >  get_bucket_cors

get_bucket_cors

Operation

get_bucket_cors async

get_bucket_cors(request: GetBucketCorsInput | GetBucketCorsInputDict, /, *, plugins: list[Plugin] | None = None) -> GetBucketCorsOutput
get_bucket_cors(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[GetBucketCorsInputDict]) -> GetBucketCorsOutput
Note

This operation is not supported for directory buckets.

Returns the Cross-Origin Resource Sharing (CORS) configuration information set for the bucket.

To use this operation, you must have permission to perform the s3:GetBucketCORS action. By default, the bucket owner has this permission and can grant it to others.

When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.

When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code InvalidAccessPointAliasError is returned. For more information about InvalidAccessPointAliasError, see List of Error Codes.

For more information about CORS, see Enabling Cross-Origin Resource Sharing.

The following operations are related to GetBucketCors:

Warning

You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt.

Parameters:

Name Type Description Default
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
GetBucketCorsOutput

An instance of GetBucketCorsOutput.

Input

Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.

Model

GetBucketCorsInput dataclass

Bases: _SerdeShape

Dataclass for GetBucketCorsInput structure.

Attributes
bucket class-attribute instance-attribute
bucket: str | None = ...

The bucket name for which to get the cors configuration.

When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.

When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code InvalidAccessPointAliasError is returned. For more information about InvalidAccessPointAliasError, see List of Error Codes.

expected_bucket_owner class-attribute instance-attribute
expected_bucket_owner: str | None = ...

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

Dictionaries

GetBucketCorsInputDict

Bases: TypedDict

Dictionary form of GetBucketCorsInput.

Attributes
bucket instance-attribute
bucket: Required[str]

The bucket name for which to get the cors configuration.

When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.

When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code InvalidAccessPointAliasError is returned. For more information about InvalidAccessPointAliasError, see List of Error Codes.

expected_bucket_owner instance-attribute
expected_bucket_owner: str | None

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

Output

GetBucketCorsOutput dataclass

Bases: _SerdeShape

Dataclass for GetBucketCorsOutput structure.

Attributes

cors_rules class-attribute instance-attribute
cors_rules: list[CORSRule] | None = ...

A set of origins and methods (cross-origin access that you want to allow). You can add up to 100 rules to the configuration.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.