Class: Miasma::Models::Compute::Server

Inherits:
Types::Model show all
Defined in:
lib/miasma/models/compute/server.rb

Overview

Abstract server

Defined Under Namespace

Classes: Address, Network

Constant Summary collapse

VALID_COMPUTE_STATES =

Returns valid compute instance states.

Returns:

  • (Array<Symbol>)

    valid compute instance states

[:running, :stopped, :pending, :terminated]

Instance Attribute Summary

Attributes inherited from Types::Model

#api

Instance Method Summary collapse

Methods inherited from Types::Model

#destroy, from_json, #id?, #initialize, #persisted?, #reload, #save

Methods included from Utils::Memoization

#_memo, #clear_memoizations!, #memoize, #unmemoize

Methods inherited from Types::Data

from_json, #from_json, #initialize, #to_json

Methods included from Utils::Lazy

included

Constructor Details

This class inherits a constructor from Miasma::Types::Model

Instance Method Details

#addressString

Returns public IP address.

Returns:

  • (String)

    public IP address



44
45
46
47
48
49
# File 'lib/miasma/models/compute/server.rb', line 44

def address
  obj = addresses_public.detect do |addr|
    addr.version == 4
  end
  obj.address if obj
end

#addressesArray<Smash>

Returns:



39
40
41
# File 'lib/miasma/models/compute/server.rb', line 39

def addresses
  addresses_public + addresses_private
end