fastly 7.1.1 → 7.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/Gemfile.lock +2 -2
  4. data/README.md +6 -5
  5. data/docs/HistoricalDdos.md +13 -0
  6. data/docs/HistoricalDdosMeta.md +13 -0
  7. data/docs/HistoricalFieldResultsAttributes.md +9 -0
  8. data/docs/KvStoreApi.md +15 -15
  9. data/docs/LoggingLogentriesAdditional.md +1 -1
  10. data/docs/LoggingLogentriesApi.md +4 -4
  11. data/docs/LoggingLogentriesResponse.md +1 -1
  12. data/docs/PlatformDdosDataItems.md +10 -0
  13. data/docs/PlatformDdosEntry.md +10 -0
  14. data/docs/PlatformDdosResponse.md +13 -0
  15. data/docs/PlatformDdosResponseAllOf.md +10 -0
  16. data/docs/RealtimeEntryAggregated.md +9 -0
  17. data/docs/RealtimeMeasurements.md +9 -0
  18. data/docs/Results.md +9 -0
  19. data/docs/SchemasSnippetResponse.md +1 -1
  20. data/docs/SchemasSnippetResponseCommon.md +15 -0
  21. data/docs/Snippet.md +1 -1
  22. data/docs/SnippetAllOf.md +10 -0
  23. data/docs/SnippetApi.md +6 -6
  24. data/docs/SnippetCommon.md +13 -0
  25. data/docs/SnippetResponse.md +1 -1
  26. data/docs/SnippetResponseCommon.md +15 -0
  27. data/docs/{SnippetResponseAllOf.md → SnippetResponseCommonAllOf.md} +1 -1
  28. data/docs/SnippetResponsePost.md +20 -0
  29. data/docs/SnippetWithDynamicNumber.md +14 -0
  30. data/docs/SnippetWithDynamicNumberAllOf.md +10 -0
  31. data/docs/ValuesDdos.md +15 -0
  32. data/docs/WholePlatformDdosHistoricalApi.md +56 -0
  33. data/lib/fastly/api/kv_store_api.rb +14 -14
  34. data/lib/fastly/api/logging_logentries_api.rb +4 -4
  35. data/lib/fastly/api/snippet_api.rb +17 -17
  36. data/lib/fastly/api/whole_platform_ddos_historical_api.rb +89 -0
  37. data/lib/fastly/configuration.rb +6 -0
  38. data/lib/fastly/models/historical_ddos.rb +249 -0
  39. data/lib/fastly/models/historical_ddos_meta.rb +248 -0
  40. data/lib/fastly/models/historical_field_results_attributes.rb +91 -1
  41. data/lib/fastly/models/logging_logentries_additional.rb +1 -1
  42. data/lib/fastly/models/logging_logentries_response.rb +1 -1
  43. data/lib/fastly/models/platform_ddos_data_items.rb +216 -0
  44. data/lib/fastly/models/platform_ddos_entry.rb +219 -0
  45. data/lib/fastly/models/platform_ddos_response.rb +257 -0
  46. data/lib/fastly/models/platform_ddos_response_all_of.rb +219 -0
  47. data/lib/fastly/models/realtime_entry_aggregated.rb +94 -4
  48. data/lib/fastly/models/realtime_measurements.rb +94 -4
  49. data/lib/fastly/models/results.rb +94 -4
  50. data/lib/fastly/models/schemas_snippet_response.rb +25 -26
  51. data/lib/fastly/models/schemas_snippet_response_common.rb +276 -0
  52. data/lib/fastly/models/snippet.rb +34 -26
  53. data/lib/fastly/models/snippet_all_of.rb +251 -0
  54. data/lib/fastly/models/snippet_common.rb +283 -0
  55. data/lib/fastly/models/snippet_response.rb +24 -25
  56. data/lib/fastly/models/snippet_response_common.rb +276 -0
  57. data/lib/fastly/models/{snippet_response_all_of.rb → snippet_response_common_all_of.rb} +3 -3
  58. data/lib/fastly/models/snippet_response_post.rb +374 -0
  59. data/lib/fastly/models/snippet_with_dynamic_number.rb +313 -0
  60. data/lib/fastly/models/snippet_with_dynamic_number_all_of.rb +251 -0
  61. data/lib/fastly/models/values_ddos.rb +268 -0
  62. data/lib/fastly/version.rb +1 -1
  63. data/lib/fastly.rb +16 -1
  64. data/sig.json +1 -1
  65. metadata +34 -4
