Sha256: 1a340c4d1993baea38af49cfa13886be3e2f2c7138e8a0eaea099a71cc63a62f

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 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.3/root_admin/listServiceOfferings.html]
        def list_service_offerings(options={})
          options.merge!(
            'command' => 'listServiceOfferings'  
          )
          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

1 entries across 1 versions & 1 rubygems

Version Path
fog-1.23.0 lib/fog/cloudstack/requests/compute/list_service_offerings.rb