fastly 8.8.0 → 8.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -1
  3. data/Gemfile.lock +1 -1
  4. data/README.md +30 -3
  5. data/docs/AclsInComputeApi.md +284 -0
  6. data/docs/{OriginInspectorRealtimeEntryRecorded.md → ComputeAclCreateAclsRequest.md} +2 -1
  7. data/docs/ComputeAclCreateAclsResponse.md +11 -0
  8. data/docs/ComputeAclListEntries.md +11 -0
  9. data/docs/ComputeAclListEntriesItem.md +11 -0
  10. data/docs/ComputeAclListEntriesMeta.md +11 -0
  11. data/docs/ComputeAclLookup.md +12 -0
  12. data/docs/ComputeAclUpdateEntry.md +12 -0
  13. data/docs/ConfiguredProductResponse.md +13 -0
  14. data/docs/ConfiguredProductResponseConfiguration.md +11 -0
  15. data/docs/ConfiguredProductResponseLinks.md +11 -0
  16. data/docs/ConfiguredProductResponseProduct.md +11 -0
  17. data/docs/ContactApi.md +1 -1
  18. data/docs/CustomerAddress.md +16 -0
  19. data/docs/CustomerAddressesApi.md +127 -0
  20. data/docs/DomainInspector.md +1 -1
  21. data/docs/DomainInspectorRealtimeEntry.md +1 -1
  22. data/docs/EnabledProductsApi.md +93 -9
  23. data/docs/Environment.md +12 -0
  24. data/docs/{RecordedTimestamp.md → EnvironmentName.md} +1 -1
  25. data/docs/{OriginInspectorSubsequentRequestTimestamp.md → InlineResponse201.md} +2 -1
  26. data/docs/{SubsequentRequestTimestamp.md → ListCustomerAddressesResponse.md} +2 -1
  27. data/docs/OriginInspector.md +1 -1
  28. data/docs/OriginInspectorRealtimeEntry.md +1 -1
  29. data/docs/RealtimeEntryAggregated.md +1 -0
  30. data/docs/RealtimeMeasurements.md +1 -0
  31. data/docs/Results.md +1 -0
  32. data/docs/SchemasVersionResponse.md +1 -0
  33. data/docs/ServiceDetail.md +1 -0
  34. data/docs/ServiceListResponse.md +1 -0
  35. data/docs/ServiceListResponseAllOf.md +1 -0
  36. data/docs/ServiceResponse.md +1 -0
  37. data/docs/ServiceResponseAllOf.md +1 -0
  38. data/docs/ServiceVersionDetail.md +1 -0
  39. data/docs/ServiceVersionDetailOrNull.md +1 -0
  40. data/docs/SetConfiguration.md +11 -0
  41. data/docs/SetWorkspaceId.md +10 -0
  42. data/docs/TlsCertificatesApi.md +2 -2
  43. data/docs/TlsDomainsApi.md +2 -2
  44. data/docs/TlsSubscriptionsApi.md +2 -2
  45. data/docs/VersionApi.md +84 -0
  46. data/docs/VersionResponse.md +1 -0
  47. data/docs/VersionResponseAllOf.md +1 -0
  48. data/lib/fastly/api/acls_in_compute_api.rb +470 -0
  49. data/lib/fastly/api/contact_api.rb +1 -1
  50. data/lib/fastly/api/customer_addresses_api.rb +224 -0
  51. data/lib/fastly/api/enabled_products_api.rb +164 -10
  52. data/lib/fastly/api/tls_certificates_api.rb +7 -7
  53. data/lib/fastly/api/tls_domains_api.rb +7 -7
  54. data/lib/fastly/api/tls_subscriptions_api.rb +7 -7
  55. data/lib/fastly/api/version_api.rb +154 -0
  56. data/lib/fastly/configuration.rb +84 -0
  57. data/lib/fastly/models/billing_response_line_item.rb +10 -0
  58. data/lib/fastly/models/{origin_inspector_realtime_entry_recorded.rb → compute_acl_create_acls_request.rb} +15 -6
  59. data/lib/fastly/models/compute_acl_create_acls_response.rb +227 -0
  60. data/lib/fastly/models/compute_acl_list_entries.rb +228 -0
  61. data/lib/fastly/models/compute_acl_list_entries_item.rb +227 -0
  62. data/lib/fastly/models/compute_acl_list_entries_meta.rb +227 -0
  63. data/lib/fastly/models/compute_acl_lookup.rb +238 -0
  64. data/lib/fastly/models/compute_acl_update_entry.rb +238 -0
  65. data/lib/fastly/models/configured_product_response.rb +243 -0
  66. data/lib/fastly/models/configured_product_response_configuration.rb +227 -0
  67. data/lib/fastly/models/configured_product_response_links.rb +227 -0
  68. data/lib/fastly/models/configured_product_response_product.rb +227 -0
  69. data/lib/fastly/models/customer_address.rb +294 -0
  70. data/lib/fastly/models/domain_inspector.rb +2 -1
  71. data/lib/fastly/models/domain_inspector_realtime_entry.rb +2 -1
  72. data/lib/fastly/models/environment.rb +235 -0
  73. data/lib/fastly/models/environment_name.rb +34 -0
  74. data/lib/fastly/models/event_attributes.rb +2 -2
  75. data/lib/fastly/models/{recorded_timestamp.rb → inline_response201.rb} +15 -6
  76. data/lib/fastly/models/line_item_data.rb +10 -0
  77. data/lib/fastly/models/{origin_inspector_subsequent_request_timestamp.rb → list_customer_addresses_response.rb} +16 -6
  78. data/lib/fastly/models/origin_inspector.rb +2 -1
  79. data/lib/fastly/models/origin_inspector_realtime_entry.rb +2 -1
  80. data/lib/fastly/models/realtime_entry_aggregated.rb +14 -4
  81. data/lib/fastly/models/realtime_measurements.rb +14 -4
  82. data/lib/fastly/models/results.rb +11 -1
  83. data/lib/fastly/models/schemas_version_response.rb +16 -4
  84. data/lib/fastly/models/service_detail.rb +13 -1
  85. data/lib/fastly/models/service_list_response.rb +16 -4
  86. data/lib/fastly/models/service_list_response_all_of.rb +16 -4
  87. data/lib/fastly/models/service_response.rb +16 -4
  88. data/lib/fastly/models/service_response_all_of.rb +16 -4
  89. data/lib/fastly/models/service_version_detail.rb +13 -1
  90. data/lib/fastly/models/service_version_detail_or_null.rb +13 -1
  91. data/lib/fastly/models/set_configuration.rb +227 -0
  92. data/lib/fastly/models/{subsequent_request_timestamp.rb → set_workspace_id.rb} +15 -6
  93. data/lib/fastly/models/version_response.rb +16 -4
  94. data/lib/fastly/models/version_response_all_of.rb +16 -4
  95. data/lib/fastly/version.rb +1 -1
  96. data/lib/fastly.rb +20 -4
  97. data/sig.json +1 -1
  98. metadata +42 -10
