akeyless 3.2.6 → 3.2.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 (158) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -1
  3. data/docs/CertAccessRules.md +2 -0
  4. data/docs/CreateAuthMethodCert.md +2 -0
  5. data/docs/CreateCertificate.md +1 -1
  6. data/docs/CreateClassicKey.md +1 -1
  7. data/docs/CreateDynamicSecret.md +1 -1
  8. data/docs/CreateLinkedTarget.md +1 -3
  9. data/docs/CreateRotatedSecret.md +1 -1
  10. data/docs/CreateSecret.md +1 -1
  11. data/docs/CreateWindowsTarget.md +2 -4
  12. data/docs/DecryptFile.md +6 -0
  13. data/docs/DescribeAssoc.md +24 -0
  14. data/docs/EncryptFile.md +0 -2
  15. data/docs/GatewayCreateProducerArtifactory.md +1 -1
  16. data/docs/GatewayCreateProducerAws.md +1 -1
  17. data/docs/GatewayCreateProducerAzure.md +1 -1
  18. data/docs/GatewayCreateProducerCassandra.md +1 -1
  19. data/docs/GatewayCreateProducerCertificateAutomation.md +1 -1
  20. data/docs/GatewayCreateProducerChef.md +1 -1
  21. data/docs/GatewayCreateProducerCustom.md +1 -1
  22. data/docs/GatewayCreateProducerDockerhub.md +1 -1
  23. data/docs/GatewayCreateProducerEks.md +1 -1
  24. data/docs/GatewayCreateProducerGcp.md +1 -1
  25. data/docs/GatewayCreateProducerGke.md +1 -1
  26. data/docs/GatewayCreateProducerHanaDb.md +1 -1
  27. data/docs/GatewayCreateProducerLdap.md +1 -1
  28. data/docs/GatewayCreateProducerMSSQL.md +1 -1
  29. data/docs/GatewayCreateProducerMongo.md +1 -1
  30. data/docs/GatewayCreateProducerMySQL.md +1 -1
  31. data/docs/GatewayCreateProducerNativeK8S.md +1 -1
  32. data/docs/GatewayCreateProducerOracleDb.md +1 -1
  33. data/docs/GatewayCreateProducerPing.md +1 -1
  34. data/docs/GatewayCreateProducerPostgreSQL.md +1 -1
  35. data/docs/GatewayCreateProducerRabbitMQ.md +1 -1
  36. data/docs/GatewayCreateProducerRdp.md +1 -1
  37. data/docs/GatewayCreateProducerRedshift.md +1 -1
  38. data/docs/GatewayCreateProducerSnowflake.md +1 -1
  39. data/docs/GatewayDownloadCustomerFragments.md +22 -0
  40. data/docs/GatewayDownloadCustomerFragmentsOutput.md +18 -0
  41. data/docs/GatewayUpdateProducerArtifactory.md +1 -1
  42. data/docs/GatewayUpdateProducerAws.md +1 -1
  43. data/docs/GatewayUpdateProducerAzure.md +1 -1
  44. data/docs/GatewayUpdateProducerCassandra.md +1 -1
  45. data/docs/GatewayUpdateProducerCertificateAutomation.md +1 -1
  46. data/docs/GatewayUpdateProducerChef.md +1 -1
  47. data/docs/GatewayUpdateProducerCustom.md +1 -1
  48. data/docs/GatewayUpdateProducerDockerhub.md +1 -1
  49. data/docs/GatewayUpdateProducerEks.md +1 -1
  50. data/docs/GatewayUpdateProducerGcp.md +1 -1
  51. data/docs/GatewayUpdateProducerGke.md +1 -1
  52. data/docs/GatewayUpdateProducerHanaDb.md +1 -1
  53. data/docs/GatewayUpdateProducerLdap.md +1 -1
  54. data/docs/GatewayUpdateProducerMSSQL.md +1 -1
  55. data/docs/GatewayUpdateProducerMongo.md +1 -1
  56. data/docs/GatewayUpdateProducerMySQL.md +1 -1
  57. data/docs/GatewayUpdateProducerNativeK8S.md +1 -1
  58. data/docs/GatewayUpdateProducerOracleDb.md +1 -1
  59. data/docs/GatewayUpdateProducerPing.md +1 -1
  60. data/docs/GatewayUpdateProducerPostgreSQL.md +1 -1
  61. data/docs/GatewayUpdateProducerRabbitMQ.md +1 -1
  62. data/docs/GatewayUpdateProducerRdp.md +1 -1
  63. data/docs/GatewayUpdateProducerRedshift.md +1 -1
  64. data/docs/GatewayUpdateProducerSnowflake.md +1 -1
  65. data/docs/GeneralConfigPart.md +2 -0
  66. data/docs/ImportPasswords.md +32 -0
  67. data/docs/ImportPasswordsOutput.md +22 -0
  68. data/docs/Item.md +2 -0
  69. data/docs/LinkedDetails.md +18 -0
  70. data/docs/RoleAssociationDetails.md +26 -0
  71. data/docs/TargetTypeDetailsInput.md +1 -3
  72. data/docs/UpdateAuthMethodCert.md +2 -0
  73. data/docs/UpdateLinkedTarget.md +2 -4
  74. data/docs/UpdateWindowsTarget.md +2 -4
  75. data/docs/V2Api.md +191 -2
  76. data/lib/akeyless/api/v2_api.rb +192 -0
  77. data/lib/akeyless/models/cert_access_rules.rb +13 -1
  78. data/lib/akeyless/models/create_auth_method_cert.rb +11 -1
  79. data/lib/akeyless/models/create_certificate.rb +1 -1
  80. data/lib/akeyless/models/create_classic_key.rb +1 -1
  81. data/lib/akeyless/models/create_dynamic_secret.rb +1 -1
  82. data/lib/akeyless/models/create_linked_target.rb +2 -17
  83. data/lib/akeyless/models/create_rotated_secret.rb +1 -1
  84. data/lib/akeyless/models/create_secret.rb +1 -1
  85. data/lib/akeyless/models/create_windows_target.rb +9 -19
  86. data/lib/akeyless/models/decrypt_file.rb +35 -1
  87. data/lib/akeyless/models/describe_assoc.rb +257 -0
  88. data/lib/akeyless/models/encrypt_file.rb +1 -13
  89. data/lib/akeyless/models/gateway_create_producer_artifactory.rb +1 -1
  90. data/lib/akeyless/models/gateway_create_producer_aws.rb +1 -1
  91. data/lib/akeyless/models/gateway_create_producer_azure.rb +1 -1
  92. data/lib/akeyless/models/gateway_create_producer_cassandra.rb +1 -1
  93. data/lib/akeyless/models/gateway_create_producer_certificate_automation.rb +1 -1
  94. data/lib/akeyless/models/gateway_create_producer_chef.rb +1 -1
  95. data/lib/akeyless/models/gateway_create_producer_custom.rb +1 -1
  96. data/lib/akeyless/models/gateway_create_producer_dockerhub.rb +1 -1
  97. data/lib/akeyless/models/gateway_create_producer_eks.rb +1 -1
  98. data/lib/akeyless/models/gateway_create_producer_gcp.rb +1 -1
  99. data/lib/akeyless/models/gateway_create_producer_gke.rb +1 -1
  100. data/lib/akeyless/models/gateway_create_producer_hana_db.rb +1 -1
  101. data/lib/akeyless/models/gateway_create_producer_ldap.rb +1 -1
  102. data/lib/akeyless/models/gateway_create_producer_mongo.rb +1 -1
  103. data/lib/akeyless/models/gateway_create_producer_mssql.rb +1 -1
  104. data/lib/akeyless/models/gateway_create_producer_my_sql.rb +1 -1
  105. data/lib/akeyless/models/gateway_create_producer_native_k8_s.rb +1 -1
  106. data/lib/akeyless/models/gateway_create_producer_oracle_db.rb +1 -1
  107. data/lib/akeyless/models/gateway_create_producer_ping.rb +1 -1
  108. data/lib/akeyless/models/gateway_create_producer_postgre_sql.rb +1 -1
  109. data/lib/akeyless/models/gateway_create_producer_rabbit_mq.rb +1 -1
  110. data/lib/akeyless/models/gateway_create_producer_rdp.rb +1 -1
  111. data/lib/akeyless/models/gateway_create_producer_redshift.rb +1 -1
  112. data/lib/akeyless/models/gateway_create_producer_snowflake.rb +1 -1
  113. data/lib/akeyless/models/gateway_download_customer_fragments.rb +243 -0
  114. data/lib/akeyless/models/gateway_download_customer_fragments_output.rb +221 -0
  115. data/lib/akeyless/models/gateway_update_producer_artifactory.rb +1 -1
  116. data/lib/akeyless/models/gateway_update_producer_aws.rb +1 -1
  117. data/lib/akeyless/models/gateway_update_producer_azure.rb +1 -1
  118. data/lib/akeyless/models/gateway_update_producer_cassandra.rb +1 -1
  119. data/lib/akeyless/models/gateway_update_producer_certificate_automation.rb +1 -1
  120. data/lib/akeyless/models/gateway_update_producer_chef.rb +1 -1
  121. data/lib/akeyless/models/gateway_update_producer_custom.rb +1 -1
  122. data/lib/akeyless/models/gateway_update_producer_dockerhub.rb +1 -1
  123. data/lib/akeyless/models/gateway_update_producer_eks.rb +1 -1
  124. data/lib/akeyless/models/gateway_update_producer_gcp.rb +1 -1
  125. data/lib/akeyless/models/gateway_update_producer_gke.rb +1 -1
  126. data/lib/akeyless/models/gateway_update_producer_hana_db.rb +1 -1
  127. data/lib/akeyless/models/gateway_update_producer_ldap.rb +1 -1
  128. data/lib/akeyless/models/gateway_update_producer_mongo.rb +1 -1
  129. data/lib/akeyless/models/gateway_update_producer_mssql.rb +1 -1
  130. data/lib/akeyless/models/gateway_update_producer_my_sql.rb +1 -1
  131. data/lib/akeyless/models/gateway_update_producer_native_k8_s.rb +1 -1
  132. data/lib/akeyless/models/gateway_update_producer_oracle_db.rb +1 -1
  133. data/lib/akeyless/models/gateway_update_producer_ping.rb +1 -1
  134. data/lib/akeyless/models/gateway_update_producer_postgre_sql.rb +1 -1
  135. data/lib/akeyless/models/gateway_update_producer_rabbit_mq.rb +1 -1
  136. data/lib/akeyless/models/gateway_update_producer_rdp.rb +1 -1
  137. data/lib/akeyless/models/gateway_update_producer_redshift.rb +1 -1
  138. data/lib/akeyless/models/gateway_update_producer_snowflake.rb +1 -1
  139. data/lib/akeyless/models/general_config_part.rb +10 -1
  140. data/lib/akeyless/models/import_passwords.rb +304 -0
  141. data/lib/akeyless/models/import_passwords_output.rb +237 -0
  142. data/lib/akeyless/models/item.rb +10 -1
  143. data/lib/akeyless/models/linked_details.rb +221 -0
  144. data/lib/akeyless/models/role_association_details.rb +258 -0
  145. data/lib/akeyless/models/target_type_details_input.rb +3 -12
  146. data/lib/akeyless/models/update_auth_method_cert.rb +11 -1
  147. data/lib/akeyless/models/update_linked_target.rb +3 -18
  148. data/lib/akeyless/models/update_windows_target.rb +9 -19
  149. data/lib/akeyless/version.rb +1 -1
  150. data/lib/akeyless.rb +7 -0
  151. data/spec/models/describe_assoc_spec.rb +52 -0
  152. data/spec/models/gateway_download_customer_fragments_output_spec.rb +34 -0
  153. data/spec/models/gateway_download_customer_fragments_spec.rb +46 -0
  154. data/spec/models/import_passwords_output_spec.rb +46 -0
  155. data/spec/models/import_passwords_spec.rb +76 -0
  156. data/spec/models/linked_details_spec.rb +34 -0
  157. data/spec/models/role_association_details_spec.rb +58 -0
  158. metadata +30 -2
