fastly 8.0.0 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +205 -130
  3. data/Gemfile.lock +1 -1
  4. data/README.md +13 -7
  5. data/docs/{ErrorResponse.md → AutomationTokenErrorResponse.md} +1 -1
  6. data/docs/AutomationTokensApi.md +2 -2
  7. data/docs/Backend.md +1 -1
  8. data/docs/BackendApi.md +4 -4
  9. data/docs/BackendResponse.md +1 -1
  10. data/docs/BillingInvoicesApi.md +96 -0
  11. data/docs/CreateResponseObjectRequest.md +16 -0
  12. data/docs/Director.md +1 -1
  13. data/docs/DirectorApi.md +2 -2
  14. data/docs/DirectorResponse.md +1 -1
  15. data/docs/DomainInspectorHistoricalApi.md +4 -4
  16. data/docs/DomainInspectorRealtimeEntry.md +1 -1
  17. data/docs/Error.md +13 -0
  18. data/docs/ErrorResponseData.md +11 -0
  19. data/docs/Invoice.md +18 -0
  20. data/docs/InvoiceResponse.md +18 -0
  21. data/docs/Invoicelineitems.md +18 -0
  22. data/docs/KvStoreApi.md +1 -1
  23. data/docs/ListInvoicesResponse.md +11 -0
  24. data/docs/Listinvoices.md +11 -0
  25. data/docs/LoggingScalyrAdditional.md +1 -1
  26. data/docs/LoggingScalyrApi.md +4 -4
  27. data/docs/LoggingScalyrResponse.md +1 -1
  28. data/docs/Metadata.md +13 -0
  29. data/docs/OriginInspectorHistoricalApi.md +4 -4
  30. data/docs/OriginInspectorRealtimeEntry.md +1 -1
  31. data/docs/PoolAdditional.md +1 -1
  32. data/docs/PoolApi.md +4 -4
  33. data/docs/PoolResponse.md +1 -1
  34. data/docs/PoolResponsePost.md +1 -1
  35. data/docs/Pop.md +2 -2
  36. data/docs/PublishApi.md +1 -1
  37. data/docs/RealtimeEntry.md +1 -1
  38. data/docs/ResponseObjectApi.md +4 -0
  39. data/docs/Results.md +2 -0
  40. data/docs/SecretStoreApi.md +4 -2
  41. data/docs/SecretStoreItemApi.md +2 -2
  42. data/docs/ServiceDetail.md +1 -1
  43. data/docs/ServiceListResponse.md +2 -2
  44. data/docs/ServiceListResponseAllOf.md +2 -2
  45. data/docs/ServiceResponse.md +1 -1
  46. data/docs/ServiceResponseAllOf.md +1 -1
  47. data/docs/TlsConfigurationResponseAttributes.md +2 -2
  48. data/docs/TlsConfigurationResponseAttributesAllOf.md +2 -2
  49. data/docs/TlsCsr.md +10 -0
  50. data/docs/TlsCsrData.md +12 -0
  51. data/docs/TlsCsrDataAttributes.md +20 -0
  52. data/docs/TlsCsrErrorResponse.md +10 -0
  53. data/docs/TlsCsrResponse.md +10 -0
  54. data/docs/TlsCsrResponseAttributes.md +10 -0
  55. data/docs/TlsCsrResponseData.md +13 -0
  56. data/docs/TlsCsrsApi.md +52 -0
  57. data/docs/TlsSubscriptionResponseAttributes.md +1 -0
  58. data/docs/TlsSubscriptionResponseAttributesAllOf.md +1 -0
  59. data/docs/TokensApi.md +1 -1
  60. data/docs/TypeTlsCsr.md +9 -0
  61. data/docs/VclApi.md +1 -1
  62. data/docs/WafActiveRulesApi.md +1 -1
  63. data/lib/fastly/api/automation_tokens_api.rb +3 -3
  64. data/lib/fastly/api/backend_api.rb +4 -4
  65. data/lib/fastly/api/billing_invoices_api.rb +151 -0
  66. data/lib/fastly/api/director_api.rb +2 -2
  67. data/lib/fastly/api/domain_inspector_historical_api.rb +4 -4
  68. data/lib/fastly/api/kv_store_api.rb +2 -2
  69. data/lib/fastly/api/logging_scalyr_api.rb +4 -4
  70. data/lib/fastly/api/origin_inspector_historical_api.rb +4 -4
  71. data/lib/fastly/api/pool_api.rb +4 -4
  72. data/lib/fastly/api/publish_api.rb +2 -2
  73. data/lib/fastly/api/response_object_api.rb +8 -4
  74. data/lib/fastly/api/secret_store_api.rb +5 -2
  75. data/lib/fastly/api/secret_store_item_api.rb +2 -2
  76. data/lib/fastly/api/tls_csrs_api.rb +83 -0
  77. data/lib/fastly/api/tokens_api.rb +2 -2
  78. data/lib/fastly/api/vcl_api.rb +2 -2
  79. data/lib/fastly/api/waf_active_rules_api.rb +2 -2
  80. data/lib/fastly/configuration.rb +18 -0
  81. data/lib/fastly/models/{error_response.rb → automation_token_error_response.rb} +3 -3
  82. data/lib/fastly/models/backend.rb +1 -1
  83. data/lib/fastly/models/backend_response.rb +1 -1
  84. data/lib/fastly/models/create_response_object_request.rb +280 -0
  85. data/lib/fastly/models/director.rb +1 -1
  86. data/lib/fastly/models/director_response.rb +1 -1
  87. data/lib/fastly/models/domain_inspector_realtime_entry.rb +1 -1
  88. data/lib/fastly/models/error.rb +243 -0
  89. data/lib/fastly/models/error_response_data.rb +225 -0
  90. data/lib/fastly/models/event_attributes.rb +2 -2
  91. data/lib/fastly/models/invoice.rb +298 -0
  92. data/lib/fastly/models/invoice_response.rb +305 -0
  93. data/lib/fastly/models/invoicelineitems.rb +297 -0
  94. data/lib/fastly/models/list_invoices_response.rb +234 -0
  95. data/lib/fastly/models/listinvoices.rb +227 -0
  96. data/lib/fastly/models/logging_scalyr_additional.rb +1 -1
  97. data/lib/fastly/models/logging_scalyr_response.rb +1 -1
  98. data/lib/fastly/models/metadata.rb +250 -0
  99. data/lib/fastly/models/origin_inspector_realtime_entry.rb +1 -1
  100. data/lib/fastly/models/pool_additional.rb +1 -1
  101. data/lib/fastly/models/pool_response.rb +1 -1
  102. data/lib/fastly/models/pool_response_post.rb +1 -1
  103. data/lib/fastly/models/pop.rb +2 -2
  104. data/lib/fastly/models/realtime_entry.rb +1 -1
  105. data/lib/fastly/models/relationship_tls_certificate.rb +1 -1
  106. data/lib/fastly/models/relationship_tls_configuration.rb +1 -1
  107. data/lib/fastly/models/results.rb +21 -1
  108. data/lib/fastly/models/service_detail.rb +1 -1
  109. data/lib/fastly/models/service_list_response.rb +2 -2
  110. data/lib/fastly/models/service_list_response_all_of.rb +2 -2
  111. data/lib/fastly/models/service_response.rb +1 -1
  112. data/lib/fastly/models/service_response_all_of.rb +1 -1
  113. data/lib/fastly/models/tls_configuration_response_attributes.rb +2 -2
  114. data/lib/fastly/models/tls_configuration_response_attributes_all_of.rb +2 -2
  115. data/lib/fastly/models/tls_csr.rb +216 -0
  116. data/lib/fastly/models/tls_csr_data.rb +236 -0
  117. data/lib/fastly/models/tls_csr_data_attributes.rb +358 -0
  118. data/lib/fastly/models/tls_csr_error_response.rb +218 -0
  119. data/lib/fastly/models/tls_csr_response.rb +216 -0
  120. data/lib/fastly/models/tls_csr_response_attributes.rb +217 -0
  121. data/lib/fastly/models/tls_csr_response_data.rb +245 -0
  122. data/lib/fastly/models/tls_subscription_data_attributes.rb +2 -2
  123. data/lib/fastly/models/tls_subscription_response_attributes.rb +14 -4
  124. data/lib/fastly/models/tls_subscription_response_attributes_all_of.rb +14 -4
  125. data/lib/fastly/models/type_tls_csr.rb +34 -0
  126. data/lib/fastly/version.rb +1 -1
  127. data/lib/fastly.rb +20 -1
  128. data/sig.json +1 -1
  129. metadata +42 -4
