fastly 8.4.0 → 8.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +15 -2
  5. data/docs/{RelationshipTlsDnsRecord.md → AsyncResponse.md} +3 -2
  6. data/docs/BillingInvoicesApi.md +37 -4
  7. data/docs/BillingUsageMetricsApi.md +111 -0
  8. data/docs/ContentApi.md +1 -1
  9. data/docs/CreateDashboardRequest.md +12 -0
  10. data/docs/Dashboard.md +17 -0
  11. data/docs/DashboardItem.md +15 -0
  12. data/docs/DashboardItemPropertyDataSource.md +11 -0
  13. data/docs/DashboardItemPropertyDataSourcePropertyConfig.md +10 -0
  14. data/docs/DashboardItemPropertyVisualization.md +11 -0
  15. data/docs/DashboardItemPropertyVisualizationPropertyConfig.md +12 -0
  16. data/docs/{RelationshipTlsDnsRecords.md → DashboardPropertyCreatedBy.md} +1 -2
  17. data/docs/{RelationshipTlsDnsRecordDnsRecord.md → DashboardPropertyUpdatedBy.md} +1 -2
  18. data/docs/DomainInspectorMeasurements.md +1 -1
  19. data/docs/{InvoiceResponse.md → EomInvoiceResponse.md} +1 -1
  20. data/docs/GetServiceLevelUsageResponse.md +10 -0
  21. data/docs/GetServiceLevelUsageTypesResponse.md +10 -0
  22. data/docs/IncludedWithTlsConfiguration.md +10 -0
  23. data/docs/IncludedWithTlsConfigurationItem.md +12 -0
  24. data/docs/ListDashboardsResponse.md +11 -0
  25. data/docs/{ListInvoicesResponse.md → ListEomInvoicesResponse.md} +1 -1
  26. data/docs/LoggingKafkaAdditional.md +1 -1
  27. data/docs/LoggingKafkaApi.md +2 -2
  28. data/docs/LoggingKafkaResponse.md +1 -1
  29. data/docs/LoggingKafkaResponsePost.md +1 -1
  30. data/docs/LoggingLogentriesAdditional.md +1 -1
  31. data/docs/LoggingLogentriesApi.md +4 -4
  32. data/docs/LoggingLogentriesResponse.md +1 -1
  33. data/docs/LoggingSplunkAdditional.md +1 -1
  34. data/docs/LoggingSplunkApi.md +4 -4
  35. data/docs/LoggingSplunkResponse.md +1 -1
  36. data/docs/LoggingSyslogAdditional.md +1 -1
  37. data/docs/LoggingSyslogApi.md +4 -4
  38. data/docs/LoggingSyslogResponse.md +1 -1
  39. data/docs/{LoggingUseTls.md → LoggingUseTlsString.md} +1 -1
  40. data/docs/MtdInvoiceResponse.md +15 -0
  41. data/docs/Mtdinvoice.md +15 -0
  42. data/docs/Mtdlineitems.md +18 -0
  43. data/docs/ObservabilityCustomDashboardsApi.md +203 -0
  44. data/docs/RealtimeEntryAggregated.md +1 -0
  45. data/docs/RealtimeMeasurements.md +1 -0
  46. data/docs/RelationshipDefaultEcdsaTlsCertificate.md +10 -0
  47. data/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate.md +10 -0
  48. data/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData.md +11 -0
  49. data/docs/RelationshipDefaultTlsCertificate.md +10 -0
  50. data/docs/RelationshipDefaultTlsCertificateDefaultCertificate.md +10 -0
  51. data/docs/RelationshipDefaultTlsCertificateDefaultCertificateData.md +11 -0
  52. data/docs/RelationshipTlsDnsRecordsRequest.md +10 -0
  53. data/docs/RelationshipTlsDnsRecordsRequestDnsRecords.md +10 -0
  54. data/docs/RelationshipTlsDnsRecordsRequestDnsRecordsData.md +11 -0
  55. data/docs/RelationshipTlsDnsRecordsResponse.md +10 -0
  56. data/docs/RelationshipTlsDnsRecordsResponseDnsRecords.md +10 -0
  57. data/docs/{RelationshipMemberTlsDnsRecord.md → RelationshipTlsDnsRecordsResponseDnsRecordsData.md} +1 -1
  58. data/docs/Results.md +1 -0
  59. data/docs/Serviceusagemetric.md +13 -0
  60. data/docs/Serviceusagemetrics.md +10 -0
  61. data/docs/ServiceusagemetricsData.md +16 -0
  62. data/docs/Serviceusagetype.md +11 -0
  63. data/docs/Serviceusagetypes.md +10 -0
  64. data/docs/TlsCertificateBlobResponse.md +10 -0
  65. data/docs/TlsCertificatesApi.md +38 -0
  66. data/docs/TlsDnsRecord.md +1 -2
  67. data/docs/UpdateDashboardRequest.md +12 -0
  68. data/docs/Values.md +1 -1
  69. data/lib/fastly/api/billing_invoices_api.rb +62 -6
  70. data/lib/fastly/api/billing_usage_metrics_api.rb +213 -0
  71. data/lib/fastly/api/content_api.rb +2 -2
  72. data/lib/fastly/api/logging_datadog_api.rb +2 -2
  73. data/lib/fastly/api/logging_kafka_api.rb +2 -2
  74. data/lib/fastly/api/logging_logentries_api.rb +4 -4
  75. data/lib/fastly/api/logging_splunk_api.rb +4 -4
  76. data/lib/fastly/api/logging_syslog_api.rb +4 -4
  77. data/lib/fastly/api/observability_custom_dashboards_api.rb +333 -0
  78. data/lib/fastly/api/tls_certificates_api.rb +63 -0
  79. data/lib/fastly/configuration.rb +54 -0
  80. data/lib/fastly/models/async_response.rb +225 -0
  81. data/lib/fastly/models/create_dashboard_request.rb +245 -0
  82. data/lib/fastly/models/dashboard.rb +290 -0
  83. data/lib/fastly/models/dashboard_item.rb +368 -0
  84. data/lib/fastly/models/dashboard_item_property_data_source.rb +271 -0
  85. data/lib/fastly/models/dashboard_item_property_data_source_property_config.rb +244 -0
  86. data/lib/fastly/models/dashboard_item_property_visualization.rb +271 -0
  87. data/lib/fastly/models/dashboard_item_property_visualization_property_config.rb +303 -0
  88. data/lib/fastly/models/dashboard_property_created_by.rb +208 -0
  89. data/lib/fastly/models/dashboard_property_updated_by.rb +208 -0
  90. data/lib/fastly/models/domain_inspector_measurements.rb +1 -1
  91. data/lib/fastly/models/{invoice_response.rb → eom_invoice_response.rb} +3 -3
  92. data/lib/fastly/models/get_service_level_usage_response.rb +223 -0
  93. data/lib/fastly/models/get_service_level_usage_types_response.rb +225 -0
  94. data/lib/fastly/models/included_with_tls_configuration.rb +218 -0
  95. data/lib/fastly/models/included_with_tls_configuration_item.rb +237 -0
  96. data/lib/fastly/models/invoicelineitems.rb +5 -5
  97. data/lib/fastly/models/list_dashboards_response.rb +229 -0
  98. data/lib/fastly/models/{list_invoices_response.rb → list_eom_invoices_response.rb} +3 -3
  99. data/lib/fastly/models/logging_datadog_additional.rb +2 -2
  100. data/lib/fastly/models/logging_datadog_response.rb +2 -2
  101. data/lib/fastly/models/logging_kafka_additional.rb +2 -2
  102. data/lib/fastly/models/logging_kafka_response.rb +2 -2
  103. data/lib/fastly/models/logging_kafka_response_post.rb +2 -2
  104. data/lib/fastly/models/logging_logentries_additional.rb +2 -2
  105. data/lib/fastly/models/logging_logentries_response.rb +2 -2
  106. data/lib/fastly/models/logging_splunk_additional.rb +2 -2
  107. data/lib/fastly/models/logging_splunk_response.rb +2 -2
  108. data/lib/fastly/models/logging_syslog_additional.rb +2 -2
  109. data/lib/fastly/models/logging_syslog_response.rb +2 -2
  110. data/lib/fastly/models/{logging_use_tls.rb → logging_use_tls_string.rb} +5 -5
  111. data/lib/fastly/models/mtd_invoice_response.rb +275 -0
  112. data/lib/fastly/models/mtdinvoice.rb +268 -0
  113. data/lib/fastly/models/mtdlineitems.rb +297 -0
  114. data/lib/fastly/models/realtime_entry_aggregated.rb +14 -4
  115. data/lib/fastly/models/realtime_measurements.rb +14 -4
  116. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate.rb +216 -0
  117. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate.rb +216 -0
  118. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate_data.rb +228 -0
  119. data/lib/fastly/models/relationship_default_tls_certificate.rb +216 -0
  120. data/lib/fastly/models/relationship_default_tls_certificate_default_certificate.rb +216 -0
  121. data/lib/fastly/models/relationship_default_tls_certificate_default_certificate_data.rb +228 -0
  122. data/lib/fastly/models/{relationship_tls_dns_records.rb → relationship_tls_dns_records_request.rb} +4 -4
  123. data/lib/fastly/models/relationship_tls_dns_records_request_dns_records.rb +218 -0
  124. data/lib/fastly/models/{relationship_member_tls_dns_record.rb → relationship_tls_dns_records_request_dns_records_data.rb} +3 -3
  125. data/lib/fastly/models/relationship_tls_dns_records_response.rb +216 -0
  126. data/lib/fastly/models/relationship_tls_dns_records_response_dns_records.rb +218 -0
  127. data/lib/fastly/models/relationship_tls_dns_records_response_dns_records_data.rb +227 -0
  128. data/lib/fastly/models/relationships_for_tls_configuration.rb +1 -1
  129. data/lib/fastly/models/results.rb +11 -1
  130. data/lib/fastly/models/serviceusagemetric.rb +246 -0
  131. data/lib/fastly/models/{relationship_tls_dns_record.rb → serviceusagemetrics.rb} +10 -10
  132. data/lib/fastly/models/serviceusagemetrics_data.rb +276 -0
  133. data/lib/fastly/models/serviceusagetype.rb +227 -0
  134. data/lib/fastly/models/{relationship_tls_dns_record_dns_record.rb → serviceusagetypes.rb} +4 -4
  135. data/lib/fastly/models/tls_certificate_blob_response.rb +217 -0
  136. data/lib/fastly/models/tls_dns_record.rb +48 -12
  137. data/lib/fastly/models/update_dashboard_request.rb +240 -0
  138. data/lib/fastly/models/values.rb +1 -1
  139. data/lib/fastly/version.rb +1 -1
  140. data/lib/fastly.rb +42 -7
  141. data/sig.json +1 -1
  142. metadata +86 -16