@@ -79,7 +79,7 @@ module Akeyless
79
79
  # Enable Web Secure Remote Access
80
80
  attr_accessor :secure_access_web
81
81
 
82
- # List of the tags attached to this secret
82
+ # Add tags attached to this object
83
83
  attr_accessor :tags
84
84
 
85
85
  # Target name
@@ -67,7 +67,7 @@ module Akeyless
67
67
  # Enable Web Secure Remote Access
68
68
  attr_accessor :secure_access_web
69
69
 
70
- # List of the tags attached to this secret
70
+ # Add tags attached to this object
71
71
  attr_accessor :tags
72
72
 
73
73
  # Target name
@@ -76,7 +76,7 @@ module Akeyless
76
76
  # SSL connection certificate
77
77
  attr_accessor :ssl_certificate
78
78
 
79
- # List of the tags attached to this secret
79
+ # Add tags attached to this object
80
80
  attr_accessor :tags
81
81
 
82
82
  # Target name
@@ -85,7 +85,7 @@ module Akeyless
85
85
  # Web-Proxy via Akeyless Web Access Bastion
86
86
  attr_accessor :secure_access_web_proxy
87
87
 
88
- # List of the tags attached to this secret
88
+ # Add tags attached to this object
89
89
  attr_accessor :tags
