akeyless 3.3.4 → 3.3.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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -1
  3. data/docs/CertificateTemplateInfo.md +32 -0
  4. data/docs/CreateClassicKey.md +16 -0
  5. data/docs/CreateDFCKey.md +16 -0
  6. data/docs/CreateKey.md +16 -0
  7. data/docs/DSProducerDetails.md +8 -2
  8. data/docs/DeriveKey.md +40 -0
  9. data/docs/DeriveKeyOutput.md +20 -0
  10. data/docs/EventAction.md +26 -0
  11. data/docs/GatewayCreateProducerCertificateAutomation.md +6 -4
  12. data/docs/GatewayUpdateProducerCertificateAutomation.md +6 -4
  13. data/docs/ItemGeneralInfo.md +2 -0
  14. data/docs/TargetTypeDetailsInput.md +8 -2
  15. data/docs/V2Api.md +126 -0
  16. data/lib/akeyless/api/v2_api.rb +128 -0
  17. data/lib/akeyless/models/certificate_template_info.rb +282 -0
  18. data/lib/akeyless/models/create_classic_key.rb +81 -1
  19. data/lib/akeyless/models/create_dfc_key.rb +81 -1
  20. data/lib/akeyless/models/create_key.rb +81 -1
  21. data/lib/akeyless/models/derive_key.rb +362 -0
  22. data/lib/akeyless/models/derive_key_output.rb +228 -0
  23. data/lib/akeyless/models/ds_producer_details.rb +30 -1
  24. data/lib/akeyless/models/event_action.rb +272 -0
  25. data/lib/akeyless/models/gateway_create_producer_certificate_automation.rb +30 -18
  26. data/lib/akeyless/models/gateway_update_producer_certificate_automation.rb +30 -18
  27. data/lib/akeyless/models/item_general_info.rb +10 -1
  28. data/lib/akeyless/models/target_type_details_input.rb +30 -1
  29. data/lib/akeyless/version.rb +1 -1
  30. data/lib/akeyless.rb +4 -0
  31. data/spec/models/certificate_template_info_spec.rb +76 -0
  32. data/spec/models/derive_key_output_spec.rb +40 -0
  33. data/spec/models/derive_key_spec.rb +100 -0
  34. data/spec/models/event_action_spec.rb +58 -0
  35. metadata +18 -2
@@ -18,6 +18,27 @@ module Akeyless
18
18
  # DFCKey type; options: [AES128GCM, AES256GCM, AES128SIV, AES256SIV, AES128CBC, AES256CBC, RSA1024, RSA2048, RSA3072, RSA4096]
19
19
  attr_accessor :alg
20
20
 
21
+ # Common name for the generated certificate. Relevant only for generate-self-signed-certificate.
22
+ attr_accessor :certificate_common_name
23
+
24
+ # Country name for the generated certificate. Relevant only for generate-self-signed-certificate.
25
+ attr_accessor :certificate_country
26
+
27
+ # Digest algorithm to be used for the certificate key signing. Currently, we support only \"sha256\" so we hide this option for CLI.
28
+ attr_accessor :certificate_digest_algo
29
+
30
+ # Locality for the generated certificate. Relevant only for generate-self-signed-certificate.
31
+ attr_accessor :certificate_locality
32
+
33
+ # Organization name for the generated certificate. Relevant only for generate-self-signed-certificate.
34
+ attr_accessor :certificate_organization
35
+
36
+ # Province name for the generated certificate. Relevant only for generate-self-signed-certificate.
37
+ attr_accessor :certificate_province
38
+
39
+ # TTL in days for the generated certificate. Required only for generate-self-signed-certificate.
40
+ attr_accessor :certificate_ttl
41
+
21
42
  # The customer fragment ID that will be used to create the DFC key (if empty, the key will be created independently of a customer fragment)
22
43
  attr_accessor :customer_frg_id
23
44
 
@@ -27,6 +48,9 @@ module Akeyless
27
48
  # Description of the object
28
49
  attr_accessor :description
29
50
 
51
+ # Whether to generate a self signed certificate with the key. If set, --certificate-ttl must be provided.
52
+ attr_accessor :generate_self_signed_certificate
53
+
30
54
  # Set output format to JSON
31
55
  attr_accessor :json
32
56
 
@@ -52,9 +76,17 @@ module Akeyless
52
76
  def self.attribute_map
