Class: LinodeOpenapiClient::PostAddLinodeConfigRequest
- Inherits:
-
Object
- Object
- LinodeOpenapiClient::PostAddLinodeConfigRequest
- Defined in:
- lib/linode_openapi_client/models/post_add_linode_config_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#comments ⇒ Object
Optional field for arbitrary User comments on this Config.
-
#devices ⇒ Object
Returns the value of attribute devices.
-
#helpers ⇒ Object
Returns the value of attribute helpers.
-
#id ⇒ Object
Read-only The ID of this Config.
-
#interfaces ⇒ Object
An array of Network Interfaces to add to this Linode’s Configuration Profile.
-
#kernel ⇒ Object
A Kernel ID to boot a Linode with.
-
#label ⇒ Object
__Filterable__ The Config’s label is for display purposes only.
-
#memory_limit ⇒ Object
Defaults to the total RAM of the Linode.
-
#root_device ⇒ Object
The root device to boot.
-
#run_level ⇒ Object
Defines the state of your Linode after booting.
-
#virt_mode ⇒ Object
Controls the virtualization mode.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.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.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ PostAddLinodeConfigRequest
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 = {}) ⇒ PostAddLinodeConfigRequest
Initializes the object
119 120 121 122 123 124 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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 119 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `LinodeOpenapiClient::PostAddLinodeConfigRequest` 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 `LinodeOpenapiClient::PostAddLinodeConfigRequest`. 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?(:'label') self.label = attributes[:'label'] else self.label = nil end if attributes.key?(:'helpers') self.helpers = attributes[:'helpers'] end if attributes.key?(:'run_level') self.run_level = attributes[:'run_level'] end if attributes.key?(:'memory_limit') self.memory_limit = attributes[:'memory_limit'] end if attributes.key?(:'kernel') self.kernel = attributes[:'kernel'] else self.kernel = 'linode/latest-64bit' end if attributes.key?(:'comments') self.comments = attributes[:'comments'] end if attributes.key?(:'root_device') self.root_device = attributes[:'root_device'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'interfaces') if (value = attributes[:'interfaces']).is_a?(Array) self.interfaces = value end end if attributes.key?(:'devices') self.devices = attributes[:'devices'] else self.devices = nil end if attributes.key?(:'virt_mode') self.virt_mode = attributes[:'virt_mode'] end end |
Instance Attribute Details
#comments ⇒ Object
Optional field for arbitrary User comments on this Config.
33 34 35 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 33 def comments @comments end |
#devices ⇒ Object
Returns the value of attribute devices.
44 45 46 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 44 def devices @devices end |
#helpers ⇒ Object
Returns the value of attribute helpers.
21 22 23 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 21 def helpers @helpers end |
#id ⇒ Object
Read-only The ID of this Config.
39 40 41 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 39 def id @id end |
#interfaces ⇒ Object
An array of Network Interfaces to add to this Linode’s Configuration Profile. At least one and up to three Interface objects can exist in this array. The position in the array determines which of the Linode’s network Interfaces is configured: - First [0]: eth0 - Second [1]: eth1 - Third [2]: eth2 When updating a Linode’s Interfaces, _each Interface must be redefined_. An empty ‘interfaces` array results in a default `public` type Interface configuration only. If no public Interface is configured, public IP addresses are still assigned to the Linode but will not be usable without manual configuration. __Note__. Changes to Linode Interface configurations can be enabled by rebooting the Linode. `vpc` details See the [VPC documentation](www.linode.com/docs/products/networking/vpc/#technical-specifications) guide for its specifications and limitations. `vlan` details - Only Next Generation Network (NGN) data centers support VLANs. Run the [List regions](techdocs.akamai.com/linode-api/reference/get-regions) operation to view the capabilities of data center regions. If a VLAN is attached to your Linode and you attempt to migrate or clone it to a non-NGN data center, the migration or cloning will not initiate. If a Linode cannot be migrated or cloned because of an incompatibility, you will be prompted to select a different data center or contact support. - See the [VLANs Overview](www.linode.com/docs/products/networking/vlans/#technical-specifications) guide to view additional specifications and limitations.
42 43 44 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 42 def interfaces @interfaces end |
#kernel ⇒ Object
A Kernel ID to boot a Linode with. Here are examples of commonly-used kernels: - ‘linode/latest-64bit` (default): Our latest kernel at the time of instance boot/reboot. - `linode/grub2`: The upstream distribution-supplied kernel that is installed on the primary disk, or a custom kernel if installed. - `linode/direct-disk`: The MBR (Master Boot Record) of the primary disk/root device, used instead of a Linux kernel. For a complete list of options, run the [List kernels](techdocs.akamai.com/linode-api/reference/get-kernels) operation.
30 31 32 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 30 def kernel @kernel end |
#label ⇒ Object
__Filterable__ The Config’s label is for display purposes only.
19 20 21 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 19 def label @label end |
#memory_limit ⇒ Object
Defaults to the total RAM of the Linode.
27 28 29 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 27 def memory_limit @memory_limit end |
#root_device ⇒ Object
The root device to boot. - If no value or an invalid value is provided, root device will default to ‘/dev/sda`. - If the device specified at the root device location is not mounted, the Linode will not boot until a device is mounted.
36 37 38 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 36 def root_device @root_device end |
#run_level ⇒ Object
Defines the state of your Linode after booting. Defaults to ‘default`.
24 25 26 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 24 def run_level @run_level end |
#virt_mode ⇒ Object
Controls the virtualization mode. Defaults to ‘paravirt`. - `paravirt` is suitable for most cases. Linodes running in paravirt mode share some qualities with the host, ultimately making it run faster since there is less transition between it and the host. - `fullvirt` affords more customization, but is slower because 100% of the VM is virtualized.
47 48 49 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 47 def virt_mode @virt_mode end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 368 def self._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 = LinodeOpenapiClient.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
89 90 91 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 89 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 72 def self.attribute_map { :'label' => :'label', :'helpers' => :'helpers', :'run_level' => :'run_level', :'memory_limit' => :'memory_limit', :'kernel' => :'kernel', :'comments' => :'comments', :'root_device' => :'root_device', :'id' => :'id', :'interfaces' => :'interfaces', :'devices' => :'devices', :'virt_mode' => :'virt_mode' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 344 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{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[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
111 112 113 114 115 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 111 def self.openapi_nullable Set.new([ :'comments', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 94 def self.openapi_types { :'label' => :'String', :'helpers' => :'PostAddLinodeConfigRequestAllOfHelpers', :'run_level' => :'String', :'memory_limit' => :'Integer', :'kernel' => :'String', :'comments' => :'String', :'root_device' => :'String', :'id' => :'Integer', :'interfaces' => :'Array<PostAddLinodeConfigRequestAllOfInterfacesInner>', :'devices' => :'PostAddLinodeConfigRequestAllOfDevices', :'virt_mode' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 313 def ==(o) return true if self.equal?(o) self.class == o.class && label == o.label && helpers == o.helpers && run_level == o.run_level && memory_limit == o.memory_limit && kernel == o.kernel && comments == o.comments && root_device == o.root_device && id == o.id && interfaces == o.interfaces && devices == o.devices && virt_mode == o.virt_mode end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 439 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 |
#eql?(o) ⇒ Boolean
331 332 333 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 331 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
337 338 339 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 337 def hash [label, helpers, run_level, memory_limit, kernel, comments, root_device, id, interfaces, devices, virt_mode].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 187 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @label.nil? invalid_properties.push('invalid value for "label", label cannot be nil.') end if @label.to_s.length > 48 invalid_properties.push('invalid value for "label", the character length must be smaller than or equal to 48.') end if @label.to_s.length < 1 invalid_properties.push('invalid value for "label", the character length must be great than or equal to 1.') end pattern = Regexp.new(/a-z, A-Z, 0-9, \/, _, -/) if !@root_device.nil? && @root_device !~ pattern invalid_properties.push("invalid value for \"root_device\", must conform to the pattern #{pattern}.") end if !@interfaces.nil? && @interfaces.length > 3 invalid_properties.push('invalid value for "interfaces", number of items must be less than or equal to 3.') end if !@interfaces.nil? && @interfaces.length < 1 invalid_properties.push('invalid value for "interfaces", number of items must be greater than or equal to 1.') end if @devices.nil? invalid_properties.push('invalid value for "devices", devices cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
415 416 417 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 415 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 421 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
409 410 411 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 409 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/linode_openapi_client/models/post_add_linode_config_request.rb', line 224 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @label.nil? return false if @label.to_s.length > 48 return false if @label.to_s.length < 1 run_level_validator = EnumAttributeValidator.new('String', ["default", "single", "binbash"]) return false unless run_level_validator.valid?(@run_level) return false if !@root_device.nil? && @root_device !~ Regexp.new(/a-z, A-Z, 0-9, \/, _, -/) return false if !@interfaces.nil? && @interfaces.length > 3 return false if !@interfaces.nil? && @interfaces.length < 1 return false if @devices.nil? virt_mode_validator = EnumAttributeValidator.new('String', ["paravirt", "fullvirt"]) return false unless virt_mode_validator.valid?(@virt_mode) true end |