90
90
 
91
91
  # Target name
@@ -67,7 +67,7 @@ module Akeyless
67
67
  # Enable Web Secure Remote Access
68
68
  attr_accessor :secure_access_web
69
69
 
70
- # List of the tags attached to this secret
70
+ # Add tags attached to this object
71
71
  attr_accessor :tags
72
72
 
73
73
  # Target name
@@ -79,7 +79,7 @@ module Akeyless
79
79
  # Dynamic producer encryption key
80
80
  attr_accessor :producer_encryption_key_name
81
81
 
82
- # List of the tags attached to this secret
82
+ # Add tags attached to this object
83
83
  attr_accessor :tags
84
84
 
85
85
  # Target name
@@ -70,7 +70,7 @@ module Akeyless
70
70
  # Enable/Disable SSL [true/false]
71
71
  attr_accessor :ssl
72
72
 
73
- # List of the tags attached to this secret
73
+ # Add tags attached to this object
74
74
  attr_accessor :tags
75
75
 
76
76
  # Target name
@@ -70,7 +70,7 @@ module Akeyless
70
70
  # Web-Proxy via Akeyless Web Access Bastion
71
71
  attr_accessor :secure_access_web_proxy
72
72
 
73
- # List of the tags attached to this secret
73
+ # Add tags attached to this object
74
74
  attr_accessor :tags
