akeyless 3.0.1 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +36 -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/CreateCertificate.md +38 -0
  9. data/docs/CreateCertificateOutput.md +18 -0
  10. data/docs/CreateEventForwarder.md +48 -0
  11. data/docs/CreateEventForwarderOutput.md +18 -0
  12. data/docs/CreateRotatedSecret.md +2 -0
  13. data/docs/DeleteEventForwarder.md +24 -0
  14. data/docs/EmailEntry.md +20 -0
  15. data/docs/Extension.md +22 -0
  16. data/docs/GatewayUpdateItem.md +2 -0
  17. data/docs/GatewayUpdateTlsCert.md +26 -0
  18. data/docs/GatewayUpdateTlsCertOutput.md +18 -0
  19. data/docs/GetCertificateValue.md +26 -0
  20. data/docs/GetCertificateValueOutput.md +20 -0
  21. data/docs/GetEventForwarder.md +24 -0
  22. data/docs/GetEventForwarderOutput.md +18 -0
  23. data/docs/Item.md +4 -0
  24. data/docs/ItemGeneralInfo.md +2 -0
  25. data/docs/ListSRABastions.md +2 -0
  26. data/docs/ListSharedItems.md +24 -0
  27. data/docs/Name.md +28 -0
  28. data/docs/NotiForwarder.md +56 -0
  29. data/docs/RequestAccess.md +28 -0
  30. data/docs/RequestAccessOutput.md +18 -0
  31. data/docs/RotateKey.md +2 -0
  32. data/docs/Target.md +4 -0
  33. data/docs/UpdateCertificateOutput.md +18 -0
  34. data/docs/UpdateCertificateValue.md +32 -0
  35. data/docs/UpdateEventForwarder.md +40 -0
  36. data/docs/UpdateRotatedSecret.md +2 -0
  37. data/docs/V2Api.md +631 -65
  38. data/lib/akeyless/api/v2_api.rb +664 -88
  39. data/lib/akeyless/api_error.rb +1 -0
  40. data/lib/akeyless/configuration.rb +11 -0
  41. data/lib/akeyless/models/attribute_type_and_value.rb +231 -0
  42. data/lib/akeyless/models/certificate_chain_info.rb +241 -0
  43. data/lib/akeyless/models/certificate_expiration_event.rb +219 -0
  44. data/lib/akeyless/models/certificate_info.rb +434 -0
  45. data/lib/akeyless/models/connect.rb +11 -1
  46. data/lib/akeyless/models/create_certificate.rb +329 -0
  47. data/lib/akeyless/models/create_certificate_output.rb +219 -0
  48. data/lib/akeyless/models/create_event_forwarder.rb +394 -0
  49. data/lib/akeyless/models/create_event_forwarder_output.rb +219 -0
  50. data/lib/akeyless/models/create_rotated_secret.rb +11 -1
  51. data/lib/akeyless/models/delete_event_forwarder.rb +255 -0
  52. data/lib/akeyless/models/email_entry.rb +228 -0
  53. data/lib/akeyless/models/extension.rb +237 -0
  54. data/lib/akeyless/models/gateway_update_item.rb +11 -1
  55. data/lib/akeyless/models/gateway_update_tls_cert.rb +261 -0
  56. data/lib/akeyless/models/gateway_update_tls_cert_output.rb +219 -0
  57. data/lib/akeyless/models/get_certificate_value.rb +265 -0
  58. data/lib/akeyless/models/get_certificate_value_output.rb +228 -0
  59. data/lib/akeyless/models/get_event_forwarder.rb +255 -0
  60. data/lib/akeyless/models/get_event_forwarder_output.rb +219 -0
  61. data/lib/akeyless/models/item.rb +19 -1
  62. data/lib/akeyless/models/item_general_info.rb +10 -1
  63. data/lib/akeyless/models/list_shared_items.rb +253 -0
  64. data/lib/akeyless/models/list_sra_bastions.rb +10 -1
  65. data/lib/akeyless/models/name.rb +277 -0
  66. data/lib/akeyless/models/noti_forwarder.rb +400 -0
  67. data/lib/akeyless/models/request_access.rb +282 -0
  68. data/lib/akeyless/models/request_access_output.rb +219 -0
  69. data/lib/akeyless/models/rotate_key.rb +11 -1
  70. data/lib/akeyless/models/target.rb +19 -1
  71. data/lib/akeyless/models/update_certificate_output.rb +219 -0
  72. data/lib/akeyless/models/update_certificate_value.rb +297 -0
  73. data/lib/akeyless/models/update_event_forwarder.rb +341 -0
  74. data/lib/akeyless/models/update_rotated_secret.rb +11 -1
  75. data/lib/akeyless/version.rb +1 -1
  76. data/lib/akeyless.rb +25 -1
  77. data/spec/models/attribute_type_and_value_spec.rb +40 -0
  78. data/spec/models/certificate_chain_info_spec.rb +46 -0
  79. data/spec/models/certificate_expiration_event_spec.rb +34 -0
  80. data/spec/models/certificate_info_spec.rb +166 -0
  81. data/spec/models/create_certificate_output_spec.rb +34 -0
  82. data/spec/models/create_certificate_spec.rb +94 -0
  83. data/spec/models/create_event_forwarder_output_spec.rb +34 -0
  84. data/spec/models/create_event_forwarder_spec.rb +124 -0
  85. data/spec/models/delete_event_forwarder_spec.rb +52 -0
  86. data/spec/models/email_entry_spec.rb +40 -0
  87. data/spec/models/extension_spec.rb +46 -0
  88. data/spec/models/gateway_update_tls_cert_output_spec.rb +34 -0
  89. data/spec/models/gateway_update_tls_cert_spec.rb +58 -0
  90. data/spec/models/get_certificate_value_output_spec.rb +40 -0
  91. data/spec/models/get_certificate_value_spec.rb +58 -0
  92. data/spec/models/get_event_forwarder_output_spec.rb +34 -0
  93. data/spec/models/get_event_forwarder_spec.rb +52 -0
  94. data/spec/models/list_shared_items_spec.rb +52 -0
  95. data/spec/models/name_spec.rb +64 -0
  96. data/spec/models/noti_forwarder_spec.rb +148 -0
  97. data/spec/models/request_access_output_spec.rb +34 -0
  98. data/spec/models/request_access_spec.rb +64 -0
  99. data/spec/models/update_certificate_output_spec.rb +34 -0
  100. data/spec/models/update_certificate_value_spec.rb +76 -0
  101. data/spec/models/update_event_forwarder_spec.rb +100 -0
  102. metadata +630 -530
