pnap_bmc_api 1.5.0 → 2.1.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/EsxiDatastoreConfiguration.md +18 -0
- data/docs/EsxiOsConfiguration.md +18 -0
- data/docs/OsConfiguration.md +2 -0
- 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 +26 -23
- 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/esxi_datastore_configuration.rb +262 -0
- data/lib/pnap_bmc_api/models/{quota_edit_limit_request_details_all_of.rb → esxi_os_configuration.rb} +25 -36
- 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 +29 -21
- 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 +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/esxi_datastore_configuration_spec.rb +36 -0
- data/spec/models/esxi_os_configuration_spec.rb +36 -0
- 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 +39 -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 +43 -39
- 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
@@ -0,0 +1,395 @@
|
|
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
|
+
# Provision bare metal server.
|
18
|
+
class ServerProvision
|
19
|
+
# Hostname of server.
|
20
|
+
attr_accessor :hostname
|
21
|
+
|
22
|
+
# Description of server.
|
23
|
+
attr_accessor :description
|
24
|
+
|
25
|
+
# The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`.
|
26
|
+
attr_accessor :os
|
27
|
+
|
28
|
+
# Whether or not to install SSH keys marked as default in addition to any SSH keys specified in this request.
|
29
|
+
attr_accessor :install_default_ssh_keys
|
30
|
+
|
31
|
+
# A list of SSH keys that will be installed on the server.
|
32
|
+
attr_accessor :ssh_keys
|
33
|
+
|
34
|
+
# A list of SSH key IDs that will be installed on the server in addition to any SSH keys specified in this request.
|
35
|
+
attr_accessor :ssh_key_ids
|
36
|
+
|
37
|
+
# The type of network configuration for this server.<br> Currently this field should be set to `PUBLIC_AND_PRIVATE`, `PRIVATE_ONLY`, `PUBLIC_ONLY` or `USER_DEFINED`.<br> Setting the `force` query parameter to `true` allows you to configure network configuration type as `NONE`.
|
38
|
+
attr_accessor :network_type
|
39
|
+
|
40
|
+
attr_accessor :os_configuration
|
41
|
+
|
42
|
+
# Tags to set to the server. To create a new tag or list all the existing tags that you can use, refer to [Tags API](https://developers.phoenixnap.com/docs/tags/1/overview).
|
43
|
+
attr_accessor :tags
|
44
|
+
|
45
|
+
attr_accessor :network_configuration
|
46
|
+
|
47
|
+
attr_accessor :storage_configuration
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:'hostname' => :'hostname',
|
53
|
+
:'description' => :'description',
|
54
|
+
:'os' => :'os',
|
55
|
+
:'install_default_ssh_keys' => :'installDefaultSshKeys',
|
56
|
+
:'ssh_keys' => :'sshKeys',
|
57
|
+
:'ssh_key_ids' => :'sshKeyIds',
|
58
|
+
:'network_type' => :'networkType',
|
59
|
+
:'os_configuration' => :'osConfiguration',
|
60
|
+
:'tags' => :'tags',
|
61
|
+
:'network_configuration' => :'networkConfiguration',
|
62
|
+
:'storage_configuration' => :'storageConfiguration'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns all the JSON keys this model knows about
|
67
|
+
def self.acceptable_attributes
|
68
|
+
attribute_map.values
|
69
|
+
end
|
70
|
+
|
71
|
+
# Attribute type mapping.
|
72
|
+
def self.openapi_types
|
73
|
+
{
|
74
|
+
:'hostname' => :'String',
|
75
|
+
:'description' => :'String',
|
76
|
+
:'os' => :'String',
|
77
|
+
:'install_default_ssh_keys' => :'Boolean',
|
78
|
+
:'ssh_keys' => :'Array<String>',
|
79
|
+
:'ssh_key_ids' => :'Array<String>',
|
80
|
+
:'network_type' => :'String',
|
81
|
+
:'os_configuration' => :'OsConfiguration',
|
82
|
+
:'tags' => :'Array<TagAssignmentRequest>',
|
83
|
+
:'network_configuration' => :'NetworkConfiguration',
|
84
|
+
:'storage_configuration' => :'StorageConfiguration'
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
# List of attributes with nullable: true
|
89
|
+
def self.openapi_nullable
|
90
|
+
Set.new([
|
91
|
+
])
|
92
|
+
end
|
93
|
+
|
94
|
+
# Initializes the object
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
def initialize(attributes = {})
|
97
|
+
if (!attributes.is_a?(Hash))
|
98
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::ServerProvision` initialize method"
|
99
|
+
end
|
100
|
+
|
101
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
102
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
103
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
104
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerProvision`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
105
|
+
end
|
106
|
+
h[k.to_sym] = v
|
107
|
+
}
|
108
|
+
|
109
|
+
if attributes.key?(:'hostname')
|
110
|
+
self.hostname = attributes[:'hostname']
|
111
|
+
else
|
112
|
+
self.hostname = nil
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'description')
|
116
|
+
self.description = attributes[:'description']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'os')
|
120
|
+
self.os = attributes[:'os']
|
121
|
+
else
|
122
|
+
self.os = nil
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'install_default_ssh_keys')
|
126
|
+
self.install_default_ssh_keys = attributes[:'install_default_ssh_keys']
|
127
|
+
else
|
128
|
+
self.install_default_ssh_keys = true
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'ssh_keys')
|
132
|
+
if (value = attributes[:'ssh_keys']).is_a?(Array)
|
133
|
+
self.ssh_keys = value
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.key?(:'ssh_key_ids')
|
138
|
+
if (value = attributes[:'ssh_key_ids']).is_a?(Array)
|
139
|
+
self.ssh_key_ids = value
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'network_type')
|
144
|
+
self.network_type = attributes[:'network_type']
|
145
|
+
else
|
146
|
+
self.network_type = 'PUBLIC_AND_PRIVATE'
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.key?(:'os_configuration')
|
150
|
+
self.os_configuration = attributes[:'os_configuration']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'tags')
|
154
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
155
|
+
self.tags = value
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'network_configuration')
|
160
|
+
self.network_configuration = attributes[:'network_configuration']
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'storage_configuration')
|
164
|
+
self.storage_configuration = attributes[:'storage_configuration']
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
169
|
+
# @return Array for valid properties with the reasons
|
170
|
+
def list_invalid_properties
|
171
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
172
|
+
invalid_properties = Array.new
|
173
|
+
if @hostname.nil?
|
174
|
+
invalid_properties.push('invalid value for "hostname", hostname cannot be nil.')
|
175
|
+
end
|
176
|
+
|
177
|
+
if @hostname.to_s.length > 100
|
178
|
+
invalid_properties.push('invalid value for "hostname", the character length must be smaller than or equal to 100.')
|
179
|
+
end
|
180
|
+
|
181
|
+
if @hostname.to_s.length < 1
|
182
|
+
invalid_properties.push('invalid value for "hostname", the character length must be great than or equal to 1.')
|
183
|
+
end
|
184
|
+
|
185
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
186
|
+
if @hostname !~ pattern
|
187
|
+
invalid_properties.push("invalid value for \"hostname\", must conform to the pattern #{pattern}.")
|
188
|
+
end
|
189
|
+
|
190
|
+
if !@description.nil? && @description.to_s.length > 250
|
191
|
+
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
|
192
|
+
end
|
193
|
+
|
194
|
+
if @os.nil?
|
195
|
+
invalid_properties.push('invalid value for "os", os cannot be nil.')
|
196
|
+
end
|
197
|
+
|
198
|
+
invalid_properties
|
199
|
+
end
|
200
|
+
|
201
|
+
# Check to see if the all the properties in the model are valid
|
202
|
+
# @return true if the model is valid
|
203
|
+
def valid?
|
204
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
205
|
+
return false if @hostname.nil?
|
206
|
+
return false if @hostname.to_s.length > 100
|
207
|
+
return false if @hostname.to_s.length < 1
|
208
|
+
return false if @hostname !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
209
|
+
return false if !@description.nil? && @description.to_s.length > 250
|
210
|
+
return false if @os.nil?
|
211
|
+
true
|
212
|
+
end
|
213
|
+
|
214
|
+
# Custom attribute writer method with validation
|
215
|
+
# @param [Object] hostname Value to be assigned
|
216
|
+
def hostname=(hostname)
|
217
|
+
if hostname.nil?
|
218
|
+
fail ArgumentError, 'hostname cannot be nil'
|
219
|
+
end
|
220
|
+
|
221
|
+
if hostname.to_s.length > 100
|
222
|
+
fail ArgumentError, 'invalid value for "hostname", the character length must be smaller than or equal to 100.'
|
223
|
+
end
|
224
|
+
|
225
|
+
if hostname.to_s.length < 1
|
226
|
+
fail ArgumentError, 'invalid value for "hostname", the character length must be great than or equal to 1.'
|
227
|
+
end
|
228
|
+
|
229
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
230
|
+
if hostname !~ pattern
|
231
|
+
fail ArgumentError, "invalid value for \"hostname\", must conform to the pattern #{pattern}."
|
232
|
+
end
|
233
|
+
|
234
|
+
@hostname = hostname
|
235
|
+
end
|
236
|
+
|
237
|
+
# Custom attribute writer method with validation
|
238
|
+
# @param [Object] description Value to be assigned
|
239
|
+
def description=(description)
|
240
|
+
if description.nil?
|
241
|
+
fail ArgumentError, 'description cannot be nil'
|
242
|
+
end
|
243
|
+
|
244
|
+
if description.to_s.length > 250
|
245
|
+
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
|
246
|
+
end
|
247
|
+
|
248
|
+
@description = description
|
249
|
+
end
|
250
|
+
|
251
|
+
# Checks equality by comparing each attribute.
|
252
|
+
# @param [Object] Object to be compared
|
253
|
+
def ==(o)
|
254
|
+
return true if self.equal?(o)
|
255
|
+
self.class == o.class &&
|
256
|
+
hostname == o.hostname &&
|
257
|
+
description == o.description &&
|
258
|
+
os == o.os &&
|
259
|
+
install_default_ssh_keys == o.install_default_ssh_keys &&
|
260
|
+
ssh_keys == o.ssh_keys &&
|
261
|
+
ssh_key_ids == o.ssh_key_ids &&
|
262
|
+
network_type == o.network_type &&
|
263
|
+
os_configuration == o.os_configuration &&
|
264
|
+
tags == o.tags &&
|
265
|
+
network_configuration == o.network_configuration &&
|
266
|
+
storage_configuration == o.storage_configuration
|
267
|
+
end
|
268
|
+
|
269
|
+
# @see the `==` method
|
270
|
+
# @param [Object] Object to be compared
|
271
|
+
def eql?(o)
|
272
|
+
self == o
|
273
|
+
end
|
274
|
+
|
275
|
+
# Calculates hash code according to all attributes.
|
276
|
+
# @return [Integer] Hash code
|
277
|
+
def hash
|
278
|
+
[hostname, description, os, install_default_ssh_keys, ssh_keys, ssh_key_ids, network_type, os_configuration, tags, network_configuration, storage_configuration].hash
|
279
|
+
end
|
280
|
+
|
281
|
+
# Builds the object from hash
|
282
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
283
|
+
# @return [Object] Returns the model itself
|
284
|
+
def self.build_from_hash(attributes)
|
285
|
+
return nil unless attributes.is_a?(Hash)
|
286
|
+
attributes = attributes.transform_keys(&:to_sym)
|
287
|
+
transformed_hash = {}
|
288
|
+
openapi_types.each_pair do |key, type|
|
289
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
290
|
+
transformed_hash["#{key}"] = nil
|
291
|
+
elsif type =~ /\AArray<(.*)>/i
|
292
|
+
# check to ensure the input is an array given that the attribute
|
293
|
+
# is documented as an array but the input is not
|
294
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
295
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
296
|
+
end
|
297
|
+
elsif !attributes[attribute_map[key]].nil?
|
298
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
299
|
+
end
|
300
|
+
end
|
301
|
+
new(transformed_hash)
|
302
|
+
end
|
303
|
+
|
304
|
+
# Deserializes the data based on type
|
305
|
+
# @param string type Data type
|
306
|
+
# @param string value Value to be deserialized
|
307
|
+
# @return [Object] Deserialized data
|
308
|
+
def self._deserialize(type, value)
|
309
|
+
case type.to_sym
|
310
|
+
when :Time
|
311
|
+
Time.parse(value)
|
312
|
+
when :Date
|
313
|
+
Date.parse(value)
|
314
|
+
when :String
|
315
|
+
value.to_s
|
316
|
+
when :Integer
|
317
|
+
value.to_i
|
318
|
+
when :Float
|
319
|
+
value.to_f
|
320
|
+
when :Boolean
|
321
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
322
|
+
true
|
323
|
+
else
|
324
|
+
false
|
325
|
+
end
|
326
|
+
when :Object
|
327
|
+
# generic object (usually a Hash), return directly
|
328
|
+
value
|
329
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
330
|
+
inner_type = Regexp.last_match[:inner_type]
|
331
|
+
value.map { |v| _deserialize(inner_type, v) }
|
332
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
333
|
+
k_type = Regexp.last_match[:k_type]
|
334
|
+
v_type = Regexp.last_match[:v_type]
|
335
|
+
{}.tap do |hash|
|
336
|
+
value.each do |k, v|
|
337
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
else # model
|
341
|
+
# models (e.g. Pet) or oneOf
|
342
|
+
klass = BmcApi.const_get(type)
|
343
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
# Returns the string representation of the object
|
348
|
+
# @return [String] String presentation of the object
|
349
|
+
def to_s
|
350
|
+
to_hash.to_s
|
351
|
+
end
|
352
|
+
|
353
|
+
# to_body is an alias to to_hash (backward compatibility)
|
354
|
+
# @return [Hash] Returns the object in the form of hash
|
355
|
+
def to_body
|
356
|
+
to_hash
|
357
|
+
end
|
358
|
+
|
359
|
+
# Returns the object in the form of hash
|
360
|
+
# @return [Hash] Returns the object in the form of hash
|
361
|
+
def to_hash
|
362
|
+
hash = {}
|
363
|
+
self.class.attribute_map.each_pair do |attr, param|
|
364
|
+
value = self.send(attr)
|
365
|
+
if value.nil?
|
366
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
367
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
368
|
+
end
|
369
|
+
|
370
|
+
hash[param] = _to_hash(value)
|
371
|
+
end
|
372
|
+
hash
|
373
|
+
end
|
374
|
+
|
375
|
+
# Outputs non-array value in the form of hash
|
376
|
+
# For object, use to_hash. Otherwise, just return the value
|
377
|
+
# @param [Object] value Any valid value
|
378
|
+
# @return [Hash] Returns the value in the form of hash
|
379
|
+
def _to_hash(value)
|
380
|
+
if value.is_a?(Array)
|
381
|
+
value.compact.map { |v| _to_hash(v) }
|
382
|
+
elsif value.is_a?(Hash)
|
383
|
+
{}.tap do |hash|
|
384
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
385
|
+
end
|
386
|
+
elsif value.respond_to? :to_hash
|
387
|
+
value.to_hash
|
388
|
+
else
|
389
|
+
value
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
end
|
394
|
+
|
395
|
+
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
|
|
@@ -19,7 +19,7 @@ module BmcApi
|
|
19
19
|
# The network identifier.
|
20
20
|
attr_accessor :id
|
21
21
|
|
22
|
-
# Configurable/configured IPs on the server.<br> At least 1 IP address is required. All IPs must be within the network's range.<br> Setting the `force` query parameter to `true` allows you to:<ul> <li> Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network. <li> Assign one or more IP addresses which are already configured on other resource(s) in network.</ul>
|
22
|
+
# Configurable/configured IPs on the server.<br> At least 1 IP address is required. Valid IP formats are single IPv4 addresses or IPv4 ranges. All IPs must be within the network's range.<br> Setting the `force` query parameter to `true` allows you to:<ul> <li> Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network. <li> Assign one or more IP addresses which are already configured on other resource(s) in network.</ul>
|
23
23
|
attr_accessor :ips
|
24
24
|
|
25
25
|
# (Read-only) The status of the assignment to the network.
|
@@ -71,6 +71,8 @@ module BmcApi
|
|
71
71
|
|
72
72
|
if attributes.key?(:'id')
|
73
73
|
self.id = attributes[:'id']
|
74
|
+
else
|
75
|
+
self.id = nil
|
74
76
|
end
|
75
77
|
|
76
78
|
if attributes.key?(:'ips')
|
@@ -87,6 +89,7 @@ module BmcApi
|
|
87
89
|
# Show invalid properties with the reasons. Usually used together with valid?
|
88
90
|
# @return Array for valid properties with the reasons
|
89
91
|
def list_invalid_properties
|
92
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
90
93
|
invalid_properties = Array.new
|
91
94
|
if @id.nil?
|
92
95
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
@@ -98,6 +101,7 @@ module BmcApi
|
|
98
101
|
# Check to see if the all the properties in the model are valid
|
99
102
|
# @return true if the model is valid
|
100
103
|
def valid?
|
104
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
101
105
|
return false if @id.nil?
|
102
106
|
true
|
103
107
|
end
|
@@ -128,37 +132,30 @@ module BmcApi
|
|
128
132
|
# @param [Hash] attributes Model attributes in the form of hash
|
129
133
|
# @return [Object] Returns the model itself
|
130
134
|
def self.build_from_hash(attributes)
|
131
|
-
new.build_from_hash(attributes)
|
132
|
-
end
|
133
|
-
|
134
|
-
# Builds the object from hash
|
135
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
-
# @return [Object] Returns the model itself
|
137
|
-
def build_from_hash(attributes)
|
138
135
|
return nil unless attributes.is_a?(Hash)
|
139
136
|
attributes = attributes.transform_keys(&:to_sym)
|
140
|
-
|
141
|
-
|
142
|
-
|
137
|
+
transformed_hash = {}
|
138
|
+
openapi_types.each_pair do |key, type|
|
139
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
140
|
+
transformed_hash["#{key}"] = nil
|
143
141
|
elsif type =~ /\AArray<(.*)>/i
|
144
142
|
# check to ensure the input is an array given that the attribute
|
145
143
|
# is documented as an array but the input is not
|
146
|
-
if attributes[
|
147
|
-
|
144
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
145
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
148
146
|
end
|
149
|
-
elsif !attributes[
|
150
|
-
|
147
|
+
elsif !attributes[attribute_map[key]].nil?
|
148
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
151
149
|
end
|
152
150
|
end
|
153
|
-
|
154
|
-
self
|
151
|
+
new(transformed_hash)
|
155
152
|
end
|
156
153
|
|
157
154
|
# Deserializes the data based on type
|
158
155
|
# @param string type Data type
|
159
156
|
# @param string value Value to be deserialized
|
160
157
|
# @return [Object] Deserialized data
|
161
|
-
def _deserialize(type, value)
|
158
|
+
def self._deserialize(type, value)
|
162
159
|
case type.to_sym
|
163
160
|
when :Time
|
164
161
|
Time.parse(value)
|
@@ -193,7 +190,7 @@ module BmcApi
|
|
193
190
|
else # model
|
194
191
|
# models (e.g. Pet) or oneOf
|
195
192
|
klass = BmcApi.const_get(type)
|
196
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
193
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
197
194
|
end
|
198
195
|
end
|
199
196
|
|
@@ -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?(:'pricing_model')
|
63
63
|
self.pricing_model = attributes[:'pricing_model']
|
64
|
+
else
|
65
|
+
self.pricing_model = 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 @pricing_model.nil?
|
72
75
|
invalid_properties.push('invalid value for "pricing_model", pricing_model 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 @pricing_model.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
|
|
@@ -99,6 +99,7 @@ module BmcApi
|
|
99
99
|
# Show invalid properties with the reasons. Usually used together with valid?
|
100
100
|
# @return Array for valid properties with the reasons
|
101
101
|
def list_invalid_properties
|
102
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
102
103
|
invalid_properties = Array.new
|
103
104
|
invalid_properties
|
104
105
|
end
|
@@ -106,6 +107,7 @@ module BmcApi
|
|
106
107
|
# Check to see if the all the properties in the model are valid
|
107
108
|
# @return true if the model is valid
|
108
109
|
def valid?
|
110
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
109
111
|
true
|
110
112
|
end
|
111
113
|
|
@@ -136,37 +138,30 @@ module BmcApi
|
|
136
138
|
# @param [Hash] attributes Model attributes in the form of hash
|
137
139
|
# @return [Object] Returns the model itself
|
138
140
|
def self.build_from_hash(attributes)
|
139
|
-
new.build_from_hash(attributes)
|
140
|
-
end
|
141
|
-
|
142
|
-
# Builds the object from hash
|
143
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
144
|
-
# @return [Object] Returns the model itself
|
145
|
-
def build_from_hash(attributes)
|
146
141
|
return nil unless attributes.is_a?(Hash)
|
147
142
|
attributes = attributes.transform_keys(&:to_sym)
|
148
|
-
|
149
|
-
|
150
|
-
|
143
|
+
transformed_hash = {}
|
144
|
+
openapi_types.each_pair do |key, type|
|
145
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
146
|
+
transformed_hash["#{key}"] = nil
|
151
147
|
elsif type =~ /\AArray<(.*)>/i
|
152
148
|
# check to ensure the input is an array given that the attribute
|
153
149
|
# is documented as an array but the input is not
|
154
|
-
if attributes[
|
155
|
-
|
150
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
151
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
156
152
|
end
|
157
|
-
elsif !attributes[
|
158
|
-
|
153
|
+
elsif !attributes[attribute_map[key]].nil?
|
154
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
159
155
|
end
|
160
156
|
end
|
161
|
-
|
162
|
-
self
|
157
|
+
new(transformed_hash)
|
163
158
|
end
|
164
159
|
|
165
160
|
# Deserializes the data based on type
|
166
161
|
# @param string type Data type
|
167
162
|
# @param string value Value to be deserialized
|
168
163
|
# @return [Object] Deserialized data
|
169
|
-
def _deserialize(type, value)
|
164
|
+
def self._deserialize(type, value)
|
170
165
|
case type.to_sym
|
171
166
|
when :Time
|
172
167
|
Time.parse(value)
|
@@ -201,7 +196,7 @@ module BmcApi
|
|
201
196
|
else # model
|
202
197
|
# models (e.g. Pet) or oneOf
|
203
198
|
klass = BmcApi.const_get(type)
|
204
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
199
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
205
200
|
end
|
206
201
|
end
|
207
202
|
|