Sha256: e73dc29d8b55ffc191b1371e6a9e4e3951031d2e77d5cd8e82ca1e3407efeb6a

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

module Fog
  module Compute
    class Cloudstack

      class Real
        # Lists all available service offerings.
        #
        # {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/listServiceOfferings.html]
        def list_service_offerings(*args)
          options = {}
          if args[0].is_a? Hash
            options = args[0]
            options.merge!('command' => 'listServiceOfferings') 
          else
            options.merge!('command' => 'listServiceOfferings')
          end
          request(options)
        end
      end
 
      class Mock

        def list_service_offerings(options={})
          flavors = []
          if service_offering_id = options['id']
            flavor = self.data[:flavors][service_offering_id]
            raise Fog::Compute::Cloudstack::BadRequest unless flavor
            flavors = [flavor]
          else
            flavors = self.data[:flavors].values
          end

          {
            "listserviceofferingsresponse" =>
            {
              "count" => flavors.size,
              "serviceoffering"=> flavors
            }
          }
        end
      end 
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fog-1.26.0 lib/fog/cloudstack/requests/compute/list_service_offerings.rb
fog-1.25.0 lib/fog/cloudstack/requests/compute/list_service_offerings.rb
nsidc-fog-1.24.1 lib/fog/cloudstack/requests/compute/list_service_offerings.rb
fog-1.24.0 lib/fog/cloudstack/requests/compute/list_service_offerings.rb