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,219 @@
1
+ =begin
2
+ #Akeyless API
3
+
4
+ #The purpose of this application is to provide access to Akeyless API.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: support@akeyless.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ class RequestAccessOutput
18
+ attr_accessor :response
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'response' => :'response'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'response' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::RequestAccessOutput` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::RequestAccessOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'response')
61
+ self.response = attributes[:'response']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ response == o.response
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [response].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ attributes = attributes.transform_keys(&:to_sym)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
+ self.send("#{key}=", nil)
114
+ elsif type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :Time
135
+ Time.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ # models (e.g. Pet) or oneOf
166
+ klass = Akeyless.const_get(type)
167
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -22,6 +22,9 @@ module Akeyless
22
22
  # Key name
23
23
  attr_accessor :name
24
24
 
25
+ # The new pem encoded certificate for the classic key. relevant only for keys provided by user ('bring-your-own-key')
26
+ attr_accessor :new_cert_pem_data
27
+
25
28
  # The new base64 encoded value for the classic key. relevant only for keys provided by user ('bring-your-own-key')
26
29
  attr_accessor :new_key_data
27
30
 
@@ -36,6 +39,7 @@ module Akeyless
36
39
  {
37
40
  :'json' => :'json',
38
41
  :'name' => :'name',
42
+ :'new_cert_pem_data' => :'new-cert-pem-data',
39
43
  :'new_key_data' => :'new-key-data',
40
44
  :'token' => :'token',
41
45
  :'uid_token' => :'uid-token'
@@ -52,6 +56,7 @@ module Akeyless
52
56
  {
53
57
  :'json' => :'Boolean',
54
58
  :'name' => :'String',
59
+ :'new_cert_pem_data' => :'String',
55
60
  :'new_key_data' => :'String',
56
61
  :'token' => :'String',
57
62
  :'uid_token' => :'String'
@@ -87,6 +92,10 @@ module Akeyless
87
92
  self.name = attributes[:'name']
88
93
  end
89
94
 
95
+ if attributes.key?(:'new_cert_pem_data')
96
+ self.new_cert_pem_data = attributes[:'new_cert_pem_data']
97
+ end
98
+
90
99
  if attributes.key?(:'new_key_data')
91
100
  self.new_key_data = attributes[:'new_key_data']
92
101
  end
@@ -125,6 +134,7 @@ module Akeyless
125
134
  self.class == o.class &&
126
135
  json == o.json &&
127
136
  name == o.name &&
137
+ new_cert_pem_data == o.new_cert_pem_data &&
128
138
  new_key_data == o.new_key_data &&
129
139
  token == o.token &&
130
140
  uid_token == o.uid_token
@@ -139,7 +149,7 @@ module Akeyless
139
149
  # Calculates hash code according to all attributes.
140
150
  # @return [Integer] Hash code
141
151
  def hash
142
- [json, name, new_key_data, token, uid_token].hash
152
+ [json, name, new_cert_pem_data, new_key_data, token, uid_token].hash
143
153
  end
144
154
 
145
155
  # Builds the object from hash
@@ -17,6 +17,8 @@ module Akeyless
17
17
  class Target
18
18
  attr_accessor :access_date
19
19
 
20
+ attr_accessor :access_request_status
21
+
20
22
  # this is not \"omitempty\" since an empty value causes no update while an empty map will clear the attributes
21
23
  attr_accessor :attributes
22
24
 
@@ -28,6 +30,8 @@ module Akeyless
28
30
 
29
31
  attr_accessor :credentials_less
30
32
 
33
+ attr_accessor :is_access_request_enabled
34
+
31
35
  attr_accessor :last_version
32
36
 
33
37
  attr_accessor :modification_date
@@ -50,11 +54,13 @@ module Akeyless
50
54
  def self.attribute_map
51
55
  {
52
56
  :'access_date' => :'access_date',
57
+ :'access_request_status' => :'access_request_status',
53
58
  :'attributes' => :'attributes',
54
59
  :'client_permissions' => :'client_permissions',
55
60
  :'comment' => :'comment',
56
61
  :'creation_date' => :'creation_date',
57
62
  :'credentials_less' => :'credentials_less',
63
+ :'is_access_request_enabled' => :'is_access_request_enabled',
58
64
  :'last_version' => :'last_version',
59
65
  :'modification_date' => :'modification_date',
60
66
  :'protection_key_name' => :'protection_key_name',
@@ -76,11 +82,13 @@ module Akeyless
76
82
  def self.openapi_types
77
83
  {
78
84
  :'access_date' => :'Time',
85
+ :'access_request_status' => :'String',
79
86
  :'attributes' => :'Hash<String, Object>',
80
87
  :'client_permissions' => :'Array<String>',
81
88
  :'comment' => :'String',
82
89
  :'creation_date' => :'Time',
83
90
  :'credentials_less' => :'Boolean',
91
+ :'is_access_request_enabled' => :'Boolean',
84
92
  :'last_version' => :'Integer',
85
93
  :'modification_date' => :'Time',
86
94
  :'protection_key_name' => :'String',
@@ -118,6 +126,10 @@ module Akeyless
118
126
  self.access_date = attributes[:'access_date']
119
127
  end
120
128
 
129
+ if attributes.key?(:'access_request_status')
130
+ self.access_request_status = attributes[:'access_request_status']
131
+ end
132
+
121
133
  if attributes.key?(:'attributes')
122
134
  if (value = attributes[:'attributes']).is_a?(Hash)
123
135
  self.attributes = value
@@ -142,6 +154,10 @@ module Akeyless
142
154
  self.credentials_less = attributes[:'credentials_less']
143
155
  end
144
156
 
157
+ if attributes.key?(:'is_access_request_enabled')
158
+ self.is_access_request_enabled = attributes[:'is_access_request_enabled']
159
+ end
160
+
145
161
  if attributes.key?(:'last_version')
146
162
  self.last_version = attributes[:'last_version']
147
163
  end
@@ -202,11 +218,13 @@ module Akeyless
202
218
  return true if self.equal?(o)
203
219
  self.class == o.class &&
204
220
  access_date == o.access_date &&
221
+ access_request_status == o.access_request_status &&
205
222
  attributes == o.attributes &&
206
223
  client_permissions == o.client_permissions &&
207
224
  comment == o.comment &&
208
225
  creation_date == o.creation_date &&
209
226
  credentials_less == o.credentials_less &&
227
+ is_access_request_enabled == o.is_access_request_enabled &&
210
228
  last_version == o.last_version &&
211
229
  modification_date == o.modification_date &&
212
230
  protection_key_name == o.protection_key_name &&
@@ -227,7 +245,7 @@ module Akeyless
227
245
  # Calculates hash code according to all attributes.
228
246
  # @return [Integer] Hash code
229
247
  def hash
230
- [access_date, attributes, client_permissions, comment, creation_date, credentials_less, last_version, modification_date, protection_key_name, target_id, target_items_assoc, target_name, target_type, target_versions, with_customer_fragment].hash
248
+ [access_date, access_request_status, attributes, client_permissions, comment, creation_date, credentials_less, is_access_request_enabled, last_version, modification_date, protection_key_name, target_id, target_items_assoc, target_name, target_type, target_versions, with_customer_fragment].hash
231
249
  end
232
250
 
233
251
  # Builds the object from hash
@@ -0,0 +1,219 @@
1
+ =begin
2
+ #Akeyless API
3
+
4
+ #The purpose of this application is to provide access to Akeyless API.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: support@akeyless.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ class UpdateCertificateOutput
18
+ attr_accessor :name
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'name' => :'name'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'name' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::UpdateCertificateOutput` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::UpdateCertificateOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'name')
61
+ self.name = attributes[:'name']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ name == o.name
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [name].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ attributes = attributes.transform_keys(&:to_sym)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
+ self.send("#{key}=", nil)
114
+ elsif type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :Time
135
+ Time.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ # models (e.g. Pet) or oneOf
166
+ klass = Akeyless.const_get(type)
167
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end