75
75
 
76
76
  # Target name
@@ -67,7 +67,7 @@ module Akeyless
67
67
  # Override the RDP Domain username
68
68
  attr_accessor :secure_access_rdp_user
69
69
 
70
- # List of the tags attached to this secret
70
+ # Add tags attached to this object
71
71
  attr_accessor :tags
72
72
 
73
73
  # Target name
@@ -58,7 +58,7 @@ module Akeyless
58
58
  # Enable/Disable SSL [true/false]
59
59
  attr_accessor :ssl
60
60
 
61
- # List of the tags attached to this secret
61
+ # Add tags attached to this object
62
62
  attr_accessor :tags
63
63
 
64
64
  # Target name
@@ -49,7 +49,7 @@ module Akeyless
49
49
  # User role
50
50
  attr_accessor :role
51
51
 
52
- # List of the tags attached to this secret
52
+ # Add tags attached to this object
53
53
  attr_accessor :tags
54
54
 
55
55
  # Target name
@@ -22,6 +22,8 @@ module Akeyless
22
22
 
23
23
  attr_accessor :display_name
24
24
 
25
+ attr_accessor :enable_sni_proxy
26
+
25
27
  attr_accessor :enable_tls
26
28
 
27
29
  attr_accessor :enable_tls_configure
@@ -44,6 +46,7 @@ module Akeyless
44
46
  :'akeyless_url' => :'akeyless_url',
45
47
  :'api_token_ttl' => :'api_token_ttl',
46
48
  :'display_name' => :'display_name',
