Class: Fog::Compute::Cloudstack::Image

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

Instance Attribute Summary collapse

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Attribute Details

#bitsObject

Returns the value of attribute bits.



41
42
43
# File 'lib/fog/cloudstack/models/compute/image.rb', line 41

def bits
  @bits
end

#requires_hvmObject

Returns the value of attribute requires_hvm.



41
42
43
# File 'lib/fog/cloudstack/models/compute/image.rb', line 41

def requires_hvm
  @requires_hvm
end

#snapshot_idObject

Returns the value of attribute snapshot_id.



41
42
43
# File 'lib/fog/cloudstack/models/compute/image.rb', line 41

def snapshot_id
  @snapshot_id
end

#urlObject

Returns the value of attribute url.



41
42
43
# File 'lib/fog/cloudstack/models/compute/image.rb', line 41

def url
  @url
end

#virtual_machine_idObject

Returns the value of attribute virtual_machine_id.



41
42
43
# File 'lib/fog/cloudstack/models/compute/image.rb', line 41

def virtual_machine_id
  @virtual_machine_id
end

#volume_idObject

Returns the value of attribute volume_id.



41
42
43
# File 'lib/fog/cloudstack/models/compute/image.rb', line 41

def volume_id
  @volume_id
end

Instance Method Details

#destroyObject



64
65
66
67
68
# File 'lib/fog/cloudstack/models/compute/image.rb', line 64

def destroy
  requires :id
  connection.delete_template('id' => self.id)
  true
end

#saveObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/fog/cloudstack/models/compute/image.rb', line 43

def save
  options = {
    'displaytext'      => display_text,
    'name'             => name,
    'ostypeid'         => os_type_id,
    'bits'             => bits,
    'details'          => details,
    'isfeatured'       => is_featured,
    'ispublic'         => is_public,
    'passwordenabled'  => password_enabled,
    'requireshvm'      => requires_hvm,
    'snapshotid'       => snapshot_id,
    'templatetag'      => template_tag,
    'url'              => url,
    'virtualmachineid' => virtual_machine_id,
    'volumeid'         => volume_id
  }
  data = connection.create_template(options)
  merge_attributes(data['createtemplateresponse'])
end