akeyless 2.16.4 → 2.16.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -1
  3. data/docs/AwsS3LogForwardingConfig.md +2 -0
  4. data/docs/CreateAuthMethod.md +1 -1
  5. data/docs/CreateAuthMethodAWSIAM.md +1 -1
  6. data/docs/CreateAuthMethodAzureAD.md +1 -1
  7. data/docs/CreateAuthMethodCert.md +1 -1
  8. data/docs/CreateAuthMethodGCP.md +1 -1
  9. data/docs/CreateAuthMethodHuawei.md +1 -1
  10. data/docs/CreateAuthMethodK8S.md +1 -1
  11. data/docs/CreateAuthMethodLDAP.md +1 -1
  12. data/docs/CreateAuthMethodOAuth2.md +1 -1
  13. data/docs/CreateAuthMethodOIDC.md +1 -1
  14. data/docs/CreateAuthMethodSAML.md +1 -1
  15. data/docs/CreateAuthMethodUniversalIdentity.md +1 -1
  16. data/docs/CreateClassicKey.md +12 -0
  17. data/docs/CreateRotatedSecret.md +28 -0
  18. data/docs/CreateSalesforceTarget.md +42 -0
  19. data/docs/CreateSalesforceTargetOutput.md +18 -0
  20. data/docs/GatewayCreateMigration.md +50 -0
  21. data/docs/GatewayDeleteMigration.md +22 -0
  22. data/docs/GatewayGetMigration.md +22 -0
  23. data/docs/GatewayMigrationCreateOutput.md +18 -0
  24. data/docs/GatewayMigrationDeleteOutput.md +18 -0
  25. data/docs/GatewayMigrationGetOutput.md +18 -0
  26. data/docs/GatewayMigrationUpdateOutput.md +18 -0
  27. data/docs/GatewayUpdateMigration.md +52 -0
  28. data/docs/GetSecretValue.md +2 -0
  29. data/docs/HashiPayload.md +2 -0
  30. data/docs/Item.md +2 -0
  31. data/docs/TargetTypeDetailsInput.md +12 -0
  32. data/docs/UpdateAuthMethod.md +1 -1
  33. data/docs/UpdateAuthMethodAWSIAM.md +1 -1
  34. data/docs/UpdateAuthMethodAzureAD.md +1 -1
  35. data/docs/UpdateAuthMethodCert.md +1 -1
  36. data/docs/UpdateAuthMethodGCP.md +1 -1
  37. data/docs/UpdateAuthMethodK8S.md +1 -1
  38. data/docs/UpdateAuthMethodLDAP.md +1 -1
  39. data/docs/UpdateAuthMethodOAuth2.md +1 -1
  40. data/docs/UpdateAuthMethodOIDC.md +1 -1
  41. data/docs/UpdateAuthMethodSAML.md +1 -1
  42. data/docs/UpdateAuthMethodUniversalIdentity.md +1 -1
  43. data/docs/UpdateRotatedSecret.md +28 -0
  44. data/docs/UpdateSalesforceTarget.md +48 -0
  45. data/docs/UpdateSalesforceTargetOutput.md +18 -0
  46. data/docs/V2Api.md +441 -0
  47. data/lib/akeyless/api/v2_api.rb +448 -0
  48. data/lib/akeyless/models/aws_s3_log_forwarding_config.rb +10 -1
  49. data/lib/akeyless/models/create_auth_method.rb +0 -2
  50. data/lib/akeyless/models/create_auth_method_awsiam.rb +0 -2
  51. data/lib/akeyless/models/create_auth_method_azure_ad.rb +0 -2
  52. data/lib/akeyless/models/create_auth_method_cert.rb +0 -2
  53. data/lib/akeyless/models/create_auth_method_gcp.rb +0 -2
  54. data/lib/akeyless/models/create_auth_method_huawei.rb +0 -2
  55. data/lib/akeyless/models/create_auth_method_k8_s.rb +0 -2
  56. data/lib/akeyless/models/create_auth_method_ldap.rb +0 -2
  57. data/lib/akeyless/models/create_auth_method_o_auth2.rb +0 -2
  58. data/lib/akeyless/models/create_auth_method_oidc.rb +0 -2
  59. data/lib/akeyless/models/create_auth_method_saml.rb +0 -2
  60. data/lib/akeyless/models/create_auth_method_universal_identity.rb +0 -2
  61. data/lib/akeyless/models/create_classic_key.rb +61 -1
  62. data/lib/akeyless/models/create_rotated_secret.rb +153 -1
  63. data/lib/akeyless/models/create_salesforce_target.rb +375 -0
  64. data/lib/akeyless/models/create_salesforce_target_output.rb +219 -0
  65. data/lib/akeyless/models/gateway_create_migration.rb +374 -0
  66. data/lib/akeyless/models/gateway_delete_migration.rb +246 -0
  67. data/lib/akeyless/models/gateway_get_migration.rb +240 -0
  68. data/lib/akeyless/models/gateway_migration_create_output.rb +219 -0
  69. data/lib/akeyless/models/gateway_migration_delete_output.rb +219 -0
  70. data/lib/akeyless/models/gateway_migration_get_output.rb +219 -0
  71. data/lib/akeyless/models/gateway_migration_update_output.rb +219 -0
  72. data/lib/akeyless/models/gateway_update_migration.rb +383 -0
  73. data/lib/akeyless/models/gateway_update_producer_hana_db.rb +1 -1
  74. data/lib/akeyless/models/get_secret_value.rb +10 -1
  75. data/lib/akeyless/models/hashi_payload.rb +10 -1
  76. data/lib/akeyless/models/item.rb +10 -1
  77. data/lib/akeyless/models/target_type_details_input.rb +59 -1
  78. data/lib/akeyless/models/update_auth_method.rb +0 -2
  79. data/lib/akeyless/models/update_auth_method_awsiam.rb +0 -2
  80. data/lib/akeyless/models/update_auth_method_azure_ad.rb +0 -2
  81. data/lib/akeyless/models/update_auth_method_cert.rb +0 -2
  82. data/lib/akeyless/models/update_auth_method_gcp.rb +0 -2
  83. data/lib/akeyless/models/update_auth_method_k8_s.rb +0 -2
  84. data/lib/akeyless/models/update_auth_method_ldap.rb +0 -2
  85. data/lib/akeyless/models/update_auth_method_o_auth2.rb +0 -2
  86. data/lib/akeyless/models/update_auth_method_oidc.rb +0 -2
  87. data/lib/akeyless/models/update_auth_method_saml.rb +0 -2
  88. data/lib/akeyless/models/update_auth_method_universal_identity.rb +0 -2
  89. data/lib/akeyless/models/update_rotated_secret.rb +153 -1
  90. data/lib/akeyless/models/update_salesforce_target.rb +404 -0
  91. data/lib/akeyless/models/update_salesforce_target_output.rb +219 -0
  92. data/lib/akeyless/version.rb +1 -1
  93. data/lib/akeyless.rb +12 -0
  94. data/spec/models/create_salesforce_target_output_spec.rb +34 -0
  95. data/spec/models/create_salesforce_target_spec.rb +106 -0
  96. data/spec/models/gateway_create_migration_spec.rb +130 -0
  97. data/spec/models/gateway_delete_migration_spec.rb +46 -0
  98. data/spec/models/gateway_get_migration_spec.rb +46 -0
  99. data/spec/models/gateway_migration_create_output_spec.rb +34 -0
  100. data/spec/models/gateway_migration_delete_output_spec.rb +34 -0
  101. data/spec/models/gateway_migration_get_output_spec.rb +34 -0
  102. data/spec/models/gateway_migration_update_output_spec.rb +34 -0
  103. data/spec/models/gateway_update_migration_spec.rb +136 -0
  104. data/spec/models/update_salesforce_target_output_spec.rb +34 -0
  105. data/spec/models/update_salesforce_target_spec.rb +124 -0
  106. metadata +512 -464