@@ -0,0 +1,271 @@
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
+ # [An object](#visualization) which describes the data visualization to display.
16
+ class DashboardItemPropertyVisualization
17
+ # The type of visualization to display.
18
+ attr_accessor :type
19
+
20
+ attr_accessor :config
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'type' => :'type',
48
+ :'config' => :'config'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.fastly_types
59
+ {
60
+ :'type' => :'String',
61
+ :'config' => :'DashboardItemPropertyVisualizationPropertyConfig'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.fastly_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DashboardItemPropertyVisualization` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DashboardItemPropertyVisualization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'type')
87
+ self.type = attributes[:'type']
88
+ end
89
+
90
+ if attributes.key?(:'config')
91
+ self.config = attributes[:'config']
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ if @type.nil?
100
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
101
+ end
102
+
103
+ if @config.nil?
104
+ invalid_properties.push('invalid value for "config", config cannot be nil.')
105
+ end
106
+
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ return false if @type.nil?
114
+ type_validator = EnumAttributeValidator.new('String', ["chart"])
115
+ return false unless type_validator.valid?(@type)
116
+ return false if @config.nil?
117
+ true
118
+ end
119
+
120
+ # Custom attribute writer method checking allowed values (enum).
121
+ # @param [Object] type Object to be assigned
122
+ def type=(type)
123
+ validator = EnumAttributeValidator.new('String', ["chart"])
124
+ unless validator.valid?(type)
125
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
126
+ end
127
+ @type = type
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ type == o.type &&
136
+ config == o.config
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [type, config].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ new.build_from_hash(attributes)
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ self.class.fastly_types.each_pair do |key, type|
164
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
165
+ self.send("#{key}=", nil)
166
+ elsif type =~ /\AArray<(.*)>/i
167
+ # check to ensure the input is an array given that the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
170
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
171
+ end
172
+ elsif !attributes[self.class.attribute_map[key]].nil?
173
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
174
+ end
175
+ end
176
+
177
+ self
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def _deserialize(type, value)
185
+ case type.to_sym
186
+ when :Time
187
+ Time.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :Boolean
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ # models (e.g. Pet) or oneOf
218
+ klass = Fastly.const_get(type)
219
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.fastly_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map { |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to? :to_hash
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ end
@@ -0,0 +1,303 @@
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
+ # [Configuration options](#visualization-config) for the given visualization.
16
+ class DashboardItemPropertyVisualizationPropertyConfig
17
+ # The type of chart to display.
18
+ attr_accessor :plot_type
19
+
20
+ # (Optional) The units to use to format the data.
21
+ attr_accessor :format
22
+
23
+ # (Optional) The aggregation function to apply to the dataset.
24
+ attr_accessor :calculation_method
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'plot_type' => :'plot_type',
52
+ :'format' => :'format',
53
+ :'calculation_method' => :'calculation_method'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.fastly_types
64
+ {
65
+ :'plot_type' => :'String',
66
+ :'format' => :'String',
67
+ :'calculation_method' => :'String'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.fastly_nullable
73
+ Set.new([
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::DashboardItemPropertyVisualizationPropertyConfig` 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::DashboardItemPropertyVisualizationPropertyConfig`. 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?(:'plot_type')
93
+ self.plot_type = attributes[:'plot_type']
94
+ end
95
+
96
+ if attributes.key?(:'format')
97
+ self.format = attributes[:'format']
98
+ else
99
+ self.format = 'number'
100
+ end
101
+
102
+ if attributes.key?(:'calculation_method')
103
+ self.calculation_method = attributes[:'calculation_method']
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ invalid_properties = Array.new
111
+ if @plot_type.nil?
112
+ invalid_properties.push('invalid value for "plot_type", plot_type cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ return false if @plot_type.nil?
122
+ plot_type_validator = EnumAttributeValidator.new('String', ["line", "bar", "single-metric", "donut"])
123
+ return false unless plot_type_validator.valid?(@plot_type)
124
+ format_validator = EnumAttributeValidator.new('String', ["number", "bytes", "percent", "requests", "responses", "seconds", "milliseconds", "ratio", "bitrate"])
125
+ return false unless format_validator.valid?(@format)
126
+ calculation_method_validator = EnumAttributeValidator.new('String', ["avg", "sum", "min", "max", "latest", "p95"])
127
+ return false unless calculation_method_validator.valid?(@calculation_method)
128
+ true
129
+ end
130
+
131
+ # Custom attribute writer method checking allowed values (enum).
132
+ # @param [Object] plot_type Object to be assigned
133
+ def plot_type=(plot_type)
134
+ validator = EnumAttributeValidator.new('String', ["line", "bar", "single-metric", "donut"])
135
+ unless validator.valid?(plot_type)
136
+ fail ArgumentError, "invalid value for \"plot_type\", must be one of #{validator.allowable_values}."
137
+ end
138
+ @plot_type = plot_type
139
+ end
140
+
141
+ # Custom attribute writer method checking allowed values (enum).
142
+ # @param [Object] format Object to be assigned
143
+ def format=(format)
144
+ validator = EnumAttributeValidator.new('String', ["number", "bytes", "percent", "requests", "responses", "seconds", "milliseconds", "ratio", "bitrate"])
145
+ unless validator.valid?(format)
146
+ fail ArgumentError, "invalid value for \"format\", must be one of #{validator.allowable_values}."
147
+ end
148
+ @format = format
149
+ end
150
+
151
+ # Custom attribute writer method checking allowed values (enum).
152
+ # @param [Object] calculation_method Object to be assigned
153
+ def calculation_method=(calculation_method)
154
+ validator = EnumAttributeValidator.new('String', ["avg", "sum", "min", "max", "latest", "p95"])
155
+ unless validator.valid?(calculation_method)
156
+ fail ArgumentError, "invalid value for \"calculation_method\", must be one of #{validator.allowable_values}."
157
+ end
158
+ @calculation_method = calculation_method
159
+ end
160
+
161
+ # Checks equality by comparing each attribute.
162
+ # @param [Object] Object to be compared
163
+ def ==(o)
164
+ return true if self.equal?(o)
165
+ self.class == o.class &&
166
+ plot_type == o.plot_type &&
167
+ format == o.format &&
168
+ calculation_method == o.calculation_method
169
+ end
170
+
171
+ # @see the `==` method
172
+ # @param [Object] Object to be compared
173
+ def eql?(o)
174
+ self == o
175
+ end
176
+
177
+ # Calculates hash code according to all attributes.
178
+ # @return [Integer] Hash code
179
+ def hash
180
+ [plot_type, format, calculation_method].hash
181
+ end
182
+
183
+ # Builds the object from hash
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ # @return [Object] Returns the model itself
186
+ def self.build_from_hash(attributes)
187
+ new.build_from_hash(attributes)
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ self.class.fastly_types.each_pair do |key, type|
196
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
197
+ self.send("#{key}=", nil)
198
+ elsif type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
202
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
203
+ end
204
+ elsif !attributes[self.class.attribute_map[key]].nil?
205
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
206
+ end
207
+ end
208
+
209
+ self
210
+ end
211
+
212
+ # Deserializes the data based on type
213
+ # @param string type Data type
214
+ # @param string value Value to be deserialized
215
+ # @return [Object] Deserialized data
216
+ def _deserialize(type, value)
217
+ case type.to_sym
218
+ when :Time
219
+ Time.parse(value)
220
+ when :Date
221
+ Date.parse(value)
222
+ when :String
223
+ value.to_s
224
+ when :Integer
225
+ value.to_i
226
+ when :Float
227
+ value.to_f
228
+ when :Boolean
229
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
230
+ true
231
+ else
232
+ false
233
+ end
234
+ when :Object
235
+ # generic object (usually a Hash), return directly
236
+ value
237
+ when /\AArray<(?<inner_type>.+)>\z/
238
+ inner_type = Regexp.last_match[:inner_type]
239
+ value.map { |v| _deserialize(inner_type, v) }
240
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
241
+ k_type = Regexp.last_match[:k_type]
242
+ v_type = Regexp.last_match[:v_type]
243
+ {}.tap do |hash|
244
+ value.each do |k, v|
245
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
246
+ end
247
+ end
248
+ else # model
249
+ # models (e.g. Pet) or oneOf
250
+ klass = Fastly.const_get(type)
251
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ # Returns the string representation of the object
256
+ # @return [String] String presentation of the object
257
+ def to_s
258
+ to_hash.to_s
259
+ end
260
+
261
+ # to_body is an alias to to_hash (backward compatibility)
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_body
264
+ to_hash
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ if value.nil?
274
+ is_nullable = self.class.fastly_nullable.include?(attr)
275
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
276
+ end
277
+
278
+ hash[param] = _to_hash(value)
279
+ end
280
+ hash
281
+ end
282
+
283
+ # Outputs non-array value in the form of hash
284
+ # For object, use to_hash. Otherwise, just return the value
285
+ # @param [Object] value Any valid value
286
+ # @return [Hash] Returns the value in the form of hash
287
+ def _to_hash(value)
288
+ if value.is_a?(Array)
289
+ value.compact.map { |v| _to_hash(v) }
290
+ elsif value.is_a?(Hash)
291
+ {}.tap do |hash|
292
+ value.each { |k, v| hash[k] = _to_hash(v) }
293
+ end
294
+ elsif value.respond_to? :to_hash
295
+ value.to_hash
296
+ else
297
+ value
298
+ end
299
+ end
300
+
301
+ end
302
+
303
+ end