@@ -0,0 +1,56 @@
1
+ # Fastly::WholePlatformDdosHistoricalApi
2
+
3
+
4
+ ```ruby
5
+ require 'fastly'
6
+ api_instance = Fastly::WholePlatformDdosHistoricalApi.new
7
+ ```
8
+
9
+ ## Methods
10
+
11
+ | Method | HTTP request | Description |
12
+ | ------ | ------------ | ----------- |
13
+ | [**get_platform_ddos_historical**](WholePlatformDdosHistoricalApi.md#get_platform_ddos_historical) | **GET** /metrics/platform/ddos | Get historical DDoS metrics for the entire Fastly platform |
14
+
15
+
16
+ ## `get_platform_ddos_historical()`
17
+
18
+ ```ruby
19
+ get_platform_ddos_historical(opts): <PlatformDdosResponse> # Get historical DDoS metrics for the entire Fastly platform
20
+ ```
21
+
22
+ Fetches historical DDoS metrics for the entire Fastly platform.
23
+
24
+ ### Examples
25
+
26
+ ```ruby
27
+ api_instance = Fastly::WholePlatformDdosHistoricalApi.new
28
+ opts = {
29
+ start: '2021-08-01T00:00:00.000Z', # String | A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the inclusive start of the query time range. If not provided, a default is chosen based on the provided `downsample` value.
30
+ _end: '2020-08-02T00:00:00.000Z', # String | A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the exclusive end of the query time range. If not provided, a default is chosen based on the provided `downsample` value.
31
+ downsample: 'hour', # String | Duration of sample windows.
32
+ }
33
+
34
+ begin
35
+ # Get historical DDoS metrics for the entire Fastly platform
36
+ result = api_instance.get_platform_ddos_historical(opts)
37
+ p result
38
+ rescue Fastly::ApiError => e
39
+ puts "Error when calling WholePlatformDdosHistoricalApi->get_platform_ddos_historical: #{e}"
40
+ end
41
+ ```
42
+
43
+ ### Options
44
+
45
+ | Name | Type | Description | Notes |
46
+ | ---- | ---- | ----------- | ----- |
47
+ | **start** | **String** | A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the inclusive start of the query time range. If not provided, a default is chosen based on the provided `downsample` value. | [optional] |
48
+ | **_end** | **String** | A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the exclusive end of the query time range. If not provided, a default is chosen based on the provided `downsample` value. | [optional] |
49
+ | **downsample** | **String** | Duration of sample windows. | [optional][default to &#39;hour&#39;] |
50
+
51
+ ### Return type
52
+
53
+ [**PlatformDdosResponse**](PlatformDdosResponse.md)
54
+
55
+ [[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
56
+ [[Back to README]](../../README.md)
@@ -17,8 +17,8 @@ module Fastly
17
17
  def initialize(api_client = ApiClient.default)
18
18
  @api_client = api_client
19
19
  end
20
- # Create an kv store.
21
- # Create a new kv store.
20
+ # Create a KV store.
21
+ # Create a new KV store.
22
22
  # @option opts [String] :location
23
23
  # @option opts [Store] :store
24
24
  # @return [StoreResponse]
@@ -27,8 +27,8 @@ module Fastly
27
27
  data
28
28
  end
29
29
 
30
- # Create an kv store.
31
- # Create a new kv store.
30
+ # Create a KV store.
31
+ # Create a new KV store.
32
32
  # @option opts [String] :location
33
33
  # @option opts [Store] :store
34
34
  # @return [Array<(StoreResponse, Integer, Hash)>] StoreResponse data, response status code and response headers
@@ -83,8 +83,8 @@ module Fastly
83
83
  return data, status_code, headers
84
84
  end
85
85
 
86
- # Delete an kv store.
87
- # An kv store must be empty before it can be deleted. Deleting an kv store that still contains keys will result in a `409` (Conflict).
86
+ # Delete a KV store.
87
+ # A KV store must be empty before it can be deleted. Deleting a KV store that still contains keys will result in a `409` (Conflict).
88
88
  # @option opts [String] :store_id (required)
89
89
  # @return [nil]
90
90
  def delete_store(opts = {})
@@ -92,8 +92,8 @@ module Fastly
92
92
  nil
93
93
  end
94
94
 
95
- # Delete an kv store.
96
- # An kv store must be empty before it can be deleted. Deleting an kv store that still contains keys will result in a &#x60;409&#x60; (Conflict).
95
+ # Delete a KV store.
96
+ # A KV store must be empty before it can be deleted. Deleting a KV store that still contains keys will result in a &#x60;409&#x60; (Conflict).
97
97
  # @option opts [String] :store_id (required)
98
98
  # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
99
99
  def delete_store_with_http_info(opts = {})
@@ -144,8 +144,8 @@ module Fastly
144
144
  return data, status_code, headers
145
145
  end
146
146
 
147
- # Describe an kv store.
148
- # Get an kv store by ID.
147
+ # Describe a KV store.
148
+ # Get a KV store by ID.
149
149
  # @option opts [String] :store_id (required)
150
150
  # @return [StoreResponse]
151
151
  def get_store(opts = {})
@@ -153,8 +153,8 @@ module Fastly
153
153
  data
154
154
  end
155
155
 
156
- # Describe an kv store.
157
- # Get an kv store by ID.
156
+ # Describe a KV store.
157
+ # Get a KV store by ID.
158
158
  # @option opts [String] :store_id (required)
159
159
  # @return [Array<(StoreResponse, Integer, Hash)>] StoreResponse data, response status code and response headers
160
160
  def get_store_with_http_info(opts = {})
@@ -207,7 +207,7 @@ module Fastly
207
207
  return data, status_code, headers
208
208
  end
209
209
 
210
- # List kv stores.
210
+ # List KV stores.
211
211
  # Get all stores for a given customer.
212
212
  # @option opts [String] :cursor
213
213
  # @option opts [Integer] :limit (default to 100)
@@ -217,7 +217,7 @@ module Fastly
217
217
  data
218
218
  end
219
219
 
220
- # List kv stores.
220
+ # List KV stores.
221
221
  # Get all stores for a given customer.
222
222
  # @option opts [String] :cursor
223
223
  # @option opts [Integer] :limit (default to 100)
@@ -27,7 +27,7 @@ module Fastly
27
27
  # @option opts [String] :format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (default to '%h %l %u %t \"%r\" %&gt;s %b')
28
28
  # @option opts [Integer] :format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in &#x60;vcl_log&#x60; if &#x60;format_version&#x60; is set to &#x60;2&#x60; and in &#x60;vcl_deliver&#x60; if &#x60;format_version&#x60; is set to &#x60;1&#x60;. (default to FORMAT_VERSION::v2)
29
29
  # @option opts [Integer] :port The port number. (default to 20000)
30
- # @option opts [String] :token Use token based authentication ([https://logentries.com/doc/input-token/](https://logentries.com/doc/input-token/)).
30
+ # @option opts [String] :token Use token based authentication.
31
31
  # @option opts [LoggingUseTls] :use_tls (default to LoggingUseTls::no_tls)
32
32
  # @option opts [String] :region The region to which to stream logs.
33
33
  # @return [LoggingLogentriesResponse]
@@ -46,7 +46,7 @@ module Fastly
46
46
  # @option opts [String] :format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (default to '%h %l %u %t \"%r\" %&gt;s %b')
47
47
  # @option opts [Integer] :format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in &#x60;vcl_log&#x60; if &#x60;format_version&#x60; is set to &#x60;2&#x60; and in &#x60;vcl_deliver&#x60; if &#x60;format_version&#x60; is set to &#x60;1&#x60;. (default to FORMAT_VERSION::v2)
48
48
  # @option opts [Integer] :port The port number. (default to 20000)
49
- # @option opts [String] :token Use token based authentication ([https://logentries.com/doc/input-token/](https://logentries.com/doc/input-token/)).
49
+ # @option opts [String] :token Use token based authentication.
50
50
  # @option opts [LoggingUseTls] :use_tls (default to LoggingUseTls::no_tls)
51
51
  # @option opts [String] :region The region to which to stream logs.
52
52
  # @return [Array<(LoggingLogentriesResponse, Integer, Hash)>] LoggingLogentriesResponse data, response status code and response headers
@@ -366,7 +366,7 @@ module Fastly
366
366
  # @option opts [String] :format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (default to '%h %l %u %t \"%r\" %&gt;s %b')
367
367
  # @option opts [Integer] :format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in &#x60;vcl_log&#x60; if &#x60;format_version&#x60; is set to &#x60;2&#x60; and in &#x60;vcl_deliver&#x60; if &#x60;format_version&#x60; is set to &#x60;1&#x60;. (default to FORMAT_VERSION::v2)
368
368
  # @option opts [Integer] :port The port number. (default to 20000)
369
- # @option opts [String] :token Use token based authentication ([https://logentries.com/doc/input-token/](https://logentries.com/doc/input-token/)).
369
+ # @option opts [String] :token Use token based authentication.
370
370
  # @option opts [LoggingUseTls] :use_tls (default to LoggingUseTls::no_tls)
371
371
  # @option opts [String] :region The region to which to stream logs.
372
372
  # @return [LoggingLogentriesResponse]
@@ -386,7 +386,7 @@ module Fastly
386
386
  # @option opts [String] :format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (default to '%h %l %u %t \"%r\" %&gt;s %b')
387
387
  # @option opts [Integer] :format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in &#x60;vcl_log&#x60; if &#x60;format_version&#x60; is set to &#x60;2&#x60; and in &#x60;vcl_deliver&#x60; if &#x60;format_version&#x60; is set to &#x60;1&#x60;. (default to FORMAT_VERSION::v2)
388
388
  # @option opts [Integer] :port The port number. (default to 20000)
389
- # @option opts [String] :token Use token based authentication ([https://logentries.com/doc/input-token/](https://logentries.com/doc/input-token/)).
389
+ # @option opts [String] :token Use token based authentication.
390
390
  # @option opts [LoggingUseTls] :use_tls (default to LoggingUseTls::no_tls)
391
391
  # @option opts [String] :region The region to which to stream logs.
392
392
  # @return [Array<(LoggingLogentriesResponse, Integer, Hash)>] LoggingLogentriesResponse data, response status code and response headers
@@ -22,11 +22,11 @@ module Fastly
22
22
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
23
23
  # @option opts [Integer] :version_id Integer identifying a service version. (required)
24
24
  # @option opts [String] :name The name for the snippet.
25
- # @option opts [String] :dynamic Sets the snippet version.
26
25
  # @option opts [String] :type The location in generated VCL where the snippet should be placed.
27
26
  # @option opts [String] :content The VCL code that specifies exactly what the snippet does.
28
27
  # @option opts [String] :priority Priority determines execution order. Lower numbers execute first. (default to '100')
29
- # @return [SnippetResponse]
28
+ # @option opts [String] :dynamic Sets the snippet version.
29
+ # @return [SnippetResponsePost]
30
30
  def create_snippet(opts = {})
31
31
  data, _status_code, _headers = create_snippet_with_http_info(opts)
32
32
  data
@@ -37,11 +37,11 @@ module Fastly
37
37
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
38
38
  # @option opts [Integer] :version_id Integer identifying a service version. (required)
39
39
  # @option opts [String] :name The name for the snippet.
40
- # @option opts [String] :dynamic Sets the snippet version.
41
40
  # @option opts [String] :type The location in generated VCL where the snippet should be placed.
42
41
  # @option opts [String] :content The VCL code that specifies exactly what the snippet does.
43
42
  # @option opts [String] :priority Priority determines execution order. Lower numbers execute first. (default to '100')
44
- # @return [Array<(SnippetResponse, Integer, Hash)>] SnippetResponse data, response status code and response headers
43
+ # @option opts [String] :dynamic Sets the snippet version.
44
+ # @return [Array<(SnippetResponsePost, Integer, Hash)>] SnippetResponsePost data, response status code and response headers
45
45
  def create_snippet_with_http_info(opts = {})
46
46
  if @api_client.config.debugging
47
47
  @api_client.config.logger.debug 'Calling API: SnippetApi.create_snippet ...'
@@ -57,14 +57,14 @@ module Fastly
57
57
  if @api_client.config.client_side_validation && version_id.nil?
58
58
  fail ArgumentError, "Missing the required parameter 'version_id' when calling SnippetApi.create_snippet"
59
59
  end
60
- allowable_values = ["0", "1"]
61
- if @api_client.config.client_side_validation && opts[:'dynamic'] && !allowable_values.include?(opts[:'dynamic'])
62
- fail ArgumentError, "invalid value for \"dynamic\", must be one of #{allowable_values}"
63
- end
64
60
  allowable_values = ["init", "recv", "hash", "hit", "miss", "pass", "fetch", "error", "deliver", "log", "none"]
65
61
  if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
66
62
  fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
67
63
  end
64
+ allowable_values = ["0", "1"]
65
+ if @api_client.config.client_side_validation && opts[:'dynamic'] && !allowable_values.include?(opts[:'dynamic'])
66
+ fail ArgumentError, "invalid value for \"dynamic\", must be one of #{allowable_values}"
67
+ end
68
68
  # resource path
69
69
  local_var_path = '/service/{service_id}/version/{version_id}/snippet'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))
70
70
 
@@ -84,16 +84,16 @@ module Fastly
84
84
  # form parameters
85
85
  form_params = opts[:form_params] || {}
86
86
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
87
- form_params['dynamic'] = opts[:'dynamic'] if !opts[:'dynamic'].nil?
88
87
  form_params['type'] = opts[:'type'] if !opts[:'type'].nil?
89
88
  form_params['content'] = opts[:'content'] if !opts[:'content'].nil?
90
89
  form_params['priority'] = opts[:'priority'] if !opts[:'priority'].nil?
90
+ form_params['dynamic'] = opts[:'dynamic'] if !opts[:'dynamic'].nil?
91
91
 
92
92
  # http body (model)
93
93
  post_body = opts[:debug_body]
94
94
 
95
95
  # return_type
96
- return_type = opts[:debug_return_type] || 'SnippetResponse'
96
+ return_type = opts[:debug_return_type] || 'SnippetResponsePost'
97
97
 
98
98
  # auth_names
99
99
  auth_names = opts[:debug_auth_names] || ['token']
@@ -496,10 +496,10 @@ module Fastly
496
496
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
497
497
  # @option opts [String] :snippet_id Alphanumeric string identifying a VCL Snippet. (required)
498
498
  # @option opts [String] :name The name for the snippet.
499
- # @option opts [String] :dynamic Sets the snippet version.
500
499
  # @option opts [String] :type The location in generated VCL where the snippet should be placed.
501
500
  # @option opts [String] :content The VCL code that specifies exactly what the snippet does.
502
501
  # @option opts [String] :priority Priority determines execution order. Lower numbers execute first. (default to '100')
502
+ # @option opts [String] :dynamic Sets the snippet version.
503
503
  # @return [SnippetResponse]
504
504
  def update_snippet_dynamic(opts = {})
505
505
  data, _status_code, _headers = update_snippet_dynamic_with_http_info(opts)
@@ -511,10 +511,10 @@ module Fastly
511
511
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
512
512
  # @option opts [String] :snippet_id Alphanumeric string identifying a VCL Snippet. (required)
513
513
  # @option opts [String] :name The name for the snippet.
514
- # @option opts [String] :dynamic Sets the snippet version.
515
514
  # @option opts [String] :type The location in generated VCL where the snippet should be placed.
516
515
  # @option opts [String] :content The VCL code that specifies exactly what the snippet does.
517
516
  # @option opts [String] :priority Priority determines execution order. Lower numbers execute first. (default to '100')
517
+ # @option opts [String] :dynamic Sets the snippet version.
518
518
  # @return [Array<(SnippetResponse, Integer, Hash)>] SnippetResponse data, response status code and response headers
519
519
  def update_snippet_dynamic_with_http_info(opts = {})
520
520
  if @api_client.config.debugging
@@ -531,14 +531,14 @@ module Fastly
531
531
  if @api_client.config.client_side_validation && snippet_id.nil?
532
532
  fail ArgumentError, "Missing the required parameter 'snippet_id' when calling SnippetApi.update_snippet_dynamic"
533
533
  end
534
- allowable_values = ["0", "1"]
535
- if @api_client.config.client_side_validation && opts[:'dynamic'] && !allowable_values.include?(opts[:'dynamic'])
536
- fail ArgumentError, "invalid value for \"dynamic\", must be one of #{allowable_values}"
537
- end
538
534
  allowable_values = ["init", "recv", "hash", "hit", "miss", "pass", "fetch", "error", "deliver", "log", "none"]
539
535
  if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
540
536
  fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
541
537
  end
538
+ allowable_values = ["0", "1"]
539
+ if @api_client.config.client_side_validation && opts[:'dynamic'] && !allowable_values.include?(opts[:'dynamic'])
540
+ fail ArgumentError, "invalid value for \"dynamic\", must be one of #{allowable_values}"
541
+ end
542
542
  # resource path
543
543
  local_var_path = '/service/{service_id}/snippet/{snippet_id}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'snippet_id' + '}', CGI.escape(snippet_id.to_s))
544
544
 
@@ -558,10 +558,10 @@ module Fastly
558
558
  # form parameters
559
559
  form_params = opts[:form_params] || {}
560
560
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
561
- form_params['dynamic'] = opts[:'dynamic'] if !opts[:'dynamic'].nil?
562
561
  form_params['type'] = opts[:'type'] if !opts[:'type'].nil?
563
562
  form_params['content'] = opts[:'content'] if !opts[:'content'].nil?
564
563
  form_params['priority'] = opts[:'priority'] if !opts[:'priority'].nil?
564
+ form_params['dynamic'] = opts[:'dynamic'] if !opts[:'dynamic'].nil?
565
565
 
566
566
  # http body (model)
567
567
  post_body = opts[:debug_body]
@@ -0,0 +1,89 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://developer.fastly.com/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'cgi'
12
+
13
+ module Fastly
14
+ class WholePlatformDdosHistoricalApi
15
+ attr_accessor :api_client
16
+
17
+ def initialize(api_client = ApiClient.default)
18
+ @api_client = api_client
19
+ end
20
+ # Get historical DDoS metrics for the entire Fastly platform
21
+ # Fetches historical DDoS metrics for the entire Fastly platform.
22
+ # @option opts [String] :start A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the inclusive start of the query time range. If not provided, a default is chosen based on the provided &#x60;downsample&#x60; value.
23
+ # @option opts [String] :_end A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the exclusive end of the query time range. If not provided, a default is chosen based on the provided &#x60;downsample&#x60; value.
24
+ # @option opts [String] :downsample Duration of sample windows. (default to 'hour')
25
+ # @return [PlatformDdosResponse]
26
+ def get_platform_ddos_historical(opts = {})
27
+ data, _status_code, _headers = get_platform_ddos_historical_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Get historical DDoS metrics for the entire Fastly platform
32
+ # Fetches historical DDoS metrics for the entire Fastly platform.
33
+ # @option opts [String] :start A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the inclusive start of the query time range. If not provided, a default is chosen based on the provided &#x60;downsample&#x60; value.
34
+ # @option opts [String] :_end A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the exclusive end of the query time range. If not provided, a default is chosen based on the provided &#x60;downsample&#x60; value.
35
+ # @option opts [String] :downsample Duration of sample windows. (default to 'hour')
36
+ # @return [Array<(PlatformDdosResponse, Integer, Hash)>] PlatformDdosResponse data, response status code and response headers
37
+ def get_platform_ddos_historical_with_http_info(opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: WholePlatformDdosHistoricalApi.get_platform_ddos_historical ...'
40
+ end
41
+ # unbox the parameters from the hash
42
+ allowable_values = ["hour", "day"]
43
+ if @api_client.config.client_side_validation && opts[:'downsample'] && !allowable_values.include?(opts[:'downsample'])
44
+ fail ArgumentError, "invalid value for \"downsample\", must be one of #{allowable_values}"
45
+ end
46
+ # resource path
47
+ local_var_path = '/metrics/platform/ddos'
48
+
49
+ # query parameters
50
+ query_params = opts[:query_params] || {}
51
+ query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
52
+ query_params[:'end'] = opts[:'_end'] if !opts[:'_end'].nil?
53
+ query_params[:'downsample'] = opts[:'downsample'] if !opts[:'downsample'].nil?
54
+
55
+ # header parameters
56
+ header_params = opts[:header_params] || {}
57
+ # HTTP header 'Accept' (if needed)
58
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
59
+
60
+ # form parameters
61
+ form_params = opts[:form_params] || {}
62
+
63
+ # http body (model)
64
+ post_body = opts[:debug_body]
65
+
66
+ # return_type
67
+ return_type = opts[:debug_return_type] || 'PlatformDdosResponse'
68
+
69
+ # auth_names
70
+ auth_names = opts[:debug_auth_names] || ['token']
71
+
72
+ new_options = opts.merge(
73
+ :operation => :"WholePlatformDdosHistoricalApi.get_platform_ddos_historical",
74
+ :header_params => header_params,
75
+ :query_params => query_params,
76
+ :form_params => form_params,
77
+ :body => post_body,
78
+ :auth_names => auth_names,
79
+ :return_type => return_type
80
+ )
81
+
82
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
83
+ if @api_client.config.debugging
84
+ @api_client.config.logger.debug "API called: WholePlatformDdosHistoricalApi#get_platform_ddos_historical\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
85
+ end
86
+ return data, status_code, headers
87
+ end
88
+ end
89
+ end
@@ -3440,6 +3440,12 @@ module Fastly
3440
3440
  description: "No description provided",
3441
3441
  }
3442
3442
  ],
