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.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/VERSION +1 -1
  4. data/docs/DeleteResult.md +1 -1
  5. data/docs/OsConfigurationCloudInit.md +1 -1
  6. data/docs/QuotasApi.md +6 -8
  7. data/docs/SSHKeysApi.md +12 -16
  8. data/docs/Server.md +11 -7
  9. data/docs/ServerCreate.md +3 -3
  10. data/docs/ServerNetworkUpdate.md +2 -2
  11. data/docs/ServerPrivateNetwork.md +3 -3
  12. data/docs/ServerProvision.md +38 -0
  13. data/docs/ServerPublicNetwork.md +2 -2
  14. data/docs/ServersApi.md +173 -111
  15. data/docs/StorageConfigurationRootPartition.md +2 -2
  16. data/lib/pnap_bmc_api/api/quotas_api.rb +11 -7
  17. data/lib/pnap_bmc_api/api/servers_api.rb +200 -75
  18. data/lib/pnap_bmc_api/api/ssh_keys_api.rb +21 -13
  19. data/lib/pnap_bmc_api/api_client.rb +24 -21
  20. data/lib/pnap_bmc_api/api_error.rb +2 -1
  21. data/lib/pnap_bmc_api/configuration.rb +28 -9
  22. data/lib/pnap_bmc_api/models/action_result.rb +16 -19
  23. data/lib/pnap_bmc_api/models/delete_result.rb +18 -19
  24. data/lib/pnap_bmc_api/models/delete_ssh_key_result.rb +18 -19
  25. data/lib/pnap_bmc_api/models/error.rb +16 -19
  26. data/lib/pnap_bmc_api/models/ip_blocks_configuration.rb +19 -20
  27. data/lib/pnap_bmc_api/models/network_configuration.rb +14 -19
  28. data/lib/pnap_bmc_api/models/os_configuration.rb +19 -20
  29. data/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb +15 -20
  30. data/lib/pnap_bmc_api/models/os_configuration_map.rb +14 -19
  31. data/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb +19 -20
  32. data/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb +19 -20
  33. data/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb +14 -19
  34. data/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb +25 -22
  35. data/lib/pnap_bmc_api/models/os_configuration_windows.rb +19 -20
  36. data/lib/pnap_bmc_api/models/private_network_configuration.rb +14 -19
  37. data/lib/pnap_bmc_api/models/public_network_configuration.rb +14 -19
  38. data/lib/pnap_bmc_api/models/quota.rb +30 -19
  39. data/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +39 -19
  40. data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +42 -21
  41. data/lib/pnap_bmc_api/models/relinquish_ip_block.rb +14 -19
  42. data/lib/pnap_bmc_api/models/reset_result.rb +16 -19
  43. data/lib/pnap_bmc_api/models/server.rb +79 -33
  44. data/lib/pnap_bmc_api/models/server_create.rb +29 -22
  45. data/lib/pnap_bmc_api/models/server_ip_block.rb +16 -19
  46. data/lib/pnap_bmc_api/models/server_network_update.rb +15 -20
  47. data/lib/pnap_bmc_api/models/server_patch.rb +27 -24
  48. data/lib/pnap_bmc_api/models/server_private_network.rb +23 -22
  49. data/lib/pnap_bmc_api/models/server_provision.rb +395 -0
  50. data/lib/pnap_bmc_api/models/server_public_network.rb +17 -20
  51. data/lib/pnap_bmc_api/models/server_reserve.rb +16 -19
  52. data/lib/pnap_bmc_api/models/server_reset.rb +14 -19
  53. data/lib/pnap_bmc_api/models/ssh_key.rb +28 -19
  54. data/lib/pnap_bmc_api/models/ssh_key_create.rb +52 -19
  55. data/lib/pnap_bmc_api/models/ssh_key_update.rb +29 -19
  56. data/lib/pnap_bmc_api/models/storage_configuration.rb +14 -19
  57. data/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb +14 -19
  58. data/lib/pnap_bmc_api/models/tag_assignment.rb +20 -19
  59. data/lib/pnap_bmc_api/models/tag_assignment_request.rb +16 -19
  60. data/lib/pnap_bmc_api/version.rb +1 -1
  61. data/lib/pnap_bmc_api.rb +2 -2
  62. data/pnap_bmc_api.gemspec +2 -2
  63. data/spec/api/quotas_api_spec.rb +6 -6
  64. data/spec/api/servers_api_spec.rb +109 -36
  65. data/spec/api/ssh_keys_api_spec.rb +9 -9
  66. data/spec/models/action_result_spec.rb +6 -4
  67. data/spec/models/delete_result_spec.rb +7 -5
  68. data/spec/models/delete_ssh_key_result_spec.rb +7 -5
  69. data/spec/models/error_spec.rb +7 -5
  70. data/spec/models/ip_blocks_configuration_spec.rb +7 -5
  71. data/spec/models/network_configuration_spec.rb +19 -5
  72. data/spec/models/os_configuration_cloud_init_spec.rb +5 -3
  73. data/spec/models/os_configuration_map_esxi_spec.rb +8 -6
  74. data/spec/models/os_configuration_map_proxmox_spec.rb +8 -6
  75. data/spec/models/os_configuration_map_spec.rb +8 -6
  76. data/spec/models/os_configuration_netris_controller_spec.rb +7 -5
  77. data/spec/models/os_configuration_netris_softgate_spec.rb +8 -6
  78. data/spec/models/os_configuration_spec.rb +33 -7
  79. data/spec/models/os_configuration_windows_spec.rb +6 -4
  80. data/spec/models/private_network_configuration_spec.rb +8 -6
  81. data/spec/models/public_network_configuration_spec.rb +6 -4
  82. data/spec/models/quota_edit_limit_request_details_spec.rb +8 -6
  83. data/spec/models/quota_edit_limit_request_spec.rb +7 -5
  84. data/spec/models/quota_spec.rb +13 -15
  85. data/spec/models/relinquish_ip_block_spec.rb +6 -4
  86. data/spec/models/reset_result_spec.rb +8 -6
  87. data/spec/models/server_create_spec.rb +25 -17
  88. data/spec/models/server_ip_block_spec.rb +7 -5
  89. data/spec/models/server_network_update_spec.rb +5 -3
  90. data/spec/models/server_patch_spec.rb +7 -5
  91. data/spec/models/server_private_network_spec.rb +9 -7
  92. data/spec/models/server_provision_spec.rb +96 -0
  93. data/spec/models/server_public_network_spec.rb +8 -6
  94. data/spec/models/server_reserve_spec.rb +6 -4
  95. data/spec/models/server_reset_spec.rb +9 -7
  96. data/spec/models/server_spec.rb +47 -27
  97. data/spec/models/ssh_key_create_spec.rb +8 -6
  98. data/spec/models/ssh_key_spec.rb +12 -10
  99. data/spec/models/ssh_key_update_spec.rb +7 -5
  100. data/spec/models/storage_configuration_root_partition_spec.rb +6 -4
  101. data/spec/models/storage_configuration_spec.rb +5 -3
  102. data/spec/models/tag_assignment_request_spec.rb +7 -5
  103. data/spec/models/tag_assignment_spec.rb +10 -8
  104. data/spec/spec_helper.rb +1 -1
  105. metadata +38 -42
  106. data/docs/QuotaEditLimitRequestDetailsAllOf.md +0 -18
  107. data/lib/pnap_bmc_api/models/quota_edit_limit_request_details_all_of.rb +0 -226
  108. data/spec/api_client_spec.rb +0 -226
  109. data/spec/configuration_spec.rb +0 -42
  110. 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: 6.1.0
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(opts[:'ssh_key_create'])
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&#39;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&#39;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(opts[:'ssh_key_update'])
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: 6.1.0
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 (could be nil), response status code and response headers.
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
- request = Typhoeus::Request.new(url, req_opts)
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.on_complete do |response|
191
- if tempfile
192
- tempfile.close
193
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
194
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
195
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
196
- "explicitly with `tempfile.delete`"
197
- end
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: 6.1.0
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: 6.1.0
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 = 0
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
- index = server_operation_index.fetch(operation, server_index)
194
- return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
195
-
196
- server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
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 #{access_token}"
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: 6.1.0
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
- self.class.openapi_types.each_pair do |key, type|
119
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
120
- self.send("#{key}=", nil)
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[self.class.attribute_map[key]].is_a?(Array)
125
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
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[self.class.attribute_map[key]].nil?
128
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
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: 6.1.0
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
- 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)
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[self.class.attribute_map[key]].is_a?(Array)
140
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
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[self.class.attribute_map[key]].nil?
143
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
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: 6.1.0
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
- 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)
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[self.class.attribute_map[key]].is_a?(Array)
140
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
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[self.class.attribute_map[key]].nil?
143
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
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