fastly 14.0.0 → 15.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +22 -13
  5. data/docs/ApiDiscoveryResponseBodyGetAllServices.md +13 -0
  6. data/docs/ApiDiscoveryResponseCustomer.md +10 -0
  7. data/docs/ApiDiscoveryResponseCustomerCustomer.md +11 -0
  8. data/docs/ApiDiscoveryResponseEnable.md +12 -0
  9. data/docs/ApiDiscoveryResponseEnabledServices.md +10 -0
  10. data/docs/ApiDiscoveryResponseLinks.md +10 -0
  11. data/docs/ApiDiscoveryResponseLinksGetAllServices.md +10 -0
  12. data/docs/ApiDiscoveryResponseLinksGetAllServicesLinks.md +10 -0
  13. data/docs/ApiDiscoveryResponseLinksLinks.md +10 -0
  14. data/docs/ApiDiscoveryResponseProduct.md +10 -0
  15. data/docs/ApiDiscoveryResponseProductProduct.md +11 -0
  16. data/docs/ApiDiscoveryResponseService.md +10 -0
  17. data/docs/{BotManagementResponseServiceService.md → ApiDiscoveryResponseServiceService.md} +1 -1
  18. data/docs/BotManagementResponseBodyEnable.md +1 -1
  19. data/docs/BotManagementResponseService.md +1 -1
  20. data/docs/BrotliCompressionResponseBodyEnable.md +1 -1
  21. data/docs/BrotliCompressionResponseService.md +1 -1
  22. data/docs/DdosProtectionApi.md +2 -0
  23. data/docs/DdosProtectionEvent.md +2 -0
  24. data/docs/DdosProtectionEventAllOf.md +2 -0
  25. data/docs/DdosProtectionRequestEnableMode.md +10 -0
  26. data/docs/DdosProtectionResponseConfigure.md +1 -1
  27. data/docs/DdosProtectionResponseEnable.md +1 -1
  28. data/docs/DdosProtectionResponseService.md +1 -1
  29. data/docs/DdosProtectionRuleWithStats.md +23 -0
  30. data/docs/DdosProtectionRuleWithStatsAllOf.md +10 -0
  31. data/docs/DdosProtectionTrafficStats.md +1 -0
  32. data/docs/DdosProtectionTrafficStatsAllOf.md +1 -0
  33. data/docs/DmDomainsApi.md +220 -0
  34. data/docs/DomainInspectorHistoricalApi.md +1 -1
  35. data/docs/DomainInspectorResponseBodyEnable.md +1 -1
  36. data/docs/DomainInspectorResponseService.md +1 -1
  37. data/docs/DomainOwnershipsApi.md +2 -2
  38. data/docs/DomainResearchApi.md +103 -0
  39. data/docs/DomainResearchResponseBodyEnable.md +12 -0
  40. data/docs/DomainResearchResponseCustomer.md +10 -0
  41. data/docs/DomainResearchResponseLinks.md +10 -0
  42. data/docs/DomainResearchResponseLinksLinks.md +10 -0
  43. data/docs/DomainResearchResponseProduct.md +10 -0
  44. data/docs/DomainResearchResponseProductProduct.md +11 -0
  45. data/docs/FanoutResponseBodyEnable.md +1 -1
  46. data/docs/FanoutResponseService.md +1 -1
  47. data/docs/Healthcheck.md +1 -1
  48. data/docs/HealthcheckApi.md +4 -4
  49. data/docs/HealthcheckResponse.md +1 -1
  50. data/docs/IamRolesApi.md +23 -253
  51. data/docs/IamV1RoleListResponse.md +12 -0
  52. data/docs/IamV1RoleResponse.md +14 -0
  53. data/docs/ImageOptimizerResponseBodyEnable.md +1 -1
  54. data/docs/ImageOptimizerResponseService.md +1 -1
  55. data/docs/InlineResponse20010.md +11 -0
  56. data/docs/InlineResponse20011.md +10 -0
  57. data/docs/InlineResponse2003.md +2 -2
  58. data/docs/InlineResponse2004.md +2 -1
  59. data/docs/InlineResponse2005.md +1 -2
  60. data/docs/InlineResponse2006.md +1 -2
  61. data/docs/InlineResponse2007.md +1 -1
  62. data/docs/InlineResponse2008.md +1 -1
  63. data/docs/InlineResponse2009.md +2 -1
  64. data/docs/InvitationDataAttributes.md +1 -0
  65. data/docs/KvStoreApi.md +43 -4
  66. data/docs/KvStoreDetails.md +2 -0
  67. data/docs/KvStoreItemApi.md +2 -2
  68. data/docs/{KvStoreRequestCreate.md → KvStoreRequestCreateOrUpdate.md} +1 -1
  69. data/docs/LogExplorerInsightsResponseBodyEnable.md +1 -1
  70. data/docs/LogExplorerInsightsResponseService.md +1 -1
  71. data/docs/LoggingHttpsAdditional.md +1 -0
  72. data/docs/LoggingHttpsApi.md +4 -0
  73. data/docs/LoggingHttpsResponse.md +1 -0
  74. data/docs/MetricsPlatformApi.md +75 -0
  75. data/docs/NgwafRequestEnable.md +1 -0
  76. data/docs/NgwafResponseConfigure.md +1 -1
  77. data/docs/NgwafResponseEnable.md +1 -1
  78. data/docs/NgwafResponseService.md +1 -1
  79. data/docs/Offer.md +12 -0
  80. data/docs/OfferAllOf.md +12 -0
  81. data/docs/OriginInspectorHistoricalApi.md +1 -1
  82. data/docs/OriginInspectorResponseBodyEnable.md +1 -1
  83. data/docs/OriginInspectorResponseService.md +1 -1
  84. data/docs/PlatformMetadata.md +14 -0
  85. data/docs/PlatformMetricsResponse.md +11 -0
  86. data/docs/PlatformValues.md +25 -0
  87. data/docs/ProductApiDiscoveryApi.md +163 -0
  88. data/docs/ProductDdosProtectionApi.md +3 -1
  89. data/docs/ProductDomainResearchApi.md +115 -0
  90. data/docs/RealtimeEntryAggregated.md +5 -0
  91. data/docs/RealtimeMeasurements.md +5 -0
  92. data/docs/RequestBodyForCreate.md +12 -0
  93. data/docs/RequestBodyForUpdate.md +11 -0
  94. data/docs/Results.md +5 -0
  95. data/docs/SchemasUserResponse.md +1 -0
  96. data/docs/SecretStoreApi.md +2 -2
  97. data/docs/SecretStoreItemApi.md +2 -2
  98. data/docs/ServiceAuthorizationsApi.md +2 -2
  99. data/docs/Status.md +15 -0
  100. data/docs/StatusAllOf.md +15 -0
  101. data/docs/SuccessfulResponseAsObject.md +17 -0
  102. data/docs/SuccessfulResponseAsObjectAllOf.md +15 -0
  103. data/docs/Suggestion.md +13 -0
  104. data/docs/SuggestionAllOf.md +13 -0
  105. data/docs/User.md +1 -0
  106. data/docs/UserApi.md +4 -0
  107. data/docs/UserResponse.md +1 -0
  108. data/docs/WebsocketsResponseBodyEnable.md +1 -1
  109. data/docs/WebsocketsResponseService.md +1 -1
  110. data/lib/fastly/api/ddos_protection_api.rb +3 -0
  111. data/lib/fastly/api/dm_domains_api.rb +362 -0
  112. data/lib/fastly/api/domain_inspector_historical_api.rb +1 -1
  113. data/lib/fastly/api/domain_ownerships_api.rb +3 -3
  114. data/lib/fastly/api/domain_research_api.rb +163 -0
  115. data/lib/fastly/api/healthcheck_api.rb +20 -4
  116. data/lib/fastly/api/iam_roles_api.rb +43 -435
  117. data/lib/fastly/api/kv_store_api.rb +74 -6
  118. data/lib/fastly/api/kv_store_item_api.rb +3 -3
  119. data/lib/fastly/api/logging_https_api.rb +6 -0
  120. data/lib/fastly/api/metrics_platform_api.rb +134 -0
  121. data/lib/fastly/api/origin_inspector_historical_api.rb +1 -1
  122. data/lib/fastly/api/product_api_discovery_api.rb +263 -0
  123. data/lib/fastly/api/product_ddos_protection_api.rb +10 -3
  124. data/lib/fastly/api/product_domain_research_api.rb +186 -0
  125. data/lib/fastly/api/secret_store_api.rb +3 -3
  126. data/lib/fastly/api/secret_store_item_api.rb +3 -3
  127. data/lib/fastly/api/service_authorizations_api.rb +3 -3
  128. data/lib/fastly/api/user_api.rb +6 -0
  129. data/lib/fastly/configuration.rb +98 -38
  130. data/lib/fastly/models/api_discovery_response_body_get_all_services.rb +256 -0
  131. data/lib/fastly/models/api_discovery_response_customer.rb +216 -0
  132. data/lib/fastly/models/api_discovery_response_customer_customer.rb +227 -0
  133. data/lib/fastly/models/api_discovery_response_enable.rb +243 -0
  134. data/lib/fastly/models/api_discovery_response_enabled_services.rb +219 -0
  135. data/lib/fastly/models/api_discovery_response_links.rb +216 -0
  136. data/lib/fastly/models/api_discovery_response_links_get_all_services.rb +216 -0
  137. data/lib/fastly/models/api_discovery_response_links_get_all_services_links.rb +217 -0
  138. data/lib/fastly/models/api_discovery_response_links_links.rb +217 -0
  139. data/lib/fastly/models/api_discovery_response_product.rb +216 -0
  140. data/lib/fastly/models/api_discovery_response_product_product.rb +227 -0
  141. data/lib/fastly/models/api_discovery_response_service.rb +216 -0
  142. data/lib/fastly/models/{bot_management_response_service_service.rb → api_discovery_response_service_service.rb} +3 -3
  143. data/lib/fastly/models/bot_management_response_body_enable.rb +1 -1
  144. data/lib/fastly/models/bot_management_response_service.rb +1 -1
  145. data/lib/fastly/models/brotli_compression_response_body_enable.rb +1 -1
  146. data/lib/fastly/models/brotli_compression_response_service.rb +1 -1
  147. data/lib/fastly/models/ddos_protection_event.rb +21 -1
  148. data/lib/fastly/models/ddos_protection_event_all_of.rb +21 -1
  149. data/lib/fastly/models/ddos_protection_request_enable_mode.rb +251 -0
  150. data/lib/fastly/models/ddos_protection_response_configure.rb +1 -1
  151. data/lib/fastly/models/ddos_protection_response_enable.rb +1 -1
  152. data/lib/fastly/models/ddos_protection_response_service.rb +1 -1
  153. data/lib/fastly/models/ddos_protection_rule_with_stats.rb +365 -0
  154. data/lib/fastly/models/ddos_protection_rule_with_stats_all_of.rb +216 -0
  155. data/lib/fastly/models/ddos_protection_traffic_stats.rb +20 -4
  156. data/lib/fastly/models/ddos_protection_traffic_stats_all_of.rb +20 -4
  157. data/lib/fastly/models/domain_inspector_response_body_enable.rb +1 -1
  158. data/lib/fastly/models/domain_inspector_response_service.rb +1 -1
  159. data/lib/fastly/models/domain_research_response_body_enable.rb +243 -0
  160. data/lib/fastly/models/domain_research_response_customer.rb +216 -0
  161. data/lib/fastly/models/domain_research_response_links.rb +216 -0
  162. data/lib/fastly/models/domain_research_response_links_links.rb +217 -0
  163. data/lib/fastly/models/domain_research_response_product.rb +216 -0
  164. data/lib/fastly/models/domain_research_response_product_product.rb +227 -0
  165. data/lib/fastly/models/fanout_response_body_enable.rb +1 -1
  166. data/lib/fastly/models/fanout_response_service.rb +1 -1
  167. data/lib/fastly/models/healthcheck.rb +25 -1
  168. data/lib/fastly/models/healthcheck_response.rb +25 -1
  169. data/lib/fastly/models/iam_v1_role_list_response.rb +240 -0
  170. data/lib/fastly/models/{iam_role_all_of.rb → iam_v1_role_response.rb} +23 -34
  171. data/lib/fastly/models/image_optimizer_response_body_enable.rb +1 -1
  172. data/lib/fastly/models/image_optimizer_response_service.rb +1 -1
  173. data/lib/fastly/models/inline_response20010.rb +227 -0
  174. data/lib/fastly/models/inline_response20011.rb +218 -0
  175. data/lib/fastly/models/inline_response2003.rb +11 -1
  176. data/lib/fastly/models/inline_response2004.rb +20 -8
  177. data/lib/fastly/models/inline_response2005.rb +8 -18
  178. data/lib/fastly/models/inline_response2006.rb +8 -17
  179. data/lib/fastly/models/inline_response2007.rb +1 -1
  180. data/lib/fastly/models/inline_response2008.rb +1 -1
  181. data/lib/fastly/models/inline_response2009.rb +13 -4
  182. data/lib/fastly/models/invitation_data_attributes.rb +12 -1
  183. data/lib/fastly/models/kv_store_details.rb +24 -4
  184. data/lib/fastly/models/{kv_store_request_create.rb → kv_store_request_create_or_update.rb} +3 -3
  185. data/lib/fastly/models/log_explorer_insights_response_body_enable.rb +1 -1
  186. data/lib/fastly/models/log_explorer_insights_response_service.rb +1 -1
  187. data/lib/fastly/models/logging_https_additional.rb +16 -4
  188. data/lib/fastly/models/logging_https_response.rb +13 -1
  189. data/lib/fastly/models/ngwaf_request_enable.rb +14 -4
  190. data/lib/fastly/models/ngwaf_response_configure.rb +1 -1
  191. data/lib/fastly/models/ngwaf_response_enable.rb +1 -1
  192. data/lib/fastly/models/ngwaf_response_service.rb +1 -1
  193. data/lib/fastly/models/offer.rb +245 -0
  194. data/lib/fastly/models/offer_all_of.rb +237 -0
  195. data/lib/fastly/models/origin_inspector_response_body_enable.rb +1 -1
  196. data/lib/fastly/models/origin_inspector_response_service.rb +1 -1
  197. data/lib/fastly/models/platform_metadata.rb +258 -0
  198. data/lib/fastly/models/platform_metrics_response.rb +228 -0
  199. data/lib/fastly/models/platform_values.rb +368 -0
  200. data/lib/fastly/models/realtime_entry_aggregated.rb +54 -4
  201. data/lib/fastly/models/realtime_measurements.rb +54 -4
  202. data/lib/fastly/models/request_body_for_create.rb +244 -0
  203. data/lib/fastly/models/request_body_for_update.rb +229 -0
  204. data/lib/fastly/models/results.rb +51 -1
  205. data/lib/fastly/models/role_user.rb +2 -0
  206. data/lib/fastly/models/schemas_user_response.rb +13 -1
  207. data/lib/fastly/models/status.rb +276 -0
  208. data/lib/fastly/models/status_all_of.rb +268 -0
  209. data/lib/fastly/models/{iam_role.rb → successful_response_as_object.rb} +37 -35
  210. data/lib/fastly/models/successful_response_as_object_all_of.rb +268 -0
  211. data/lib/fastly/models/suggestion.rb +255 -0
  212. data/lib/fastly/models/suggestion_all_of.rb +247 -0
  213. data/lib/fastly/models/user.rb +13 -1
  214. data/lib/fastly/models/user_response.rb +13 -1
  215. data/lib/fastly/models/websockets_response_body_enable.rb +1 -1
  216. data/lib/fastly/models/websockets_response_service.rb +1 -1
  217. data/lib/fastly/version.rb +1 -1
  218. data/lib/fastly.rb +45 -4
  219. data/sig.json +1 -1
  220. metadata +92 -10
  221. data/docs/IamRole.md +0 -17
  222. data/docs/IamRoleAllOf.md +0 -15