@@ -87,6 +87,83 @@ module Fastly
87
87
  return data, status_code, headers
88
88
  end
89
89
 
90
+ # Activate a service version on the specified environment
91
+ # Activate a version on a given environment, i.e. \"staging\"
92
+ # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
93
+ # @option opts [Integer] :version_id Integer identifying a service version. (required)
94
+ # @option opts [EnvironmentName] :environment_name (required)
95
+ # @return [VersionResponse]
96
+ def activate_service_version_environment(opts = {})
97
+ data, _status_code, _headers = activate_service_version_environment_with_http_info(opts)
98
+ data
99
+ end
100
+
101
+ # Activate a service version on the specified environment
102
+ # Activate a version on a given environment, i.e. \"staging\"
103
+ # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
104
+ # @option opts [Integer] :version_id Integer identifying a service version. (required)
105
+ # @option opts [EnvironmentName] :environment_name (required)
106
+ # @return [Array<(VersionResponse, Integer, Hash)>] VersionResponse data, response status code and response headers
107
+ def activate_service_version_environment_with_http_info(opts = {})
108
+ if @api_client.config.debugging
109
+ @api_client.config.logger.debug 'Calling API: VersionApi.activate_service_version_environment ...'
110
+ end
111
+ # unbox the parameters from the hash
112
+ service_id = opts[:'service_id']
113
+ version_id = opts[:'version_id']
114
+ environment_name = opts[:'environment_name']
115
+ # verify the required parameter 'service_id' is set
116
+ if @api_client.config.client_side_validation && service_id.nil?
117
+ fail ArgumentError, "Missing the required parameter 'service_id' when calling VersionApi.activate_service_version_environment"
118
+ end
119
+ # verify the required parameter 'version_id' is set
120
+ if @api_client.config.client_side_validation && version_id.nil?
121
+ fail ArgumentError, "Missing the required parameter 'version_id' when calling VersionApi.activate_service_version_environment"
122
+ end
123
+ # verify the required parameter 'environment_name' is set
124
+ if @api_client.config.client_side_validation && environment_name.nil?
125
+ fail ArgumentError, "Missing the required parameter 'environment_name' when calling VersionApi.activate_service_version_environment"
126
+ end
127
+ # resource path
128
+ local_var_path = '/service/{service_id}/version/{version_id}/activate/{environment_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'environment_name' + '}', CGI.escape(environment_name.to_s))
129
+
130
+ # query parameters
131
+ query_params = opts[:query_params] || {}
132
+
133
+ # header parameters
134
+ header_params = opts[:header_params] || {}
135
+ # HTTP header 'Accept' (if needed)
136
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
137
+
138
+ # form parameters
139
+ form_params = opts[:form_params] || {}
140
+
141
+ # http body (model)
142
+ post_body = opts[:debug_body]
143
+
144
+ # return_type
145
+ return_type = opts[:debug_return_type] || 'VersionResponse'
146
+
147
+ # auth_names
148
+ auth_names = opts[:debug_auth_names] || ['token']
149
+
150
+ new_options = opts.merge(
151
+ :operation => :"VersionApi.activate_service_version_environment",
152
+ :header_params => header_params,
153
+ :query_params => query_params,
154
+ :form_params => form_params,
155
+ :body => post_body,
156
+ :auth_names => auth_names,
157
+ :return_type => return_type
158
+ )
159
+
160
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
161
+ if @api_client.config.debugging
162
+ @api_client.config.logger.debug "API called: VersionApi#activate_service_version_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
163
+ end
164
+ return data, status_code, headers
165
+ end
166
+
90
167
  # Clone a service version
