Sha256: 94311c8157ed7ece32c164567afc9bd07d1fc64cb03adca2029e39a0f7165e55

Contents?: true

Size: 974 Bytes

Versions: 60

Compression:

Stored size: 974 Bytes

Contents

module CloudstackClient

	module DiskOffering

		##
    # Lists all available disk offerings.

    def list_disk_offerings(domain = nil)
      params = {
          'command' => 'listDiskOfferings'
      }

      if domain
        params['domainid'] = list_domains(domain).first["id"]
      end

      json = send_request(params)
      json['diskoffering'] || []
    end

    ##
    # Get disk offering by name.

    def get_disk_offering(name)

      # TODO: use name parameter
      # listServiceOfferings in CloudStack 2.2 doesn't seem to work
      # when the name parameter is specified. When this is fixed,
      # the name parameter should be added to the request.
      params = {
          'command' => 'listDiskOfferings'
      }
      json = send_request(params)

      services = json['diskoffering']
      return nil unless services

      services.each { |s|
        if s['name'] == name then
          return s
        end
      }
      nil
    end


	end

end

Version data entries

60 entries across 60 versions & 3 rubygems

Version Path
cloudstack_client-0.9.7 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.9.6 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.9.5 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.9.3 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.9.2 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.9.1 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.9.0 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.8.0 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.7.1 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.7.0 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.6.4 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.6.3 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.6.2 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.6.0 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.6.1 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.5.0 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.4.4 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.4.3 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.4.2 lib/cloudstack_client/commands/disk_offering.rb
cloudstack_client-0.4.1 lib/cloudstack_client/commands/disk_offering.rb