49
+ :'enable_sni_proxy' => :'enable_sni_proxy',
47
50
  :'enable_tls' => :'enable_tls',
48
51
  :'enable_tls_configure' => :'enable_tls_configure',
49
52
  :'enable_tls_curl' => :'enable_tls_curl',
@@ -66,6 +69,7 @@ module Akeyless
66
69
  :'akeyless_url' => :'String',
67
70
  :'api_token_ttl' => :'String',
68
71
  :'display_name' => :'String',
72
+ :'enable_sni_proxy' => :'Boolean',
69
73
  :'enable_tls' => :'Boolean',
70
74
  :'enable_tls_configure' => :'Boolean',
71
75
  :'enable_tls_curl' => :'Boolean',
@@ -110,6 +114,10 @@ module Akeyless
110
114
  self.display_name = attributes[:'display_name']
111
115
  end
112
116
 
117
+ if attributes.key?(:'enable_sni_proxy')
118
+ self.enable_sni_proxy = attributes[:'enable_sni_proxy']
119
+ end
120
+
113
121
  if attributes.key?(:'enable_tls')
114
122
  self.enable_tls = attributes[:'enable_tls']
115
123
  end
@@ -164,6 +172,7 @@ module Akeyless
164
172
  akeyless_url == o.akeyless_url &&
165
173
  api_token_ttl == o.api_token_ttl &&
166
174
  display_name == o.display_name &&
175
+ enable_sni_proxy == o.enable_sni_proxy &&
167
176
  enable_tls == o.enable_tls &&
168
177
  enable_tls_configure == o.enable_tls_configure &&
169
178
  enable_tls_curl == o.enable_tls_curl &&
@@ -183,7 +192,7 @@ module Akeyless
183
192
  # Calculates hash code according to all attributes.
184
193
  # @return [Integer] Hash code
185
194
  def hash
186
- [akeyless_url, api_token_ttl, display_name, enable_tls, enable_tls_configure, enable_tls_curl, enable_tls_hvp, gw_cluster_url, tcp_port, tls_cert, tls_key].hash
195
+ [akeyless_url, api_token_ttl, display_name, enable_sni_proxy, enable_tls, enable_tls_configure, enable_tls_curl, enable_tls_hvp, gw_cluster_url, tcp_port, tls_cert, tls_key].hash
187
196
  end
188
197
 
189
198
  # Builds the object from hash
