Class: Fog::Compute::OracleCloud::Instance

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/oraclecloud/models/compute/instance.rb

Instance Method Summary collapse

Instance Method Details

#clean_nameObject



46
47
48
# File 'lib/fog/oraclecloud/models/compute/instance.rb', line 46

def clean_name 
	name.sub %r{\/.*\/}, ''
end

#createObject



55
56
57
58
59
60
# File 'lib/fog/oraclecloud/models/compute/instance.rb', line 55

def create
	requires :name, :shape, :imagelist, :label, :sshkeys
  
  data = service.create_instance(name, shape, imagelist, label, sshkeys)
  merge_attributes(data.body['instances'][0])
end

#destroyObject



62
63
64
65
# File 'lib/fog/oraclecloud/models/compute/instance.rb', line 62

def destroy
	requires :name
	service.delete_instance(name)
end

#ready?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/fog/oraclecloud/models/compute/instance.rb', line 42

def ready?
	state == 'running'
end

#saveObject



50
51
52
53
# File 'lib/fog/oraclecloud/models/compute/instance.rb', line 50

def save
  #identity ? update : create
  create
end