Class: BmcApi::Server
- Inherits:
-
Object
- Object
- BmcApi::Server
- Defined in:
- lib/pnap_bmc_api/models/server.rb
Overview
Bare metal server.
Instance Attribute Summary collapse
-
#cluster_id ⇒ Object
The cluster reference id if any.
-
#cores_per_cpu ⇒ Object
The number of physical cores present on each CPU.
-
#cpu ⇒ Object
A description of the machine CPU.
-
#cpu_count ⇒ Object
The number of CPUs available in the system.
-
#cpu_frequency ⇒ Object
The CPU frequency in GHz.
-
#description ⇒ Object
Description of server.
-
#hostname ⇒ Object
Hostname of server.
-
#id ⇒ Object
The unique identifier of the server.
-
#location ⇒ Object
Server location ID.
-
#network_configuration ⇒ Object
Returns the value of attribute network_configuration.
-
#network_type ⇒ Object
The type of network configuration for this server.
-
#os ⇒ Object
The server’s OS ID used when the server was created.
-
#os_configuration ⇒ Object
Returns the value of attribute os_configuration.
-
#password ⇒ Object
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.
-
#pricing_model ⇒ Object
The pricing model this server is being billed.
-
#private_ip_addresses ⇒ Object
Private IP addresses assigned to server.
-
#provisioned_on ⇒ Object
Date and time when server was provisioned.
-
#public_ip_addresses ⇒ Object
Public IP addresses assigned to server.
-
#ram ⇒ Object
A description of the machine RAM.
-
#reservation_id ⇒ Object
The reservation reference id if any.
-
#status ⇒ Object
The status of the server.
-
#storage ⇒ Object
A description of the machine storage.
-
#tags ⇒ Object
The tags assigned if any.
-
#type ⇒ Object
Server type ID.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Server
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Server
Initializes the object
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/pnap_bmc_api/models/server.rb', line 162 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `BmcApi::Server` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) 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 end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'hostname') self.hostname = attributes[:'hostname'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'os') self.os = attributes[:'os'] end if attributes.key?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'location') self.location = attributes[:'location'] end if attributes.key?(:'cpu') self.cpu = attributes[:'cpu'] end if attributes.key?(:'cpu_count') self.cpu_count = attributes[:'cpu_count'] end if attributes.key?(:'cores_per_cpu') self.cores_per_cpu = attributes[:'cores_per_cpu'] end if attributes.key?(:'cpu_frequency') self.cpu_frequency = attributes[:'cpu_frequency'] end if attributes.key?(:'ram') self.ram = attributes[:'ram'] end if attributes.key?(:'storage') self.storage = attributes[:'storage'] end if attributes.key?(:'private_ip_addresses') if (value = attributes[:'private_ip_addresses']).is_a?(Array) self.private_ip_addresses = value end end if attributes.key?(:'public_ip_addresses') if (value = attributes[:'public_ip_addresses']).is_a?(Array) self.public_ip_addresses = value end end if attributes.key?(:'reservation_id') self.reservation_id = attributes[:'reservation_id'] end if attributes.key?(:'pricing_model') self.pricing_model = attributes[:'pricing_model'] else self.pricing_model = 'HOURLY' end if attributes.key?(:'password') self.password = attributes[:'password'] end if attributes.key?(:'network_type') self.network_type = attributes[:'network_type'] else self.network_type = 'PUBLIC_AND_PRIVATE' end if attributes.key?(:'cluster_id') self.cluster_id = attributes[:'cluster_id'] end if attributes.key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self. = value end end if attributes.key?(:'provisioned_on') self.provisioned_on = attributes[:'provisioned_on'] end if attributes.key?(:'os_configuration') self.os_configuration = attributes[:'os_configuration'] end if attributes.key?(:'network_configuration') self.network_configuration = attributes[:'network_configuration'] end end |
Instance Attribute Details
#cluster_id ⇒ Object
The cluster reference id if any.
77 78 79 |
# File 'lib/pnap_bmc_api/models/server.rb', line 77 def cluster_id @cluster_id end |
#cores_per_cpu ⇒ Object
The number of physical cores present on each CPU.
47 48 49 |
# File 'lib/pnap_bmc_api/models/server.rb', line 47 def cores_per_cpu @cores_per_cpu end |
#cpu ⇒ Object
A description of the machine CPU.
41 42 43 |
# File 'lib/pnap_bmc_api/models/server.rb', line 41 def cpu @cpu end |
#cpu_count ⇒ Object
The number of CPUs available in the system.
44 45 46 |
# File 'lib/pnap_bmc_api/models/server.rb', line 44 def cpu_count @cpu_count end |
#cpu_frequency ⇒ Object
The CPU frequency in GHz.
50 51 52 |
# File 'lib/pnap_bmc_api/models/server.rb', line 50 def cpu_frequency @cpu_frequency end |
#description ⇒ Object
Description of server.
29 30 31 |
# File 'lib/pnap_bmc_api/models/server.rb', line 29 def description @description end |
#hostname ⇒ Object
Hostname of server.
26 27 28 |
# File 'lib/pnap_bmc_api/models/server.rb', line 26 def hostname @hostname end |
#id ⇒ Object
The unique identifier of the server.
20 21 22 |
# File 'lib/pnap_bmc_api/models/server.rb', line 20 def id @id end |
#location ⇒ Object
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 39 40 |
# File 'lib/pnap_bmc_api/models/server.rb', line 38 def location @location end |
#network_configuration ⇒ Object
Returns the value of attribute network_configuration.
87 88 89 |
# File 'lib/pnap_bmc_api/models/server.rb', line 87 def network_configuration @network_configuration end |
#network_type ⇒ Object
The type of network configuration for this server. Currently this field should be set to `PUBLIC_AND_PRIVATE` or `PRIVATE_ONLY`.
74 75 76 |
# File 'lib/pnap_bmc_api/models/server.rb', line 74 def network_type @network_type end |
#os ⇒ Object
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`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `esxi/esxi70u2`, `debian/bullseye` or `proxmox/bullseye`.
32 33 34 |
# File 'lib/pnap_bmc_api/models/server.rb', line 32 def os @os end |
#os_configuration ⇒ Object
Returns the value of attribute os_configuration.
85 86 87 |
# File 'lib/pnap_bmc_api/models/server.rb', line 85 def os_configuration @os_configuration end |
#password ⇒ Object
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 72 73 |
# File 'lib/pnap_bmc_api/models/server.rb', line 71 def password @password end |
#pricing_model ⇒ Object
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 69 70 |
# File 'lib/pnap_bmc_api/models/server.rb', line 68 def pricing_model @pricing_model end |
#private_ip_addresses ⇒ Object
Private IP addresses assigned to server.
59 60 61 |
# File 'lib/pnap_bmc_api/models/server.rb', line 59 def private_ip_addresses @private_ip_addresses end |
#provisioned_on ⇒ Object
Date and time when server was provisioned.
83 84 85 |
# File 'lib/pnap_bmc_api/models/server.rb', line 83 def provisioned_on @provisioned_on end |
#public_ip_addresses ⇒ Object
Public IP addresses assigned to server.
62 63 64 |
# File 'lib/pnap_bmc_api/models/server.rb', line 62 def public_ip_addresses @public_ip_addresses end |
#ram ⇒ Object
A description of the machine RAM.
53 54 55 |
# File 'lib/pnap_bmc_api/models/server.rb', line 53 def ram @ram end |
#reservation_id ⇒ Object
The reservation reference id if any.
65 66 67 |
# File 'lib/pnap_bmc_api/models/server.rb', line 65 def reservation_id @reservation_id end |
#status ⇒ Object
The status of the server.
23 24 25 |
# File 'lib/pnap_bmc_api/models/server.rb', line 23 def status @status end |
#storage ⇒ Object
A description of the machine storage.
56 57 58 |
# File 'lib/pnap_bmc_api/models/server.rb', line 56 def storage @storage end |
#tags ⇒ Object
The tags assigned if any.
80 81 82 |
# File 'lib/pnap_bmc_api/models/server.rb', line 80 def @tags end |
#type ⇒ Object
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.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.medium`, `d2.m1.large`, `d2.m2.medium`, `d2.m2.large`, `d2.m2.xlarge` or `d2.c4.storage.pliops1`.
35 36 37 |
# File 'lib/pnap_bmc_api/models/server.rb', line 35 def type @type end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
120 121 122 |
# File 'lib/pnap_bmc_api/models/server.rb', line 120 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/pnap_bmc_api/models/server.rb', line 90 def self.attribute_map { :'id' => :'id', :'status' => :'status', :'hostname' => :'hostname', :'description' => :'description', :'os' => :'os', :'type' => :'type', :'location' => :'location', :'cpu' => :'cpu', :'cpu_count' => :'cpuCount', :'cores_per_cpu' => :'coresPerCpu', :'cpu_frequency' => :'cpuFrequency', :'ram' => :'ram', :'storage' => :'storage', :'private_ip_addresses' => :'privateIpAddresses', :'public_ip_addresses' => :'publicIpAddresses', :'reservation_id' => :'reservationId', :'pricing_model' => :'pricingModel', :'password' => :'password', :'network_type' => :'networkType', :'cluster_id' => :'clusterId', :'tags' => :'tags', :'provisioned_on' => :'provisionedOn', :'os_configuration' => :'osConfiguration', :'network_configuration' => :'networkConfiguration' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
561 562 563 |
# File 'lib/pnap_bmc_api/models/server.rb', line 561 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
155 156 157 158 |
# File 'lib/pnap_bmc_api/models/server.rb', line 155 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/pnap_bmc_api/models/server.rb', line 125 def self.openapi_types { :'id' => :'String', :'status' => :'String', :'hostname' => :'String', :'description' => :'String', :'os' => :'String', :'type' => :'String', :'location' => :'String', :'cpu' => :'String', :'cpu_count' => :'Integer', :'cores_per_cpu' => :'Integer', :'cpu_frequency' => :'Float', :'ram' => :'String', :'storage' => :'String', :'private_ip_addresses' => :'Array<String>', :'public_ip_addresses' => :'Array<String>', :'reservation_id' => :'String', :'pricing_model' => :'String', :'password' => :'String', :'network_type' => :'String', :'cluster_id' => :'String', :'tags' => :'Array<TagAssignment>', :'provisioned_on' => :'Time', :'os_configuration' => :'OsConfiguration', :'network_configuration' => :'NetworkConfiguration' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 |
# File 'lib/pnap_bmc_api/models/server.rb', line 517 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && status == o.status && hostname == o.hostname && description == o.description && os == o.os && type == o.type && location == o.location && cpu == o.cpu && cpu_count == o.cpu_count && cores_per_cpu == o.cores_per_cpu && cpu_frequency == o.cpu_frequency && ram == o.ram && storage == o.storage && private_ip_addresses == o.private_ip_addresses && public_ip_addresses == o.public_ip_addresses && reservation_id == o.reservation_id && pricing_model == o.pricing_model && password == o.password && network_type == o.network_type && cluster_id == o.cluster_id && == o. && provisioned_on == o.provisioned_on && os_configuration == o.os_configuration && network_configuration == o.network_configuration end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 |
# File 'lib/pnap_bmc_api/models/server.rb', line 592 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = BmcApi.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
663 664 665 666 667 668 669 670 671 672 673 674 675 |
# File 'lib/pnap_bmc_api/models/server.rb', line 663 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
# File 'lib/pnap_bmc_api/models/server.rb', line 568 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(o) ⇒ Boolean
548 549 550 |
# File 'lib/pnap_bmc_api/models/server.rb', line 548 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
554 555 556 |
# File 'lib/pnap_bmc_api/models/server.rb', line 554 def hash [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, , provisioned_on, os_configuration, network_configuration].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/pnap_bmc_api/models/server.rb', line 284 def list_invalid_properties invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @hostname.nil? invalid_properties.push('invalid value for "hostname", hostname cannot be nil.') end if @hostname.to_s.length > 100 invalid_properties.push('invalid value for "hostname", the character length must be smaller than or equal to 100.') end if @hostname.to_s.length < 1 invalid_properties.push('invalid value for "hostname", the character length must be great than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/) if @hostname !~ pattern invalid_properties.push("invalid value for \"hostname\", must conform to the pattern #{pattern}.") end if !@description.nil? && @description.to_s.length > 250 invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.') end if @os.nil? invalid_properties.push('invalid value for "os", os cannot be nil.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if @location.nil? invalid_properties.push('invalid value for "location", location cannot be nil.') end if @cpu.nil? invalid_properties.push('invalid value for "cpu", cpu cannot be nil.') end if @cpu_count.nil? invalid_properties.push('invalid value for "cpu_count", cpu_count cannot be nil.') end if @cpu_count < 1 invalid_properties.push('invalid value for "cpu_count", must be greater than or equal to 1.') end if @cores_per_cpu.nil? invalid_properties.push('invalid value for "cores_per_cpu", cores_per_cpu cannot be nil.') end if @cores_per_cpu < 1 invalid_properties.push('invalid value for "cores_per_cpu", must be greater than or equal to 1.') end if @cpu_frequency.nil? invalid_properties.push('invalid value for "cpu_frequency", cpu_frequency cannot be nil.') end if @cpu_frequency < 0 invalid_properties.push('invalid value for "cpu_frequency", must be greater than or equal to 0.') end if @ram.nil? invalid_properties.push('invalid value for "ram", ram cannot be nil.') end if @storage.nil? invalid_properties.push('invalid value for "storage", storage cannot be nil.') end if @private_ip_addresses.nil? invalid_properties.push('invalid value for "private_ip_addresses", private_ip_addresses cannot be nil.') end if @private_ip_addresses.length < 1 invalid_properties.push('invalid value for "private_ip_addresses", number of items must be greater than or equal to 1.') end if !@public_ip_addresses.nil? && @public_ip_addresses.length < 0 invalid_properties.push('invalid value for "public_ip_addresses", number of items must be greater than or equal to 0.') end if @pricing_model.nil? invalid_properties.push('invalid value for "pricing_model", pricing_model cannot be nil.') end if @network_configuration.nil? invalid_properties.push('invalid value for "network_configuration", network_configuration cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
639 640 641 |
# File 'lib/pnap_bmc_api/models/server.rb', line 639 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
645 646 647 648 649 650 651 652 653 654 655 656 657 |
# File 'lib/pnap_bmc_api/models/server.rb', line 645 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
633 634 635 |
# File 'lib/pnap_bmc_api/models/server.rb', line 633 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/pnap_bmc_api/models/server.rb', line 388 def valid? return false if @id.nil? return false if @status.nil? return false if @hostname.nil? return false if @hostname.to_s.length > 100 return false if @hostname.to_s.length < 1 return false if @hostname !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/) return false if !@description.nil? && @description.to_s.length > 250 return false if @os.nil? return false if @type.nil? return false if @location.nil? return false if @cpu.nil? return false if @cpu_count.nil? return false if @cpu_count < 1 return false if @cores_per_cpu.nil? return false if @cores_per_cpu < 1 return false if @cpu_frequency.nil? return false if @cpu_frequency < 0 return false if @ram.nil? return false if @storage.nil? return false if @private_ip_addresses.nil? return false if @private_ip_addresses.length < 1 return false if !@public_ip_addresses.nil? && @public_ip_addresses.length < 0 return false if @pricing_model.nil? return false if @network_configuration.nil? true end |