fastly 5.3.1 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +55 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +85 -63
  5. data/docs/AclEntry.md +1 -1
  6. data/docs/AclEntryApi.md +176 -0
  7. data/docs/AclEntryResponse.md +1 -1
  8. data/docs/ApexRedirectApi.md +56 -0
  9. data/docs/BulkUpdateAclEntry.md +1 -1
  10. data/docs/ClientKey.md +12 -0
  11. data/docs/ContactApi.md +50 -0
  12. data/docs/Content.md +2 -2
  13. data/docs/ContentApi.md +52 -0
  14. data/docs/DirectorApi.md +42 -0
  15. data/docs/DomainInspector.md +12 -0
  16. data/docs/DomainInspectorEntry.md +11 -0
  17. data/docs/DomainInspectorEntryDimensions.md +12 -0
  18. data/docs/DomainInspectorHistoricalApi.md +72 -0
  19. data/docs/DomainInspectorMeasurements.md +71 -0
  20. data/docs/DomainInspectorRealtimeApi.md +132 -0
  21. data/docs/DomainInspectorRealtimeEntry.md +12 -0
  22. data/docs/EventAttributes.md +1 -1
  23. data/docs/{EventsResponseAllOf.md → EventData.md} +1 -1
  24. data/docs/HistoricalDomains.md +13 -0
  25. data/docs/HistoricalDomainsData.md +11 -0
  26. data/docs/HistoricalDomainsMeta.md +18 -0
  27. data/docs/HistoricalDomainsMetaFilters.md +12 -0
  28. data/docs/HistoricalDomainsResponse.md +13 -0
  29. data/docs/HistoricalDomainsResponseAllOf.md +10 -0
  30. data/docs/{HistoricalFieldResultsAttributesAllOf.md → HistoricalFieldResultsAttributesAdditional.md} +1 -1
  31. data/docs/HistoricalOriginsResponse.md +13 -0
  32. data/docs/HistoricalOriginsResponseAllOf.md +10 -0
  33. data/docs/IamRolesApi.md +157 -0
  34. data/docs/IamServiceGroupsApi.md +157 -0
  35. data/docs/IamUserGroupsApi.md +315 -0
  36. data/docs/InlineResponse2005.md +11 -0
  37. data/docs/InlineResponse2006.md +11 -0
  38. data/docs/InlineResponse2007.md +10 -0
  39. data/docs/InlineResponse400.md +10 -0
  40. data/docs/LegacyWafConfigurationSet.md +11 -0
  41. data/docs/LegacyWafConfigurationSetsApi.md +125 -0
  42. data/docs/LegacyWafFirewall.md +18 -0
  43. data/docs/LegacyWafFirewallApi.md +352 -0
  44. data/docs/LegacyWafOwasp.md +38 -0
  45. data/docs/LegacyWafOwaspApi.md +138 -0
  46. data/docs/LegacyWafRule.md +14 -0
  47. data/docs/LegacyWafRuleApi.md +184 -0
  48. data/docs/LegacyWafRuleStatus.md +12 -0
  49. data/docs/LegacyWafRuleStatusApi.md +202 -0
  50. data/docs/LegacyWafRuleset.md +11 -0
  51. data/docs/LegacyWafRulesetApi.md +136 -0
  52. data/docs/LegacyWafTag.md +10 -0
  53. data/docs/LegacyWafTagApi.md +58 -0
  54. data/docs/LegacyWafUpdateStatus.md +15 -0
  55. data/docs/LegacyWafUpdateStatusApi.md +102 -0
  56. data/docs/LoggingKafkaApi.md +42 -0
  57. data/docs/LoggingKinesisApi.md +42 -0
  58. data/docs/OriginInspector.md +12 -0
  59. data/docs/OriginInspectorDimensions.md +12 -0
  60. data/docs/OriginInspectorEntry.md +11 -0
  61. data/docs/OriginInspectorHistorical.md +13 -0
  62. data/docs/OriginInspectorHistoricalApi.md +72 -0
  63. data/docs/OriginInspectorHistoricalData.md +11 -0
  64. data/docs/OriginInspectorHistoricalMeta.md +18 -0
  65. data/docs/OriginInspectorHistoricalMetaFilters.md +12 -0
  66. data/docs/OriginInspectorMeasurements.md +161 -0
  67. data/docs/OriginInspectorRealtimeApi.md +132 -0
  68. data/docs/OriginInspectorRealtimeEntry.md +12 -0
  69. data/docs/OriginInspectorRealtimeEntryRecorded.md +9 -0
  70. data/docs/OriginInspectorSubsequentRequestTimestamp.md +9 -0
  71. data/docs/OriginInspectorValues.md +161 -0
  72. data/docs/PaginationCursorMeta.md +11 -0
  73. data/docs/ReadOnlyServiceId.md +9 -0
  74. data/docs/ReadOnlyVersion.md +9 -0
  75. data/docs/RealtimeEntry.md +2 -2
  76. data/docs/RealtimeEntryAggregated.md +227 -0
  77. data/docs/RealtimeEntryRecorded.md +9 -0
  78. data/docs/RealtimeMeasurements.md +1 -1
  79. data/docs/RecordedTimestamp.md +9 -0
  80. data/docs/RequestSettingsApi.md +40 -0
  81. data/docs/ResponseObjectApi.md +82 -0
  82. data/docs/Secret.md +12 -0
  83. data/docs/SecretResponse.md +13 -0
  84. data/docs/SecretStore.md +10 -0
  85. data/docs/SecretStoreApi.md +233 -0
  86. data/docs/SecretStoreItemApi.md +255 -0
  87. data/docs/SecretStoreResponse.md +12 -0
  88. data/docs/ServiceAuthorizationsApi.md +76 -0
  89. data/docs/SigningKey.md +10 -0
  90. data/docs/SnippetApi.md +42 -0
  91. data/docs/SubsequentRequestTimestamp.md +9 -0
  92. data/docs/SudoApi.md +52 -0
  93. data/docs/SudoGenericTokenError.md +10 -0
  94. data/docs/SudoRequest.md +12 -0
  95. data/docs/SudoResponse.md +10 -0
  96. data/docs/TokensApi.md +70 -0
  97. data/docs/Values.md +71 -0
  98. data/docs/WafActiveRulesApi.md +41 -0
  99. data/lib/fastly/api/acl_entry_api.rb +332 -0
  100. data/lib/fastly/api/apex_redirect_api.rb +111 -0
  101. data/lib/fastly/api/contact_api.rb +90 -0
  102. data/lib/fastly/api/content_api.rb +79 -0
  103. data/lib/fastly/api/director_api.rb +82 -0
  104. data/lib/fastly/api/domain_inspector_historical_api.rb +125 -0
  105. data/lib/fastly/api/domain_inspector_realtime_api.rb +223 -0
  106. data/lib/fastly/api/iam_roles_api.rb +271 -0
  107. data/lib/fastly/api/iam_service_groups_api.rb +271 -0
  108. data/lib/fastly/api/iam_user_groups_api.rb +547 -0
  109. data/lib/fastly/api/legacy_waf_configuration_sets_api.rb +209 -0
  110. data/lib/fastly/api/legacy_waf_firewall_api.rb +627 -0
  111. data/lib/fastly/api/legacy_waf_owasp_api.rb +244 -0
  112. data/lib/fastly/api/legacy_waf_rule_api.rb +307 -0
  113. data/lib/fastly/api/legacy_waf_rule_status_api.rb +366 -0
  114. data/lib/fastly/api/legacy_waf_ruleset_api.rb +237 -0
  115. data/lib/fastly/api/legacy_waf_tag_api.rb +96 -0
  116. data/lib/fastly/api/legacy_waf_update_status_api.rb +184 -0
  117. data/lib/fastly/api/logging_kafka_api.rb +82 -0
  118. data/lib/fastly/api/logging_kinesis_api.rb +82 -0
  119. data/lib/fastly/api/origin_inspector_historical_api.rb +125 -0
  120. data/lib/fastly/api/origin_inspector_realtime_api.rb +223 -0
  121. data/lib/fastly/api/request_settings_api.rb +75 -0
  122. data/lib/fastly/api/response_object_api.rb +157 -0
  123. data/lib/fastly/api/secret_store_api.rb +381 -0
  124. data/lib/fastly/api/secret_store_item_api.rb +437 -0
  125. data/lib/fastly/api/service_authorizations_api.rb +126 -0
  126. data/lib/fastly/api/snippet_api.rb +82 -0
  127. data/lib/fastly/api/sudo_api.rb +83 -0
  128. data/lib/fastly/api/tokens_api.rb +122 -0
  129. data/lib/fastly/api/waf_active_rules_api.rb +75 -0
  130. data/lib/fastly/configuration.rb +504 -0
  131. data/lib/fastly/models/acl_entry.rb +1 -1
  132. data/lib/fastly/models/acl_entry_response.rb +1 -1
  133. data/lib/fastly/models/bulk_update_acl_entry.rb +1 -1
  134. data/lib/fastly/models/client_key.rb +239 -0
  135. data/lib/fastly/models/content.rb +8 -4
  136. data/lib/fastly/models/domain.rb +1 -0
  137. data/lib/fastly/models/domain_inspector.rb +238 -0
  138. data/lib/fastly/models/domain_inspector_entry.rb +228 -0
  139. data/lib/fastly/models/domain_inspector_entry_dimensions.rb +238 -0
  140. data/lib/fastly/models/domain_inspector_measurements.rb +828 -0
  141. data/lib/fastly/models/domain_inspector_realtime_entry.rb +241 -0
  142. data/lib/fastly/models/event_attributes.rb +4 -2
  143. data/lib/fastly/models/{events_response_all_of.rb → event_data.rb} +3 -3
  144. data/lib/fastly/models/events_response.rb +1 -1
  145. data/lib/fastly/models/historical_domains.rb +249 -0
  146. data/lib/fastly/models/historical_domains_data.rb +228 -0
  147. data/lib/fastly/models/historical_domains_meta.rb +297 -0
  148. data/lib/fastly/models/historical_domains_meta_filters.rb +235 -0
  149. data/lib/fastly/models/historical_domains_response.rb +257 -0
  150. data/lib/fastly/models/historical_domains_response_all_of.rb +219 -0
  151. data/lib/fastly/models/historical_field_results_attributes.rb +1 -1
  152. data/lib/fastly/models/{historical_field_results_attributes_all_of.rb → historical_field_results_attributes_additional.rb} +3 -3
  153. data/lib/fastly/models/historical_origins_response.rb +257 -0
  154. data/lib/fastly/models/historical_origins_response_all_of.rb +219 -0
  155. data/lib/fastly/models/inline_response2005.rb +227 -0
  156. data/lib/fastly/models/inline_response2006.rb +227 -0
  157. data/lib/fastly/models/inline_response2007.rb +218 -0
  158. data/lib/fastly/models/inline_response400.rb +250 -0
  159. data/lib/fastly/models/legacy_waf_configuration_set.rb +227 -0
  160. data/lib/fastly/models/legacy_waf_firewall.rb +297 -0
  161. data/lib/fastly/models/legacy_waf_owasp.rb +527 -0
  162. data/lib/fastly/models/legacy_waf_rule.rb +257 -0
  163. data/lib/fastly/models/legacy_waf_rule_status.rb +237 -0
  164. data/lib/fastly/models/legacy_waf_ruleset.rb +227 -0
  165. data/lib/fastly/models/legacy_waf_tag.rb +217 -0
  166. data/lib/fastly/models/legacy_waf_update_status.rb +267 -0
  167. data/lib/fastly/models/origin_inspector.rb +238 -0
  168. data/lib/fastly/models/origin_inspector_dimensions.rb +238 -0
  169. data/lib/fastly/models/origin_inspector_entry.rb +228 -0
  170. data/lib/fastly/models/origin_inspector_historical.rb +249 -0
  171. data/lib/fastly/models/origin_inspector_historical_data.rb +225 -0
  172. data/lib/fastly/models/origin_inspector_historical_meta.rb +297 -0
  173. data/lib/fastly/models/origin_inspector_historical_meta_filters.rb +235 -0
  174. data/lib/fastly/models/origin_inspector_measurements.rb +1728 -0
  175. data/lib/fastly/models/origin_inspector_realtime_entry.rb +241 -0
  176. data/lib/fastly/models/origin_inspector_realtime_entry_recorded.rb +208 -0
  177. data/lib/fastly/models/origin_inspector_subsequent_request_timestamp.rb +208 -0
  178. data/lib/fastly/models/origin_inspector_values.rb +1728 -0
  179. data/lib/fastly/models/pagination_cursor_meta.rb +227 -0
  180. data/lib/fastly/models/read_only_service_id.rb +207 -0
  181. data/lib/fastly/models/read_only_version.rb +207 -0
  182. data/lib/fastly/models/realtime_entry.rb +2 -7
  183. data/lib/fastly/models/realtime_entry_aggregated.rb +2397 -0
  184. data/lib/fastly/models/realtime_entry_recorded.rb +208 -0
  185. data/lib/fastly/models/realtime_measurements.rb +4 -2
  186. data/lib/fastly/models/recorded_timestamp.rb +208 -0
  187. data/lib/fastly/models/secret.rb +238 -0
  188. data/lib/fastly/models/secret_response.rb +249 -0
  189. data/lib/fastly/models/secret_store.rb +217 -0
  190. data/lib/fastly/models/secret_store_response.rb +238 -0
  191. data/lib/fastly/models/signing_key.rb +218 -0
  192. data/lib/fastly/models/subsequent_request_timestamp.rb +208 -0
  193. data/lib/fastly/models/sudo_generic_token_error.rb +216 -0
  194. data/lib/fastly/models/sudo_request.rb +244 -0
  195. data/lib/fastly/models/sudo_response.rb +217 -0
  196. data/lib/fastly/models/values.rb +828 -0
  197. data/lib/fastly/version.rb +1 -1
  198. data/lib/fastly.rb +72 -2
  199. data/sig.json +1 -1
  200. metadata +146 -6
