fastly 8.0.1 → 8.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +223 -130
  3. data/Gemfile.lock +1 -1
  4. data/README.md +19 -7
  5. data/docs/{ErrorResponse.md → AutomationTokenErrorResponse.md} +1 -1
  6. data/docs/AutomationTokensApi.md +2 -2
  7. data/docs/Backend.md +5 -1
  8. data/docs/BackendApi.md +20 -4
  9. data/docs/BackendResponse.md +5 -1
  10. data/docs/BillingInvoicesApi.md +96 -0
  11. data/docs/Director.md +1 -1
  12. data/docs/DirectorApi.md +2 -2
  13. data/docs/DirectorResponse.md +1 -1
  14. data/docs/DomainInspectorHistoricalApi.md +4 -4
  15. data/docs/DomainInspectorRealtimeEntry.md +1 -1
  16. data/docs/Error.md +13 -0
  17. data/docs/ErrorResponseData.md +11 -0
  18. data/docs/Invoice.md +18 -0
  19. data/docs/InvoiceResponse.md +18 -0
  20. data/docs/Invoicelineitems.md +18 -0
  21. data/docs/KvStoreApi.md +1 -1
  22. data/docs/ListInvoicesResponse.md +11 -0
  23. data/docs/Listinvoices.md +11 -0
  24. data/docs/LoggingScalyrAdditional.md +1 -1
  25. data/docs/LoggingScalyrApi.md +4 -4
  26. data/docs/LoggingScalyrResponse.md +1 -1
  27. data/docs/Metadata.md +13 -0
  28. data/docs/OriginInspectorHistoricalApi.md +4 -4
  29. data/docs/OriginInspectorRealtimeEntry.md +1 -1
  30. data/docs/PoolAdditional.md +1 -1
  31. data/docs/PoolApi.md +4 -4
  32. data/docs/PoolResponse.md +1 -1
  33. data/docs/PoolResponsePost.md +1 -1
  34. data/docs/Pop.md +2 -2
  35. data/docs/PublishApi.md +1 -1
  36. data/docs/RealtimeEntry.md +1 -1
  37. data/docs/RealtimeEntryAggregated.md +22 -1
  38. data/docs/RealtimeMeasurements.md +22 -1
  39. data/docs/RelationshipCustomerCustomer.md +1 -1
  40. data/docs/Results.md +23 -0
  41. data/docs/SecretStoreApi.md +4 -2
  42. data/docs/SecretStoreItemApi.md +2 -2
  43. data/docs/ServiceDetail.md +1 -1
  44. data/docs/ServiceListResponse.md +2 -2
  45. data/docs/ServiceListResponseAllOf.md +2 -2
  46. data/docs/ServiceResponse.md +1 -1
  47. data/docs/ServiceResponseAllOf.md +1 -1
  48. data/docs/TlsConfigurationResponseAttributes.md +1 -1
  49. data/docs/TlsConfigurationResponseAttributesAllOf.md +1 -1
  50. data/docs/TlsCsr.md +10 -0
  51. data/docs/TlsCsrData.md +12 -0
  52. data/docs/TlsCsrDataAttributes.md +20 -0
  53. data/docs/TlsCsrErrorResponse.md +10 -0
  54. data/docs/TlsCsrResponse.md +10 -0
  55. data/docs/TlsCsrResponseAttributes.md +10 -0
  56. data/docs/TlsCsrResponseData.md +13 -0
  57. data/docs/TlsCsrsApi.md +52 -0
  58. data/docs/TlsSubscriptionResponseAttributes.md +1 -0
  59. data/docs/TlsSubscriptionResponseAttributesAllOf.md +1 -0
  60. data/docs/TokensApi.md +1 -1
  61. data/docs/TypeTlsCsr.md +9 -0
  62. data/docs/VclApi.md +1 -1
  63. data/docs/WafActiveRulesApi.md +1 -1
  64. data/lib/fastly/api/automation_tokens_api.rb +3 -3
  65. data/lib/fastly/api/backend_api.rb +28 -4
  66. data/lib/fastly/api/billing_invoices_api.rb +151 -0
  67. data/lib/fastly/api/director_api.rb +2 -2
  68. data/lib/fastly/api/domain_inspector_historical_api.rb +4 -4
  69. data/lib/fastly/api/kv_store_api.rb +2 -2
  70. data/lib/fastly/api/logging_scalyr_api.rb +4 -4
  71. data/lib/fastly/api/origin_inspector_historical_api.rb +4 -4
  72. data/lib/fastly/api/pool_api.rb +4 -4
  73. data/lib/fastly/api/publish_api.rb +2 -2
  74. data/lib/fastly/api/secret_store_api.rb +5 -2
  75. data/lib/fastly/api/secret_store_item_api.rb +2 -2
  76. data/lib/fastly/api/tls_csrs_api.rb +83 -0
  77. data/lib/fastly/api/tokens_api.rb +2 -2
  78. data/lib/fastly/api/vcl_api.rb +2 -2
  79. data/lib/fastly/api/waf_active_rules_api.rb +2 -2
  80. data/lib/fastly/configuration.rb +18 -0
  81. data/lib/fastly/models/{error_response.rb → automation_token_error_response.rb} +3 -3
  82. data/lib/fastly/models/backend.rb +45 -2
  83. data/lib/fastly/models/backend_response.rb +45 -2
  84. data/lib/fastly/models/director.rb +1 -1
  85. data/lib/fastly/models/director_response.rb +1 -1
  86. data/lib/fastly/models/domain_inspector_realtime_entry.rb +1 -1
  87. data/lib/fastly/models/error.rb +243 -0
  88. data/lib/fastly/models/error_response_data.rb +225 -0
  89. data/lib/fastly/models/event_attributes.rb +2 -2
  90. data/lib/fastly/models/invoice.rb +298 -0
  91. data/lib/fastly/models/invoice_response.rb +305 -0
  92. data/lib/fastly/models/invoicelineitems.rb +297 -0
  93. data/lib/fastly/models/list_invoices_response.rb +234 -0
  94. data/lib/fastly/models/listinvoices.rb +227 -0
  95. data/lib/fastly/models/logging_scalyr_additional.rb +1 -1
  96. data/lib/fastly/models/logging_scalyr_response.rb +1 -1
  97. data/lib/fastly/models/metadata.rb +250 -0
  98. data/lib/fastly/models/origin_inspector_realtime_entry.rb +1 -1
  99. data/lib/fastly/models/pool_additional.rb +1 -1
  100. data/lib/fastly/models/pool_response.rb +1 -1
  101. data/lib/fastly/models/pool_response_post.rb +1 -1
  102. data/lib/fastly/models/pop.rb +2 -2
  103. data/lib/fastly/models/realtime_entry.rb +1 -1
  104. data/lib/fastly/models/realtime_entry_aggregated.rb +215 -5
  105. data/lib/fastly/models/realtime_measurements.rb +215 -5
  106. data/lib/fastly/models/relationship_customer_customer.rb +2 -4
  107. data/lib/fastly/models/relationship_tls_certificate.rb +1 -1
  108. data/lib/fastly/models/relationship_tls_configuration.rb +1 -1
  109. data/lib/fastly/models/request_settings_additional.rb +1 -0
  110. data/lib/fastly/models/request_settings_response.rb +6 -0
  111. data/lib/fastly/models/request_settings_response_all_of.rb +5 -0
  112. data/lib/fastly/models/results.rb +231 -1
  113. data/lib/fastly/models/service_detail.rb +1 -1
  114. data/lib/fastly/models/service_list_response.rb +2 -2
  115. data/lib/fastly/models/service_list_response_all_of.rb +2 -2
  116. data/lib/fastly/models/service_response.rb +1 -1
  117. data/lib/fastly/models/service_response_all_of.rb +1 -1
  118. data/lib/fastly/models/tls_configuration_response_attributes.rb +1 -1
  119. data/lib/fastly/models/tls_configuration_response_attributes_all_of.rb +1 -1
  120. data/lib/fastly/models/tls_csr.rb +216 -0
  121. data/lib/fastly/models/tls_csr_data.rb +236 -0
  122. data/lib/fastly/models/tls_csr_data_attributes.rb +358 -0
  123. data/lib/fastly/models/tls_csr_error_response.rb +218 -0
  124. data/lib/fastly/models/tls_csr_response.rb +216 -0
  125. data/lib/fastly/models/tls_csr_response_attributes.rb +217 -0
  126. data/lib/fastly/models/tls_csr_response_data.rb +245 -0
  127. data/lib/fastly/models/tls_subscription_data_attributes.rb +2 -2
  128. data/lib/fastly/models/tls_subscription_response_attributes.rb +14 -4
  129. data/lib/fastly/models/tls_subscription_response_attributes_all_of.rb +14 -4
  130. data/lib/fastly/models/type_tls_csr.rb +34 -0
  131. data/lib/fastly/version.rb +1 -1
  132. data/lib/fastly.rb +19 -1
  133. data/sig.json +1 -1
  134. metadata +41 -5
