akeyless 2.16.6 → 2.16.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -1
  3. data/docs/CertAccessRules.md +1 -1
  4. data/docs/CreateAzureTarget.md +6 -0
  5. data/docs/CreateRotatedSecret.md +2 -0
  6. data/docs/DSProducerDetails.md +6 -0
  7. data/docs/DeleteRoleRule.md +1 -1
  8. data/docs/GatewayCreateProducerRabbitMQ.md +2 -0
  9. data/docs/GatewayCreateProducerRedshift.md +2 -0
  10. data/docs/GatewayUpdateProducerRabbitMQ.md +2 -0
  11. data/docs/GatewayUpdateProducerRedshift.md +2 -0
  12. data/docs/GetRSAPublicOutput.md +1 -1
  13. data/docs/ListItems.md +2 -0
  14. data/docs/SetRoleRule.md +1 -1
  15. data/docs/Target.md +2 -0
  16. data/docs/TargetTypeDetailsInput.md +6 -0
  17. data/docs/UpdateAzureTarget.md +6 -0
  18. data/docs/UpdateLdapTarget.md +42 -0
  19. data/docs/UpdateLdapTargetDetails.md +40 -0
  20. data/docs/UpdateLdapTargetOutput.md +18 -0
  21. data/docs/UpdateRotatedSecret.md +2 -0
  22. data/docs/V2Api.md +126 -0
  23. data/lib/akeyless/api/v2_api.rb +128 -0
  24. data/lib/akeyless/models/cert_access_rules.rb +2 -4
  25. data/lib/akeyless/models/create_azure_target.rb +31 -1
  26. data/lib/akeyless/models/create_rotated_secret.rb +11 -1
  27. data/lib/akeyless/models/delete_role_rule.rb +1 -1
  28. data/lib/akeyless/models/ds_producer_details.rb +28 -1
  29. data/lib/akeyless/models/gateway_create_producer_rabbit_mq.rb +13 -1
  30. data/lib/akeyless/models/gateway_create_producer_redshift.rb +11 -1
  31. data/lib/akeyless/models/gateway_update_producer_rabbit_mq.rb +13 -1
  32. data/lib/akeyless/models/gateway_update_producer_redshift.rb +11 -1
  33. data/lib/akeyless/models/get_rsa_public_output.rb +2 -4
  34. data/lib/akeyless/models/list_items.rb +10 -1
  35. data/lib/akeyless/models/set_role_rule.rb +1 -1
  36. data/lib/akeyless/models/target.rb +13 -1
  37. data/lib/akeyless/models/target_type_details_input.rb +28 -1
  38. data/lib/akeyless/models/update_azure_target.rb +31 -1
  39. data/lib/akeyless/models/update_ldap_target.rb +339 -0
  40. data/lib/akeyless/models/update_ldap_target_details.rb +328 -0
  41. data/lib/akeyless/models/update_ldap_target_output.rb +219 -0
  42. data/lib/akeyless/models/update_rotated_secret.rb +11 -1
  43. data/lib/akeyless/version.rb +1 -1
  44. data/lib/akeyless.rb +3 -0
  45. data/spec/models/update_ldap_target_details_spec.rb +100 -0
  46. data/spec/models/update_ldap_target_output_spec.rb +34 -0
  47. data/spec/models/update_ldap_target_spec.rb +106 -0
  48. metadata +14 -2
@@ -24,7 +24,7 @@ module Akeyless
24
24
  # The role name to be updated
25
25
  attr_accessor :role_name
26
26
 
27
- # item-rule, target-rule, role-rule, auth-method-rule, search-rule or reports-rule
27
+ # item-rule, target-rule, role-rule, auth-method-rule, search-rule, reports-rule, gw-reports-rule or sra-reports-rule
28
28
  attr_accessor :rule_type
29
29
 
30
30
  # Authentication token (see `/auth` and `/configure`)
@@ -15,6 +15,9 @@ require 'time'
15
15
 
16
16
  module Akeyless
17
17
  class Target
18
+ # this is not \"omitempty\" since an empty value causes no update while an empty map will clear the attributes
19
+ attr_accessor :attributes
20
+
18
21
  attr_accessor :client_permissions
19
22
 
20
23
  attr_accessor :comment
@@ -38,6 +41,7 @@ module Akeyless
38
41
  # Attribute mapping from ruby-style variable name to JSON key.