@@ -0,0 +1,276 @@
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
+ # All attributes for a domain status.
16
+ class Status
17
+ # The scope provided in the status request.
18
+ attr_accessor :scope
19
+
20
+ # The domain provided in the status request.
21
+ attr_accessor :domain
22
+
23
+ # The zone of the domain provided of the status request.
24
+ attr_accessor :zone
25
+
26
+ # A space-delimited string of the varying statuses associated with the domain provided.
27
+ attr_accessor :status
28
+
29
+ # A space-delimited string of the varying tags associated with the domain provided.
30
+ attr_accessor :tags
31
+
32
+ attr_accessor :offers
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'scope' => :'scope',
38
+ :'domain' => :'domain',
39
+ :'zone' => :'zone',
40
+ :'status' => :'status',
41
+ :'tags' => :'tags',
42
+ :'offers' => :'offers'
43
+ }
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.fastly_types
53
+ {
54
+ :'scope' => :'String',
55
+ :'domain' => :'String',
56
+ :'zone' => :'String',
57
+ :'status' => :'String',
58
+ :'tags' => :'String',
59
+ :'offers' => :'Array<Offer>'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.fastly_nullable
65
+ Set.new([
66
+ ])
67
+ end
68
+
69
+ # List of class defined in allOf (OpenAPI v3)
70
+ def self.fastly_all_of
71
+ [
72
+ :'StatusAllOf'
73
+ ]
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Status` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if (!self.class.attribute_map.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Status`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ if attributes.key?(:'scope')
92
+ self.scope = attributes[:'scope']
93
+ end
94
+
95
+ if attributes.key?(:'domain')
96
+ self.domain = attributes[:'domain']
97
+ end
98
+
99
+ if attributes.key?(:'zone')
100
+ self.zone = attributes[:'zone']
101
+ end
102
+
103
+ if attributes.key?(:'status')
104
+ self.status = attributes[:'status']
105
+ end
106
+
107
+ if attributes.key?(:'tags')
108
+ self.tags = attributes[:'tags']
109
+ end
110
+
111
+ if attributes.key?(:'offers')
112
+ if (value = attributes[:'offers']).is_a?(Array)
113
+ self.offers = value
114
+ end
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ invalid_properties = Array.new
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ true
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ scope == o.scope &&
137
+ domain == o.domain &&
138
+ zone == o.zone &&
139
+ status == o.status &&
140
+ tags == o.tags &&
141
+ offers == o.offers
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [scope, domain, zone, status, tags, offers].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ self.class.fastly_types.each_pair do |key, type|
169
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
170
+ self.send("#{key}=", nil)
171
+ elsif type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
175
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
176
+ end
177
+ elsif !attributes[self.class.attribute_map[key]].nil?
178
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
179
+ end
180
+ end
181
+
182
+ self
183
+ end
184
+
185
+ # Deserializes the data based on type
186
+ # @param string type Data type
187
+ # @param string value Value to be deserialized
188
+ # @return [Object] Deserialized data
189
+ def _deserialize(type, value)
190
+ case type.to_sym
191
+ when :Time
192
+ Time.parse(value)
193
+ when :Date
194
+ Date.parse(value)
195
+ when :String
196
+ value.to_s
197
+ when :Integer
198
+ value.to_i
199
+ when :Float
200
+ value.to_f
201
+ when :Boolean
202
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
203
+ true
204
+ else
205
+ false
206
+ end
207
+ when :Object
208
+ # generic object (usually a Hash), return directly
209
+ value
210
+ when /\AArray<(?<inner_type>.+)>\z/
211
+ inner_type = Regexp.last_match[:inner_type]
212
+ value.map { |v| _deserialize(inner_type, v) }
213
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
214
+ k_type = Regexp.last_match[:k_type]
215
+ v_type = Regexp.last_match[:v_type]
216
+ {}.tap do |hash|
217
+ value.each do |k, v|
218
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
219
+ end
220
+ end
221
+ else # model
222
+ # models (e.g. Pet) or oneOf
223
+ klass = Fastly.const_get(type)
224
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
225
+ end
226
+ end
227
+
228
+ # Returns the string representation of the object
229
+ # @return [String] String presentation of the object
230
+ def to_s
231
+ to_hash.to_s
232
+ end
233
+
234
+ # to_body is an alias to to_hash (backward compatibility)
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_body
237
+ to_hash
238
+ end
239
+
240
+ # Returns the object in the form of hash
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ if value.nil?
247
+ is_nullable = self.class.fastly_nullable.include?(attr)
248
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
249
+ end
250
+
251
+ hash[param] = _to_hash(value)
252
+ end
253
+ hash
254
+ end
255
+
256
+ # Outputs non-array value in the form of hash
257
+ # For object, use to_hash. Otherwise, just return the value
258
+ # @param [Object] value Any valid value
259
+ # @return [Hash] Returns the value in the form of hash
260
+ def _to_hash(value)
261
+ if value.is_a?(Array)
262
+ value.compact.map { |v| _to_hash(v) }
263
+ elsif value.is_a?(Hash)
264
+ {}.tap do |hash|
265
+ value.each { |k, v| hash[k] = _to_hash(v) }
266
+ end
267
+ elsif value.respond_to? :to_hash
268
+ value.to_hash
269
+ else
270
+ value
271
+ end
272
+ end
273
+
274
+ end
275
+
276
+ end
@@ -0,0 +1,268 @@
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 StatusAllOf
16
+ # The scope provided in the status request.
17
+ attr_accessor :scope
18
+
19
+ # The domain provided in the status request.
20
+ attr_accessor :domain
21
+
22
+ # The zone of the domain provided of the status request.
23
+ attr_accessor :zone
24
+
25
+ # A space-delimited string of the varying statuses associated with the domain provided.
26
+ attr_accessor :status
27
+
28
+ # A space-delimited string of the varying tags associated with the domain provided.
29
+ attr_accessor :tags
30
+
31
+ attr_accessor :offers
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'scope' => :'scope',
37
+ :'domain' => :'domain',
38
+ :'zone' => :'zone',
39
+ :'status' => :'status',
40
+ :'tags' => :'tags',
41
+ :'offers' => :'offers'
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.fastly_types
52
+ {
53
+ :'scope' => :'String',
54
+ :'domain' => :'String',
55
+ :'zone' => :'String',
56
+ :'status' => :'String',
57
+ :'tags' => :'String',
58
+ :'offers' => :'Array<Offer>'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.fastly_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::StatusAllOf` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::StatusAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'scope')
84
+ self.scope = attributes[:'scope']
85
+ end
86
+
87
+ if attributes.key?(:'domain')
88
+ self.domain = attributes[:'domain']
89
+ end
90
+
91
+ if attributes.key?(:'zone')
92
+ self.zone = attributes[:'zone']
93
+ end
94
+
95
+ if attributes.key?(:'status')
96
+ self.status = attributes[:'status']
97
+ end
98
+
99
+ if attributes.key?(:'tags')
100
+ self.tags = attributes[:'tags']
101
+ end
102
+
103
+ if attributes.key?(:'offers')
104
+ if (value = attributes[:'offers']).is_a?(Array)
105
+ self.offers = value
106
+ end
107
+ end
108
+ end
109
+
110
+ # Show invalid properties with the reasons. Usually used together with valid?
111
+ # @return Array for valid properties with the reasons
112
+ def list_invalid_properties
113
+ invalid_properties = Array.new
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ true
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(o)
126
+ return true if self.equal?(o)
127
+ self.class == o.class &&
128
+ scope == o.scope &&
129
+ domain == o.domain &&
130
+ zone == o.zone &&
131
+ status == o.status &&
132
+ tags == o.tags &&
133
+ offers == o.offers
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(o)
139
+ self == o
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Integer] Hash code
144
+ def hash
145
+ [scope, domain, zone, status, tags, offers].hash
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def self.build_from_hash(attributes)
152
+ new.build_from_hash(attributes)
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def build_from_hash(attributes)
159
+ return nil unless attributes.is_a?(Hash)
160
+ self.class.fastly_types.each_pair do |key, type|
161
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
162
+ self.send("#{key}=", nil)
163
+ elsif type =~ /\AArray<(.*)>/i
164
+ # check to ensure the input is an array given that the attribute
165
+ # is documented as an array but the input is not
166
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
167
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
168
+ end
169
+ elsif !attributes[self.class.attribute_map[key]].nil?
170
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
171
+ end
172
+ end
173
+
174
+ self
175
+ end
176
+
177
+ # Deserializes the data based on type
178
+ # @param string type Data type
179
+ # @param string value Value to be deserialized
180
+ # @return [Object] Deserialized data
181
+ def _deserialize(type, value)
182
+ case type.to_sym
183
+ when :Time
184
+ Time.parse(value)
185
+ when :Date
186
+ Date.parse(value)
187
+ when :String
188
+ value.to_s
189
+ when :Integer
190
+ value.to_i
191
+ when :Float
192
+ value.to_f
193
+ when :Boolean
194
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
195
+ true
196
+ else
197
+ false
198
+ end
199
+ when :Object
200
+ # generic object (usually a Hash), return directly
201
+ value
202
+ when /\AArray<(?<inner_type>.+)>\z/
203
+ inner_type = Regexp.last_match[:inner_type]
204
+ value.map { |v| _deserialize(inner_type, v) }
205
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
206
+ k_type = Regexp.last_match[:k_type]
207
+ v_type = Regexp.last_match[:v_type]
208
+ {}.tap do |hash|
209
+ value.each do |k, v|
210
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
+ end
212
+ end
213
+ else # model
214
+ # models (e.g. Pet) or oneOf
215
+ klass = Fastly.const_get(type)
216
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.fastly_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+
266
+ end
267
+
268
+ end