akeyless 3.1.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -1
  3. data/docs/CreatePingTarget.md +38 -0
  4. data/docs/CreatePingTargetOutput.md +18 -0
  5. data/docs/CreateRotatedSecret.md +2 -0
  6. data/docs/DSProducerDetails.md +40 -0
  7. data/docs/GatewayCreateProducerPing.md +66 -0
  8. data/docs/GatewayCreateProducerPingOutput.md +18 -0
  9. data/docs/GatewayUpdateProducerPing.md +68 -0
  10. data/docs/GatewayUpdateProducerPingOutput.md +18 -0
  11. data/docs/GetKubeExecCreds.md +5 -3
  12. data/docs/GetPKICertificate.md +5 -3
  13. data/docs/SecureRemoteAccess.md +2 -0
  14. data/docs/TargetTypeDetailsInput.md +10 -0
  15. data/docs/UpdatePingTarget.md +44 -0
  16. data/docs/UpdateRotatedSecret.md +2 -0
  17. data/docs/V2Api.md +252 -0
  18. data/lib/akeyless/api/v2_api.rb +256 -0
  19. data/lib/akeyless/models/create_ping_target.rb +329 -0
  20. data/lib/akeyless/models/create_ping_target_output.rb +219 -0
  21. data/lib/akeyless/models/create_rotated_secret.rb +13 -1
  22. data/lib/akeyless/models/ds_producer_details.rb +196 -1
  23. data/lib/akeyless/models/gateway_create_producer_ping.rb +482 -0
  24. data/lib/akeyless/models/gateway_create_producer_ping_output.rb +219 -0
  25. data/lib/akeyless/models/gateway_update_producer_ping.rb +492 -0
  26. data/lib/akeyless/models/gateway_update_producer_ping_output.rb +219 -0
  27. data/lib/akeyless/models/get_kube_exec_creds.rb +14 -4
  28. data/lib/akeyless/models/get_pki_certificate.rb +14 -4
  29. data/lib/akeyless/models/secure_remote_access.rb +10 -1
  30. data/lib/akeyless/models/target_type_details_input.rb +46 -1
  31. data/lib/akeyless/models/update_ping_target.rb +358 -0
  32. data/lib/akeyless/models/update_rotated_secret.rb +13 -1
  33. data/lib/akeyless/version.rb +1 -1
  34. data/lib/akeyless.rb +7 -0
  35. data/spec/models/create_ping_target_output_spec.rb +34 -0
  36. data/spec/models/create_ping_target_spec.rb +94 -0
  37. data/spec/models/gateway_create_producer_ping_output_spec.rb +34 -0
  38. data/spec/models/gateway_create_producer_ping_spec.rb +178 -0
  39. data/spec/models/gateway_update_producer_ping_output_spec.rb +34 -0
  40. data/spec/models/gateway_update_producer_ping_spec.rb +184 -0
  41. data/spec/models/update_ping_target_spec.rb +112 -0
  42. metadata +590 -562
@@ -2131,6 +2131,70 @@ module Akeyless
2131
2131
  return data, status_code, headers
2132
2132
  end
2133
2133
 
