Class: Fog::Compute::Gridscale::Template

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

Instance Method Summary collapse

Instance Method Details

#deleteObject



29
30
31
32
33
# File 'lib/fog/compute/gridscale/models/template.rb', line 29

def delete
  requires :object_uuid
  response = service.template_delete object_uuid
  response.body
end

#destroyObject



35
36
37
38
39
# File 'lib/fog/compute/gridscale/models/template.rb', line 35

def destroy
  requires :object_uuid
  response = service.template_delete object_uuid
  response.body
end

#saveObject

Raises:

  • (Fog::Errors::Error)


41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fog/compute/gridscale/models/template.rb', line 41

def save
  raise Fog::Errors::Error.new('Re-saving an existing object may create a duplicate') if persisted?
  requires :name, :snapshot_uuid

  options = {}
  options[:labels] = labels

  data = service.template_create(name, snapshot_uuid, options)

  merge_attributes(data.body)
  true
end

#updateObject



54
55
56
57
58
59
60
61
62
# File 'lib/fog/compute/gridscale/models/template.rb', line 54

def update
  requires :object_uuid

  payload = {}

  data = service.template_update(object_uuid, payload)
  merge_attributes(data.body)
  true
end