@@ -0,0 +1,238 @@
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 OriginInspector
16
+ attr_accessor :timestamp
17
+
18
+ # Offset of entry timestamps from the current time due to processing time.
19
+ attr_accessor :aggregate_delay
20
+
21
+ # A list of report [entries](#entry-data-model), each representing one second of time.
22
+ attr_accessor :data
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'timestamp' => :'Timestamp',
28
+ :'aggregate_delay' => :'AggregateDelay',
29
+ :'data' => :'Data'
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
+ :'timestamp' => :'OriginInspectorSubsequentRequestTimestamp',
42
+ :'aggregate_delay' => :'Integer',
43
+ :'data' => :'Array<OriginInspectorRealtimeEntry>'
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::OriginInspector` 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::OriginInspector`. 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?(:'timestamp')
69
+ self.timestamp = attributes[:'timestamp']
70
+ end
71
+
72
+ if attributes.key?(:'aggregate_delay')
73
+ self.aggregate_delay = attributes[:'aggregate_delay']
74
+ end
75
+
76
+ if attributes.key?(:'data')
77
+ if (value = attributes[:'data']).is_a?(Array)
78
+ self.data = 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
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ timestamp == o.timestamp &&
102
+ aggregate_delay == o.aggregate_delay &&
103
+ data == o.data
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [timestamp, aggregate_delay, data].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ new.build_from_hash(attributes)
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ self.class.fastly_types.each_pair do |key, type|
131
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
132
+ self.send("#{key}=", nil)
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = Fastly.const_get(type)
186
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.fastly_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -0,0 +1,238 @@
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
+ # The unique combination of dimensions associated with this timeseries.
16
+ class OriginInspectorDimensions
17
+ # The geographic region from which the edge responses in this data entry were delivered. If unspecified, results are aggregated across regions.
18
+ attr_accessor :region
19
+
20
+ # The POP from which the edge responses in this data entry were delivered. If unspecified, results are aggregated across POPs.
21
+ attr_accessor :datacenter
22
+
23
+ # The origin host from which the edge responses in this data entry were delivered. If unspecified, results are aggregated across origin hosts.
24
+ attr_accessor :host
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'region' => :'region',
30
+ :'datacenter' => :'datacenter',
31
+ :'host' => :'host'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.fastly_types
42
+ {
43
+ :'region' => :'String',
44
+ :'datacenter' => :'String',
45
+ :'host' => :'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::OriginInspectorDimensions` 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::OriginInspectorDimensions`. 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?(:'region')
71
+ self.region = attributes[:'region']
72
+ end
73
+
74
+ if attributes.key?(:'datacenter')
75
+ self.datacenter = attributes[:'datacenter']
76
+ end
77
+
78
+ if attributes.key?(:'host')
79
+ self.host = attributes[:'host']
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
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ region == o.region &&
102
+ datacenter == o.datacenter &&
103
+ host == o.host
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [region, datacenter, host].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ new.build_from_hash(attributes)
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ self.class.fastly_types.each_pair do |key, type|
131
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
132
+ self.send("#{key}=", nil)
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = Fastly.const_get(type)
186
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.fastly_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -0,0 +1,228 @@
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 OriginInspectorEntry
16
+ attr_accessor :dimensions
17
+
18
+ # An array of values representing the metric values at each point in time. Note that this dataset is sparse: only the keys with non-zero values will be included in the record.
19
+ attr_accessor :values
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'dimensions' => :'dimensions',
25
+ :'values' => :'values'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.fastly_types
36
+ {
37
+ :'dimensions' => :'OriginInspectorDimensions',
38
+ :'values' => :'Array<OriginInspectorValues>'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.fastly_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ if (!attributes.is_a?(Hash))
52
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::OriginInspectorEntry` initialize method"
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::OriginInspectorEntry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ end
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:'dimensions')
64
+ self.dimensions = attributes[:'dimensions']
65
+ end
66
+
67
+ if attributes.key?(:'values')
68
+ if (value = attributes[:'values']).is_a?(Array)
69
+ self.values = value
70
+ end
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ dimensions == o.dimensions &&
93
+ values == o.values
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [dimensions, values].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ new.build_from_hash(attributes)
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ self.class.fastly_types.each_pair do |key, type|
121
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
122
+ self.send("#{key}=", nil)
123
+ elsif type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :Time
144
+ Time.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :Boolean
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ # models (e.g. Pet) or oneOf
175
+ klass = Fastly.const_get(type)
176
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.fastly_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+
226
+ end
227
+
228
+ end