2134
+ # @param body [CreatePingTarget]
2135
+ # @param [Hash] opts the optional parameters
2136
+ # @return [CreatePingTargetOutput]
2137
+ def create_ping_target(body, opts = {})
2138
+ data, _status_code, _headers = create_ping_target_with_http_info(body, opts)
2139
+ data
2140
+ end
2141
+
2142
+ # @param body [CreatePingTarget]
2143
+ # @param [Hash] opts the optional parameters
2144
+ # @return [Array<(CreatePingTargetOutput, Integer, Hash)>] CreatePingTargetOutput data, response status code and response headers
2145
+ def create_ping_target_with_http_info(body, opts = {})
2146
+ if @api_client.config.debugging
2147
+ @api_client.config.logger.debug 'Calling API: V2Api.create_ping_target ...'
2148
+ end
2149
+ # verify the required parameter 'body' is set
2150
+ if @api_client.config.client_side_validation && body.nil?
2151
+ fail ArgumentError, "Missing the required parameter 'body' when calling V2Api.create_ping_target"
2152
+ end
2153
+ # resource path
2154
+ local_var_path = '/create-ping-target'
2155
+
2156
+ # query parameters
2157
+ query_params = opts[:query_params] || {}
2158
+
2159
+ # header parameters
2160
+ header_params = opts[:header_params] || {}
2161
+ # HTTP header 'Accept' (if needed)
2162
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2163
+ # HTTP header 'Content-Type'
2164
+ content_type = @api_client.select_header_content_type(['application/json'])
2165
+ if !content_type.nil?
2166
+ header_params['Content-Type'] = content_type
2167
+ end
2168
+
2169
+ # form parameters
2170
+ form_params = opts[:form_params] || {}
2171
+
2172
+ # http body (model)
2173
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
2174
+
2175
+ # return_type
2176
+ return_type = opts[:debug_return_type] || 'CreatePingTargetOutput'
2177
+
2178
+ # auth_names
2179
+ auth_names = opts[:debug_auth_names] || []
2180
+
2181
+ new_options = opts.merge(
2182
+ :operation => :"V2Api.create_ping_target",
2183
+ :header_params => header_params,
2184
+ :query_params => query_params,
2185
+ :form_params => form_params,
2186
+ :body => post_body,
2187
+ :auth_names => auth_names,
2188
+ :return_type => return_type
2189
+ )
2190
+
2191
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
2192
+ if @api_client.config.debugging
2193
+ @api_client.config.logger.debug "API called: V2Api#create_ping_target\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2194
+ end
2195
+ return data, status_code, headers
2196
+ end
2197
+
2134
2198
  # @param body [CreatePKICertIssuer]
2135
2199
  # @param [Hash] opts the optional parameters
2136
2200
  # @return [CreatePKICertIssuerOutput]
@@ -5647,6 +5711,70 @@ module Akeyless
5647
5711
  return data, status_code, headers
5648
5712
  end
5649
5713
 
5714
+ # @param body [GatewayCreateProducerPing]
5715
+ # @param [Hash] opts the optional parameters
5716
+ # @return [GatewayCreateProducerPingOutput]
5717
+ def gateway_create_producer_ping(body, opts = {})
5718
+ data, _status_code, _headers = gateway_create_producer_ping_with_http_info(body, opts)
5719
+ data
5720
+ end
5721
+
5722
+ # @param body [GatewayCreateProducerPing]
5723
+ # @param [Hash] opts the optional parameters
5724
+ # @return [Array<(GatewayCreateProducerPingOutput, Integer, Hash)>] GatewayCreateProducerPingOutput data, response status code and response headers
5725
+ def gateway_create_producer_ping_with_http_info(body, opts = {})
5726
+ if @api_client.config.debugging
5727
+ @api_client.config.logger.debug 'Calling API: V2Api.gateway_create_producer_ping ...'
5728
+ end
5729
+ # verify the required parameter 'body' is set
5730
+ if @api_client.config.client_side_validation && body.nil?
5731
+ fail ArgumentError, "Missing the required parameter 'body' when calling V2Api.gateway_create_producer_ping"
5732
+ end
5733
+ # resource path
5734
+ local_var_path = '/gateway-create-producer-ping'
5735
+
5736
+ # query parameters
5737
+ query_params = opts[:query_params] || {}
5738
+
5739
+ # header parameters
5740
+ header_params = opts[:header_params] || {}
5741
+ # HTTP header 'Accept' (if needed)
5742
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
5743
+ # HTTP header 'Content-Type'
5744
+ content_type = @api_client.select_header_content_type(['application/json'])
5745
+ if !content_type.nil?
5746
+ header_params['Content-Type'] = content_type
5747
+ end
5748
+
5749
+ # form parameters
5750
+ form_params = opts[:form_params] || {}
5751
+
5752
+ # http body (model)
5753
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
5754
+
5755
+ # return_type
5756
+ return_type = opts[:debug_return_type] || 'GatewayCreateProducerPingOutput'
5757
+
5758
+ # auth_names
5759
+ auth_names = opts[:debug_auth_names] || []
5760
+
5761
+ new_options = opts.merge(
5762
+ :operation => :"V2Api.gateway_create_producer_ping",
5763
+ :header_params => header_params,
5764
+ :query_params => query_params,
5765
+ :form_params => form_params,
5766
+ :body => post_body,
5767
+ :auth_names => auth_names,
5768
+ :return_type => return_type
5769
+ )
5770
+
5771
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
5772
+ if @api_client.config.debugging
5773
+ @api_client.config.logger.debug "API called: V2Api#gateway_create_producer_ping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
5774
+ end
5775
+ return data, status_code, headers
5776
+ end
5777
+
5650
5778
  # @param body [GatewayCreateProducerPostgreSQL]
