Sha256: e5bd77957d51fd814b31e58708fd112f75d4bd44fc2f6bd639f74b58c8da0202

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

module OVIRT
  class Client
    def templates(opts={})
      search= opts[:search] || ("datacenter=%s" % current_datacenter.name)
      http_get("/templates?search=%s" % CGI.escape(search)).xpath('/templates/template').collect do |t|
        OVIRT::Template::new(self, t)
      end.compact
    end

    def template(template_id, opts={})
      results = http_get("/templates/%s" % template_id)
      template = OVIRT::Template::new(self, results.root)
      template
    end

    def create_template(opts)
      template = http_post("/templates", Template.to_xml(opts))
      OVIRT::Template::new(self, template.root)
    end

    def destroy_template(id)
      http_delete("/templates/%s" % id)
    end

    def template_interfaces template_id
      http_get("/templates/%s/nics" % template_id, http_headers).xpath('/nics/nic').collect do |nic|
        OVIRT::Interface::new(self, nic)
      end
    end

    def template_volumes template_id
      http_get("/templates/%s/disks" % template_id, http_headers).xpath('/disks/disk').collect do |disk|
        OVIRT::Volume::new(self, disk)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rbovirt-0.0.15 lib/client/template_api.rb
rbovirt-0.0.14 lib/client/template_api.rb
rbovirt-0.0.13 lib/client/template_api.rb
rbovirt-0.0.12 lib/client/template_api.rb
rbovirt-0.0.11 lib/client/template_api.rb
rbovirt-0.0.10 lib/client/template_api.rb
rbovirt-0.0.9 lib/client/template_api.rb
rbovirt-0.0.8 lib/client/template_api.rb