fastly 5.2.1 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/docs/AutomationTokenCreateResponse.md +3 -3
- data/docs/AutomationTokenCreateResponseAllOf.md +3 -3
- data/docs/AutomationTokenResponse.md +2 -2
- data/docs/AutomationTokenResponseAllOf.md +2 -2
- data/docs/AutomationTokensApi.md +4 -3
- data/docs/ErrorResponse.md +13 -0
- data/docs/{HistoricalFieldResponseAllOf.md → HistoricalFieldResponseDataField.md} +1 -1
- data/docs/HistoricalFieldResultsAttributes.md +1 -1
- data/docs/HistoricalFieldResultsAttributesAllOf.md +1 -1
- data/docs/{HistoricalResponseAllOf.md → HistoricalResponseDataField.md} +1 -1
- data/docs/HistoricalService.md +10 -0
- data/docs/HistoricalUsageMonthResponse.md +1 -1
- data/docs/HistoricalUsageMonthResponseAllOf.md +1 -1
- data/docs/{HistoricalUsageMonthResponseAllOfData.md → HistoricalUsageMonthResponseData.md} +2 -2
- data/docs/RateLimiter.md +1 -1
- data/docs/RateLimiterApi.md +122 -0
- data/docs/RateLimiterResponse.md +1 -1
- data/docs/ReadOnlyCustomerId.md +9 -0
- data/docs/ReadOnlyId.md +9 -0
- data/docs/ReadOnlyIdService.md +9 -0
- data/docs/ReadOnlyUserId.md +9 -0
- data/lib/fastly/api/automation_tokens_api.rb +5 -5
- data/lib/fastly/api/rate_limiter_api.rb +345 -0
- data/lib/fastly/configuration.rb +12 -0
- data/lib/fastly/models/automation_token_create_request_attributes.rb +0 -1
- data/lib/fastly/models/automation_token_create_response.rb +3 -6
- data/lib/fastly/models/automation_token_create_response_all_of.rb +3 -6
- data/lib/fastly/models/automation_token_response.rb +2 -4
- data/lib/fastly/models/automation_token_response_all_of.rb +2 -4
- data/lib/fastly/models/{rate_limiter_response1.rb → error_response.rb} +30 -77
- data/lib/fastly/models/historical_field_response.rb +1 -1
- data/lib/fastly/models/{historical_field_response_all_of.rb → historical_field_response_data_field.rb} +3 -3
- data/lib/fastly/models/historical_field_results_attributes.rb +1 -2
- data/lib/fastly/models/historical_field_results_attributes_all_of.rb +1 -2
- data/lib/fastly/models/historical_response.rb +1 -1
- data/lib/fastly/models/{historical_response_all_of.rb → historical_response_data_field.rb} +3 -3
- data/lib/fastly/models/historical_service.rb +217 -0
- data/lib/fastly/models/historical_usage_month_response.rb +1 -1
- data/lib/fastly/models/historical_usage_month_response_all_of.rb +1 -1
- data/lib/fastly/models/{historical_usage_month_response_all_of_data.rb → historical_usage_month_response_data.rb} +4 -4
- data/lib/fastly/models/rate_limiter.rb +5 -2
- data/lib/fastly/models/rate_limiter_response.rb +5 -2
- data/lib/fastly/models/read_only_customer_id.rb +207 -0
- data/lib/fastly/models/read_only_id.rb +207 -0
- data/lib/fastly/models/read_only_id_service.rb +207 -0
- data/lib/fastly/models/read_only_user_id.rb +207 -0
- data/lib/fastly/version.rb +1 -1
- data/lib/fastly.rb +9 -4
- data/sig.json +1 -1
- metadata +20 -10
- data/docs/RateLimiterResponse1.md +0 -12
@@ -17,6 +17,182 @@ module Fastly
|
|
17
17
|
def initialize(api_client = ApiClient.default)
|
18
18
|
@api_client = api_client
|
19
19
|
end
|
20
|
+
# Create a rate limiter
|
21
|
+
# Create a rate limiter for a particular service and version.
|
22
|
+
# @option opts [String] :service_id Alphanumeric string identifying the service. (required)
|
23
|
+
# @option opts [Integer] :version_id Integer identifying a service version. (required)
|
24
|
+
# @option opts [String] :name A human readable name for the rate limiting rule.
|
25
|
+
# @option opts [String] :uri_dictionary_name The name of an Edge Dictionary containing URIs as keys. If not defined or `null`, all origin URIs will be rate limited.
|
26
|
+
# @option opts [Array<String>] :http_methods Array of HTTP methods to apply rate limiting to.
|
27
|
+
# @option opts [Integer] :rps_limit Upper limit of requests per second allowed by the rate limiter.
|
28
|
+
# @option opts [Integer] :window_size Number of seconds during which the RPS limit must be exceeded in order to trigger a violation.
|
29
|
+
# @option opts [Array<String>] :client_key Array of VCL variables used to generate a counter key to identify a client. Example variables include `req.http.Fastly-Client-IP`, `req.http.User-Agent`, or a custom header like `req.http.API-Key`.
|
30
|
+
# @option opts [Integer] :penalty_box_duration Length of time in minutes that the rate limiter is in effect after the initial violation is detected.
|
31
|
+
# @option opts [String] :action The action to take when a rate limiter violation is detected.
|
32
|
+
# @option opts [String] :response_object_name Name of existing response object. Required if `action` is `response_object`. Note that the rate limiter response is only updated to reflect the response object content when saving the rate limiter configuration.
|
33
|
+
# @option opts [String] :logger_type Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries.
|
34
|
+
# @option opts [Integer] :feature_revision Revision number of the rate limiting feature implementation. Defaults to the most recent revision.
|
35
|
+
# @return [RateLimiterResponse]
|
36
|
+
def create_rate_limiter(opts = {})
|
37
|
+
data, _status_code, _headers = create_rate_limiter_with_http_info(opts)
|
38
|
+
data
|
39
|
+
end
|
40
|
+
|
41
|
+
# Create a rate limiter
|
42
|
+
# Create a rate limiter for a particular service and version.
|
43
|
+
# @option opts [String] :service_id Alphanumeric string identifying the service. (required)
|
44
|
+
# @option opts [Integer] :version_id Integer identifying a service version. (required)
|
45
|
+
# @option opts [String] :name A human readable name for the rate limiting rule.
|
46
|
+
# @option opts [String] :uri_dictionary_name The name of an Edge Dictionary containing URIs as keys. If not defined or `null`, all origin URIs will be rate limited.
|
47
|
+
# @option opts [Array<String>] :http_methods Array of HTTP methods to apply rate limiting to.
|
48
|
+
# @option opts [Integer] :rps_limit Upper limit of requests per second allowed by the rate limiter.
|
49
|
+
# @option opts [Integer] :window_size Number of seconds during which the RPS limit must be exceeded in order to trigger a violation.
|
50
|
+
# @option opts [Array<String>] :client_key Array of VCL variables used to generate a counter key to identify a client. Example variables include `req.http.Fastly-Client-IP`, `req.http.User-Agent`, or a custom header like `req.http.API-Key`.
|
51
|
+
# @option opts [Integer] :penalty_box_duration Length of time in minutes that the rate limiter is in effect after the initial violation is detected.
|
52
|
+
# @option opts [String] :action The action to take when a rate limiter violation is detected.
|
53
|
+
# @option opts [String] :response_object_name Name of existing response object. Required if `action` is `response_object`. Note that the rate limiter response is only updated to reflect the response object content when saving the rate limiter configuration.
|
54
|
+
# @option opts [String] :logger_type Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries.
|
55
|
+
# @option opts [Integer] :feature_revision Revision number of the rate limiting feature implementation. Defaults to the most recent revision.
|
56
|
+
# @return [Array<(RateLimiterResponse, Integer, Hash)>] RateLimiterResponse data, response status code and response headers
|
57
|
+
def create_rate_limiter_with_http_info(opts = {})
|
58
|
+
if @api_client.config.debugging
|
59
|
+
@api_client.config.logger.debug 'Calling API: RateLimiterApi.create_rate_limiter ...'
|
60
|
+
end
|
61
|
+
# unbox the parameters from the hash
|
62
|
+
service_id = opts[:'service_id']
|
63
|
+
version_id = opts[:'version_id']
|
64
|
+
# verify the required parameter 'service_id' is set
|
65
|
+
if @api_client.config.client_side_validation && service_id.nil?
|
66
|
+
fail ArgumentError, "Missing the required parameter 'service_id' when calling RateLimiterApi.create_rate_limiter"
|
67
|
+
end
|
68
|
+
# verify the required parameter 'version_id' is set
|
69
|
+
if @api_client.config.client_side_validation && version_id.nil?
|
70
|
+
fail ArgumentError, "Missing the required parameter 'version_id' when calling RateLimiterApi.create_rate_limiter"
|
71
|
+
end
|
72
|
+
if @api_client.config.client_side_validation && !opts[:'name'].nil? && opts[:'name'].to_s.length > 255
|
73
|
+
fail ArgumentError, 'invalid value for "opts[:"name"]" when calling RateLimiterApi.create_rate_limiter, the character length must be smaller than or equal to 255.'
|
74
|
+
end
|
75
|
+
|
76
|
+
if @api_client.config.client_side_validation && !opts[:'name'].nil? && opts[:'name'].to_s.length < 1
|
77
|
+
fail ArgumentError, 'invalid value for "opts[:"name"]" when calling RateLimiterApi.create_rate_limiter, the character length must be great than or equal to 1.'
|
78
|
+
end
|
79
|
+
|
80
|
+
if @api_client.config.client_side_validation && !opts[:'uri_dictionary_name'].nil? && opts[:'uri_dictionary_name'].to_s.length > 255
|
81
|
+
fail ArgumentError, 'invalid value for "opts[:"uri_dictionary_name"]" when calling RateLimiterApi.create_rate_limiter, the character length must be smaller than or equal to 255.'
|
82
|
+
end
|
83
|
+
|
84
|
+
if @api_client.config.client_side_validation && !opts[:'uri_dictionary_name'].nil? && opts[:'uri_dictionary_name'].to_s.length < 1
|
85
|
+
fail ArgumentError, 'invalid value for "opts[:"uri_dictionary_name"]" when calling RateLimiterApi.create_rate_limiter, the character length must be great than or equal to 1.'
|
86
|
+
end
|
87
|
+
|
88
|
+
allowable_values = ["HEAD", "OPTIONS", "GET", "POST", "PUT", "PATCH", "DELETE", "TRACE"]
|
89
|
+
if @api_client.config.client_side_validation && opts[:'http_methods'] && !opts[:'http_methods'].all? { |item| allowable_values.include?(item) }
|
90
|
+
fail ArgumentError, "invalid value for \"http_methods\", must include one of #{allowable_values}"
|
91
|
+
end
|
92
|
+
if @api_client.config.client_side_validation && !opts[:'http_methods'].nil? && opts[:'http_methods'].length < 1
|
93
|
+
fail ArgumentError, 'invalid value for "opts[:"http_methods"]" when calling RateLimiterApi.create_rate_limiter, number of items must be greater than or equal to 1.'
|
94
|
+
end
|
95
|
+
|
96
|
+
if @api_client.config.client_side_validation && !opts[:'rps_limit'].nil? && opts[:'rps_limit'] > 10000
|
97
|
+
fail ArgumentError, 'invalid value for "opts[:"rps_limit"]" when calling RateLimiterApi.create_rate_limiter, must be smaller than or equal to 10000.'
|
98
|
+
end
|
99
|
+
|
100
|
+
if @api_client.config.client_side_validation && !opts[:'rps_limit'].nil? && opts[:'rps_limit'] < 10
|
101
|
+
fail ArgumentError, 'invalid value for "opts[:"rps_limit"]" when calling RateLimiterApi.create_rate_limiter, must be greater than or equal to 10.'
|
102
|
+
end
|
103
|
+
|
104
|
+
allowable_values = [1, 10, 60]
|
105
|
+
if @api_client.config.client_side_validation && opts[:'window_size'] && !allowable_values.include?(opts[:'window_size'])
|
106
|
+
fail ArgumentError, "invalid value for \"window_size\", must be one of #{allowable_values}"
|
107
|
+
end
|
108
|
+
if @api_client.config.client_side_validation && !opts[:'client_key'].nil? && opts[:'client_key'].length < 1
|
109
|
+
fail ArgumentError, 'invalid value for "opts[:"client_key"]" when calling RateLimiterApi.create_rate_limiter, number of items must be greater than or equal to 1.'
|
110
|
+
end
|
111
|
+
|
112
|
+
if @api_client.config.client_side_validation && !opts[:'penalty_box_duration'].nil? && opts[:'penalty_box_duration'] > 60
|
113
|
+
fail ArgumentError, 'invalid value for "opts[:"penalty_box_duration"]" when calling RateLimiterApi.create_rate_limiter, must be smaller than or equal to 60.'
|
114
|
+
end
|
115
|
+
|
116
|
+
if @api_client.config.client_side_validation && !opts[:'penalty_box_duration'].nil? && opts[:'penalty_box_duration'] < 1
|
117
|
+
fail ArgumentError, 'invalid value for "opts[:"penalty_box_duration"]" when calling RateLimiterApi.create_rate_limiter, must be greater than or equal to 1.'
|
118
|
+
end
|
119
|
+
|
120
|
+
allowable_values = ["response", "response_object", "log_only"]
|
121
|
+
if @api_client.config.client_side_validation && opts[:'action'] && !allowable_values.include?(opts[:'action'])
|
122
|
+
fail ArgumentError, "invalid value for \"action\", must be one of #{allowable_values}"
|
123
|
+
end
|
124
|
+
if @api_client.config.client_side_validation && !opts[:'action'].nil? && opts[:'action'].to_s.length < 1
|
125
|
+
fail ArgumentError, 'invalid value for "opts[:"action"]" when calling RateLimiterApi.create_rate_limiter, the character length must be great than or equal to 1.'
|
126
|
+
end
|
127
|
+
|
128
|
+
if @api_client.config.client_side_validation && !opts[:'response_object_name'].nil? && opts[:'response_object_name'].to_s.length > 255
|
129
|
+
fail ArgumentError, 'invalid value for "opts[:"response_object_name"]" when calling RateLimiterApi.create_rate_limiter, the character length must be smaller than or equal to 255.'
|
130
|
+
end
|
131
|
+
|
132
|
+
if @api_client.config.client_side_validation && !opts[:'response_object_name'].nil? && opts[:'response_object_name'].to_s.length < 1
|
133
|
+
fail ArgumentError, 'invalid value for "opts[:"response_object_name"]" when calling RateLimiterApi.create_rate_limiter, the character length must be great than or equal to 1.'
|
134
|
+
end
|
135
|
+
|
136
|
+
allowable_values = ["azureblob", "bigquery", "cloudfiles", "datadog", "digitalocean", "elasticsearch", "ftp", "gcs", "googleanalytics", "heroku", "honeycomb", "http", "https", "kafka", "kinesis", "logentries", "loggly", "logshuttle", "newrelic", "openstack", "papertrail", "pubsub", "s3", "scalyr", "sftp", "splunk", "stackdriver", "sumologic", "syslog"]
|
137
|
+
if @api_client.config.client_side_validation && opts[:'logger_type'] && !allowable_values.include?(opts[:'logger_type'])
|
138
|
+
fail ArgumentError, "invalid value for \"logger_type\", must be one of #{allowable_values}"
|
139
|
+
end
|
140
|
+
# resource path
|
141
|
+
local_var_path = '/service/{service_id}/version/{version_id}/rate-limiters'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))
|
142
|
+
|
143
|
+
# query parameters
|
144
|
+
query_params = opts[:query_params] || {}
|
145
|
+
|
146
|
+
# header parameters
|
147
|
+
header_params = opts[:header_params] || {}
|
148
|
+
# HTTP header 'Accept' (if needed)
|
149
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
150
|
+
# HTTP header 'Content-Type'
|
151
|
+
content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
152
|
+
if !content_type.nil?
|
153
|
+
header_params['Content-Type'] = content_type
|
154
|
+
end
|
155
|
+
|
156
|
+
# form parameters
|
157
|
+
form_params = opts[:form_params] || {}
|
158
|
+
form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
|
159
|
+
form_params['uri_dictionary_name'] = opts[:'uri_dictionary_name'] if !opts[:'uri_dictionary_name'].nil?
|
160
|
+
form_params['http_methods'] = @api_client.build_collection_param(opts[:'http_methods'], :csv) if !opts[:'http_methods'].nil?
|
161
|
+
form_params['rps_limit'] = opts[:'rps_limit'] if !opts[:'rps_limit'].nil?
|
162
|
+
form_params['window_size'] = opts[:'window_size'] if !opts[:'window_size'].nil?
|
163
|
+
form_params['client_key'] = @api_client.build_collection_param(opts[:'client_key'], :csv) if !opts[:'client_key'].nil?
|
164
|
+
form_params['penalty_box_duration'] = opts[:'penalty_box_duration'] if !opts[:'penalty_box_duration'].nil?
|
165
|
+
form_params['action'] = opts[:'action'] if !opts[:'action'].nil?
|
166
|
+
form_params['response_object_name'] = opts[:'response_object_name'] if !opts[:'response_object_name'].nil?
|
167
|
+
form_params['logger_type'] = opts[:'logger_type'] if !opts[:'logger_type'].nil?
|
168
|
+
form_params['feature_revision'] = opts[:'feature_revision'] if !opts[:'feature_revision'].nil?
|
169
|
+
|
170
|
+
# http body (model)
|
171
|
+
post_body = opts[:debug_body]
|
172
|
+
|
173
|
+
# return_type
|
174
|
+
return_type = opts[:debug_return_type] || 'RateLimiterResponse'
|
175
|
+
|
176
|
+
# auth_names
|
177
|
+
auth_names = opts[:debug_auth_names] || ['token']
|
178
|
+
|
179
|
+
new_options = opts.merge(
|
180
|
+
:operation => :"RateLimiterApi.create_rate_limiter",
|
181
|
+
:header_params => header_params,
|
182
|
+
:query_params => query_params,
|
183
|
+
:form_params => form_params,
|
184
|
+
:body => post_body,
|
185
|
+
:auth_names => auth_names,
|
186
|
+
:return_type => return_type
|
187
|
+
)
|
188
|
+
|
189
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
190
|
+
if @api_client.config.debugging
|
191
|
+
@api_client.config.logger.debug "API called: RateLimiterApi#create_rate_limiter\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
192
|
+
end
|
193
|
+
return data, status_code, headers
|
194
|
+
end
|
195
|
+
|
20
196
|
# Delete a rate limiter
|
21
197
|
# Delete a rate limiter by its ID.
|
22
198
|
# @option opts [String] :rate_limiter_id Alphanumeric string identifying the rate limiter. (required)
|
@@ -212,5 +388,174 @@ module Fastly
|
|
212
388
|
end
|
213
389
|
return data, status_code, headers
|
214
390
|
end
|
391
|
+
|
392
|
+
# Update a rate limiter
|
393
|
+
# Update a rate limiter by its ID.
|
394
|
+
# @option opts [String] :rate_limiter_id Alphanumeric string identifying the rate limiter. (required)
|
395
|
+
# @option opts [String] :name A human readable name for the rate limiting rule.
|
396
|
+
# @option opts [String] :uri_dictionary_name The name of an Edge Dictionary containing URIs as keys. If not defined or `null`, all origin URIs will be rate limited.
|
397
|
+
# @option opts [Array<String>] :http_methods Array of HTTP methods to apply rate limiting to.
|
398
|
+
# @option opts [Integer] :rps_limit Upper limit of requests per second allowed by the rate limiter.
|
399
|
+
# @option opts [Integer] :window_size Number of seconds during which the RPS limit must be exceeded in order to trigger a violation.
|
400
|
+
# @option opts [Array<String>] :client_key Array of VCL variables used to generate a counter key to identify a client. Example variables include `req.http.Fastly-Client-IP`, `req.http.User-Agent`, or a custom header like `req.http.API-Key`.
|
401
|
+
# @option opts [Integer] :penalty_box_duration Length of time in minutes that the rate limiter is in effect after the initial violation is detected.
|
402
|
+
# @option opts [String] :action The action to take when a rate limiter violation is detected.
|
403
|
+
# @option opts [String] :response_object_name Name of existing response object. Required if `action` is `response_object`. Note that the rate limiter response is only updated to reflect the response object content when saving the rate limiter configuration.
|
404
|
+
# @option opts [String] :logger_type Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries.
|
405
|
+
# @option opts [Integer] :feature_revision Revision number of the rate limiting feature implementation. Defaults to the most recent revision.
|
406
|
+
# @return [RateLimiterResponse]
|
407
|
+
def update_rate_limiter(opts = {})
|
408
|
+
data, _status_code, _headers = update_rate_limiter_with_http_info(opts)
|
409
|
+
data
|
410
|
+
end
|
411
|
+
|
412
|
+
# Update a rate limiter
|
413
|
+
# Update a rate limiter by its ID.
|
414
|
+
# @option opts [String] :rate_limiter_id Alphanumeric string identifying the rate limiter. (required)
|
415
|
+
# @option opts [String] :name A human readable name for the rate limiting rule.
|
416
|
+
# @option opts [String] :uri_dictionary_name The name of an Edge Dictionary containing URIs as keys. If not defined or `null`, all origin URIs will be rate limited.
|
417
|
+
# @option opts [Array<String>] :http_methods Array of HTTP methods to apply rate limiting to.
|
418
|
+
# @option opts [Integer] :rps_limit Upper limit of requests per second allowed by the rate limiter.
|
419
|
+
# @option opts [Integer] :window_size Number of seconds during which the RPS limit must be exceeded in order to trigger a violation.
|
420
|
+
# @option opts [Array<String>] :client_key Array of VCL variables used to generate a counter key to identify a client. Example variables include `req.http.Fastly-Client-IP`, `req.http.User-Agent`, or a custom header like `req.http.API-Key`.
|
421
|
+
# @option opts [Integer] :penalty_box_duration Length of time in minutes that the rate limiter is in effect after the initial violation is detected.
|
422
|
+
# @option opts [String] :action The action to take when a rate limiter violation is detected.
|
423
|
+
# @option opts [String] :response_object_name Name of existing response object. Required if `action` is `response_object`. Note that the rate limiter response is only updated to reflect the response object content when saving the rate limiter configuration.
|
424
|
+
# @option opts [String] :logger_type Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries.
|
425
|
+
# @option opts [Integer] :feature_revision Revision number of the rate limiting feature implementation. Defaults to the most recent revision.
|
426
|
+
# @return [Array<(RateLimiterResponse, Integer, Hash)>] RateLimiterResponse data, response status code and response headers
|
427
|
+
def update_rate_limiter_with_http_info(opts = {})
|
428
|
+
if @api_client.config.debugging
|
429
|
+
@api_client.config.logger.debug 'Calling API: RateLimiterApi.update_rate_limiter ...'
|
430
|
+
end
|
431
|
+
# unbox the parameters from the hash
|
432
|
+
rate_limiter_id = opts[:'rate_limiter_id']
|
433
|
+
# verify the required parameter 'rate_limiter_id' is set
|
434
|
+
if @api_client.config.client_side_validation && rate_limiter_id.nil?
|
435
|
+
fail ArgumentError, "Missing the required parameter 'rate_limiter_id' when calling RateLimiterApi.update_rate_limiter"
|
436
|
+
end
|
437
|
+
if @api_client.config.client_side_validation && !opts[:'name'].nil? && opts[:'name'].to_s.length > 255
|
438
|
+
fail ArgumentError, 'invalid value for "opts[:"name"]" when calling RateLimiterApi.update_rate_limiter, the character length must be smaller than or equal to 255.'
|
439
|
+
end
|
440
|
+
|
441
|
+
if @api_client.config.client_side_validation && !opts[:'name'].nil? && opts[:'name'].to_s.length < 1
|
442
|
+
fail ArgumentError, 'invalid value for "opts[:"name"]" when calling RateLimiterApi.update_rate_limiter, the character length must be great than or equal to 1.'
|
443
|
+
end
|
444
|
+
|
445
|
+
if @api_client.config.client_side_validation && !opts[:'uri_dictionary_name'].nil? && opts[:'uri_dictionary_name'].to_s.length > 255
|
446
|
+
fail ArgumentError, 'invalid value for "opts[:"uri_dictionary_name"]" when calling RateLimiterApi.update_rate_limiter, the character length must be smaller than or equal to 255.'
|
447
|
+
end
|
448
|
+
|
449
|
+
if @api_client.config.client_side_validation && !opts[:'uri_dictionary_name'].nil? && opts[:'uri_dictionary_name'].to_s.length < 1
|
450
|
+
fail ArgumentError, 'invalid value for "opts[:"uri_dictionary_name"]" when calling RateLimiterApi.update_rate_limiter, the character length must be great than or equal to 1.'
|
451
|
+
end
|
452
|
+
|
453
|
+
allowable_values = ["HEAD", "OPTIONS", "GET", "POST", "PUT", "PATCH", "DELETE", "TRACE"]
|
454
|
+
if @api_client.config.client_side_validation && opts[:'http_methods'] && !opts[:'http_methods'].all? { |item| allowable_values.include?(item) }
|
455
|
+
fail ArgumentError, "invalid value for \"http_methods\", must include one of #{allowable_values}"
|
456
|
+
end
|
457
|
+
if @api_client.config.client_side_validation && !opts[:'http_methods'].nil? && opts[:'http_methods'].length < 1
|
458
|
+
fail ArgumentError, 'invalid value for "opts[:"http_methods"]" when calling RateLimiterApi.update_rate_limiter, number of items must be greater than or equal to 1.'
|
459
|
+
end
|
460
|
+
|
461
|
+
if @api_client.config.client_side_validation && !opts[:'rps_limit'].nil? && opts[:'rps_limit'] > 10000
|
462
|
+
fail ArgumentError, 'invalid value for "opts[:"rps_limit"]" when calling RateLimiterApi.update_rate_limiter, must be smaller than or equal to 10000.'
|
463
|
+
end
|
464
|
+
|
465
|
+
if @api_client.config.client_side_validation && !opts[:'rps_limit'].nil? && opts[:'rps_limit'] < 10
|
466
|
+
fail ArgumentError, 'invalid value for "opts[:"rps_limit"]" when calling RateLimiterApi.update_rate_limiter, must be greater than or equal to 10.'
|
467
|
+
end
|
468
|
+
|
469
|
+
allowable_values = [1, 10, 60]
|
470
|
+
if @api_client.config.client_side_validation && opts[:'window_size'] && !allowable_values.include?(opts[:'window_size'])
|
471
|
+
fail ArgumentError, "invalid value for \"window_size\", must be one of #{allowable_values}"
|
472
|
+
end
|
473
|
+
if @api_client.config.client_side_validation && !opts[:'client_key'].nil? && opts[:'client_key'].length < 1
|
474
|
+
fail ArgumentError, 'invalid value for "opts[:"client_key"]" when calling RateLimiterApi.update_rate_limiter, number of items must be greater than or equal to 1.'
|
475
|
+
end
|
476
|
+
|
477
|
+
if @api_client.config.client_side_validation && !opts[:'penalty_box_duration'].nil? && opts[:'penalty_box_duration'] > 60
|
478
|
+
fail ArgumentError, 'invalid value for "opts[:"penalty_box_duration"]" when calling RateLimiterApi.update_rate_limiter, must be smaller than or equal to 60.'
|
479
|
+
end
|
480
|
+
|
481
|
+
if @api_client.config.client_side_validation && !opts[:'penalty_box_duration'].nil? && opts[:'penalty_box_duration'] < 1
|
482
|
+
fail ArgumentError, 'invalid value for "opts[:"penalty_box_duration"]" when calling RateLimiterApi.update_rate_limiter, must be greater than or equal to 1.'
|
483
|
+
end
|
484
|
+
|
485
|
+
allowable_values = ["response", "response_object", "log_only"]
|
486
|
+
if @api_client.config.client_side_validation && opts[:'action'] && !allowable_values.include?(opts[:'action'])
|
487
|
+
fail ArgumentError, "invalid value for \"action\", must be one of #{allowable_values}"
|
488
|
+
end
|
489
|
+
if @api_client.config.client_side_validation && !opts[:'action'].nil? && opts[:'action'].to_s.length < 1
|
490
|
+
fail ArgumentError, 'invalid value for "opts[:"action"]" when calling RateLimiterApi.update_rate_limiter, the character length must be great than or equal to 1.'
|
491
|
+
end
|
492
|
+
|
493
|
+
if @api_client.config.client_side_validation && !opts[:'response_object_name'].nil? && opts[:'response_object_name'].to_s.length > 255
|
494
|
+
fail ArgumentError, 'invalid value for "opts[:"response_object_name"]" when calling RateLimiterApi.update_rate_limiter, the character length must be smaller than or equal to 255.'
|
495
|
+
end
|
496
|
+
|
497
|
+
if @api_client.config.client_side_validation && !opts[:'response_object_name'].nil? && opts[:'response_object_name'].to_s.length < 1
|
498
|
+
fail ArgumentError, 'invalid value for "opts[:"response_object_name"]" when calling RateLimiterApi.update_rate_limiter, the character length must be great than or equal to 1.'
|
499
|
+
end
|
500
|
+
|
501
|
+
allowable_values = ["azureblob", "bigquery", "cloudfiles", "datadog", "digitalocean", "elasticsearch", "ftp", "gcs", "googleanalytics", "heroku", "honeycomb", "http", "https", "kafka", "kinesis", "logentries", "loggly", "logshuttle", "newrelic", "openstack", "papertrail", "pubsub", "s3", "scalyr", "sftp", "splunk", "stackdriver", "sumologic", "syslog"]
|
502
|
+
if @api_client.config.client_side_validation && opts[:'logger_type'] && !allowable_values.include?(opts[:'logger_type'])
|
503
|
+
fail ArgumentError, "invalid value for \"logger_type\", must be one of #{allowable_values}"
|
504
|
+
end
|
505
|
+
# resource path
|
506
|
+
local_var_path = '/rate-limiters/{rate_limiter_id}'.sub('{' + 'rate_limiter_id' + '}', CGI.escape(rate_limiter_id.to_s))
|
507
|
+
|
508
|
+
# query parameters
|
509
|
+
query_params = opts[:query_params] || {}
|
510
|
+
|
511
|
+
# header parameters
|
512
|
+
header_params = opts[:header_params] || {}
|
513
|
+
# HTTP header 'Accept' (if needed)
|
514
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
515
|
+
# HTTP header 'Content-Type'
|
516
|
+
content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
517
|
+
if !content_type.nil?
|
518
|
+
header_params['Content-Type'] = content_type
|
519
|
+
end
|
520
|
+
|
521
|
+
# form parameters
|
522
|
+
form_params = opts[:form_params] || {}
|
523
|
+
form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
|
524
|
+
form_params['uri_dictionary_name'] = opts[:'uri_dictionary_name'] if !opts[:'uri_dictionary_name'].nil?
|
525
|
+
form_params['http_methods'] = @api_client.build_collection_param(opts[:'http_methods'], :csv) if !opts[:'http_methods'].nil?
|
526
|
+
form_params['rps_limit'] = opts[:'rps_limit'] if !opts[:'rps_limit'].nil?
|
527
|
+
form_params['window_size'] = opts[:'window_size'] if !opts[:'window_size'].nil?
|
528
|
+
form_params['client_key'] = @api_client.build_collection_param(opts[:'client_key'], :csv) if !opts[:'client_key'].nil?
|
529
|
+
form_params['penalty_box_duration'] = opts[:'penalty_box_duration'] if !opts[:'penalty_box_duration'].nil?
|
530
|
+
form_params['action'] = opts[:'action'] if !opts[:'action'].nil?
|
531
|
+
form_params['response_object_name'] = opts[:'response_object_name'] if !opts[:'response_object_name'].nil?
|
532
|
+
form_params['logger_type'] = opts[:'logger_type'] if !opts[:'logger_type'].nil?
|
533
|
+
form_params['feature_revision'] = opts[:'feature_revision'] if !opts[:'feature_revision'].nil?
|
534
|
+
|
535
|
+
# http body (model)
|
536
|
+
post_body = opts[:debug_body]
|
537
|
+
|
538
|
+
# return_type
|
539
|
+
return_type = opts[:debug_return_type] || 'RateLimiterResponse'
|
540
|
+
|
541
|
+
# auth_names
|
542
|
+
auth_names = opts[:debug_auth_names] || ['token']
|
543
|
+
|
544
|
+
new_options = opts.merge(
|
545
|
+
:operation => :"RateLimiterApi.update_rate_limiter",
|
546
|
+
:header_params => header_params,
|
547
|
+
:query_params => query_params,
|
548
|
+
:form_params => form_params,
|
549
|
+
:body => post_body,
|
550
|
+
:auth_names => auth_names,
|
551
|
+
:return_type => return_type
|
552
|
+
)
|
553
|
+
|
554
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
555
|
+
if @api_client.config.debugging
|
556
|
+
@api_client.config.logger.debug "API called: RateLimiterApi#update_rate_limiter\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
557
|
+
end
|
558
|
+
return data, status_code, headers
|
559
|
+
end
|
215
560
|
end
|
216
561
|
end
|
data/lib/fastly/configuration.rb
CHANGED
@@ -2036,6 +2036,12 @@ module Fastly
|
|
2036
2036
|
description: "No description provided",
|
2037
2037
|
}
|
2038
2038
|
],
|
2039
|
+
"RateLimiterApi.create_rate_limiter": [
|
2040
|
+
{
|
2041
|
+
url: "https://api.fastly.com",
|
2042
|
+
description: "No description provided",
|
2043
|
+
}
|
2044
|
+
],
|
2039
2045
|
"RateLimiterApi.delete_rate_limiter": [
|
2040
2046
|
{
|
2041
2047
|
url: "https://api.fastly.com",
|
@@ -2054,6 +2060,12 @@ module Fastly
|
|
2054
2060
|
description: "No description provided",
|
2055
2061
|
}
|
2056
2062
|
],
|
2063
|
+
"RateLimiterApi.update_rate_limiter": [
|
2064
|
+
{
|
2065
|
+
url: "https://api.fastly.com",
|
2066
|
+
description: "No description provided",
|
2067
|
+
}
|
2068
|
+
],
|
2057
2069
|
"RealtimeApi.get_stats_last120_seconds": [
|
2058
2070
|
{
|
2059
2071
|
url: "https://rt.fastly.com",
|
@@ -112,9 +112,9 @@ module Fastly
|
|
112
112
|
:'created_at' => :'Time',
|
113
113
|
:'deleted_at' => :'Time',
|
114
114
|
:'updated_at' => :'Time',
|
115
|
-
:'id' => :'
|
116
|
-
:'user_id' => :'
|
117
|
-
:'customer_id' => :'
|
115
|
+
:'id' => :'ReadOnlyId',
|
116
|
+
:'user_id' => :'ReadOnlyUserId',
|
117
|
+
:'customer_id' => :'ReadOnlyCustomerId',
|
118
118
|
:'sudo_expires_at' => :'Time',
|
119
119
|
:'access_token' => :'String',
|
120
120
|
:'last_used_at' => :'Time',
|
@@ -127,9 +127,6 @@ module Fastly
|
|
127
127
|
Set.new([
|
128
128
|
:'deleted_at',
|
129
129
|
:'updated_at',
|
130
|
-
:'id',
|
131
|
-
:'user_id',
|
132
|
-
:'customer_id',
|
133
130
|
])
|
134
131
|
end
|
135
132
|
|
@@ -54,9 +54,9 @@ module Fastly
|
|
54
54
|
# Attribute type mapping.
|
55
55
|
def self.fastly_types
|
56
56
|
{
|
57
|
-
:'id' => :'
|
58
|
-
:'user_id' => :'
|
59
|
-
:'customer_id' => :'
|
57
|
+
:'id' => :'ReadOnlyId',
|
58
|
+
:'user_id' => :'ReadOnlyUserId',
|
59
|
+
:'customer_id' => :'ReadOnlyCustomerId',
|
60
60
|
:'sudo_expires_at' => :'Time',
|
61
61
|
:'created_at' => :'Time',
|
62
62
|
:'access_token' => :'String',
|
@@ -68,9 +68,6 @@ module Fastly
|
|
68
68
|
# List of attributes with nullable: true
|
69
69
|
def self.fastly_nullable
|
70
70
|
Set.new([
|
71
|
-
:'id',
|
72
|
-
:'user_id',
|
73
|
-
:'customer_id',
|
74
71
|
])
|
75
72
|
end
|
76
73
|
|
@@ -109,8 +109,8 @@ module Fastly
|
|
109
109
|
:'created_at' => :'String',
|
110
110
|
:'deleted_at' => :'Time',
|
111
111
|
:'updated_at' => :'Time',
|
112
|
-
:'id' => :'
|
113
|
-
:'customer_id' => :'
|
112
|
+
:'id' => :'ReadOnlyId',
|
113
|
+
:'customer_id' => :'ReadOnlyCustomerId',
|
114
114
|
:'ip' => :'String',
|
115
115
|
:'user_agent' => :'String',
|
116
116
|
:'sudo_expires_at' => :'String',
|
@@ -123,8 +123,6 @@ module Fastly
|
|
123
123
|
Set.new([
|
124
124
|
:'deleted_at',
|
125
125
|
:'updated_at',
|
126
|
-
:'id',
|
127
|
-
:'customer_id',
|
128
126
|
])
|
129
127
|
end
|
130
128
|
|
@@ -59,8 +59,8 @@ module Fastly
|
|
59
59
|
# Attribute type mapping.
|
60
60
|
def self.fastly_types
|
61
61
|
{
|
62
|
-
:'id' => :'
|
63
|
-
:'customer_id' => :'
|
62
|
+
:'id' => :'ReadOnlyId',
|
63
|
+
:'customer_id' => :'ReadOnlyCustomerId',
|
64
64
|
:'role' => :'String',
|
65
65
|
:'ip' => :'String',
|
66
66
|
:'user_agent' => :'String',
|
@@ -74,8 +74,6 @@ module Fastly
|
|
74
74
|
# List of attributes with nullable: true
|
75
75
|
def self.fastly_nullable
|
76
76
|
Set.new([
|
77
|
-
:'id',
|
78
|
-
:'customer_id',
|
79
77
|
])
|
80
78
|
end
|
81
79
|
|