5651
5779
  # @param [Hash] opts the optional parameters
5652
5780
  # @return [GatewayCreateProducerPostgreSQLOutput]
@@ -8583,6 +8711,70 @@ module Akeyless
8583
8711
  return data, status_code, headers
8584
8712
  end
8585
8713
 
8714
+ # @param body [GatewayUpdateProducerPing]
8715
+ # @param [Hash] opts the optional parameters
8716
+ # @return [GatewayUpdateProducerPingOutput]
8717
+ def gateway_update_producer_ping(body, opts = {})
8718
+ data, _status_code, _headers = gateway_update_producer_ping_with_http_info(body, opts)
8719
+ data
8720
+ end
8721
+
8722
+ # @param body [GatewayUpdateProducerPing]
8723
+ # @param [Hash] opts the optional parameters
8724
+ # @return [Array<(GatewayUpdateProducerPingOutput, Integer, Hash)>] GatewayUpdateProducerPingOutput data, response status code and response headers
8725
+ def gateway_update_producer_ping_with_http_info(body, opts = {})
8726
+ if @api_client.config.debugging
8727
+ @api_client.config.logger.debug 'Calling API: V2Api.gateway_update_producer_ping ...'
8728
+ end
8729
+ # verify the required parameter 'body' is set
8730
+ if @api_client.config.client_side_validation && body.nil?
8731
+ fail ArgumentError, "Missing the required parameter 'body' when calling V2Api.gateway_update_producer_ping"
8732
+ end
8733
+ # resource path
8734
+ local_var_path = '/gateway-update-producer-ping'
8735
+
8736
+ # query parameters
8737
+ query_params = opts[:query_params] || {}
8738
+
8739
+ # header parameters
8740
+ header_params = opts[:header_params] || {}
8741
+ # HTTP header 'Accept' (if needed)
8742
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
8743
+ # HTTP header 'Content-Type'
8744
+ content_type = @api_client.select_header_content_type(['application/json'])
8745
+ if !content_type.nil?
8746
+ header_params['Content-Type'] = content_type
8747
+ end
8748
+
8749
+ # form parameters
8750
+ form_params = opts[:form_params] || {}
8751
+
8752
+ # http body (model)
8753
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
8754
+
8755
+ # return_type
8756
+ return_type = opts[:debug_return_type] || 'GatewayUpdateProducerPingOutput'
8757
+
8758
+ # auth_names
8759
+ auth_names = opts[:debug_auth_names] || []
8760
+
8761
+ new_options = opts.merge(
8762
+ :operation => :"V2Api.gateway_update_producer_ping",
8763
+ :header_params => header_params,
8764
+ :query_params => query_params,
8765
+ :form_params => form_params,
8766
+ :body => post_body,
8767
+ :auth_names => auth_names,
8768
+ :return_type => return_type
8769
+ )
8770
+
8771
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
8772
+ if @api_client.config.debugging
8773
+ @api_client.config.logger.debug "API called: V2Api#gateway_update_producer_ping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
8774
+ end
8775
+ return data, status_code, headers
8776
+ end
8777
+
8586
8778
  # @param body [GatewayUpdateProducerPostgreSQL]
