class Marathon::Leader

This class represents a Marathon Leader. See mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/leader for full list of API's methods.

Public Class Methods

delete() click to toggle source

Causes the current leader to abdicate, triggering a new election. If no leader exists, raises NotFoundError.

# File lib/marathon/leader.rb, line 30
def delete
  Marathon.singleton.leaders.delete
end
get() click to toggle source

Returns the current leader. If no leader exists, raises NotFoundError.

# File lib/marathon/leader.rb, line 24
def get
  Marathon.singleton.leaders.get
end
new(marathon_instance = Marathon.singleton) click to toggle source
# File lib/marathon/leader.rb, line 5
def initialize(marathon_instance = Marathon.singleton)
  @connection = marathon_instance.connection
end

Public Instance Methods

delete() click to toggle source

Causes the current leader to abdicate, triggering a new election. If no leader exists, raises NotFoundError.

# File lib/marathon/leader.rb, line 17
def delete
  json = @connection.delete('/v2/leader')
  json['message']
end
get() click to toggle source

Returns the current leader. If no leader exists, raises NotFoundError.

# File lib/marathon/leader.rb, line 10
def get
  json = @connection.get('/v2/leader')
  json['leader']
end