Sha256: 455742aaf444e3b4d82dee7f1fa444e6f59810d2ac9e7decf8a0a63c8c8e1fcf

Contents?: true

Size: 1.79 KB

Versions: 28

Compression:

Stored size: 1.79 KB

Contents

module Fog
  module Compute
    class Cloudstack

      class Real
        # Extracts a template
        #
        # {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/extractTemplate.html]
        def extract_template(*args)
          options = {}
          if args[0].is_a? Hash
            options = args[0]
            options.merge!('command' => 'extractTemplate') 
          else
            options.merge!('command' => 'extractTemplate', 
            'mode' => args[0], 
            'id' => args[1])
          end
          request(options)
        end
      end
 
      class Mock
        def extract_template(options={})
          Fog.credentials[:cloudstack_zone_id] = 1105

          template_id = options['id']
          template_mode = options['mode']

          zoneid = self.data[:zones].keys[0]
          zone = self.data[:zones][zoneid]

          template = {}
          template['id'] = template_id
          template['name'] = "test template"
          template['extractId'] = 1
          template['accountid'] = 1
          template['state'] = "DOWNLOAD_URL_CREATED"
          template['zoneid'] = zoneid
          template['zonename'] = self.data[:zones][zoneid]["name"]
          template['extractMode'] = template_mode
          template['url'] = "http:%2F%2Fexample.com"

          job_id = 1
          job = {
            "jobid"         => job_id,
            "jobstatus"     => 1,
            "jobprocstatus" => 0,
            "jobresultcode" => 0,
            "jobresulttype" => "object",
            "jobresult"     => { "template" => template }
          }

          self.data[:jobs][job_id] = job
          {
            "extracttemplateresponse" => {
              "jobid" => job_id
            }
          }
        end
      end # Mock 
    end
  end
end

Version data entries

28 entries across 26 versions & 4 rubygems

Version Path
fog-2.1.0 lib/fog/cloudstack/requests/compute/extract_template.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/cloudstack/requests/compute/extract_template.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/cloudstack/requests/compute/extract_template.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.42.1 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-2.0.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.42.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.41.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.40.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.39.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.38.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.37.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.36.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.35.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-2.0.0.pre.0 lib/fog/cloudstack/requests/compute/extract_template.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.34.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.33.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.32.0 lib/fog/cloudstack/requests/compute/extract_template.rb
fog-1.31.0 lib/fog/cloudstack/requests/compute/extract_template.rb