Class CorsRule
Specifies a cross-origin access rule for an Amazon S3 bucket.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.S3
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CorsRule : Object, ICorsRule
Syntax (vb)
Public Class CorsRule
Inherits Object
Implements ICorsRule
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.S3;
var corsRule = new CorsRule {
AllowedMethods = new [] { HttpMethods.GET },
AllowedOrigins = new [] { "allowedOrigins" },
// the properties below are optional
AllowedHeaders = new [] { "allowedHeaders" },
ExposedHeaders = new [] { "exposedHeaders" },
Id = "id",
MaxAge = 123
};
Synopsis
Constructors
CorsRule() |
Properties
AllowedHeaders | Headers that are specified in the Access-Control-Request-Headers header. |
AllowedMethods | An HTTP method that you allow the origin to execute. |
AllowedOrigins | One or more origins you want customers to be able to access the bucket from. |
ExposedHeaders | One or more headers in the response that you want customers to be able to access from their applications. |
Id | A unique identifier for this rule. |
MaxAge | The time in seconds that your browser is to cache the preflight response for the specified resource. |
Constructors
CorsRule()
public CorsRule()
Properties
AllowedHeaders
Headers that are specified in the Access-Control-Request-Headers header.
public string[] AllowedHeaders { get; set; }
Property Value
System.String[]
Remarks
Default: - No headers allowed.
AllowedMethods
An HTTP method that you allow the origin to execute.
public HttpMethods[] AllowedMethods { get; set; }
Property Value
AllowedOrigins
One or more origins you want customers to be able to access the bucket from.
public string[] AllowedOrigins { get; set; }
Property Value
System.String[]
ExposedHeaders
One or more headers in the response that you want customers to be able to access from their applications.
public string[] ExposedHeaders { get; set; }
Property Value
System.String[]
Remarks
Default: - No headers exposed.
Id
A unique identifier for this rule.
public string Id { get; set; }
Property Value
System.String
Remarks
Default: - No id specified.
MaxAge
The time in seconds that your browser is to cache the preflight response for the specified resource.
public Nullable<double> MaxAge { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default: - No caching.