Class: LinodeOpenapiClient::Linode1
- Inherits:
-
Object
- Object
- LinodeOpenapiClient::Linode1
- Defined in:
- lib/linode_openapi_client/models/linode1.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#alerts ⇒ Object
Returns the value of attribute alerts.
-
#backups ⇒ Object
Returns the value of attribute backups.
-
#created ⇒ Object
Read-only When this Linode was created.
-
#group ⇒ Object
__Filterable__ A deprecated property denoting a group label for this Linode.
-
#has_user_data ⇒ Object
Read-only Whether this compute instance was provisioned utilizing ‘user_data` provided via the Metadata service.
-
#host_uuid ⇒ Object
Read-only The Linode’s host machine, as a UUID.
-
#hypervisor ⇒ Object
Read-only The virtualization software powering this Linode.
-
#id ⇒ Object
__Filterable__, Read-only This Linode’s ID which must be provided for all operations impacting this Linode.
-
#image ⇒ Object
An Image ID to deploy the Linode Disk from.
-
#ipv4 ⇒ Object
__Filterable__, Read-only This Linode’s IPv4 Addresses.
-
#ipv6 ⇒ Object
Read-only This Linode’s IPv6 SLAAC address.
-
#label ⇒ Object
__Filterable__ The Linode’s label is for display purposes only.
-
#placement_group ⇒ Object
Returns the value of attribute placement_group.
-
#region ⇒ Object
__Filterable__, Read-only This is the [region](techdocs.akamai.com/linode-api/reference/get-regions) where the Linode was deployed.
-
#specs ⇒ Object
Returns the value of attribute specs.
-
#status ⇒ Object
Read-only A brief description of this Linode’s current state.
-
#tags ⇒ Object
__Filterable__ An array of tags applied to this object.
-
#type ⇒ Object
Read-only This is the [Linode type](techdocs.akamai.com/linode-api/reference/get-linode-types) that this Linode was deployed with.
-
#updated ⇒ Object
Read-only When this Linode was last updated.
-
#watchdog_enabled ⇒ Object
The watchdog, named Lassie, is a Shutdown Watchdog that monitors your Linode and will reboot it if it powers off unexpectedly.
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 = {}) ⇒ Linode1
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 = {}) ⇒ Linode1
Initializes the object
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 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 163 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `LinodeOpenapiClient::Linode1` 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::Linode1`. 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?(:'watchdog_enabled') self.watchdog_enabled = attributes[:'watchdog_enabled'] end if attributes.key?(:'has_user_data') self.has_user_data = attributes[:'has_user_data'] end if attributes.key?(:'placement_group') self.placement_group = attributes[:'placement_group'] end if attributes.key?(:'image') self.image = attributes[:'image'] end if attributes.key?(:'updated') self.updated = attributes[:'updated'] end if attributes.key?(:'label') self.label = attributes[:'label'] end if attributes.key?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'region') self.region = attributes[:'region'] end if attributes.key?(:'ipv4') if (value = attributes[:'ipv4']).is_a?(Array) self.ipv4 = value end end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'hypervisor') self.hypervisor = attributes[:'hypervisor'] end if attributes.key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self. = value end end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'ipv6') self.ipv6 = attributes[:'ipv6'] end if attributes.key?(:'specs') self.specs = attributes[:'specs'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'group') self.group = attributes[:'group'] end if attributes.key?(:'alerts') self.alerts = attributes[:'alerts'] end if attributes.key?(:'host_uuid') self.host_uuid = attributes[:'host_uuid'] end if attributes.key?(:'backups') self.backups = attributes[:'backups'] end end |
Instance Attribute Details
#alerts ⇒ Object
Returns the value of attribute alerts.
67 68 69 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 67 def alerts @alerts end |
#backups ⇒ Object
Returns the value of attribute backups.
72 73 74 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 72 def backups @backups end |
#created ⇒ Object
Read-only When this Linode was created.
45 46 47 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 45 def created @created end |
#group ⇒ Object
__Filterable__ A deprecated property denoting a group label for this Linode.
65 66 67 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 65 def group @group end |
#has_user_data ⇒ Object
Read-only Whether this compute instance was provisioned utilizing ‘user_data` provided via the Metadata service. See the [Create a Linode](techdocs.akamai.com/linode-api/reference/post-linode-instance) description for more information on Metadata.
22 23 24 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 22 def has_user_data @has_user_data end |
#host_uuid ⇒ Object
Read-only The Linode’s host machine, as a UUID.
70 71 72 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 70 def host_uuid @host_uuid end |
#hypervisor ⇒ Object
Read-only The virtualization software powering this Linode.
48 49 50 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 48 def hypervisor @hypervisor end |
#id ⇒ Object
__Filterable__, Read-only This Linode’s ID which must be provided for all operations impacting this Linode.
54 55 56 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 54 def id @id end |
#image ⇒ Object
An Image ID to deploy the Linode Disk from. Run the [List images](techdocs.akamai.com/linode-api/reference/get-images) operation with authentication to view all available Images. Official Linode Images start with ‘linode/`, while your Account’s Images start with ‘private/`. Creating a disk from a Private Image requires `read_only` or `read_write` permissions for that Image. Run the [Update a user’s grants](techdocs.akamai.com/linode-api/reference/put-user-grants) operation to adjust permissions for an Account Image.
27 28 29 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 27 def image @image end |
#ipv4 ⇒ Object
__Filterable__, Read-only This Linode’s IPv4 Addresses. Each Linode is assigned a single public IPv4 address upon creation, and may get a single private IPv4 address if needed. You may need to [Open a support ticket](techdocs.akamai.com/linode-api/reference/post-ticket) to get additional IPv4 addresses. IPv4 addresses may be reassigned between your Linodes, or shared with other Linodes. See the [networking](techdocs.akamai.com/linode-api/reference/post-firewalls) operations for details.
42 43 44 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 42 def ipv4 @ipv4 end |
#ipv6 ⇒ Object
Read-only This Linode’s IPv6 SLAAC address. This address is specific to a Linode, and may not be shared. If the Linode has not been assigned an IPv6 address, the return value will be ‘null`.
57 58 59 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 57 def ipv6 @ipv6 end |
#label ⇒ Object
__Filterable__ The Linode’s label is for display purposes only. If no label is provided for a Linode, a default will be assigned. Linode labels have the following constraints: - Must begin and end with an alphanumeric character. - May only consist of alphanumeric characters, hyphens (‘-`), underscores (`_`) or periods (`.`). - Cannot have two hyphens (`–`), underscores (`__`) or periods (`..`) in a row.
33 34 35 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 33 def label @label end |
#placement_group ⇒ Object
Returns the value of attribute placement_group.
24 25 26 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 24 def placement_group @placement_group end |
#region ⇒ Object
__Filterable__, Read-only This is the [region](techdocs.akamai.com/linode-api/reference/get-regions) where the Linode was deployed. A Linode’s region can only be changed by initiating a [cross data center migration](techdocs.akamai.com/linode-api/reference/post-migrate-linode-instance).
39 40 41 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 39 def region @region end |
#specs ⇒ Object
Returns the value of attribute specs.
59 60 61 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 59 def specs @specs end |
#status ⇒ Object
Read-only A brief description of this Linode’s current state. This field may change without direct action from you. For example, when a Linode goes into maintenance mode its status will display ‘stopped`.
62 63 64 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 62 def status @status end |
#tags ⇒ Object
__Filterable__ An array of tags applied to this object. Tags are for organizational purposes only.
51 52 53 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 51 def @tags end |
#type ⇒ Object
Read-only This is the [Linode type](techdocs.akamai.com/linode-api/reference/get-linode-types) that this Linode was deployed with. To change a Linode’s Type, use [Resize a Linode](techdocs.akamai.com/linode-api/reference/post-resize-linode-instance).
36 37 38 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 36 def type @type end |
#updated ⇒ Object
Read-only When this Linode was last updated.
30 31 32 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 30 def updated @updated end |
#watchdog_enabled ⇒ Object
The watchdog, named Lassie, is a Shutdown Watchdog that monitors your Linode and will reboot it if it powers off unexpectedly. It works by issuing a boot job when your Linode powers off without a shutdown job being responsible. To prevent a loop, Lassie will give up if there have been more than 5 boot jobs issued within 15 minutes.
19 20 21 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 19 def watchdog_enabled @watchdog_enabled end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 405 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
123 124 125 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 123 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 97 def self.attribute_map { :'watchdog_enabled' => :'watchdog_enabled', :'has_user_data' => :'has_user_data', :'placement_group' => :'placement_group', :'image' => :'image', :'updated' => :'updated', :'label' => :'label', :'type' => :'type', :'region' => :'region', :'ipv4' => :'ipv4', :'created' => :'created', :'hypervisor' => :'hypervisor', :'tags' => :'tags', :'id' => :'id', :'ipv6' => :'ipv6', :'specs' => :'specs', :'status' => :'status', :'group' => :'group', :'alerts' => :'alerts', :'host_uuid' => :'host_uuid', :'backups' => :'backups' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 381 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
154 155 156 157 158 159 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 154 def self.openapi_nullable Set.new([ :'placement_group', :'ipv6', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 128 def self.openapi_types { :'watchdog_enabled' => :'Boolean', :'has_user_data' => :'Boolean', :'placement_group' => :'Linode1PlacementGroup', :'image' => :'String', :'updated' => :'Time', :'label' => :'String', :'type' => :'String', :'region' => :'String', :'ipv4' => :'Array<String>', :'created' => :'Time', :'hypervisor' => :'String', :'tags' => :'Array<String>', :'id' => :'Integer', :'ipv6' => :'String', :'specs' => :'Linode1Specs', :'status' => :'String', :'group' => :'String', :'alerts' => :'Linode1Alerts', :'host_uuid' => :'String', :'backups' => :'Linode1Backups' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 341 def ==(o) return true if self.equal?(o) self.class == o.class && watchdog_enabled == o.watchdog_enabled && has_user_data == o.has_user_data && placement_group == o.placement_group && image == o.image && updated == o.updated && label == o.label && type == o.type && region == o.region && ipv4 == o.ipv4 && created == o.created && hypervisor == o.hypervisor && == o. && id == o.id && ipv6 == o.ipv6 && specs == o.specs && status == o.status && group == o.group && alerts == o.alerts && host_uuid == o.host_uuid && backups == o.backups end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
476 477 478 479 480 481 482 483 484 485 486 487 488 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 476 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
368 369 370 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 368 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
374 375 376 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 374 def hash [watchdog_enabled, has_user_data, placement_group, image, updated, label, type, region, ipv4, created, hypervisor, , id, ipv6, specs, status, group, alerts, host_uuid, backups].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 263 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@label.nil? && @label.to_s.length > 64 invalid_properties.push('invalid value for "label", the character length must be smaller than or equal to 64.') end if !@label.nil? && @label.to_s.length < 3 invalid_properties.push('invalid value for "label", the character length must be great than or equal to 3.') end pattern = Regexp.new(/^[a-zA-Z]((?!--|__|..)[a-zA-Z0-9-_.])+$/) if !@label.nil? && @label !~ pattern invalid_properties.push("invalid value for \"label\", must conform to the pattern #{pattern}.") end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
452 453 454 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 452 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
458 459 460 461 462 463 464 465 466 467 468 469 470 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 458 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
446 447 448 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 446 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/linode_openapi_client/models/linode1.rb', line 284 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@label.nil? && @label.to_s.length > 64 return false if !@label.nil? && @label.to_s.length < 3 return false if !@label.nil? && @label !~ Regexp.new(/^[a-zA-Z]((?!--|__|..)[a-zA-Z0-9-_.])+$/) hypervisor_validator = EnumAttributeValidator.new('String', ["kvm"]) return false unless hypervisor_validator.valid?(@hypervisor) status_validator = EnumAttributeValidator.new('String', ["running", "offline", "booting", "rebooting", "shutting_down", "provisioning", "deleting", "migrating", "rebuilding", "cloning", "restoring", "stopped", "billing_suspension"]) return false unless status_validator.valid?(@status) true end |