Class: AWSCDK::APIGateway::RateLimitedAPIKeyProps

Inherits:
APIKeyProps
  • Object
show all
Defined in:
api_gateway/rate_limited_api_key_props.rb

Overview

RateLimitedApiKey properties.

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, customer_id: nil, enabled: nil, generate_distinct_id: nil, resources: nil, stages: nil, api_stages: nil, quota: nil, throttle: nil) ⇒ RateLimitedAPIKeyProps

Returns a new instance of RateLimitedAPIKeyProps.

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.

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

    An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.

  • enabled (Boolean, nil) (defaults to: nil)

    Indicates whether the API key can be used by clients.

  • generate_distinct_id (Boolean, nil) (defaults to: nil)

    Specifies whether the key identifier is distinct from the created API key value.

  • resources (Array<AWSCDK::APIGateway::IRestAPI>, nil) (defaults to: nil)

    A list of resources this api key is associated with.

  • stages (Array<AWSCDK::APIGateway::IStage>, nil) (defaults to: nil)

    A list of Stages this api key is associated with.

  • api_stages (Array<AWSCDK::APIGateway::UsagePlanPerAPIStage>, nil) (defaults to: nil)

    API Stages to be associated with the RateLimitedApiKey.

  • quota (AWSCDK::APIGateway::QuotaSettings, nil) (defaults to: nil)

    Number of requests clients can make in a given time period.

  • throttle (AWSCDK::APIGateway::ThrottleSettings, nil) (defaults to: nil)

    Overall throttle settings for the API.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'api_gateway/rate_limited_api_key_props.rb', line 21

