akeyless 3.3.13 → 3.3.15
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.
- checksums.yaml +4 -4
- data/README.md +10 -6
- data/docs/CreateAuthMethodOAuth2.md +0 -2
- data/docs/GatewayCreateAllowedAccess.md +32 -0
- data/docs/GatewayDeleteAllowedAccess.md +24 -0
- data/docs/GatewayGetAllowedAccess.md +24 -0
- data/docs/GatewayUpdateAllowedAccess.md +34 -0
- data/docs/GenerateCsr.md +56 -0
- data/docs/GenerateCsrOutput.md +18 -0
- data/docs/UpdateAuthMethodOAuth2.md +0 -2
- data/docs/V2Api.md +73 -10
- data/lib/akeyless/api/v2_api.rb +74 -10
- data/lib/akeyless/models/create_auth_method_o_auth2.rb +1 -11
- data/lib/akeyless/models/gateway_create_allowed_access.rb +305 -0
- data/lib/akeyless/models/gateway_delete_allowed_access.rb +258 -0
- data/lib/akeyless/models/gateway_get_allowed_access.rb +258 -0
- data/lib/akeyless/models/gateway_update_allowed_access.rb +315 -0
- data/lib/akeyless/models/generate_csr.rb +421 -0
- data/lib/akeyless/models/generate_csr_output.rb +219 -0
- data/lib/akeyless/models/oidc_client_info.rb +1 -1
- data/lib/akeyless/models/update_auth_method_o_auth2.rb +1 -11
- data/lib/akeyless/version.rb +1 -1
- data/lib/akeyless.rb +6 -3
- data/spec/models/gateway_create_allowed_access_spec.rb +76 -0
- data/spec/models/gateway_delete_allowed_access_spec.rb +52 -0
- data/spec/models/gateway_get_allowed_access_spec.rb +52 -0
- data/spec/models/gateway_update_allowed_access_spec.rb +82 -0
- data/spec/models/generate_csr_output_spec.rb +34 -0
- data/spec/models/generate_csr_spec.rb +148 -0
- metadata +26 -2
@@ -43,9 +43,6 @@ module Akeyless
|
|
43
43
|
# The JSON Web Key Set (JWKS) that containing the public keys that should be used to verify any JSON Web Token (JWT) issued by the authorization server. base64 encoded string
|
44
44
|
attr_accessor :jwks_json_data
|
45
45
|
|
46
|
-
# JSON Web Key Set (JWKS) JSON file path that will be used to verify any JSON Web Token (JWT) issued by the authorization server.
|
47
|
-
attr_accessor :jwks_json_file
|
48
|
-
|
49
46
|
# The URL to the JSON Web Key Set (JWKS) that containing the public keys that should be used to verify any JSON Web Token (JWT) issued by the authorization server.
|
50
47
|
attr_accessor :jwks_uri
|
51
48
|
|
@@ -76,7 +73,6 @@ module Akeyless
|
|
76
73
|
:'issuer' => :'issuer',
|
77
74
|
:'json' => :'json',
|
78
75
|
:'jwks_json_data' => :'jwks-json-data',
|
79
|
-
:'jwks_json_file' => :'jwks-json-file',
|
80
76
|
:'jwks_uri' => :'jwks-uri',
|
81
77
|
:'jwt_ttl' => :'jwt-ttl',
|
82
78
|
:'name' => :'name',
|
@@ -103,7 +99,6 @@ module Akeyless
|
|
103
99
|
:'issuer' => :'String',
|
104
100
|
:'json' => :'Boolean',
|
105
101
|
:'jwks_json_data' => :'String',
|
106
|
-
:'jwks_json_file' => :'String',
|
107
102
|
:'jwks_uri' => :'String',
|
108
103
|
:'jwt_ttl' => :'Integer',
|
109
104
|
:'name' => :'String',
|
@@ -180,10 +175,6 @@ module Akeyless
|
|
180
175
|
self.jwks_json_data = attributes[:'jwks_json_data']
|
181
176
|
end
|
182
177
|
|
183
|
-
if attributes.key?(:'jwks_json_file')
|
184
|
-
self.jwks_json_file = attributes[:'jwks_json_file']
|
185
|
-
end
|
186
|
-
|
187
178
|
if attributes.key?(:'jwks_uri')
|
188
179
|
self.jwks_uri = attributes[:'jwks_uri']
|
189
180
|
else
|
@@ -255,7 +246,6 @@ module Akeyless
|
|
255
246
|
issuer == o.issuer &&
|
256
247
|
json == o.json &&
|
257
248
|
jwks_json_data == o.jwks_json_data &&
|
258
|
-
jwks_json_file == o.jwks_json_file &&
|
259
249
|
jwks_uri == o.jwks_uri &&
|
260
250
|
jwt_ttl == o.jwt_ttl &&
|
261
251
|
name == o.name &&
|
@@ -273,7 +263,7 @@ module Akeyless
|
|
273
263
|
# Calculates hash code according to all attributes.
|
274
264
|
# @return [Integer] Hash code
|
275
265
|
def hash
|
276
|
-
[access_expires, audience, bound_client_ids, bound_ips, force_sub_claims, gw_bound_ips, issuer, json, jwks_json_data,
|
266
|
+
[access_expires, audience, bound_client_ids, bound_ips, force_sub_claims, gw_bound_ips, issuer, json, jwks_json_data, jwks_uri, jwt_ttl, name, token, uid_token, unique_identifier].hash
|
277
267
|
end
|
278
268
|
|
279
269
|
# Builds the object from hash
|
@@ -0,0 +1,305 @@
|
|
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: 7.0.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Akeyless
|
17
|
+
# gatewayCreateAllowedAccess is a command that creates allowed access in Gator
|
18
|
+
class GatewayCreateAllowedAccess
|
19
|
+
# Access ID The access id to be attached to this allowed access. Auth method with this access id should already exist.
|
20
|
+
attr_accessor :access_id
|
21
|
+
|
22
|
+
# Allowed access description
|
23
|
+
attr_accessor :description
|
24
|
+
|
25
|
+
# Set output format to JSON
|
26
|
+
attr_accessor :json
|
27
|
+
|
28
|
+
# Allowed access name
|
29
|
+
attr_accessor :name
|
30
|
+
|
31
|
+
# Permissions Comma-seperated list of permissions for this allowed access. Available permissions: [defaults,targets,classic_keys,automatic_migration,ldap_auth,dynamic_secret,k8s_auth,log_forwarding,zero_knowledge_encryption,rotated_secret,caching,event_forwarding,admin,kmip,general]
|
32
|
+
attr_accessor :permissions
|
33
|
+
|
34
|
+
# Sub claims key/val of sub claims, e.g group=admins,developers
|
35
|
+
attr_accessor :sub_claims
|
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
|
+
:'access_id' => :'access-id',
|
47
|
+
:'description' => :'description',
|
48
|
+
:'json' => :'json',
|
49
|
+
:'name' => :'name',
|
50
|
+
:'permissions' => :'permissions',
|
51
|
+
:'sub_claims' => :'sub-claims',
|
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
|
+
:'access_id' => :'String',
|
66
|
+
:'description' => :'String',
|
67
|
+
:'json' => :'Boolean',
|
68
|
+
:'name' => :'String',
|
69
|
+
:'permissions' => :'String',
|
70
|
+
:'sub_claims' => :'Hash<String, 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::GatewayCreateAllowedAccess` 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::GatewayCreateAllowedAccess`. 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?(:'access_id')
|
98
|
+
self.access_id = attributes[:'access_id']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'description')
|
102
|
+
self.description = attributes[:'description']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'json')
|
106
|
+
self.json = attributes[:'json']
|
107
|
+
else
|
108
|
+
self.json = false
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'name')
|
112
|
+
self.name = attributes[:'name']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'permissions')
|
116
|
+
self.permissions = attributes[:'permissions']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'sub_claims')
|
120
|
+
if (value = attributes[:'sub_claims']).is_a?(Hash)
|
121
|
+
self.sub_claims = value
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'token')
|
126
|
+
self.token = attributes[:'token']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'uid_token')
|
130
|
+
self.uid_token = attributes[:'uid_token']
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
135
|
+
# @return Array for valid properties with the reasons
|
136
|
+
def list_invalid_properties
|
137
|
+
invalid_properties = Array.new
|
138
|
+
if @access_id.nil?
|
139
|
+
invalid_properties.push('invalid value for "access_id", access_id cannot be nil.')
|
140
|
+
end
|
141
|
+
|
142
|
+
if @name.nil?
|
143
|
+
invalid_properties.push('invalid value for "name", name 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 @access_id.nil?
|
153
|
+
return false if @name.nil?
|
154
|
+
true
|
155
|
+
end
|
156
|
+
|
157
|
+
# Checks equality by comparing each attribute.
|
158
|
+
# @param [Object] Object to be compared
|
159
|
+
def ==(o)
|
160
|
+
return true if self.equal?(o)
|
161
|
+
self.class == o.class &&
|
162
|
+
access_id == o.access_id &&
|
163
|
+
description == o.description &&
|
164
|
+
json == o.json &&
|
165
|
+
name == o.name &&
|
166
|
+
permissions == o.permissions &&
|
167
|
+
sub_claims == o.sub_claims &&
|
168
|
+
token == o.token &&
|
169
|
+
uid_token == o.uid_token
|
170
|
+
end
|
171
|
+
|
172
|
+
# @see the `==` method
|
173
|
+
# @param [Object] Object to be compared
|
174
|
+
def eql?(o)
|
175
|
+
self == o
|
176
|
+
end
|
177
|
+
|
178
|
+
# Calculates hash code according to all attributes.
|
179
|
+
# @return [Integer] Hash code
|
180
|
+
def hash
|
181
|
+
[access_id, description, json, name, permissions, sub_claims, token, uid_token].hash
|
182
|
+
end
|
183
|
+
|
184
|
+
# Builds the object from hash
|
185
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
186
|
+
# @return [Object] Returns the model itself
|
187
|
+
def self.build_from_hash(attributes)
|
188
|
+
new.build_from_hash(attributes)
|
189
|
+
end
|
190
|
+
|
191
|
+
# Builds the object from hash
|
192
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
193
|
+
# @return [Object] Returns the model itself
|
194
|
+
def build_from_hash(attributes)
|
195
|
+
return nil unless attributes.is_a?(Hash)
|
196
|
+
attributes = attributes.transform_keys(&:to_sym)
|
197
|
+
self.class.openapi_types.each_pair do |key, type|
|
198
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
199
|
+
self.send("#{key}=", nil)
|
200
|
+
elsif type =~ /\AArray<(.*)>/i
|
201
|
+
# check to ensure the input is an array given that the attribute
|
202
|
+
# is documented as an array but the input is not
|
203
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
204
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
205
|
+
end
|
206
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
207
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
self
|
212
|
+
end
|
213
|
+
|
214
|
+
# Deserializes the data based on type
|
215
|
+
# @param string type Data type
|
216
|
+
# @param string value Value to be deserialized
|
217
|
+
# @return [Object] Deserialized data
|
218
|
+
def _deserialize(type, value)
|
219
|
+
case type.to_sym
|
220
|
+
when :Time
|
221
|
+
Time.parse(value)
|
222
|
+
when :Date
|
223
|
+
Date.parse(value)
|
224
|
+
when :String
|
225
|
+
value.to_s
|
226
|
+
when :Integer
|
227
|
+
value.to_i
|
228
|
+
when :Float
|
229
|
+
value.to_f
|
230
|
+
when :Boolean
|
231
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
232
|
+
true
|
233
|
+
else
|
234
|
+
false
|
235
|
+
end
|
236
|
+
when :Object
|
237
|
+
# generic object (usually a Hash), return directly
|
238
|
+
value
|
239
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
240
|
+
inner_type = Regexp.last_match[:inner_type]
|
241
|
+
value.map { |v| _deserialize(inner_type, v) }
|
242
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
243
|
+
k_type = Regexp.last_match[:k_type]
|
244
|
+
v_type = Regexp.last_match[:v_type]
|
245
|
+
{}.tap do |hash|
|
246
|
+
value.each do |k, v|
|
247
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
else # model
|
251
|
+
# models (e.g. Pet) or oneOf
|
252
|
+
klass = Akeyless.const_get(type)
|
253
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
# Returns the string representation of the object
|
258
|
+
# @return [String] String presentation of the object
|
259
|
+
def to_s
|
260
|
+
to_hash.to_s
|
261
|
+
end
|
262
|
+
|
263
|
+
# to_body is an alias to to_hash (backward compatibility)
|
264
|
+
# @return [Hash] Returns the object in the form of hash
|
265
|
+
def to_body
|
266
|
+
to_hash
|
267
|
+
end
|
268
|
+
|
269
|
+
# Returns the object in the form of hash
|
270
|
+
# @return [Hash] Returns the object in the form of hash
|
271
|
+
def to_hash
|
272
|
+
hash = {}
|
273
|
+
self.class.attribute_map.each_pair do |attr, param|
|
274
|
+
value = self.send(attr)
|
275
|
+
if value.nil?
|
276
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
277
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
278
|
+
end
|
279
|
+
|
280
|
+
hash[param] = _to_hash(value)
|
281
|
+
end
|
282
|
+
hash
|
283
|
+
end
|
284
|
+
|
285
|
+
# Outputs non-array value in the form of hash
|
286
|
+
# For object, use to_hash. Otherwise, just return the value
|
287
|
+
# @param [Object] value Any valid value
|
288
|
+
# @return [Hash] Returns the value in the form of hash
|
289
|
+
def _to_hash(value)
|
290
|
+
if value.is_a?(Array)
|
291
|
+
value.compact.map { |v| _to_hash(v) }
|
292
|
+
elsif value.is_a?(Hash)
|
293
|
+
{}.tap do |hash|
|
294
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
295
|
+
end
|
296
|
+
elsif value.respond_to? :to_hash
|
297
|
+
value.to_hash
|
298
|
+
else
|
299
|
+
value
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
end
|
304
|
+
|
305
|
+
end
|
@@ -0,0 +1,258 @@
|
|
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: 7.0.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Akeyless
|
17
|
+
# gatewayDeleteAllowedAccess is a command that deletes allowed access from gateway
|
18
|
+
class GatewayDeleteAllowedAccess
|
19
|
+
# Set output format to JSON
|
20
|
+
attr_accessor :json
|
21
|
+
|
22
|
+
# Allowed access name to delete
|
23
|
+
attr_accessor :name
|
24
|
+
|
25
|
+
# Authentication token (see `/auth` and `/configure`)
|
26
|
+
attr_accessor :token
|
27
|
+
|
28
|
+
# The universal identity token, Required only for universal_identity authentication
|
29
|
+
attr_accessor :uid_token
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'json' => :'json',
|
35
|
+
:'name' => :'name',
|
36
|
+
:'token' => :'token',
|
37
|
+
:'uid_token' => :'uid-token'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns all the JSON keys this model knows about
|
42
|
+
def self.acceptable_attributes
|
43
|
+
attribute_map.values
|
44
|
+
end
|
45
|
+
|
46
|
+
# Attribute type mapping.
|
47
|
+
def self.openapi_types
|
48
|
+
{
|
49
|
+
:'json' => :'Boolean',
|
50
|
+
:'name' => :'String',
|
51
|
+
:'token' => :'String',
|
52
|
+
:'uid_token' => :'String'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# List of attributes with nullable: true
|
57
|
+
def self.openapi_nullable
|
58
|
+
Set.new([
|
59
|
+
])
|
60
|
+
end
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
def initialize(attributes = {})
|
65
|
+
if (!attributes.is_a?(Hash))
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::GatewayDeleteAllowedAccess` initialize method"
|
67
|
+
end
|
68
|
+
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
71
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::GatewayDeleteAllowedAccess`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
73
|
+
end
|
74
|
+
h[k.to_sym] = v
|
75
|
+
}
|
76
|
+
|
77
|
+
if attributes.key?(:'json')
|
78
|
+
self.json = attributes[:'json']
|
79
|
+
else
|
80
|
+
self.json = false
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'name')
|
84
|
+
self.name = attributes[:'name']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'token')
|
88
|
+
self.token = attributes[:'token']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'uid_token')
|
92
|
+
self.uid_token = attributes[:'uid_token']
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
97
|
+
# @return Array for valid properties with the reasons
|
98
|
+
def list_invalid_properties
|
99
|
+
invalid_properties = Array.new
|
100
|
+
if @name.nil?
|
101
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
102
|
+
end
|
103
|
+
|
104
|
+
invalid_properties
|
105
|
+
end
|
106
|
+
|
107
|
+
# Check to see if the all the properties in the model are valid
|
108
|
+
# @return true if the model is valid
|
109
|
+
def valid?
|
110
|
+
return false if @name.nil?
|
111
|
+
true
|
112
|
+
end
|
113
|
+
|
114
|
+
# Checks equality by comparing each attribute.
|
115
|
+
# @param [Object] Object to be compared
|
116
|
+
def ==(o)
|
117
|
+
return true if self.equal?(o)
|
118
|
+
self.class == o.class &&
|
119
|
+
json == o.json &&
|
120
|
+
name == o.name &&
|
121
|
+
token == o.token &&
|
122
|
+
uid_token == o.uid_token
|
123
|
+
end
|
124
|
+
|
125
|
+
# @see the `==` method
|
126
|
+
# @param [Object] Object to be compared
|
127
|
+
def eql?(o)
|
128
|
+
self == o
|
129
|
+
end
|
130
|
+
|
131
|
+
# Calculates hash code according to all attributes.
|
132
|
+
# @return [Integer] Hash code
|
133
|
+
def hash
|
134
|
+
[json, name, token, uid_token].hash
|
135
|
+
end
|
136
|
+
|
137
|
+
# Builds the object from hash
|
138
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
139
|
+
# @return [Object] Returns the model itself
|
140
|
+
def self.build_from_hash(attributes)
|
141
|
+
new.build_from_hash(attributes)
|
142
|
+
end
|
143
|
+
|
144
|
+
# Builds the object from hash
|
145
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
146
|
+
# @return [Object] Returns the model itself
|
147
|
+
def build_from_hash(attributes)
|
148
|
+
return nil unless attributes.is_a?(Hash)
|
149
|
+
attributes = attributes.transform_keys(&:to_sym)
|
150
|
+
self.class.openapi_types.each_pair do |key, type|
|
151
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
152
|
+
self.send("#{key}=", nil)
|
153
|
+
elsif type =~ /\AArray<(.*)>/i
|
154
|
+
# check to ensure the input is an array given that the attribute
|
155
|
+
# is documented as an array but the input is not
|
156
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
157
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
158
|
+
end
|
159
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
160
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
self
|
165
|
+
end
|
166
|
+
|
167
|
+
# Deserializes the data based on type
|
168
|
+
# @param string type Data type
|
169
|
+
# @param string value Value to be deserialized
|
170
|
+
# @return [Object] Deserialized data
|
171
|
+
def _deserialize(type, value)
|
172
|
+
case type.to_sym
|
173
|
+
when :Time
|
174
|
+
Time.parse(value)
|
175
|
+
when :Date
|
176
|
+
Date.parse(value)
|
177
|
+
when :String
|
178
|
+
value.to_s
|
179
|
+
when :Integer
|
180
|
+
value.to_i
|
181
|
+
when :Float
|
182
|
+
value.to_f
|
183
|
+
when :Boolean
|
184
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
185
|
+
true
|
186
|
+
else
|
187
|
+
false
|
188
|
+
end
|
189
|
+
when :Object
|
190
|
+
# generic object (usually a Hash), return directly
|
191
|
+
value
|
192
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
193
|
+
inner_type = Regexp.last_match[:inner_type]
|
194
|
+
value.map { |v| _deserialize(inner_type, v) }
|
195
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
196
|
+
k_type = Regexp.last_match[:k_type]
|
197
|
+
v_type = Regexp.last_match[:v_type]
|
198
|
+
{}.tap do |hash|
|
199
|
+
value.each do |k, v|
|
200
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
else # model
|
204
|
+
# models (e.g. Pet) or oneOf
|
205
|
+
klass = Akeyless.const_get(type)
|
206
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# Returns the string representation of the object
|
211
|
+
# @return [String] String presentation of the object
|
212
|
+
def to_s
|
213
|
+
to_hash.to_s
|
214
|
+
end
|
215
|
+
|
216
|
+
# to_body is an alias to to_hash (backward compatibility)
|
217
|
+
# @return [Hash] Returns the object in the form of hash
|
218
|
+
def to_body
|
219
|
+
to_hash
|
220
|
+
end
|
221
|
+
|
222
|
+
# Returns the object in the form of hash
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
224
|
+
def to_hash
|
225
|
+
hash = {}
|
226
|
+
self.class.attribute_map.each_pair do |attr, param|
|
227
|
+
value = self.send(attr)
|
228
|
+
if value.nil?
|
229
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
230
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
231
|
+
end
|
232
|
+
|
233
|
+
hash[param] = _to_hash(value)
|
234
|
+
end
|
235
|
+
hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Outputs non-array value in the form of hash
|
239
|
+
# For object, use to_hash. Otherwise, just return the value
|
240
|
+
# @param [Object] value Any valid value
|
241
|
+
# @return [Hash] Returns the value in the form of hash
|
242
|
+
def _to_hash(value)
|
243
|
+
if value.is_a?(Array)
|
244
|
+
value.compact.map { |v| _to_hash(v) }
|
245
|
+
elsif value.is_a?(Hash)
|
246
|
+
{}.tap do |hash|
|
247
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
248
|
+
end
|
249
|
+
elsif value.respond_to? :to_hash
|
250
|
+
value.to_hash
|
251
|
+
else
|
252
|
+
value
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|