pnap_bmc_api 1.4.0 → 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 +7 -1
- data/VERSION +1 -1
- data/docs/DeleteResult.md +1 -1
- data/docs/OsConfigurationCloudInit.md +1 -1
- data/docs/OsConfigurationNetrisController.md +1 -1
- data/docs/PrivateNetworkConfiguration.md +1 -1
- data/docs/QuotaEditLimitRequest.md +1 -1
- data/docs/QuotaEditLimitRequestDetails.md +1 -1
- data/docs/QuotasApi.md +6 -8
- data/docs/SSHKeysApi.md +12 -16
- data/docs/Server.md +14 -8
- data/docs/ServerCreate.md +7 -5
- data/docs/ServerNetworkUpdate.md +2 -2
- data/docs/ServerPrivateNetwork.md +3 -3
- data/docs/ServerProvision.md +38 -0
- data/docs/ServerPublicNetwork.md +2 -2
- data/docs/ServersApi.md +173 -111
- data/docs/StorageConfiguration.md +18 -0
- data/docs/StorageConfigurationRootPartition.md +20 -0
- data/lib/pnap_bmc_api/api/quotas_api.rb +11 -7
- data/lib/pnap_bmc_api/api/servers_api.rb +200 -75
- data/lib/pnap_bmc_api/api/ssh_keys_api.rb +21 -13
- data/lib/pnap_bmc_api/api_client.rb +24 -21
- data/lib/pnap_bmc_api/api_error.rb +2 -1
- data/lib/pnap_bmc_api/configuration.rb +28 -9
- data/lib/pnap_bmc_api/models/action_result.rb +16 -19
- data/lib/pnap_bmc_api/models/delete_result.rb +18 -19
- data/lib/pnap_bmc_api/models/delete_ssh_key_result.rb +18 -19
- data/lib/pnap_bmc_api/models/error.rb +16 -19
- data/lib/pnap_bmc_api/models/ip_blocks_configuration.rb +19 -20
- data/lib/pnap_bmc_api/models/network_configuration.rb +14 -19
- data/lib/pnap_bmc_api/models/os_configuration.rb +19 -20
- data/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb +15 -20
- data/lib/pnap_bmc_api/models/os_configuration_map.rb +14 -19
- data/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb +19 -20
- data/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb +19 -20
- data/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb +16 -21
- data/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb +66 -20
- data/lib/pnap_bmc_api/models/os_configuration_windows.rb +19 -20
- data/lib/pnap_bmc_api/models/private_network_configuration.rb +15 -20
- data/lib/pnap_bmc_api/models/public_network_configuration.rb +14 -19
- data/lib/pnap_bmc_api/models/quota.rb +30 -19
- data/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +40 -20
- data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +43 -22
- data/lib/pnap_bmc_api/models/relinquish_ip_block.rb +14 -19
- data/lib/pnap_bmc_api/models/reset_result.rb +16 -19
- data/lib/pnap_bmc_api/models/server.rb +94 -34
- data/lib/pnap_bmc_api/models/server_create.rb +43 -27
- data/lib/pnap_bmc_api/models/server_ip_block.rb +16 -19
- data/lib/pnap_bmc_api/models/server_network_update.rb +15 -20
- data/lib/pnap_bmc_api/models/server_patch.rb +27 -24
- data/lib/pnap_bmc_api/models/server_private_network.rb +27 -26
- data/lib/pnap_bmc_api/models/server_provision.rb +395 -0
- data/lib/pnap_bmc_api/models/server_public_network.rb +17 -20
- data/lib/pnap_bmc_api/models/server_reserve.rb +16 -19
- data/lib/pnap_bmc_api/models/server_reset.rb +14 -19
- data/lib/pnap_bmc_api/models/ssh_key.rb +28 -19
- data/lib/pnap_bmc_api/models/ssh_key_create.rb +52 -19
- data/lib/pnap_bmc_api/models/ssh_key_update.rb +29 -19
- data/lib/pnap_bmc_api/models/storage_configuration.rb +215 -0
- data/lib/pnap_bmc_api/models/{quota_edit_limit_request_details_all_of.rb → storage_configuration_root_partition.rb} +40 -36
- data/lib/pnap_bmc_api/models/tag_assignment.rb +20 -19
- data/lib/pnap_bmc_api/models/tag_assignment_request.rb +16 -19
- data/lib/pnap_bmc_api/version.rb +1 -1
- data/lib/pnap_bmc_api.rb +4 -2
- data/pnap_bmc_api.gemspec +2 -2
- data/spec/api/quotas_api_spec.rb +6 -6
- data/spec/api/servers_api_spec.rb +109 -36
- data/spec/api/ssh_keys_api_spec.rb +9 -9
- data/spec/models/action_result_spec.rb +6 -4
- data/spec/models/delete_result_spec.rb +7 -5
- data/spec/models/delete_ssh_key_result_spec.rb +7 -5
- data/spec/models/error_spec.rb +7 -5
- data/spec/models/ip_blocks_configuration_spec.rb +7 -5
- data/spec/models/network_configuration_spec.rb +19 -5
- data/spec/models/os_configuration_cloud_init_spec.rb +5 -3
- data/spec/models/os_configuration_map_esxi_spec.rb +8 -6
- data/spec/models/os_configuration_map_proxmox_spec.rb +8 -6
- data/spec/models/os_configuration_map_spec.rb +8 -6
- data/spec/models/os_configuration_netris_controller_spec.rb +7 -5
- data/spec/models/os_configuration_netris_softgate_spec.rb +8 -6
- data/spec/models/os_configuration_spec.rb +33 -7
- data/spec/models/os_configuration_windows_spec.rb +6 -4
- data/spec/models/private_network_configuration_spec.rb +8 -6
- data/spec/models/public_network_configuration_spec.rb +6 -4
- data/spec/models/quota_edit_limit_request_details_spec.rb +8 -6
- data/spec/models/quota_edit_limit_request_spec.rb +7 -5
- data/spec/models/quota_spec.rb +13 -15
- data/spec/models/relinquish_ip_block_spec.rb +6 -4
- data/spec/models/reset_result_spec.rb +8 -6
- data/spec/models/server_create_spec.rb +25 -17
- data/spec/models/server_ip_block_spec.rb +7 -5
- data/spec/models/server_network_update_spec.rb +5 -3
- data/spec/models/server_patch_spec.rb +7 -5
- data/spec/models/server_private_network_spec.rb +9 -7
- data/spec/models/server_provision_spec.rb +96 -0
- data/spec/models/server_public_network_spec.rb +8 -6
- data/spec/models/server_reserve_spec.rb +6 -4
- data/spec/models/server_reset_spec.rb +9 -7
- data/spec/models/server_spec.rb +47 -27
- data/spec/models/ssh_key_create_spec.rb +8 -6
- data/spec/models/ssh_key_spec.rb +12 -10
- data/spec/models/ssh_key_update_spec.rb +7 -5
- data/spec/models/storage_configuration_root_partition_spec.rb +42 -0
- data/spec/models/storage_configuration_spec.rb +36 -0
- data/spec/models/tag_assignment_request_spec.rb +7 -5
- data/spec/models/tag_assignment_spec.rb +10 -8
- data/spec/spec_helper.rb +1 -1
- metadata +41 -37
- data/docs/QuotaEditLimitRequestDetailsAllOf.md +0 -18
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/quota_edit_limit_request_details_all_of_spec.rb +0 -34
@@ -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,36 +91,51 @@ module BmcApi
|
|
91
91
|
|
92
92
|
if attributes.key?(:'id')
|
93
93
|
self.id = attributes[:'id']
|
94
|
+
else
|
95
|
+
self.id = nil
|
94
96
|
end
|
95
97
|
|
96
98
|
if attributes.key?(:'default')
|
97
99
|
self.default = attributes[:'default']
|
100
|
+
else
|
101
|
+
self.default = nil
|
98
102
|
end
|
99
103
|
|
100
104
|
if attributes.key?(:'name')
|
101
105
|
self.name = attributes[:'name']
|
106
|
+
else
|
107
|
+
self.name = nil
|
102
108
|
end
|
103
109
|
|
104
110
|
if attributes.key?(:'key')
|
105
111
|
self.key = attributes[:'key']
|
112
|
+
else
|
113
|
+
self.key = nil
|
106
114
|
end
|
107
115
|
|
108
116
|
if attributes.key?(:'fingerprint')
|
109
117
|
self.fingerprint = attributes[:'fingerprint']
|
118
|
+
else
|
119
|
+
self.fingerprint = nil
|
110
120
|
end
|
111
121
|
|
112
122
|
if attributes.key?(:'created_on')
|
113
123
|
self.created_on = attributes[:'created_on']
|
124
|
+
else
|
125
|
+
self.created_on = nil
|
114
126
|
end
|
115
127
|
|
116
128
|
if attributes.key?(:'last_updated_on')
|
117
129
|
self.last_updated_on = attributes[:'last_updated_on']
|
130
|
+
else
|
131
|
+
self.last_updated_on = nil
|
118
132
|
end
|
119
133
|
end
|
120
134
|
|
121
135
|
# Show invalid properties with the reasons. Usually used together with valid?
|
122
136
|
# @return Array for valid properties with the reasons
|
123
137
|
def list_invalid_properties
|
138
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
124
139
|
invalid_properties = Array.new
|
125
140
|
if @id.nil?
|
126
141
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
@@ -156,6 +171,7 @@ module BmcApi
|
|
156
171
|
# Check to see if the all the properties in the model are valid
|
157
172
|
# @return true if the model is valid
|
158
173
|
def valid?
|
174
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
159
175
|
return false if @id.nil?
|
160
176
|
return false if @default.nil?
|
161
177
|
return false if @name.nil?
|
@@ -196,37 +212,30 @@ module BmcApi
|
|
196
212
|
# @param [Hash] attributes Model attributes in the form of hash
|
197
213
|
# @return [Object] Returns the model itself
|
198
214
|
def self.build_from_hash(attributes)
|
199
|
-
new.build_from_hash(attributes)
|
200
|
-
end
|
201
|
-
|
202
|
-
# Builds the object from hash
|
203
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
204
|
-
# @return [Object] Returns the model itself
|
205
|
-
def build_from_hash(attributes)
|
206
215
|
return nil unless attributes.is_a?(Hash)
|
207
216
|
attributes = attributes.transform_keys(&:to_sym)
|
208
|
-
|
209
|
-
|
210
|
-
|
217
|
+
transformed_hash = {}
|
218
|
+
openapi_types.each_pair do |key, type|
|
219
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
220
|
+
transformed_hash["#{key}"] = nil
|
211
221
|
elsif type =~ /\AArray<(.*)>/i
|
212
222
|
# check to ensure the input is an array given that the attribute
|
213
223
|
# is documented as an array but the input is not
|
214
|
-
if attributes[
|
215
|
-
|
224
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
225
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
216
226
|
end
|
217
|
-
elsif !attributes[
|
218
|
-
|
227
|
+
elsif !attributes[attribute_map[key]].nil?
|
228
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
219
229
|
end
|
220
230
|
end
|
221
|
-
|
222
|
-
self
|
231
|
+
new(transformed_hash)
|
223
232
|
end
|
224
233
|
|
225
234
|
# Deserializes the data based on type
|
226
235
|
# @param string type Data type
|
227
236
|
# @param string value Value to be deserialized
|
228
237
|
# @return [Object] Deserialized data
|
229
|
-
def _deserialize(type, value)
|
238
|
+
def self._deserialize(type, value)
|
230
239
|
case type.to_sym
|
231
240
|
when :Time
|
232
241
|
Time.parse(value)
|
@@ -261,7 +270,7 @@ module BmcApi
|
|
261
270
|
else # model
|
262
271
|
# models (e.g. Pet) or oneOf
|
263
272
|
klass = BmcApi.const_get(type)
|
264
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
273
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
265
274
|
end
|
266
275
|
end
|
267
276
|
|
@@ -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
|
|
@@ -71,20 +71,27 @@ module BmcApi
|
|
71
71
|
|
72
72
|
if attributes.key?(:'default')
|
73
73
|
self.default = attributes[:'default']
|
74
|
+
else
|
75
|
+
self.default = nil
|
74
76
|
end
|
75
77
|
|
76
78
|
if attributes.key?(:'name')
|
77
79
|
self.name = attributes[:'name']
|
80
|
+
else
|
81
|
+
self.name = nil
|
78
82
|
end
|
79
83
|
|
80
84
|
if attributes.key?(:'key')
|
81
85
|
self.key = attributes[:'key']
|
86
|
+
else
|
87
|
+
self.key = nil
|
82
88
|
end
|
83
89
|
end
|
84
90
|
|
85
91
|
# Show invalid properties with the reasons. Usually used together with valid?
|
86
92
|
# @return Array for valid properties with the reasons
|
87
93
|
def list_invalid_properties
|
94
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
88
95
|
invalid_properties = Array.new
|
89
96
|
if @default.nil?
|
90
97
|
invalid_properties.push('invalid value for "default", default cannot be nil.')
|
@@ -102,21 +109,34 @@ module BmcApi
|
|
102
109
|
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
103
110
|
end
|
104
111
|
|
112
|
+
pattern = Regexp.new(/^(?!\s*$).+/)
|
113
|
+
if @name !~ pattern
|
114
|
+
invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
|
115
|
+
end
|
116
|
+
|
105
117
|
if @key.nil?
|
106
118
|
invalid_properties.push('invalid value for "key", key cannot be nil.')
|
107
119
|
end
|
108
120
|
|
121
|
+
pattern = Regexp.new(/^(?!\s*$).+/)
|
122
|
+
if @key !~ pattern
|
123
|
+
invalid_properties.push("invalid value for \"key\", must conform to the pattern #{pattern}.")
|
124
|
+
end
|
125
|
+
|
109
126
|
invalid_properties
|
110
127
|
end
|
111
128
|
|
112
129
|
# Check to see if the all the properties in the model are valid
|
113
130
|
# @return true if the model is valid
|
114
131
|
def valid?
|
132
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
115
133
|
return false if @default.nil?
|
116
134
|
return false if @name.nil?
|
117
135
|
return false if @name.to_s.length > 100
|
118
136
|
return false if @name.to_s.length < 1
|
137
|
+
return false if @name !~ Regexp.new(/^(?!\s*$).+/)
|
119
138
|
return false if @key.nil?
|
139
|
+
return false if @key !~ Regexp.new(/^(?!\s*$).+/)
|
120
140
|
true
|
121
141
|
end
|
122
142
|
|
@@ -135,9 +155,29 @@ module BmcApi
|
|
135
155
|
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
136
156
|
end
|
137
157
|
|
158
|
+
pattern = Regexp.new(/^(?!\s*$).+/)
|
159
|
+
if name !~ pattern
|
160
|
+
fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
|
161
|
+
end
|
162
|
+
|
138
163
|
@name = name
|
139
164
|
end
|
140
165
|
|
166
|
+
# Custom attribute writer method with validation
|
167
|
+
# @param [Object] key Value to be assigned
|
168
|
+
def key=(key)
|
169
|
+
if key.nil?
|
170
|
+
fail ArgumentError, 'key cannot be nil'
|
171
|
+
end
|
172
|
+
|
173
|
+
pattern = Regexp.new(/^(?!\s*$).+/)
|
174
|
+
if key !~ pattern
|
175
|
+
fail ArgumentError, "invalid value for \"key\", must conform to the pattern #{pattern}."
|
176
|
+
end
|
177
|
+
|
178
|
+
@key = key
|
179
|
+
end
|
180
|
+
|
141
181
|
# Checks equality by comparing each attribute.
|
142
182
|
# @param [Object] Object to be compared
|
143
183
|
def ==(o)
|
@@ -164,37 +204,30 @@ module BmcApi
|
|
164
204
|
# @param [Hash] attributes Model attributes in the form of hash
|
165
205
|
# @return [Object] Returns the model itself
|
166
206
|
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
207
|
return nil unless attributes.is_a?(Hash)
|
175
208
|
attributes = attributes.transform_keys(&:to_sym)
|
176
|
-
|
177
|
-
|
178
|
-
|
209
|
+
transformed_hash = {}
|
210
|
+
openapi_types.each_pair do |key, type|
|
211
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
212
|
+
transformed_hash["#{key}"] = nil
|
179
213
|
elsif type =~ /\AArray<(.*)>/i
|
180
214
|
# check to ensure the input is an array given that the attribute
|
181
215
|
# is documented as an array but the input is not
|
182
|
-
if attributes[
|
183
|
-
|
216
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
217
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
184
218
|
end
|
185
|
-
elsif !attributes[
|
186
|
-
|
219
|
+
elsif !attributes[attribute_map[key]].nil?
|
220
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
187
221
|
end
|
188
222
|
end
|
189
|
-
|
190
|
-
self
|
223
|
+
new(transformed_hash)
|
191
224
|
end
|
192
225
|
|
193
226
|
# Deserializes the data based on type
|
194
227
|
# @param string type Data type
|
195
228
|
# @param string value Value to be deserialized
|
196
229
|
# @return [Object] Deserialized data
|
197
|
-
def _deserialize(type, value)
|
230
|
+
def self._deserialize(type, value)
|
198
231
|
case type.to_sym
|
199
232
|
when :Time
|
200
233
|
Time.parse(value)
|
@@ -229,7 +262,7 @@ module BmcApi
|
|
229
262
|
else # model
|
230
263
|
# models (e.g. Pet) or oneOf
|
231
264
|
klass = BmcApi.const_get(type)
|
232
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
265
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
233
266
|
end
|
234
267
|
end
|
235
268
|
|
@@ -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
|
|
@@ -66,16 +66,21 @@ module BmcApi
|
|
66
66
|
|
67
67
|
if attributes.key?(:'default')
|
68
68
|
self.default = attributes[:'default']
|
69
|
+
else
|
70
|
+
self.default = nil
|
69
71
|
end
|
70
72
|
|
71
73
|
if attributes.key?(:'name')
|
72
74
|
self.name = attributes[:'name']
|
75
|
+
else
|
76
|
+
self.name = nil
|
73
77
|
end
|
74
78
|
end
|
75
79
|
|
76
80
|
# Show invalid properties with the reasons. Usually used together with valid?
|
77
81
|
# @return Array for valid properties with the reasons
|
78
82
|
def list_invalid_properties
|
83
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
79
84
|
invalid_properties = Array.new
|
80
85
|
if @default.nil?
|
81
86
|
invalid_properties.push('invalid value for "default", default cannot be nil.')
|
@@ -93,16 +98,23 @@ module BmcApi
|
|
93
98
|
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
94
99
|
end
|
95
100
|
|
101
|
+
pattern = Regexp.new(/^(?!\s*$).+/)
|
102
|
+
if @name !~ pattern
|
103
|
+
invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
|
104
|
+
end
|
105
|
+
|
96
106
|
invalid_properties
|
97
107
|
end
|
98
108
|
|
99
109
|
# Check to see if the all the properties in the model are valid
|
100
110
|
# @return true if the model is valid
|
101
111
|
def valid?
|
112
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
102
113
|
return false if @default.nil?
|
103
114
|
return false if @name.nil?
|
104
115
|
return false if @name.to_s.length > 100
|
105
116
|
return false if @name.to_s.length < 1
|
117
|
+
return false if @name !~ Regexp.new(/^(?!\s*$).+/)
|
106
118
|
true
|
107
119
|
end
|
108
120
|
|
@@ -121,6 +133,11 @@ module BmcApi
|
|
121
133
|
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
122
134
|
end
|
123
135
|
|
136
|
+
pattern = Regexp.new(/^(?!\s*$).+/)
|
137
|
+
if name !~ pattern
|
138
|
+
fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
|
139
|
+
end
|
140
|
+
|
124
141
|
@name = name
|
125
142
|
end
|
126
143
|
|
@@ -149,37 +166,30 @@ module BmcApi
|
|
149
166
|
# @param [Hash] attributes Model attributes in the form of hash
|
150
167
|
# @return [Object] Returns the model itself
|
151
168
|
def self.build_from_hash(attributes)
|
152
|
-
new.build_from_hash(attributes)
|
153
|
-
end
|
154
|
-
|
155
|
-
# Builds the object from hash
|
156
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
157
|
-
# @return [Object] Returns the model itself
|
158
|
-
def build_from_hash(attributes)
|
159
169
|
return nil unless attributes.is_a?(Hash)
|
160
170
|
attributes = attributes.transform_keys(&:to_sym)
|
161
|
-
|
162
|
-
|
163
|
-
|
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
|
164
175
|
elsif type =~ /\AArray<(.*)>/i
|
165
176
|
# check to ensure the input is an array given that the attribute
|
166
177
|
# is documented as an array but the input is not
|
167
|
-
if attributes[
|
168
|
-
|
178
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
179
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
169
180
|
end
|
170
|
-
elsif !attributes[
|
171
|
-
|
181
|
+
elsif !attributes[attribute_map[key]].nil?
|
182
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
172
183
|
end
|
173
184
|
end
|
174
|
-
|
175
|
-
self
|
185
|
+
new(transformed_hash)
|
176
186
|
end
|
177
187
|
|
178
188
|
# Deserializes the data based on type
|
179
189
|
# @param string type Data type
|
180
190
|
# @param string value Value to be deserialized
|
181
191
|
# @return [Object] Deserialized data
|
182
|
-
def _deserialize(type, value)
|
192
|
+
def self._deserialize(type, value)
|
183
193
|
case type.to_sym
|
184
194
|
when :Time
|
185
195
|
Time.parse(value)
|
@@ -214,7 +224,7 @@ module BmcApi
|
|
214
224
|
else # model
|
215
225
|
# models (e.g. Pet) or oneOf
|
216
226
|
klass = BmcApi.const_get(type)
|
217
|
-
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)
|
218
228
|
end
|
219
229
|
end
|
220
230
|
|
@@ -0,0 +1,215 @@
|
|
1
|
+
=begin
|
2
|
+
#Bare Metal Cloud API
|
3
|
+
|
4
|
+
#Create, power off, power on, reset, reboot, or shut down your server with the Bare Metal Cloud API. Deprovision servers, get or edit SSH key details, assign public IPs, assign servers to networks and a lot more. Manage your infrastructure more efficiently using just a few simple API calls.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/how-to-deploy-bare-metal-cloud-server' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/bmc/v1/)</b>
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.1
|
7
|
+
Contact: support@phoenixnap.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module BmcApi
|
17
|
+
# Storage configuration.
|
18
|
+
class StorageConfiguration
|
19
|
+
attr_accessor :root_partition
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'root_partition' => :'rootPartition'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns all the JSON keys this model knows about
|
29
|
+
def self.acceptable_attributes
|
30
|
+
attribute_map.values
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.openapi_types
|
35
|
+
{
|
36
|
+
:'root_partition' => :'StorageConfigurationRootPartition'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# List of attributes with nullable: true
|
41
|
+
def self.openapi_nullable
|
42
|
+
Set.new([
|
43
|
+
])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::StorageConfiguration` initialize method"
|
51
|
+
end
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::StorageConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
+
end
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
60
|
+
|
61
|
+
if attributes.key?(:'root_partition')
|
62
|
+
self.root_partition = attributes[:'root_partition']
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
67
|
+
# @return Array for valid properties with the reasons
|
68
|
+
def list_invalid_properties
|
69
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
70
|
+
invalid_properties = Array.new
|
71
|
+
invalid_properties
|
72
|
+
end
|
73
|
+
|
74
|
+
# Check to see if the all the properties in the model are valid
|
75
|
+
# @return true if the model is valid
|
76
|
+
def valid?
|
77
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
78
|
+
true
|
79
|
+
end
|
80
|
+
|
81
|
+
# Checks equality by comparing each attribute.
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def ==(o)
|
84
|
+
return true if self.equal?(o)
|
85
|
+
self.class == o.class &&
|
86
|
+
root_partition == o.root_partition
|
87
|
+
end
|
88
|
+
|
89
|
+
# @see the `==` method
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def eql?(o)
|
92
|
+
self == o
|
93
|
+
end
|
94
|
+
|
95
|
+
# Calculates hash code according to all attributes.
|
96
|
+
# @return [Integer] Hash code
|
97
|
+
def hash
|
98
|
+
[root_partition].hash
|
99
|
+
end
|
100
|
+
|
101
|
+
# Builds the object from hash
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
103
|
+
# @return [Object] Returns the model itself
|
104
|
+
def self.build_from_hash(attributes)
|
105
|
+
return nil unless attributes.is_a?(Hash)
|
106
|
+
attributes = attributes.transform_keys(&:to_sym)
|
107
|
+
transformed_hash = {}
|
108
|
+
openapi_types.each_pair do |key, type|
|
109
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
110
|
+
transformed_hash["#{key}"] = nil
|
111
|
+
elsif type =~ /\AArray<(.*)>/i
|
112
|
+
# check to ensure the input is an array given that the attribute
|
113
|
+
# is documented as an array but the input is not
|
114
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
115
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
116
|
+
end
|
117
|
+
elsif !attributes[attribute_map[key]].nil?
|
118
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
119
|
+
end
|
120
|
+
end
|
121
|
+
new(transformed_hash)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Deserializes the data based on type
|
125
|
+
# @param string type Data type
|
126
|
+
# @param string value Value to be deserialized
|
127
|
+
# @return [Object] Deserialized data
|
128
|
+
def self._deserialize(type, value)
|
129
|
+
case type.to_sym
|
130
|
+
when :Time
|
131
|
+
Time.parse(value)
|
132
|
+
when :Date
|
133
|
+
Date.parse(value)
|
134
|
+
when :String
|
135
|
+
value.to_s
|
136
|
+
when :Integer
|
137
|
+
value.to_i
|
138
|
+
when :Float
|
139
|
+
value.to_f
|
140
|
+
when :Boolean
|
141
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
142
|
+
true
|
143
|
+
else
|
144
|
+
false
|
145
|
+
end
|
146
|
+
when :Object
|
147
|
+
# generic object (usually a Hash), return directly
|
148
|
+
value
|
149
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
150
|
+
inner_type = Regexp.last_match[:inner_type]
|
151
|
+
value.map { |v| _deserialize(inner_type, v) }
|
152
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
153
|
+
k_type = Regexp.last_match[:k_type]
|
154
|
+
v_type = Regexp.last_match[:v_type]
|
155
|
+
{}.tap do |hash|
|
156
|
+
value.each do |k, v|
|
157
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
else # model
|
161
|
+
# models (e.g. Pet) or oneOf
|
162
|
+
klass = BmcApi.const_get(type)
|
163
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the string representation of the object
|
168
|
+
# @return [String] String presentation of the object
|
169
|
+
def to_s
|
170
|
+
to_hash.to_s
|
171
|
+
end
|
172
|
+
|
173
|
+
# to_body is an alias to to_hash (backward compatibility)
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_body
|
176
|
+
to_hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the object in the form of hash
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_hash
|
182
|
+
hash = {}
|
183
|
+
self.class.attribute_map.each_pair do |attr, param|
|
184
|
+
value = self.send(attr)
|
185
|
+
if value.nil?
|
186
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
187
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
188
|
+
end
|
189
|
+
|
190
|
+
hash[param] = _to_hash(value)
|
191
|
+
end
|
192
|
+
hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Outputs non-array value in the form of hash
|
196
|
+
# For object, use to_hash. Otherwise, just return the value
|
197
|
+
# @param [Object] value Any valid value
|
198
|
+
# @return [Hash] Returns the value in the form of hash
|
199
|
+
def _to_hash(value)
|
200
|
+
if value.is_a?(Array)
|
201
|
+
value.compact.map { |v| _to_hash(v) }
|
202
|
+
elsif value.is_a?(Hash)
|
203
|
+
{}.tap do |hash|
|
204
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
205
|
+
end
|
206
|
+
elsif value.respond_to? :to_hash
|
207
|
+
value.to_hash
|
208
|
+
else
|
209
|
+
value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|