akeyless 3.6.0 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/docs/Auth.md +4 -0
- data/docs/AuthMethodAccessInfo.md +2 -0
- data/docs/Configure.md +5 -1
- data/docs/CreateAuthMethodOCI.md +40 -0
- data/docs/CreateAuthMethodOCIOutput.md +18 -0
- data/docs/OCIAccessRules.md +20 -0
- data/docs/UpdateAuthMethodOCI.md +42 -0
- data/docs/UpdateAuthMethodOCIOutput.md +18 -0
- data/docs/V2Api.md +126 -0
- data/lib/akeyless/api/v2_api.rb +128 -0
- data/lib/akeyless/models/auth.rb +25 -1
- data/lib/akeyless/models/auth_method_access_info.rb +10 -1
- data/lib/akeyless/models/configure.rb +28 -4
- data/lib/akeyless/models/create_auth_method_oci.rb +359 -0
- data/lib/akeyless/models/create_auth_method_oci_output.rb +214 -0
- data/lib/akeyless/models/oci_access_rules.rb +226 -0
- data/lib/akeyless/models/update_auth_method_oci.rb +369 -0
- data/lib/akeyless/models/update_auth_method_oci_output.rb +214 -0
- data/lib/akeyless/version.rb +1 -1
- data/lib/akeyless.rb +5 -0
- data/spec/models/create_auth_method_oci_output_spec.rb +36 -0
- data/spec/models/create_auth_method_oci_spec.rb +102 -0
- data/spec/models/oci_access_rules_spec.rb +42 -0
- data/spec/models/update_auth_method_oci_output_spec.rb +36 -0
- data/spec/models/update_auth_method_oci_spec.rb +108 -0
- metadata +21 -1
@@ -0,0 +1,226 @@
|
|
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.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Akeyless
|
17
|
+
# OCIAccessRules contains access rules specific to Oracle cloud instance / user authentication
|
18
|
+
class OCIAccessRules
|
19
|
+
attr_accessor :group_ocids
|
20
|
+
|
21
|
+
attr_accessor :tenant_ocid
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'group_ocids' => :'group_ocids',
|
27
|
+
:'tenant_ocid' => :'tenant_ocid'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns all the JSON keys this model knows about
|
32
|
+
def self.acceptable_attributes
|
33
|
+
attribute_map.values
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.openapi_types
|
38
|
+
{
|
39
|
+
:'group_ocids' => :'Array<String>',
|
40
|
+
:'tenant_ocid' => :'String'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# List of attributes with nullable: true
|
45
|
+
def self.openapi_nullable
|
46
|
+
Set.new([
|
47
|
+
])
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::OCIAccessRules` initialize method"
|
55
|
+
end
|
56
|
+
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::OCIAccessRules`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
+
end
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:'group_ocids')
|
66
|
+
if (value = attributes[:'group_ocids']).is_a?(Array)
|
67
|
+
self.group_ocids = value
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.key?(:'tenant_ocid')
|
72
|
+
self.tenant_ocid = attributes[:'tenant_ocid']
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
77
|
+
# @return Array for valid properties with the reasons
|
78
|
+
def list_invalid_properties
|
79
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
80
|
+
invalid_properties = Array.new
|
81
|
+
invalid_properties
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check to see if the all the properties in the model are valid
|
85
|
+
# @return true if the model is valid
|
86
|
+
def valid?
|
87
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
88
|
+
true
|
89
|
+
end
|
90
|
+
|
91
|
+
# Checks equality by comparing each attribute.
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def ==(o)
|
94
|
+
return true if self.equal?(o)
|
95
|
+
self.class == o.class &&
|
96
|
+
group_ocids == o.group_ocids &&
|
97
|
+
tenant_ocid == o.tenant_ocid
|
98
|
+
end
|
99
|
+
|
100
|
+
# @see the `==` method
|
101
|
+
# @param [Object] Object to be compared
|
102
|
+
def eql?(o)
|
103
|
+
self == o
|
104
|
+
end
|
105
|
+
|
106
|
+
# Calculates hash code according to all attributes.
|
107
|
+
# @return [Integer] Hash code
|
108
|
+
def hash
|
109
|
+
[group_ocids, tenant_ocid].hash
|
110
|
+
end
|
111
|
+
|
112
|
+
# Builds the object from hash
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
+
# @return [Object] Returns the model itself
|
115
|
+
def self.build_from_hash(attributes)
|
116
|
+
return nil unless attributes.is_a?(Hash)
|
117
|
+
attributes = attributes.transform_keys(&:to_sym)
|
118
|
+
transformed_hash = {}
|
119
|
+
openapi_types.each_pair do |key, type|
|
120
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
121
|
+
transformed_hash["#{key}"] = nil
|
122
|
+
elsif type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
126
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
127
|
+
end
|
128
|
+
elsif !attributes[attribute_map[key]].nil?
|
129
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
130
|
+
end
|
131
|
+
end
|
132
|
+
new(transformed_hash)
|
133
|
+
end
|
134
|
+
|
135
|
+
# Deserializes the data based on type
|
136
|
+
# @param string type Data type
|
137
|
+
# @param string value Value to be deserialized
|
138
|
+
# @return [Object] Deserialized data
|
139
|
+
def self._deserialize(type, value)
|
140
|
+
case type.to_sym
|
141
|
+
when :Time
|
142
|
+
Time.parse(value)
|
143
|
+
when :Date
|
144
|
+
Date.parse(value)
|
145
|
+
when :String
|
146
|
+
value.to_s
|
147
|
+
when :Integer
|
148
|
+
value.to_i
|
149
|
+
when :Float
|
150
|
+
value.to_f
|
151
|
+
when :Boolean
|
152
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
153
|
+
true
|
154
|
+
else
|
155
|
+
false
|
156
|
+
end
|
157
|
+
when :Object
|
158
|
+
# generic object (usually a Hash), return directly
|
159
|
+
value
|
160
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
161
|
+
inner_type = Regexp.last_match[:inner_type]
|
162
|
+
value.map { |v| _deserialize(inner_type, v) }
|
163
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
164
|
+
k_type = Regexp.last_match[:k_type]
|
165
|
+
v_type = Regexp.last_match[:v_type]
|
166
|
+
{}.tap do |hash|
|
167
|
+
value.each do |k, v|
|
168
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
else # model
|
172
|
+
# models (e.g. Pet) or oneOf
|
173
|
+
klass = Akeyless.const_get(type)
|
174
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the string representation of the object
|
179
|
+
# @return [String] String presentation of the object
|
180
|
+
def to_s
|
181
|
+
to_hash.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_body
|
187
|
+
to_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the object in the form of hash
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_hash
|
193
|
+
hash = {}
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
195
|
+
value = self.send(attr)
|
196
|
+
if value.nil?
|
197
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
198
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
199
|
+
end
|
200
|
+
|
201
|
+
hash[param] = _to_hash(value)
|
202
|
+
end
|
203
|
+
hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# Outputs non-array value in the form of hash
|
207
|
+
# For object, use to_hash. Otherwise, just return the value
|
208
|
+
# @param [Object] value Any valid value
|
209
|
+
# @return [Hash] Returns the value in the form of hash
|
210
|
+
def _to_hash(value)
|
211
|
+
if value.is_a?(Array)
|
212
|
+
value.compact.map { |v| _to_hash(v) }
|
213
|
+
elsif value.is_a?(Hash)
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
216
|
+
end
|
217
|
+
elsif value.respond_to? :to_hash
|
218
|
+
value.to_hash
|
219
|
+
else
|
220
|
+
value
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
@@ -0,0 +1,369 @@
|
|
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.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Akeyless
|
17
|
+
# updateAuthMethodOCI is a command that updates an auth method that will be used in the account using OCI principle and groups.
|
18
|
+
class UpdateAuthMethodOCI
|
19
|
+
# Access expiration date in Unix timestamp (select 0 for access without expiry date)
|
20
|
+
attr_accessor :access_expires
|
21
|
+
|
22
|
+
# A CIDR whitelist with the IPs that the access is restricted to
|
23
|
+
attr_accessor :bound_ips
|
24
|
+
|
25
|
+
# Auth Method description
|
26
|
+
attr_accessor :description
|
27
|
+
|
28
|
+
# if true: enforce role-association must include sub claims
|
29
|
+
attr_accessor :force_sub_claims
|
30
|
+
|
31
|
+
# A list of required groups ocids
|
32
|
+
attr_accessor :group_ocid
|
33
|
+
|
34
|
+
# A CIDR whitelist with the GW IPs that the access is restricted to
|
35
|
+
attr_accessor :gw_bound_ips
|
36
|
+
|
37
|
+
# Set output format to JSON
|
38
|
+
attr_accessor :json
|
39
|
+
|
40
|
+
# Jwt TTL
|
41
|
+
attr_accessor :jwt_ttl
|
42
|
+
|
43
|
+
# Auth Method name
|
44
|
+
attr_accessor :name
|
45
|
+
|
46
|
+
# Auth Method new name
|
47
|
+
attr_accessor :new_name
|
48
|
+
|
49
|
+
# The Oracle Cloud tenant ID
|
50
|
+
attr_accessor :tenant_ocid
|
51
|
+
|
52
|
+
# Authentication token (see `/auth` and `/configure`)
|
53
|
+
attr_accessor :token
|
54
|
+
|
55
|
+
# The universal identity token, Required only for universal_identity authentication
|
56
|
+
attr_accessor :uid_token
|
57
|
+
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
59
|
+
def self.attribute_map
|
60
|
+
{
|
61
|
+
:'access_expires' => :'access-expires',
|
62
|
+
:'bound_ips' => :'bound-ips',
|
63
|
+
:'description' => :'description',
|
64
|
+
:'force_sub_claims' => :'force-sub-claims',
|
65
|
+
:'group_ocid' => :'group-ocid',
|
66
|
+
:'gw_bound_ips' => :'gw-bound-ips',
|
67
|
+
:'json' => :'json',
|
68
|
+
:'jwt_ttl' => :'jwt-ttl',
|
69
|
+
:'name' => :'name',
|
70
|
+
:'new_name' => :'new-name',
|
71
|
+
:'tenant_ocid' => :'tenant-ocid',
|
72
|
+
:'token' => :'token',
|
73
|
+
:'uid_token' => :'uid-token'
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns all the JSON keys this model knows about
|
78
|
+
def self.acceptable_attributes
|
79
|
+
attribute_map.values
|
80
|
+
end
|
81
|
+
|
82
|
+
# Attribute type mapping.
|
83
|
+
def self.openapi_types
|
84
|
+
{
|
85
|
+
:'access_expires' => :'Integer',
|
86
|
+
:'bound_ips' => :'Array<String>',
|
87
|
+
:'description' => :'String',
|
88
|
+
:'force_sub_claims' => :'Boolean',
|
89
|
+
:'group_ocid' => :'Array<String>',
|
90
|
+
:'gw_bound_ips' => :'Array<String>',
|
91
|
+
:'json' => :'Boolean',
|
92
|
+
:'jwt_ttl' => :'Integer',
|
93
|
+
:'name' => :'String',
|
94
|
+
:'new_name' => :'String',
|
95
|
+
:'tenant_ocid' => :'String',
|
96
|
+
:'token' => :'String',
|
97
|
+
:'uid_token' => :'String'
|
98
|
+
}
|
99
|
+
end
|
100
|
+
|
101
|
+
# List of attributes with nullable: true
|
102
|
+
def self.openapi_nullable
|
103
|
+
Set.new([
|
104
|
+
])
|
105
|
+
end
|
106
|
+
|
107
|
+
# Initializes the object
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
def initialize(attributes = {})
|
110
|
+
if (!attributes.is_a?(Hash))
|
111
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::UpdateAuthMethodOCI` initialize method"
|
112
|
+
end
|
113
|
+
|
114
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
115
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
116
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
117
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::UpdateAuthMethodOCI`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
118
|
+
end
|
119
|
+
h[k.to_sym] = v
|
120
|
+
}
|
121
|
+
|
122
|
+
if attributes.key?(:'access_expires')
|
123
|
+
self.access_expires = attributes[:'access_expires']
|
124
|
+
else
|
125
|
+
self.access_expires = 0
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'bound_ips')
|
129
|
+
if (value = attributes[:'bound_ips']).is_a?(Array)
|
130
|
+
self.bound_ips = value
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'description')
|
135
|
+
self.description = attributes[:'description']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.key?(:'force_sub_claims')
|
139
|
+
self.force_sub_claims = attributes[:'force_sub_claims']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.key?(:'group_ocid')
|
143
|
+
if (value = attributes[:'group_ocid']).is_a?(Array)
|
144
|
+
self.group_ocid = value
|
145
|
+
end
|
146
|
+
else
|
147
|
+
self.group_ocid = nil
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.key?(:'gw_bound_ips')
|
151
|
+
if (value = attributes[:'gw_bound_ips']).is_a?(Array)
|
152
|
+
self.gw_bound_ips = value
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.key?(:'json')
|
157
|
+
self.json = attributes[:'json']
|
158
|
+
else
|
159
|
+
self.json = false
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.key?(:'jwt_ttl')
|
163
|
+
self.jwt_ttl = attributes[:'jwt_ttl']
|
164
|
+
else
|
165
|
+
self.jwt_ttl = 0
|
166
|
+
end
|
167
|
+
|
168
|
+
if attributes.key?(:'name')
|
169
|
+
self.name = attributes[:'name']
|
170
|
+
else
|
171
|
+
self.name = nil
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.key?(:'new_name')
|
175
|
+
self.new_name = attributes[:'new_name']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.key?(:'tenant_ocid')
|
179
|
+
self.tenant_ocid = attributes[:'tenant_ocid']
|
180
|
+
else
|
181
|
+
self.tenant_ocid = nil
|
182
|
+
end
|
183
|
+
|
184
|
+
if attributes.key?(:'token')
|
185
|
+
self.token = attributes[:'token']
|
186
|
+
end
|
187
|
+
|
188
|
+
if attributes.key?(:'uid_token')
|
189
|
+
self.uid_token = attributes[:'uid_token']
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
194
|
+
# @return Array for valid properties with the reasons
|
195
|
+
def list_invalid_properties
|
196
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
197
|
+
invalid_properties = Array.new
|
198
|
+
if @group_ocid.nil?
|
199
|
+
invalid_properties.push('invalid value for "group_ocid", group_ocid cannot be nil.')
|
200
|
+
end
|
201
|
+
|
202
|
+
if @name.nil?
|
203
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
204
|
+
end
|
205
|
+
|
206
|
+
if @tenant_ocid.nil?
|
207
|
+
invalid_properties.push('invalid value for "tenant_ocid", tenant_ocid cannot be nil.')
|
208
|
+
end
|
209
|
+
|
210
|
+
invalid_properties
|
211
|
+
end
|
212
|
+
|
213
|
+
# Check to see if the all the properties in the model are valid
|
214
|
+
# @return true if the model is valid
|
215
|
+
def valid?
|
216
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
217
|
+
return false if @group_ocid.nil?
|
218
|
+
return false if @name.nil?
|
219
|
+
return false if @tenant_ocid.nil?
|
220
|
+
true
|
221
|
+
end
|
222
|
+
|
223
|
+
# Checks equality by comparing each attribute.
|
224
|
+
# @param [Object] Object to be compared
|
225
|
+
def ==(o)
|
226
|
+
return true if self.equal?(o)
|
227
|
+
self.class == o.class &&
|
228
|
+
access_expires == o.access_expires &&
|
229
|
+
bound_ips == o.bound_ips &&
|
230
|
+
description == o.description &&
|
231
|
+
force_sub_claims == o.force_sub_claims &&
|
232
|
+
group_ocid == o.group_ocid &&
|
233
|
+
gw_bound_ips == o.gw_bound_ips &&
|
234
|
+
json == o.json &&
|
235
|
+
jwt_ttl == o.jwt_ttl &&
|
236
|
+
name == o.name &&
|
237
|
+
new_name == o.new_name &&
|
238
|
+
tenant_ocid == o.tenant_ocid &&
|
239
|
+
token == o.token &&
|
240
|
+
uid_token == o.uid_token
|
241
|
+
end
|
242
|
+
|
243
|
+
# @see the `==` method
|
244
|
+
# @param [Object] Object to be compared
|
245
|
+
def eql?(o)
|
246
|
+
self == o
|
247
|
+
end
|
248
|
+
|
249
|
+
# Calculates hash code according to all attributes.
|
250
|
+
# @return [Integer] Hash code
|
251
|
+
def hash
|
252
|
+
[access_expires, bound_ips, description, force_sub_claims, group_ocid, gw_bound_ips, json, jwt_ttl, name, new_name, tenant_ocid, token, uid_token].hash
|
253
|
+
end
|
254
|
+
|
255
|
+
# Builds the object from hash
|
256
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
257
|
+
# @return [Object] Returns the model itself
|
258
|
+
def self.build_from_hash(attributes)
|
259
|
+
return nil unless attributes.is_a?(Hash)
|
260
|
+
attributes = attributes.transform_keys(&:to_sym)
|
261
|
+
transformed_hash = {}
|
262
|
+
openapi_types.each_pair do |key, type|
|
263
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
264
|
+
transformed_hash["#{key}"] = nil
|
265
|
+
elsif type =~ /\AArray<(.*)>/i
|
266
|
+
# check to ensure the input is an array given that the attribute
|
267
|
+
# is documented as an array but the input is not
|
268
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
269
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
270
|
+
end
|
271
|
+
elsif !attributes[attribute_map[key]].nil?
|
272
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
273
|
+
end
|
274
|
+
end
|
275
|
+
new(transformed_hash)
|
276
|
+
end
|
277
|
+
|
278
|
+
# Deserializes the data based on type
|
279
|
+
# @param string type Data type
|
280
|
+
# @param string value Value to be deserialized
|
281
|
+
# @return [Object] Deserialized data
|
282
|
+
def self._deserialize(type, value)
|
283
|
+
case type.to_sym
|
284
|
+
when :Time
|
285
|
+
Time.parse(value)
|
286
|
+
when :Date
|
287
|
+
Date.parse(value)
|
288
|
+
when :String
|
289
|
+
value.to_s
|
290
|
+
when :Integer
|
291
|
+
value.to_i
|
292
|
+
when :Float
|
293
|
+
value.to_f
|
294
|
+
when :Boolean
|
295
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
296
|
+
true
|
297
|
+
else
|
298
|
+
false
|
299
|
+
end
|
300
|
+
when :Object
|
301
|
+
# generic object (usually a Hash), return directly
|
302
|
+
value
|
303
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
304
|
+
inner_type = Regexp.last_match[:inner_type]
|
305
|
+
value.map { |v| _deserialize(inner_type, v) }
|
306
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
307
|
+
k_type = Regexp.last_match[:k_type]
|
308
|
+
v_type = Regexp.last_match[:v_type]
|
309
|
+
{}.tap do |hash|
|
310
|
+
value.each do |k, v|
|
311
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
312
|
+
end
|
313
|
+
end
|
314
|
+
else # model
|
315
|
+
# models (e.g. Pet) or oneOf
|
316
|
+
klass = Akeyless.const_get(type)
|
317
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
# Returns the string representation of the object
|
322
|
+
# @return [String] String presentation of the object
|
323
|
+
def to_s
|
324
|
+
to_hash.to_s
|
325
|
+
end
|
326
|
+
|
327
|
+
# to_body is an alias to to_hash (backward compatibility)
|
328
|
+
# @return [Hash] Returns the object in the form of hash
|
329
|
+
def to_body
|
330
|
+
to_hash
|
331
|
+
end
|
332
|
+
|
333
|
+
# Returns the object in the form of hash
|
334
|
+
# @return [Hash] Returns the object in the form of hash
|
335
|
+
def to_hash
|
336
|
+
hash = {}
|
337
|
+
self.class.attribute_map.each_pair do |attr, param|
|
338
|
+
value = self.send(attr)
|
339
|
+
if value.nil?
|
340
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
341
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
342
|
+
end
|
343
|
+
|
344
|
+
hash[param] = _to_hash(value)
|
345
|
+
end
|
346
|
+
hash
|
347
|
+
end
|
348
|
+
|
349
|
+
# Outputs non-array value in the form of hash
|
350
|
+
# For object, use to_hash. Otherwise, just return the value
|
351
|
+
# @param [Object] value Any valid value
|
352
|
+
# @return [Hash] Returns the value in the form of hash
|
353
|
+
def _to_hash(value)
|
354
|
+
if value.is_a?(Array)
|
355
|
+
value.compact.map { |v| _to_hash(v) }
|
356
|
+
elsif value.is_a?(Hash)
|
357
|
+
{}.tap do |hash|
|
358
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
359
|
+
end
|
360
|
+
elsif value.respond_to? :to_hash
|
361
|
+
value.to_hash
|
362
|
+
else
|
363
|
+
value
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
end
|
368
|
+
|
369
|
+
end
|