@@ -0,0 +1,253 @@
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
+ # listSharedItems is a command to list all the items been shared
18
+ class ListSharedItems
19
+ # for personal password manager
20
+ attr_accessor :accessibility
21
+
22
+ # Set output format to JSON
23
+ attr_accessor :json
24
+
25
+ # Authentication token (see `/auth` and `/configure`)
26
+ attr_accessor :token
27
+
28
+ # The universal identity token, Required only for universal_identity authentication
29
+ attr_accessor :uid_token
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'accessibility' => :'accessibility',
35
+ :'json' => :'json',
36
+ :'token' => :'token',
37
+ :'uid_token' => :'uid-token'
38
+ }
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'accessibility' => :'String',
50
+ :'json' => :'Boolean',
51
+ :'token' => :'String',
52
+ :'uid_token' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::ListSharedItems` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::ListSharedItems`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'accessibility')
78
+ self.accessibility = attributes[:'accessibility']
79
+ else
80
+ self.accessibility = 'regular'
81
+ end
82
+
83
+ if attributes.key?(:'json')
84
+ self.json = attributes[:'json']
85
+ end
86
+
87
+ if attributes.key?(:'token')
88
+ self.token = attributes[:'token']
89
+ end
90
+
91
+ if attributes.key?(:'uid_token')
92
+ self.uid_token = attributes[:'uid_token']
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ invalid_properties = Array.new
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ accessibility == o.accessibility &&
115
+ json == o.json &&
116
+ token == o.token &&
117
+ uid_token == o.uid_token
118
+ end
119
+
120
+ # @see the `==` method
121
+ # @param [Object] Object to be compared
122
+ def eql?(o)
123
+ self == o
124
+ end
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Integer] Hash code
128
+ def hash
129
+ [accessibility, json, token, uid_token].hash
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 self.build_from_hash(attributes)
136
+ new.build_from_hash(attributes)
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def build_from_hash(attributes)
143
+ return nil unless attributes.is_a?(Hash)
144
+ attributes = attributes.transform_keys(&:to_sym)
145
+ self.class.openapi_types.each_pair do |key, type|
146
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
+ self.send("#{key}=", nil)
148
+ elsif type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :Time
169
+ Time.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :Boolean
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ # models (e.g. Pet) or oneOf
200
+ klass = Akeyless.const_get(type)
201
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+
253
+ end
@@ -15,6 +15,8 @@ require 'time'
15
15
 