@@ -0,0 +1,375 @@
1
+ =begin
2
+ #Akeyless API
3
+
4
+ #The purpose of this application is to provide access to Akeyless API.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: support@akeyless.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ class CreateSalesforceTarget
18
+ # Base64 encoded PEM cert to use when uploading a new key to Salesforce
19
+ attr_accessor :ca_cert_data
20
+
21
+ # name of the certificate in Salesforce tenant to use when uploading new key
22
+ attr_accessor :ca_cert_name
23
+
24
+ # Client ID of the oauth2 app to use for connecting to Salesforce
25
+ attr_accessor :client_id
26
+
27
+ # Client secret of the oauth2 app to use for connecting to Salesforce
28
+ attr_accessor :client_secret
29
+
30
+ # Comment about the target
31
+ attr_accessor :comment
32
+
33
+ # The email of the user attached to the oauth2 app used for connecting to Salesforce
34
+ attr_accessor :email
35
+
36
+ # The name of a key that used to encrypt the target secret value (if empty, the account default protectionKey key will be used)
37
+ attr_accessor :key
38
+
39
+ # Target name
40
+ attr_accessor :name
41
+
42
+ # The password of the user attached to the oauth2 app used for connecting to Salesforce
43
+ attr_accessor :password
44
+
45
+ # The security token of the user attached to the oauth2 app used for connecting to Salesforce
46
+ attr_accessor :security_token
47
+
48
+ # Url of the Salesforce tenant
49
+ attr_accessor :tenant_url
50
+
51
+ # Authentication token (see `/auth` and `/configure`)
52
+ attr_accessor :token
53
+
54
+ # The universal identity token, Required only for universal_identity authentication
55
+ attr_accessor :uid_token
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'ca_cert_data' => :'ca-cert-data',
61
+ :'ca_cert_name' => :'ca-cert-name',
62
+ :'client_id' => :'client-id',
63
+ :'client_secret' => :'client-secret',
64
+ :'comment' => :'comment',
65
+ :'email' => :'email',
66
+ :'key' => :'key',
67
+ :'name' => :'name',
68
+ :'password' => :'password',
69
+ :'security_token' => :'security-token',
70
+ :'tenant_url' => :'tenant-url',
71
+ :'token' => :'token',
72
+ :'uid_token' => :'uid-token'
73
+ }
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'ca_cert_data' => :'String',
85
+ :'ca_cert_name' => :'String',
86
+ :'client_id' => :'String',
87
+ :'client_secret' => :'String',
88
+ :'comment' => :'String',
89
+ :'email' => :'String',
90
+ :'key' => :'String',
91
+ :'name' => :'String',
92
+ :'password' => :'String',
93
+ :'security_token' => :'String',
94
+ :'tenant_url' => :'String',
95
+ :'token' => :'String',
96
+ :'uid_token' => :'String'
97
+ }
98
+ end
99
+
100
+ # List of attributes with nullable: true
101
+ def self.openapi_nullable
102
+ Set.new([
103
+ ])
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ if (!attributes.is_a?(Hash))
110
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::CreateSalesforceTarget` initialize method"
111
+ end
112
+
113
+ # check to see if the attribute exists and convert string to symbol for hash key
114
+ attributes = attributes.each_with_object({}) { |(k, v), h|
115
+ if (!self.class.attribute_map.key?(k.to_sym))
116
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::CreateSalesforceTarget`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
117
+ end
118
+ h[k.to_sym] = v
119
+ }
120
+
121
+ if attributes.key?(:'ca_cert_data')
122
+ self.ca_cert_data = attributes[:'ca_cert_data']
123
+ end
124
+
125
+ if attributes.key?(:'ca_cert_name')
126
+ self.ca_cert_name = attributes[:'ca_cert_name']
127
+ end
128
+
129
+ if attributes.key?(:'client_id')
130
+ self.client_id = attributes[:'client_id']
131
+ end
132
+
133
+ if attributes.key?(:'client_secret')
134
+ self.client_secret = attributes[:'client_secret']
135
+ end
136
+
137
+ if attributes.key?(:'comment')
138
+ self.comment = attributes[:'comment']
139
+ end
140
+
141
+ if attributes.key?(:'email')
142
+ self.email = attributes[:'email']
143
+ end
144
+
145
+ if attributes.key?(:'key')
146
+ self.key = attributes[:'key']
147
+ end
148
+
149
+ if attributes.key?(:'name')
150
+ self.name = attributes[:'name']
151
+ end
152
+
153
+ if attributes.key?(:'password')
154
+ self.password = attributes[:'password']
155
+ end
156
+
157
+ if attributes.key?(:'security_token')
158
+ self.security_token = attributes[:'security_token']
159
+ end
160
+
161
+ if attributes.key?(:'tenant_url')
162
+ self.tenant_url = attributes[:'tenant_url']
163
+ end
164
+
165
+ if attributes.key?(:'token')
166
+ self.token = attributes[:'token']
167
+ end
168
+
169
+ if attributes.key?(:'uid_token')
170
+ self.uid_token = attributes[:'uid_token']
171
+ end
172
+ end
173
+
174
+ # Show invalid properties with the reasons. Usually used together with valid?
175
+ # @return Array for valid properties with the reasons
176
+ def list_invalid_properties
177
+ invalid_properties = Array.new
178
+ if @client_id.nil?
179
+ invalid_properties.push('invalid value for "client_id", client_id cannot be nil.')
180
+ end
181
+
182
+ if @client_secret.nil?
183
+ invalid_properties.push('invalid value for "client_secret", client_secret cannot be nil.')
184
+ end
185
+
186
+ if @email.nil?
187
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
188
+ end
189
+
190
+ if @name.nil?
191
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
192
+ end
193
+
194
+ if @password.nil?
195
+ invalid_properties.push('invalid value for "password", password cannot be nil.')
196
+ end
197
+
198
+ if @security_token.nil?
199
+ invalid_properties.push('invalid value for "security_token", security_token cannot be nil.')
200
+ end
201
+
202
+ if @tenant_url.nil?
203
+ invalid_properties.push('invalid value for "tenant_url", tenant_url cannot be nil.')
204
+ end
205
+
206
+ invalid_properties
207
+ end
208
+
209
+ # Check to see if the all the properties in the model are valid
210
+ # @return true if the model is valid
211
+ def valid?
212
+ return false if @client_id.nil?
213
+ return false if @client_secret.nil?
214
+ return false if @email.nil?
215
+ return false if @name.nil?
216
+ return false if @password.nil?
217
+ return false if @security_token.nil?
218
+ return false if @tenant_url.nil?
219
+ true
220
+ end
221
+
222
+ # Checks equality by comparing each attribute.
223
+ # @param [Object] Object to be compared
224
+ def ==(o)
225
+ return true if self.equal?(o)
226
+ self.class == o.class &&
227
+ ca_cert_data == o.ca_cert_data &&
228
+ ca_cert_name == o.ca_cert_name &&
229
+ client_id == o.client_id &&
230
+ client_secret == o.client_secret &&
231
+ comment == o.comment &&
232
+ email == o.email &&
233
+ key == o.key &&
234
+ name == o.name &&
235
+ password == o.password &&
236
+ security_token == o.security_token &&
237
+ tenant_url == o.tenant_url &&
238
+ token == o.token &&
239
+ uid_token == o.uid_token
240
+ end
241
+
242
+ # @see the `==` method
243
+ # @param [Object] Object to be compared
244
+ def eql?(o)
245
+ self == o
246
+ end
247
+
248
+ # Calculates hash code according to all attributes.
249
+ # @return [Integer] Hash code
250
+ def hash
251
+ [ca_cert_data, ca_cert_name, client_id, client_secret, comment, email, key, name, password, security_token, tenant_url, token, uid_token].hash
252
+ end
253
+
254
+ # Builds the object from hash
255
+ # @param [Hash] attributes Model attributes in the form of hash
256
+ # @return [Object] Returns the model itself
257
+ def self.build_from_hash(attributes)
258
+ new.build_from_hash(attributes)
259
+ end
260
+
261
+ # Builds the object from hash
262
+ # @param [Hash] attributes Model attributes in the form of hash
263
+ # @return [Object] Returns the model itself
264
+ def build_from_hash(attributes)
265
+ return nil unless attributes.is_a?(Hash)
266
+ attributes = attributes.transform_keys(&:to_sym)
267
+ self.class.openapi_types.each_pair do |key, type|
268
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
269
+ self.send("#{key}=", nil)
270
+ elsif type =~ /\AArray<(.*)>/i
271
+ # check to ensure the input is an array given that the attribute
272
+ # is documented as an array but the input is not
273
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
274
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
275
+ end
276
+ elsif !attributes[self.class.attribute_map[key]].nil?
277
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
278
+ end
279
+ end
280
+
281
+ self
282
+ end
283
+
284
+ # Deserializes the data based on type
285
+ # @param string type Data type
286
+ # @param string value Value to be deserialized
287
+ # @return [Object] Deserialized data
288
+ def _deserialize(type, value)
289
+ case type.to_sym
290
+ when :Time
291
+ Time.parse(value)
292
+ when :Date
293
+ Date.parse(value)
294
+ when :String
295
+ value.to_s
296
+ when :Integer
297
+ value.to_i
298
+ when :Float
299
+ value.to_f
300
+ when :Boolean
301
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
302
+ true
303
+ else
304
+ false
305
+ end
306
+ when :Object
307
+ # generic object (usually a Hash), return directly
308
+ value
309
+ when /\AArray<(?<inner_type>.+)>\z/
310
+ inner_type = Regexp.last_match[:inner_type]
311
+ value.map { |v| _deserialize(inner_type, v) }
312
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
313
+ k_type = Regexp.last_match[:k_type]
314
+ v_type = Regexp.last_match[:v_type]
315
+ {}.tap do |hash|
316
+ value.each do |k, v|
317
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
318
+ end
319
+ end
320
+ else # model
321
+ # models (e.g. Pet) or oneOf
322
+ klass = Akeyless.const_get(type)
323
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
324
+ end
325
+ end
326
+
327
+ # Returns the string representation of the object
328
+ # @return [String] String presentation of the object
329
+ def to_s
330
+ to_hash.to_s
331
+ end
332
+
333
+ # to_body is an alias to to_hash (backward compatibility)
334
+ # @return [Hash] Returns the object in the form of hash
335
+ def to_body
336
+ to_hash
337
+ end
338
+
339
+ # Returns the object in the form of hash
340
+ # @return [Hash] Returns the object in the form of hash
341
+ def to_hash
342
+ hash = {}
343
+ self.class.attribute_map.each_pair do |attr, param|
344
+ value = self.send(attr)
345
+ if value.nil?
346
+ is_nullable = self.class.openapi_nullable.include?(attr)
347
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
348
+ end
349
+
350
+ hash[param] = _to_hash(value)
351
+ end
352
+ hash
353
+ end
354
+
355
+ # Outputs non-array value in the form of hash
356
+ # For object, use to_hash. Otherwise, just return the value
357
+ # @param [Object] value Any valid value
358
+ # @return [Hash] Returns the value in the form of hash
359
+ def _to_hash(value)
360
+ if value.is_a?(Array)
361
+ value.compact.map { |v| _to_hash(v) }
362
+ elsif value.is_a?(Hash)
363
+ {}.tap do |hash|
364
+ value.each { |k, v| hash[k] = _to_hash(v) }
365
+ end
366
+ elsif value.respond_to? :to_hash
367
+ value.to_hash
368
+ else
369
+ value
370
+ end
371
+ end
372
+
373
+ end
374
+
375
+ end
@@ -0,0 +1,219 @@
1
+ =begin
2
+ #Akeyless API
3
+
4
+ #The purpose of this application is to provide access to Akeyless API.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: support@akeyless.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ class CreateSalesforceTargetOutput
18
+ attr_accessor :target_id
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'target_id' => :'target_id'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'target_id' => :'Integer'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::CreateSalesforceTargetOutput` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::CreateSalesforceTargetOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'target_id')
61
+ self.target_id = attributes[:'target_id']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ target_id == o.target_id
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [target_id].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ attributes = attributes.transform_keys(&:to_sym)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
+ self.send("#{key}=", nil)
114
+ elsif type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :Time
135
+ Time.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ # models (e.g. Pet) or oneOf
166
+ klass = Akeyless.const_get(type)
167
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end