Class: OracleCloud::Instance

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

Instance Attribute Summary

Attributes inherited from Asset

#asset_data, #asset_type, #client, #container, #path

Instance Method Summary collapse

Methods inherited from Asset

#fetch, #initialize, #name_with_container, #strip_identity_domain, #validate!

Constructor Details

This class inherits a constructor from OracleCloud::Asset

Instance Method Details

#deleteObject



72
73
74
75
76
77
# File 'lib/oraclecloud/instance.rb', line 72

def delete
  raise 'Unable to delete instance, instance is part of orchestration ' \
    "#{orchestration} - delete the orchestration instead" unless orchestration.nil?

  client.asset_delete(asset_type, id)
end

#full_nameObject



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

def full_name
  asset_data['name']
end

#hostnameObject



44
45
46
# File 'lib/oraclecloud/instance.rb', line 44

def hostname
  asset_data['hostname']
end

#idObject



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

def id
  strip_identity_domain(asset_data['name'])
end

#imageObject



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

def image
  asset_data['imagelist']
end

#ip_addressObject



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

def ip_address
  asset_data['ip']
end

#labelObject



48
49
50
# File 'lib/oraclecloud/instance.rb', line 48

def label
  asset_data['label']
end

#local_initObject



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

def local_init
  @asset_type = 'instance'
end

#orchestrationObject



65
66
67
68
69
70
# File 'lib/oraclecloud/instance.rb', line 65

def orchestration
  orchestration = asset_data['attributes']['nimbula_orchestration']
  return if orchestration.nil?

  strip_identity_domain(orchestration)
end

#public_ip_addressesObject



61
62
63
# File 'lib/oraclecloud/instance.rb', line 61

def public_ip_addresses
  client.ip_associations.find_by_vcable(vcable_id).map(&:ip_address)
end

#shapeObject



40
41
42
# File 'lib/oraclecloud/instance.rb', line 40

def shape
  asset_data['shape']
end

#stateObject Also known as: status



52
53
54
# File 'lib/oraclecloud/instance.rb', line 52

def state
  asset_data['state']
end

#vcable_idObject



57
58
59
# File 'lib/oraclecloud/instance.rb', line 57

def vcable_id
  asset_data['vcable_id']
end