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::ApiMethoding

#api_method_for

Methods inherited from Types::Data

from_json, #from_json, #initialize, #to_json

Constructor Details

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

Instance Method Details

#addressString

Returns public IP address.

Returns:

  • (String)

    public IP address



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

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

#addressesArray<Smash>

Returns:

  • (Array<Smash>)


41
42
43
# File 'lib/miasma/models/compute/server.rb', line 41

def addresses
  addresses_public + addresses_private
end