8587
8779
  # @param [Hash] opts the optional parameters
8588
8780
  # @return [GatewayUpdateProducerPostgreSQLOutput]
@@ -14649,6 +14841,70 @@ module Akeyless
14649
14841
  return data, status_code, headers
14650
14842
  end
14651
14843
 
14844
+ # @param body [UpdatePingTarget]
14845
+ # @param [Hash] opts the optional parameters
14846
+ # @return [Object]
14847
+ def update_ping_target(body, opts = {})
14848
+ data, _status_code, _headers = update_ping_target_with_http_info(body, opts)
14849
+ data
14850
+ end
14851
+
14852
+ # @param body [UpdatePingTarget]
14853
+ # @param [Hash] opts the optional parameters
14854
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
14855
+ def update_ping_target_with_http_info(body, opts = {})
14856
+ if @api_client.config.debugging
14857
+ @api_client.config.logger.debug 'Calling API: V2Api.update_ping_target ...'
14858
+ end
14859
+ # verify the required parameter 'body' is set
14860
+ if @api_client.config.client_side_validation && body.nil?
14861
+ fail ArgumentError, "Missing the required parameter 'body' when calling V2Api.update_ping_target"
14862
+ end
14863
+ # resource path
14864
+ local_var_path = '/update-ping-target'
14865
+
14866
+ # query parameters
14867
+ query_params = opts[:query_params] || {}
14868
+
14869
+ # header parameters
14870
+ header_params = opts[:header_params] || {}
14871
+ # HTTP header 'Accept' (if needed)
14872
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
14873
+ # HTTP header 'Content-Type'
14874
+ content_type = @api_client.select_header_content_type(['application/json'])
14875
+ if !content_type.nil?
14876
+ header_params['Content-Type'] = content_type
14877
+ end
14878
+
14879
+ # form parameters
14880
+ form_params = opts[:form_params] || {}
14881
+
14882
+ # http body (model)
14883
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
14884
+
14885
+ # return_type
14886
+ return_type = opts[:debug_return_type] || 'Object'
14887
+
14888
+ # auth_names
14889
+ auth_names = opts[:debug_auth_names] || []
14890
+
14891
+ new_options = opts.merge(
14892
+ :operation => :"V2Api.update_ping_target",
14893
+ :header_params => header_params,
14894
+ :query_params => query_params,
14895
+ :form_params => form_params,
14896
+ :body => post_body,
14897
+ :auth_names => auth_names,
14898
+ :return_type => return_type
14899
+ )
14900
+
14901
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
14902
+ if @api_client.config.debugging
14903
+ @api_client.config.logger.debug "API called: V2Api#update_ping_target\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
14904
+ end
14905
+ return data, status_code, headers
14906
+ end
14907
+
14652
14908
  # @param body [UpdatePKICertIssuer]
14653
14909
  # @param [Hash] opts the optional parameters
14654
14910
  # @return [UpdatePKICertIssuerOutput]
