fastly 13.1.0 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/Gemfile.lock +4 -4
  4. data/README.md +16 -4
  5. data/docs/AttackReport.md +19 -0
  6. data/docs/AttackSignal.md +12 -0
  7. data/docs/AttackSource.md +13 -0
  8. data/docs/Backend.md +4 -4
  9. data/docs/BackendApi.md +10 -10
  10. data/docs/BackendResponse.md +4 -4
  11. data/docs/DdosProtectionApi.md +40 -0
  12. data/docs/DdosProtectionAttributeStats.md +1 -1
  13. data/docs/DdosProtectionInvalidRequest.md +13 -0
  14. data/docs/{LogTimeseriesResultDimensions.md → DdosProtectionNotAuthorized.md} +3 -2
  15. data/docs/DdosProtectionRule.md +1 -1
  16. data/docs/DdosProtectionRuleAllOf.md +1 -1
  17. data/docs/DdosProtectionRulePatch.md +10 -0
  18. data/docs/HistoricalApi.md +2 -0
  19. data/docs/KvStoreApi.md +2 -0
  20. data/docs/ListAttackReport.md +11 -0
  21. data/docs/{DdosProtectionTrafficAttribute.md → ListAttackReportMeta.md} +2 -1
  22. data/docs/{DdosProtectionAction.md → ListSignalReport.md} +2 -1
  23. data/docs/LogExplorerApi.md +1 -1
  24. data/docs/NgwafReportsApi.md +99 -0
  25. data/docs/ObservabilityTimeseriesApi.md +67 -0
  26. data/docs/PoolApi.md +4 -4
  27. data/docs/PoolResponse.md +1 -1
  28. data/docs/PoolResponseCommon.md +1 -1
  29. data/docs/PoolResponsePost.md +1 -1
  30. data/docs/SignalReport.md +13 -0
  31. data/docs/TimeseriesGetResponse.md +11 -0
  32. data/docs/TimeseriesMeta.md +13 -0
  33. data/docs/TimeseriesResult.md +11 -0
  34. data/docs/TlsSubscriptionsApi.md +0 -2
  35. data/docs/TopWorkspace.md +12 -0
  36. data/lib/fastly/api/backend_api.rb +16 -16
  37. data/lib/fastly/api/ddos_protection_api.rb +70 -0
  38. data/lib/fastly/api/historical_api.rb +3 -0
  39. data/lib/fastly/api/kv_store_api.rb +3 -0
  40. data/lib/fastly/api/ngwaf_reports_api.rb +161 -0
  41. data/lib/fastly/api/{observability_timeseries_for_logs_api.rb → observability_timeseries_api.rb} +38 -43
  42. data/lib/fastly/api/pool_api.rb +4 -4
  43. data/lib/fastly/api/tls_subscriptions_api.rb +0 -3
  44. data/lib/fastly/configuration.rb +19 -1
  45. data/lib/fastly/models/attack_report.rb +359 -0
  46. data/lib/fastly/models/attack_signal.rb +252 -0
  47. data/lib/fastly/models/attack_source.rb +267 -0
  48. data/lib/fastly/models/backend.rb +7 -1
  49. data/lib/fastly/models/backend_response.rb +7 -1
  50. data/lib/fastly/models/ddos_protection_attribute_stats.rb +2 -1
  51. data/lib/fastly/models/ddos_protection_invalid_request.rb +309 -0
  52. data/lib/fastly/models/{log_timeseries_filter_field_item.rb → ddos_protection_not_authorized.rb} +24 -36
  53. data/lib/fastly/models/ddos_protection_rule.rb +2 -1
  54. data/lib/fastly/models/ddos_protection_rule_all_of.rb +2 -1
  55. data/lib/fastly/models/ddos_protection_rule_patch.rb +219 -0
  56. data/lib/fastly/models/{log_timeseries_get_response.rb → list_attack_report.rb} +5 -5
  57. data/lib/fastly/models/list_attack_report_meta.rb +218 -0
  58. data/lib/fastly/models/{log_timeseries_result_dimensions.rb → list_signal_report.rb} +12 -10
  59. data/lib/fastly/models/pool_response.rb +1 -1
  60. data/lib/fastly/models/pool_response_common.rb +1 -1
  61. data/lib/fastly/models/pool_response_post.rb +1 -1
  62. data/lib/fastly/models/signal_report.rb +249 -0
  63. data/lib/fastly/models/{log_timeseries_get_response_meta_filters.rb → timeseries_get_response.rb} +20 -13
  64. data/lib/fastly/models/{log_timeseries_get_response_meta.rb → timeseries_meta.rb} +23 -32
  65. data/lib/fastly/models/{log_timeseries_result.rb → timeseries_result.rb} +9 -5
  66. data/lib/fastly/models/top_workspace.rb +238 -0
  67. data/lib/fastly/version.rb +1 -1
  68. data/lib/fastly.rb +16 -10
  69. data/sig.json +1 -1
  70. metadata +34 -22
  71. data/docs/LogTimeseriesFilterFieldItem.md +0 -12
  72. data/docs/LogTimeseriesGetResponse.md +0 -11
  73. data/docs/LogTimeseriesGetResponseMeta.md +0 -14
  74. data/docs/LogTimeseriesGetResponseMetaFilters.md +0 -10
  75. data/docs/LogTimeseriesResult.md +0 -11
  76. data/docs/LogTimeseriesValueField.md +0 -59
  77. data/docs/ObservabilityTimeseriesForLogsApi.md +0 -67
  78. data/lib/fastly/models/ddos_protection_action.rb +0 -37
  79. data/lib/fastly/models/ddos_protection_traffic_attribute.rb +0 -40
  80. data/lib/fastly/models/log_timeseries_value_field.rb +0 -108
