akeyless 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -3
  3. data/docs/AttributeTypeAndValue.md +20 -0
  4. data/docs/CertificateChainInfo.md +22 -0
  5. data/docs/CertificateExpirationEvent.md +18 -0
  6. data/docs/CertificateInfo.md +62 -0
  7. data/docs/Connect.md +2 -0
  8. data/docs/CreateEventForwarder.md +48 -0
  9. data/docs/CreateEventForwarderOutput.md +18 -0
  10. data/docs/CreateRotatedSecret.md +2 -0
  11. data/docs/DeleteEventForwarder.md +24 -0
  12. data/docs/EmailEntry.md +20 -0
  13. data/docs/Extension.md +22 -0
  14. data/docs/GatewayUpdateItem.md +2 -0
  15. data/docs/GetEventForwarder.md +24 -0
  16. data/docs/GetEventForwarderOutput.md +18 -0
  17. data/docs/Item.md +4 -0
  18. data/docs/ItemGeneralInfo.md +2 -0
  19. data/docs/ListSharedItems.md +24 -0
  20. data/docs/Name.md +28 -0
  21. data/docs/NotiForwarder.md +56 -0
  22. data/docs/RequestAccess.md +28 -0
  23. data/docs/RequestAccessOutput.md +18 -0
  24. data/docs/Target.md +4 -0
  25. data/docs/UpdateEventForwarder.md +40 -0
  26. data/docs/UpdateRotatedSecret.md +2 -0
  27. data/docs/V2Api.md +377 -63
  28. data/lib/akeyless/api/v2_api.rb +384 -64
  29. data/lib/akeyless/api_error.rb +1 -0
  30. data/lib/akeyless/configuration.rb +11 -0
  31. data/lib/akeyless/models/attribute_type_and_value.rb +231 -0
  32. data/lib/akeyless/models/certificate_chain_info.rb +241 -0
  33. data/lib/akeyless/models/certificate_expiration_event.rb +219 -0
  34. data/lib/akeyless/models/certificate_info.rb +434 -0
  35. data/lib/akeyless/models/connect.rb +11 -1
  36. data/lib/akeyless/models/create_event_forwarder.rb +394 -0
  37. data/lib/akeyless/models/create_event_forwarder_output.rb +219 -0
  38. data/lib/akeyless/models/create_rotated_secret.rb +11 -1
  39. data/lib/akeyless/models/delete_event_forwarder.rb +255 -0
  40. data/lib/akeyless/models/email_entry.rb +228 -0
  41. data/lib/akeyless/models/extension.rb +237 -0
  42. data/lib/akeyless/models/gateway_update_item.rb +11 -1
  43. data/lib/akeyless/models/get_event_forwarder.rb +255 -0
  44. data/lib/akeyless/models/get_event_forwarder_output.rb +219 -0
  45. data/lib/akeyless/models/item.rb +19 -1
  46. data/lib/akeyless/models/item_general_info.rb +10 -1
  47. data/lib/akeyless/models/list_shared_items.rb +253 -0
  48. data/lib/akeyless/models/name.rb +277 -0
  49. data/lib/akeyless/models/noti_forwarder.rb +400 -0
  50. data/lib/akeyless/models/request_access.rb +282 -0
  51. data/lib/akeyless/models/request_access_output.rb +219 -0
  52. data/lib/akeyless/models/target.rb +19 -1
  53. data/lib/akeyless/models/update_event_forwarder.rb +341 -0
  54. data/lib/akeyless/models/update_rotated_secret.rb +11 -1
  55. data/lib/akeyless/version.rb +1 -1
  56. data/lib/akeyless.rb +17 -1
  57. data/spec/models/attribute_type_and_value_spec.rb +40 -0
  58. data/spec/models/certificate_chain_info_spec.rb +46 -0
  59. data/spec/models/certificate_expiration_event_spec.rb +34 -0
  60. data/spec/models/certificate_info_spec.rb +166 -0
  61. data/spec/models/create_event_forwarder_output_spec.rb +34 -0
  62. data/spec/models/create_event_forwarder_spec.rb +124 -0
  63. data/spec/models/delete_event_forwarder_spec.rb +52 -0
  64. data/spec/models/email_entry_spec.rb +40 -0
  65. data/spec/models/extension_spec.rb +46 -0
  66. data/spec/models/get_event_forwarder_output_spec.rb +34 -0
  67. data/spec/models/get_event_forwarder_spec.rb +52 -0
  68. data/spec/models/list_shared_items_spec.rb +52 -0
  69. data/spec/models/name_spec.rb +64 -0
  70. data/spec/models/noti_forwarder_spec.rb +148 -0
  71. data/spec/models/request_access_output_spec.rb +34 -0
  72. data/spec/models/request_access_spec.rb +64 -0
  73. data/spec/models/update_event_forwarder_spec.rb +100 -0
  74. metadata +597 -529