53
77
  {
54
78
  :'alg' => :'alg',
79
+ :'certificate_common_name' => :'certificate-common-name',
80
+ :'certificate_country' => :'certificate-country',
81
+ :'certificate_digest_algo' => :'certificate-digest-algo',
82
+ :'certificate_locality' => :'certificate-locality',
83
+ :'certificate_organization' => :'certificate-organization',
84
+ :'certificate_province' => :'certificate-province',
85
+ :'certificate_ttl' => :'certificate-ttl',
55
86
  :'customer_frg_id' => :'customer-frg-id',
56
87
  :'delete_protection' => :'delete_protection',
57
88
  :'description' => :'description',
89
+ :'generate_self_signed_certificate' => :'generate-self-signed-certificate',
58
90
  :'json' => :'json',
59
91
  :'metadata' => :'metadata',
60
92
  :'name' => :'name',
@@ -74,9 +106,17 @@ module Akeyless
74
106
  def self.openapi_types
75
107
  {
76
108
  :'alg' => :'String',
109
+ :'certificate_common_name' => :'String',
110
+ :'certificate_country' => :'String',
111
+ :'certificate_digest_algo' => :'String',
112
+ :'certificate_locality' => :'String',
113
+ :'certificate_organization' => :'String',
114
+ :'certificate_province' => :'String',
115
+ :'certificate_ttl' => :'Integer',
77
116
  :'customer_frg_id' => :'String',
78
117
  :'delete_protection' => :'String',
79
118
  :'description' => :'String',
119
+ :'generate_self_signed_certificate' => :'Boolean',
80
120
  :'json' => :'Boolean',
81
121
  :'metadata' => :'String',
82
122
  :'name' => :'String',
@@ -112,6 +152,34 @@ module Akeyless
112
152
  self.alg = attributes[:'alg']
113
153
  end
114
154
 
155
+ if attributes.key?(:'certificate_common_name')
156
+ self.certificate_common_name = attributes[:'certificate_common_name']
157
+ end
158
+
159
+ if attributes.key?(:'certificate_country')
160
+ self.certificate_country = attributes[:'certificate_country']
161
+ end
162
+
163
+ if attributes.key?(:'certificate_digest_algo')
164
+ self.certificate_digest_algo = attributes[:'certificate_digest_algo']
165
+ end
166
+
167
+ if attributes.key?(:'certificate_locality')
168
+ self.certificate_locality = attributes[:'certificate_locality']
169
+ end
170
+
171
+ if attributes.key?(:'certificate_organization')
172
+ self.certificate_organization = attributes[:'certificate_organization']
173
+ end
174
+
175
+ if attributes.key?(:'certificate_province')
176
+ self.certificate_province = attributes[:'certificate_province']
177
+ end
178
+
179
+ if attributes.key?(:'certificate_ttl')
180
+ self.certificate_ttl = attributes[:'certificate_ttl']
181
+ end
182
+
115
183
  if attributes.key?(:'customer_frg_id')
116
184
  self.customer_frg_id = attributes[:'customer_frg_id']
117
185
  end
@@ -124,6 +192,10 @@ module Akeyless
124
192
  self.description = attributes[:'description']
125
193
  end
126
194
 
195
+ if attributes.key?(:'generate_self_signed_certificate')
196
+ self.generate_self_signed_certificate = attributes[:'generate_self_signed_certificate']
197
+ end
198
+
127
199
  if attributes.key?(:'json')
128
200
  self.json = attributes[:'json']
129
201
  else
@@ -188,9 +260,17 @@ module Akeyless
188
260
  return true if self.equal?(o)
189
261
  self.class == o.class &&
190
262
  alg == o.alg &&
263
+ certificate_common_name == o.certificate_common_name &&
264
+ certificate_country == o.certificate_country &&
265
+ certificate_digest_algo == o.certificate_digest_algo &&
266
+ certificate_locality == o.certificate_locality &&
267
+ certificate_organization == o.certificate_organization &&
268
+ certificate_province == o.certificate_province &&
269
+ certificate_ttl == o.certificate_ttl &&
191
270
  customer_frg_id == o.customer_frg_id &&
192
271
  delete_protection == o.delete_protection &&
193
272
  description == o.description &&
273
+ generate_self_signed_certificate == o.generate_self_signed_certificate &&
194
274
  json == o.json &&
195
275
  metadata == o.metadata &&
196
276
  name == o.name &&
@@ -209,7 +289,7 @@ module Akeyless
209
289
  # Calculates hash code according to all attributes.
210
290
  # @return [Integer] Hash code
211
291
  def hash
212
- [alg, customer_frg_id, delete_protection, description, json, metadata, name, split_level, tag, token, uid_token].hash
292
+ [alg, certificate_common_name, certificate_country, certificate_digest_algo, certificate_locality, certificate_organization, certificate_province, certificate_ttl, customer_frg_id, delete_protection, description, generate_self_signed_certificate, json, metadata, name, split_level, tag, token, uid_token].hash
213
293
  end
214
294
 
215
295
  # Builds the object from hash
@@ -19,6 +19,27 @@ module Akeyless
19
19
  # Key type; options: [AES128GCM, AES256GCM, AES128SIV, AES256SIV, AES128CBC, AES256CBC, RSA1024, RSA2048, RSA3072, RSA4096]
20
20
  attr_accessor :alg
21
21
 
22
+ # Common name for the generated certificate. Relevant only for generate-self-signed-certificate.
23
+ attr_accessor :certificate_common_name
24
+
25
+ # Country name for the generated certificate. Relevant only for generate-self-signed-certificate.
26
+ attr_accessor :certificate_country
27
+
28
+ # Digest algorithm to be used for the certificate key signing. Currently, we support only \"sha256\" so we hide this option for CLI.
29
+ attr_accessor :certificate_digest_algo
30
+
31
+ # Locality for the generated certificate. Relevant only for generate-self-signed-certificate.
32
+ attr_accessor :certificate_locality
33
+
34
+ # Organization name for the generated certificate. Relevant only for generate-self-signed-certificate.
35
+ attr_accessor :certificate_organization
36
+
37
+ # Province name for the generated certificate. Relevant only for generate-self-signed-certificate.
38
+ attr_accessor :certificate_province
39
+
40
+ # TTL in days for the generated certificate. Required only for generate-self-signed-certificate.
41
+ attr_accessor :certificate_ttl
42
+
22
43
  # The customer fragment ID that will be used to create the key (if empty, the key will be created independently of a customer fragment)
23
44
  attr_accessor :customer_frg_id
24
45
 
@@ -28,6 +49,9 @@ module Akeyless
28
49
  # Description of the object
29
50
  attr_accessor :description
30
51
 
52
+ # Whether to generate a self signed certificate with the key. If set, --certificate-ttl must be provided.
53
+ attr_accessor :generate_self_signed_certificate
54
+
31
55
  # Set output format to JSON
32
56
  attr_accessor :json
33
57
 
@@ -53,9 +77,17 @@ module Akeyless
53
77
  def self.attribute_map
54
78
  {
55
79
  :'alg' => :'alg',
80
+ :'certificate_common_name' => :'certificate-common-name',
81
+ :'certificate_country' => :'certificate-country',
82
+ :'certificate_digest_algo' => :'certificate-digest-algo',
83
+ :'certificate_locality' => :'certificate-locality',
84
+ :'certificate_organization' => :'certificate-organization',
85
+ :'certificate_province' => :'certificate-province',
86
+ :'certificate_ttl' => :'certificate-ttl',
56
87
  :'customer_frg_id' => :'customer-frg-id',
57
88
  :'delete_protection' => :'delete_protection',
58
89
  :'description' => :'description',
90
+ :'generate_self_signed_certificate' => :'generate-self-signed-certificate',
59
91
  :'json' => :'json',
60
92
  :'metadata' => :'metadata',
61
93
  :'name' => :'name',
@@ -75,9 +107,17 @@ module Akeyless
75
107
  def self.openapi_types
76
108
  {
77
109
  :'alg' => :'String',
110
+ :'certificate_common_name' => :'String',
111
+ :'certificate_country' => :'String',
112
+ :'certificate_digest_algo' => :'String',
113
+ :'certificate_locality' => :'String',
114
+ :'certificate_organization' => :'String',
115
+ :'certificate_province' => :'String',
116
+ :'certificate_ttl' => :'Integer',
78
117
  :'customer_frg_id' => :'String',
79
118
  :'delete_protection' => :'String',
80
119
  :'description' => :'String',
120
+ :'generate_self_signed_certificate' => :'Boolean',
81
121
  :'json' => :'Boolean',
82
122
  :'metadata' => :'String',
83
123
  :'name' => :'String',
@@ -113,6 +153,34 @@ module Akeyless
113
153
  self.alg = attributes[:'alg']
114
154
  end
115
155
 
156
+ if attributes.key?(:'certificate_common_name')
157
+ self.certificate_common_name = attributes[:'certificate_common_name']
158
+ end
159
+
160
+ if attributes.key?(:'certificate_country')
161
+ self.certificate_country = attributes[:'certificate_country']
162
+ end
163
+
164
+ if attributes.key?(:'certificate_digest_algo')
165
+ self.certificate_digest_algo = attributes[:'certificate_digest_algo']
166
+ end
167
+
168
+ if attributes.key?(:'certificate_locality')
169
+ self.certificate_locality = attributes[:'certificate_locality']
170
+ end
171
+
172
+ if attributes.key?(:'certificate_organization')
173
+ self.certificate_organization = attributes[:'certificate_organization']
174
+ end
175
+
176
+ if attributes.key?(:'certificate_province')
177
+ self.certificate_province = attributes[:'certificate_province']
178
+ end
179
+
180
+ if attributes.key?(:'certificate_ttl')
181
+ self.certificate_ttl = attributes[:'certificate_ttl']
182
+ end
183
+
116
184
  if attributes.key?(:'customer_frg_id')
117
185
  self.customer_frg_id = attributes[:'customer_frg_id']
118
186
  end
@@ -125,6 +193,10 @@ module Akeyless
125
193
  self.description = attributes[:'description']
126
194
  end
127
195
 
196
+ if attributes.key?(:'generate_self_signed_certificate')
197
+ self.generate_self_signed_certificate = attributes[:'generate_self_signed_certificate']
198
+ end
199
+
128
200
  if attributes.key?(:'json')
129
201
  self.json = attributes[:'json']
130
202
  else
@@ -189,9 +261,17 @@ module Akeyless
189
261
  return true if self.equal?(o)
190
262
  self.class == o.class &&
191
263
  alg == o.alg &&
264
+ certificate_common_name == o.certificate_common_name &&
265
+ certificate_country == o.certificate_country &&
266
+ certificate_digest_algo == o.certificate_digest_algo &&
267
+ certificate_locality == o.certificate_locality &&
268
+ certificate_organization == o.certificate_organization &&
269
+ certificate_province == o.certificate_province &&
270
+ certificate_ttl == o.certificate_ttl &&
192
271
  customer_frg_id == o.customer_frg_id &&
193
272
  delete_protection == o.delete_protection &&
194
273
  description == o.description &&
274
+ generate_self_signed_certificate == o.generate_self_signed_certificate &&
195
275
  json == o.json &&
196
276
  metadata == o.metadata &&
197
277
  name == o.name &&
@@ -210,7 +290,7 @@ module Akeyless
210
290
  # Calculates hash code according to all attributes.
211
291
  # @return [Integer] Hash code
212
292
  def hash
213
- [alg, customer_frg_id, delete_protection, description, json, metadata, name, split_level, tag, token, uid_token].hash
293
+ [alg, certificate_common_name, certificate_country, certificate_digest_algo, certificate_locality, certificate_organization, certificate_province, certificate_ttl, customer_frg_id, delete_protection, description, generate_self_signed_certificate, json, metadata, name, split_level, tag, token, uid_token].hash
214
294
  end
215
295
 
216
296
  # Builds the object from hash
@@ -0,0 +1,362 @@
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: 7.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ class DeriveKey
18
+ # for personal password manager
19
+ attr_accessor :accessibility
20
+
21
+ # Kdf algorithm
22
+ attr_accessor :alg
23
+
24
+ # HashFunction the hash function to use (relevant for pbkdf2)
25
+ attr_accessor :hash_function
26
+
27
+ # IterationCount the number of iterations
28
+ attr_accessor :iter
29
+
30
+ # Set output format to JSON
31
+ attr_accessor :json
32
+
33
+ # KeyLength the byte length of the generated key
34
+ attr_accessor :key_len
35
+
36
+ # MemorySizeInKb the memory paramter in kb (relevant for argon2id)
37
+ attr_accessor :mem
38
+
39
+ # Static Secret full name
40
+ attr_accessor :name
41
+
42
+ # Parallelism the number of threads to use (relevant for argon2id)
43
+ attr_accessor :parallelism
44
+
45
+ # Salt Base64 encoded salt value. If not provided, the salt will be generated as part of the operation. The salt should be securely-generated random bytes, minimum 64 bits, 128 bits is recommended
46
+ attr_accessor :salt
47
+
48
+ # Authentication token (see `/auth` and `/configure`)
49
+ attr_accessor :token
50
+
51
+ # The universal identity token, Required only for universal_identity authentication
52
+ attr_accessor :uid_token
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'accessibility' => :'accessibility',
58
+ :'alg' => :'alg',
59
+ :'hash_function' => :'hash-function',
60
+ :'iter' => :'iter',
61
+ :'json' => :'json',
62
+ :'key_len' => :'key-len',
63
+ :'mem' => :'mem',
64
+ :'name' => :'name',
65
+ :'parallelism' => :'parallelism',
66
+ :'salt' => :'salt',
67
+ :'token' => :'token',
68
+ :'uid_token' => :'uid-token'
69
+ }
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'accessibility' => :'String',
81
+ :'alg' => :'String',
82
+ :'hash_function' => :'String',
83
+ :'iter' => :'Integer',
84
+ :'json' => :'Boolean',
85
+ :'key_len' => :'Integer',
86
+ :'mem' => :'Integer',
87
+ :'name' => :'String',
88
+ :'parallelism' => :'Integer',
89
+ :'salt' => :'String',
90
+ :'token' => :'String',
91
+ :'uid_token' => :'String'
92
+ }
93
+ end
94
+
95
+ # List of attributes with nullable: true
96
+ def self.openapi_nullable
97
+ Set.new([
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::DeriveKey` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::DeriveKey`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'accessibility')
117
+ self.accessibility = attributes[:'accessibility']
118
+ else
119
+ self.accessibility = 'regular'
120
+ end
121
+
122
+ if attributes.key?(:'alg')
123
+ self.alg = attributes[:'alg']
124
+ else
125
+ self.alg = 'pbkdf2'
126
+ end
127
+
128
+ if attributes.key?(:'hash_function')
129
+ self.hash_function = attributes[:'hash_function']
130
+ else
131
+ self.hash_function = 'sha256'
132
+ end
133
+
134
+ if attributes.key?(:'iter')
135
+ self.iter = attributes[:'iter']
136
+ end
137
+
138
+ if attributes.key?(:'json')
139
+ self.json = attributes[:'json']
140
+ else
141
+ self.json = false
142
+ end
143
+
144
+ if attributes.key?(:'key_len')
145
+ self.key_len = attributes[:'key_len']
146
+ end
147
+
148
+ if attributes.key?(:'mem')
149
+ self.mem = attributes[:'mem']
150
+ else
151
+ self.mem = 16384
152
+ end
153
+
154
+ if attributes.key?(:'name')
155
+ self.name = attributes[:'name']
156
+ end
157
+
158
+ if attributes.key?(:'parallelism')
159
+ self.parallelism = attributes[:'parallelism']
160
+ else
161
+ self.parallelism = 1
162
+ end
163
+
164
+ if attributes.key?(:'salt')
165
+ self.salt = attributes[:'salt']
166
+ end
167
+
168
+ if attributes.key?(:'token')
169
+ self.token = attributes[:'token']
170
+ end
171
+
172
+ if attributes.key?(:'uid_token')
173
+ self.uid_token = attributes[:'uid_token']
174
+ end
175
+ end
176
+
177
+ # Show invalid properties with the reasons. Usually used together with valid?
178
+ # @return Array for valid properties with the reasons
179
+ def list_invalid_properties
180
+ invalid_properties = Array.new
181
+ if @alg.nil?
182
+ invalid_properties.push('invalid value for "alg", alg cannot be nil.')
183
+ end
184
+
185
+ if @iter.nil?
186
+ invalid_properties.push('invalid value for "iter", iter cannot be nil.')
187
+ end
188
+
189
+ if @key_len.nil?
190
+ invalid_properties.push('invalid value for "key_len", key_len cannot be nil.')
191
+ end
192
+
193
+ if @name.nil?
194
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
195
+ end
196
+
197
+ invalid_properties
198
+ end
199
+
200
+ # Check to see if the all the properties in the model are valid
201
+ # @return true if the model is valid
202
+ def valid?
203
+ return false if @alg.nil?
204
+ return false if @iter.nil?
205
+ return false if @key_len.nil?
206
+ return false if @name.nil?
207
+ true
208
+ end
209
+
210
+ # Checks equality by comparing each attribute.
211
+ # @param [Object] Object to be compared
212
+ def ==(o)
213
+ return true if self.equal?(o)
214
+ self.class == o.class &&
215
+ accessibility == o.accessibility &&
216
+ alg == o.alg &&
217
+ hash_function == o.hash_function &&
218
+ iter == o.iter &&
219
+ json == o.json &&
220
+ key_len == o.key_len &&
221
+ mem == o.mem &&
222
+ name == o.name &&
223
+ parallelism == o.parallelism &&
224
+ salt == o.salt &&
225
+ token == o.token &&
226
+ uid_token == o.uid_token
227
+ end
228
+
229
+ # @see the `==` method
230
+ # @param [Object] Object to be compared
231
+ def eql?(o)
232
+ self == o
233
+ end
234
+
235
+ # Calculates hash code according to all attributes.
236
+ # @return [Integer] Hash code
237
+ def hash
238
+ [accessibility, alg, hash_function, iter, json, key_len, mem, name, parallelism, salt, token, uid_token].hash
239
+ end
240
+
241
+ # Builds the object from hash
242
+ # @param [Hash] attributes Model attributes in the form of hash
243
+ # @return [Object] Returns the model itself
244
+ def self.build_from_hash(attributes)
245
+ new.build_from_hash(attributes)
246
+ end
247
+
248
+ # Builds the object from hash
249
+ # @param [Hash] attributes Model attributes in the form of hash
250
+ # @return [Object] Returns the model itself
251
+ def build_from_hash(attributes)
252
+ return nil unless attributes.is_a?(Hash)
253
+ attributes = attributes.transform_keys(&:to_sym)
254
+ self.class.openapi_types.each_pair do |key, type|
255
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
256
+ self.send("#{key}=", nil)
257
+ elsif type =~ /\AArray<(.*)>/i
258
+ # check to ensure the input is an array given that the attribute
259
+ # is documented as an array but the input is not
260
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
261
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
262
+ end
263
+ elsif !attributes[self.class.attribute_map[key]].nil?
264
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
265
+ end
266
+ end
267
+
268
+ self
269
+ end
270
+
271
+ # Deserializes the data based on type
272
+ # @param string type Data type
273
+ # @param string value Value to be deserialized
274
+ # @return [Object] Deserialized data
275
+ def _deserialize(type, value)
276
+ case type.to_sym
277
+ when :Time
278
+ Time.parse(value)
279
+ when :Date
280
+ Date.parse(value)
281
+ when :String
282
+ value.to_s
283
+ when :Integer
284
+ value.to_i
285
+ when :Float
286
+ value.to_f
287
+ when :Boolean
288
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
289
+ true
290
+ else
291
+ false
292
+ end
293
+ when :Object
294
+ # generic object (usually a Hash), return directly
295
+ value
296
+ when /\AArray<(?<inner_type>.+)>\z/
297
+ inner_type = Regexp.last_match[:inner_type]
298
+ value.map { |v| _deserialize(inner_type, v) }
299
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
300
+ k_type = Regexp.last_match[:k_type]
301
+ v_type = Regexp.last_match[:v_type]
302
+ {}.tap do |hash|
303
+ value.each do |k, v|
304
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
305
+ end
306
+ end
307
+ else # model
308
+ # models (e.g. Pet) or oneOf
309
+ klass = Akeyless.const_get(type)
310
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
311
+ end
312
+ end
313
+
314
+ # Returns the string representation of the object
315
+ # @return [String] String presentation of the object
316
+ def to_s
317
+ to_hash.to_s
318
+ end
319
+
320
+ # to_body is an alias to to_hash (backward compatibility)
321
+ # @return [Hash] Returns the object in the form of hash
322
+ def to_body
323
+ to_hash
324
+ end
325
+
326
+ # Returns the object in the form of hash
327
+ # @return [Hash] Returns the object in the form of hash
328
+ def to_hash
329
+ hash = {}
330
+ self.class.attribute_map.each_pair do |attr, param|
331
+ value = self.send(attr)
332
+ if value.nil?
333
+ is_nullable = self.class.openapi_nullable.include?(attr)
334
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
335
+ end
336
+
337
+ hash[param] = _to_hash(value)
338
+ end
339
+ hash
340
+ end
341
+
342
+ # Outputs non-array value in the form of hash
343
+ # For object, use to_hash. Otherwise, just return the value
344
+ # @param [Object] value Any valid value
345
+ # @return [Hash] Returns the value in the form of hash
346
+ def _to_hash(value)
347
+ if value.is_a?(Array)
348
+ value.compact.map { |v| _to_hash(v) }
349
+ elsif value.is_a?(Hash)
350
+ {}.tap do |hash|
351
+ value.each { |k, v| hash[k] = _to_hash(v) }
352
+ end
353
+ elsif value.respond_to? :to_hash
354
+ value.to_hash
355
+ else
356
+ value
357
+ end
358
+ end
359
+
360
+ end
361
+
362
+ end