pnap_rancher_api 1.0.5 → 2.0.0
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 +3 -4
- data/VERSION +1 -1
- data/docs/Cluster.md +3 -3
- data/docs/ClustersApi.md +6 -8
- data/docs/NodePool.md +2 -2
- data/docs/RancherClusterConfig.md +1 -1
- data/lib/pnap_rancher_api/api/clusters_api.rb +11 -7
- data/lib/pnap_rancher_api/api_client.rb +24 -21
- data/lib/pnap_rancher_api/api_error.rb +2 -1
- data/lib/pnap_rancher_api/configuration.rb +28 -9
- data/lib/pnap_rancher_api/models/cluster.rb +25 -24
- data/lib/pnap_rancher_api/models/delete_result.rb +18 -19
- data/lib/pnap_rancher_api/models/error.rb +16 -19
- data/lib/pnap_rancher_api/models/node.rb +14 -19
- data/lib/pnap_rancher_api/models/node_pool.rb +54 -20
- data/lib/pnap_rancher_api/models/rancher_cluster_certificates.rb +14 -19
- data/lib/pnap_rancher_api/models/rancher_cluster_config.rb +15 -20
- data/lib/pnap_rancher_api/models/rancher_server_metadata.rb +14 -19
- data/lib/pnap_rancher_api/models/ssh_config.rb +14 -19
- data/lib/pnap_rancher_api/models/workload_cluster_config.rb +16 -19
- data/lib/pnap_rancher_api/version.rb +1 -1
- data/lib/pnap_rancher_api.rb +1 -5
- data/pnap_rancher_api.gemspec +2 -2
- data/spec/api/clusters_api_spec.rb +7 -7
- data/spec/models/cluster_spec.rb +14 -12
- data/spec/models/delete_result_spec.rb +6 -4
- data/spec/models/error_spec.rb +6 -4
- data/spec/models/node_pool_spec.rb +9 -7
- data/spec/models/node_spec.rb +5 -3
- data/spec/models/rancher_cluster_certificates_spec.rb +7 -5
- data/spec/models/rancher_cluster_config_spec.rb +11 -9
- data/spec/models/rancher_server_metadata_spec.rb +7 -5
- data/spec/models/ssh_config_spec.rb +7 -5
- data/spec/models/workload_cluster_config_spec.rb +8 -6
- data/spec/spec_helper.rb +1 -1
- metadata +9 -29
- data/docs/ClusterConfiguration.md +0 -30
- data/docs/ClusterWorkloadConfiguration.md +0 -24
- data/docs/NodePoolSshConfig.md +0 -22
- data/docs/RancherClusterConfigCertificates.md +0 -22
- data/lib/pnap_rancher_api/models/cluster_configuration.rb +0 -290
- data/lib/pnap_rancher_api/models/cluster_workload_configuration.rb +0 -271
- data/lib/pnap_rancher_api/models/node_pool_ssh_config.rb +0 -253
- data/lib/pnap_rancher_api/models/rancher_cluster_config_certificates.rb +0 -247
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/cluster_configuration_spec.rb +0 -70
- data/spec/models/cluster_workload_configuration_spec.rb +0 -52
- data/spec/models/node_pool_ssh_config_spec.rb +0 -46
- data/spec/models/rancher_cluster_config_certificates_spec.rb +0 -46
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -65,6 +65,8 @@ module RancherApi
|
|
65
65
|
|
66
66
|
if attributes.key?(:'message')
|
67
67
|
self.message = attributes[:'message']
|
68
|
+
else
|
69
|
+
self.message = nil
|
68
70
|
end
|
69
71
|
|
70
72
|
if attributes.key?(:'validation_errors')
|
@@ -77,6 +79,7 @@ module RancherApi
|
|
77
79
|
# Show invalid properties with the reasons. Usually used together with valid?
|
78
80
|
# @return Array for valid properties with the reasons
|
79
81
|
def list_invalid_properties
|
82
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
80
83
|
invalid_properties = Array.new
|
81
84
|
if @message.nil?
|
82
85
|
invalid_properties.push('invalid value for "message", message cannot be nil.')
|
@@ -88,6 +91,7 @@ module RancherApi
|
|
88
91
|
# Check to see if the all the properties in the model are valid
|
89
92
|
# @return true if the model is valid
|
90
93
|
def valid?
|
94
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
91
95
|
return false if @message.nil?
|
92
96
|
true
|
93
97
|
end
|
@@ -117,37 +121,30 @@ module RancherApi
|
|
117
121
|
# @param [Hash] attributes Model attributes in the form of hash
|
118
122
|
# @return [Object] Returns the model itself
|
119
123
|
def self.build_from_hash(attributes)
|
120
|
-
new.build_from_hash(attributes)
|
121
|
-
end
|
122
|
-
|
123
|
-
# Builds the object from hash
|
124
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
-
# @return [Object] Returns the model itself
|
126
|
-
def build_from_hash(attributes)
|
127
124
|
return nil unless attributes.is_a?(Hash)
|
128
125
|
attributes = attributes.transform_keys(&:to_sym)
|
129
|
-
|
130
|
-
|
131
|
-
|
126
|
+
transformed_hash = {}
|
127
|
+
openapi_types.each_pair do |key, type|
|
128
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
129
|
+
transformed_hash["#{key}"] = nil
|
132
130
|
elsif type =~ /\AArray<(.*)>/i
|
133
131
|
# check to ensure the input is an array given that the attribute
|
134
132
|
# is documented as an array but the input is not
|
135
|
-
if attributes[
|
136
|
-
|
133
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
134
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
137
135
|
end
|
138
|
-
elsif !attributes[
|
139
|
-
|
136
|
+
elsif !attributes[attribute_map[key]].nil?
|
137
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
140
138
|
end
|
141
139
|
end
|
142
|
-
|
143
|
-
self
|
140
|
+
new(transformed_hash)
|
144
141
|
end
|
145
142
|
|
146
143
|
# Deserializes the data based on type
|
147
144
|
# @param string type Data type
|
148
145
|
# @param string value Value to be deserialized
|
149
146
|
# @return [Object] Deserialized data
|
150
|
-
def _deserialize(type, value)
|
147
|
+
def self._deserialize(type, value)
|
151
148
|
case type.to_sym
|
152
149
|
when :Time
|
153
150
|
Time.parse(value)
|
@@ -182,7 +179,7 @@ module RancherApi
|
|
182
179
|
else # model
|
183
180
|
# models (e.g. Pet) or oneOf
|
184
181
|
klass = RancherApi.const_get(type)
|
185
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
182
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
186
183
|
end
|
187
184
|
end
|
188
185
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -67,6 +67,7 @@ module RancherApi
|
|
67
67
|
# Show invalid properties with the reasons. Usually used together with valid?
|
68
68
|
# @return Array for valid properties with the reasons
|
69
69
|
def list_invalid_properties
|
70
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
70
71
|
invalid_properties = Array.new
|
71
72
|
invalid_properties
|
72
73
|
end
|
@@ -74,6 +75,7 @@ module RancherApi
|
|
74
75
|
# Check to see if the all the properties in the model are valid
|
75
76
|
# @return true if the model is valid
|
76
77
|
def valid?
|
78
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
77
79
|
true
|
78
80
|
end
|
79
81
|
|
@@ -101,37 +103,30 @@ module RancherApi
|
|
101
103
|
# @param [Hash] attributes Model attributes in the form of hash
|
102
104
|
# @return [Object] Returns the model itself
|
103
105
|
def self.build_from_hash(attributes)
|
104
|
-
new.build_from_hash(attributes)
|
105
|
-
end
|
106
|
-
|
107
|
-
# Builds the object from hash
|
108
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
-
# @return [Object] Returns the model itself
|
110
|
-
def build_from_hash(attributes)
|
111
106
|
return nil unless attributes.is_a?(Hash)
|
112
107
|
attributes = attributes.transform_keys(&:to_sym)
|
113
|
-
|
114
|
-
|
115
|
-
|
108
|
+
transformed_hash = {}
|
109
|
+
openapi_types.each_pair do |key, type|
|
110
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
111
|
+
transformed_hash["#{key}"] = nil
|
116
112
|
elsif type =~ /\AArray<(.*)>/i
|
117
113
|
# check to ensure the input is an array given that the attribute
|
118
114
|
# is documented as an array but the input is not
|
119
|
-
if attributes[
|
120
|
-
|
115
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
116
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
121
117
|
end
|
122
|
-
elsif !attributes[
|
123
|
-
|
118
|
+
elsif !attributes[attribute_map[key]].nil?
|
119
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
124
120
|
end
|
125
121
|
end
|
126
|
-
|
127
|
-
self
|
122
|
+
new(transformed_hash)
|
128
123
|
end
|
129
124
|
|
130
125
|
# Deserializes the data based on type
|
131
126
|
# @param string type Data type
|
132
127
|
# @param string value Value to be deserialized
|
133
128
|
# @return [Object] Deserialized data
|
134
|
-
def _deserialize(type, value)
|
129
|
+
def self._deserialize(type, value)
|
135
130
|
case type.to_sym
|
136
131
|
when :Time
|
137
132
|
Time.parse(value)
|
@@ -166,7 +161,7 @@ module RancherApi
|
|
166
161
|
else # model
|
167
162
|
# models (e.g. Pet) or oneOf
|
168
163
|
klass = RancherApi.const_get(type)
|
169
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
164
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
170
165
|
end
|
171
166
|
end
|
172
167
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -52,7 +52,7 @@ module RancherApi
|
|
52
52
|
:'name' => :'String',
|
53
53
|
:'node_count' => :'Integer',
|
54
54
|
:'server_type' => :'String',
|
55
|
-
:'ssh_config' => :'
|
55
|
+
:'ssh_config' => :'SshConfig',
|
56
56
|
:'nodes' => :'Array<Node>'
|
57
57
|
}
|
58
58
|
end
|
@@ -106,16 +106,57 @@ module RancherApi
|
|
106
106
|
# Show invalid properties with the reasons. Usually used together with valid?
|
107
107
|
# @return Array for valid properties with the reasons
|
108
108
|
def list_invalid_properties
|
109
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
109
110
|
invalid_properties = Array.new
|
111
|
+
if !@name.nil? && @name.to_s.length > 100
|
112
|
+
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
|
113
|
+
end
|
114
|
+
|
115
|
+
if !@name.nil? && @name.to_s.length < 1
|
116
|
+
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
117
|
+
end
|
118
|
+
|
119
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
120
|
+
if !@name.nil? && @name !~ pattern
|
121
|
+
invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
|
122
|
+
end
|
123
|
+
|
110
124
|
invalid_properties
|
111
125
|
end
|
112
126
|
|
113
127
|
# Check to see if the all the properties in the model are valid
|
114
128
|
# @return true if the model is valid
|
115
129
|
def valid?
|
130
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
131
|
+
return false if !@name.nil? && @name.to_s.length > 100
|
132
|
+
return false if !@name.nil? && @name.to_s.length < 1
|
133
|
+
return false if !@name.nil? && @name !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
116
134
|
true
|
117
135
|
end
|
118
136
|
|
137
|
+
# Custom attribute writer method with validation
|
138
|
+
# @param [Object] name Value to be assigned
|
139
|
+
def name=(name)
|
140
|
+
if name.nil?
|
141
|
+
fail ArgumentError, 'name cannot be nil'
|
142
|
+
end
|
143
|
+
|
144
|
+
if name.to_s.length > 100
|
145
|
+
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.'
|
146
|
+
end
|
147
|
+
|
148
|
+
if name.to_s.length < 1
|
149
|
+
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
150
|
+
end
|
151
|
+
|
152
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
153
|
+
if name !~ pattern
|
154
|
+
fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
|
155
|
+
end
|
156
|
+
|
157
|
+
@name = name
|
158
|
+
end
|
159
|
+
|
119
160
|
# Checks equality by comparing each attribute.
|
120
161
|
# @param [Object] Object to be compared
|
121
162
|
def ==(o)
|
@@ -144,37 +185,30 @@ module RancherApi
|
|
144
185
|
# @param [Hash] attributes Model attributes in the form of hash
|
145
186
|
# @return [Object] Returns the model itself
|
146
187
|
def self.build_from_hash(attributes)
|
147
|
-
new.build_from_hash(attributes)
|
148
|
-
end
|
149
|
-
|
150
|
-
# Builds the object from hash
|
151
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
152
|
-
# @return [Object] Returns the model itself
|
153
|
-
def build_from_hash(attributes)
|
154
188
|
return nil unless attributes.is_a?(Hash)
|
155
189
|
attributes = attributes.transform_keys(&:to_sym)
|
156
|
-
|
157
|
-
|
158
|
-
|
190
|
+
transformed_hash = {}
|
191
|
+
openapi_types.each_pair do |key, type|
|
192
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
193
|
+
transformed_hash["#{key}"] = nil
|
159
194
|
elsif type =~ /\AArray<(.*)>/i
|
160
195
|
# check to ensure the input is an array given that the attribute
|
161
196
|
# is documented as an array but the input is not
|
162
|
-
if attributes[
|
163
|
-
|
197
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
198
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
164
199
|
end
|
165
|
-
elsif !attributes[
|
166
|
-
|
200
|
+
elsif !attributes[attribute_map[key]].nil?
|
201
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
167
202
|
end
|
168
203
|
end
|
169
|
-
|
170
|
-
self
|
204
|
+
new(transformed_hash)
|
171
205
|
end
|
172
206
|
|
173
207
|
# Deserializes the data based on type
|
174
208
|
# @param string type Data type
|
175
209
|
# @param string value Value to be deserialized
|
176
210
|
# @return [Object] Deserialized data
|
177
|
-
def _deserialize(type, value)
|
211
|
+
def self._deserialize(type, value)
|
178
212
|
case type.to_sym
|
179
213
|
when :Time
|
180
214
|
Time.parse(value)
|
@@ -209,7 +243,7 @@ module RancherApi
|
|
209
243
|
else # model
|
210
244
|
# models (e.g. Pet) or oneOf
|
211
245
|
klass = RancherApi.const_get(type)
|
212
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
246
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
213
247
|
end
|
214
248
|
end
|
215
249
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -85,6 +85,7 @@ module RancherApi
|
|
85
85
|
# Show invalid properties with the reasons. Usually used together with valid?
|
86
86
|
# @return Array for valid properties with the reasons
|
87
87
|
def list_invalid_properties
|
88
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
88
89
|
invalid_properties = Array.new
|
89
90
|
invalid_properties
|
90
91
|
end
|
@@ -92,6 +93,7 @@ module RancherApi
|
|
92
93
|
# Check to see if the all the properties in the model are valid
|
93
94
|
# @return true if the model is valid
|
94
95
|
def valid?
|
96
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
95
97
|
true
|
96
98
|
end
|
97
99
|
|
@@ -121,37 +123,30 @@ module RancherApi
|
|
121
123
|
# @param [Hash] attributes Model attributes in the form of hash
|
122
124
|
# @return [Object] Returns the model itself
|
123
125
|
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
126
|
return nil unless attributes.is_a?(Hash)
|
132
127
|
attributes = attributes.transform_keys(&:to_sym)
|
133
|
-
|
134
|
-
|
135
|
-
|
128
|
+
transformed_hash = {}
|
129
|
+
openapi_types.each_pair do |key, type|
|
130
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
131
|
+
transformed_hash["#{key}"] = nil
|
136
132
|
elsif type =~ /\AArray<(.*)>/i
|
137
133
|
# check to ensure the input is an array given that the attribute
|
138
134
|
# is documented as an array but the input is not
|
139
|
-
if attributes[
|
140
|
-
|
135
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
136
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
141
137
|
end
|
142
|
-
elsif !attributes[
|
143
|
-
|
138
|
+
elsif !attributes[attribute_map[key]].nil?
|
139
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
144
140
|
end
|
145
141
|
end
|
146
|
-
|
147
|
-
self
|
142
|
+
new(transformed_hash)
|
148
143
|
end
|
149
144
|
|
150
145
|
# Deserializes the data based on type
|
151
146
|
# @param string type Data type
|
152
147
|
# @param string value Value to be deserialized
|
153
148
|
# @return [Object] Deserialized data
|
154
|
-
def _deserialize(type, value)
|
149
|
+
def self._deserialize(type, value)
|
155
150
|
case type.to_sym
|
156
151
|
when :Time
|
157
152
|
Time.parse(value)
|
@@ -186,7 +181,7 @@ module RancherApi
|
|
186
181
|
else # model
|
187
182
|
# models (e.g. Pet) or oneOf
|
188
183
|
klass = RancherApi.const_get(type)
|
189
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
184
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
190
185
|
end
|
191
186
|
end
|
192
187
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -63,7 +63,7 @@ module RancherApi
|
|
63
63
|
:'etcd_snapshot_retention' => :'Integer',
|
64
64
|
:'node_taint' => :'String',
|
65
65
|
:'cluster_domain' => :'String',
|
66
|
-
:'certificates' => :'
|
66
|
+
:'certificates' => :'RancherClusterCertificates'
|
67
67
|
}
|
68
68
|
end
|
69
69
|
|
@@ -124,6 +124,7 @@ module RancherApi
|
|
124
124
|
# Show invalid properties with the reasons. Usually used together with valid?
|
125
125
|
# @return Array for valid properties with the reasons
|
126
126
|
def list_invalid_properties
|
127
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
127
128
|
invalid_properties = Array.new
|
128
129
|
invalid_properties
|
129
130
|
end
|
@@ -131,6 +132,7 @@ module RancherApi
|
|
131
132
|
# Check to see if the all the properties in the model are valid
|
132
133
|
# @return true if the model is valid
|
133
134
|
def valid?
|
135
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
134
136
|
true
|
135
137
|
end
|
136
138
|
|
@@ -164,37 +166,30 @@ module RancherApi
|
|
164
166
|
# @param [Hash] attributes Model attributes in the form of hash
|
165
167
|
# @return [Object] Returns the model itself
|
166
168
|
def self.build_from_hash(attributes)
|
167
|
-
new.build_from_hash(attributes)
|
168
|
-
end
|
169
|
-
|
170
|
-
# Builds the object from hash
|
171
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
172
|
-
# @return [Object] Returns the model itself
|
173
|
-
def build_from_hash(attributes)
|
174
169
|
return nil unless attributes.is_a?(Hash)
|
175
170
|
attributes = attributes.transform_keys(&:to_sym)
|
176
|
-
|
177
|
-
|
178
|
-
|
171
|
+
transformed_hash = {}
|
172
|
+
openapi_types.each_pair do |key, type|
|
173
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
174
|
+
transformed_hash["#{key}"] = nil
|
179
175
|
elsif type =~ /\AArray<(.*)>/i
|
180
176
|
# check to ensure the input is an array given that the attribute
|
181
177
|
# is documented as an array but the input is not
|
182
|
-
if attributes[
|
183
|
-
|
178
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
179
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
184
180
|
end
|
185
|
-
elsif !attributes[
|
186
|
-
|
181
|
+
elsif !attributes[attribute_map[key]].nil?
|
182
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
187
183
|
end
|
188
184
|
end
|
189
|
-
|
190
|
-
self
|
185
|
+
new(transformed_hash)
|
191
186
|
end
|
192
187
|
|
193
188
|
# Deserializes the data based on type
|
194
189
|
# @param string type Data type
|
195
190
|
# @param string value Value to be deserialized
|
196
191
|
# @return [Object] Deserialized data
|
197
|
-
def _deserialize(type, value)
|
192
|
+
def self._deserialize(type, value)
|
198
193
|
case type.to_sym
|
199
194
|
when :Time
|
200
195
|
Time.parse(value)
|
@@ -229,7 +224,7 @@ module RancherApi
|
|
229
224
|
else # model
|
230
225
|
# models (e.g. Pet) or oneOf
|
231
226
|
klass = RancherApi.const_get(type)
|
232
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
227
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
233
228
|
end
|
234
229
|
end
|
235
230
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -85,6 +85,7 @@ module RancherApi
|
|
85
85
|
# Show invalid properties with the reasons. Usually used together with valid?
|
86
86
|
# @return Array for valid properties with the reasons
|
87
87
|
def list_invalid_properties
|
88
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
88
89
|
invalid_properties = Array.new
|
89
90
|
invalid_properties
|
90
91
|
end
|
@@ -92,6 +93,7 @@ module RancherApi
|
|
92
93
|
# Check to see if the all the properties in the model are valid
|
93
94
|
# @return true if the model is valid
|
94
95
|
def valid?
|
96
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
95
97
|
true
|
96
98
|
end
|
97
99
|
|
@@ -121,37 +123,30 @@ module RancherApi
|
|
121
123
|
# @param [Hash] attributes Model attributes in the form of hash
|
122
124
|
# @return [Object] Returns the model itself
|
123
125
|
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
126
|
return nil unless attributes.is_a?(Hash)
|
132
127
|
attributes = attributes.transform_keys(&:to_sym)
|
133
|
-
|
134
|
-
|
135
|
-
|
128
|
+
transformed_hash = {}
|
129
|
+
openapi_types.each_pair do |key, type|
|
130
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
131
|
+
transformed_hash["#{key}"] = nil
|
136
132
|
elsif type =~ /\AArray<(.*)>/i
|
137
133
|
# check to ensure the input is an array given that the attribute
|
138
134
|
# is documented as an array but the input is not
|
139
|
-
if attributes[
|
140
|
-
|
135
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
136
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
141
137
|
end
|
142
|
-
elsif !attributes[
|
143
|
-
|
138
|
+
elsif !attributes[attribute_map[key]].nil?
|
139
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
144
140
|
end
|
145
141
|
end
|
146
|
-
|
147
|
-
self
|
142
|
+
new(transformed_hash)
|
148
143
|
end
|
149
144
|
|
150
145
|
# Deserializes the data based on type
|
151
146
|
# @param string type Data type
|
152
147
|
# @param string value Value to be deserialized
|
153
148
|
# @return [Object] Deserialized data
|
154
|
-
def _deserialize(type, value)
|
149
|
+
def self._deserialize(type, value)
|
155
150
|
case type.to_sym
|
156
151
|
when :Time
|
157
152
|
Time.parse(value)
|
@@ -186,7 +181,7 @@ module RancherApi
|
|
186
181
|
else # model
|
187
182
|
# models (e.g. Pet) or oneOf
|
188
183
|
klass = RancherApi.const_get(type)
|
189
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
184
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
190
185
|
end
|
191
186
|
end
|
192
187
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -91,6 +91,7 @@ module RancherApi
|
|
91
91
|
# Show invalid properties with the reasons. Usually used together with valid?
|
92
92
|
# @return Array for valid properties with the reasons
|
93
93
|
def list_invalid_properties
|
94
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
94
95
|
invalid_properties = Array.new
|
95
96
|
invalid_properties
|
96
97
|
end
|
@@ -98,6 +99,7 @@ module RancherApi
|
|
98
99
|
# Check to see if the all the properties in the model are valid
|
99
100
|
# @return true if the model is valid
|
100
101
|
def valid?
|
102
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
101
103
|
true
|
102
104
|
end
|
103
105
|
|
@@ -127,37 +129,30 @@ module RancherApi
|
|
127
129
|
# @param [Hash] attributes Model attributes in the form of hash
|
128
130
|
# @return [Object] Returns the model itself
|
129
131
|
def self.build_from_hash(attributes)
|
130
|
-
new.build_from_hash(attributes)
|
131
|
-
end
|
132
|
-
|
133
|
-
# Builds the object from hash
|
134
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
135
|
-
# @return [Object] Returns the model itself
|
136
|
-
def build_from_hash(attributes)
|
137
132
|
return nil unless attributes.is_a?(Hash)
|
138
133
|
attributes = attributes.transform_keys(&:to_sym)
|
139
|
-
|
140
|
-
|
141
|
-
|
134
|
+
transformed_hash = {}
|
135
|
+
openapi_types.each_pair do |key, type|
|
136
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
137
|
+
transformed_hash["#{key}"] = nil
|
142
138
|
elsif type =~ /\AArray<(.*)>/i
|
143
139
|
# check to ensure the input is an array given that the attribute
|
144
140
|
# is documented as an array but the input is not
|
145
|
-
if attributes[
|
146
|
-
|
141
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
142
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
147
143
|
end
|
148
|
-
elsif !attributes[
|
149
|
-
|
144
|
+
elsif !attributes[attribute_map[key]].nil?
|
145
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
150
146
|
end
|
151
147
|
end
|
152
|
-
|
153
|
-
self
|
148
|
+
new(transformed_hash)
|
154
149
|
end
|
155
150
|
|
156
151
|
# Deserializes the data based on type
|
157
152
|
# @param string type Data type
|
158
153
|
# @param string value Value to be deserialized
|
159
154
|
# @return [Object] Deserialized data
|
160
|
-
def _deserialize(type, value)
|
155
|
+
def self._deserialize(type, value)
|
161
156
|
case type.to_sym
|
162
157
|
when :Time
|
163
158
|
Time.parse(value)
|
@@ -192,7 +187,7 @@ module RancherApi
|
|
192
187
|
else # model
|
193
188
|
# models (e.g. Pet) or oneOf
|
194
189
|
klass = RancherApi.const_get(type)
|
195
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
190
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
196
191
|
end
|
197
192
|
end
|
198
193
|
|