CorsRule
- class aws_cdk.aws_s3.CorsRule(*, allowed_methods, allowed_origins, allowed_headers=None, exposed_headers=None, id=None, max_age=None)
Bases:
object
Specifies a cross-origin access rule for an Amazon S3 bucket.
- Parameters:
allowed_methods (
Sequence
[HttpMethods
]) – An HTTP method that you allow the origin to execute.allowed_origins (
Sequence
[str
]) – One or more origins you want customers to be able to access the bucket from.allowed_headers (
Optional
[Sequence
[str
]]) – Headers that are specified in the Access-Control-Request-Headers header. Default: - No headers allowed.exposed_headers (
Optional
[Sequence
[str
]]) – One or more headers in the response that you want customers to be able to access from their applications. Default: - No headers exposed.id (
Optional
[str
]) – A unique identifier for this rule. Default: - No id specified.max_age (
Union
[int
,float
,None
]) – The time in seconds that your browser is to cache the preflight response for the specified resource. Default: - No caching.
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_s3 as s3 cors_rule = s3.CorsRule( allowed_methods=[s3.HttpMethods.GET], allowed_origins=["allowedOrigins"], # the properties below are optional allowed_headers=["allowedHeaders"], exposed_headers=["exposedHeaders"], id="id", max_age=123 )
Attributes
- allowed_headers
Headers that are specified in the Access-Control-Request-Headers header.
- Default:
No headers allowed.
- allowed_methods
An HTTP method that you allow the origin to execute.
- allowed_origins
One or more origins you want customers to be able to access the bucket from.
- exposed_headers
One or more headers in the response that you want customers to be able to access from their applications.
- Default:
No headers exposed.
- id
A unique identifier for this rule.
- Default:
No id specified.
- max_age
The time in seconds that your browser is to cache the preflight response for the specified resource.
- Default:
No caching.