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,263 @@
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 'cgi'
12
+
13
+ module Fastly
14
+ class ObjectStorageAccessKeysApi
15
+ attr_accessor :api_client
16
+
17
+ def initialize(api_client = ApiClient.default)
18
+ @api_client = api_client
19
+ end
20
+ # Create an access key
21
+ # Create an access key.
22
+ # @option opts [AccessKey] :access_key
23
+ # @return [AccessKeyResponse]
24
+ def create_access_key(opts = {})
25
+ data, _status_code, _headers = create_access_key_with_http_info(opts)
26
+ data
27
+ end
28
+
29
+ # Create an access key
30
+ # Create an access key.
31
+ # @option opts [AccessKey] :access_key
32
+ # @return [Array<(AccessKeyResponse, Integer, Hash)>] AccessKeyResponse data, response status code and response headers
33
+ def create_access_key_with_http_info(opts = {})
34
+ if @api_client.config.debugging
35
+ @api_client.config.logger.debug 'Calling API: ObjectStorageAccessKeysApi.create_access_key ...'
36
+ end
37
+ # unbox the parameters from the hash
38
+ # resource path
39
+ local_var_path = '/resources/object-storage/access-keys'
40
+
41
+ # query parameters
42
+ query_params = opts[:query_params] || {}
43
+
44
+ # header parameters
45
+ header_params = opts[:header_params] || {}
46
+ # HTTP header 'Accept' (if needed)
47
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
48
+ # HTTP header 'Content-Type'
49
+ content_type = @api_client.select_header_content_type(['application/json'])
50
+ if !content_type.nil?
51
+ header_params['Content-Type'] = content_type
52
+ end
53
+
54
+ # form parameters
55
+ form_params = opts[:form_params] || {}
56
+
57
+ # http body (model)
58
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'access_key'])
59
+
60
+ # return_type
61
+ return_type = opts[:debug_return_type] || 'AccessKeyResponse'
62
+
63
+ # auth_names
64
+ auth_names = opts[:debug_auth_names] || ['token']
65
+
66
+ new_options = opts.merge(
67
+ :operation => :"ObjectStorageAccessKeysApi.create_access_key",
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => return_type
74
+ )
75
+
76
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: ObjectStorageAccessKeysApi#create_access_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+
83
+ # Delete an access key
84
+ # Delete an access key.
85
+ # @option opts [String] :access_key (required)
86
+ # @return [nil]
87
+ def delete_access_key(opts = {})
88
+ delete_access_key_with_http_info(opts)
89
+ nil
90
+ end
91
+
92
+ # Delete an access key
93
+ # Delete an access key.
94
+ # @option opts [String] :access_key (required)
95
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
96
+ def delete_access_key_with_http_info(opts = {})
97
+ if @api_client.config.debugging
98
+ @api_client.config.logger.debug 'Calling API: ObjectStorageAccessKeysApi.delete_access_key ...'
99
+ end
100
+ # unbox the parameters from the hash
101
+ access_key = opts[:'access_key']
102
+ # verify the required parameter 'access_key' is set
103
+ if @api_client.config.client_side_validation && access_key.nil?
104
+ fail ArgumentError, "Missing the required parameter 'access_key' when calling ObjectStorageAccessKeysApi.delete_access_key"
105
+ end
106
+ # resource path
107
+ local_var_path = '/resources/object-storage/access-keys/{access_key}'.sub('{' + 'access_key' + '}', CGI.escape(access_key.to_s))
108
+
109
+ # query parameters
110
+ query_params = opts[:query_params] || {}
111
+
112
+ # header parameters
113
+ header_params = opts[:header_params] || {}
114
+
115
+ # form parameters
116
+ form_params = opts[:form_params] || {}
117
+
118
+ # http body (model)
119
+ post_body = opts[:debug_body]
120
+
121
+ # return_type
122
+ return_type = opts[:debug_return_type]
123
+
124
+ # auth_names
125
+ auth_names = opts[:debug_auth_names] || ['token']
126
+
127
+ new_options = opts.merge(
128
+ :operation => :"ObjectStorageAccessKeysApi.delete_access_key",
129
+ :header_params => header_params,
130
+ :query_params => query_params,
131
+ :form_params => form_params,
132
+ :body => post_body,
133
+ :auth_names => auth_names,
134
+ :return_type => return_type
135
+ )
136
+
137
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
138
+ if @api_client.config.debugging
139
+ @api_client.config.logger.debug "API called: ObjectStorageAccessKeysApi#delete_access_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
140
+ end
141
+ return data, status_code, headers
142
+ end
143
+
144
+ # Get an access key
145
+ # Get an access key by its identifier.
146
+ # @option opts [String] :access_key (required)
147
+ # @return [AccessKey]
148
+ def get_access_key(opts = {})
149
+ data, _status_code, _headers = get_access_key_with_http_info(opts)
150
+ data
151
+ end
152
+
153
+ # Get an access key
154
+ # Get an access key by its identifier.
155
+ # @option opts [String] :access_key (required)
156
+ # @return [Array<(AccessKey, Integer, Hash)>] AccessKey data, response status code and response headers
157
+ def get_access_key_with_http_info(opts = {})
158
+ if @api_client.config.debugging
159
+ @api_client.config.logger.debug 'Calling API: ObjectStorageAccessKeysApi.get_access_key ...'
160
+ end
161
+ # unbox the parameters from the hash
162
+ access_key = opts[:'access_key']
163
+ # verify the required parameter 'access_key' is set
164
+ if @api_client.config.client_side_validation && access_key.nil?
165
+ fail ArgumentError, "Missing the required parameter 'access_key' when calling ObjectStorageAccessKeysApi.get_access_key"
166
+ end
167
+ # resource path
168
+ local_var_path = '/resources/object-storage/access-keys/{access_key}'.sub('{' + 'access_key' + '}', CGI.escape(access_key.to_s))
169
+
170
+ # query parameters
171
+ query_params = opts[:query_params] || {}
172
+
173
+ # header parameters
174
+ header_params = opts[:header_params] || {}
175
+ # HTTP header 'Accept' (if needed)
176
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
177
+
178
+ # form parameters
179
+ form_params = opts[:form_params] || {}
180
+
181
+ # http body (model)
182
+ post_body = opts[:debug_body]
183
+
184
+ # return_type
185
+ return_type = opts[:debug_return_type] || 'AccessKey'
186
+
187
+ # auth_names
188
+ auth_names = opts[:debug_auth_names] || ['token']
189
+
190
+ new_options = opts.merge(
191
+ :operation => :"ObjectStorageAccessKeysApi.get_access_key",
192
+ :header_params => header_params,
193
+ :query_params => query_params,
194
+ :form_params => form_params,
195
+ :body => post_body,
196
+ :auth_names => auth_names,
197
+ :return_type => return_type
198
+ )
199
+
200
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
201
+ if @api_client.config.debugging
202
+ @api_client.config.logger.debug "API called: ObjectStorageAccessKeysApi#get_access_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
203
+ end
204
+ return data, status_code, headers
205
+ end
206
+
207
+ # List access keys
208
+ # List access keys.
209
+ # @return [AccessKeyResponse]
210
+ def list_access_keys(opts = {})
211
+ data, _status_code, _headers = list_access_keys_with_http_info(opts)
212
+ data
213
+ end
214
+
215
+ # List access keys
216
+ # List access keys.
217
+ # @return [Array<(AccessKeyResponse, Integer, Hash)>] AccessKeyResponse data, response status code and response headers
218
+ def list_access_keys_with_http_info(opts = {})
219
+ if @api_client.config.debugging
220
+ @api_client.config.logger.debug 'Calling API: ObjectStorageAccessKeysApi.list_access_keys ...'
221
+ end
222
+ # unbox the parameters from the hash
223
+ # resource path
224
+ local_var_path = '/resources/object-storage/access-keys'
225
+
226
+ # query parameters
227
+ query_params = opts[:query_params] || {}
228
+
229
+ # header parameters
230
+ header_params = opts[:header_params] || {}
231
+ # HTTP header 'Accept' (if needed)
232
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
233
+
234
+ # form parameters
235
+ form_params = opts[:form_params] || {}
236
+
237
+ # http body (model)
238
+ post_body = opts[:debug_body]
239
+
240
+ # return_type
241
+ return_type = opts[:debug_return_type] || 'AccessKeyResponse'
242
+
243
+ # auth_names
244
+ auth_names = opts[:debug_auth_names] || ['token']
245
+
246
+ new_options = opts.merge(
247
+ :operation => :"ObjectStorageAccessKeysApi.list_access_keys",
248
+ :header_params => header_params,
249
+ :query_params => query_params,
250
+ :form_params => form_params,
251
+ :body => post_body,
252
+ :auth_names => auth_names,
253
+ :return_type => return_type
254
+ )
255
+
256
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
257
+ if @api_client.config.debugging
258
+ @api_client.config.logger.debug "API called: ObjectStorageAccessKeysApi#list_access_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
259
+ end
260
+ return data, status_code, headers
261
+ end
262
+ end
263
+ end
@@ -542,7 +542,7 @@ module Fastly
542
542
  description: "No description provided",
