Sha256: 10d481c20129cb9d9b1315e5f6a8fe15112e5f7ab3557a4092bea5c31c696c03

Contents?: true

Size: 1.5 KB

Versions: 55

Compression:

Stored size: 1.5 KB

Contents

module Fog
  module Compute
    class Cloudstack
      class Real

        # Creates a disk offering.
        #
        # {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.0.0/root_admin/createDiskOffering.html]
        def create_disk_offering(options={})
          options.merge!(
            'command' => 'createDiskOffering'
          )
          request(options)
        end

      end # Real

      class Mock

        def create_disk_offering(options={})
          disk_offering_id = Fog::Cloudstack.uuid

          first_domain_data = data[:domains].first.last
          domain_id = options['domainid'] || first_domain_data['id']
          domain_name = data[:domains][domain_id]['name']

          storage_type = options['storagetype'] || 'shared'
          customized = options['customized'] || false
          disk_size = options['disk_size'] || 1

          disk_offering = {
            "id"           => disk_offering_id,
            "domainid"     => domain_id,
            "domain"       => domain_name,
            "name"         => options['name'],
            "displaytext"  => options['display_text'],
            "disksize"     => disk_size,
            "created"      => Time.now.iso8601,
            "iscustomized" => customized,
            "storagetype"  => storage_type
          }

          self.data[:disk_offerings][disk_offering_id] = disk_offering

          {'creatediskofferingresponse' => disk_offering}
        end
      end

    end # Cloudstack
  end # Compute
end # Fog

Version data entries

55 entries across 55 versions & 3 rubygems

Version Path
fog-1.22.0 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-1.21.0 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-1.20.0 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-1.19.0 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/cloudstack/requests/compute/create_disk_offering.rb