16
16
  module Akeyless
17
17
  class ListSRABastions
18
+ attr_accessor :allowed_urls_only
19
+
18
20
  # Set output format to JSON
19
21
  attr_accessor :json
20
22
 
@@ -27,6 +29,7 @@ module Akeyless
27
29
  # Attribute mapping from ruby-style variable name to JSON key.
28
30
  def self.attribute_map
29
31
  {
32
+ :'allowed_urls_only' => :'allowed-urls-only',
30
33
  :'json' => :'json',
31
34
  :'token' => :'token',
32
35
  :'uid_token' => :'uid-token'
@@ -41,6 +44,7 @@ module Akeyless
41
44
  # Attribute type mapping.
42
45
  def self.openapi_types
43
46
  {
47
+ :'allowed_urls_only' => :'Boolean',
44
48
  :'json' => :'Boolean',
45
49
  :'token' => :'String',
46
50
  :'uid_token' => :'String'
@@ -68,6 +72,10 @@ module Akeyless
68
72
  h[k.to_sym] = v
69
73
  }
70
74
 
75
+ if attributes.key?(:'allowed_urls_only')
76
+ self.allowed_urls_only = attributes[:'allowed_urls_only']
77
+ end
78
+
71
79
  if attributes.key?(:'json')
72
80
  self.json = attributes[:'json']
73
81
  end
@@ -99,6 +107,7 @@ module Akeyless
99
107
  def ==(o)
100
108
  return true if self.equal?(o)
101
109
  self.class == o.class &&
110
+ allowed_urls_only == o.allowed_urls_only &&
102
111
  json == o.json &&
103
112
  token == o.token &&
104
113
  uid_token == o.uid_token
@@ -113,7 +122,7 @@ module Akeyless
113
122
  # Calculates hash code according to all attributes.
114
123
  # @return [Integer] Hash code
115
124
  def hash
116
- [json, token, uid_token].hash
125
+ [allowed_urls_only, json, token, uid_token].hash
117
126
  end
118
127
 
119
128
  # Builds the object from hash
@@ -0,0 +1,277 @@
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
+ # Name represents an X.509 distinguished name. This only includes the common elements of a DN. Note that Name is only an approximation of the X.509 structure. If an accurate representation is needed, asn1.Unmarshal the raw subject or issuer as an RDNSequence.
18
+ class Name
19
+ attr_accessor :country
20
+
21
+ # ExtraNames contains attributes to be copied, raw, into any marshaled distinguished names. Values override any attributes with the same OID. The ExtraNames field is not populated when parsing, see Names.
22
+ attr_accessor :extra_names
23
+
24
+ attr_accessor :locality
25
+
26
+ # Names contains all parsed attributes. When parsing distinguished names, this can be used to extract non-standard attributes that are not parsed by this package. When marshaling to RDNSequences, the Names field is ignored, see ExtraNames.
27
+ attr_accessor :names
28
+
29
+ attr_accessor :serial_number
30
+
31
+ attr_accessor :street_address
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'country' => :'Country',
37
+ :'extra_names' => :'ExtraNames',
38
+ :'locality' => :'Locality',
39
+ :'names' => :'Names',
40
+ :'serial_number' => :'SerialNumber',
41
+ :'street_address' => :'StreetAddress'
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'country' => :'Array<String>',
54
+ :'extra_names' => :'Array<AttributeTypeAndValue>',
55
+ :'locality' => :'Array<String>',
56
+ :'names' => :'Array<AttributeTypeAndValue>',
57
+ :'serial_number' => :'String',
58
+ :'street_address' => :'Array<String>'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.openapi_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::Name` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::Name`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'country')
84
+ if (value = attributes[:'country']).is_a?(Array)
85
+ self.country = value
86
+ end
87
+ end
88
+
89
+ if attributes.key?(:'extra_names')
90
+ if (value = attributes[:'extra_names']).is_a?(Array)
91
+ self.extra_names = value
92
+ end
93
+ end
94
+
95
+ if attributes.key?(:'locality')
96
+ if (value = attributes[:'locality']).is_a?(Array)
97
+ self.locality = value
98
+ end
99
+ end
100
+
101
+ if attributes.key?(:'names')
102
+ if (value = attributes[:'names']).is_a?(Array)
103
+ self.names = value
104
+ end
105
+ end
106
+
107
+ if attributes.key?(:'serial_number')
108
+ self.serial_number = attributes[:'serial_number']
109
+ end
110
+
111
+ if attributes.key?(:'street_address')
112
+ if (value = attributes[:'street_address']).is_a?(Array)
113
+ self.street_address = value
114
+ end
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ invalid_properties = Array.new
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ true
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ country == o.country &&
137
+ extra_names == o.extra_names &&
138
+ locality == o.locality &&
139
+ names == o.names &&
140
+ serial_number == o.serial_number &&
141
+ street_address == o.street_address
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [country, extra_names, locality, names, serial_number, street_address].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ attributes = attributes.transform_keys(&:to_sym)
169
+ self.class.openapi_types.each_pair do |key, type|
170
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
171
+ self.send("#{key}=", nil)
172
+ elsif type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
177
+ end
178
+ elsif !attributes[self.class.attribute_map[key]].nil?
179
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
+ end
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :Time
193
+ Time.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :Boolean
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ # models (e.g. Pet) or oneOf
224
+ klass = Akeyless.const_get(type)
225
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
226
+ end
227
+ end
228
+
229
+ # Returns the string representation of the object
230
+ # @return [String] String presentation of the object
231
+ def to_s
232
+ to_hash.to_s
233
+ end
234
+
235
+ # to_body is an alias to to_hash (backward compatibility)
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_body
238
+ to_hash
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ self.class.attribute_map.each_pair do |attr, param|
246
+ value = self.send(attr)
247
+ if value.nil?
248
+ is_nullable = self.class.openapi_nullable.include?(attr)
249
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
250
+ end
251
+
252
+ hash[param] = _to_hash(value)
253
+ end
254
+ hash
255
+ end
256
+
257
+ # Outputs non-array value in the form of hash
258
+ # For object, use to_hash. Otherwise, just return the value
259
+ # @param [Object] value Any valid value
260
+ # @return [Hash] Returns the value in the form of hash
261
+ def _to_hash(value)
262
+ if value.is_a?(Array)
263
+ value.compact.map { |v| _to_hash(v) }
264
+ elsif value.is_a?(Hash)
265
+ {}.tap do |hash|
266
+ value.each { |k, v| hash[k] = _to_hash(v) }
267
+ end
268
+ elsif value.respond_to? :to_hash
269
+ value.to_hash
270
+ else
271
+ value
272
+ end
273
+ end
274
+
275
+ end
276
+
277
+ end