@@ -0,0 +1,236 @@
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 TlsCsrData
16
+ attr_accessor :type
17
+
18
+ attr_accessor :attributes
19
+
20
+ attr_accessor :relationships
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'type' => :'type',
26
+ :'attributes' => :'attributes',
27
+ :'relationships' => :'relationships'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.fastly_types
38
+ {
39
+ :'type' => :'TypeTlsCsr',
40
+ :'attributes' => :'TlsCsrDataAttributes',
41
+ :'relationships' => :'RelationshipTlsPrivateKey'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.fastly_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::TlsCsrData` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::TlsCsrData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'type')
67
+ self.type = attributes[:'type']
68
+ else
69
+ self.type = 'csr'
70
+ end
71
+
72
+ if attributes.key?(:'attributes')
73
+ self.attributes = attributes[:'attributes']
74
+ end
75
+
76
+ if attributes.key?(:'relationships')
77
+ self.relationships = attributes[:'relationships']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ type == o.type &&
100
+ attributes == o.attributes &&
101
+ relationships == o.relationships
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [type, attributes, relationships].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ new.build_from_hash(attributes)
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ self.class.fastly_types.each_pair do |key, type|
129
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
130
+ self.send("#{key}=", nil)
131
+ elsif type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
+ end
137
+ elsif !attributes[self.class.attribute_map[key]].nil?
138
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ end
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :Time
152
+ Time.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ # models (e.g. Pet) or oneOf
183
+ klass = Fastly.const_get(type)
184
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ # Returns the string representation of the object
189
+ # @return [String] String presentation of the object
190
+ def to_s
191
+ to_hash.to_s
192
+ end
193
+
194
+ # to_body is an alias to to_hash (backward compatibility)
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = self.send(attr)
206
+ if value.nil?
207
+ is_nullable = self.class.fastly_nullable.include?(attr)
208
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
+ end
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ end
@@ -0,0 +1,358 @@
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 TlsCsrDataAttributes
16
+ # Subject Alternate Names - An array of one or more fully qualified domain names or public IP addresses to be secured by this certificate. Required.
17
+ attr_accessor :sans
18
+
19
+ # Common Name (CN) - The fully qualified domain name (FQDN) to be secured by this certificate. The common name should be one of the entries in the SANs parameter.
20
+ attr_accessor :common_name
21
+
22
+ # Country (C) - The two-letter ISO country code where the organization is located.
23
+ attr_accessor :country
24
+
25
+ # State (S) - The state, province, region, or county where the organization is located. This should not be abbreviated.
26
+ attr_accessor :state
27
+
28
+ # Locality (L) - The locality, city, town, or village where the organization is located.
29
+ attr_accessor :city
30
+
31
+ # Postal Code - The postal code where the organization is located.
32
+ attr_accessor :postal_code
33
+
34
+ # Street Address - The street address where the organization is located.
35
+ attr_accessor :street_address
36
+
37
+ # Organization (O) - The legal name of the organization, including any suffixes. This should not be abbreviated.
38
+ attr_accessor :organization
39
+
40
+ # Organizational Unit (OU) - The internal division of the organization managing the certificate.
41
+ attr_accessor :organizational_unit
42
+
43
+ # Email Address (EMAIL) - The organizational contact for this.
44
+ attr_accessor :email
45
+
46
+ # CSR Key Type.
47
+ attr_accessor :key_type
48
+
49
+ class EnumAttributeValidator
50
+ attr_reader :datatype
51
+ attr_reader :allowable_values
52
+
53
+ def initialize(datatype, allowable_values)
54
+ @allowable_values = allowable_values.map do |value|
55
+ case datatype.to_s
56
+ when /Integer/i
57
+ value.to_i
58
+ when /Float/i
59
+ value.to_f
60
+ else
61
+ value
62
+ end
63
+ end
64
+ end
65
+
66
+ def valid?(value)
67
+ !value || allowable_values.include?(value)
68
+ end
69
+ end
70
+
71
+ # Attribute mapping from ruby-style variable name to JSON key.
72
+ def self.attribute_map
73
+ {
74
+ :'sans' => :'sans',
75
+ :'common_name' => :'common_name',
76
+ :'country' => :'country',
77
+ :'state' => :'state',
78
+ :'city' => :'city',
79
+ :'postal_code' => :'postal_code',
80
+ :'street_address' => :'street_address',
81
+ :'organization' => :'organization',
82
+ :'organizational_unit' => :'organizational_unit',
83
+ :'email' => :'email',
84
+ :'key_type' => :'key_type'
85
+ }
86
+ end
87
+
88
+ # Returns all the JSON keys this model knows about
89
+ def self.acceptable_attributes
90
+ attribute_map.values
91
+ end
92
+
93
+ # Attribute type mapping.
94
+ def self.fastly_types
95
+ {
96
+ :'sans' => :'Array<String>',
97
+ :'common_name' => :'String',
98
+ :'country' => :'String',
99
+ :'state' => :'String',
100
+ :'city' => :'String',
101
+ :'postal_code' => :'String',
102
+ :'street_address' => :'String',
103
+ :'organization' => :'String',
104
+ :'organizational_unit' => :'String',
105
+ :'email' => :'String',
106
+ :'key_type' => :'String'
107
+ }
108
+ end
109
+
110
+ # List of attributes with nullable: true
111
+ def self.fastly_nullable
112
+ Set.new([
113
+ ])
114
+ end
115
+
116
+ # Initializes the object
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ def initialize(attributes = {})
119
+ if (!attributes.is_a?(Hash))
120
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::TlsCsrDataAttributes` initialize method"
121
+ end
122
+
123
+ # check to see if the attribute exists and convert string to symbol for hash key
124
+ attributes = attributes.each_with_object({}) { |(k, v), h|
125
+ if (!self.class.attribute_map.key?(k.to_sym))
126
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::TlsCsrDataAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
127
+ end
128
+ h[k.to_sym] = v
129
+ }
130
+
131
+ if attributes.key?(:'sans')
132
+ if (value = attributes[:'sans']).is_a?(Array)
133
+ self.sans = value
134
+ end
135
+ end
136
+
137
+ if attributes.key?(:'common_name')
138
+ self.common_name = attributes[:'common_name']
139
+ end
140
+
141
+ if attributes.key?(:'country')
142
+ self.country = attributes[:'country']
143
+ end
144
+
145
+ if attributes.key?(:'state')
146
+ self.state = attributes[:'state']
147
+ end
148
+
149
+ if attributes.key?(:'city')
150
+ self.city = attributes[:'city']
151
+ end
152
+
153
+ if attributes.key?(:'postal_code')
154
+ self.postal_code = attributes[:'postal_code']
155
+ end
156
+
157
+ if attributes.key?(:'street_address')
158
+ self.street_address = attributes[:'street_address']
159
+ end
160
+
161
+ if attributes.key?(:'organization')
162
+ self.organization = attributes[:'organization']
163
+ end
164
+
165
+ if attributes.key?(:'organizational_unit')
166
+ self.organizational_unit = attributes[:'organizational_unit']
167
+ end
168
+
169
+ if attributes.key?(:'email')
170
+ self.email = attributes[:'email']
171
+ end
172
+
173
+ if attributes.key?(:'key_type')
174
+ self.key_type = attributes[:'key_type']
175
+ end
176
+ end
177
+
178
+ # Show invalid properties with the reasons. Usually used together with valid?
179
+ # @return Array for valid properties with the reasons
180
+ def list_invalid_properties
181
+ invalid_properties = Array.new
182
+ if @sans.nil?
183
+ invalid_properties.push('invalid value for "sans", sans cannot be nil.')
184
+ end
185
+
186
+ invalid_properties
187
+ end
188
+
189
+ # Check to see if the all the properties in the model are valid
190
+ # @return true if the model is valid
191
+ def valid?
192
+ return false if @sans.nil?
193
+ key_type_validator = EnumAttributeValidator.new('String', ["RSA2048", "ECDSA256"])
194
+ return false unless key_type_validator.valid?(@key_type)
195
+ true
196
+ end
197
+
198
+ # Custom attribute writer method checking allowed values (enum).
199
+ # @param [Object] key_type Object to be assigned
200
+ def key_type=(key_type)
201
+ validator = EnumAttributeValidator.new('String', ["RSA2048", "ECDSA256"])
202
+ unless validator.valid?(key_type)
203
+ fail ArgumentError, "invalid value for \"key_type\", must be one of #{validator.allowable_values}."
204
+ end
205
+ @key_type = key_type
206
+ end
207
+
208
+ # Checks equality by comparing each attribute.
209
+ # @param [Object] Object to be compared
210
+ def ==(o)
211
+ return true if self.equal?(o)
212
+ self.class == o.class &&
213
+ sans == o.sans &&
214
+ common_name == o.common_name &&
215
+ country == o.country &&
216
+ state == o.state &&
217
+ city == o.city &&
218
+ postal_code == o.postal_code &&
219
+ street_address == o.street_address &&
220
+ organization == o.organization &&
221
+ organizational_unit == o.organizational_unit &&
222
+ email == o.email &&
223
+ key_type == o.key_type
224
+ end
225
+
226
+ # @see the `==` method
227
+ # @param [Object] Object to be compared
228
+ def eql?(o)
229
+ self == o
230
+ end
231
+
232
+ # Calculates hash code according to all attributes.
233
+ # @return [Integer] Hash code
234
+ def hash
235
+ [sans, common_name, country, state, city, postal_code, street_address, organization, organizational_unit, email, key_type].hash
236
+ end
237
+
238
+ # Builds the object from hash
239
+ # @param [Hash] attributes Model attributes in the form of hash
240
+ # @return [Object] Returns the model itself
241
+ def self.build_from_hash(attributes)
242
+ new.build_from_hash(attributes)
243
+ end
244
+
245
+ # Builds the object from hash
246
+ # @param [Hash] attributes Model attributes in the form of hash
247
+ # @return [Object] Returns the model itself
248
+ def build_from_hash(attributes)
249
+ return nil unless attributes.is_a?(Hash)
250
+ self.class.fastly_types.each_pair do |key, type|
251
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
252
+ self.send("#{key}=", nil)
253
+ elsif type =~ /\AArray<(.*)>/i
254
+ # check to ensure the input is an array given that the attribute
255
+ # is documented as an array but the input is not
256
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
257
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
258
+ end
259
+ elsif !attributes[self.class.attribute_map[key]].nil?
260
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
261
+ end
262
+ end
263
+
264
+ self
265
+ end
266
+
267
+ # Deserializes the data based on type
268
+ # @param string type Data type
269
+ # @param string value Value to be deserialized
270
+ # @return [Object] Deserialized data
271
+ def _deserialize(type, value)
272
+ case type.to_sym
273
+ when :Time
274
+ Time.parse(value)
275
+ when :Date
276
+ Date.parse(value)
277
+ when :String
278
+ value.to_s
279
+ when :Integer
280
+ value.to_i
281
+ when :Float
282
+ value.to_f
283
+ when :Boolean
284
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
285
+ true
286
+ else
287
+ false
288
+ end
289
+ when :Object
290
+ # generic object (usually a Hash), return directly
291
+ value
292
+ when /\AArray<(?<inner_type>.+)>\z/
293
+ inner_type = Regexp.last_match[:inner_type]
294
+ value.map { |v| _deserialize(inner_type, v) }
295
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
296
+ k_type = Regexp.last_match[:k_type]
297
+ v_type = Regexp.last_match[:v_type]
298
+ {}.tap do |hash|
299
+ value.each do |k, v|
300
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
301
+ end
302
+ end
303
+ else # model
304
+ # models (e.g. Pet) or oneOf
305
+ klass = Fastly.const_get(type)
306
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
307
+ end
308
+ end
309
+
310
+ # Returns the string representation of the object
311
+ # @return [String] String presentation of the object
312
+ def to_s
313
+ to_hash.to_s
314
+ end
315
+
316
+ # to_body is an alias to to_hash (backward compatibility)
317
+ # @return [Hash] Returns the object in the form of hash
318
+ def to_body
319
+ to_hash
320
+ end
321
+
322
+ # Returns the object in the form of hash
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_hash
325
+ hash = {}
326
+ self.class.attribute_map.each_pair do |attr, param|
327
+ value = self.send(attr)
328
+ if value.nil?
329
+ is_nullable = self.class.fastly_nullable.include?(attr)
330
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
331
+ end
332
+
333
+ hash[param] = _to_hash(value)
334
+ end
335
+ hash
336
+ end
337
+
338
+ # Outputs non-array value in the form of hash
339
+ # For object, use to_hash. Otherwise, just return the value
340
+ # @param [Object] value Any valid value
341
+ # @return [Hash] Returns the value in the form of hash
342
+ def _to_hash(value)
343
+ if value.is_a?(Array)
344
+ value.compact.map { |v| _to_hash(v) }
345
+ elsif value.is_a?(Hash)
346
+ {}.tap do |hash|
347
+ value.each { |k, v| hash[k] = _to_hash(v) }
348
+ end
349
+ elsif value.respond_to? :to_hash
350
+ value.to_hash
351
+ else
352
+ value
353
+ end
354
+ end
355
+
356
+ end
357
+
358
+ end