@@ -11,76 +11,71 @@ Contact: oss@fastly.com
11
11
  require 'cgi'
12
12
 
13
13
  module Fastly
14
- class ObservabilityTimeseriesForLogsApi
14
+ class ObservabilityTimeseriesApi
15
15
  attr_accessor :api_client
16
16
 
17
17
  def initialize(api_client = ApiClient.default)
18
18
  @api_client = api_client
19
19
  end
20
- # Retrieve log data as time series
21
- # Retrieves log data as time series.
20
+ # Retrieve observability data as a time series
21
+ # Retrieves observability data as a time series.
22
22
  # @option opts [String] :source (required)
23
- # @option opts [String] :service_id (required)
24
- # @option opts [String] :start (required)
25
- # @option opts [String] :_end (required)
23
+ # @option opts [String] :from (required)
24
+ # @option opts [String] :to (required)
26
25
  # @option opts [String] :granularity (required)
27
26
  # @option opts [String] :series (required)
27
+ # @option opts [String] :dimensions
28
28
  # @option opts [String] :filter
29
- # @return [LogTimeseriesGetResponse]
30
- def log_timeseries_get(opts = {})
31
- data, _status_code, _headers = log_timeseries_get_with_http_info(opts)
29
+ # @return [TimeseriesGetResponse]
30
+ def timeseries_get(opts = {})
31
+ data, _status_code, _headers = timeseries_get_with_http_info(opts)
32
32
  data
33
33
  end
34
34
 
35
- # Retrieve log data as time series
36
- # Retrieves log data as time series.
35
+ # Retrieve observability data as a time series
36
+ # Retrieves observability data as a time series.
37
37
  # @option opts [String] :source (required)
38
- # @option opts [String] :service_id (required)
39
- # @option opts [String] :start (required)
40
- # @option opts [String] :_end (required)
38
+ # @option opts [String] :from (required)
39
+ # @option opts [String] :to (required)
41
40
  # @option opts [String] :granularity (required)
42
41
  # @option opts [String] :series (required)
42
+ # @option opts [String] :dimensions
43
43
  # @option opts [String] :filter
44
- # @return [Array<(LogTimeseriesGetResponse, Integer, Hash)>] LogTimeseriesGetResponse data, response status code and response headers
45
- def log_timeseries_get_with_http_info(opts = {})
44
+ # @return [Array<(TimeseriesGetResponse, Integer, Hash)>] TimeseriesGetResponse data, response status code and response headers
45
+ def timeseries_get_with_http_info(opts = {})
46
46
  if @api_client.config.debugging