91
168
  # Clone the current configuration into a new version.
92
169
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
@@ -290,6 +367,83 @@ module Fastly
290
367
  return data, status_code, headers
291
368
  end
292
369
 
370
+ # Deactivate a service version on an environment
371
+ # Deactivate the current version on a given environment, i.e. \"staging\"
372
+ # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
373
+ # @option opts [Integer] :version_id Integer identifying a service version. (required)
374
+ # @option opts [EnvironmentName] :environment_name (required)
375
+ # @return [VersionResponse]
376
+ def deactivate_service_version_environment(opts = {})
377
+ data, _status_code, _headers = deactivate_service_version_environment_with_http_info(opts)
378
+ data
379
+ end
380
+
381
+ # Deactivate a service version on an environment
382
+ # Deactivate the current version on a given environment, i.e. \&quot;staging\&quot;
383
+ # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
384
+ # @option opts [Integer] :version_id Integer identifying a service version. (required)
385
+ # @option opts [EnvironmentName] :environment_name (required)
386
+ # @return [Array<(VersionResponse, Integer, Hash)>] VersionResponse data, response status code and response headers
387
+ def deactivate_service_version_environment_with_http_info(opts = {})
388
+ if @api_client.config.debugging
389
+ @api_client.config.logger.debug 'Calling API: VersionApi.deactivate_service_version_environment ...'
390
+ end
391
+ # unbox the parameters from the hash
392
+ service_id = opts[:'service_id']
393
+ version_id = opts[:'version_id']
394
+ environment_name = opts[:'environment_name']
395
+ # verify the required parameter 'service_id' is set
396
+ if @api_client.config.client_side_validation && service_id.nil?
397
+ fail ArgumentError, "Missing the required parameter 'service_id' when calling VersionApi.deactivate_service_version_environment"
398
+ end
399
+ # verify the required parameter 'version_id' is set
400
+ if @api_client.config.client_side_validation && version_id.nil?
401
+ fail ArgumentError, "Missing the required parameter 'version_id' when calling VersionApi.deactivate_service_version_environment"
402
+ end
403
+ # verify the required parameter 'environment_name' is set
404
+ if @api_client.config.client_side_validation && environment_name.nil?
405
+ fail ArgumentError, "Missing the required parameter 'environment_name' when calling VersionApi.deactivate_service_version_environment"
406
+ end
407
+ # resource path
408
+ local_var_path = '/service/{service_id}/version/{version_id}/deactivate/{environment_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'environment_name' + '}', CGI.escape(environment_name.to_s))
409
+
410
+ # query parameters
411
+ query_params = opts[:query_params] || {}
412
+
413
+ # header parameters
414
+ header_params = opts[:header_params] || {}
415
+ # HTTP header 'Accept' (if needed)
416
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
417
+
418
+ # form parameters
419
+ form_params = opts[:form_params] || {}
420
+
421
+ # http body (model)
422
+ post_body = opts[:debug_body]
423
+
424
+ # return_type
425
+ return_type = opts[:debug_return_type] || 'VersionResponse'
426
+
427
+ # auth_names
428
+ auth_names = opts[:debug_auth_names] || ['token']
429
+
430
+ new_options = opts.merge(
431
+ :operation => :"VersionApi.deactivate_service_version_environment",
432
+ :header_params => header_params,
433
+ :query_params => query_params,
434
+ :form_params => form_params,
435
+ :body => post_body,
436
+ :auth_names => auth_names,
437
+ :return_type => return_type
438
+ )
439
+
440
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
441
+ if @api_client.config.debugging
442
+ @api_client.config.logger.debug "API called: VersionApi#deactivate_service_version_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
443
+ end
444
+ return data, status_code, headers
445
+ end
446
+
293
447
  # Get a version of a service
