Class: CapComputeEngine::Instance

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

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Instance



3
4
5
# File 'lib/cap_compute_engine/instance.rb', line 3

def initialize(hash)
  @hash = hash.with_indifferent_access
end

Instance Method Details

#external_ipObject



11
12
13
# File 'lib/cap_compute_engine/instance.rb', line 11

def external_ip
  @hash[:networkInterfaces].first[:accessConfigs].first[:natIP]
end

#has_tag?(tag_name) ⇒ Boolean



15
16
17
# File 'lib/cap_compute_engine/instance.rb', line 15

def has_tag?(tag_name)
  tags.include?(tag_name)
end

#tagsObject



7
8
9
# File 'lib/cap_compute_engine/instance.rb', line 7

def tags
  @hash[:tags][:items] || []
end