class OnappMarket::Search

Trader Side OnApp Market API - Search

This is the API used by Trader to find resources to the OnApp Market.

Assumptions

It is assumed that any user of this API will have

Attributes

api[RW]

API used to manage this resource

Public Class Methods

new(api) click to toggle source

Create a new instance of Supplier API

Attributes

  • api - The API to communicate over

# File lib/onapp_market/search.rb, line 26
def initialize(api)
  raise "No OnAppMarket API specified" if api == nil
  @api = api
end

Public Instance Methods

find(resource_query = nil, pricing_query = nil, offset = 0, limit = -1) click to toggle source

Find resource which match the specified queries.

Attributes

Returns

Roles

trader, admin

# File lib/onapp_market/search.rb, line 42
def find(resource_query = nil, pricing_query = nil, offset = 0, limit = -1)
  resource_query = OnappMarket::API::Query::NilOperator.new if resource_query == nil
  pricing_query = OnappMarket::API::Query::NilOperator.new if pricing_query == nil
  resource_json = OnappMarket::API::Query::to_json(resource_query)
  pricing_json = OnappMarket::API::Query::to_json(pricing_query)
  @api.post("/resource/search", {:resource_query => resource_json.to_s, :pricing_query => pricing_json.to_s, :offset => offset, :limit => limit})
end
find_by_template(template_query = nil, offset = 0, limit = -1) click to toggle source

Find compute resources and templates which match a given template query

Attributes

Returns

Roles

trader, admin

# File lib/onapp_market/search.rb, line 60
def find_by_template(template_query = nil, offset = 0, limit = -1)
  template_json = OnappMarket::API::Query::to_json(template_query)
  @api.post("/compute/template_search", {:template_query => template_json.to_s, :offset => offset, :limit => limit})
end