def initialize(default_cors_preflight_options: nil, default_integration: nil, default_method_options: nil, api_key_name: nil, description: nil, value: nil, customer_id: nil, enabled: nil, generate_distinct_id: nil, resources: nil, stages: nil, api_stages: nil, quota: nil, throttle: 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?
  @customer_id = customer_id
  Jsii::Type.check_type(@customer_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "customerId") unless @customer_id.nil?
  @enabled = enabled
  Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled") unless @enabled.nil?
  @generate_distinct_id = generate_distinct_id
  Jsii::Type.check_type(@generate_distinct_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "generateDistinctId") unless @generate_distinct_id.nil?
  @resources = resources
  Jsii::Type.check_type(@resources, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcGlnYXRld2F5LklSZXN0QXBpIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "resources") unless @resources.nil?
  @stages = stages
  Jsii::Type.check_type(@stages, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcGlnYXRld2F5LklTdGFnZSJ9LCJraW5kIjoiYXJyYXkifX0=")), "stages") unless @stages.nil?
  @api_stages = api_stages.is_a?(Array) ? api_stages.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::APIGateway::UsagePlanPerAPIStage.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : api_stages
  Jsii::Type.check_type(@api_stages, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcGlnYXRld2F5LlVzYWdlUGxhblBlckFwaVN0YWdlIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "apiStages") unless @api_stages.nil?
  @quota = quota.is_a?(Hash) ? ::AWSCDK::APIGateway::QuotaSettings.new(**quota.transform_keys(&:to_sym)) : quota
  Jsii::Type.check_type(@quota, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5RdW90YVNldHRpbmdzIn0=")), "quota") unless @quota.nil?
  @throttle = throttle.is_a?(Hash) ? ::AWSCDK::APIGateway::ThrottleSettings.new(**throttle.transform_keys(&:to_sym)) : throttle
  Jsii::Type.check_type(@throttle, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5UaHJvdHRsZVNldHRpbmdzIn0=")), "throttle") unless @throttle.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)


75
76
77
# File 'api_gateway/rate_limited_api_key_props.rb', line 75

def api_key_name
  @api_key_name
end

#api_stagesArray<AWSCDK::APIGateway::UsagePlanPerAPIStage>? (readonly)

Note:

Default: none

API Stages to be associated with the RateLimitedApiKey.

If you already prepared UsagePlan resource explicitly, you should use stages property. If you prefer to prepare UsagePlan resource implicitly via RateLimitedApiKey, or you should specify throttle settings at each stage individually, you should use api_stages property.



122
123
124
# File 'api_gateway/rate_limited_api_key_props.rb', line 122

def api_stages
  @api_stages
end

#customer_idString? (readonly)

Note:

Default: none

An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.

Returns:

  • (String, nil)


92
93
94
# File 'api_gateway/rate_limited_api_key_props.rb', line 92

def customer_id
  @customer_id
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.



58
59
60
# File 'api_gateway/rate_limited_api_key_props.rb', line 58

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.



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

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.



68
69
70
# File 'api_gateway/rate_limited_api_key_props.rb', line 68

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)


80
81
82
# File 'api_gateway/rate_limited_api_key_props.rb', line 80

def description
  @description
end

#enabledBoolean? (readonly)

Note:

Default: true

Indicates whether the API key can be used by clients.

Returns:

  • (Boolean, nil)


97
98
99
# File 'api_gateway/rate_limited_api_key_props.rb', line 97

def enabled
  @enabled
end

#generate_distinct_idBoolean? (readonly)

Note:

Default: false

Specifies whether the key identifier is distinct from the created API key value.

Returns:

  • (Boolean, nil)


102
103
104
# File 'api_gateway/rate_limited_api_key_props.rb', line 102

def generate_distinct_id
  @generate_distinct_id
end

#quotaAWSCDK::APIGateway::QuotaSettings? (readonly)

Note:

Default: none

Number of requests clients can make in a given time period.



127
128
129
# File 'api_gateway/rate_limited_api_key_props.rb', line 127

def quota
  @quota
end

#resourcesArray<AWSCDK::APIGateway::IRestAPI>? (readonly)

Deprecated.
  • use stages instead
Note:

Default: none

A list of resources this api key is associated with.

Returns:



108
109
110
# File 'api_gateway/rate_limited_api_key_props.rb', line 108

def resources
  @resources
end

#stagesArray<AWSCDK::APIGateway::IStage>? (readonly)

Note:

Default: - the api key is not associated with any stages

A list of Stages this api key is associated with.

Returns:



113
114
115
# File 'api_gateway/rate_limited_api_key_props.rb', line 113

def stages
  @stages
end

#throttleAWSCDK::APIGateway::ThrottleSettings? (readonly)

Note:

Default: none

Overall throttle settings for the API.



132
133
134
# File 'api_gateway/rate_limited_api_key_props.rb', line 132

def throttle
  @throttle
end

#valueString? (readonly)

Note:

Default: none

The value of the API key.

Must be at least 20 characters long.

Returns:

  • (String, nil)


87
88
89
# File 'api_gateway/rate_limited_api_key_props.rb', line 87

def value
  @value
end

Class Method Details

.jsii_propertiesObject



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'api_gateway/rate_limited_api_key_props.rb', line 134

def self.jsii_properties
  {
    :default_cors_preflight_options => "defaultCorsPreflightOptions",
    :default_integration => "defaultIntegration",
    :default_method_options => "defaultMethodOptions",
    :api_key_name => "apiKeyName",
    :description => "description",
    :value => "value",
    :customer_id => "customerId",
    :enabled => "enabled",
    :generate_distinct_id => "generateDistinctId",
    :resources => "resources",
    :stages => "stages",
    :api_stages => "apiStages",
    :quota => "quota",
    :throttle => "throttle",
  }
end

Instance Method Details

#to_jsiiObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'api_gateway/rate_limited_api_key_props.rb', line 153

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,
    "customerId" => @customer_id,
    "enabled" => @enabled,
    "generateDistinctId" => @generate_distinct_id,
    "resources" => @resources,
    "stages" => @stages,
    "apiStages" => @api_stages,
    "quota" => @quota,
    "throttle" => @throttle,
  })
  result.compact
end