47
- @api_client.config.logger.debug 'Calling API: ObservabilityTimeseriesForLogsApi.log_timeseries_get ...'
47
+ @api_client.config.logger.debug 'Calling API: ObservabilityTimeseriesApi.timeseries_get ...'
48
48
  end
49
49
  # unbox the parameters from the hash
50
50
  source = opts[:'source']
51
- service_id = opts[:'service_id']
52
- start = opts[:'start']
53
- _end = opts[:'_end']
51
+ from = opts[:'from']
52
+ to = opts[:'to']
54
53
  granularity = opts[:'granularity']
55
54
  series = opts[:'series']
56
55
  # verify the required parameter 'source' is set
57
56
  if @api_client.config.client_side_validation && source.nil?
58
- fail ArgumentError, "Missing the required parameter 'source' when calling ObservabilityTimeseriesForLogsApi.log_timeseries_get"
57
+ fail ArgumentError, "Missing the required parameter 'source' when calling ObservabilityTimeseriesApi.timeseries_get"
59
58
  end
60
- # verify the required parameter 'service_id' is set
61
- if @api_client.config.client_side_validation && service_id.nil?
62
- fail ArgumentError, "Missing the required parameter 'service_id' when calling ObservabilityTimeseriesForLogsApi.log_timeseries_get"
59
+ # verify enum value
60
+ allowable_values = ["logs", "sustainability"]
61
+ if @api_client.config.client_side_validation && !allowable_values.include?(source)
62
+ fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}"
63
63
  end
64
- # verify the required parameter 'start' is set
65
- if @api_client.config.client_side_validation && start.nil?
66
- fail ArgumentError, "Missing the required parameter 'start' when calling ObservabilityTimeseriesForLogsApi.log_timeseries_get"
64
+ # verify the required parameter 'from' is set
65
+ if @api_client.config.client_side_validation && from.nil?
66
+ fail ArgumentError, "Missing the required parameter 'from' when calling ObservabilityTimeseriesApi.timeseries_get"
67
67
  end
68
- # verify the required parameter '_end' is set
69
- if @api_client.config.client_side_validation && _end.nil?
70
- fail ArgumentError, "Missing the required parameter '_end' when calling ObservabilityTimeseriesForLogsApi.log_timeseries_get"
68
+ # verify the required parameter 'to' is set
69
+ if @api_client.config.client_side_validation && to.nil?
70
+ fail ArgumentError, "Missing the required parameter 'to' when calling ObservabilityTimeseriesApi.timeseries_get"
71
71
  end
72
72
  # verify the required parameter 'granularity' is set
73
73
  if @api_client.config.client_side_validation && granularity.nil?
74
- fail ArgumentError, "Missing the required parameter 'granularity' when calling ObservabilityTimeseriesForLogsApi.log_timeseries_get"
75
- end
76
- # verify enum value
77
- allowable_values = ["second", "minute", "hour", "day"]
78
- if @api_client.config.client_side_validation && !allowable_values.include?(granularity)
79
- fail ArgumentError, "invalid value for \"granularity\", must be one of #{allowable_values}"
74
+ fail ArgumentError, "Missing the required parameter 'granularity' when calling ObservabilityTimeseriesApi.timeseries_get"
80
75
  end
81
76
  # verify the required parameter 'series' is set
82
77
  if @api_client.config.client_side_validation && series.nil?
83
- fail ArgumentError, "Missing the required parameter 'series' when calling ObservabilityTimeseriesForLogsApi.log_timeseries_get"
78
+ fail ArgumentError, "Missing the required parameter 'series' when calling ObservabilityTimeseriesApi.timeseries_get"
84
79
  end
85
80
  # resource path
86
81
  local_var_path = '/observability/timeseries'
@@ -88,11 +83,11 @@ module Fastly
88
83
  # query parameters
89
84
  query_params = opts[:query_params] || {}
