Class: AWSCDK::S3::CorsRule
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::S3::CorsRule
- Defined in:
- s3/cors_rule.rb
Overview
Specifies a cross-origin access rule for an Amazon S3 bucket.
Instance Attribute Summary collapse
-
#allowed_headers ⇒ Array<String>?
readonly
Headers that are specified in the Access-Control-Request-Headers header.
-
#allowed_methods ⇒ Array<AWSCDK::S3::HttpMethods>
readonly
An HTTP method that you allow the origin to execute.
-
#allowed_origins ⇒ Array<String>
readonly
One or more origins you want customers to be able to access the bucket from.
-
#exposed_headers ⇒ Array<String>?
readonly
One or more headers in the response that you want customers to be able to access from their applications.
-
#id ⇒ String?
readonly
A unique identifier for this rule.
-
#max_age ⇒ Numeric?
readonly
The time in seconds that your browser is to cache the preflight response for the specified resource.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(allowed_methods:, allowed_origins:, allowed_headers: nil, exposed_headers: nil, id: nil, max_age: nil) ⇒ CorsRule
constructor
A new instance of CorsRule.
- #to_jsii ⇒ Object
Constructor Details
#initialize(allowed_methods:, allowed_origins:, allowed_headers: nil, exposed_headers: nil, id: nil, max_age: nil) ⇒ CorsRule
Returns a new instance of CorsRule.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 's3/cors_rule.rb', line 13 def initialize(allowed_methods:, allowed_origins:, allowed_headers: nil, exposed_headers: nil, id: nil, max_age: nil) @allowed_methods = allowed_methods Jsii::Type.check_type(@allowed_methods, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zMy5IdHRwTWV0aG9kcyJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowedMethods") @allowed_origins = allowed_origins Jsii::Type.check_type(@allowed_origins, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowedOrigins") @allowed_headers = allowed_headers Jsii::Type.check_type(@allowed_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowedHeaders") unless @allowed_headers.nil? @exposed_headers = exposed_headers Jsii::Type.check_type(@exposed_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "exposedHeaders") unless @exposed_headers.nil? @id = id Jsii::Type.check_type(@id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") unless @id.nil? @max_age = max_age Jsii::Type.check_type(@max_age, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxAge") unless @max_age.nil? end |
Instance Attribute Details
#allowed_headers ⇒ Array<String>? (readonly)
Default: - No headers allowed.
Headers that are specified in the Access-Control-Request-Headers header.
40 41 42 |
# File 's3/cors_rule.rb', line 40 def allowed_headers @allowed_headers end |
#allowed_methods ⇒ Array<AWSCDK::S3::HttpMethods> (readonly)
An HTTP method that you allow the origin to execute.
31 32 33 |
# File 's3/cors_rule.rb', line 31 def allowed_methods @allowed_methods end |
#allowed_origins ⇒ Array<String> (readonly)
One or more origins you want customers to be able to access the bucket from.
35 36 37 |
# File 's3/cors_rule.rb', line 35 def allowed_origins @allowed_origins end |
#exposed_headers ⇒ Array<String>? (readonly)
Default: - No headers exposed.
One or more headers in the response that you want customers to be able to access from their applications.
45 46 47 |
# File 's3/cors_rule.rb', line 45 def exposed_headers @exposed_headers end |
#id ⇒ String? (readonly)
Default: - No id specified.
A unique identifier for this rule.
50 51 52 |
# File 's3/cors_rule.rb', line 50 def id @id end |
#max_age ⇒ Numeric? (readonly)
Default: - No caching.
The time in seconds that your browser is to cache the preflight response for the specified resource.
55 56 57 |
# File 's3/cors_rule.rb', line 55 def max_age @max_age end |
Class Method Details
.jsii_properties ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 's3/cors_rule.rb', line 57 def self.jsii_properties { :allowed_methods => "allowedMethods", :allowed_origins => "allowedOrigins", :allowed_headers => "allowedHeaders", :exposed_headers => "exposedHeaders", :id => "id", :max_age => "maxAge", } end |
Instance Method Details
#to_jsii ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 's3/cors_rule.rb', line 68 def to_jsii result = {} result.merge!({ "allowedMethods" => @allowed_methods, "allowedOrigins" => @allowed_origins, "allowedHeaders" => @allowed_headers, "exposedHeaders" => @exposed_headers, "id" => @id, "maxAge" => @max_age, }) result.compact end |