Class: AWSCDK::APIGateway::APIKeyOptions

Inherits:
ResourceOptions
  • Object
show all
Defined in:
api_gateway/api_key_options.rb

Overview

The options for creating an API Key.

Direct Known Subclasses

APIKeyProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(default_cors_preflight_options: nil, default_integration: nil, default_method_options: nil, api_key_name: nil, description: nil, value: nil) ⇒ APIKeyOptions

Returns a new instance of APIKeyOptions.

Parameters:

  • default_cors_preflight_options (AWSCDK::APIGateway::CorsOptions, nil) (defaults to: nil)

    Adds a CORS preflight OPTIONS method to this resource and all child resources.

  • default_integration (AWSCDK::APIGateway::Integration, nil) (defaults to: nil)

    An integration to use as a default for all methods created within this API unless an integration is specified.

  • default_method_options (AWSCDK::APIGateway::MethodOptions, nil) (defaults to: nil)

    Method options to use as a default for all methods created within this API unless custom options are specified.

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

    A name for the API key.

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

    A description of the purpose of the API key.

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

    The value of the API key.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'api_gateway/api_key_options.rb', line 13

def initialize(default_cors_preflight_options: nil, default_integration: nil, default_method_options: nil, api_key_name: nil, description: nil, value: nil)
  @default_cors_preflight_options = default_cors_preflight_options.is_a?(Hash) ? ::AWSCDK::APIGateway::CorsOptions.new(**default_cors_preflight_options.transform_keys(&:to_sym)) : default_cors_preflight_options
  Jsii::Type.check_type(@default_cors_preflight_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5Db3JzT3B0aW9ucyJ9")), "defaultCorsPreflightOptions") unless @default_cors_preflight_options.nil?
  @default_integration = default_integration
  Jsii::Type.check_type(@default_integration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5JbnRlZ3JhdGlvbiJ9")), "defaultIntegration") unless @default_integration.nil?
  @default_method_options = default_method_options.is_a?(Hash) ? ::AWSCDK::APIGateway::MethodOptions.new(**default_method_options.transform_keys(&:to_sym)) : default_method_options
  Jsii::Type.check_type(@default_method_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5NZXRob2RPcHRpb25zIn0=")), "defaultMethodOptions") unless @default_method_options.nil?
  @api_key_name = api_key_name
  Jsii::Type.check_type(@api_key_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "apiKeyName") unless @api_key_name.nil?
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @value = value
  Jsii::Type.check_type(@value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "value") unless @value.nil?
end

Instance Attribute Details

#api_key_nameString? (readonly)

Note:

Default: automically generated name

A name for the API key.

If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the API key name.

Returns:

  • (String, nil)


51
52
53
# File 'api_gateway/api_key_options.rb', line 51

def api_key_name
  @api_key_name
end

#default_cors_preflight_optionsAWSCDK::APIGateway::CorsOptions? (readonly)

Note:

Default: - CORS is disabled

Adds a CORS preflight OPTIONS method to this resource and all child resources.

You can add CORS at the resource-level using add_cors_preflight.



34
35
36
# File 'api_gateway/api_key_options.rb', line 34

def default_cors_preflight_options
  @default_cors_preflight_options
end

#default_integrationAWSCDK::APIGateway::Integration? (readonly)

Note:

Default: - Inherited from parent.

An integration to use as a default for all methods created within this API unless an integration is specified.



39
40
41
# File 'api_gateway/api_key_options.rb', line 39

def default_integration
  @default_integration
end

#default_method_optionsAWSCDK::APIGateway::MethodOptions? (readonly)

Note:

Default: - Inherited from parent.

Method options to use as a default for all methods created within this API unless custom options are specified.



44
45
46
# File 'api_gateway/api_key_options.rb', line 44

def default_method_options
  @default_method_options
end

#descriptionString? (readonly)

Note:

Default: none

A description of the purpose of the API key.

Returns:

  • (String, nil)


56
57
58
# File 'api_gateway/api_key_options.rb', line 56

def description
  @description
end

#valueString? (readonly)

Note:

Default: none

The value of the API key.

Must be at least 20 characters long.

Returns:

  • (String, nil)


63
64
65
# File 'api_gateway/api_key_options.rb', line 63

def value
  @value
end

Class Method Details

.jsii_propertiesObject



65
66
67
68
69
70
71
72
73
74
# File 'api_gateway/api_key_options.rb', line 65

def self.jsii_properties
  {
    :default_cors_preflight_options => "defaultCorsPreflightOptions",
    :default_integration => "defaultIntegration",
    :default_method_options => "defaultMethodOptions",
    :api_key_name => "apiKeyName",
    :description => "description",
    :value => "value",
  }
end

Instance Method Details

#to_jsiiObject



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'api_gateway/api_key_options.rb', line 76

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "defaultCorsPreflightOptions" => @default_cors_preflight_options,
    "defaultIntegration" => @default_integration,
    "defaultMethodOptions" => @default_method_options,
    "apiKeyName" => @api_key_name,
    "description" => @description,
    "value" => @value,
  })
  result.compact
end