294
448
  # Get the version for a particular service.
295
449
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
@@ -344,6 +344,48 @@ module Fastly
344
344
  description: "No description provided",
345
345
  }
346
346
  ],
347
+ "AclsInComputeApi.compute_acl_create_acls": [
348
+ {
349
+ url: "https://api.fastly.com",
350
+ description: "No description provided",
351
+ }
352
+ ],
353
+ "AclsInComputeApi.compute_acl_delete_s_acl_id": [
354
+ {
355
+ url: "https://api.fastly.com",
356
+ description: "No description provided",
357
+ }
358
+ ],
359
+ "AclsInComputeApi.compute_acl_list_acl_entries": [
360
+ {
361
+ url: "https://api.fastly.com",
362
+ description: "No description provided",
363
+ }
364
+ ],
365
+ "AclsInComputeApi.compute_acl_list_acls": [
366
+ {
367
+ url: "https://api.fastly.com",
368
+ description: "No description provided",
369
+ }
370
+ ],
371
+ "AclsInComputeApi.compute_acl_list_acls_s_acl_id": [
372
+ {
373
+ url: "https://api.fastly.com",
374
+ description: "No description provided",
375
+ }
376
+ ],
377
+ "AclsInComputeApi.compute_acl_lookup_acls": [
378
+ {
379
+ url: "https://api.fastly.com",
380
+ description: "No description provided",
381
+ }
382
+ ],
383
+ "AclsInComputeApi.compute_acl_update_acls": [
384
+ {
385
+ url: "https://api.fastly.com",
386
+ description: "No description provided",
387
+ }
388
+ ],
347
389
  "ApexRedirectApi.create_apex_redirect": [
348
390
  {
349
391
  url: "https://api.fastly.com",
@@ -704,6 +746,24 @@ module Fastly
704
746
  description: "No description provided",
705
747
  }
706
748
  ],
749
+ "CustomerAddressesApi.create_customer_address": [
750
+ {
751
+ url: "https://api.fastly.com",
752
+ description: "No description provided",
753
+ }
754
+ ],
755
+ "CustomerAddressesApi.list_customer_addresses": [
756
+ {
757
+ url: "https://api.fastly.com",
758
+ description: "No description provided",
759
+ }
760
+ ],
761
+ "CustomerAddressesApi.update_customer_address": [
762
+ {
763
+ url: "https://api.fastly.com",
764
+ description: "No description provided",
765
+ }
766
+ ],
707
767
  "DictionaryApi.create_dictionary": [
708
768
  {
709
769
  url: "https://api.fastly.com",
@@ -926,6 +986,18 @@ module Fastly
926
986
  description: "No description provided",
927
987
  }
928
988
  ],
989
+ "EnabledProductsApi.get_product_configuration": [
990
+ {
991
+ url: "https://api.fastly.com",
992
+ description: "No description provided",
993
+ }
994
+ ],
995
+ "EnabledProductsApi.set_product_configuration": [
996
+ {
997
+ url: "https://api.fastly.com",
998
+ description: "No description provided",
999
+ }
1000
+ ],
929
1001
  "EventsApi.get_event": [
930
1002
  {
931
1003
  url: "https://api.fastly.com",
@@ -3302,6 +3374,12 @@ module Fastly
3302
3374
  description: "No description provided",
3303
3375
  }
3304
3376
  ],
3377
+ "VersionApi.activate_service_version_environment": [
3378
+ {
3379
+ url: "https://api.fastly.com",
3380
+ description: "No description provided",
3381
+ }
3382
+ ],
3305
3383
  "VersionApi.clone_service_version": [
3306
3384
  {
3307
3385
  url: "https://api.fastly.com",
@@ -3320,6 +3398,12 @@ module Fastly
3320
3398
  description: "No description provided",
3321
3399
  }
3322
3400
  ],