90
85
  query_params[:'source'] = source
91
- query_params[:'service_id'] = service_id
92
- query_params[:'start'] = start
93
- query_params[:'end'] = _end
86
+ query_params[:'from'] = from
87
+ query_params[:'to'] = to
94
88
  query_params[:'granularity'] = granularity
95
89
  query_params[:'series'] = series
90
+ query_params[:'dimensions'] = opts[:'dimensions'] if !opts[:'dimensions'].nil?
96
91
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
97
92
 
98
93
  # header parameters
@@ -107,13 +102,13 @@ module Fastly
107
102
  post_body = opts[:debug_body]
108
103
 
109
104
  # return_type
110
- return_type = opts[:debug_return_type] || 'LogTimeseriesGetResponse'
105
+ return_type = opts[:debug_return_type] || 'TimeseriesGetResponse'
111
106
 
112
107
  # auth_names
113
108
  auth_names = opts[:debug_auth_names] || ['token']
114
109
 
115
110
  new_options = opts.merge(
116
- :operation => :"ObservabilityTimeseriesForLogsApi.log_timeseries_get",
111
+ :operation => :"ObservabilityTimeseriesApi.timeseries_get",
117
112
  :header_params => header_params,
118
113
  :query_params => query_params,
119
114
  :form_params => form_params,
@@ -124,7 +119,7 @@ module Fastly
124
119
 
125
120
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
126
121
  if @api_client.config.debugging
127
- @api_client.config.logger.debug "API called: ObservabilityTimeseriesForLogsApi#log_timeseries_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
122
+ @api_client.config.logger.debug "API called: ObservabilityTimeseriesApi#timeseries_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
128
123
  end
129
124
  return data, status_code, headers
130
125
  end
@@ -42,7 +42,7 @@ module Fastly
42
42
  # @option opts [String] :comment A freeform descriptive note.
43
43
  # @option opts [String] :type What type of load balance group to use.
44
44
  # @option opts [String] :override_host The hostname to [override the Host header](https://www.fastly.com/documentation/guides/full-site-delivery/domains-and-origins/specifying-an-override-host/). Defaults to &#x60;null&#x60; meaning no override of the Host header will occur. This setting can also be added to a Server definition. If the field is set on a Server definition it will override the Pool setting. (default to 'null')
45
- # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;. (default to 10000)
45
+ # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;. (default to 10000)
46
46
  # @option opts [Integer] :connect_timeout How long to wait for a timeout in milliseconds. Optional.
47
47
  # @option opts [Integer] :first_byte_timeout How long to wait for the first byte in milliseconds. Optional.
48
48
  # @option opts [Integer] :max_conn_default Maximum number of connections. Optional. (default to 200)
@@ -79,7 +79,7 @@ module Fastly
79
79
  # @option opts [String] :comment A freeform descriptive note.
80
80
  # @option opts [String] :type What type of load balance group to use.
81
81
  # @option opts [String] :override_host The hostname to [override the Host header](https://www.fastly.com/documentation/guides/full-site-delivery/domains-and-origins/specifying-an-override-host/). Defaults to &#x60;null&#x60; meaning no override of the Host header will occur. This setting can also be added to a Server definition. If the field is set on a Server definition it will override the Pool setting. (default to 'null')
82
- # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;. (default to 10000)
82
+ # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;. (default to 10000)
83
83
  # @option opts [Integer] :connect_timeout How long to wait for a timeout in milliseconds. Optional.
84
84
  # @option opts [Integer] :first_byte_timeout How long to wait for the first byte in milliseconds. Optional.
85
85
  # @option opts [Integer] :max_conn_default Maximum number of connections. Optional. (default to 200)
@@ -439,7 +439,7 @@ module Fastly
439
439
  # @option opts [String] :comment A freeform descriptive note.
440
440
  # @option opts [String] :type What type of load balance group to use.
441
441
  # @option opts [String] :override_host The hostname to [override the Host header](https://www.fastly.com/documentation/guides/full-site-delivery/domains-and-origins/specifying-an-override-host/). Defaults to &#x60;null&#x60; meaning no override of the Host header will occur. This setting can also be added to a Server definition. If the field is set on a Server definition it will override the Pool setting. (default to 'null')
442
- # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;. (default to 10000)
442
+ # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;. (default to 10000)
443
443
  # @option opts [Integer] :connect_timeout How long to wait for a timeout in milliseconds. Optional.
444
444
  # @option opts [Integer] :first_byte_timeout How long to wait for the first byte in milliseconds. Optional.
445
445
  # @option opts [Integer] :max_conn_default Maximum number of connections. Optional. (default to 200)
@@ -477,7 +477,7 @@ module Fastly
477
477
  # @option opts [String] :comment A freeform descriptive note.
478
478
  # @option opts [String] :type What type of load balance group to use.
479
479
  # @option opts [String] :override_host The hostname to [override the Host header](https://www.fastly.com/documentation/guides/full-site-delivery/domains-and-origins/specifying-an-override-host/). Defaults to &#x60;null&#x60; meaning no override of the Host header will occur. This setting can also be added to a Server definition. If the field is set on a Server definition it will override the Pool setting. (default to 'null')
480
- # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;. (default to 10000)
480
+ # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;. (default to 10000)
481
481
  # @option opts [Integer] :connect_timeout How long to wait for a timeout in milliseconds. Optional.
482
482
  # @option opts [Integer] :first_byte_timeout How long to wait for the first byte in milliseconds. Optional.
483
483
  # @option opts [Integer] :max_conn_default Maximum number of connections. Optional. (default to 200)
@@ -96,7 +96,6 @@ module Fastly
96
96
 
97
97
  # Create a TLS subscription
98
98
  # Create a new TLS subscription. This response includes a list of possible challenges to verify domain ownership.
99
- # @option opts [Boolean] :force A flag that allows you to edit and delete a subscription with active domains. Valid to use on PATCH and DELETE actions. As a warning, removing an active domain from a subscription or forcing the deletion of a subscription may result in breaking TLS termination to that domain.
100
99
  # @option opts [TlsSubscription] :tls_subscription
101
100
  # @return [TlsSubscriptionResponse]
102
101
  def create_tls_sub(opts = {})
@@ -106,7 +105,6 @@ module Fastly
106
105
 
107
106
  # Create a TLS subscription
108
107
  # Create a new TLS subscription. This response includes a list of possible challenges to verify domain ownership.
109
- # @option opts [Boolean] :force A flag that allows you to edit and delete a subscription with active domains. Valid to use on PATCH and DELETE actions. As a warning, removing an active domain from a subscription or forcing the deletion of a subscription may result in breaking TLS termination to that domain.
110
108
  # @option opts [TlsSubscription] :tls_subscription
111
109
  # @return [Array<(TlsSubscriptionResponse, Integer, Hash)>] TlsSubscriptionResponse data, response status code and response headers
112
110
  def create_tls_sub_with_http_info(opts = {})
@@ -119,7 +117,6 @@ module Fastly
119
117
 
120
118
  # query parameters
121
119
  query_params = opts[:query_params] || {}
122
- query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?
123
120
 
124
121
  # header parameters
125
122
  header_params = opts[:header_params] || {}
@@ -770,6 +770,12 @@ module Fastly
770
770
  description: "No description provided",
771
771
  }
