fastly 8.9.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +15 -4
  5. data/docs/AccessKey.md +12 -0
  6. data/docs/AccessKeyResponse.md +15 -0
  7. data/docs/AclsInComputeApi.md +2 -2
  8. data/docs/Backend.md +2 -2
  9. data/docs/BackendApi.md +8 -8
  10. data/docs/BackendResponse.md +2 -2
  11. data/docs/BillingUsageMetricsApi.md +13 -19
  12. data/docs/ComputeAclUpdate.md +10 -0
  13. data/docs/DimensionAttributesCountryStats.md +12 -0
  14. data/docs/DimensionAttributesRate.md +10 -0
  15. data/docs/DimensionBrowser.md +10 -0
  16. data/docs/DimensionContentType.md +10 -0
  17. data/docs/DimensionCountry.md +10 -0
  18. data/docs/DimensionDevice.md +10 -0
  19. data/docs/DimensionOs.md +10 -0
  20. data/docs/DimensionResponse.md +10 -0
  21. data/docs/DimensionStatusCode.md +10 -0
  22. data/docs/DimensionUrl.md +10 -0
  23. data/docs/EnabledProductsApi.md +5 -5
  24. data/docs/FilterFieldItem.md +12 -0
  25. data/docs/GetLogInsightsResponse.md +11 -0
  26. data/docs/GetLogRecordsResponse.md +11 -0
  27. data/docs/GetLogRecordsResponseMeta.md +10 -0
  28. data/docs/GetLogRecordsResponseMetaFilters.md +16 -0
  29. data/docs/InsightsApi.md +69 -0
  30. data/docs/KvStoreItemApi.md +2 -0
  31. data/docs/LogExplorerApi.md +65 -0
  32. data/docs/LogInsights.md +12 -0
  33. data/docs/LogInsightsDimensionAttributes.md +49 -0
  34. data/docs/LogInsightsDimensions.md +61 -0
  35. data/docs/LogInsightsMeta.md +10 -0
  36. data/docs/LogInsightsMetaFilter.md +14 -0
  37. data/docs/LogInsightsValues.md +65 -0
  38. data/docs/LogPropertyServiceId.md +9 -0
  39. data/docs/LogRecord.md +37 -0
  40. data/docs/LoggingGrafanacloudlogsAdditional.md +14 -0
  41. data/docs/LoggingGrafanacloudlogsApi.md +259 -0
  42. data/docs/LoggingGrafanacloudlogsResponse.md +23 -0
  43. data/docs/ObjectStorageAccessKeysApi.md +163 -0
  44. data/docs/RealtimeEntryAggregated.md +3 -7
  45. data/docs/RealtimeMeasurements.md +3 -7
  46. data/docs/Results.md +3 -7
  47. data/docs/SetConfiguration.md +1 -0
  48. data/docs/Usagemetric.md +18 -0
  49. data/docs/Usagemetrics.md +10 -0
  50. data/docs/ValueField.md +59 -0
  51. data/docs/Values503Responses.md +12 -0
  52. data/docs/ValuesBandwidth.md +11 -0
  53. data/docs/ValuesBrowser.md +11 -0
  54. data/docs/ValuesCacheHitRatio.md +10 -0
  55. data/docs/ValuesCountryStats.md +12 -0
  56. data/docs/ValuesDuration.md +12 -0
  57. data/docs/ValuesMisses.md +10 -0
  58. data/docs/ValuesRate.md +10 -0
  59. data/docs/ValuesRequests.md +10 -0
  60. data/docs/ValuesStatusCodes.md +12 -0
  61. data/lib/fastly/api/acls_in_compute_api.rb +3 -3
  62. data/lib/fastly/api/backend_api.rb +8 -8
  63. data/lib/fastly/api/billing_usage_metrics_api.rb +30 -57
  64. data/lib/fastly/api/enabled_products_api.rb +10 -10
  65. data/lib/fastly/api/insights_api.rb +125 -0
  66. data/lib/fastly/api/kv_store_item_api.rb +3 -0
  67. data/lib/fastly/api/log_explorer_api.rb +109 -0
  68. data/lib/fastly/api/logging_grafanacloudlogs_api.rb +471 -0
  69. data/lib/fastly/api/object_storage_access_keys_api.rb +263 -0
  70. data/lib/fastly/configuration.rb +67 -1
  71. data/lib/fastly/models/access_key.rb +248 -0
  72. data/lib/fastly/models/access_key_response.rb +269 -0
  73. data/lib/fastly/models/backend.rb +2 -2
  74. data/lib/fastly/models/backend_response.rb +2 -2
  75. data/lib/fastly/models/compute_acl_list_entries.rb +1 -1
  76. data/lib/fastly/models/compute_acl_lookup.rb +1 -1
  77. data/lib/fastly/models/compute_acl_update.rb +219 -0
  78. data/lib/fastly/models/compute_acl_update_entry.rb +1 -1
  79. data/lib/fastly/models/dimension_attributes_country_stats.rb +237 -0
  80. data/lib/fastly/models/dimension_attributes_rate.rb +217 -0
  81. data/lib/fastly/models/dimension_browser.rb +217 -0
  82. data/lib/fastly/models/dimension_content_type.rb +217 -0
  83. data/lib/fastly/models/dimension_country.rb +217 -0
  84. data/lib/fastly/models/dimension_device.rb +217 -0
  85. data/lib/fastly/models/dimension_os.rb +217 -0
  86. data/lib/fastly/models/dimension_response.rb +217 -0
  87. data/lib/fastly/models/dimension_status_code.rb +217 -0
  88. data/lib/fastly/models/dimension_url.rb +217 -0
  89. data/lib/fastly/models/filter_field_item.rb +271 -0
  90. data/lib/fastly/models/get_log_insights_response.rb +227 -0
  91. data/lib/fastly/models/get_log_records_response.rb +227 -0
  92. data/lib/fastly/models/get_log_records_response_meta.rb +216 -0
  93. data/lib/fastly/models/get_log_records_response_meta_filters.rb +307 -0
  94. data/lib/fastly/models/log_insights.rb +234 -0
  95. data/lib/fastly/models/log_insights_dimension_attributes.rb +103 -0
  96. data/lib/fastly/models/log_insights_dimensions.rb +109 -0
  97. data/lib/fastly/models/log_insights_meta.rb +217 -0
  98. data/lib/fastly/models/log_insights_meta_filter.rb +284 -0
  99. data/lib/fastly/models/log_insights_values.rb +111 -0
  100. data/lib/fastly/models/log_property_service_id.rb +208 -0
  101. data/lib/fastly/models/log_record.rb +486 -0
  102. data/lib/fastly/models/logging_grafanacloudlogs_additional.rb +257 -0
  103. data/lib/fastly/models/logging_grafanacloudlogs_response.rb +408 -0
  104. data/lib/fastly/models/realtime_entry_aggregated.rb +34 -74
  105. data/lib/fastly/models/realtime_measurements.rb +34 -74
  106. data/lib/fastly/models/results.rb +31 -71
  107. data/lib/fastly/models/set_configuration.rb +14 -4
  108. data/lib/fastly/models/usagemetric.rb +297 -0
  109. data/lib/fastly/models/usagemetrics.rb +218 -0
  110. data/lib/fastly/models/value_field.rb +108 -0
  111. data/lib/fastly/models/values503_responses.rb +237 -0
  112. data/lib/fastly/models/values_bandwidth.rb +227 -0
  113. data/lib/fastly/models/values_browser.rb +227 -0
  114. data/lib/fastly/models/values_cache_hit_ratio.rb +217 -0
  115. data/lib/fastly/models/values_country_stats.rb +237 -0
  116. data/lib/fastly/models/values_duration.rb +237 -0
  117. data/lib/fastly/models/values_misses.rb +217 -0
  118. data/lib/fastly/models/values_rate.rb +217 -0
  119. data/lib/fastly/models/values_requests.rb +217 -0
  120. data/lib/fastly/models/values_status_codes.rb +237 -0
  121. data/lib/fastly/version.rb +1 -1
  122. data/lib/fastly.rb +45 -0
  123. data/sig.json +1 -1
  124. metadata +92 -2
