class Marathon::EventSubscriptions

This class represents a Marathon Event Subscriptions. See mesosphere.github.io/marathon/docs/rest-api.html#event-subscriptions for full list of API's methods.

Public Class Methods

list() click to toggle source

List all event subscriber callback URLs. Returns a list of strings/URLs.

# File lib/marathon/event_subscriptions.rb, line 40
def list
  Marathon.singleton.event_subscriptions.list
end
new(marathon_instance = Marathon.singleton) click to toggle source
# File lib/marathon/event_subscriptions.rb, line 5
def initialize(marathon_instance = Marathon.singleton)
  @connection = marathon_instance.connection
end
register(callbackUrl) click to toggle source

Register a callback URL as an event subscriber. callbackUrl: URL to which events should be posted. Returns an event as hash.

# File lib/marathon/event_subscriptions.rb, line 47
def register(callbackUrl)
  Marathon.singleton.event_subscriptions.register(callbackUrl)
end
unregister(callbackUrl) click to toggle source

Unregister a callback URL from the event subscribers list. callbackUrl: URL passed when the event subscription was created. Returns an event as hash.

# File lib/marathon/event_subscriptions.rb, line 54
def unregister(callbackUrl)
  Marathon.singleton.event_subscriptions.unregister(callbackUrl)
end

Public Instance Methods

list() click to toggle source

List all event subscriber callback URLs. Returns a list of strings/URLs.

# File lib/marathon/event_subscriptions.rb, line 11
def list
  json = @connection.get('/v2/eventSubscriptions')
  json['callbackUrls']
end
register(callbackUrl) click to toggle source

Register a callback URL as an event subscriber. callbackUrl: URL to which events should be posted. Returns an event as hash.

# File lib/marathon/event_subscriptions.rb, line 19
def register(callbackUrl)
  query = {}
  query[:callbackUrl] = callbackUrl
  json = @connection.post('/v2/eventSubscriptions', query)
  json
end
unregister(callbackUrl) click to toggle source

Unregister a callback URL from the event subscribers list. callbackUrl: URL passed when the event subscription was created. Returns an event as hash.

# File lib/marathon/event_subscriptions.rb, line 29
def unregister(callbackUrl)
  query = {}
  query[:callbackUrl] = callbackUrl
  json = @connection.delete('/v2/eventSubscriptions', query)
  json
end