Class: Mulder::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/mulder/instance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fog_compute_instance) ⇒ Instance

Returns a new instance of Instance.



8
9
10
# File 'lib/mulder/instance.rb', line 8

def initialize(fog_compute_instance)
  @fog_compute_instance = fog_compute_instance
end

Instance Attribute Details

#fog_compute_instanceObject (readonly)

Returns the value of attribute fog_compute_instance.



6
7
8
# File 'lib/mulder/instance.rb', line 6

def fog_compute_instance
  @fog_compute_instance
end

Instance Method Details

#as_hashObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/mulder/instance.rb', line 40

def as_hash
  @as_hash ||= {
    id: id,
    dns_name: dns_name,
    public_ip_address: public_ip_address,
    private_ip_address: private_ip_address,
    availability_zone: availability_zone,
    vpc_id: vpc_id,
    created_at: created_at
  }.delete_if { |_, value| value == '' || value == nil }
end

#availability_zoneObject



28
29
30
# File 'lib/mulder/instance.rb', line 28

def availability_zone
  @fog_compute_instance.availability_zone
end

#created_atObject



36
37
38
# File 'lib/mulder/instance.rb', line 36

def created_at
  @fog_compute_instance.created_at
end

#dns_nameObject



16
17
18
# File 'lib/mulder/instance.rb', line 16

def dns_name
  @fog_compute_instance.dns_name
end

#idObject



12
13
14
# File 'lib/mulder/instance.rb', line 12

def id
  @fog_compute_instance.id
end

#private_ip_addressObject



24
25
26
# File 'lib/mulder/instance.rb', line 24

def private_ip_address
  @fog_compute_instance.private_ip_address
end

#public_ip_addressObject



20
21
22
# File 'lib/mulder/instance.rb', line 20

def public_ip_address
  @fog_compute_instance.public_ip_address
end

#vpc_idObject



32
33
34
# File 'lib/mulder/instance.rb', line 32

def vpc_id
  @fog_compute_instance.vpc_id
end