@@ -476,6 +476,18 @@ module Fastly
476
476
  description: "No description provided",
477
477
  }
478
478
  ],
479
+ "BillingInvoicesApi.get_invoice_by_invoice_id": [
480
+ {
481
+ url: "https://api.fastly.com",
482
+ description: "No description provided",
483
+ }
484
+ ],
485
+ "BillingInvoicesApi.list_invoices": [
486
+ {
487
+ url: "https://api.fastly.com",
488
+ description: "No description provided",
489
+ }
490
+ ],
479
491
  "CacheSettingsApi.create_cache_settings": [
480
492
  {
481
493
  url: "https://api.fastly.com",
@@ -2966,6 +2978,12 @@ module Fastly
2966
2978
  description: "No description provided",
2967
2979
  }
2968
2980
  ],
2981
+ "TlsCsrsApi.create_csr": [
2982
+ {
2983
+ url: "https://api.fastly.com",
2984
+ description: "No description provided",
2985
+ }
2986
+ ],
2969
2987
  "TlsDomainsApi.list_tls_domains": [
2970
2988
  {
2971
2989
  url: "https://api.fastly.com",
@@ -12,7 +12,7 @@ require 'date'
12
12
  require 'time'
13
13
 
14
14
  module Fastly
15
- class ErrorResponse
15
+ class AutomationTokenErrorResponse
16
16
  attr_accessor :detail
17
17
 
18
18
  attr_accessor :errors
@@ -56,13 +56,13 @@ module Fastly
56
56
  # @param [Hash] attributes Model attributes in the form of hash
57
57
  def initialize(attributes = {})
58
58
  if (!attributes.is_a?(Hash))
59
- fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ErrorResponse` initialize method"
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::AutomationTokenErrorResponse` initialize method"
60
60
  end
61
61
 
62
62
  # check to see if the attribute exists and convert string to symbol for hash key
63
63
  attributes = attributes.each_with_object({}) { |(k, v), h|
64
64
  if (!self.class.attribute_map.key?(k.to_sym))
65
- fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::AutomationTokenErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
66
  end
67
67
  h[k.to_sym] = v
68
68
  }
@@ -85,7 +85,7 @@ module Fastly
85
85
  # Be strict on checking SSL certs.
86
86
  attr_accessor :ssl_check_cert
87
87
 
88
- # List of [OpenSSL ciphers](https://www.openssl.org/docs/manmaster/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.
88
+ # List of [OpenSSL ciphers](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.
89
89
  attr_accessor :ssl_ciphers
90
90
 
91
91
  # Client certificate attached to origin.
@@ -85,7 +85,7 @@ module Fastly
85
85
  # Be strict on checking SSL certs.
86
86
  attr_accessor :ssl_check_cert
87
87
 
88
- # List of [OpenSSL ciphers](https://www.openssl.org/docs/manmaster/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.
88
+ # List of [OpenSSL ciphers](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.
89
89
  attr_accessor :ssl_ciphers
90
90
 
91
91
  # Client certificate attached to origin.
@@ -0,0 +1,280 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://developer.fastly.com/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Fastly
15
+ class CreateResponseObjectRequest
16
+ # The name of the response object to create.
17
+ attr_accessor :name
18
+
19
+ # The status code the response will have. Defaults to 200.
20
+ attr_accessor :status
21
+
22
+ # The status text the response will have. Defaults to 'OK'.
23
+ attr_accessor :response
24
+
25
+ # The content the response will deliver.
26
+ attr_accessor :content
27
+
28
+ # The MIME type of your response content.
29
+ attr_accessor :content_type
30
+
31
+ # Condition which, if met, will select this configuration during a request. Optional.
32
+ attr_accessor :request_condition
33
+
34
+ # Name of the cache condition controlling when this configuration applies.
35
+ attr_accessor :cache_condition
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'name' => :'name',
41
+ :'status' => :'status',
42
+ :'response' => :'response',
43
+ :'content' => :'content',
44
+ :'content_type' => :'content_type',
45
+ :'request_condition' => :'request_condition',
46
+ :'cache_condition' => :'cache_condition'
47
+ }
48
+ end
49
+
50
+ # Returns all the JSON keys this model knows about
51
+ def self.acceptable_attributes
52
+ attribute_map.values
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.fastly_types
57
+ {
58
+ :'name' => :'String',
59
+ :'status' => :'String',
60
+ :'response' => :'String',
61
+ :'content' => :'String',
62
+ :'content_type' => :'String',
63
+ :'request_condition' => :'String',
64
+ :'cache_condition' => :'String'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.fastly_nullable
70
+ Set.new([
71
+ :'content_type',
72
+ :'request_condition',
73
+ :'cache_condition'
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::CreateResponseObjectRequest` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!self.class.attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::CreateResponseObjectRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'name')
93
+ self.name = attributes[:'name']
94
+ end
95
+
96
+ if attributes.key?(:'status')
97
+ self.status = attributes[:'status']
98
+ end
99
+
100
+ if attributes.key?(:'response')
101
+ self.response = attributes[:'response']
102
+ end
103
+
104
+ if attributes.key?(:'content')
105
+ self.content = attributes[:'content']
106
+ end
107
+
108
+ if attributes.key?(:'content_type')
109
+ self.content_type = attributes[:'content_type']
110
+ end
111
+
112
+ if attributes.key?(:'request_condition')
113
+ self.request_condition = attributes[:'request_condition']
114
+ end
115
+
116
+ if attributes.key?(:'cache_condition')
117
+ self.cache_condition = attributes[:'cache_condition']
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ invalid_properties = Array.new
125
+ invalid_properties
126
+ end
127
+
128
+ # Check to see if the all the properties in the model are valid
129
+ # @return true if the model is valid
130
+ def valid?
131
+ true
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ name == o.name &&
140
+ status == o.status &&
141
+ response == o.response &&
142
+ content == o.content &&
143
+ content_type == o.content_type &&
144
+ request_condition == o.request_condition &&
145
+ cache_condition == o.cache_condition
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [name, status, response, content, content_type, request_condition, cache_condition].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ new.build_from_hash(attributes)
165
+ end
166
+
167
+ # Builds the object from hash
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ # @return [Object] Returns the model itself
170
+ def build_from_hash(attributes)
171
+ return nil unless attributes.is_a?(Hash)
172
+ self.class.fastly_types.each_pair do |key, type|
173
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
174
+ self.send("#{key}=", nil)
175
+ elsif type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
179
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
180
+ end
181
+ elsif !attributes[self.class.attribute_map[key]].nil?
182
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
183
+ end
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :Time
196
+ Time.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :Boolean
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ # models (e.g. Pet) or oneOf
227
+ klass = Fastly.const_get(type)
228
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
229
+ end
230
+ end
231
+
232
+ # Returns the string representation of the object
233
+ # @return [String] String presentation of the object
234
+ def to_s
235
+ to_hash.to_s
236
+ end
237
+
238
+ # to_body is an alias to to_hash (backward compatibility)
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_body
241
+ to_hash
242
+ end
243
+
244
+ # Returns the object in the form of hash
245
+ # @return [Hash] Returns the object in the form of hash
246
+ def to_hash
247
+ hash = {}
248
+ self.class.attribute_map.each_pair do |attr, param|
249
+ value = self.send(attr)
250
+ if value.nil?
251
+ is_nullable = self.class.fastly_nullable.include?(attr)
252
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
253
+ end
254
+
255
+ hash[param] = _to_hash(value)
256
+ end
257
+ hash
258
+ end
259
+
260
+ # Outputs non-array value in the form of hash
261
+ # For object, use to_hash. Otherwise, just return the value
262
+ # @param [Object] value Any valid value
263
+ # @return [Hash] Returns the value in the form of hash
264
+ def _to_hash(value)
265
+ if value.is_a?(Array)
266
+ value.compact.map { |v| _to_hash(v) }
267
+ elsif value.is_a?(Hash)
268
+ {}.tap do |hash|
269
+ value.each { |k, v| hash[k] = _to_hash(v) }
270
+ end
271
+ elsif value.respond_to? :to_hash
272
+ value.to_hash
273
+ else
274
+ value
275
+ end
276
+ end
277
+
278
+ end
279
+
280
+ end
@@ -28,7 +28,7 @@ module Fastly
28
28
  # The percentage of capacity that needs to be up for a director to be considered up. `0` to `100`.
29
29
  attr_accessor :quorum
30
30
 
31
- # Selected POP to serve as a shield for the backends. Defaults to `null` meaning no origin shielding if not set. Refer to the [POPs API endpoint](/reference/api/utils/pops/) to get a list of available POPs used for shielding.
31
+ # Selected POP to serve as a shield for the backends. Defaults to `null` meaning no origin shielding if not set. Refer to the [POPs API endpoint](https://www.fastly.com/documentation/reference/api/utils/pops/) to get a list of available POPs used for shielding.
32
32
  attr_accessor :shield
33
33
 
34
34
  # What type of load balance group to use.
@@ -28,7 +28,7 @@ module Fastly
28
28
  # The percentage of capacity that needs to be up for a director to be considered up. `0` to `100`.
29
29
  attr_accessor :quorum
30
30
 
31
- # Selected POP to serve as a shield for the backends. Defaults to `null` meaning no origin shielding if not set. Refer to the [POPs API endpoint](/reference/api/utils/pops/) to get a list of available POPs used for shielding.
31
+ # Selected POP to serve as a shield for the backends. Defaults to `null` meaning no origin shielding if not set. Refer to the [POPs API endpoint](https://www.fastly.com/documentation/reference/api/utils/pops/) to get a list of available POPs used for shielding.
32
32
  attr_accessor :shield
33
33
 
34
34
  # What type of load balance group to use.
@@ -19,7 +19,7 @@ module Fastly
19
19
  # Groups [measurements](#measurements-data-model) by backend name and then by IP address.
20
20
  attr_accessor :aggregated
21
21
 
22
- # Groups [measurements](#measurements-data-model) by POP, then backend name, and then IP address. See the [POPs API](/reference/api/utils/pops/) for details about POP identifiers.
22
+ # Groups [measurements](#measurements-data-model) by POP, then backend name, and then IP address. See the [POPs API](https://www.fastly.com/documentation/reference/api/utils/pops/) for details about POP identifiers.
23
23
  attr_accessor :datacenter
24
24
 
25
25
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -0,0 +1,243 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://developer.fastly.com/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Fastly
15
+ class Error
16
+ attr_accessor :type
17
+
18
+ attr_accessor :title
19
+
20
+ attr_accessor :code
21
+
22
+ attr_accessor :status
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'type' => :'type',
28
+ :'title' => :'title',
29
+ :'code' => :'code',
30
+ :'status' => :'status'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.fastly_types
41
+ {
42
+ :'type' => :'String',
43
+ :'title' => :'String',
44
+ :'code' => :'String',
45
+ :'status' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.fastly_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Error` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'type')
71
+ self.type = attributes[:'type']
72
+ end
73
+
74
+ if attributes.key?(:'title')
75
+ self.title = attributes[:'title']
76
+ end
77
+
78
+ if attributes.key?(:'code')
79
+ self.code = attributes[:'code']
80
+ end
81
+
82
+ if attributes.key?(:'status')
83
+ self.status = attributes[:'status']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ type == o.type &&
106
+ title == o.title &&
107
+ code == o.code &&
108
+ status == o.status
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [type, title, code, status].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.fastly_types.each_pair do |key, type|
136
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
137
+ self.send("#{key}=", nil)
138
+ elsif type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :Time
159
+ Time.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ # models (e.g. Pet) or oneOf
190
+ klass = Fastly.const_get(type)
191
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.fastly_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+
241
+ end
242
+
243
+ end