543
543
  }
544
544
  ],
545
- "BillingUsageMetricsApi.get_service_level_usage_types": [
545
+ "BillingUsageMetricsApi.get_usage_metrics": [
546
546
  {
547
547
  url: "https://api.fastly.com",
548
548
  description: "No description provided",
@@ -1370,6 +1370,12 @@ module Fastly
1370
1370
  description: "No description provided",
1371
1371
  }
1372
1372
  ],
1373
+ "InsightsApi.get_log_insights": [
1374
+ {
1375
+ url: "https://api.fastly.com",
1376
+ description: "No description provided",
1377
+ }
1378
+ ],
1373
1379
  "InvitationsApi.create_invitation": [
1374
1380
  {
1375
1381
  url: "https://api.fastly.com",
@@ -1604,6 +1610,12 @@ module Fastly
1604
1610
  description: "No description provided",
1605
1611
  }
1606
1612
  ],
1613
+ "LogExplorerApi.get_log_records": [
1614
+ {
1615
+ url: "https://api.fastly.com",
1616
+ description: "No description provided",
1617
+ }
1618
+ ],
1607
1619
  "LoggingAzureblobApi.create_log_azure": [
1608
1620
  {
1609
1621
  url: "https://api.fastly.com",
@@ -1844,6 +1856,36 @@ module Fastly
1844
1856
  description: "No description provided",
1845
1857
  }
1846
1858
  ],
1859
+ "LoggingGrafanacloudlogsApi.create_log_grafanacloudlogs": [
1860
+ {
1861
+ url: "https://api.fastly.com",
1862
+ description: "No description provided",
1863
+ }
1864
+ ],
1865
+ "LoggingGrafanacloudlogsApi.delete_log_grafanacloudlogs": [
1866
+ {
1867
+ url: "https://api.fastly.com",
1868
+ description: "No description provided",
1869
+ }
1870
+ ],
1871
+ "LoggingGrafanacloudlogsApi.get_log_grafanacloudlogs": [
1872
+ {
1873
+ url: "https://api.fastly.com",
1874
+ description: "No description provided",
1875
+ }
1876
+ ],
1877
+ "LoggingGrafanacloudlogsApi.list_log_grafanacloudlogs": [
1878
+ {
1879
+ url: "https://api.fastly.com",
1880
+ description: "No description provided",
1881
+ }
1882
+ ],
1883
+ "LoggingGrafanacloudlogsApi.update_log_grafanacloudlogs": [
1884
+ {
1885
+ url: "https://api.fastly.com",
1886
+ description: "No description provided",
1887
+ }
1888
+ ],
1847
1889
  "LoggingHerokuApi.create_log_heroku": [
1848
1890
  {
1849
1891
  url: "https://api.fastly.com",
@@ -2444,6 +2486,30 @@ module Fastly
2444
2486
  description: "No description provided",
2445
2487
  }
2446
2488
  ],
2489
+ "ObjectStorageAccessKeysApi.create_access_key": [
2490
+ {
2491
+ url: "https://api.fastly.com",
2492
+ description: "No description provided",
2493
+ }
2494
+ ],
2495
+ "ObjectStorageAccessKeysApi.delete_access_key": [
2496
+ {
2497
+ url: "https://api.fastly.com",
2498
+ description: "No description provided",
2499
+ }
2500
+ ],
2501
+ "ObjectStorageAccessKeysApi.get_access_key": [
2502
+ {
2503
+ url: "https://api.fastly.com",
2504
+ description: "No description provided",
2505
+ }
2506
+ ],
2507
+ "ObjectStorageAccessKeysApi.list_access_keys": [
2508
+ {
2509
+ url: "https://api.fastly.com",
2510
+ description: "No description provided",
2511
+ }
2512
+ ],
2447
2513
  "ObservabilityCustomDashboardsApi.create_dashboard": [
2448
2514
  {
2449
2515
  url: "https://api.fastly.com",
@@ -0,0 +1,248 @@
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 AccessKey
16
+ # A description of the access key.
17
+ attr_accessor :description
18
+
19
+ # The permissions granted to an access key.
20
+ attr_accessor :permission
21
+
22
+ attr_accessor :buckets
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'description' => :'description',
28
+ :'permission' => :'permission',
29
+ :'buckets' => :'buckets'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.fastly_types
40
+ {
41
+ :'description' => :'String',
42
+ :'permission' => :'String',
43
+ :'buckets' => :'Array<String>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.fastly_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::AccessKey` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::AccessKey`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'description')
69
+ self.description = attributes[:'description']
70
+ end
71
+
72
+ if attributes.key?(:'permission')
73
+ self.permission = attributes[:'permission']
74
+ end
75
+
76
+ if attributes.key?(:'buckets')
77
+ if (value = attributes[:'buckets']).is_a?(Array)
78
+ self.buckets = value
79
+ end
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ if @description.nil?
88
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
89
+ end
90
+
91
+ if @permission.nil?
92
+ invalid_properties.push('invalid value for "permission", permission cannot be nil.')
93
+ end
94
+
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ return false if @description.nil?
102
+ return false if @permission.nil?
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
+ description == o.description &&
112
+ permission == o.permission &&
113
+ buckets == o.buckets
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Integer] Hash code
124
+ def hash
125
+ [description, permission, buckets].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def self.build_from_hash(attributes)
132
+ new.build_from_hash(attributes)
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ self.class.fastly_types.each_pair do |key, type|
141
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
142
+ self.send("#{key}=", nil)
143
+ elsif type =~ /\AArray<(.*)>/i
144
+ # check to ensure the input is an array given that the attribute
145
+ # is documented as an array but the input is not
146
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
147
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
148
+ end
149
+ elsif !attributes[self.class.attribute_map[key]].nil?
150
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
151
+ end
152
+ end
153
+
154
+ self
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :Time
164
+ Time.parse(value)
165
+ when :Date
166
+ Date.parse(value)
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :Boolean
174
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ # models (e.g. Pet) or oneOf
195
+ klass = Fastly.const_get(type)
196
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ if value.nil?
219
+ is_nullable = self.class.fastly_nullable.include?(attr)
220
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
+ end
222
+
223
+ hash[param] = _to_hash(value)
224
+ end
225
+ hash
226
+ end
227
+
228
+ # Outputs non-array value in the form of hash
229
+ # For object, use to_hash. Otherwise, just return the value
230
+ # @param [Object] value Any valid value
231
+ # @return [Hash] Returns the value in the form of hash
232
+ def _to_hash(value)
233
+ if value.is_a?(Array)
234
+ value.compact.map { |v| _to_hash(v) }
235
+ elsif value.is_a?(Hash)
236
+ {}.tap do |hash|
237
+ value.each { |k, v| hash[k] = _to_hash(v) }
238
+ end
239
+ elsif value.respond_to? :to_hash
240
+ value.to_hash
241
+ else
242
+ value
243
+ end
244
+ end
245
+
246
+ end
247
+
248
+ end