@@ -0,0 +1,486 @@
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 LogRecord
16
+ # The ID of the Fastly customer that owns the service.
17
+ attr_accessor :customer_id
18
+
19
+ attr_accessor :service_id
20
+
21
+ # Timestamp of the request in ISO 8601 format.
22
+ attr_accessor :timestamp
23
+
24
+ # The autonomous system (AS) number of the client.
25
+ attr_accessor :client_as_number
26
+
27
+ # The client's country subdivision code as found in ISO 3166-2.
28
+ attr_accessor :client_region
29
+
30
+ # The two-letter ISO 3166-1 country code for the client.
31
+ attr_accessor :client_country_code
32
+
33
+ # The name of the operating system installed on the client device.
34
+ attr_accessor :client_os_name
35
+
36
+ # The type of the client's device.
37
+ attr_accessor :client_device_type
38
+
39
+ # The name of the browser in use on the client device.
40
+ attr_accessor :client_browser_name
41
+
42
+ # The version of the browser in use on client device.
43
+ attr_accessor :client_browser_version
44
+
45
+ # The name of the Fastly POP that served this request.
46
+ attr_accessor :fastly_pop
47
+
48
+ # The name of the origin host that served this request.
49
+ attr_accessor :origin_host
50
+
51
+ # HTTP protocol version in use for this request. For example, HTTP/1.1.
52
+ attr_accessor :request_protocol
53
+
54
+ # The name of the request host used for this request.
55
+ attr_accessor :request_host
56
+
57
+ # The URL path supplied for this request.
58
+ attr_accessor :request_path
59
+
60
+ # HTTP method sent by the client such as \"GET\" or \"POST\".
61
+ attr_accessor :request_method
62
+
63
+ # Body bytes sent to the client in the response.
64
+ attr_accessor :response_bytes_body
65
+
66
+ # Header bytes sent to the client in the response.
67
+ attr_accessor :response_bytes_header
68
+
69
+ # Total bytes sent to the client in the response.
70
+ attr_accessor :response_content_length
71
+
72
+ # The content type of the response sent to the client.
73
+ attr_accessor :response_content_type
74
+
75
+ # The HTTP reason phrase returned for this request, if any.
76
+ attr_accessor :response_reason
77
+
78
+ # The state of the request with optional suffixes describing special cases.
79
+ attr_accessor :response_state
80
+
81
+ # The HTTP response code returned for this request.
82
+ attr_accessor :response_status
83
+
84
+ # The time since the request started in seconds.
85
+ attr_accessor :response_time
86
+
87
+ # Indicates whether the request was a HIT or a MISS.
88
+ attr_accessor :response_x_cache
89
+
90
+ # Indicates whether this request was fulfilled from cache.
91
+ attr_accessor :is_cache_hit
92
+
93
+ # Indicates whether the request was handled by a Fastly edge POP.
94
+ attr_accessor :is_edge
95
+
96
+ # Indicates whether the request was handled by a Fastly shield POP.
97
+ attr_accessor :is_shield
98
+
99
+ # Attribute mapping from ruby-style variable name to JSON key.
100
+ def self.attribute_map
101
+ {
102
+ :'customer_id' => :'customer_id',
103
+ :'service_id' => :'service_id',
104
+ :'timestamp' => :'timestamp',
105
+ :'client_as_number' => :'client_as_number',
106
+ :'client_region' => :'client_region',
107
+ :'client_country_code' => :'client_country_code',
108
+ :'client_os_name' => :'client_os_name',
109
+ :'client_device_type' => :'client_device_type',
110
+ :'client_browser_name' => :'client_browser_name',
111
+ :'client_browser_version' => :'client_browser_version',
112
+ :'fastly_pop' => :'fastly_pop',
113
+ :'origin_host' => :'origin_host',
114
+ :'request_protocol' => :'request_protocol',
115
+ :'request_host' => :'request_host',
116
+ :'request_path' => :'request_path',
117
+ :'request_method' => :'request_method',
118
+ :'response_bytes_body' => :'response_bytes_body',
119
+ :'response_bytes_header' => :'response_bytes_header',
120
+ :'response_content_length' => :'response_content_length',
121
+ :'response_content_type' => :'response_content_type',
122
+ :'response_reason' => :'response_reason',
123
+ :'response_state' => :'response_state',
124
+ :'response_status' => :'response_status',
125
+ :'response_time' => :'response_time',
126
+ :'response_x_cache' => :'response_x_cache',
127
+ :'is_cache_hit' => :'is_cache_hit',
128
+ :'is_edge' => :'is_edge',
129
+ :'is_shield' => :'is_shield'
130
+ }
131
+ end
132
+
133
+ # Returns all the JSON keys this model knows about
134
+ def self.acceptable_attributes
135
+ attribute_map.values
136
+ end
137
+
138
+ # Attribute type mapping.
139
+ def self.fastly_types
140
+ {
141
+ :'customer_id' => :'String',
142
+ :'service_id' => :'LogPropertyServiceId',
143
+ :'timestamp' => :'Time',
144
+ :'client_as_number' => :'Integer',
145
+ :'client_region' => :'String',
146
+ :'client_country_code' => :'String',
147
+ :'client_os_name' => :'String',
148
+ :'client_device_type' => :'String',
149
+ :'client_browser_name' => :'String',
150
+ :'client_browser_version' => :'String',
151
+ :'fastly_pop' => :'String',
152
+ :'origin_host' => :'String',
153
+ :'request_protocol' => :'String',
154
+ :'request_host' => :'String',
155
+ :'request_path' => :'String',
156
+ :'request_method' => :'String',
157
+ :'response_bytes_body' => :'Integer',
158
+ :'response_bytes_header' => :'Integer',
159
+ :'response_content_length' => :'Integer',
160
+ :'response_content_type' => :'String',
161
+ :'response_reason' => :'String',
162
+ :'response_state' => :'String',
163
+ :'response_status' => :'Integer',
164
+ :'response_time' => :'Float',
165
+ :'response_x_cache' => :'String',
166
+ :'is_cache_hit' => :'Boolean',
167
+ :'is_edge' => :'Boolean',
168
+ :'is_shield' => :'Boolean'
169
+ }
170
+ end
171
+
172
+ # List of attributes with nullable: true
173
+ def self.fastly_nullable
174
+ Set.new([
175
+ ])
176
+ end
177
+
178
+ # Initializes the object
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ def initialize(attributes = {})
181
+ if (!attributes.is_a?(Hash))
182
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LogRecord` initialize method"
183
+ end
184
+
185
+ # check to see if the attribute exists and convert string to symbol for hash key
186
+ attributes = attributes.each_with_object({}) { |(k, v), h|
187
+ if (!self.class.attribute_map.key?(k.to_sym))
188
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LogRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
189
+ end
190
+ h[k.to_sym] = v
191
+ }
192
+
193
+ if attributes.key?(:'customer_id')
194
+ self.customer_id = attributes[:'customer_id']
195
+ end
196
+
197
+ if attributes.key?(:'service_id')
198
+ self.service_id = attributes[:'service_id']
199
+ end
200
+
201
+ if attributes.key?(:'timestamp')
202
+ self.timestamp = attributes[:'timestamp']
203
+ end
204
+
205
+ if attributes.key?(:'client_as_number')
206
+ self.client_as_number = attributes[:'client_as_number']
207
+ end
208
+
209
+ if attributes.key?(:'client_region')
210
+ self.client_region = attributes[:'client_region']
211
+ end
212
+
213
+ if attributes.key?(:'client_country_code')
214
+ self.client_country_code = attributes[:'client_country_code']
215
+ end
216
+
217
+ if attributes.key?(:'client_os_name')
218
+ self.client_os_name = attributes[:'client_os_name']
219
+ end
220
+
221
+ if attributes.key?(:'client_device_type')
222
+ self.client_device_type = attributes[:'client_device_type']
223
+ end
224
+
225
+ if attributes.key?(:'client_browser_name')
226
+ self.client_browser_name = attributes[:'client_browser_name']
227
+ end
228
+
229
+ if attributes.key?(:'client_browser_version')
230
+ self.client_browser_version = attributes[:'client_browser_version']
231
+ end
232
+
233
+ if attributes.key?(:'fastly_pop')
234
+ self.fastly_pop = attributes[:'fastly_pop']
235
+ end
236
+
237
+ if attributes.key?(:'origin_host')
238
+ self.origin_host = attributes[:'origin_host']
239
+ end
240
+
241
+ if attributes.key?(:'request_protocol')
242
+ self.request_protocol = attributes[:'request_protocol']
243
+ end
244
+
245
+ if attributes.key?(:'request_host')
246
+ self.request_host = attributes[:'request_host']
247
+ end
248
+
249
+ if attributes.key?(:'request_path')
250
+ self.request_path = attributes[:'request_path']
251
+ end
252
+
253
+ if attributes.key?(:'request_method')
254
+ self.request_method = attributes[:'request_method']
255
+ end
256
+
257
+ if attributes.key?(:'response_bytes_body')
258
+ self.response_bytes_body = attributes[:'response_bytes_body']
259
+ end
260
+
261
+ if attributes.key?(:'response_bytes_header')
262
+ self.response_bytes_header = attributes[:'response_bytes_header']
263
+ end
264
+
265
+ if attributes.key?(:'response_content_length')
266
+ self.response_content_length = attributes[:'response_content_length']
267
+ end
268
+
269
+ if attributes.key?(:'response_content_type')
270
+ self.response_content_type = attributes[:'response_content_type']
271
+ end
272
+
273
+ if attributes.key?(:'response_reason')
274
+ self.response_reason = attributes[:'response_reason']
275
+ end
276
+
277
+ if attributes.key?(:'response_state')
278
+ self.response_state = attributes[:'response_state']
279
+ end
280
+
281
+ if attributes.key?(:'response_status')
282
+ self.response_status = attributes[:'response_status']
283
+ end
284
+
285
+ if attributes.key?(:'response_time')
286
+ self.response_time = attributes[:'response_time']
287
+ end
288
+
289
+ if attributes.key?(:'response_x_cache')
290
+ self.response_x_cache = attributes[:'response_x_cache']
291
+ end
292
+
293
+ if attributes.key?(:'is_cache_hit')
294
+ self.is_cache_hit = attributes[:'is_cache_hit']
295
+ end
296
+
297
+ if attributes.key?(:'is_edge')
298
+ self.is_edge = attributes[:'is_edge']
299
+ end
300
+
301
+ if attributes.key?(:'is_shield')
302
+ self.is_shield = attributes[:'is_shield']
303
+ end
304
+ end
305
+
306
+ # Show invalid properties with the reasons. Usually used together with valid?
307
+ # @return Array for valid properties with the reasons
308
+ def list_invalid_properties
309
+ invalid_properties = Array.new
310
+ invalid_properties
311
+ end
312
+
313
+ # Check to see if the all the properties in the model are valid
314
+ # @return true if the model is valid
315
+ def valid?
316
+ true
317
+ end
318
+
319
+ # Checks equality by comparing each attribute.
320
+ # @param [Object] Object to be compared
321
+ def ==(o)
322
+ return true if self.equal?(o)
323
+ self.class == o.class &&
324
+ customer_id == o.customer_id &&
325
+ service_id == o.service_id &&
326
+ timestamp == o.timestamp &&
327
+ client_as_number == o.client_as_number &&
328
+ client_region == o.client_region &&
329
+ client_country_code == o.client_country_code &&
330
+ client_os_name == o.client_os_name &&
331
+ client_device_type == o.client_device_type &&
332
+ client_browser_name == o.client_browser_name &&
333
+ client_browser_version == o.client_browser_version &&
334
+ fastly_pop == o.fastly_pop &&
335
+ origin_host == o.origin_host &&
336
+ request_protocol == o.request_protocol &&
337
+ request_host == o.request_host &&
338
+ request_path == o.request_path &&
339
+ request_method == o.request_method &&
340
+ response_bytes_body == o.response_bytes_body &&
341
+ response_bytes_header == o.response_bytes_header &&
342
+ response_content_length == o.response_content_length &&
343
+ response_content_type == o.response_content_type &&
344
+ response_reason == o.response_reason &&
345
+ response_state == o.response_state &&
346
+ response_status == o.response_status &&
347
+ response_time == o.response_time &&
348
+ response_x_cache == o.response_x_cache &&
349
+ is_cache_hit == o.is_cache_hit &&
350
+ is_edge == o.is_edge &&
351
+ is_shield == o.is_shield
352
+ end
353
+
354
+ # @see the `==` method
355
+ # @param [Object] Object to be compared
356
+ def eql?(o)
357
+ self == o
358
+ end
359
+
360
+ # Calculates hash code according to all attributes.
361
+ # @return [Integer] Hash code
362
+ def hash
363
+ [customer_id, service_id, timestamp, client_as_number, client_region, client_country_code, client_os_name, client_device_type, client_browser_name, client_browser_version, fastly_pop, origin_host, request_protocol, request_host, request_path, request_method, response_bytes_body, response_bytes_header, response_content_length, response_content_type, response_reason, response_state, response_status, response_time, response_x_cache, is_cache_hit, is_edge, is_shield].hash
364
+ end
365
+
366
+ # Builds the object from hash
367
+ # @param [Hash] attributes Model attributes in the form of hash
368
+ # @return [Object] Returns the model itself
369
+ def self.build_from_hash(attributes)
370
+ new.build_from_hash(attributes)
371
+ end
372
+
373
+ # Builds the object from hash
374
+ # @param [Hash] attributes Model attributes in the form of hash
375
+ # @return [Object] Returns the model itself
376
+ def build_from_hash(attributes)
377
+ return nil unless attributes.is_a?(Hash)
378
+ self.class.fastly_types.each_pair do |key, type|
379
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
380
+ self.send("#{key}=", nil)
381
+ elsif type =~ /\AArray<(.*)>/i
382
+ # check to ensure the input is an array given that the attribute
383
+ # is documented as an array but the input is not
384
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
385
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
386
+ end
387
+ elsif !attributes[self.class.attribute_map[key]].nil?
388
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
389
+ end
390
+ end
391
+
392
+ self
393
+ end
394
+
395
+ # Deserializes the data based on type
396
+ # @param string type Data type
397
+ # @param string value Value to be deserialized
398
+ # @return [Object] Deserialized data
399
+ def _deserialize(type, value)
400
+ case type.to_sym
401
+ when :Time
402
+ Time.parse(value)
403
+ when :Date
404
+ Date.parse(value)
405
+ when :String
406
+ value.to_s
407
+ when :Integer
408
+ value.to_i
409
+ when :Float
410
+ value.to_f
411
+ when :Boolean
412
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
413
+ true
414
+ else
415
+ false
416
+ end
417
+ when :Object
418
+ # generic object (usually a Hash), return directly
419
+ value
420
+ when /\AArray<(?<inner_type>.+)>\z/
421
+ inner_type = Regexp.last_match[:inner_type]
422
+ value.map { |v| _deserialize(inner_type, v) }
423
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
424
+ k_type = Regexp.last_match[:k_type]
425
+ v_type = Regexp.last_match[:v_type]
426
+ {}.tap do |hash|
427
+ value.each do |k, v|
428
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
429
+ end
430
+ end
431
+ else # model
432
+ # models (e.g. Pet) or oneOf
433
+ klass = Fastly.const_get(type)
434
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
435
+ end
436
+ end
437
+
438
+ # Returns the string representation of the object
439
+ # @return [String] String presentation of the object
440
+ def to_s
441
+ to_hash.to_s
442
+ end
443
+
444
+ # to_body is an alias to to_hash (backward compatibility)
445
+ # @return [Hash] Returns the object in the form of hash
446
+ def to_body
447
+ to_hash
448
+ end
449
+
450
+ # Returns the object in the form of hash
451
+ # @return [Hash] Returns the object in the form of hash
452
+ def to_hash
453
+ hash = {}
454
+ self.class.attribute_map.each_pair do |attr, param|
455
+ value = self.send(attr)
456
+ if value.nil?
457
+ is_nullable = self.class.fastly_nullable.include?(attr)
458
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
459
+ end
460
+
461
+ hash[param] = _to_hash(value)
462
+ end
463
+ hash
464
+ end
465
+
466
+ # Outputs non-array value in the form of hash
467
+ # For object, use to_hash. Otherwise, just return the value
468
+ # @param [Object] value Any valid value
469
+ # @return [Hash] Returns the value in the form of hash
470
+ def _to_hash(value)
471
+ if value.is_a?(Array)
472
+ value.compact.map { |v| _to_hash(v) }
473
+ elsif value.is_a?(Hash)
474
+ {}.tap do |hash|
475
+ value.each { |k, v| hash[k] = _to_hash(v) }
476
+ end
477
+ elsif value.respond_to? :to_hash
478
+ value.to_hash
479
+ else
480
+ value
481
+ end
482
+ end
483
+
484
+ end
485
+
486
+ end