class OnappMarket::OnApp::Supply

OnApp specific supply functions

Public Class Methods

new(api) click to toggle source

Create new instance

Attributes

  • api - The api which manages this resource

# File lib/onapp_market/onapp/supply.rb, line 14
def initialize(api)
  super(api)
end

Public Instance Methods

get_resources_by_cloud(cloud_id = nil) click to toggle source

Get a list of resources owned by this user on a specific cloud, or all resource if cloud_id is nil

Returns

Roles

supplier, admin

# File lib/onapp_market/onapp/supply.rb, line 25
def get_resources_by_cloud(cloud_id = nil)
  return get_resources({"cloud_id" => cloud_id})
end
submit_event(resource_id, type, data) click to toggle source

Submit event data about a resource for forwarding to interested traders (market will rewrite VM ids)

Attributes

  • resource_id - resource id of resource which is raising the specified event

  • type - type of the event

  • data - data associated with the event

  • OnappMarket::API::Response - object/hash of JSON billing data if is_ok?

Roles

supplier, admin

# File lib/onapp_market/onapp/supply.rb, line 38
def submit_event(resource_id, type, data)
  @api.post("/onapp/hypervisor_zone/#{resource_id.url_safe}/submit_event", {:event_type => type, :event_data => data})
end