pnap_bmc_api 1.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 +7 -0
- data/Gemfile +9 -0
- data/README.md +196 -0
- data/Rakefile +10 -0
- data/VERSION +1 -0
- data/docs/ActionResult.md +18 -0
- data/docs/DeleteResult.md +20 -0
- data/docs/DeleteSshKeyResult.md +20 -0
- data/docs/Error.md +20 -0
- data/docs/IpBlocksConfiguration.md +20 -0
- data/docs/NetworkConfiguration.md +20 -0
- data/docs/OsConfiguration.md +24 -0
- data/docs/OsConfigurationMap.md +22 -0
- data/docs/OsConfigurationMapEsxi.md +22 -0
- data/docs/OsConfigurationMapProxmox.md +22 -0
- data/docs/OsConfigurationWindows.md +18 -0
- data/docs/PrivateNetworkConfiguration.md +22 -0
- data/docs/Quota.md +32 -0
- data/docs/QuotaEditLimitRequest.md +20 -0
- data/docs/QuotaEditLimitRequestDetails.md +22 -0
- data/docs/QuotaEditLimitRequestDetailsAllOf.md +18 -0
- data/docs/QuotasApi.md +217 -0
- data/docs/RelinquishIpBlock.md +18 -0
- data/docs/ResetResult.md +22 -0
- data/docs/SSHKeysApi.md +360 -0
- data/docs/Server.md +64 -0
- data/docs/ServerCreate.md +44 -0
- data/docs/ServerIpBlock.md +20 -0
- data/docs/ServerPatch.md +20 -0
- data/docs/ServerPrivateNetwork.md +24 -0
- data/docs/ServerReserve.md +18 -0
- data/docs/ServerReset.md +24 -0
- data/docs/ServersApi.md +1237 -0
- data/docs/SshKey.md +30 -0
- data/docs/SshKeyCreate.md +22 -0
- data/docs/SshKeyUpdate.md +20 -0
- data/docs/TagAssignment.md +26 -0
- data/docs/TagAssignmentRequest.md +20 -0
- data/lib/pnap_bmc_api/api/quotas_api.rb +212 -0
- data/lib/pnap_bmc_api/api/servers_api.rb +1159 -0
- data/lib/pnap_bmc_api/api/ssh_keys_api.rb +339 -0
- data/lib/pnap_bmc_api/api_client.rb +392 -0
- data/lib/pnap_bmc_api/api_error.rb +57 -0
- data/lib/pnap_bmc_api/configuration.rb +278 -0
- data/lib/pnap_bmc_api/models/action_result.rb +225 -0
- data/lib/pnap_bmc_api/models/delete_result.rb +240 -0
- data/lib/pnap_bmc_api/models/delete_ssh_key_result.rb +240 -0
- data/lib/pnap_bmc_api/models/error.rb +236 -0
- data/lib/pnap_bmc_api/models/ip_blocks_configuration.rb +283 -0
- data/lib/pnap_bmc_api/models/network_configuration.rb +228 -0
- data/lib/pnap_bmc_api/models/os_configuration.rb +266 -0
- data/lib/pnap_bmc_api/models/os_configuration_map.rb +237 -0
- data/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb +257 -0
- data/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb +257 -0
- data/lib/pnap_bmc_api/models/os_configuration_windows.rb +237 -0
- data/lib/pnap_bmc_api/models/private_network_configuration.rb +244 -0
- data/lib/pnap_bmc_api/models/quota.rb +415 -0
- data/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +259 -0
- data/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +281 -0
- data/lib/pnap_bmc_api/models/quota_edit_limit_request_details_all_of.rb +225 -0
- data/lib/pnap_bmc_api/models/relinquish_ip_block.rb +222 -0
- data/lib/pnap_bmc_api/models/reset_result.rb +244 -0
- data/lib/pnap_bmc_api/models/server.rb +687 -0
- data/lib/pnap_bmc_api/models/server_create.rb +434 -0
- data/lib/pnap_bmc_api/models/server_ip_block.rb +235 -0
- data/lib/pnap_bmc_api/models/server_patch.rb +280 -0
- data/lib/pnap_bmc_api/models/server_private_network.rb +274 -0
- data/lib/pnap_bmc_api/models/server_reserve.rb +225 -0
- data/lib/pnap_bmc_api/models/server_reset.rb +255 -0
- data/lib/pnap_bmc_api/models/ssh_key.rb +315 -0
- data/lib/pnap_bmc_api/models/ssh_key_create.rb +283 -0
- data/lib/pnap_bmc_api/models/ssh_key_update.rb +268 -0
- data/lib/pnap_bmc_api/models/tag_assignment.rb +309 -0
- data/lib/pnap_bmc_api/models/tag_assignment_request.rb +235 -0
- data/lib/pnap_bmc_api/version.rb +19 -0
- data/lib/pnap_bmc_api.rb +72 -0
- data/pnap_bmc_api.gemspec +39 -0
- data/spec/api/quotas_api_spec.rb +71 -0
- data/spec/api/servers_api_spec.rb +249 -0
- data/spec/api/ssh_keys_api_spec.rb +95 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/action_result_spec.rb +34 -0
- data/spec/models/delete_result_spec.rb +40 -0
- data/spec/models/delete_ssh_key_result_spec.rb +40 -0
- data/spec/models/error_spec.rb +40 -0
- data/spec/models/ip_blocks_configuration_spec.rb +44 -0
- data/spec/models/network_configuration_spec.rb +40 -0
- data/spec/models/os_configuration_map_esxi_spec.rb +46 -0
- data/spec/models/os_configuration_map_proxmox_spec.rb +46 -0
- data/spec/models/os_configuration_map_spec.rb +46 -0
- data/spec/models/os_configuration_spec.rb +52 -0
- data/spec/models/os_configuration_windows_spec.rb +34 -0
- data/spec/models/private_network_configuration_spec.rb +46 -0
- data/spec/models/quota_edit_limit_request_details_all_of_spec.rb +34 -0
- data/spec/models/quota_edit_limit_request_details_spec.rb +46 -0
- data/spec/models/quota_edit_limit_request_spec.rb +40 -0
- data/spec/models/quota_spec.rb +84 -0
- data/spec/models/relinquish_ip_block_spec.rb +34 -0
- data/spec/models/reset_result_spec.rb +46 -0
- data/spec/models/server_create_spec.rb +112 -0
- data/spec/models/server_ip_block_spec.rb +40 -0
- data/spec/models/server_patch_spec.rb +40 -0
- data/spec/models/server_private_network_spec.rb +52 -0
- data/spec/models/server_reserve_spec.rb +34 -0
- data/spec/models/server_reset_spec.rb +52 -0
- data/spec/models/server_spec.rb +172 -0
- data/spec/models/ssh_key_create_spec.rb +46 -0
- data/spec/models/ssh_key_spec.rb +70 -0
- data/spec/models/ssh_key_update_spec.rb +40 -0
- data/spec/models/tag_assignment_request_spec.rb +40 -0
- data/spec/models/tag_assignment_spec.rb +62 -0
- data/spec/spec_helper.rb +111 -0
- metadata +232 -0
@@ -0,0 +1,687 @@
|
|
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, 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: 5.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module BmcApi
|
17
|
+
# Bare metal server.
|
18
|
+
class Server
|
19
|
+
# The unique identifier of the server.
|
20
|
+
attr_accessor :id
|
21
|
+
|
22
|
+
# The status of the server.
|
23
|
+
attr_accessor :status
|
24
|
+
|
25
|
+
# Hostname of server.
|
26
|
+
attr_accessor :hostname
|
27
|
+
|
28
|
+
# Description of server.
|
29
|
+
attr_accessor :description
|
30
|
+
|
31
|
+
# The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `centos/centos7`, `windows/srv2019std`, `windows/srv2019dc`, `esxi/esxi70u2`, `debian/bullseye` or `proxmox/bullseye`.
|
32
|
+
attr_accessor :os
|
33
|
+
|
34
|
+
# Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m2.medium`, `d2.m2.large` or `d2.m2.xlarge`.
|
35
|
+
attr_accessor :type
|
36
|
+
|
37
|
+
# Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`.
|
38
|
+
attr_accessor :location
|
39
|
+
|
40
|
+
# A description of the machine CPU.
|
41
|
+
attr_accessor :cpu
|
42
|
+
|
43
|
+
# The number of CPUs available in the system.
|
44
|
+
attr_accessor :cpu_count
|
45
|
+
|
46
|
+
# The number of physical cores present on each CPU.
|
47
|
+
attr_accessor :cores_per_cpu
|
48
|
+
|
49
|
+
# The CPU frequency in GHz.
|
50
|
+
attr_accessor :cpu_frequency
|
51
|
+
|
52
|
+
# A description of the machine RAM.
|
53
|
+
attr_accessor :ram
|
54
|
+
|
55
|
+
# A description of the machine storage.
|
56
|
+
attr_accessor :storage
|
57
|
+
|
58
|
+
# Private IP addresses assigned to server.
|
59
|
+
attr_accessor :private_ip_addresses
|
60
|
+
|
61
|
+
# Public IP addresses assigned to server.
|
62
|
+
attr_accessor :public_ip_addresses
|
63
|
+
|
64
|
+
# The reservation reference id if any.
|
65
|
+
attr_accessor :reservation_id
|
66
|
+
|
67
|
+
# The pricing model this server is being billed. Currently this field should be set to `HOURLY`, `ONE_MONTH_RESERVATION`, `TWELVE_MONTHS_RESERVATION`, `TWENTY_FOUR_MONTHS_RESERVATION` or `THIRTY_SIX_MONTHS_RESERVATION`.
|
68
|
+
attr_accessor :pricing_model
|
69
|
+
|
70
|
+
# Password set for user Admin on Windows server or user root on ESXi server which will only be returned in response to provisioning a server.
|
71
|
+
attr_accessor :password
|
72
|
+
|
73
|
+
# The type of network configuration for this server. Currently this field should be set to `PUBLIC_AND_PRIVATE` or `PRIVATE_ONLY`.
|
74
|
+
attr_accessor :network_type
|
75
|
+
|
76
|
+
# The cluster reference id if any.
|
77
|
+
attr_accessor :cluster_id
|
78
|
+
|
79
|
+
# The tags assigned if any.
|
80
|
+
attr_accessor :tags
|
81
|
+
|
82
|
+
# Date and time when server was provisioned.
|
83
|
+
attr_accessor :provisioned_on
|
84
|
+
|
85
|
+
attr_accessor :os_configuration
|
86
|
+
|
87
|
+
attr_accessor :network_configuration
|
88
|
+
|
89
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
90
|
+
def self.attribute_map
|
91
|
+
{
|
92
|
+
:'id' => :'id',
|
93
|
+
:'status' => :'status',
|
94
|
+
:'hostname' => :'hostname',
|
95
|
+
:'description' => :'description',
|
96
|
+
:'os' => :'os',
|
97
|
+
:'type' => :'type',
|
98
|
+
:'location' => :'location',
|
99
|
+
:'cpu' => :'cpu',
|
100
|
+
:'cpu_count' => :'cpuCount',
|
101
|
+
:'cores_per_cpu' => :'coresPerCpu',
|
102
|
+
:'cpu_frequency' => :'cpuFrequency',
|
103
|
+
:'ram' => :'ram',
|
104
|
+
:'storage' => :'storage',
|
105
|
+
:'private_ip_addresses' => :'privateIpAddresses',
|
106
|
+
:'public_ip_addresses' => :'publicIpAddresses',
|
107
|
+
:'reservation_id' => :'reservationId',
|
108
|
+
:'pricing_model' => :'pricingModel',
|
109
|
+
:'password' => :'password',
|
110
|
+
:'network_type' => :'networkType',
|
111
|
+
:'cluster_id' => :'clusterId',
|
112
|
+
:'tags' => :'tags',
|
113
|
+
:'provisioned_on' => :'provisionedOn',
|
114
|
+
:'os_configuration' => :'osConfiguration',
|
115
|
+
:'network_configuration' => :'networkConfiguration'
|
116
|
+
}
|
117
|
+
end
|
118
|
+
|
119
|
+
# Returns all the JSON keys this model knows about
|
120
|
+
def self.acceptable_attributes
|
121
|
+
attribute_map.values
|
122
|
+
end
|
123
|
+
|
124
|
+
# Attribute type mapping.
|
125
|
+
def self.openapi_types
|
126
|
+
{
|
127
|
+
:'id' => :'String',
|
128
|
+
:'status' => :'String',
|
129
|
+
:'hostname' => :'String',
|
130
|
+
:'description' => :'String',
|
131
|
+
:'os' => :'String',
|
132
|
+
:'type' => :'String',
|
133
|
+
:'location' => :'String',
|
134
|
+
:'cpu' => :'String',
|
135
|
+
:'cpu_count' => :'Integer',
|
136
|
+
:'cores_per_cpu' => :'Integer',
|
137
|
+
:'cpu_frequency' => :'Float',
|
138
|
+
:'ram' => :'String',
|
139
|
+
:'storage' => :'String',
|
140
|
+
:'private_ip_addresses' => :'Array<String>',
|
141
|
+
:'public_ip_addresses' => :'Array<String>',
|
142
|
+
:'reservation_id' => :'String',
|
143
|
+
:'pricing_model' => :'String',
|
144
|
+
:'password' => :'String',
|
145
|
+
:'network_type' => :'String',
|
146
|
+
:'cluster_id' => :'String',
|
147
|
+
:'tags' => :'Array<TagAssignment>',
|
148
|
+
:'provisioned_on' => :'Time',
|
149
|
+
:'os_configuration' => :'OsConfiguration',
|
150
|
+
:'network_configuration' => :'NetworkConfiguration'
|
151
|
+
}
|
152
|
+
end
|
153
|
+
|
154
|
+
# List of attributes with nullable: true
|
155
|
+
def self.openapi_nullable
|
156
|
+
Set.new([
|
157
|
+
])
|
158
|
+
end
|
159
|
+
|
160
|
+
# Initializes the object
|
161
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
162
|
+
def initialize(attributes = {})
|
163
|
+
if (!attributes.is_a?(Hash))
|
164
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::Server` initialize method"
|
165
|
+
end
|
166
|
+
|
167
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
168
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
169
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
170
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::Server`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
171
|
+
end
|
172
|
+
h[k.to_sym] = v
|
173
|
+
}
|
174
|
+
|
175
|
+
if attributes.key?(:'id')
|
176
|
+
self.id = attributes[:'id']
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.key?(:'status')
|
180
|
+
self.status = attributes[:'status']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.key?(:'hostname')
|
184
|
+
self.hostname = attributes[:'hostname']
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.key?(:'description')
|
188
|
+
self.description = attributes[:'description']
|
189
|
+
end
|
190
|
+
|
191
|
+
if attributes.key?(:'os')
|
192
|
+
self.os = attributes[:'os']
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.key?(:'type')
|
196
|
+
self.type = attributes[:'type']
|
197
|
+
end
|
198
|
+
|
199
|
+
if attributes.key?(:'location')
|
200
|
+
self.location = attributes[:'location']
|
201
|
+
end
|
202
|
+
|
203
|
+
if attributes.key?(:'cpu')
|
204
|
+
self.cpu = attributes[:'cpu']
|
205
|
+
end
|
206
|
+
|
207
|
+
if attributes.key?(:'cpu_count')
|
208
|
+
self.cpu_count = attributes[:'cpu_count']
|
209
|
+
end
|
210
|
+
|
211
|
+
if attributes.key?(:'cores_per_cpu')
|
212
|
+
self.cores_per_cpu = attributes[:'cores_per_cpu']
|
213
|
+
end
|
214
|
+
|
215
|
+
if attributes.key?(:'cpu_frequency')
|
216
|
+
self.cpu_frequency = attributes[:'cpu_frequency']
|
217
|
+
end
|
218
|
+
|
219
|
+
if attributes.key?(:'ram')
|
220
|
+
self.ram = attributes[:'ram']
|
221
|
+
end
|
222
|
+
|
223
|
+
if attributes.key?(:'storage')
|
224
|
+
self.storage = attributes[:'storage']
|
225
|
+
end
|
226
|
+
|
227
|
+
if attributes.key?(:'private_ip_addresses')
|
228
|
+
if (value = attributes[:'private_ip_addresses']).is_a?(Array)
|
229
|
+
self.private_ip_addresses = value
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
if attributes.key?(:'public_ip_addresses')
|
234
|
+
if (value = attributes[:'public_ip_addresses']).is_a?(Array)
|
235
|
+
self.public_ip_addresses = value
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
if attributes.key?(:'reservation_id')
|
240
|
+
self.reservation_id = attributes[:'reservation_id']
|
241
|
+
end
|
242
|
+
|
243
|
+
if attributes.key?(:'pricing_model')
|
244
|
+
self.pricing_model = attributes[:'pricing_model']
|
245
|
+
else
|
246
|
+
self.pricing_model = 'HOURLY'
|
247
|
+
end
|
248
|
+
|
249
|
+
if attributes.key?(:'password')
|
250
|
+
self.password = attributes[:'password']
|
251
|
+
end
|
252
|
+
|
253
|
+
if attributes.key?(:'network_type')
|
254
|
+
self.network_type = attributes[:'network_type']
|
255
|
+
else
|
256
|
+
self.network_type = 'PUBLIC_AND_PRIVATE'
|
257
|
+
end
|
258
|
+
|
259
|
+
if attributes.key?(:'cluster_id')
|
260
|
+
self.cluster_id = attributes[:'cluster_id']
|
261
|
+
end
|
262
|
+
|
263
|
+
if attributes.key?(:'tags')
|
264
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
265
|
+
self.tags = value
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
if attributes.key?(:'provisioned_on')
|
270
|
+
self.provisioned_on = attributes[:'provisioned_on']
|
271
|
+
end
|
272
|
+
|
273
|
+
if attributes.key?(:'os_configuration')
|
274
|
+
self.os_configuration = attributes[:'os_configuration']
|
275
|
+
end
|
276
|
+
|
277
|
+
if attributes.key?(:'network_configuration')
|
278
|
+
self.network_configuration = attributes[:'network_configuration']
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
283
|
+
# @return Array for valid properties with the reasons
|
284
|
+
def list_invalid_properties
|
285
|
+
invalid_properties = Array.new
|
286
|
+
if @id.nil?
|
287
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
288
|
+
end
|
289
|
+
|
290
|
+
if @status.nil?
|
291
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
292
|
+
end
|
293
|
+
|
294
|
+
if @hostname.nil?
|
295
|
+
invalid_properties.push('invalid value for "hostname", hostname cannot be nil.')
|
296
|
+
end
|
297
|
+
|
298
|
+
if @hostname.to_s.length > 100
|
299
|
+
invalid_properties.push('invalid value for "hostname", the character length must be smaller than or equal to 100.')
|
300
|
+
end
|
301
|
+
|
302
|
+
if @hostname.to_s.length < 1
|
303
|
+
invalid_properties.push('invalid value for "hostname", the character length must be great than or equal to 1.')
|
304
|
+
end
|
305
|
+
|
306
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
307
|
+
if @hostname !~ pattern
|
308
|
+
invalid_properties.push("invalid value for \"hostname\", must conform to the pattern #{pattern}.")
|
309
|
+
end
|
310
|
+
|
311
|
+
if !@description.nil? && @description.to_s.length > 250
|
312
|
+
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
|
313
|
+
end
|
314
|
+
|
315
|
+
if @os.nil?
|
316
|
+
invalid_properties.push('invalid value for "os", os cannot be nil.')
|
317
|
+
end
|
318
|
+
|
319
|
+
if @type.nil?
|
320
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
321
|
+
end
|
322
|
+
|
323
|
+
if @location.nil?
|
324
|
+
invalid_properties.push('invalid value for "location", location cannot be nil.')
|
325
|
+
end
|
326
|
+
|
327
|
+
if @cpu.nil?
|
328
|
+
invalid_properties.push('invalid value for "cpu", cpu cannot be nil.')
|
329
|
+
end
|
330
|
+
|
331
|
+
if @cpu_count.nil?
|
332
|
+
invalid_properties.push('invalid value for "cpu_count", cpu_count cannot be nil.')
|
333
|
+
end
|
334
|
+
|
335
|
+
if @cpu_count < 1
|
336
|
+
invalid_properties.push('invalid value for "cpu_count", must be greater than or equal to 1.')
|
337
|
+
end
|
338
|
+
|
339
|
+
if @cores_per_cpu.nil?
|
340
|
+
invalid_properties.push('invalid value for "cores_per_cpu", cores_per_cpu cannot be nil.')
|
341
|
+
end
|
342
|
+
|
343
|
+
if @cores_per_cpu < 1
|
344
|
+
invalid_properties.push('invalid value for "cores_per_cpu", must be greater than or equal to 1.')
|
345
|
+
end
|
346
|
+
|
347
|
+
if @cpu_frequency.nil?
|
348
|
+
invalid_properties.push('invalid value for "cpu_frequency", cpu_frequency cannot be nil.')
|
349
|
+
end
|
350
|
+
|
351
|
+
if @cpu_frequency < 0
|
352
|
+
invalid_properties.push('invalid value for "cpu_frequency", must be greater than or equal to 0.')
|
353
|
+
end
|
354
|
+
|
355
|
+
if @ram.nil?
|
356
|
+
invalid_properties.push('invalid value for "ram", ram cannot be nil.')
|
357
|
+
end
|
358
|
+
|
359
|
+
if @storage.nil?
|
360
|
+
invalid_properties.push('invalid value for "storage", storage cannot be nil.')
|
361
|
+
end
|
362
|
+
|
363
|
+
if @private_ip_addresses.nil?
|
364
|
+
invalid_properties.push('invalid value for "private_ip_addresses", private_ip_addresses cannot be nil.')
|
365
|
+
end
|
366
|
+
|
367
|
+
if @private_ip_addresses.length < 1
|
368
|
+
invalid_properties.push('invalid value for "private_ip_addresses", number of items must be greater than or equal to 1.')
|
369
|
+
end
|
370
|
+
|
371
|
+
if @public_ip_addresses.nil?
|
372
|
+
invalid_properties.push('invalid value for "public_ip_addresses", public_ip_addresses cannot be nil.')
|
373
|
+
end
|
374
|
+
|
375
|
+
if @public_ip_addresses.length < 1
|
376
|
+
invalid_properties.push('invalid value for "public_ip_addresses", number of items must be greater than or equal to 1.')
|
377
|
+
end
|
378
|
+
|
379
|
+
if @pricing_model.nil?
|
380
|
+
invalid_properties.push('invalid value for "pricing_model", pricing_model cannot be nil.')
|
381
|
+
end
|
382
|
+
|
383
|
+
if @network_configuration.nil?
|
384
|
+
invalid_properties.push('invalid value for "network_configuration", network_configuration cannot be nil.')
|
385
|
+
end
|
386
|
+
|
387
|
+
invalid_properties
|
388
|
+
end
|
389
|
+
|
390
|
+
# Check to see if the all the properties in the model are valid
|
391
|
+
# @return true if the model is valid
|
392
|
+
def valid?
|
393
|
+
return false if @id.nil?
|
394
|
+
return false if @status.nil?
|
395
|
+
return false if @hostname.nil?
|
396
|
+
return false if @hostname.to_s.length > 100
|
397
|
+
return false if @hostname.to_s.length < 1
|
398
|
+
return false if @hostname !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
399
|
+
return false if !@description.nil? && @description.to_s.length > 250
|
400
|
+
return false if @os.nil?
|
401
|
+
return false if @type.nil?
|
402
|
+
return false if @location.nil?
|
403
|
+
return false if @cpu.nil?
|
404
|
+
return false if @cpu_count.nil?
|
405
|
+
return false if @cpu_count < 1
|
406
|
+
return false if @cores_per_cpu.nil?
|
407
|
+
return false if @cores_per_cpu < 1
|
408
|
+
return false if @cpu_frequency.nil?
|
409
|
+
return false if @cpu_frequency < 0
|
410
|
+
return false if @ram.nil?
|
411
|
+
return false if @storage.nil?
|
412
|
+
return false if @private_ip_addresses.nil?
|
413
|
+
return false if @private_ip_addresses.length < 1
|
414
|
+
return false if @public_ip_addresses.nil?
|
415
|
+
return false if @public_ip_addresses.length < 1
|
416
|
+
return false if @pricing_model.nil?
|
417
|
+
return false if @network_configuration.nil?
|
418
|
+
true
|
419
|
+
end
|
420
|
+
|
421
|
+
# Custom attribute writer method with validation
|
422
|
+
# @param [Object] hostname Value to be assigned
|
423
|
+
def hostname=(hostname)
|
424
|
+
if hostname.nil?
|
425
|
+
fail ArgumentError, 'hostname cannot be nil'
|
426
|
+
end
|
427
|
+
|
428
|
+
if hostname.to_s.length > 100
|
429
|
+
fail ArgumentError, 'invalid value for "hostname", the character length must be smaller than or equal to 100.'
|
430
|
+
end
|
431
|
+
|
432
|
+
if hostname.to_s.length < 1
|
433
|
+
fail ArgumentError, 'invalid value for "hostname", the character length must be great than or equal to 1.'
|
434
|
+
end
|
435
|
+
|
436
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
|
437
|
+
if hostname !~ pattern
|
438
|
+
fail ArgumentError, "invalid value for \"hostname\", must conform to the pattern #{pattern}."
|
439
|
+
end
|
440
|
+
|
441
|
+
@hostname = hostname
|
442
|
+
end
|
443
|
+
|
444
|
+
# Custom attribute writer method with validation
|
445
|
+
# @param [Object] description Value to be assigned
|
446
|
+
def description=(description)
|
447
|
+
if !description.nil? && description.to_s.length > 250
|
448
|
+
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
|
449
|
+
end
|
450
|
+
|
451
|
+
@description = description
|
452
|
+
end
|
453
|
+
|
454
|
+
# Custom attribute writer method with validation
|
455
|
+
# @param [Object] cpu_count Value to be assigned
|
456
|
+
def cpu_count=(cpu_count)
|
457
|
+
if cpu_count.nil?
|
458
|
+
fail ArgumentError, 'cpu_count cannot be nil'
|
459
|
+
end
|
460
|
+
|
461
|
+
if cpu_count < 1
|
462
|
+
fail ArgumentError, 'invalid value for "cpu_count", must be greater than or equal to 1.'
|
463
|
+
end
|
464
|
+
|
465
|
+
@cpu_count = cpu_count
|
466
|
+
end
|
467
|
+
|
468
|
+
# Custom attribute writer method with validation
|
469
|
+
# @param [Object] cores_per_cpu Value to be assigned
|
470
|
+
def cores_per_cpu=(cores_per_cpu)
|
471
|
+
if cores_per_cpu.nil?
|
472
|
+
fail ArgumentError, 'cores_per_cpu cannot be nil'
|
473
|
+
end
|
474
|
+
|
475
|
+
if cores_per_cpu < 1
|
476
|
+
fail ArgumentError, 'invalid value for "cores_per_cpu", must be greater than or equal to 1.'
|
477
|
+
end
|
478
|
+
|
479
|
+
@cores_per_cpu = cores_per_cpu
|
480
|
+
end
|
481
|
+
|
482
|
+
# Custom attribute writer method with validation
|
483
|
+
# @param [Object] cpu_frequency Value to be assigned
|
484
|
+
def cpu_frequency=(cpu_frequency)
|
485
|
+
if cpu_frequency.nil?
|
486
|
+
fail ArgumentError, 'cpu_frequency cannot be nil'
|
487
|
+
end
|
488
|
+
|
489
|
+
if cpu_frequency < 0
|
490
|
+
fail ArgumentError, 'invalid value for "cpu_frequency", must be greater than or equal to 0.'
|
491
|
+
end
|
492
|
+
|
493
|
+
@cpu_frequency = cpu_frequency
|
494
|
+
end
|
495
|
+
|
496
|
+
# Custom attribute writer method with validation
|
497
|
+
# @param [Object] private_ip_addresses Value to be assigned
|
498
|
+
def private_ip_addresses=(private_ip_addresses)
|
499
|
+
if private_ip_addresses.nil?
|
500
|
+
fail ArgumentError, 'private_ip_addresses cannot be nil'
|
501
|
+
end
|
502
|
+
|
503
|
+
if private_ip_addresses.length < 1
|
504
|
+
fail ArgumentError, 'invalid value for "private_ip_addresses", number of items must be greater than or equal to 1.'
|
505
|
+
end
|
506
|
+
|
507
|
+
@private_ip_addresses = private_ip_addresses
|
508
|
+
end
|
509
|
+
|
510
|
+
# Custom attribute writer method with validation
|
511
|
+
# @param [Object] public_ip_addresses Value to be assigned
|
512
|
+
def public_ip_addresses=(public_ip_addresses)
|
513
|
+
if public_ip_addresses.nil?
|
514
|
+
fail ArgumentError, 'public_ip_addresses cannot be nil'
|
515
|
+
end
|
516
|
+
|
517
|
+
if public_ip_addresses.length < 1
|
518
|
+
fail ArgumentError, 'invalid value for "public_ip_addresses", number of items must be greater than or equal to 1.'
|
519
|
+
end
|
520
|
+
|
521
|
+
@public_ip_addresses = public_ip_addresses
|
522
|
+
end
|
523
|
+
|
524
|
+
# Checks equality by comparing each attribute.
|
525
|
+
# @param [Object] Object to be compared
|
526
|
+
def ==(o)
|
527
|
+
return true if self.equal?(o)
|
528
|
+
self.class == o.class &&
|
529
|
+
id == o.id &&
|
530
|
+
status == o.status &&
|
531
|
+
hostname == o.hostname &&
|
532
|
+
description == o.description &&
|
533
|
+
os == o.os &&
|
534
|
+
type == o.type &&
|
535
|
+
location == o.location &&
|
536
|
+
cpu == o.cpu &&
|
537
|
+
cpu_count == o.cpu_count &&
|
538
|
+
cores_per_cpu == o.cores_per_cpu &&
|
539
|
+
cpu_frequency == o.cpu_frequency &&
|
540
|
+
ram == o.ram &&
|
541
|
+
storage == o.storage &&
|
542
|
+
private_ip_addresses == o.private_ip_addresses &&
|
543
|
+
public_ip_addresses == o.public_ip_addresses &&
|
544
|
+
reservation_id == o.reservation_id &&
|
545
|
+
pricing_model == o.pricing_model &&
|
546
|
+
password == o.password &&
|
547
|
+
network_type == o.network_type &&
|
548
|
+
cluster_id == o.cluster_id &&
|
549
|
+
tags == o.tags &&
|
550
|
+
provisioned_on == o.provisioned_on &&
|
551
|
+
os_configuration == o.os_configuration &&
|
552
|
+
network_configuration == o.network_configuration
|
553
|
+
end
|
554
|
+
|
555
|
+
# @see the `==` method
|
556
|
+
# @param [Object] Object to be compared
|
557
|
+
def eql?(o)
|
558
|
+
self == o
|
559
|
+
end
|
560
|
+
|
561
|
+
# Calculates hash code according to all attributes.
|
562
|
+
# @return [Integer] Hash code
|
563
|
+
def hash
|
564
|
+
[id, status, hostname, description, os, type, location, cpu, cpu_count, cores_per_cpu, cpu_frequency, ram, storage, private_ip_addresses, public_ip_addresses, reservation_id, pricing_model, password, network_type, cluster_id, tags, provisioned_on, os_configuration, network_configuration].hash
|
565
|
+
end
|
566
|
+
|
567
|
+
# Builds the object from hash
|
568
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
569
|
+
# @return [Object] Returns the model itself
|
570
|
+
def self.build_from_hash(attributes)
|
571
|
+
new.build_from_hash(attributes)
|
572
|
+
end
|
573
|
+
|
574
|
+
# Builds the object from hash
|
575
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
576
|
+
# @return [Object] Returns the model itself
|
577
|
+
def build_from_hash(attributes)
|
578
|
+
return nil unless attributes.is_a?(Hash)
|
579
|
+
self.class.openapi_types.each_pair do |key, type|
|
580
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
581
|
+
self.send("#{key}=", nil)
|
582
|
+
elsif type =~ /\AArray<(.*)>/i
|
583
|
+
# check to ensure the input is an array given that the attribute
|
584
|
+
# is documented as an array but the input is not
|
585
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
586
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
587
|
+
end
|
588
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
589
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
self
|
594
|
+
end
|
595
|
+
|
596
|
+
# Deserializes the data based on type
|
597
|
+
# @param string type Data type
|
598
|
+
# @param string value Value to be deserialized
|
599
|
+
# @return [Object] Deserialized data
|
600
|
+
def _deserialize(type, value)
|
601
|
+
case type.to_sym
|
602
|
+
when :Time
|
603
|
+
Time.parse(value)
|
604
|
+
when :Date
|
605
|
+
Date.parse(value)
|
606
|
+
when :String
|
607
|
+
value.to_s
|
608
|
+
when :Integer
|
609
|
+
value.to_i
|
610
|
+
when :Float
|
611
|
+
value.to_f
|
612
|
+
when :Boolean
|
613
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
614
|
+
true
|
615
|
+
else
|
616
|
+
false
|
617
|
+
end
|
618
|
+
when :Object
|
619
|
+
# generic object (usually a Hash), return directly
|
620
|
+
value
|
621
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
622
|
+
inner_type = Regexp.last_match[:inner_type]
|
623
|
+
value.map { |v| _deserialize(inner_type, v) }
|
624
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
625
|
+
k_type = Regexp.last_match[:k_type]
|
626
|
+
v_type = Regexp.last_match[:v_type]
|
627
|
+
{}.tap do |hash|
|
628
|
+
value.each do |k, v|
|
629
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
630
|
+
end
|
631
|
+
end
|
632
|
+
else # model
|
633
|
+
# models (e.g. Pet) or oneOf
|
634
|
+
klass = BmcApi.const_get(type)
|
635
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
636
|
+
end
|
637
|
+
end
|
638
|
+
|
639
|
+
# Returns the string representation of the object
|
640
|
+
# @return [String] String presentation of the object
|
641
|
+
def to_s
|
642
|
+
to_hash.to_s
|
643
|
+
end
|
644
|
+
|
645
|
+
# to_body is an alias to to_hash (backward compatibility)
|
646
|
+
# @return [Hash] Returns the object in the form of hash
|
647
|
+
def to_body
|
648
|
+
to_hash
|
649
|
+
end
|
650
|
+
|
651
|
+
# Returns the object in the form of hash
|
652
|
+
# @return [Hash] Returns the object in the form of hash
|
653
|
+
def to_hash
|
654
|
+
hash = {}
|
655
|
+
self.class.attribute_map.each_pair do |attr, param|
|
656
|
+
value = self.send(attr)
|
657
|
+
if value.nil?
|
658
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
659
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
660
|
+
end
|
661
|
+
|
662
|
+
hash[param] = _to_hash(value)
|
663
|
+
end
|
664
|
+
hash
|
665
|
+
end
|
666
|
+
|
667
|
+
# Outputs non-array value in the form of hash
|
668
|
+
# For object, use to_hash. Otherwise, just return the value
|
669
|
+
# @param [Object] value Any valid value
|
670
|
+
# @return [Hash] Returns the value in the form of hash
|
671
|
+
def _to_hash(value)
|
672
|
+
if value.is_a?(Array)
|
673
|
+
value.compact.map { |v| _to_hash(v) }
|
674
|
+
elsif value.is_a?(Hash)
|
675
|
+
{}.tap do |hash|
|
676
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
677
|
+
end
|
678
|
+
elsif value.respond_to? :to_hash
|
679
|
+
value.to_hash
|
680
|
+
else
|
681
|
+
value
|
682
|
+
end
|
683
|
+
end
|
684
|
+
|
685
|
+
end
|
686
|
+
|
687
|
+
end
|