fastly 8.5.0 → 8.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -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/Billing.md +1 -2
  7. data/docs/BillingApi.md +2 -2
  8. data/docs/BillingBandwidth.md +11 -0
  9. data/docs/BillingBandwidthTiers.md +14 -0
  10. data/docs/{RelationshipTlsDnsRecords.md → BillingEstimateInvoiceId.md} +2 -2
  11. data/docs/BillingEstimateResponse.md +2 -2
  12. data/docs/{RelationshipTlsDnsRecordDnsRecord.md → BillingInvoiceId.md} +2 -2
  13. data/docs/BillingInvoicesApi.md +39 -6
  14. data/docs/BillingRegions.md +13 -0
  15. data/docs/BillingResponse.md +2 -2
  16. data/docs/BillingResponseLineItem.md +1 -1
  17. data/docs/BillingUsageMetricsApi.md +111 -0
  18. data/docs/CreateDashboardRequest.md +12 -0
  19. data/docs/Dashboard.md +17 -0
  20. data/docs/DashboardItem.md +15 -0
  21. data/docs/DashboardItemPropertyDataSource.md +11 -0
  22. data/docs/DashboardItemPropertyDataSourcePropertyConfig.md +10 -0
  23. data/docs/DashboardItemPropertyVisualization.md +11 -0
  24. data/docs/DashboardItemPropertyVisualizationPropertyConfig.md +12 -0
  25. data/docs/{LineItemDataReadOnlyInvoiceId.md → DashboardPropertyCreatedBy.md} +1 -1
  26. data/docs/DashboardPropertyUpdatedBy.md +9 -0
  27. data/docs/DomainInspectorMeasurements.md +1 -1
  28. data/docs/{InvoiceResponse.md → EomInvoiceResponse.md} +2 -2
  29. data/docs/GetServiceLevelUsageResponse.md +10 -0
  30. data/docs/GetServiceLevelUsageTypesResponse.md +10 -0
  31. data/docs/IncludedWithTlsConfiguration.md +10 -0
  32. data/docs/IncludedWithTlsConfigurationItem.md +12 -0
  33. data/docs/Invoice.md +1 -1
  34. data/docs/LineItemData.md +1 -1
  35. data/docs/ListDashboardsResponse.md +11 -0
  36. data/docs/{ListInvoicesResponse.md → ListEomInvoicesResponse.md} +1 -1
  37. data/docs/MtdInvoiceResponse.md +15 -0
  38. data/docs/Mtdinvoice.md +15 -0
  39. data/docs/Mtdlineitems.md +18 -0
  40. data/docs/ObservabilityCustomDashboardsApi.md +203 -0
  41. data/docs/RealtimeEntryAggregated.md +1 -0
  42. data/docs/RealtimeMeasurements.md +1 -0
  43. data/docs/RelationshipDefaultEcdsaTlsCertificate.md +10 -0
  44. data/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate.md +10 -0
  45. data/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData.md +11 -0
  46. data/docs/RelationshipDefaultTlsCertificate.md +10 -0
  47. data/docs/RelationshipDefaultTlsCertificateDefaultCertificate.md +10 -0
  48. data/docs/RelationshipDefaultTlsCertificateDefaultCertificateData.md +11 -0
  49. data/docs/RelationshipTlsDnsRecordsRequest.md +10 -0
  50. data/docs/RelationshipTlsDnsRecordsRequestDnsRecords.md +10 -0
  51. data/docs/RelationshipTlsDnsRecordsRequestDnsRecordsData.md +11 -0
  52. data/docs/RelationshipTlsDnsRecordsResponse.md +10 -0
  53. data/docs/RelationshipTlsDnsRecordsResponseDnsRecords.md +10 -0
  54. data/docs/{RelationshipMemberTlsDnsRecord.md → RelationshipTlsDnsRecordsResponseDnsRecordsData.md} +1 -1
  55. data/docs/Results.md +1 -0
  56. data/docs/Serviceusagemetric.md +13 -0
  57. data/docs/Serviceusagemetrics.md +10 -0
  58. data/docs/ServiceusagemetricsData.md +16 -0
  59. data/docs/Serviceusagetype.md +11 -0
  60. data/docs/Serviceusagetypes.md +10 -0
  61. data/docs/TlsCertificateBlobResponse.md +10 -0
  62. data/docs/TlsCertificatesApi.md +38 -0
  63. data/docs/TlsDnsRecord.md +1 -2
  64. data/docs/UpdateDashboardRequest.md +12 -0
  65. data/docs/Values.md +1 -1
  66. data/lib/fastly/api/billing_api.rb +2 -2
  67. data/lib/fastly/api/billing_invoices_api.rb +64 -8
  68. data/lib/fastly/api/billing_usage_metrics_api.rb +213 -0
  69. data/lib/fastly/api/observability_custom_dashboards_api.rb +333 -0
  70. data/lib/fastly/api/tls_certificates_api.rb +63 -0
  71. data/lib/fastly/configuration.rb +54 -0
  72. data/lib/fastly/models/async_response.rb +225 -0
  73. data/lib/fastly/models/billing.rb +2 -11
  74. data/lib/fastly/models/billing_bandwidth.rb +227 -0
  75. data/lib/fastly/models/billing_bandwidth_tiers.rb +252 -0
  76. data/lib/fastly/models/{relationship_tls_dns_record.rb → billing_estimate_invoice_id.rb} +10 -10
  77. data/lib/fastly/models/billing_estimate_response.rb +12 -11
  78. data/lib/fastly/models/billing_invoice_id.rb +216 -0
  79. data/lib/fastly/models/billing_regions.rb +243 -0
  80. data/lib/fastly/models/billing_response.rb +12 -11
  81. data/lib/fastly/models/billing_response_line_item.rb +2 -1
  82. data/lib/fastly/models/create_dashboard_request.rb +245 -0
  83. data/lib/fastly/models/dashboard.rb +290 -0
  84. data/lib/fastly/models/dashboard_item.rb +368 -0
  85. data/lib/fastly/models/dashboard_item_property_data_source.rb +271 -0
  86. data/lib/fastly/models/dashboard_item_property_data_source_property_config.rb +244 -0
  87. data/lib/fastly/models/dashboard_item_property_visualization.rb +271 -0
  88. data/lib/fastly/models/dashboard_item_property_visualization_property_config.rb +303 -0
  89. data/lib/fastly/models/{line_item_data_read_only_invoice_id.rb → dashboard_property_created_by.rb} +4 -3
  90. data/lib/fastly/models/dashboard_property_updated_by.rb +208 -0
  91. data/lib/fastly/models/domain_inspector_measurements.rb +1 -1
  92. data/lib/fastly/models/{invoice_response.rb → eom_invoice_response.rb} +4 -4
  93. data/lib/fastly/models/get_service_level_usage_response.rb +223 -0
  94. data/lib/fastly/models/get_service_level_usage_types_response.rb +225 -0
  95. data/lib/fastly/models/included_with_tls_configuration.rb +218 -0
  96. data/lib/fastly/models/included_with_tls_configuration_item.rb +237 -0
  97. data/lib/fastly/models/invoice.rb +1 -1
  98. data/lib/fastly/models/invoicelineitems.rb +5 -5
  99. data/lib/fastly/models/line_item_data.rb +2 -1
  100. data/lib/fastly/models/list_dashboards_response.rb +229 -0
  101. data/lib/fastly/models/{list_invoices_response.rb → list_eom_invoices_response.rb} +3 -3
  102. data/lib/fastly/models/mtd_invoice_response.rb +275 -0
  103. data/lib/fastly/models/mtdinvoice.rb +268 -0
  104. data/lib/fastly/models/mtdlineitems.rb +297 -0
  105. data/lib/fastly/models/realtime_entry_aggregated.rb +14 -4
  106. data/lib/fastly/models/realtime_measurements.rb +14 -4
  107. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate.rb +216 -0
  108. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate.rb +216 -0
  109. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate_data.rb +228 -0
  110. data/lib/fastly/models/relationship_default_tls_certificate.rb +216 -0
  111. data/lib/fastly/models/relationship_default_tls_certificate_default_certificate.rb +216 -0
  112. data/lib/fastly/models/relationship_default_tls_certificate_default_certificate_data.rb +228 -0
  113. data/lib/fastly/models/{relationship_tls_dns_records.rb → relationship_tls_dns_records_request.rb} +4 -4
  114. data/lib/fastly/models/relationship_tls_dns_records_request_dns_records.rb +218 -0
  115. data/lib/fastly/models/{relationship_member_tls_dns_record.rb → relationship_tls_dns_records_request_dns_records_data.rb} +3 -3
  116. data/lib/fastly/models/relationship_tls_dns_records_response.rb +216 -0
  117. data/lib/fastly/models/relationship_tls_dns_records_response_dns_records.rb +218 -0
  118. data/lib/fastly/models/relationship_tls_dns_records_response_dns_records_data.rb +227 -0
  119. data/lib/fastly/models/relationships_for_tls_configuration.rb +1 -1
  120. data/lib/fastly/models/results.rb +11 -1
  121. data/lib/fastly/models/serviceusagemetric.rb +246 -0
  122. data/lib/fastly/models/serviceusagemetrics.rb +216 -0
  123. data/lib/fastly/models/serviceusagemetrics_data.rb +276 -0
  124. data/lib/fastly/models/serviceusagetype.rb +227 -0
  125. data/lib/fastly/models/{relationship_tls_dns_record_dns_record.rb → serviceusagetypes.rb} +4 -4
  126. data/lib/fastly/models/tls_certificate_blob_response.rb +217 -0
  127. data/lib/fastly/models/tls_dns_record.rb +48 -12
  128. data/lib/fastly/models/update_dashboard_request.rb +240 -0
  129. data/lib/fastly/models/values.rb +1 -1
  130. data/lib/fastly/version.rb +1 -1
  131. data/lib/fastly.rb +46 -7
  132. data/sig.json +1 -1
  133. metadata +94 -16