3401
+ "VersionApi.deactivate_service_version_environment": [
3402
+ {
3403
+ url: "https://api.fastly.com",
3404
+ description: "No description provided",
3405
+ }
3406
+ ],
3323
3407
  "VersionApi.get_service_version": [
3324
3408
  {
3325
3409
  url: "https://api.fastly.com",
@@ -120,10 +120,20 @@ module Fastly
120
120
  :'created_at',
121
121
  :'deleted_at',
122
122
  :'updated_at',
123
+ :'amount',
124
+ :'aria_invoice_id',
125
+ :'client_service_id',
123
126
  :'credit_coupon_code',
127
+ :'description',
128
+ :'line_number',
129
+ :'plan_name',
130
+ :'plan_no',
124
131
  :'rate_per_unit',
125
132
  :'rate_schedule_no',
126
133
  :'rate_schedule_tier_no',
134
+ :'service_name',
135
+ :'service_no',
136
+ :'units',
127
137
  :'usage_type_cd',
128
138
  :'usage_type_no'
129
139
  ])
@@ -12,11 +12,14 @@ require 'date'
12
12
  require 'time'
13
13
 
14
14
  module Fastly
15
- # The Unix timestamp at which this record's data was generated.
16
- class OriginInspectorRealtimeEntryRecorded
15
+ class ComputeAclCreateAclsRequest
16
+ # Human readable name of store
17
+ attr_accessor :name
18
+
17
19
  # Attribute mapping from ruby-style variable name to JSON key.
18
20
  def self.attribute_map
19
21
  {
22
+ :'name' => :'name'
20
23
  }
21
24
  end
22
25
 
@@ -28,6 +31,7 @@ module Fastly
28
31
  # Attribute type mapping.
29
32
  def self.fastly_types
30
33
  {
34
+ :'name' => :'String'
31
35
  }
32
36
  end
33
37
 
@@ -41,16 +45,20 @@ module Fastly
41
45
  # @param [Hash] attributes Model attributes in the form of hash
42
46
  def initialize(attributes = {})
43
47
  if (!attributes.is_a?(Hash))
44
- fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::OriginInspectorRealtimeEntryRecorded` initialize method"
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ComputeAclCreateAclsRequest` initialize method"
45
49
  end
46
50
 
47
51
  # check to see if the attribute exists and convert string to symbol for hash key
48
52
  attributes = attributes.each_with_object({}) { |(k, v), h|
49
53
  if (!self.class.attribute_map.key?(k.to_sym))
50
- fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::OriginInspectorRealtimeEntryRecorded`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ComputeAclCreateAclsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
55
  end
52
56
  h[k.to_sym] = v
53
57
  }
58
+
59
+ if attributes.key?(:'name')
60
+ self.name = attributes[:'name']
61
+ end
54
62
  end
55
63
 
56
64
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -70,7 +78,8 @@ module Fastly
70
78
  # @param [Object] Object to be compared
71
79
  def ==(o)
72
80
  return true if self.equal?(o)
73
- self.class == o.class
81
+ self.class == o.class &&
82
+ name == o.name
74
83
  end
75
84
 
76
85
  # @see the `==` method
@@ -82,7 +91,7 @@ module Fastly
82
91
  # Calculates hash code according to all attributes.
83
92
  # @return [Integer] Hash code
84
93
  def hash
85
- [].hash
94
+ [name].hash
86
95
  end
87
96
 
88
97
  # Builds the object from hash
@@ -0,0 +1,227 @@
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 ComputeAclCreateAclsResponse
16
+ # Human readable name of store
17
+ attr_accessor :name
18
+
19
+ # An example identifier (UUID).
20
+ attr_accessor :id
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'name' => :'name',
26
+ :'id' => :'id'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.fastly_types
37
+ {
38
+ :'name' => :'String',
39
+ :'id' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.fastly_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ComputeAclCreateAclsResponse` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ComputeAclCreateAclsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'name')
65
+ self.name = attributes[:'name']
66
+ end
67
+
68
+ if attributes.key?(:'id')
69
+ self.id = attributes[:'id']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ name == o.name &&
92
+ id == o.id
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [name, id].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.fastly_types.each_pair do |key, type|
120
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
121
+ self.send("#{key}=", nil)
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :Time
143
+ Time.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ # models (e.g. Pet) or oneOf
174
+ klass = Fastly.const_get(type)
175
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.fastly_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+
227
+ end