akeyless 3.0.1 → 3.1.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 +36 -3
- data/docs/AttributeTypeAndValue.md +20 -0
- data/docs/CertificateChainInfo.md +22 -0
- data/docs/CertificateExpirationEvent.md +18 -0
- data/docs/CertificateInfo.md +62 -0
- data/docs/Connect.md +2 -0
- data/docs/CreateCertificate.md +38 -0
- data/docs/CreateCertificateOutput.md +18 -0
- data/docs/CreateEventForwarder.md +48 -0
- data/docs/CreateEventForwarderOutput.md +18 -0
- data/docs/CreateRotatedSecret.md +2 -0
- data/docs/DeleteEventForwarder.md +24 -0
- data/docs/EmailEntry.md +20 -0
- data/docs/Extension.md +22 -0
- data/docs/GatewayUpdateItem.md +2 -0
- data/docs/GatewayUpdateTlsCert.md +26 -0
- data/docs/GatewayUpdateTlsCertOutput.md +18 -0
- data/docs/GetCertificateValue.md +26 -0
- data/docs/GetCertificateValueOutput.md +20 -0
- data/docs/GetEventForwarder.md +24 -0
- data/docs/GetEventForwarderOutput.md +18 -0
- data/docs/Item.md +4 -0
- data/docs/ItemGeneralInfo.md +2 -0
- data/docs/ListSRABastions.md +2 -0
- data/docs/ListSharedItems.md +24 -0
- data/docs/Name.md +28 -0
- data/docs/NotiForwarder.md +56 -0
- data/docs/RequestAccess.md +28 -0
- data/docs/RequestAccessOutput.md +18 -0
- data/docs/RotateKey.md +2 -0
- data/docs/Target.md +4 -0
- data/docs/UpdateCertificateOutput.md +18 -0
- data/docs/UpdateCertificateValue.md +32 -0
- data/docs/UpdateEventForwarder.md +40 -0
- data/docs/UpdateRotatedSecret.md +2 -0
- data/docs/V2Api.md +631 -65
- data/lib/akeyless/api/v2_api.rb +664 -88
- data/lib/akeyless/api_error.rb +1 -0
- data/lib/akeyless/configuration.rb +11 -0
- data/lib/akeyless/models/attribute_type_and_value.rb +231 -0
- data/lib/akeyless/models/certificate_chain_info.rb +241 -0
- data/lib/akeyless/models/certificate_expiration_event.rb +219 -0
- data/lib/akeyless/models/certificate_info.rb +434 -0
- data/lib/akeyless/models/connect.rb +11 -1
- data/lib/akeyless/models/create_certificate.rb +329 -0
- data/lib/akeyless/models/create_certificate_output.rb +219 -0
- data/lib/akeyless/models/create_event_forwarder.rb +394 -0
- data/lib/akeyless/models/create_event_forwarder_output.rb +219 -0
- data/lib/akeyless/models/create_rotated_secret.rb +11 -1
- data/lib/akeyless/models/delete_event_forwarder.rb +255 -0
- data/lib/akeyless/models/email_entry.rb +228 -0
- data/lib/akeyless/models/extension.rb +237 -0
- data/lib/akeyless/models/gateway_update_item.rb +11 -1
- data/lib/akeyless/models/gateway_update_tls_cert.rb +261 -0
- data/lib/akeyless/models/gateway_update_tls_cert_output.rb +219 -0
- data/lib/akeyless/models/get_certificate_value.rb +265 -0
- data/lib/akeyless/models/get_certificate_value_output.rb +228 -0
- data/lib/akeyless/models/get_event_forwarder.rb +255 -0
- data/lib/akeyless/models/get_event_forwarder_output.rb +219 -0
- data/lib/akeyless/models/item.rb +19 -1
- data/lib/akeyless/models/item_general_info.rb +10 -1
- data/lib/akeyless/models/list_shared_items.rb +253 -0
- data/lib/akeyless/models/list_sra_bastions.rb +10 -1
- data/lib/akeyless/models/name.rb +277 -0
- data/lib/akeyless/models/noti_forwarder.rb +400 -0
- data/lib/akeyless/models/request_access.rb +282 -0
- data/lib/akeyless/models/request_access_output.rb +219 -0
- data/lib/akeyless/models/rotate_key.rb +11 -1
- data/lib/akeyless/models/target.rb +19 -1
- data/lib/akeyless/models/update_certificate_output.rb +219 -0
- data/lib/akeyless/models/update_certificate_value.rb +297 -0
- data/lib/akeyless/models/update_event_forwarder.rb +341 -0
- data/lib/akeyless/models/update_rotated_secret.rb +11 -1
- data/lib/akeyless/version.rb +1 -1
- data/lib/akeyless.rb +25 -1
- data/spec/models/attribute_type_and_value_spec.rb +40 -0
- data/spec/models/certificate_chain_info_spec.rb +46 -0
- data/spec/models/certificate_expiration_event_spec.rb +34 -0
- data/spec/models/certificate_info_spec.rb +166 -0
- data/spec/models/create_certificate_output_spec.rb +34 -0
- data/spec/models/create_certificate_spec.rb +94 -0
- data/spec/models/create_event_forwarder_output_spec.rb +34 -0
- data/spec/models/create_event_forwarder_spec.rb +124 -0
- data/spec/models/delete_event_forwarder_spec.rb +52 -0
- data/spec/models/email_entry_spec.rb +40 -0
- data/spec/models/extension_spec.rb +46 -0
- data/spec/models/gateway_update_tls_cert_output_spec.rb +34 -0
- data/spec/models/gateway_update_tls_cert_spec.rb +58 -0
- data/spec/models/get_certificate_value_output_spec.rb +40 -0
- data/spec/models/get_certificate_value_spec.rb +58 -0
- data/spec/models/get_event_forwarder_output_spec.rb +34 -0
- data/spec/models/get_event_forwarder_spec.rb +52 -0
- data/spec/models/list_shared_items_spec.rb +52 -0
- data/spec/models/name_spec.rb +64 -0
- data/spec/models/noti_forwarder_spec.rb +148 -0
- data/spec/models/request_access_output_spec.rb +34 -0
- data/spec/models/request_access_spec.rb +64 -0
- data/spec/models/update_certificate_output_spec.rb +34 -0
- data/spec/models/update_certificate_value_spec.rb +76 -0
- data/spec/models/update_event_forwarder_spec.rb +100 -0
- metadata +630 -530
data/lib/akeyless/api_error.rb
CHANGED
@@ -62,6 +62,11 @@ module Akeyless
|
|
62
62
|
# Defines the access token (Bearer) used with OAuth2.
|
63
63
|
attr_accessor :access_token
|
64
64
|
|
65
|
+
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
|
66
|
+
# Overrides the access_token if set
|
67
|
+
# @return [Proc]
|
68
|
+
attr_accessor :access_token_getter
|
69
|
+
|
65
70
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
66
71
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
67
72
|
# Default to false.
|
@@ -208,6 +213,12 @@ module Akeyless
|
|
208
213
|
end
|
209
214
|
end
|
210
215
|
|
216
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
217
|
+
def access_token_with_refresh
|
218
|
+
return access_token if access_token_getter.nil?
|
219
|
+
access_token_getter.call
|
220
|
+
end
|
221
|
+
|
211
222
|
# Gets Basic Auth token string
|
212
223
|
def basic_auth_token
|
213
224
|
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
@@ -0,0 +1,231 @@
|
|
1
|
+
=begin
|
2
|
+
#Akeyless API
|
3
|
+
|
4
|
+
#The purpose of this application is to provide access to Akeyless API.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0
|
7
|
+
Contact: support@akeyless.io
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Akeyless
|
17
|
+
# AttributeTypeAndValue mirrors the ASN.1 structure of the same name in RFC 5280, Section 4.1.2.4.
|
18
|
+
class AttributeTypeAndValue
|
19
|
+
attr_accessor :type
|
20
|
+
|
21
|
+
attr_accessor :value
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'type' => :'Type',
|
27
|
+
:'value' => :'Value'
|
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
|
+
:'type' => :'Array<Integer>',
|
40
|
+
:'value' => :'Object'
|
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::AttributeTypeAndValue` 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::AttributeTypeAndValue`. 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?(:'type')
|
66
|
+
if (value = attributes[:'type']).is_a?(Array)
|
67
|
+
self.type = value
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.key?(:'value')
|
72
|
+
self.value = attributes[:'value']
|
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
|
+
invalid_properties = Array.new
|
80
|
+
invalid_properties
|
81
|
+
end
|
82
|
+
|
83
|
+
# Check to see if the all the properties in the model are valid
|
84
|
+
# @return true if the model is valid
|
85
|
+
def valid?
|
86
|
+
true
|
87
|
+
end
|
88
|
+
|
89
|
+
# Checks equality by comparing each attribute.
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def ==(o)
|
92
|
+
return true if self.equal?(o)
|
93
|
+
self.class == o.class &&
|
94
|
+
type == o.type &&
|
95
|
+
value == o.value
|
96
|
+
end
|
97
|
+
|
98
|
+
# @see the `==` method
|
99
|
+
# @param [Object] Object to be compared
|
100
|
+
def eql?(o)
|
101
|
+
self == o
|
102
|
+
end
|
103
|
+
|
104
|
+
# Calculates hash code according to all attributes.
|
105
|
+
# @return [Integer] Hash code
|
106
|
+
def hash
|
107
|
+
[type, value].hash
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def self.build_from_hash(attributes)
|
114
|
+
new.build_from_hash(attributes)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Builds the object from hash
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
# @return [Object] Returns the model itself
|
120
|
+
def build_from_hash(attributes)
|
121
|
+
return nil unless attributes.is_a?(Hash)
|
122
|
+
attributes = attributes.transform_keys(&:to_sym)
|
123
|
+
self.class.openapi_types.each_pair do |key, type|
|
124
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
125
|
+
self.send("#{key}=", nil)
|
126
|
+
elsif type =~ /\AArray<(.*)>/i
|
127
|
+
# check to ensure the input is an array given that the attribute
|
128
|
+
# is documented as an array but the input is not
|
129
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
130
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
131
|
+
end
|
132
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
133
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
self
|
138
|
+
end
|
139
|
+
|
140
|
+
# Deserializes the data based on type
|
141
|
+
# @param string type Data type
|
142
|
+
# @param string value Value to be deserialized
|
143
|
+
# @return [Object] Deserialized data
|
144
|
+
def _deserialize(type, value)
|
145
|
+
case type.to_sym
|
146
|
+
when :Time
|
147
|
+
Time.parse(value)
|
148
|
+
when :Date
|
149
|
+
Date.parse(value)
|
150
|
+
when :String
|
151
|
+
value.to_s
|
152
|
+
when :Integer
|
153
|
+
value.to_i
|
154
|
+
when :Float
|
155
|
+
value.to_f
|
156
|
+
when :Boolean
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
158
|
+
true
|
159
|
+
else
|
160
|
+
false
|
161
|
+
end
|
162
|
+
when :Object
|
163
|
+
# generic object (usually a Hash), return directly
|
164
|
+
value
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
171
|
+
{}.tap do |hash|
|
172
|
+
value.each do |k, v|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else # model
|
177
|
+
# models (e.g. Pet) or oneOf
|
178
|
+
klass = Akeyless.const_get(type)
|
179
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the string representation of the object
|
184
|
+
# @return [String] String presentation of the object
|
185
|
+
def to_s
|
186
|
+
to_hash.to_s
|
187
|
+
end
|
188
|
+
|
189
|
+
# to_body is an alias to to_hash (backward compatibility)
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_body
|
192
|
+
to_hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Returns the object in the form of hash
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
197
|
+
def to_hash
|
198
|
+
hash = {}
|
199
|
+
self.class.attribute_map.each_pair do |attr, param|
|
200
|
+
value = self.send(attr)
|
201
|
+
if value.nil?
|
202
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
203
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
204
|
+
end
|
205
|
+
|
206
|
+
hash[param] = _to_hash(value)
|
207
|
+
end
|
208
|
+
hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# Outputs non-array value in the form of hash
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
213
|
+
# @param [Object] value Any valid value
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
215
|
+
def _to_hash(value)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.compact.map { |v| _to_hash(v) }
|
218
|
+
elsif value.is_a?(Hash)
|
219
|
+
{}.tap do |hash|
|
220
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
221
|
+
end
|
222
|
+
elsif value.respond_to? :to_hash
|
223
|
+
value.to_hash
|
224
|
+
else
|
225
|
+
value
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
@@ -0,0 +1,241 @@
|
|
1
|
+
=begin
|
2
|
+
#Akeyless API
|
3
|
+
|
4
|
+
#The purpose of this application is to provide access to Akeyless API.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0
|
7
|
+
Contact: support@akeyless.io
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Akeyless
|
17
|
+
class CertificateChainInfo
|
18
|
+
attr_accessor :certificate_chain
|
19
|
+
|
20
|
+
attr_accessor :certificate_pem
|
21
|
+
|
22
|
+
attr_accessor :expiration_events
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'certificate_chain' => :'certificate_chain',
|
28
|
+
:'certificate_pem' => :'certificate_pem',
|
29
|
+
:'expiration_events' => :'expiration_events'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'certificate_chain' => :'Array<CertificateInfo>',
|
42
|
+
:'certificate_pem' => :'String',
|
43
|
+
:'expiration_events' => :'Array<CertificateExpirationEvent>'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
])
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
if (!attributes.is_a?(Hash))
|
57
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::CertificateChainInfo` initialize method"
|
58
|
+
end
|
59
|
+
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
62
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
63
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::CertificateChainInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
64
|
+
end
|
65
|
+
h[k.to_sym] = v
|
66
|
+
}
|
67
|
+
|
68
|
+
if attributes.key?(:'certificate_chain')
|
69
|
+
if (value = attributes[:'certificate_chain']).is_a?(Array)
|
70
|
+
self.certificate_chain = value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'certificate_pem')
|
75
|
+
self.certificate_pem = attributes[:'certificate_pem']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'expiration_events')
|
79
|
+
if (value = attributes[:'expiration_events']).is_a?(Array)
|
80
|
+
self.expiration_events = value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
86
|
+
# @return Array for valid properties with the reasons
|
87
|
+
def list_invalid_properties
|
88
|
+
invalid_properties = Array.new
|
89
|
+
invalid_properties
|
90
|
+
end
|
91
|
+
|
92
|
+
# Check to see if the all the properties in the model are valid
|
93
|
+
# @return true if the model is valid
|
94
|
+
def valid?
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
# Checks equality by comparing each attribute.
|
99
|
+
# @param [Object] Object to be compared
|
100
|
+
def ==(o)
|
101
|
+
return true if self.equal?(o)
|
102
|
+
self.class == o.class &&
|
103
|
+
certificate_chain == o.certificate_chain &&
|
104
|
+
certificate_pem == o.certificate_pem &&
|
105
|
+
expiration_events == o.expiration_events
|
106
|
+
end
|
107
|
+
|
108
|
+
# @see the `==` method
|
109
|
+
# @param [Object] Object to be compared
|
110
|
+
def eql?(o)
|
111
|
+
self == o
|
112
|
+
end
|
113
|
+
|
114
|
+
# Calculates hash code according to all attributes.
|
115
|
+
# @return [Integer] Hash code
|
116
|
+
def hash
|
117
|
+
[certificate_chain, certificate_pem, expiration_events].hash
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def self.build_from_hash(attributes)
|
124
|
+
new.build_from_hash(attributes)
|
125
|
+
end
|
126
|
+
|
127
|
+
# Builds the object from hash
|
128
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
129
|
+
# @return [Object] Returns the model itself
|
130
|
+
def build_from_hash(attributes)
|
131
|
+
return nil unless attributes.is_a?(Hash)
|
132
|
+
attributes = attributes.transform_keys(&:to_sym)
|
133
|
+
self.class.openapi_types.each_pair do |key, type|
|
134
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
135
|
+
self.send("#{key}=", nil)
|
136
|
+
elsif type =~ /\AArray<(.*)>/i
|
137
|
+
# check to ensure the input is an array given that the attribute
|
138
|
+
# is documented as an array but the input is not
|
139
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
140
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
141
|
+
end
|
142
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
143
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
self
|
148
|
+
end
|
149
|
+
|
150
|
+
# Deserializes the data based on type
|
151
|
+
# @param string type Data type
|
152
|
+
# @param string value Value to be deserialized
|
153
|
+
# @return [Object] Deserialized data
|
154
|
+
def _deserialize(type, value)
|
155
|
+
case type.to_sym
|
156
|
+
when :Time
|
157
|
+
Time.parse(value)
|
158
|
+
when :Date
|
159
|
+
Date.parse(value)
|
160
|
+
when :String
|
161
|
+
value.to_s
|
162
|
+
when :Integer
|
163
|
+
value.to_i
|
164
|
+
when :Float
|
165
|
+
value.to_f
|
166
|
+
when :Boolean
|
167
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
168
|
+
true
|
169
|
+
else
|
170
|
+
false
|
171
|
+
end
|
172
|
+
when :Object
|
173
|
+
# generic object (usually a Hash), return directly
|
174
|
+
value
|
175
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
176
|
+
inner_type = Regexp.last_match[:inner_type]
|
177
|
+
value.map { |v| _deserialize(inner_type, v) }
|
178
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
179
|
+
k_type = Regexp.last_match[:k_type]
|
180
|
+
v_type = Regexp.last_match[:v_type]
|
181
|
+
{}.tap do |hash|
|
182
|
+
value.each do |k, v|
|
183
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
else # model
|
187
|
+
# models (e.g. Pet) or oneOf
|
188
|
+
klass = Akeyless.const_get(type)
|
189
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the string representation of the object
|
194
|
+
# @return [String] String presentation of the object
|
195
|
+
def to_s
|
196
|
+
to_hash.to_s
|
197
|
+
end
|
198
|
+
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_body
|
202
|
+
to_hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the object in the form of hash
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
207
|
+
def to_hash
|
208
|
+
hash = {}
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
210
|
+
value = self.send(attr)
|
211
|
+
if value.nil?
|
212
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
213
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
214
|
+
end
|
215
|
+
|
216
|
+
hash[param] = _to_hash(value)
|
217
|
+
end
|
218
|
+
hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Outputs non-array value in the form of hash
|
222
|
+
# For object, use to_hash. Otherwise, just return the value
|
223
|
+
# @param [Object] value Any valid value
|
224
|
+
# @return [Hash] Returns the value in the form of hash
|
225
|
+
def _to_hash(value)
|
226
|
+
if value.is_a?(Array)
|
227
|
+
value.compact.map { |v| _to_hash(v) }
|
228
|
+
elsif value.is_a?(Hash)
|
229
|
+
{}.tap do |hash|
|
230
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
231
|
+
end
|
232
|
+
elsif value.respond_to? :to_hash
|
233
|
+
value.to_hash
|
234
|
+
else
|
235
|
+
value
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|