Sha256: 5a7c34d8353b76d82d2d7cc4cfea3aaef2b724ea8e39572b585de701aa1f48b2

Contents?: true

Size: 1.49 KB

Versions: 11

Compression:

Stored size: 1.49 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

11 entries across 11 versions & 3 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/cloudstack/requests/compute/create_disk_offering.rb
ns-fog-1.22.11 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
ns-fog-1.22.10 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
ns-fog-1.22.9 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
ns-fog-1.22.8 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
ns-fog-1.22.7 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
ns-fog-1.22.6 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
ns-fog-1.22.4 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
ns-fog-1.22.3 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
ns-fog-1.22.2 lib/fog/cloudstack/requests/compute/create_disk_offering.rb
fog-1.22.1 lib/fog/cloudstack/requests/compute/create_disk_offering.rb