akeyless 2.16.2 → 2.16.5

Sign up to get free protection for your applications and to get access to all the features.
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,374 @@
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
+ # gatewayCreateMigration is a command that create migration
18
+ class GatewayCreateMigration
19
+ attr_accessor :aws_key
20
+
21
+ attr_accessor :aws_key_id
22
+
23
+ attr_accessor :aws_region
24
+
25
+ attr_accessor :azure_client_id
26
+
27
+ attr_accessor :azure_kv_name
28
+
29
+ attr_accessor :azure_secret
30
+
31
+ attr_accessor :azure_tenant_id
32
+
33
+ attr_accessor :hashi_json
34
+
35
+ attr_accessor :hashi_ns
36
+
37
+ attr_accessor :hashi_token
38
+
39
+ attr_accessor :hashi_url
40
+
41
+ # Migration name
42
+ attr_accessor :name
43
+
44
+ attr_accessor :protection_key
45
+
46
+ attr_accessor :target_location
47
+
48
+ # Authentication token (see `/auth` and `/configure`)
49
+ attr_accessor :token
50
+
51
+ attr_accessor :type
52
+
53
+ # The universal identity token, Required only for universal_identity authentication
54
+ attr_accessor :uid_token
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'aws_key' => :'aws-key',
60
+ :'aws_key_id' => :'aws-key-id',
61
+ :'aws_region' => :'aws-region',
62
+ :'azure_client_id' => :'azure-client-id',
63
+ :'azure_kv_name' => :'azure-kv-name',
64
+ :'azure_secret' => :'azure-secret',
65
+ :'azure_tenant_id' => :'azure-tenant-id',
66
+ :'hashi_json' => :'hashi-json',
67
+ :'hashi_ns' => :'hashi-ns',
68
+ :'hashi_token' => :'hashi-token',
69
+ :'hashi_url' => :'hashi-url',
70
+ :'name' => :'name',
71
+ :'protection_key' => :'protection-key',
72
+ :'target_location' => :'target-location',
73
+ :'token' => :'token',
74
+ :'type' => :'type',
75
+ :'uid_token' => :'uid-token'
76
+ }
77
+ end
78
+
79
+ # Returns all the JSON keys this model knows about
80
+ def self.acceptable_attributes
81
+ attribute_map.values
82
+ end
83
+
84
+ # Attribute type mapping.
85
+ def self.openapi_types
86
+ {
87
+ :'aws_key' => :'String',
88
+ :'aws_key_id' => :'String',
89
+ :'aws_region' => :'String',
90
+ :'azure_client_id' => :'String',
91
+ :'azure_kv_name' => :'String',
92
+ :'azure_secret' => :'String',
93
+ :'azure_tenant_id' => :'String',
94
+ :'hashi_json' => :'String',
95
+ :'hashi_ns' => :'Array<String>',
96
+ :'hashi_token' => :'String',
97
+ :'hashi_url' => :'String',
98
+ :'name' => :'String',
99
+ :'protection_key' => :'String',
100
+ :'target_location' => :'String',
101
+ :'token' => :'String',
102
+ :'type' => :'String',
103
+ :'uid_token' => :'String'
104
+ }
105
+ end
106
+
107
+ # List of attributes with nullable: true
108
+ def self.openapi_nullable
109
+ Set.new([
110
+ ])
111
+ end
112
+
113
+ # Initializes the object
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ def initialize(attributes = {})
116
+ if (!attributes.is_a?(Hash))
117
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::GatewayCreateMigration` initialize method"
118
+ end
119
+
120
+ # check to see if the attribute exists and convert string to symbol for hash key
121
+ attributes = attributes.each_with_object({}) { |(k, v), h|
122
+ if (!self.class.attribute_map.key?(k.to_sym))
123
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::GatewayCreateMigration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
124
+ end
125
+ h[k.to_sym] = v
126
+ }
127
+
128
+ if attributes.key?(:'aws_key')
129
+ self.aws_key = attributes[:'aws_key']
130
+ end
131
+
132
+ if attributes.key?(:'aws_key_id')
133
+ self.aws_key_id = attributes[:'aws_key_id']
134
+ end
135
+
136
+ if attributes.key?(:'aws_region')
137
+ self.aws_region = attributes[:'aws_region']
138
+ end
139
+
140
+ if attributes.key?(:'azure_client_id')
141
+ self.azure_client_id = attributes[:'azure_client_id']
142
+ end
143
+
144
+ if attributes.key?(:'azure_kv_name')
145
+ self.azure_kv_name = attributes[:'azure_kv_name']
146
+ end
147
+
148
+ if attributes.key?(:'azure_secret')
149
+ self.azure_secret = attributes[:'azure_secret']
150
+ end
151
+
152
+ if attributes.key?(:'azure_tenant_id')
153
+ self.azure_tenant_id = attributes[:'azure_tenant_id']
154
+ end
155
+
156
+ if attributes.key?(:'hashi_json')
157
+ self.hashi_json = attributes[:'hashi_json']
158
+ end
159
+
160
+ if attributes.key?(:'hashi_ns')
161
+ if (value = attributes[:'hashi_ns']).is_a?(Array)
162
+ self.hashi_ns = value
163
+ end
164
+ end
165
+
166
+ if attributes.key?(:'hashi_token')
167
+ self.hashi_token = attributes[:'hashi_token']
168
+ end
169
+
170
+ if attributes.key?(:'hashi_url')
171
+ self.hashi_url = attributes[:'hashi_url']
172
+ end
173
+
174
+ if attributes.key?(:'name')
175
+ self.name = attributes[:'name']
176
+ end
177
+
178
+ if attributes.key?(:'protection_key')
179
+ self.protection_key = attributes[:'protection_key']
180
+ end
181
+
182
+ if attributes.key?(:'target_location')
183
+ self.target_location = attributes[:'target_location']
184
+ end
185
+
186
+ if attributes.key?(:'token')
187
+ self.token = attributes[:'token']
188
+ end
189
+
190
+ if attributes.key?(:'type')
191
+ self.type = attributes[:'type']
192
+ end
193
+
194
+ if attributes.key?(:'uid_token')
195
+ self.uid_token = attributes[:'uid_token']
196
+ end
197
+ end
198
+
199
+ # Show invalid properties with the reasons. Usually used together with valid?
200
+ # @return Array for valid properties with the reasons
201
+ def list_invalid_properties
202
+ invalid_properties = Array.new
203
+ if @name.nil?
204
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
205
+ end
206
+
207
+ invalid_properties
208
+ end
209
+
210
+ # Check to see if the all the properties in the model are valid
211
+ # @return true if the model is valid
212
+ def valid?
213
+ return false if @name.nil?
214
+ true
215
+ end
216
+
217
+ # Checks equality by comparing each attribute.
218
+ # @param [Object] Object to be compared
219
+ def ==(o)
220
+ return true if self.equal?(o)
221
+ self.class == o.class &&
222
+ aws_key == o.aws_key &&
223
+ aws_key_id == o.aws_key_id &&
224
+ aws_region == o.aws_region &&
225
+ azure_client_id == o.azure_client_id &&
226
+ azure_kv_name == o.azure_kv_name &&
227
+ azure_secret == o.azure_secret &&
228
+ azure_tenant_id == o.azure_tenant_id &&
229
+ hashi_json == o.hashi_json &&
230
+ hashi_ns == o.hashi_ns &&
231
+ hashi_token == o.hashi_token &&
232
+ hashi_url == o.hashi_url &&
233
+ name == o.name &&
234
+ protection_key == o.protection_key &&
235
+ target_location == o.target_location &&
236
+ token == o.token &&
237
+ type == o.type &&
238
+ uid_token == o.uid_token
239
+ end
240
+
241
+ # @see the `==` method
242
+ # @param [Object] Object to be compared
243
+ def eql?(o)
244
+ self == o
245
+ end
246
+
247
+ # Calculates hash code according to all attributes.
248
+ # @return [Integer] Hash code
249
+ def hash
250
+ [aws_key, aws_key_id, aws_region, azure_client_id, azure_kv_name, azure_secret, azure_tenant_id, hashi_json, hashi_ns, hashi_token, hashi_url, name, protection_key, target_location, token, type, uid_token].hash
251
+ end
252
+
253
+ # Builds the object from hash
254
+ # @param [Hash] attributes Model attributes in the form of hash
255
+ # @return [Object] Returns the model itself
256
+ def self.build_from_hash(attributes)
257
+ new.build_from_hash(attributes)
258
+ end
259
+
260
+ # Builds the object from hash
261
+ # @param [Hash] attributes Model attributes in the form of hash
262
+ # @return [Object] Returns the model itself
263
+ def build_from_hash(attributes)
264
+ return nil unless attributes.is_a?(Hash)
265
+ attributes = attributes.transform_keys(&:to_sym)
266
+ self.class.openapi_types.each_pair do |key, type|
267
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
268
+ self.send("#{key}=", nil)
269
+ elsif type =~ /\AArray<(.*)>/i
270
+ # check to ensure the input is an array given that the attribute
271
+ # is documented as an array but the input is not
272
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
273
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
274
+ end
275
+ elsif !attributes[self.class.attribute_map[key]].nil?
276
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
277
+ end
278
+ end
279
+
280
+ self
281
+ end
282
+
283
+ # Deserializes the data based on type
284
+ # @param string type Data type
285
+ # @param string value Value to be deserialized
286
+ # @return [Object] Deserialized data
287
+ def _deserialize(type, value)
288
+ case type.to_sym
289
+ when :Time
290
+ Time.parse(value)
291
+ when :Date
292
+ Date.parse(value)
293
+ when :String
294
+ value.to_s
295
+ when :Integer
296
+ value.to_i
297
+ when :Float
298
+ value.to_f
299
+ when :Boolean
300
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
301
+ true
302
+ else
303
+ false
304
+ end
305
+ when :Object
306
+ # generic object (usually a Hash), return directly
307
+ value
308
+ when /\AArray<(?<inner_type>.+)>\z/
309
+ inner_type = Regexp.last_match[:inner_type]
310
+ value.map { |v| _deserialize(inner_type, v) }
311
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
312
+ k_type = Regexp.last_match[:k_type]
313
+ v_type = Regexp.last_match[:v_type]
314
+ {}.tap do |hash|
315
+ value.each do |k, v|
316
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
317
+ end
318
+ end
319
+ else # model
320
+ # models (e.g. Pet) or oneOf
321
+ klass = Akeyless.const_get(type)
322
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
323
+ end
324
+ end
325
+
326
+ # Returns the string representation of the object
327
+ # @return [String] String presentation of the object
328
+ def to_s
329
+ to_hash.to_s
330
+ end
331
+
332
+ # to_body is an alias to to_hash (backward compatibility)
333
+ # @return [Hash] Returns the object in the form of hash
334
+ def to_body
335
+ to_hash
336
+ end
337
+
338
+ # Returns the object in the form of hash
339
+ # @return [Hash] Returns the object in the form of hash
340
+ def to_hash
341
+ hash = {}
342
+ self.class.attribute_map.each_pair do |attr, param|
343
+ value = self.send(attr)
344
+ if value.nil?
345
+ is_nullable = self.class.openapi_nullable.include?(attr)
346
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
347
+ end
348
+
349
+ hash[param] = _to_hash(value)
350
+ end
351
+ hash
352
+ end
353
+
354
+ # Outputs non-array value in the form of hash
355
+ # For object, use to_hash. Otherwise, just return the value
356
+ # @param [Object] value Any valid value
357
+ # @return [Hash] Returns the value in the form of hash
358
+ def _to_hash(value)
359
+ if value.is_a?(Array)
360
+ value.compact.map { |v| _to_hash(v) }
361
+ elsif value.is_a?(Hash)
362
+ {}.tap do |hash|
363
+ value.each { |k, v| hash[k] = _to_hash(v) }
364
+ end
365
+ elsif value.respond_to? :to_hash
366
+ value.to_hash
367
+ else
368
+ value
369
+ end
370
+ end
371
+
372
+ end
373
+
374
+ end
@@ -0,0 +1,246 @@
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
+ # gatewayDeleteMigration is a command that delete migration
18
+ class GatewayDeleteMigration
19
+ # Migration name
20
+ attr_accessor :id
21
+
22
+ # Authentication token (see `/auth` and `/configure`)
23
+ attr_accessor :token
24
+
25
+ # The universal identity token, Required only for universal_identity authentication
26
+ attr_accessor :uid_token
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'token' => :'token',
33
+ :'uid_token' => :'uid-token'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'id' => :'String',
46
+ :'token' => :'String',
47
+ :'uid_token' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::GatewayDeleteMigration` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::GatewayDeleteMigration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'id')
73
+ self.id = attributes[:'id']
74
+ end
75
+
76
+ if attributes.key?(:'token')
77
+ self.token = attributes[:'token']
78
+ end
79
+
80
+ if attributes.key?(:'uid_token')
81
+ self.uid_token = attributes[:'uid_token']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ if @id.nil?
90
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
91
+ end
92
+
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ return false if @id.nil?
100
+ true
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ id == o.id &&
109
+ token == o.token &&
110
+ uid_token == o.uid_token
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [id, token, uid_token].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ attributes = attributes.transform_keys(&:to_sym)
138
+ self.class.openapi_types.each_pair do |key, type|
139
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
140
+ self.send("#{key}=", nil)
141
+ elsif type =~ /\AArray<(.*)>/i
142
+ # check to ensure the input is an array given that the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
+ end
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :Time
162
+ Time.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :Boolean
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ # models (e.g. Pet) or oneOf
193
+ klass = Akeyless.const_get(type)
194
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+
244
+ end
245
+
246
+ end