Class: AWSCDK::APIGatewayv2::CfnAPI::CorsProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
api_gatewayv2/cfn_api.rb

Overview

The Cors property specifies a CORS configuration for an API.

Supported only for HTTP APIs. See Configuring CORS for more information.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allow_credentials: nil, allow_headers: nil, allow_methods: nil, allow_origins: nil, expose_headers: nil, max_age: nil) ⇒ CorsProperty

Returns a new instance of CorsProperty.

Parameters:

  • allow_credentials (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether credentials are included in the CORS request.

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

    Represents a collection of allowed headers.

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

    Represents a collection of allowed HTTP methods.

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

    Represents a collection of allowed origins.

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

    Represents a collection of exposed headers.

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

    The number of seconds that the browser should cache preflight request results.



840
841
842
843
844
845
846
847
848
849
850
851
852
853
# File 'api_gatewayv2/cfn_api.rb', line 840

def initialize(allow_credentials: nil, allow_headers: nil, allow_methods: nil, allow_origins: nil, expose_headers: nil, max_age: nil)
  @allow_credentials = allow_credentials
  Jsii::Type.check_type(@allow_credentials, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "allowCredentials") unless @allow_credentials.nil?
  @allow_headers = allow_headers
  Jsii::Type.check_type(@allow_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowHeaders") unless @allow_headers.nil?
  @allow_methods = allow_methods
  Jsii::Type.check_type(@allow_methods, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowMethods") unless @allow_methods.nil?
  @allow_origins = allow_origins
  Jsii::Type.check_type(@allow_origins, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowOrigins") unless @allow_origins.nil?
  @expose_headers = expose_headers
  Jsii::Type.check_type(@expose_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "exposeHeaders") unless @expose_headers.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

#allow_credentialsBoolean, ... (readonly)

Specifies whether credentials are included in the CORS request.

Supported only for HTTP APIs.



861
862
863
# File 'api_gatewayv2/cfn_api.rb', line 861

def allow_credentials
  @allow_credentials
end

#allow_headersArray<String>? (readonly)

Represents a collection of allowed headers.

Supported only for HTTP APIs.



868
869
870
# File 'api_gatewayv2/cfn_api.rb', line 868

def allow_headers
  @allow_headers
end

#allow_methodsArray<String>? (readonly)

Represents a collection of allowed HTTP methods.

Supported only for HTTP APIs.



875
876
877
# File 'api_gatewayv2/cfn_api.rb', line 875

def allow_methods
  @allow_methods
end

#allow_originsArray<String>? (readonly)

Represents a collection of allowed origins.

Supported only for HTTP APIs.



882
883
884
# File 'api_gatewayv2/cfn_api.rb', line 882

def allow_origins
  @allow_origins
end

#expose_headersArray<String>? (readonly)

Represents a collection of exposed headers.

Supported only for HTTP APIs.



889
890
891
# File 'api_gatewayv2/cfn_api.rb', line 889

def expose_headers
  @expose_headers
end

#max_ageNumeric? (readonly)

The number of seconds that the browser should cache preflight request results.

Supported only for HTTP APIs.



896
897
898
# File 'api_gatewayv2/cfn_api.rb', line 896

def max_age
  @max_age
end

Class Method Details

.jsii_propertiesObject



898
899
900
901
902
903
904
905
906
907
# File 'api_gatewayv2/cfn_api.rb', line 898

def self.jsii_properties
  {
    :allow_credentials => "allowCredentials",
    :allow_headers => "allowHeaders",
    :allow_methods => "allowMethods",
    :allow_origins => "allowOrigins",
    :expose_headers => "exposeHeaders",
    :max_age => "maxAge",
  }
end

Instance Method Details

#to_jsiiObject



909
910
911
912
913
914
915
916
917
918
919
920
# File 'api_gatewayv2/cfn_api.rb', line 909

def to_jsii
  result = {}
  result.merge!({
    "allowCredentials" => @allow_credentials,
    "allowHeaders" => @allow_headers,
    "allowMethods" => @allow_methods,
    "allowOrigins" => @allow_origins,
    "exposeHeaders" => @expose_headers,
    "maxAge" => @max_age,
  })
  result.compact
end