@@ -0,0 +1,304 @@
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.5.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ # importPasswords is a command that import passwords
18
+ class ImportPasswords
19
+ # for personal password manager
20
+ attr_accessor :accessibility
21
+
22
+ # Password format type [LastPass/Chrome/Firefox]
23
+ attr_accessor :format
24
+
25
+ # File path
26
+ attr_accessor :import_path
27
+
28
+ # Set output format to JSON
29
+ attr_accessor :json
30
+
31
+ # The name of a key that used to encrypt the secret value (if empty, the account default protectionKey key will be used)
32
+ attr_accessor :protection_key
33
+
34
+ # Target folder for imported passwords
35
+ attr_accessor :target_folder
36
+
37
+ # Authentication token (see `/auth` and `/configure`)
38
+ attr_accessor :token
39
+
40
+ # The universal identity token, Required only for universal_identity authentication
41
+ attr_accessor :uid_token
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'accessibility' => :'accessibility',
47
+ :'format' => :'format',
48
+ :'import_path' => :'import-path',
49
+ :'json' => :'json',
50
+ :'protection_key' => :'protection_key',
51
+ :'target_folder' => :'target-folder',
52
+ :'token' => :'token',
53
+ :'uid_token' => :'uid-token'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'accessibility' => :'String',
66
+ :'format' => :'String',
67
+ :'import_path' => :'String',
68
+ :'json' => :'Boolean',
69
+ :'protection_key' => :'String',
70
+ :'target_folder' => :'String',
71
+ :'token' => :'String',
72
+ :'uid_token' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::ImportPasswords` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::ImportPasswords`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'accessibility')
98
+ self.accessibility = attributes[:'accessibility']
99
+ else
100
+ self.accessibility = 'personal'
101
+ end
102
+
103
+ if attributes.key?(:'format')
104
+ self.format = attributes[:'format']
105
+ else
106
+ self.format = 'LastPass'
107
+ end
108
+
109
+ if attributes.key?(:'import_path')
110
+ self.import_path = attributes[:'import_path']
111
+ end
112
+
113
+ if attributes.key?(:'json')
114
+ self.json = attributes[:'json']
115
+ else
116
+ self.json = false
117
+ end
118
+
119
+ if attributes.key?(:'protection_key')
120
+ self.protection_key = attributes[:'protection_key']
121
+ end
122
+
123
+ if attributes.key?(:'target_folder')
124
+ self.target_folder = attributes[:'target_folder']
125
+ else
126
+ self.target_folder = '/'
127
+ end
128
+
129
+ if attributes.key?(:'token')
130
+ self.token = attributes[:'token']
131
+ end
132
+
133
+ if attributes.key?(:'uid_token')
134
+ self.uid_token = attributes[:'uid_token']
135
+ end
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ invalid_properties = Array.new
142
+ if @import_path.nil?
143
+ invalid_properties.push('invalid value for "import_path", import_path cannot be nil.')
144
+ end
145
+
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ return false if @import_path.nil?
153
+ true
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ accessibility == o.accessibility &&
162
+ format == o.format &&
163
+ import_path == o.import_path &&
164
+ json == o.json &&
165
+ protection_key == o.protection_key &&
166
+ target_folder == o.target_folder &&
167
+ token == o.token &&
168
+ uid_token == o.uid_token
169
+ end
170
+
171
+ # @see the `==` method
172
+ # @param [Object] Object to be compared
173
+ def eql?(o)
174
+ self == o
175
+ end
176
+
177
+ # Calculates hash code according to all attributes.
178
+ # @return [Integer] Hash code
179
+ def hash
180
+ [accessibility, format, import_path, json, protection_key, target_folder, token, uid_token].hash
181
+ end
182
+
183
+ # Builds the object from hash
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ # @return [Object] Returns the model itself
186
+ def self.build_from_hash(attributes)
187
+ new.build_from_hash(attributes)
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ attributes = attributes.transform_keys(&:to_sym)
196
+ self.class.openapi_types.each_pair do |key, type|
197
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
198
+ self.send("#{key}=", nil)
199
+ elsif type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
203
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
204
+ end
205
+ elsif !attributes[self.class.attribute_map[key]].nil?
206
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
+ end
208
+ end
209
+
210
+ self
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def _deserialize(type, value)
218
+ case type.to_sym
219
+ when :Time
220
+ Time.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :Boolean
230
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ # models (e.g. Pet) or oneOf
251
+ klass = Akeyless.const_get(type)
252
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
253
+ end
254
+ end
255
+
256
+ # Returns the string representation of the object
257
+ # @return [String] String presentation of the object
258
+ def to_s
259
+ to_hash.to_s
260
+ end
261
+
262
+ # to_body is an alias to to_hash (backward compatibility)
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_body
265
+ to_hash
266
+ end
267
+
268
+ # Returns the object in the form of hash
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_hash
271
+ hash = {}
272
+ self.class.attribute_map.each_pair do |attr, param|
273
+ value = self.send(attr)
274
+ if value.nil?
275
+ is_nullable = self.class.openapi_nullable.include?(attr)
276
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
277
+ end
278
+
279
+ hash[param] = _to_hash(value)
280
+ end
281
+ hash
282
+ end
283
+
284
+ # Outputs non-array value in the form of hash
285
+ # For object, use to_hash. Otherwise, just return the value
286
+ # @param [Object] value Any valid value
287
+ # @return [Hash] Returns the value in the form of hash
288
+ def _to_hash(value)
289
+ if value.is_a?(Array)
290
+ value.compact.map { |v| _to_hash(v) }
291
+ elsif value.is_a?(Hash)
292
+ {}.tap do |hash|
293
+ value.each { |k, v| hash[k] = _to_hash(v) }
294
+ end
295
+ elsif value.respond_to? :to_hash
296
+ value.to_hash
297
+ else
298
+ value
299
+ end
300
+ end
301
+
302
+ end
303
+
304
+ end