pnap_bmc_api 1.5.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 +5 -1
- data/VERSION +1 -1
- data/docs/DeleteResult.md +1 -1
- data/docs/OsConfigurationCloudInit.md +1 -1
- data/docs/QuotasApi.md +6 -8
- data/docs/SSHKeysApi.md +12 -16
- data/docs/Server.md +11 -7
- data/docs/ServerCreate.md +3 -3
- 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/StorageConfigurationRootPartition.md +2 -2
- 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 +14 -19
- data/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb +25 -22
- data/lib/pnap_bmc_api/models/os_configuration_windows.rb +19 -20
- data/lib/pnap_bmc_api/models/private_network_configuration.rb +14 -19
- 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 +39 -19
- data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +42 -21
- 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 +79 -33
- data/lib/pnap_bmc_api/models/server_create.rb +29 -22
- 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 +23 -22
- 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 +14 -19
- data/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb +14 -19
- 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 +2 -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 +6 -4
- data/spec/models/storage_configuration_spec.rb +5 -3
- 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 +38 -42
- data/docs/QuotaEditLimitRequestDetailsAllOf.md +0 -18
- data/lib/pnap_bmc_api/models/quota_edit_limit_request_details_all_of.rb +0 -226
- 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
|
|
@@ -78,23 +78,27 @@ module BmcApi
|
|
78
78
|
|
79
79
|
# Create SSH Key.
|
80
80
|
# Create an SSH Key. SSH Keys created can be used for server creation and reset functionality.
|
81
|
+
# @param ssh_key_create [SshKeyCreate]
|
81
82
|
# @param [Hash] opts the optional parameters
|
82
|
-
# @option opts [SshKeyCreate] :ssh_key_create
|
83
83
|
# @return [SshKey]
|
84
|
-
def ssh_keys_post(opts = {})
|
85
|
-
data, _status_code, _headers = ssh_keys_post_with_http_info(opts)
|
84
|
+
def ssh_keys_post(ssh_key_create, opts = {})
|
85
|
+
data, _status_code, _headers = ssh_keys_post_with_http_info(ssh_key_create, opts)
|
86
86
|
data
|
87
87
|
end
|
88
88
|
|
89
89
|
# Create SSH Key.
|
90
90
|
# Create an SSH Key. SSH Keys created can be used for server creation and reset functionality.
|
91
|
+
# @param ssh_key_create [SshKeyCreate]
|
91
92
|
# @param [Hash] opts the optional parameters
|
92
|
-
# @option opts [SshKeyCreate] :ssh_key_create
|
93
93
|
# @return [Array<(SshKey, Integer, Hash)>] SshKey data, response status code and response headers
|
94
|
-
def ssh_keys_post_with_http_info(opts = {})
|
94
|
+
def ssh_keys_post_with_http_info(ssh_key_create, opts = {})
|
95
95
|
if @api_client.config.debugging
|
96
96
|
@api_client.config.logger.debug 'Calling API: SSHKeysApi.ssh_keys_post ...'
|
97
97
|
end
|
98
|
+
# verify the required parameter 'ssh_key_create' is set
|
99
|
+
if @api_client.config.client_side_validation && ssh_key_create.nil?
|
100
|
+
fail ArgumentError, "Missing the required parameter 'ssh_key_create' when calling SSHKeysApi.ssh_keys_post"
|
101
|
+
end
|
98
102
|
# resource path
|
99
103
|
local_var_path = '/ssh-keys'
|
100
104
|
|
@@ -115,7 +119,7 @@ module BmcApi
|
|
115
119
|
form_params = opts[:form_params] || {}
|
116
120
|
|
117
121
|
# http body (model)
|
118
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
122
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(ssh_key_create)
|
119
123
|
|
120
124
|
# return_type
|
121
125
|
return_type = opts[:debug_return_type] || 'SshKey'
|
@@ -269,21 +273,21 @@ module BmcApi
|
|
269
273
|
# Edit SSH Key.
|
270
274
|
# Edit SSH Key details.
|
271
275
|
# @param ssh_key_id [String] The SSH Key's ID.
|
276
|
+
# @param ssh_key_update [SshKeyUpdate]
|
272
277
|
# @param [Hash] opts the optional parameters
|
273
|
-
# @option opts [SshKeyUpdate] :ssh_key_update
|
274
278
|
# @return [SshKey]
|
275
|
-
def ssh_keys_ssh_key_id_put(ssh_key_id, opts = {})
|
276
|
-
data, _status_code, _headers = ssh_keys_ssh_key_id_put_with_http_info(ssh_key_id, opts)
|
279
|
+
def ssh_keys_ssh_key_id_put(ssh_key_id, ssh_key_update, opts = {})
|
280
|
+
data, _status_code, _headers = ssh_keys_ssh_key_id_put_with_http_info(ssh_key_id, ssh_key_update, opts)
|
277
281
|
data
|
278
282
|
end
|
279
283
|
|
280
284
|
# Edit SSH Key.
|
281
285
|
# Edit SSH Key details.
|
282
286
|
# @param ssh_key_id [String] The SSH Key's ID.
|
287
|
+
# @param ssh_key_update [SshKeyUpdate]
|
283
288
|
# @param [Hash] opts the optional parameters
|
284
|
-
# @option opts [SshKeyUpdate] :ssh_key_update
|
285
289
|
# @return [Array<(SshKey, Integer, Hash)>] SshKey data, response status code and response headers
|
286
|
-
def ssh_keys_ssh_key_id_put_with_http_info(ssh_key_id, opts = {})
|
290
|
+
def ssh_keys_ssh_key_id_put_with_http_info(ssh_key_id, ssh_key_update, opts = {})
|
287
291
|
if @api_client.config.debugging
|
288
292
|
@api_client.config.logger.debug 'Calling API: SSHKeysApi.ssh_keys_ssh_key_id_put ...'
|
289
293
|
end
|
@@ -291,6 +295,10 @@ module BmcApi
|
|
291
295
|
if @api_client.config.client_side_validation && ssh_key_id.nil?
|
292
296
|
fail ArgumentError, "Missing the required parameter 'ssh_key_id' when calling SSHKeysApi.ssh_keys_ssh_key_id_put"
|
293
297
|
end
|
298
|
+
# verify the required parameter 'ssh_key_update' is set
|
299
|
+
if @api_client.config.client_side_validation && ssh_key_update.nil?
|
300
|
+
fail ArgumentError, "Missing the required parameter 'ssh_key_update' when calling SSHKeysApi.ssh_keys_ssh_key_id_put"
|
301
|
+
end
|
294
302
|
# resource path
|
295
303
|
local_var_path = '/ssh-keys/{sshKeyId}'.sub('{' + 'sshKeyId' + '}', CGI.escape(ssh_key_id.to_s))
|
296
304
|
|
@@ -311,7 +319,7 @@ module BmcApi
|
|
311
319
|
form_params = opts[:form_params] || {}
|
312
320
|
|
313
321
|
# http body (model)
|
314
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
322
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(ssh_key_update)
|
315
323
|
|
316
324
|
# return_type
|
317
325
|
return_type = opts[:debug_return_type] || 'SshKey'
|
@@ -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
|
|
@@ -17,6 +17,7 @@ require 'tempfile'
|
|
17
17
|
require 'time'
|
18
18
|
require 'typhoeus'
|
19
19
|
|
20
|
+
|
20
21
|
module BmcApi
|
21
22
|
class ApiClient
|
22
23
|
# The Configuration object holding settings to be used in the API client.
|
@@ -31,6 +32,7 @@ module BmcApi
|
|
31
32
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
32
33
|
def initialize(config = Configuration.default)
|
33
34
|
@config = config
|
35
|
+
@config.params_encoding = :multi
|
34
36
|
@user_agent = "PNAP-ruby-sdk-bmc/#{ BmcApi::VERSION }"
|
35
37
|
@powered_by = "PNAP-ruby-sdk-bmc/#{ BmcApi::VERSION }"
|
36
38
|
@default_headers = {
|
@@ -47,9 +49,10 @@ module BmcApi
|
|
47
49
|
# Call an API with given options.
|
48
50
|
#
|
49
51
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
50
|
-
# the data deserialized from response body (
|
52
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
51
53
|
def call_api(http_method, path, opts = {})
|
52
54
|
request = build_request(http_method, path, opts)
|
55
|
+
tempfile = download_file(request) if opts[:return_type] == 'File'
|
53
56
|
response = request.run
|
54
57
|
|
55
58
|
if @config.debugging
|
@@ -71,7 +74,9 @@ module BmcApi
|
|
71
74
|
end
|
72
75
|
end
|
73
76
|
|
74
|
-
if opts[:return_type]
|
77
|
+
if opts[:return_type] == 'File'
|
78
|
+
data = tempfile
|
79
|
+
elsif opts[:return_type]
|
75
80
|
data = deserialize(response, opts[:return_type])
|
76
81
|
else
|
77
82
|
data = nil
|
@@ -127,9 +132,7 @@ module BmcApi
|
|
127
132
|
end
|
128
133
|
end
|
129
134
|
|
130
|
-
|
131
|
-
download_file(request) if opts[:return_type] == 'File'
|
132
|
-
request
|
135
|
+
Typhoeus::Request.new(url, req_opts)
|
133
136
|
end
|
134
137
|
|
135
138
|
# Builds the HTTP request body
|
@@ -167,6 +170,8 @@ module BmcApi
|
|
167
170
|
# process can use.
|
168
171
|
#
|
169
172
|
# @see Configuration#temp_folder_path
|
173
|
+
#
|
174
|
+
# @return [Tempfile] the tempfile generated
|
170
175
|
def download_file(request)
|
171
176
|
tempfile = nil
|
172
177
|
encoding = nil
|
@@ -181,21 +186,24 @@ module BmcApi
|
|
181
186
|
prefix = prefix + '-' unless prefix.end_with?('-')
|
182
187
|
encoding = response.body.encoding
|
183
188
|
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
184
|
-
@tempfile = tempfile
|
185
189
|
end
|
186
190
|
request.on_body do |chunk|
|
187
191
|
chunk.force_encoding(encoding)
|
188
192
|
tempfile.write(chunk)
|
189
193
|
end
|
190
|
-
request
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
# run the request to ensure the tempfile is created successfully before returning it
|
195
|
+
request.run
|
196
|
+
if tempfile
|
197
|
+
tempfile.close
|
198
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
199
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
200
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
201
|
+
"explicitly with `tempfile.delete`"
|
202
|
+
else
|
203
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
198
204
|
end
|
205
|
+
|
206
|
+
tempfile
|
199
207
|
end
|
200
208
|
|
201
209
|
# Check if the given MIME is a JSON MIME.
|
@@ -216,15 +224,10 @@ module BmcApi
|
|
216
224
|
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
217
225
|
def deserialize(response, return_type)
|
218
226
|
body = response.body
|
219
|
-
|
220
|
-
# handle file downloading - return the File instance processed in request callbacks
|
221
|
-
# note that response body is empty when the file is written in chunks in request on_body callback
|
222
|
-
return @tempfile if return_type == 'File'
|
223
|
-
|
224
227
|
return nil if body.nil? || body.empty?
|
225
228
|
|
226
229
|
# return response body directly for String return type
|
227
|
-
return body if return_type == 'String'
|
230
|
+
return body.to_s if return_type == 'String'
|
228
231
|
|
229
232
|
# ensuring a default content type
|
230
233
|
content_type = response.headers['Content-Type'] || 'application/json'
|
@@ -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
|
|
@@ -32,6 +32,7 @@ module BmcApi
|
|
32
32
|
end
|
33
33
|
else
|
34
34
|
super arg
|
35
|
+
@message = arg
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -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
|
|
@@ -62,6 +62,16 @@ module BmcApi
|
|
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
|
+
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
72
|
+
# Default to false.
|
73
|
+
attr_accessor :return_binary_data
|
74
|
+
|
65
75
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
66
76
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
67
77
|
# Default to false.
|
@@ -142,7 +152,7 @@ module BmcApi
|
|
142
152
|
@scheme = 'https'
|
143
153
|
@host = 'api.phoenixnap.com'
|
144
154
|
@base_path = '/bmc/v1'
|
145
|
-
@server_index =
|
155
|
+
@server_index = nil
|
146
156
|
@server_operation_index = {}
|
147
157
|
@server_variables = {}
|
148
158
|
@server_operation_variables = {}
|
@@ -190,10 +200,12 @@ module BmcApi
|
|
190
200
|
|
191
201
|
# Returns base URL for specified operation based on server settings
|
192
202
|
def base_url(operation = nil)
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
203
|
+
if operation_server_settings.key?(operation) then
|
204
|
+
index = server_operation_index.fetch(operation, server_index)
|
205
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
206
|
+
else
|
207
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
208
|
+
end
|
197
209
|
end
|
198
210
|
|
199
211
|
# Gets API key (with prefix if set).
|
@@ -208,6 +220,12 @@ module BmcApi
|
|
208
220
|
end
|
209
221
|
end
|
210
222
|
|
223
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
224
|
+
def access_token_with_refresh
|
225
|
+
return access_token if access_token_getter.nil?
|
226
|
+
access_token_getter.call
|
227
|
+
end
|
228
|
+
|
211
229
|
# Gets Basic Auth token string
|
212
230
|
def basic_auth_token
|
213
231
|
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
@@ -221,7 +239,7 @@ module BmcApi
|
|
221
239
|
type: 'oauth2',
|
222
240
|
in: 'header',
|
223
241
|
key: 'Authorization',
|
224
|
-
value: "Bearer #{
|
242
|
+
value: "Bearer #{access_token_with_refresh}"
|
225
243
|
},
|
226
244
|
}
|
227
245
|
end
|
@@ -249,8 +267,8 @@ module BmcApi
|
|
249
267
|
servers = server_settings if servers == nil
|
250
268
|
|
251
269
|
# check array index out of bound
|
252
|
-
if (index < 0 || index >= servers.size)
|
253
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
270
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
271
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
254
272
|
end
|
255
273
|
|
256
274
|
server = servers[index]
|
@@ -275,5 +293,6 @@ module BmcApi
|
|
275
293
|
url
|
276
294
|
end
|
277
295
|
|
296
|
+
|
278
297
|
end
|
279
298
|
end
|
@@ -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
|
|
@@ -61,12 +61,15 @@ module BmcApi
|
|
61
61
|
|
62
62
|
if attributes.key?(:'result')
|
63
63
|
self.result = attributes[:'result']
|
64
|
+
else
|
65
|
+
self.result = nil
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
67
69
|
# Show invalid properties with the reasons. Usually used together with valid?
|
68
70
|
# @return Array for valid properties with the reasons
|
69
71
|
def list_invalid_properties
|
72
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
70
73
|
invalid_properties = Array.new
|
71
74
|
if @result.nil?
|
72
75
|
invalid_properties.push('invalid value for "result", result cannot be nil.')
|
@@ -78,6 +81,7 @@ module BmcApi
|
|
78
81
|
# Check to see if the all the properties in the model are valid
|
79
82
|
# @return true if the model is valid
|
80
83
|
def valid?
|
84
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
81
85
|
return false if @result.nil?
|
82
86
|
true
|
83
87
|
end
|
@@ -106,37 +110,30 @@ module BmcApi
|
|
106
110
|
# @param [Hash] attributes Model attributes in the form of hash
|
107
111
|
# @return [Object] Returns the model itself
|
108
112
|
def self.build_from_hash(attributes)
|
109
|
-
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
116
113
|
return nil unless attributes.is_a?(Hash)
|
117
114
|
attributes = attributes.transform_keys(&:to_sym)
|
118
|
-
|
119
|
-
|
120
|
-
|
115
|
+
transformed_hash = {}
|
116
|
+
openapi_types.each_pair do |key, type|
|
117
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
118
|
+
transformed_hash["#{key}"] = nil
|
121
119
|
elsif type =~ /\AArray<(.*)>/i
|
122
120
|
# check to ensure the input is an array given that the attribute
|
123
121
|
# is documented as an array but the input is not
|
124
|
-
if attributes[
|
125
|
-
|
122
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
123
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
126
124
|
end
|
127
|
-
elsif !attributes[
|
128
|
-
|
125
|
+
elsif !attributes[attribute_map[key]].nil?
|
126
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
129
127
|
end
|
130
128
|
end
|
131
|
-
|
132
|
-
self
|
129
|
+
new(transformed_hash)
|
133
130
|
end
|
134
131
|
|
135
132
|
# Deserializes the data based on type
|
136
133
|
# @param string type Data type
|
137
134
|
# @param string value Value to be deserialized
|
138
135
|
# @return [Object] Deserialized data
|
139
|
-
def _deserialize(type, value)
|
136
|
+
def self._deserialize(type, value)
|
140
137
|
case type.to_sym
|
141
138
|
when :Time
|
142
139
|
Time.parse(value)
|
@@ -171,7 +168,7 @@ module BmcApi
|
|
171
168
|
else # model
|
172
169
|
# models (e.g. Pet) or oneOf
|
173
170
|
klass = BmcApi.const_get(type)
|
174
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
171
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
175
172
|
end
|
176
173
|
end
|
177
174
|
|
@@ -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?(:'result')
|
68
68
|
self.result = attributes[:'result']
|
69
|
+
else
|
70
|
+
self.result = nil
|
69
71
|
end
|
70
72
|
|
71
73
|
if attributes.key?(:'server_id')
|
72
74
|
self.server_id = attributes[:'server_id']
|
75
|
+
else
|
76
|
+
self.server_id = 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 @result.nil?
|
81
86
|
invalid_properties.push('invalid value for "result", result cannot be nil.')
|
@@ -91,6 +96,7 @@ module BmcApi
|
|
91
96
|
# Check to see if the all the properties in the model are valid
|
92
97
|
# @return true if the model is valid
|
93
98
|
def valid?
|
99
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
94
100
|
return false if @result.nil?
|
95
101
|
return false if @server_id.nil?
|
96
102
|
true
|
@@ -121,37 +127,30 @@ module BmcApi
|
|
121
127
|
# @param [Hash] attributes Model attributes in the form of hash
|
122
128
|
# @return [Object] Returns the model itself
|
123
129
|
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
130
|
return nil unless attributes.is_a?(Hash)
|
132
131
|
attributes = attributes.transform_keys(&:to_sym)
|
133
|
-
|
134
|
-
|
135
|
-
|
132
|
+
transformed_hash = {}
|
133
|
+
openapi_types.each_pair do |key, type|
|
134
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
135
|
+
transformed_hash["#{key}"] = nil
|
136
136
|
elsif type =~ /\AArray<(.*)>/i
|
137
137
|
# check to ensure the input is an array given that the attribute
|
138
138
|
# is documented as an array but the input is not
|
139
|
-
if attributes[
|
140
|
-
|
139
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
140
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
141
141
|
end
|
142
|
-
elsif !attributes[
|
143
|
-
|
142
|
+
elsif !attributes[attribute_map[key]].nil?
|
143
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
144
144
|
end
|
145
145
|
end
|
146
|
-
|
147
|
-
self
|
146
|
+
new(transformed_hash)
|
148
147
|
end
|
149
148
|
|
150
149
|
# Deserializes the data based on type
|
151
150
|
# @param string type Data type
|
152
151
|
# @param string value Value to be deserialized
|
153
152
|
# @return [Object] Deserialized data
|
154
|
-
def _deserialize(type, value)
|
153
|
+
def self._deserialize(type, value)
|
155
154
|
case type.to_sym
|
156
155
|
when :Time
|
157
156
|
Time.parse(value)
|
@@ -186,7 +185,7 @@ module BmcApi
|
|
186
185
|
else # model
|
187
186
|
# models (e.g. Pet) or oneOf
|
188
187
|
klass = BmcApi.const_get(type)
|
189
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
188
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
190
189
|
end
|
191
190
|
end
|
192
191
|
|
@@ -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?(:'result')
|
68
68
|
self.result = attributes[:'result']
|
69
|
+
else
|
70
|
+
self.result = nil
|
69
71
|
end
|
70
72
|
|
71
73
|
if attributes.key?(:'ssh_key_id')
|
72
74
|
self.ssh_key_id = attributes[:'ssh_key_id']
|
75
|
+
else
|
76
|
+
self.ssh_key_id = 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 @result.nil?
|
81
86
|
invalid_properties.push('invalid value for "result", result cannot be nil.')
|
@@ -91,6 +96,7 @@ module BmcApi
|
|
91
96
|
# Check to see if the all the properties in the model are valid
|
92
97
|
# @return true if the model is valid
|
93
98
|
def valid?
|
99
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
94
100
|
return false if @result.nil?
|
95
101
|
return false if @ssh_key_id.nil?
|
96
102
|
true
|
@@ -121,37 +127,30 @@ module BmcApi
|
|
121
127
|
# @param [Hash] attributes Model attributes in the form of hash
|
122
128
|
# @return [Object] Returns the model itself
|
123
129
|
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
130
|
return nil unless attributes.is_a?(Hash)
|
132
131
|
attributes = attributes.transform_keys(&:to_sym)
|
133
|
-
|
134
|
-
|
135
|
-
|
132
|
+
transformed_hash = {}
|
133
|
+
openapi_types.each_pair do |key, type|
|
134
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
135
|
+
transformed_hash["#{key}"] = nil
|
136
136
|
elsif type =~ /\AArray<(.*)>/i
|
137
137
|
# check to ensure the input is an array given that the attribute
|
138
138
|
# is documented as an array but the input is not
|
139
|
-
if attributes[
|
140
|
-
|
139
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
140
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
141
141
|
end
|
142
|
-
elsif !attributes[
|
143
|
-
|
142
|
+
elsif !attributes[attribute_map[key]].nil?
|
143
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
144
144
|
end
|
145
145
|
end
|
146
|
-
|
147
|
-
self
|
146
|
+
new(transformed_hash)
|
148
147
|
end
|
149
148
|
|
150
149
|
# Deserializes the data based on type
|
151
150
|
# @param string type Data type
|
152
151
|
# @param string value Value to be deserialized
|
153
152
|
# @return [Object] Deserialized data
|
154
|
-
def _deserialize(type, value)
|
153
|
+
def self._deserialize(type, value)
|
155
154
|
case type.to_sym
|
156
155
|
when :Time
|
157
156
|
Time.parse(value)
|
@@ -186,7 +185,7 @@ module BmcApi
|
|
186
185
|
else # model
|
187
186
|
# models (e.g. Pet) or oneOf
|
188
187
|
klass = BmcApi.const_get(type)
|
189
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
188
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
190
189
|
end
|
191
190
|
end
|
192
191
|
|