39
42
  def self.attribute_map
40
43
  {
44
+ :'attributes' => :'attributes',
41
45
  :'client_permissions' => :'client_permissions',
42
46
  :'comment' => :'comment',
43
47
  :'last_version' => :'last_version',
@@ -59,6 +63,7 @@ module Akeyless
59
63
  # Attribute type mapping.
60
64
  def self.openapi_types
61
65
  {
66
+ :'attributes' => :'Hash<String, Object>',
62
67
  :'client_permissions' => :'Array<String>',
63
68
  :'comment' => :'String',
64
69
  :'last_version' => :'Integer',
@@ -93,6 +98,12 @@ module Akeyless
93
98
  h[k.to_sym] = v
94
99
  }
95
100
 
101
+ if attributes.key?(:'attributes')
102
+ if (value = attributes[:'attributes']).is_a?(Hash)
103
+ self.attributes = value
104
+ end
105
+ end
106
+
96
107
  if attributes.key?(:'client_permissions')
97
108
  if (value = attributes[:'client_permissions']).is_a?(Array)
98
109
  self.client_permissions = value
@@ -158,6 +169,7 @@ module Akeyless
158
169
  def ==(o)
159
170
  return true if self.equal?(o)
160
171
  self.class == o.class &&
172
+ attributes == o.attributes &&
161
173
  client_permissions == o.client_permissions &&
162
174
  comment == o.comment &&
163
175
  last_version == o.last_version &&
@@ -179,7 +191,7 @@ module Akeyless
179
191
  # Calculates hash code according to all attributes.
180
192
  # @return [Integer] Hash code
181
193
  def hash
182
- [client_permissions, comment, last_version, protection_key_name, target_id, target_items_assoc, target_name, target_type, target_versions, with_customer_fragment].hash
194
+ [attributes, client_permissions, comment, last_version, protection_key_name, target_id, target_items_assoc, target_name, target_type, target_versions, with_customer_fragment].hash
183
195
  end
184
196
 
185
197
  # Builds the object from hash
@@ -33,6 +33,12 @@ module Akeyless
33
33
 
34
34
  attr_accessor :azure_client_secret
35
35
 
36
+ attr_accessor :azure_resource_group_name
37
+
38
+ attr_accessor :azure_resource_name
39
+
40
+ attr_accessor :azure_subscription_id
41
+
36
42
  attr_accessor :azure_tenant_id
37
43
 
38
44
  # CACertData is the rsa 4096 certificate data in PEM format
@@ -210,6 +216,9 @@ module Akeyless
210
216
  :'aws_session_token' => :'aws_session_token',
211
217
  :'azure_client_id' => :'azure_client_id',
212
218
  :'azure_client_secret' => :'azure_client_secret',
219
+ :'azure_resource_group_name' => :'azure_resource_group_name',
220
+ :'azure_resource_name' => :'azure_resource_name',
221
+ :'azure_subscription_id' => :'azure_subscription_id',
213
222
  :'azure_tenant_id' => :'azure_tenant_id',
214
223
  :'ca_cert_data' => :'ca_cert_data',
215
224
  :'ca_cert_name' => :'ca_cert_name',
@@ -308,6 +317,9 @@ module Akeyless
308
317
  :'aws_session_token' => :'String',
309
318
  :'azure_client_id' => :'String',
310
319
  :'azure_client_secret' => :'String',
320
+ :'azure_resource_group_name' => :'String',
321
+ :'azure_resource_name' => :'String',
322
+ :'azure_subscription_id' => :'String',
311
323
  :'azure_tenant_id' => :'String',
312
324
  :'ca_cert_data' => :'Array<Integer>',
313
325
  :'ca_cert_name' => :'String',
@@ -446,6 +458,18 @@ module Akeyless
446
458
  self.azure_client_secret = attributes[:'azure_client_secret']
447
459
  end
448
460
 
461
+ if attributes.key?(:'azure_resource_group_name')
462
+ self.azure_resource_group_name = attributes[:'azure_resource_group_name']
463
+ end
464
+
465
+ if attributes.key?(:'azure_resource_name')
466
+ self.azure_resource_name = attributes[:'azure_resource_name']
467
+ end
468
+
469
+ if attributes.key?(:'azure_subscription_id')
470
+ self.azure_subscription_id = attributes[:'azure_subscription_id']
471
+ end
472
+
449
473
  if attributes.key?(:'azure_tenant_id')
450
474
  self.azure_tenant_id = attributes[:'azure_tenant_id']
451
475
  end
@@ -788,6 +812,9 @@ module Akeyless
788
812
  aws_session_token == o.aws_session_token &&
789
813
  azure_client_id == o.azure_client_id &&
790
814
  azure_client_secret == o.azure_client_secret &&
815
+ azure_resource_group_name == o.azure_resource_group_name &&
816
+ azure_resource_name == o.azure_resource_name &&
817
+ azure_subscription_id == o.azure_subscription_id &&
791
818
  azure_tenant_id == o.azure_tenant_id &&
792
819
  ca_cert_data == o.ca_cert_data &&
793
820
  ca_cert_name == o.ca_cert_name &&
@@ -877,7 +904,7 @@ module Akeyless
877
904
  # Calculates hash code according to all attributes.
878
905
  # @return [Integer] Hash code
879
906
  def hash
880
- [artifactory_admin_apikey, artifactory_admin_username, artifactory_base_url, aws_access_key_id, aws_region, aws_secret_access_key, aws_session_token, azure_client_id, azure_client_secret, azure_tenant_id, ca_cert_data, ca_cert_name, chef_server_host_name, chef_server_key, chef_server_port, chef_server_url, chef_server_username, chef_skip_ssl, client_id, client_secret, db_host_name, db_name, db_port, db_pwd, db_server_certificates, db_server_name, db_user_name, eks_access_key_id, eks_cluster_ca_certificate, eks_cluster_endpoint, eks_cluster_name, eks_region, eks_secret_access_key, gcp_service_account_email, gcp_service_account_key, github_app_id, github_app_private_key, github_base_url, gke_cluster_ca_certificate, gke_cluster_endpoint, gke_cluster_name, gke_service_account_key, gke_service_account_name, host, k8s_bearer_token, k8s_cluster_ca_certificate, k8s_cluster_endpoint, ldap_audience, ldap_bind_dn, ldap_bind_password, ldap_certificate, ldap_token_expiration, ldap_url, mongodb_atlas_api_private_key, mongodb_atlas_api_public_key, mongodb_atlas_project_id, mongodb_db_name, mongodb_default_auth_db, mongodb_host_port, mongodb_is_atlas, mongodb_password, mongodb_uri_connection, mongodb_uri_options, mongodb_username, password, payload, port, private_key, private_key_password, rabbitmq_server_password, rabbitmq_server_uri, rabbitmq_server_user, security_token, sf_account, ssl_connection_certificate, ssl_connection_mode, tenant_url, url, use_gw_cloud_identity, user_name, username, venafi_api_key, venafi_base_url, venafi_tpp_password, venafi_tpp_username, venafi_use_tpp, venafi_zone].hash
907
+ [artifactory_admin_apikey, artifactory_admin_username, artifactory_base_url, aws_access_key_id, aws_region, aws_secret_access_key, aws_session_token, azure_client_id, azure_client_secret, azure_resource_group_name, azure_resource_name, azure_subscription_id, azure_tenant_id, ca_cert_data, ca_cert_name, chef_server_host_name, chef_server_key, chef_server_port, chef_server_url, chef_server_username, chef_skip_ssl, client_id, client_secret, db_host_name, db_name, db_port, db_pwd, db_server_certificates, db_server_name, db_user_name, eks_access_key_id, eks_cluster_ca_certificate, eks_cluster_endpoint, eks_cluster_name, eks_region, eks_secret_access_key, gcp_service_account_email, gcp_service_account_key, github_app_id, github_app_private_key, github_base_url, gke_cluster_ca_certificate, gke_cluster_endpoint, gke_cluster_name, gke_service_account_key, gke_service_account_name, host, k8s_bearer_token, k8s_cluster_ca_certificate, k8s_cluster_endpoint, ldap_audience, ldap_bind_dn, ldap_bind_password, ldap_certificate, ldap_token_expiration, ldap_url, mongodb_atlas_api_private_key, mongodb_atlas_api_public_key, mongodb_atlas_project_id, mongodb_db_name, mongodb_default_auth_db, mongodb_host_port, mongodb_is_atlas, mongodb_password, mongodb_uri_connection, mongodb_uri_options, mongodb_username, password, payload, port, private_key, private_key_password, rabbitmq_server_password, rabbitmq_server_uri, rabbitmq_server_user, security_token, sf_account, ssl_connection_certificate, ssl_connection_mode, tenant_url, url, use_gw_cloud_identity, user_name, username, venafi_api_key, venafi_base_url, venafi_tpp_password, venafi_tpp_username, venafi_use_tpp, venafi_zone].hash
881
908
  end
882
909
 
883
910
  # Builds the object from hash
@@ -33,6 +33,15 @@ module Akeyless
33
33
  # New target name
34
34
  attr_accessor :new_name
35
35
 
36
+ # The Resource Group name in your Azure subscription
37
+ attr_accessor :resource_group_name
38
+
39
+ # The name of the relevant Resource
40
+ attr_accessor :resource_name
41
+
42
+ # Azure Subscription Id
43
+ attr_accessor :subscription_id
44
+
36
45
  attr_accessor :tenant_id
37
46
 
38
47
  # Authentication token (see `/auth` and `/configure`)
@@ -56,6 +65,9 @@ module Akeyless
56
65
  :'key' => :'key',
57
66
  :'name' => :'name',
58
67
  :'new_name' => :'new-name',
68
+ :'resource_group_name' => :'resource-group-name',
69
+ :'resource_name' => :'resource-name',
70
+ :'subscription_id' => :'subscription-id',
59
71
  :'tenant_id' => :'tenant-id',
60
72
  :'token' => :'token',
61
73
  :'uid_token' => :'uid-token',
@@ -79,6 +91,9 @@ module Akeyless
79
91
  :'key' => :'String',
80
92
  :'name' => :'String',
81
93
  :'new_name' => :'String',
94
+ :'resource_group_name' => :'String',
95
+ :'resource_name' => :'String',
96
+ :'subscription_id' => :'String',
82
97
  :'tenant_id' => :'String',
83
98
  :'token' => :'String',
84
99
  :'uid_token' => :'String',
@@ -136,6 +151,18 @@ module Akeyless
136
151
  self.new_name = attributes[:'new_name']
137
152
  end
138
153
 
154
+ if attributes.key?(:'resource_group_name')
155
+ self.resource_group_name = attributes[:'resource_group_name']
156
+ end
157
+
158
+ if attributes.key?(:'resource_name')
159
+ self.resource_name = attributes[:'resource_name']
160
+ end
161
+
162
+ if attributes.key?(:'subscription_id')
163
+ self.subscription_id = attributes[:'subscription_id']
164
+ end
165
+
139
166
  if attributes.key?(:'tenant_id')
140
167
  self.tenant_id = attributes[:'tenant_id']
141
168
  end
@@ -187,6 +214,9 @@ module Akeyless
187
214
  key == o.key &&
188
215
  name == o.name &&
189
216
  new_name == o.new_name &&
217
+ resource_group_name == o.resource_group_name &&
218
+ resource_name == o.resource_name &&
219
+ subscription_id == o.subscription_id &&
190
220
  tenant_id == o.tenant_id &&
191
221
  token == o.token &&
192
222
  uid_token == o.uid_token &&
@@ -203,7 +233,7 @@ module Akeyless
203
233
  # Calculates hash code according to all attributes.
204
234
  # @return [Integer] Hash code
205
235
  def hash
206
- [client_id, client_secret, comment, keep_prev_version, key, name, new_name, tenant_id, token, uid_token, update_version, use_gw_cloud_identity].hash
236
+ [client_id, client_secret, comment, keep_prev_version, key, name, new_name, resource_group_name, resource_name, subscription_id, tenant_id, token, uid_token, update_version, use_gw_cloud_identity].hash
207
237
  end
208
238
 
209
239
  # Builds the object from hash
@@ -0,0 +1,339 @@
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.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ class UpdateLdapTarget
18
+ attr_accessor :bind_dn
19
+
20
+ attr_accessor :bind_dn_password
21
+
22
+ # Comment about the target
23
+ attr_accessor :comment
24
+
25
+ attr_accessor :keep_prev_version
26
+
27
+ # The name of a key that used to encrypt the target secret value (if empty, the account default protectionKey key will be used)
28
+ attr_accessor :key
29
+
30
+ attr_accessor :ldap_ca_cert
31
+
32
+ attr_accessor :ldap_url
33
+
34
+ # Target name
35
+ attr_accessor :name
36
+
37
+ # New target name
38
+ attr_accessor :new_name
39
+
40
+ # Authentication token (see `/auth` and `/configure`)
41
+ attr_accessor :token
42
+
43
+ attr_accessor :token_expiration
44
+
45
+ # The universal identity token, Required only for universal_identity authentication
46
+ attr_accessor :uid_token
47
+
48
+ # Deprecated
49
+ attr_accessor :update_version
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'bind_dn' => :'bind-dn',
55
+ :'bind_dn_password' => :'bind-dn-password',
56
+ :'comment' => :'comment',
57
+ :'keep_prev_version' => :'keep-prev-version',
58
+ :'key' => :'key',
59
+ :'ldap_ca_cert' => :'ldap-ca-cert',
60
+ :'ldap_url' => :'ldap-url',
61
+ :'name' => :'name',
62
+ :'new_name' => :'new-name',
63
+ :'token' => :'token',
64
+ :'token_expiration' => :'token-expiration',
65
+ :'uid_token' => :'uid-token',
66
+ :'update_version' => :'update-version'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'bind_dn' => :'String',
79
+ :'bind_dn_password' => :'String',
80
+ :'comment' => :'String',
81
+ :'keep_prev_version' => :'String',
82
+ :'key' => :'String',
83
+ :'ldap_ca_cert' => :'String',
84
+ :'ldap_url' => :'String',
85
+ :'name' => :'String',
86
+ :'new_name' => :'String',
87
+ :'token' => :'String',
88
+ :'token_expiration' => :'String',
89
+ :'uid_token' => :'String',
90
+ :'update_version' => :'Boolean'
91
+ }
92
+ end
93
+
94
+ # List of attributes with nullable: true
95
+ def self.openapi_nullable
96
+ Set.new([
97
+ ])
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ if (!attributes.is_a?(Hash))
104
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::UpdateLdapTarget` initialize method"
105
+ end
106
+
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!self.class.attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::UpdateLdapTarget`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'bind_dn')
116
+ self.bind_dn = attributes[:'bind_dn']
117
+ end
118
+
119
+ if attributes.key?(:'bind_dn_password')
120
+ self.bind_dn_password = attributes[:'bind_dn_password']
121
+ end
122
+
123
+ if attributes.key?(:'comment')
124
+ self.comment = attributes[:'comment']
125
+ end
126
+
127
+ if attributes.key?(:'keep_prev_version')
128
+ self.keep_prev_version = attributes[:'keep_prev_version']
129
+ end
130
+
131
+ if attributes.key?(:'key')
132
+ self.key = attributes[:'key']
133
+ end
134
+
135
+ if attributes.key?(:'ldap_ca_cert')
136
+ self.ldap_ca_cert = attributes[:'ldap_ca_cert']
137
+ end
138
+
139
+ if attributes.key?(:'ldap_url')
140
+ self.ldap_url = attributes[:'ldap_url']
141
+ end
142
+
143
+ if attributes.key?(:'name')
144
+ self.name = attributes[:'name']
145
+ end
146
+
147
+ if attributes.key?(:'new_name')
148
+ self.new_name = attributes[:'new_name']
149
+ end
150
+
151
+ if attributes.key?(:'token')
152
+ self.token = attributes[:'token']
153
+ end
154
+
155
+ if attributes.key?(:'token_expiration')
156
+ self.token_expiration = attributes[:'token_expiration']
157
+ end
158
+
159
+ if attributes.key?(:'uid_token')
160
+ self.uid_token = attributes[:'uid_token']
161
+ end
162
+
163
+ if attributes.key?(:'update_version')
164
+ self.update_version = attributes[:'update_version']
165
+ end
166
+ end
167
+
168
+ # Show invalid properties with the reasons. Usually used together with valid?
169
+ # @return Array for valid properties with the reasons
170
+ def list_invalid_properties
171
+ invalid_properties = Array.new
172
+ if @name.nil?
173
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
174
+ end
175
+
176
+ invalid_properties
177
+ end
178
+
179
+ # Check to see if the all the properties in the model are valid
180
+ # @return true if the model is valid
181
+ def valid?
182
+ return false if @name.nil?
183
+ true
184
+ end
185
+
186
+ # Checks equality by comparing each attribute.
187
+ # @param [Object] Object to be compared
188
+ def ==(o)
189
+ return true if self.equal?(o)
190
+ self.class == o.class &&
191
+ bind_dn == o.bind_dn &&
192
+ bind_dn_password == o.bind_dn_password &&
193
+ comment == o.comment &&
194
+ keep_prev_version == o.keep_prev_version &&
195
+ key == o.key &&
196
+ ldap_ca_cert == o.ldap_ca_cert &&
197
+ ldap_url == o.ldap_url &&
198
+ name == o.name &&
199
+ new_name == o.new_name &&
200
+ token == o.token &&
201
+ token_expiration == o.token_expiration &&
202
+ uid_token == o.uid_token &&
203
+ update_version == o.update_version
204
+ end
205
+
206
+ # @see the `==` method
207
+ # @param [Object] Object to be compared
208
+ def eql?(o)
209
+ self == o
210
+ end
211
+
212
+ # Calculates hash code according to all attributes.
213
+ # @return [Integer] Hash code
214
+ def hash
215
+ [bind_dn, bind_dn_password, comment, keep_prev_version, key, ldap_ca_cert, ldap_url, name, new_name, token, token_expiration, uid_token, update_version].hash
216
+ end
217
+
218
+ # Builds the object from hash
219
+ # @param [Hash] attributes Model attributes in the form of hash
220
+ # @return [Object] Returns the model itself
221
+ def self.build_from_hash(attributes)
222
+ new.build_from_hash(attributes)
223
+ end
224
+
225
+ # Builds the object from hash
226
+ # @param [Hash] attributes Model attributes in the form of hash
227
+ # @return [Object] Returns the model itself
228
+ def build_from_hash(attributes)
229
+ return nil unless attributes.is_a?(Hash)
230
+ attributes = attributes.transform_keys(&:to_sym)
231
+ self.class.openapi_types.each_pair do |key, type|
232
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
233
+ self.send("#{key}=", nil)
234
+ elsif type =~ /\AArray<(.*)>/i
235
+ # check to ensure the input is an array given that the attribute
236
+ # is documented as an array but the input is not
237
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
238
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
239
+ end
240
+ elsif !attributes[self.class.attribute_map[key]].nil?
241
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
242
+ end
243
+ end
244
+
245
+ self
246
+ end
247
+
248
+ # Deserializes the data based on type
249
+ # @param string type Data type
250
+ # @param string value Value to be deserialized
251
+ # @return [Object] Deserialized data
252
+ def _deserialize(type, value)
253
+ case type.to_sym
254
+ when :Time
255
+ Time.parse(value)
256
+ when :Date
257
+ Date.parse(value)
258
+ when :String
259
+ value.to_s
260
+ when :Integer
261
+ value.to_i
262
+ when :Float
263
+ value.to_f
264
+ when :Boolean
265
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
266
+ true
267
+ else
268
+ false
269
+ end
270
+ when :Object
271
+ # generic object (usually a Hash), return directly
272
+ value
273
+ when /\AArray<(?<inner_type>.+)>\z/
274
+ inner_type = Regexp.last_match[:inner_type]
275
+ value.map { |v| _deserialize(inner_type, v) }
276
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
277
+ k_type = Regexp.last_match[:k_type]
278
+ v_type = Regexp.last_match[:v_type]
279
+ {}.tap do |hash|
280
+ value.each do |k, v|
281
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
282
+ end
283
+ end
284
+ else # model
285
+ # models (e.g. Pet) or oneOf
286
+ klass = Akeyless.const_get(type)
287
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
288
+ end
289
+ end
290
+
291
+ # Returns the string representation of the object
292
+ # @return [String] String presentation of the object
293
+ def to_s
294
+ to_hash.to_s
295
+ end
296
+
297
+ # to_body is an alias to to_hash (backward compatibility)
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_body
300
+ to_hash
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ # Outputs non-array value in the form of hash
320
+ # For object, use to_hash. Otherwise, just return the value
321
+ # @param [Object] value Any valid value
322
+ # @return [Hash] Returns the value in the form of hash
323
+ def _to_hash(value)
324
+ if value.is_a?(Array)
325
+ value.compact.map { |v| _to_hash(v) }
326
+ elsif value.is_a?(Hash)
327
+ {}.tap do |hash|
328
+ value.each { |k, v| hash[k] = _to_hash(v) }
329
+ end
330
+ elsif value.respond_to? :to_hash
331
+ value.to_hash
332
+ else
333
+ value
334
+ end
335
+ end
336
+
337
+ end
338
+
339
+ end