@@ -0,0 +1,400 @@
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.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ class NotiForwarder
18
+ attr_accessor :client_permissions
19
+
20
+ attr_accessor :comment
21
+
22
+ attr_accessor :creation_date
23
+
24
+ attr_accessor :endpoint
25
+
26
+ attr_accessor :event_types
27
+
28
+ attr_accessor :gateway_cluster_id
29
+
30
+ attr_accessor :is_enabled
31
+
32
+ attr_accessor :last_version
33
+
34
+ attr_accessor :modification_date
35
+
36
+ attr_accessor :noti_forwarder_id
37
+
38
+ attr_accessor :noti_forwarder_name
39
+
40
+ attr_accessor :noti_forwarder_type
41
+
42
+ attr_accessor :noti_forwarder_versions
43
+
44
+ attr_accessor :paths
45
+
46
+ attr_accessor :protection_key
47
+
48
+ attr_accessor :runner_type
49
+
50
+ attr_accessor :timespan_in_seconds
51
+
52
+ attr_accessor :to_emails
53
+
54
+ attr_accessor :username
55
+
56
+ attr_accessor :with_customer_fragment
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'client_permissions' => :'client_permissions',
62
+ :'comment' => :'comment',
63
+ :'creation_date' => :'creation_date',
64
+ :'endpoint' => :'endpoint',
65
+ :'event_types' => :'event_types',
66
+ :'gateway_cluster_id' => :'gateway_cluster_id',
67
+ :'is_enabled' => :'is_enabled',
68
+ :'last_version' => :'last_version',
69
+ :'modification_date' => :'modification_date',
70
+ :'noti_forwarder_id' => :'noti_forwarder_id',
71
+ :'noti_forwarder_name' => :'noti_forwarder_name',
72
+ :'noti_forwarder_type' => :'noti_forwarder_type',
73
+ :'noti_forwarder_versions' => :'noti_forwarder_versions',
74
+ :'paths' => :'paths',
75
+ :'protection_key' => :'protection_key',
76
+ :'runner_type' => :'runner_type',
77
+ :'timespan_in_seconds' => :'timespan_in_seconds',
78
+ :'to_emails' => :'to_emails',
79
+ :'username' => :'username',
80
+ :'with_customer_fragment' => :'with_customer_fragment'
81
+ }
82
+ end
83
+
84
+ # Returns all the JSON keys this model knows about
85
+ def self.acceptable_attributes
86
+ attribute_map.values
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.openapi_types
91
+ {
92
+ :'client_permissions' => :'Array<String>',
93
+ :'comment' => :'String',
94
+ :'creation_date' => :'Time',
95
+ :'endpoint' => :'String',
96
+ :'event_types' => :'Array<String>',
97
+ :'gateway_cluster_id' => :'Integer',
98
+ :'is_enabled' => :'Boolean',
99
+ :'last_version' => :'Integer',
100
+ :'modification_date' => :'Time',
101
+ :'noti_forwarder_id' => :'Integer',
102
+ :'noti_forwarder_name' => :'String',
103
+ :'noti_forwarder_type' => :'String',
104
+ :'noti_forwarder_versions' => :'Array<ItemVersion>',
105
+ :'paths' => :'Array<String>',
106
+ :'protection_key' => :'String',
107
+ :'runner_type' => :'String',
108
+ :'timespan_in_seconds' => :'Integer',
109
+ :'to_emails' => :'Array<EmailEntry>',
110
+ :'username' => :'String',
111
+ :'with_customer_fragment' => :'Boolean'
112
+ }
113
+ end
114
+
115
+ # List of attributes with nullable: true
116
+ def self.openapi_nullable
117
+ Set.new([
118
+ ])
119
+ end
120
+
121
+ # Initializes the object
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ def initialize(attributes = {})
124
+ if (!attributes.is_a?(Hash))
125
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::NotiForwarder` initialize method"
126
+ end
127
+
128
+ # check to see if the attribute exists and convert string to symbol for hash key
129
+ attributes = attributes.each_with_object({}) { |(k, v), h|
130
+ if (!self.class.attribute_map.key?(k.to_sym))
131
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::NotiForwarder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
132
+ end
133
+ h[k.to_sym] = v
134
+ }
135
+
136
+ if attributes.key?(:'client_permissions')
137
+ if (value = attributes[:'client_permissions']).is_a?(Array)
138
+ self.client_permissions = value
139
+ end
140
+ end
141
+
142
+ if attributes.key?(:'comment')
143
+ self.comment = attributes[:'comment']
144
+ end
145
+
146
+ if attributes.key?(:'creation_date')
147
+ self.creation_date = attributes[:'creation_date']
148
+ end
149
+
150
+ if attributes.key?(:'endpoint')
151
+ self.endpoint = attributes[:'endpoint']
152
+ end
153
+
154
+ if attributes.key?(:'event_types')
155
+ if (value = attributes[:'event_types']).is_a?(Array)
156
+ self.event_types = value
157
+ end
158
+ end
159
+
160
+ if attributes.key?(:'gateway_cluster_id')
161
+ self.gateway_cluster_id = attributes[:'gateway_cluster_id']
162
+ end
163
+
164
+ if attributes.key?(:'is_enabled')
165
+ self.is_enabled = attributes[:'is_enabled']
166
+ end
167
+
168
+ if attributes.key?(:'last_version')
169
+ self.last_version = attributes[:'last_version']
170
+ end
171
+
172
+ if attributes.key?(:'modification_date')
173
+ self.modification_date = attributes[:'modification_date']
174
+ end
175
+
176
+ if attributes.key?(:'noti_forwarder_id')
177
+ self.noti_forwarder_id = attributes[:'noti_forwarder_id']
178
+ end
179
+
180
+ if attributes.key?(:'noti_forwarder_name')
181
+ self.noti_forwarder_name = attributes[:'noti_forwarder_name']
182
+ end
183
+
184
+ if attributes.key?(:'noti_forwarder_type')
185
+ self.noti_forwarder_type = attributes[:'noti_forwarder_type']
186
+ end
187
+
188
+ if attributes.key?(:'noti_forwarder_versions')
189
+ if (value = attributes[:'noti_forwarder_versions']).is_a?(Array)
190
+ self.noti_forwarder_versions = value
191
+ end
192
+ end
193
+
194
+ if attributes.key?(:'paths')
195
+ if (value = attributes[:'paths']).is_a?(Array)
196
+ self.paths = value
197
+ end
198
+ end
199
+
200
+ if attributes.key?(:'protection_key')
201
+ self.protection_key = attributes[:'protection_key']
202
+ end
203
+
204
+ if attributes.key?(:'runner_type')
205
+ self.runner_type = attributes[:'runner_type']
206
+ end
207
+
208
+ if attributes.key?(:'timespan_in_seconds')
209
+ self.timespan_in_seconds = attributes[:'timespan_in_seconds']
210
+ end
211
+
212
+ if attributes.key?(:'to_emails')
213
+ if (value = attributes[:'to_emails']).is_a?(Array)
214
+ self.to_emails = value
215
+ end
216
+ end
217
+
218
+ if attributes.key?(:'username')
219
+ self.username = attributes[:'username']
220
+ end
221
+
222
+ if attributes.key?(:'with_customer_fragment')
223
+ self.with_customer_fragment = attributes[:'with_customer_fragment']
224
+ end
225
+ end
226
+
227
+ # Show invalid properties with the reasons. Usually used together with valid?
228
+ # @return Array for valid properties with the reasons
229
+ def list_invalid_properties
230
+ invalid_properties = Array.new
231
+ invalid_properties
232
+ end
233
+
234
+ # Check to see if the all the properties in the model are valid
235
+ # @return true if the model is valid
236
+ def valid?
237
+ true
238
+ end
239
+
240
+ # Checks equality by comparing each attribute.
241
+ # @param [Object] Object to be compared
242
+ def ==(o)
243
+ return true if self.equal?(o)
244
+ self.class == o.class &&
245
+ client_permissions == o.client_permissions &&
246
+ comment == o.comment &&
247
+ creation_date == o.creation_date &&
248
+ endpoint == o.endpoint &&
249
+ event_types == o.event_types &&
250
+ gateway_cluster_id == o.gateway_cluster_id &&
251
+ is_enabled == o.is_enabled &&
252
+ last_version == o.last_version &&
253
+ modification_date == o.modification_date &&
254
+ noti_forwarder_id == o.noti_forwarder_id &&
255
+ noti_forwarder_name == o.noti_forwarder_name &&
256
+ noti_forwarder_type == o.noti_forwarder_type &&
257
+ noti_forwarder_versions == o.noti_forwarder_versions &&
258
+ paths == o.paths &&
259
+ protection_key == o.protection_key &&
260
+ runner_type == o.runner_type &&
261
+ timespan_in_seconds == o.timespan_in_seconds &&
262
+ to_emails == o.to_emails &&
263
+ username == o.username &&
264
+ with_customer_fragment == o.with_customer_fragment
265
+ end
266
+
267
+ # @see the `==` method
268
+ # @param [Object] Object to be compared
269
+ def eql?(o)
270
+ self == o
271
+ end
272
+
273
+ # Calculates hash code according to all attributes.
274
+ # @return [Integer] Hash code
275
+ def hash
276
+ [client_permissions, comment, creation_date, endpoint, event_types, gateway_cluster_id, is_enabled, last_version, modification_date, noti_forwarder_id, noti_forwarder_name, noti_forwarder_type, noti_forwarder_versions, paths, protection_key, runner_type, timespan_in_seconds, to_emails, username, with_customer_fragment].hash
277
+ end
278
+
279
+ # Builds the object from hash
280
+ # @param [Hash] attributes Model attributes in the form of hash
281
+ # @return [Object] Returns the model itself
282
+ def self.build_from_hash(attributes)
283
+ new.build_from_hash(attributes)
284
+ end
285
+
286
+ # Builds the object from hash
287
+ # @param [Hash] attributes Model attributes in the form of hash
288
+ # @return [Object] Returns the model itself
289
+ def build_from_hash(attributes)
290
+ return nil unless attributes.is_a?(Hash)
291
+ attributes = attributes.transform_keys(&:to_sym)
292
+ self.class.openapi_types.each_pair do |key, type|
293
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
294
+ self.send("#{key}=", nil)
295
+ elsif type =~ /\AArray<(.*)>/i
296
+ # check to ensure the input is an array given that the attribute
297
+ # is documented as an array but the input is not
298
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
299
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
300
+ end
301
+ elsif !attributes[self.class.attribute_map[key]].nil?
302
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
303
+ end
304
+ end
305
+
306
+ self
307
+ end
308
+
309
+ # Deserializes the data based on type
310
+ # @param string type Data type
311
+ # @param string value Value to be deserialized
312
+ # @return [Object] Deserialized data
313
+ def _deserialize(type, value)
314
+ case type.to_sym
315
+ when :Time
316
+ Time.parse(value)
317
+ when :Date
318
+ Date.parse(value)
319
+ when :String
320
+ value.to_s
321
+ when :Integer
322
+ value.to_i
323
+ when :Float
324
+ value.to_f
325
+ when :Boolean
326
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
327
+ true
328
+ else
329
+ false
330
+ end
331
+ when :Object
332
+ # generic object (usually a Hash), return directly
333
+ value
334
+ when /\AArray<(?<inner_type>.+)>\z/
335
+ inner_type = Regexp.last_match[:inner_type]
336
+ value.map { |v| _deserialize(inner_type, v) }
337
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
338
+ k_type = Regexp.last_match[:k_type]
339
+ v_type = Regexp.last_match[:v_type]
340
+ {}.tap do |hash|
341
+ value.each do |k, v|
342
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
343
+ end
344
+ end
345
+ else # model
346
+ # models (e.g. Pet) or oneOf
347
+ klass = Akeyless.const_get(type)
348
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
349
+ end
350
+ end
351
+
352
+ # Returns the string representation of the object
353
+ # @return [String] String presentation of the object
354
+ def to_s
355
+ to_hash.to_s
356
+ end
357
+
358
+ # to_body is an alias to to_hash (backward compatibility)
359
+ # @return [Hash] Returns the object in the form of hash
360
+ def to_body
361
+ to_hash
362
+ end
363
+
364
+ # Returns the object in the form of hash
365
+ # @return [Hash] Returns the object in the form of hash
366
+ def to_hash
367
+ hash = {}
368
+ self.class.attribute_map.each_pair do |attr, param|
369
+ value = self.send(attr)
370
+ if value.nil?
371
+ is_nullable = self.class.openapi_nullable.include?(attr)
372
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
373
+ end
374
+
375
+ hash[param] = _to_hash(value)
376
+ end
377
+ hash
378
+ end
379
+
380
+ # Outputs non-array value in the form of hash
381
+ # For object, use to_hash. Otherwise, just return the value
382
+ # @param [Object] value Any valid value
383
+ # @return [Hash] Returns the value in the form of hash
384
+ def _to_hash(value)
385
+ if value.is_a?(Array)
386
+ value.compact.map { |v| _to_hash(v) }
387
+ elsif value.is_a?(Hash)
388
+ {}.tap do |hash|
389
+ value.each { |k, v| hash[k] = _to_hash(v) }
390
+ end
391
+ elsif value.respond_to? :to_hash
392
+ value.to_hash
393
+ else
394
+ value
395
+ end
396
+ end
397
+
398
+ end
399
+
400
+ end
@@ -0,0 +1,282 @@
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.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ class RequestAccess
18
+ # List of the required capabilities options: [read, update, delete]
19
+ attr_accessor :capability
20
+
21
+ # Comment about this request
22
+ attr_accessor :comment
23
+
24
+ # Set output format to JSON
25
+ attr_accessor :json
26
+
27
+ # Item type
28
+ attr_accessor :name
29
+
30
+ # Authentication token (see `/auth` and `/configure`)
31
+ attr_accessor :token
32
+
33
+ # The universal identity token, Required only for universal_identity authentication
34
+ attr_accessor :uid_token
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'capability' => :'capability',
40
+ :'comment' => :'comment',
41
+ :'json' => :'json',
42
+ :'name' => :'name',
43
+ :'token' => :'token',
44
+ :'uid_token' => :'uid-token'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'capability' => :'Array<String>',
57
+ :'comment' => :'String',
58
+ :'json' => :'Boolean',
59
+ :'name' => :'String',
60
+ :'token' => :'String',
61
+ :'uid_token' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::RequestAccess` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::RequestAccess`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'capability')
87
+ if (value = attributes[:'capability']).is_a?(Array)
88
+ self.capability = value
89
+ end
90
+ end
91
+
92
+ if attributes.key?(:'comment')
93
+ self.comment = attributes[:'comment']
94
+ end
95
+
96
+ if attributes.key?(:'json')
97
+ self.json = attributes[:'json']
98
+ end
99
+
100
+ if attributes.key?(:'name')
101
+ self.name = attributes[:'name']
102
+ end
103
+
104
+ if attributes.key?(:'token')
105
+ self.token = attributes[:'token']
106
+ end
107
+
108
+ if attributes.key?(:'uid_token')
109
+ self.uid_token = attributes[:'uid_token']
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ invalid_properties = Array.new
117
+ if @capability.nil?
118
+ invalid_properties.push('invalid value for "capability", capability cannot be nil.')
119
+ end
120
+
121
+ if @name.nil?
122
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
123
+ end
124
+
125
+ invalid_properties
126
+ end
127
+
128
+ # Check to see if the all the properties in the model are valid
129
+ # @return true if the model is valid
130
+ def valid?
131
+ return false if @capability.nil?
132
+ return false if @name.nil?
133
+ true
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ capability == o.capability &&
142
+ comment == o.comment &&
143
+ json == o.json &&
144
+ name == o.name &&
145
+ token == o.token &&
146
+ uid_token == o.uid_token
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [capability, comment, json, name, token, uid_token].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ new.build_from_hash(attributes)
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ attributes = attributes.transform_keys(&:to_sym)
174
+ self.class.openapi_types.each_pair do |key, type|
175
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
176
+ self.send("#{key}=", nil)
177
+ elsif type =~ /\AArray<(.*)>/i
178
+ # check to ensure the input is an array given that the attribute
179
+ # is documented as an array but the input is not
180
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
181
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
182
+ end
183
+ elsif !attributes[self.class.attribute_map[key]].nil?
184
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
185
+ end
186
+ end
187
+
188
+ self
189
+ end
190
+
191
+ # Deserializes the data based on type
192
+ # @param string type Data type
193
+ # @param string value Value to be deserialized
194
+ # @return [Object] Deserialized data
195
+ def _deserialize(type, value)
196
+ case type.to_sym
197
+ when :Time
198
+ Time.parse(value)
199
+ when :Date
200
+ Date.parse(value)
201
+ when :String
202
+ value.to_s
203
+ when :Integer
204
+ value.to_i
205
+ when :Float
206
+ value.to_f
207
+ when :Boolean
208
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
+ true
210
+ else
211
+ false
212
+ end
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ else # model
228
+ # models (e.g. Pet) or oneOf
229
+ klass = Akeyless.const_get(type)
230
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
231
+ end
232
+ end
233
+
234
+ # Returns the string representation of the object
235
+ # @return [String] String presentation of the object
236
+ def to_s
237
+ to_hash.to_s
238
+ end
239
+
240
+ # to_body is an alias to to_hash (backward compatibility)
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_body
243
+ to_hash
244
+ end
245
+
246
+ # Returns the object in the form of hash
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_hash
249
+ hash = {}
250
+ self.class.attribute_map.each_pair do |attr, param|
251
+ value = self.send(attr)
252
+ if value.nil?
253
+ is_nullable = self.class.openapi_nullable.include?(attr)
254
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
255
+ end
256
+
257
+ hash[param] = _to_hash(value)
258
+ end
259
+ hash
260
+ end
261
+
262
+ # Outputs non-array value in the form of hash
263
+ # For object, use to_hash. Otherwise, just return the value
264
+ # @param [Object] value Any valid value
265
+ # @return [Hash] Returns the value in the form of hash
266
+ def _to_hash(value)
267
+ if value.is_a?(Array)
268
+ value.compact.map { |v| _to_hash(v) }
269
+ elsif value.is_a?(Hash)
270
+ {}.tap do |hash|
271
+ value.each { |k, v| hash[k] = _to_hash(v) }
272
+ end
273
+ elsif value.respond_to? :to_hash
274
+ value.to_hash
275
+ else
276
+ value
277
+ end
278
+ end
279
+
280
+ end
281
+
282
+ end