3443
+ "WholePlatformDdosHistoricalApi.get_platform_ddos_historical": [
3444
+ {
3445
+ url: "https://api.fastly.com",
3446
+ description: "No description provided",
3447
+ }
3448
+ ],
3443
3449
  }
3444
3450
  end
3445
3451
 
@@ -0,0 +1,249 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://developer.fastly.com/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Fastly
15
+ class HistoricalDdos
16
+ # Whether or not we were able to successfully execute the query.
17
+ attr_accessor :status
18
+
19
+ attr_accessor :meta
20
+
21
+ # If the query was not successful, this will provide a string that explains why.
22
+ attr_accessor :msg
23
+
24
+ # A list of [entries](#entry-data-model).
25
+ attr_accessor :data
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'status' => :'status',
31
+ :'meta' => :'meta',
32
+ :'msg' => :'msg',
33
+ :'data' => :'data'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.fastly_types
44
+ {
45
+ :'status' => :'String',
46
+ :'meta' => :'HistoricalDdosMeta',
47
+ :'msg' => :'String',
48
+ :'data' => :'Array<PlatformDdosDataItems>'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.fastly_nullable
54
+ Set.new([
55
+ :'msg',
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::HistoricalDdos` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::HistoricalDdos`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'status')
75
+ self.status = attributes[:'status']
76
+ end
77
+
78
+ if attributes.key?(:'meta')
79
+ self.meta = attributes[:'meta']
80
+ end
81
+
82
+ if attributes.key?(:'msg')
83
+ self.msg = attributes[:'msg']
84
+ end
85
+
86
+ if attributes.key?(:'data')
87
+ if (value = attributes[:'data']).is_a?(Array)
88
+ self.data = value
89
+ end
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ status == o.status &&
112
+ meta == o.meta &&
113
+ msg == o.msg &&
114
+ data == o.data
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Integer] Hash code
125
+ def hash
126
+ [status, meta, msg, data].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def self.build_from_hash(attributes)
133
+ new.build_from_hash(attributes)
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ self.class.fastly_types.each_pair do |key, type|
142
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
143
+ self.send("#{key}=", nil)
144
+ elsif type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ end
153
+ end
154
+
155
+ self
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def _deserialize(type, value)
163
+ case type.to_sym
164
+ when :Time
165
+ Time.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ # models (e.g. Pet) or oneOf
196
+ klass = Fastly.const_get(type)
197
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.fastly_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+
249
+ end