Class: AWSCDK::Lambda::FunctionURLCorsOptions
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::Lambda::FunctionURLCorsOptions
- Defined in:
- lambda/function_url_cors_options.rb
Overview
Specifies a cross-origin access property for a function URL.
Instance Attribute Summary collapse
-
#allow_credentials ⇒ Boolean?
readonly
Whether to allow cookies or other credentials in requests to your function URL.
-
#allowed_headers ⇒ Array<String>?
readonly
Headers that are specified in the Access-Control-Request-Headers header.
-
#allowed_methods ⇒ Array<AWSCDK::Lambda::HttpMethod>?
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.
-
#max_age ⇒ AWSCDK::Duration?
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(allow_credentials: nil, allowed_headers: nil, allowed_methods: nil, allowed_origins: nil, exposed_headers: nil, max_age: nil) ⇒ FunctionURLCorsOptions
constructor
A new instance of FunctionURLCorsOptions.
- #to_jsii ⇒ Object
Constructor Details
#initialize(allow_credentials: nil, allowed_headers: nil, allowed_methods: nil, allowed_origins: nil, exposed_headers: nil, max_age: nil) ⇒ FunctionURLCorsOptions
Returns a new instance of FunctionURLCorsOptions.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lambda/function_url_cors_options.rb', line 13 def initialize(allow_credentials: nil, allowed_headers: nil, allowed_methods: nil, allowed_origins: nil, exposed_headers: nil, max_age: nil) @allow_credentials = allow_credentials Jsii::Type.check_type(@allow_credentials, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowCredentials") unless @allow_credentials.nil? @allowed_headers = allowed_headers Jsii::Type.check_type(@allowed_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowedHeaders") unless @allowed_headers.nil? @allowed_methods = allowed_methods Jsii::Type.check_type(@allowed_methods, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19sYW1iZGEuSHR0cE1ldGhvZCJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowedMethods") unless @allowed_methods.nil? @allowed_origins = allowed_origins Jsii::Type.check_type(@allowed_origins, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowedOrigins") unless @allowed_origins.nil? @exposed_headers = exposed_headers Jsii::Type.check_type(@exposed_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "exposedHeaders") unless @exposed_headers.nil? @max_age = max_age Jsii::Type.check_type(@max_age, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxAge") unless @max_age.nil? end |
Instance Attribute Details
#allow_credentials ⇒ Boolean? (readonly)
Default: false
Whether to allow cookies or other credentials in requests to your function URL.
32 33 34 |
# File 'lambda/function_url_cors_options.rb', line 32 def allow_credentials @allow_credentials end |
#allowed_headers ⇒ Array<String>? (readonly)
Default: - No headers allowed.
Headers that are specified in the Access-Control-Request-Headers header.
37 38 39 |
# File 'lambda/function_url_cors_options.rb', line 37 def allowed_headers @allowed_headers end |
#allowed_methods ⇒ Array<AWSCDK::Lambda::HttpMethod>? (readonly)
Default: - [HttpMethod.ALL]
An HTTP method that you allow the origin to execute.
42 43 44 |
# File 'lambda/function_url_cors_options.rb', line 42 def allowed_methods @allowed_methods end |
#allowed_origins ⇒ Array<String>? (readonly)
Default: - No origins allowed.
One or more origins you want customers to be able to access the bucket from.
47 48 49 |
# File 'lambda/function_url_cors_options.rb', line 47 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.
52 53 54 |
# File 'lambda/function_url_cors_options.rb', line 52 def exposed_headers @exposed_headers end |
#max_age ⇒ AWSCDK::Duration? (readonly)
Default: - Browser default of 5 seconds.
The time in seconds that your browser is to cache the preflight response for the specified resource.
57 58 59 |
# File 'lambda/function_url_cors_options.rb', line 57 def max_age @max_age end |
Class Method Details
.jsii_properties ⇒ Object
59 60 61 62 63 64 65 66 67 68 |
# File 'lambda/function_url_cors_options.rb', line 59 def self.jsii_properties { :allow_credentials => "allowCredentials", :allowed_headers => "allowedHeaders", :allowed_methods => "allowedMethods", :allowed_origins => "allowedOrigins", :exposed_headers => "exposedHeaders", :max_age => "maxAge", } end |
Instance Method Details
#to_jsii ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lambda/function_url_cors_options.rb', line 70 def to_jsii result = {} result.merge!({ "allowCredentials" => @allow_credentials, "allowedHeaders" => @allowed_headers, "allowedMethods" => @allowed_methods, "allowedOrigins" => @allowed_origins, "exposedHeaders" => @exposed_headers, "maxAge" => @max_age, }) result.compact end |