772
772
  ],
773
+ "DdosProtectionApi.ddos_protection_rule_patch": [
774
+ {
775
+ url: "https://api.fastly.com",
776
+ description: "No description provided",
777
+ }
778
+ ],
773
779
  "DdosProtectionApi.ddos_protection_traffic_stats_rule_get": [
774
780
  {
775
781
  url: "https://api.fastly.com",
@@ -2300,6 +2306,18 @@ module Fastly
2300
2306
  description: "No description provided",
2301
2307
  }
2302
2308
  ],
2309
+ "NgwafReportsApi.get_attacks_report": [
2310
+ {
2311
+ url: "https://api.fastly.com",
2312
+ description: "No description provided",
2313
+ }
2314
+ ],
2315
+ "NgwafReportsApi.get_signals_report": [
2316
+ {
2317
+ url: "https://api.fastly.com",
2318
+ description: "No description provided",
2319
+ }
2320
+ ],
2303
2321
  "ObjectStorageAccessKeysApi.create_access_key": [
2304
2322
  {
2305
2323
  url: "https://api.fastly.com",
@@ -2360,7 +2378,7 @@ module Fastly
2360
2378
  description: "No description provided",
2361
2379
  }
2362
2380
  ],
2363
- "ObservabilityTimeseriesForLogsApi.log_timeseries_get": [
2381
+ "ObservabilityTimeseriesApi.timeseries_get": [
2364
2382
  {
2365
2383
  url: "https://api.fastly.com",
2366
2384
  description: "No description provided",
@@ -0,0 +1,359 @@
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://www.fastly.com/documentation/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 AttackReport
16
+ # ID of the workspace.
17
+ attr_accessor :id
18
+
19
+ # Name of the workspace.
20
+ attr_accessor :name
21
+
22
+ # Total request count
23
+ attr_accessor :total_count
24
+
25
+ # Blocked request count
26
+ attr_accessor :blocked_count
27
+
28
+ # Flagged request count
29
+ attr_accessor :flagged_count
30
+
31
+ # Attack request count
32
+ attr_accessor :attack_count
33
+
34
+ # Count of IPs that have been flagged
35
+ attr_accessor :all_flagged_ip_count
36
+
37
+ # Count of currently flagged IPs
38
+ attr_accessor :flagged_ip_count
39
+
40
+ attr_accessor :top_attack_signals
41
+
42
+ attr_accessor :top_attack_sources
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'id' => :'id',
48
+ :'name' => :'name',
49
+ :'total_count' => :'total_count',
50
+ :'blocked_count' => :'blocked_count',
51
+ :'flagged_count' => :'flagged_count',
52
+ :'attack_count' => :'attack_count',
53
+ :'all_flagged_ip_count' => :'all_flagged_ip_count',
54
+ :'flagged_ip_count' => :'flagged_ip_count',
55
+ :'top_attack_signals' => :'top_attack_signals',
56
+ :'top_attack_sources' => :'top_attack_sources'
57
+ }
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.fastly_types
67
+ {
68
+ :'id' => :'String',
69
+ :'name' => :'String',
70
+ :'total_count' => :'Integer',
71
+ :'blocked_count' => :'Integer',
72
+ :'flagged_count' => :'Integer',
73
+ :'attack_count' => :'Integer',
74
+ :'all_flagged_ip_count' => :'Integer',
75
+ :'flagged_ip_count' => :'Integer',
76
+ :'top_attack_signals' => :'Array<AttackSignal>',
77
+ :'top_attack_sources' => :'Array<AttackSource>'
78
+ }
79
+ end
80
+
81
+ # List of attributes with nullable: true
82
+ def self.fastly_nullable
83
+ Set.new([
84
+ ])
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ if (!attributes.is_a?(Hash))
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::AttackReport` initialize method"
92
+ end
93
+
94
+ # check to see if the attribute exists and convert string to symbol for hash key
95
+ attributes = attributes.each_with_object({}) { |(k, v), h|
96
+ if (!self.class.attribute_map.key?(k.to_sym))
97
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::AttackReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
98
+ end
99
+ h[k.to_sym] = v
100
+ }
101
+
102
+ if attributes.key?(:'id')
103
+ self.id = attributes[:'id']
104
+ end
105
+
106
+ if attributes.key?(:'name')
107
+ self.name = attributes[:'name']
108
+ end
109
+
110
+ if attributes.key?(:'total_count')
111
+ self.total_count = attributes[:'total_count']
112
+ end
113
+
114
+ if attributes.key?(:'blocked_count')
115
+ self.blocked_count = attributes[:'blocked_count']
116
+ end
117
+
118
+ if attributes.key?(:'flagged_count')
119
+ self.flagged_count = attributes[:'flagged_count']
120
+ end
121
+
122
+ if attributes.key?(:'attack_count')
123
+ self.attack_count = attributes[:'attack_count']
124
+ end
125
+
126
+ if attributes.key?(:'all_flagged_ip_count')
127
+ self.all_flagged_ip_count = attributes[:'all_flagged_ip_count']
128
+ end
129
+
130
+ if attributes.key?(:'flagged_ip_count')
131
+ self.flagged_ip_count = attributes[:'flagged_ip_count']
132
+ end
133
+
134
+ if attributes.key?(:'top_attack_signals')
135
+ if (value = attributes[:'top_attack_signals']).is_a?(Array)
136
+ self.top_attack_signals = value
137
+ end
138
+ end
139
+
140
+ if attributes.key?(:'top_attack_sources')
141
+ if (value = attributes[:'top_attack_sources']).is_a?(Array)
142
+ self.top_attack_sources = value
143
+ end
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ invalid_properties = Array.new
151
+ if @id.nil?
152
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
153
+ end
154
+
155
+ if @name.nil?
156
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
157
+ end
158
+
159
+ if @total_count.nil?
160
+ invalid_properties.push('invalid value for "total_count", total_count cannot be nil.')
161
+ end
162
+
163
+ if @blocked_count.nil?
164
+ invalid_properties.push('invalid value for "blocked_count", blocked_count cannot be nil.')
165
+ end
166
+
167
+ if @flagged_count.nil?
168
+ invalid_properties.push('invalid value for "flagged_count", flagged_count cannot be nil.')
169
+ end
170
+
171
+ if @attack_count.nil?
172
+ invalid_properties.push('invalid value for "attack_count", attack_count cannot be nil.')
173
+ end
174
+
175
+ if @all_flagged_ip_count.nil?
176
+ invalid_properties.push('invalid value for "all_flagged_ip_count", all_flagged_ip_count cannot be nil.')
177
+ end
178
+
179
+ if @flagged_ip_count.nil?
180
+ invalid_properties.push('invalid value for "flagged_ip_count", flagged_ip_count cannot be nil.')
181
+ end
182
+
183
+ if @top_attack_signals.nil?
184
+ invalid_properties.push('invalid value for "top_attack_signals", top_attack_signals cannot be nil.')
185
+ end
186
+
187
+ if @top_attack_sources.nil?
188
+ invalid_properties.push('invalid value for "top_attack_sources", top_attack_sources cannot be nil.')
189
+ end
190
+
191
+ invalid_properties
192
+ end
193
+
194
+ # Check to see if the all the properties in the model are valid
195
+ # @return true if the model is valid
196
+ def valid?
197
+ return false if @id.nil?
198
+ return false if @name.nil?
199
+ return false if @total_count.nil?
200
+ return false if @blocked_count.nil?
201
+ return false if @flagged_count.nil?
202
+ return false if @attack_count.nil?
203
+ return false if @all_flagged_ip_count.nil?
204
+ return false if @flagged_ip_count.nil?
205
+ return false if @top_attack_signals.nil?
206
+ return false if @top_attack_sources.nil?
207
+ true
208
+ end
209
+
210
+ # Checks equality by comparing each attribute.
211
+ # @param [Object] Object to be compared
212
+ def ==(o)
213
+ return true if self.equal?(o)
214
+ self.class == o.class &&
215
+ id == o.id &&
216
+ name == o.name &&
217
+ total_count == o.total_count &&
218
+ blocked_count == o.blocked_count &&
219
+ flagged_count == o.flagged_count &&
220
+ attack_count == o.attack_count &&
221
+ all_flagged_ip_count == o.all_flagged_ip_count &&
222
+ flagged_ip_count == o.flagged_ip_count &&
223
+ top_attack_signals == o.top_attack_signals &&
224
+ top_attack_sources == o.top_attack_sources
225
+ end
226
+
227
+ # @see the `==` method
228
+ # @param [Object] Object to be compared
229
+ def eql?(o)
230
+ self == o
231
+ end
232
+
233
+ # Calculates hash code according to all attributes.
234
+ # @return [Integer] Hash code
235
+ def hash
236
+ [id, name, total_count, blocked_count, flagged_count, attack_count, all_flagged_ip_count, flagged_ip_count, top_attack_signals, top_attack_sources].hash
237
+ end
238
+
239
+ # Builds the object from hash
240
+ # @param [Hash] attributes Model attributes in the form of hash
241
+ # @return [Object] Returns the model itself
242
+ def self.build_from_hash(attributes)
243
+ new.build_from_hash(attributes)
244
+ end
245
+
246
+ # Builds the object from hash
247
+ # @param [Hash] attributes Model attributes in the form of hash
248
+ # @return [Object] Returns the model itself
249
+ def build_from_hash(attributes)
250
+ return nil unless attributes.is_a?(Hash)
251
+ self.class.fastly_types.each_pair do |key, type|
252
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
253
+ self.send("#{key}=", nil)
254
+ elsif type =~ /\AArray<(.*)>/i
255
+ # check to ensure the input is an array given that the attribute
256
+ # is documented as an array but the input is not
257
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
258
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
259
+ end
260
+ elsif !attributes[self.class.attribute_map[key]].nil?
261
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
262
+ end
263
+ end
264
+
265
+ self
266
+ end
267
+
268
+ # Deserializes the data based on type
269
+ # @param string type Data type
270
+ # @param string value Value to be deserialized
271
+ # @return [Object] Deserialized data
272
+ def _deserialize(type, value)
273
+ case type.to_sym
274
+ when :Time
275
+ Time.parse(value)
276
+ when :Date
277
+ Date.parse(value)
278
+ when :String
279
+ value.to_s
280
+ when :Integer
281
+ value.to_i
282
+ when :Float
283
+ value.to_f
284
+ when :Boolean
285
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
286
+ true
287
+ else
288
+ false
289
+ end
290
+ when :Object
291
+ # generic object (usually a Hash), return directly
292
+ value
293
+ when /\AArray<(?<inner_type>.+)>\z/
294
+ inner_type = Regexp.last_match[:inner_type]
295
+ value.map { |v| _deserialize(inner_type, v) }
296
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
297
+ k_type = Regexp.last_match[:k_type]
298
+ v_type = Regexp.last_match[:v_type]
299
+ {}.tap do |hash|
300
+ value.each do |k, v|
301
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
302
+ end
303
+ end
304
+ else # model
305
+ # models (e.g. Pet) or oneOf
306
+ klass = Fastly.const_get(type)
307
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
308
+ end
309
+ end
310
+
311
+ # Returns the string representation of the object
312
+ # @return [String] String presentation of the object
313
+ def to_s
314
+ to_hash.to_s
315
+ end
316
+
317
+ # to_body is an alias to to_hash (backward compatibility)
318
+ # @return [Hash] Returns the object in the form of hash
319
+ def to_body
320
+ to_hash
321
+ end
322
+
323
+ # Returns the object in the form of hash
324
+ # @return [Hash] Returns the object in the form of hash
325
+ def to_hash
326
+ hash = {}
327
+ self.class.attribute_map.each_pair do |attr, param|
328
+ value = self.send(attr)
329
+ if value.nil?
330
+ is_nullable = self.class.fastly_nullable.include?(attr)
331
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
332
+ end
333
+
334
+ hash[param] = _to_hash(value)
335
+ end
336
+ hash
337
+ end
338
+
339
+ # Outputs non-array value in the form of hash
340
+ # For object, use to_hash. Otherwise, just return the value
341
+ # @param [Object] value Any valid value
342
+ # @return [Hash] Returns the value in the form of hash
343
+ def _to_hash(value)
344
+ if value.is_a?(Array)
345
+ value.compact.map { |v| _to_hash(v) }
346
+ elsif value.is_a?(Hash)
347
+ {}.tap do |hash|
348
+ value.each { |k, v| hash[k] = _to_hash(v) }
349
+ end
350
+ elsif value.respond_to? :to_hash
351
+ value.to_hash
352
+ else
353
+ value
354
+ end
355
+ end
356
+
357
+ end
358
+
359
+ end