@@ -0,0 +1,329 @@
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 CreatePingTarget
18
+ # Ping Federate administrative port
19
+ attr_accessor :administrative_port
20
+
21
+ # Ping Federate authorization port
22
+ attr_accessor :authorization_port
23
+
24
+ # Comment about the target
25
+ attr_accessor :comment
26
+
27
+ # Set output format to JSON
28
+ attr_accessor :json
29
+
30
+ # The name of a key that used to encrypt the target secret value (if empty, the account default protectionKey key will be used)
31
+ attr_accessor :key
32
+
33
+ # Target name
34
+ attr_accessor :name
35
+
36
+ # Ping Federate privileged user password
37
+ attr_accessor :password
38
+
39
+ # Ping URL
40
+ attr_accessor :ping_url
41
+
42
+ # Ping Federate privileged user
43
+ attr_accessor :privileged_user
44
+
45
+ # Authentication token (see `/auth` and `/configure`)
46
+ attr_accessor :token
47
+
48
+ # The universal identity token, Required only for universal_identity authentication
49
+ attr_accessor :uid_token
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'administrative_port' => :'administrative-port',
55
+ :'authorization_port' => :'authorization-port',
56
+ :'comment' => :'comment',
57
+ :'json' => :'json',
58
+ :'key' => :'key',
59
+ :'name' => :'name',
60
+ :'password' => :'password',
61
+ :'ping_url' => :'ping-url',
62
+ :'privileged_user' => :'privileged-user',
63
+ :'token' => :'token',
64
+ :'uid_token' => :'uid-token'
65
+ }
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'administrative_port' => :'String',
77
+ :'authorization_port' => :'String',
78
+ :'comment' => :'String',
79
+ :'json' => :'Boolean',
80
+ :'key' => :'String',
81
+ :'name' => :'String',
82
+ :'password' => :'String',
83
+ :'ping_url' => :'String',
84
+ :'privileged_user' => :'String',
85
+ :'token' => :'String',
86
+ :'uid_token' => :'String'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::CreatePingTarget` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!self.class.attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::CreatePingTarget`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'administrative_port')
112
+ self.administrative_port = attributes[:'administrative_port']
113
+ else
114
+ self.administrative_port = '9999'
115
+ end
116
+
117
+ if attributes.key?(:'authorization_port')
118
+ self.authorization_port = attributes[:'authorization_port']
119
+ else
120
+ self.authorization_port = '9031'
121
+ end
122
+
123
+ if attributes.key?(:'comment')
124
+ self.comment = attributes[:'comment']
125
+ end
126
+
127
+ if attributes.key?(:'json')
128
+ self.json = attributes[:'json']
129
+ end
130
+
131
+ if attributes.key?(:'key')
132
+ self.key = attributes[:'key']
133
+ end
134
+
135
+ if attributes.key?(:'name')
136
+ self.name = attributes[:'name']
137
+ end
138
+
139
+ if attributes.key?(:'password')
140
+ self.password = attributes[:'password']
141
+ end
142
+
143
+ if attributes.key?(:'ping_url')
144
+ self.ping_url = attributes[:'ping_url']
145
+ end
146
+
147
+ if attributes.key?(:'privileged_user')
148
+ self.privileged_user = attributes[:'privileged_user']
149
+ end
150
+
151
+ if attributes.key?(:'token')
152
+ self.token = attributes[:'token']
153
+ end
154
+
155
+ if attributes.key?(:'uid_token')
156
+ self.uid_token = attributes[:'uid_token']
157
+ end
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properties with the reasons
162
+ def list_invalid_properties
163
+ invalid_properties = Array.new
164
+ if @name.nil?
165
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
166
+ end
167
+
168
+ invalid_properties
169
+ end
170
+
171
+ # Check to see if the all the properties in the model are valid
172
+ # @return true if the model is valid
173
+ def valid?
174
+ return false if @name.nil?
175
+ true
176
+ end
177
+
178
+ # Checks equality by comparing each attribute.
179
+ # @param [Object] Object to be compared
180
+ def ==(o)
181
+ return true if self.equal?(o)
182
+ self.class == o.class &&
183
+ administrative_port == o.administrative_port &&
184
+ authorization_port == o.authorization_port &&
185
+ comment == o.comment &&
186
+ json == o.json &&
187
+ key == o.key &&
188
+ name == o.name &&
189
+ password == o.password &&
190
+ ping_url == o.ping_url &&
191
+ privileged_user == o.privileged_user &&
192
+ token == o.token &&
193
+ uid_token == o.uid_token
194
+ end
195
+
196
+ # @see the `==` method
197
+ # @param [Object] Object to be compared
198
+ def eql?(o)
199
+ self == o
200
+ end
201
+
202
+ # Calculates hash code according to all attributes.
203
+ # @return [Integer] Hash code
204
+ def hash
205
+ [administrative_port, authorization_port, comment, json, key, name, password, ping_url, privileged_user, token, uid_token].hash
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def self.build_from_hash(attributes)
212
+ new.build_from_hash(attributes)
213
+ end
214
+
215
+ # Builds the object from hash
216
+ # @param [Hash] attributes Model attributes in the form of hash
217
+ # @return [Object] Returns the model itself
218
+ def build_from_hash(attributes)
219
+ return nil unless attributes.is_a?(Hash)
220
+ attributes = attributes.transform_keys(&:to_sym)
221
+ self.class.openapi_types.each_pair do |key, type|
222
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
223
+ self.send("#{key}=", nil)
224
+ elsif type =~ /\AArray<(.*)>/i
225
+ # check to ensure the input is an array given that the attribute
226
+ # is documented as an array but the input is not
227
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
228
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
229
+ end
230
+ elsif !attributes[self.class.attribute_map[key]].nil?
231
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
232
+ end
233
+ end
234
+
235
+ self
236
+ end
237
+
238
+ # Deserializes the data based on type
239
+ # @param string type Data type
240
+ # @param string value Value to be deserialized
241
+ # @return [Object] Deserialized data
242
+ def _deserialize(type, value)
243
+ case type.to_sym
244
+ when :Time
245
+ Time.parse(value)
246
+ when :Date
247
+ Date.parse(value)
248
+ when :String
249
+ value.to_s
250
+ when :Integer
251
+ value.to_i
252
+ when :Float
253
+ value.to_f
254
+ when :Boolean
255
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
256
+ true
257
+ else
258
+ false
259
+ end
260
+ when :Object
261
+ # generic object (usually a Hash), return directly
262
+ value
263
+ when /\AArray<(?<inner_type>.+)>\z/
264
+ inner_type = Regexp.last_match[:inner_type]
265
+ value.map { |v| _deserialize(inner_type, v) }
266
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
267
+ k_type = Regexp.last_match[:k_type]
268
+ v_type = Regexp.last_match[:v_type]
269
+ {}.tap do |hash|
270
+ value.each do |k, v|
271
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
272
+ end
273
+ end
274
+ else # model
275
+ # models (e.g. Pet) or oneOf
276
+ klass = Akeyless.const_get(type)
277
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
278
+ end
279
+ end
280
+
281
+ # Returns the string representation of the object
282
+ # @return [String] String presentation of the object
283
+ def to_s
284
+ to_hash.to_s
285
+ end
286
+
287
+ # to_body is an alias to to_hash (backward compatibility)
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_body
290
+ to_hash
291
+ end
292
+
293
+ # Returns the object in the form of hash
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_hash
296
+ hash = {}
297
+ self.class.attribute_map.each_pair do |attr, param|
298
+ value = self.send(attr)
299
+ if value.nil?
300
+ is_nullable = self.class.openapi_nullable.include?(attr)
301
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
302
+ end
303
+
304
+ hash[param] = _to_hash(value)
305
+ end
306
+ hash
307
+ end
308
+
309
+ # Outputs non-array value in the form of hash
310
+ # For object, use to_hash. Otherwise, just return the value
311
+ # @param [Object] value Any valid value
312
+ # @return [Hash] Returns the value in the form of hash
313
+ def _to_hash(value)
314
+ if value.is_a?(Array)
315
+ value.compact.map { |v| _to_hash(v) }
316
+ elsif value.is_a?(Hash)
317
+ {}.tap do |hash|
318
+ value.each { |k, v| hash[k] = _to_hash(v) }
319
+ end
320
+ elsif value.respond_to? :to_hash
321
+ value.to_hash
322
+ else
323
+ value
324
+ end
325
+ end
326
+
327
+ end
328
+
329
+ end