Class: AWSCDK::S3::CfnBucket::CorsRuleProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
s3/cfn_bucket.rb

Overview

Specifies a cross-origin access rule for an Amazon S3 bucket.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allowed_methods:, allowed_origins:, allowed_headers: nil, exposed_headers: nil, id: nil, max_age: nil) ⇒ CorsRuleProperty

Returns a new instance of CorsRuleProperty.

Parameters:

  • allowed_methods (Array<String>)

    An HTTP method that you allow the origin to run.

  • allowed_origins (Array<String>)

    One or more origins you want customers to be able to access the bucket from.

  • allowed_headers (Array<String>, nil) (defaults to: nil)

    Headers that are specified in the Access-Control-Request-Headers header.

  • exposed_headers (Array<String>, nil) (defaults to: nil)

    One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript XMLHttpRequest object).

  • id (String, nil) (defaults to: nil)

    A unique identifier for this rule.

  • max_age (Numeric, nil) (defaults to: nil)

    The time in seconds that your browser is to cache the preflight response for the specified resource.



1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
# File 's3/cfn_bucket.rb', line 1357

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("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "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_headersArray<String>? (readonly)

Headers that are specified in the Access-Control-Request-Headers header.

These headers are allowed in a preflight OPTIONS request. In response to any preflight OPTIONS request, Amazon S3 returns any requested headers that are allowed.



1390
1391
1392
# File 's3/cfn_bucket.rb', line 1390

def allowed_headers
  @allowed_headers
end

#allowed_methodsArray<String> (readonly)

An HTTP method that you allow the origin to run.

Allowed values : GET | PUT | HEAD | POST | DELETE



1378
1379
1380
# File 's3/cfn_bucket.rb', line 1378

def allowed_methods
  @allowed_methods
end

#allowed_originsArray<String> (readonly)

One or more origins you want customers to be able to access the bucket from.



1383
1384
1385
# File 's3/cfn_bucket.rb', line 1383

def allowed_origins
  @allowed_origins
end

#exposed_headersArray<String>? (readonly)

One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript XMLHttpRequest object).



1395
1396
1397
# File 's3/cfn_bucket.rb', line 1395

def exposed_headers
  @exposed_headers
end

#idString? (readonly)

A unique identifier for this rule.

The value must be no more than 255 characters.



1402
1403
1404
# File 's3/cfn_bucket.rb', line 1402

def id
  @id
end

#max_ageNumeric? (readonly)

The time in seconds that your browser is to cache the preflight response for the specified resource.



1407
1408
1409
# File 's3/cfn_bucket.rb', line 1407

def max_age
  @max_age
end

Class Method Details

.jsii_propertiesObject



1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
# File 's3/cfn_bucket.rb', line 1409

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_jsiiObject



1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
# File 's3/cfn_bucket.rb', line 1420

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