@@ -0,0 +1,208 @@
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
+ # The ID of the user who last modified the dashboard
16
+ class DashboardPropertyUpdatedBy
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ }
21
+ end
22
+
23
+ # Returns all the JSON keys this model knows about
24
+ def self.acceptable_attributes
25
+ attribute_map.values
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.fastly_types
30
+ {
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.fastly_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DashboardPropertyUpdatedBy` initialize method"
45
+ end
46
+
47
+ # check to see if the attribute exists and convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h|
49
+ if (!self.class.attribute_map.key?(k.to_sym))
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DashboardPropertyUpdatedBy`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ end
52
+ h[k.to_sym] = v
53
+ }
54
+ end
55
+
56
+ # Show invalid properties with the reasons. Usually used together with valid?
57
+ # @return Array for valid properties with the reasons
58
+ def list_invalid_properties
59
+ invalid_properties = Array.new
60
+ invalid_properties
61
+ end
62
+
63
+ # Check to see if the all the properties in the model are valid
64
+ # @return true if the model is valid
65
+ def valid?
66
+ true
67
+ end
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] Object to be compared
71
+ def ==(o)
72
+ return true if self.equal?(o)
73
+ self.class == o.class
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Integer] Hash code
84
+ def hash
85
+ [].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def self.build_from_hash(attributes)
92
+ new.build_from_hash(attributes)
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def build_from_hash(attributes)
99
+ return nil unless attributes.is_a?(Hash)
100
+ self.class.fastly_types.each_pair do |key, type|
101
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
102
+ self.send("#{key}=", nil)
103
+ elsif type =~ /\AArray<(.*)>/i
104
+ # check to ensure the input is an array given that the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
107
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ end
112
+ end
113
+
114
+ self
115
+ end
116
+
117
+ # Deserializes the data based on type
118
+ # @param string type Data type
119
+ # @param string value Value to be deserialized
120
+ # @return [Object] Deserialized data
121
+ def _deserialize(type, value)
122
+ case type.to_sym
123
+ when :Time
124
+ Time.parse(value)
125
+ when :Date
126
+ Date.parse(value)
127
+ when :String
128
+ value.to_s
129
+ when :Integer
130
+ value.to_i
131
+ when :Float
132
+ value.to_f
133
+ when :Boolean
134
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
+ true
136
+ else
137
+ false
138
+ end
139
+ when :Object
140
+ # generic object (usually a Hash), return directly
141
+ value
142
+ when /\AArray<(?<inner_type>.+)>\z/
143
+ inner_type = Regexp.last_match[:inner_type]
144
+ value.map { |v| _deserialize(inner_type, v) }
145
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
146
+ k_type = Regexp.last_match[:k_type]
147
+ v_type = Regexp.last_match[:v_type]
148
+ {}.tap do |hash|
149
+ value.each do |k, v|
150
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
151
+ end
152
+ end
153
+ else # model
154
+ # models (e.g. Pet) or oneOf
155
+ klass = Fastly.const_get(type)
156
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.fastly_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ # Outputs non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ # @param [Object] value Any valid value
191
+ # @return [Hash] Returns the value in the form of hash
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map { |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+
206
+ end
207
+
208
+ end
@@ -128,7 +128,7 @@ module Fastly
128
128
  # Ratio of cache hits to cache misses at the edge, between 0 and 1 (`edge_hit_requests` / (`edge_hit_requests` + `edge_miss_requests`)).
129
129
  attr_accessor :edge_hit_ratio
130
130
 
131
- # Ratio of response bytes delivered from the edge compared to what is delivered from origin, between 0 and 1. (`edge_resp_body_bytes` + `edge_resp_header_bytes`) / (`origin_fetch_resp_body_bytes` + `origin_fetch_resp_header_bytes` + `edge_resp_body_bytes` + `edge_resp_header_bytes`).
131
+ # Origin Offload measures the ratio of bytes served to end users that were cached by Fastly, over the bytes served to end users, between 0 and 1. ((`edge_resp_body_bytes` + `edge_resp_header_bytes`) - (`origin_fetch_resp_body_bytes` + `origin_fetch_resp_header_bytes`)) / (`edge_resp_body_bytes` + `edge_resp_header_bytes`). Previously, Origin Offload used a different formula. [Learn more](https://www.fastly.com/documentation/reference/changes/2024/06/add-origin_offload-metric).
132
132
  attr_accessor :origin_offload
133
133
 
134
134
  # Number of responses received from origin with status code 200 (Success).
@@ -12,11 +12,11 @@ require 'date'
12
12
  require 'time'
13
13
 
14
14
  module Fastly
15
- class InvoiceResponse
15
+ class EomInvoiceResponse
16
16
  # Customer ID associated with the invoice.
17
17
  attr_accessor :customer_id
18
18
 
19
- # Alphanumeric string identifying the invoice.
19
+ # Numeric string identifying the invoice.
20
20
  attr_accessor :invoice_id
21
21
 
22
22
  # Date and time invoice was posted on, in ISO 8601 format.
@@ -91,13 +91,13 @@ module Fastly
91
91
  # @param [Hash] attributes Model attributes in the form of hash
92
92
  def initialize(attributes = {})
93
93
  if (!attributes.is_a?(Hash))
94
- fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::InvoiceResponse` initialize method"
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::EomInvoiceResponse` initialize method"
95
95
  end
96
96
 
97
97
  # check to see if the attribute exists and convert string to symbol for hash key
98
98
  attributes = attributes.each_with_object({}) { |(k, v), h|
99
99
  if (!self.class.attribute_map.key?(k.to_sym))
100
- fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::InvoiceResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::EomInvoiceResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
101
  end
102
102
  h[k.to_sym] = v
103
103
  }
@@ -0,0 +1,223 @@
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 GetServiceLevelUsageResponse
16
+ attr_accessor :data
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'data' => :'data'
22
+ }
23
+ end
24
+
25
+ # Returns all the JSON keys this model knows about
26
+ def self.acceptable_attributes
27
+ attribute_map.values
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.fastly_types
32
+ {
33
+ :'data' => :'ServiceusagemetricsData'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.fastly_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # List of class defined in allOf (OpenAPI v3)
44
+ def self.fastly_all_of
45
+ [
46
+ :'Serviceusagemetrics'
47
+ ]
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::GetServiceLevelUsageResponse` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::GetServiceLevelUsageResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'data')
66
+ self.data = attributes[:'data']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ data == o.data
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [data].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.fastly_types.each_pair do |key, type|
116
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
117
+ self.send("#{key}=", nil)
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
123
+ end
124
+ elsif !attributes[self.class.attribute_map[key]].nil?
125
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
126
+ end
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def _deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = Fastly.const_get(type)
171
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.fastly_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end
@@ -0,0 +1,225 @@
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 GetServiceLevelUsageTypesResponse
16
+ attr_accessor :data
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'data' => :'data'
22
+ }
23
+ end
24
+
25
+ # Returns all the JSON keys this model knows about
26
+ def self.acceptable_attributes
27
+ attribute_map.values
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.fastly_types
32
+ {
33
+ :'data' => :'Array<Serviceusagetype>'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.fastly_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # List of class defined in allOf (OpenAPI v3)
44
+ def self.fastly_all_of
45
+ [
46
+ :'Serviceusagetypes'
47
+ ]
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::GetServiceLevelUsageTypesResponse` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::GetServiceLevelUsageTypesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'data')
66
+ if (value = attributes[:'data']).is_a?(Array)
67
+ self.data = value
68
+ end
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ data == o.data
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(o)
96
+ self == o
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Integer] Hash code
101
+ def hash
102
+ [data].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def self.build_from_hash(attributes)
109
+ new.build_from_hash(attributes)
110
+ end
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def build_from_hash(attributes)
116
+ return nil unless attributes.is_a?(Hash)
117
+ self.class.fastly_types.each_pair do |key, type|
118
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
119
+ self.send("#{key}=", nil)
120
+ elsif type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :Time
141
+ Time.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ # models (e.g. Pet) or oneOf
172
+ klass = Fastly.const_get(type)
173
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.fastly_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map { |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end
222
+
223
+ end
224
+
225
+ end