Module: Buildkit::Client::Agents

Included in:
Buildkit::Client
Defined in:
lib/buildkit/client/agents.rb

Overview

Methods for the Agents API

Instance Method Summary collapse

Instance Method Details

#agent(org, id, options = {}) ⇒ Sawyer::Resource

Get an agent

Examples:

Buildkit.agent('my-great-org', '0b461f65-e7be-4c80-888a-ef11d81fd971')

Parameters:

  • org (String)

    Organization slug.

  • id (String)

    Agent id.

Returns:

  • (Sawyer::Resource)

    Hash representing Buildkite agent

See Also:



27
28
29
# File 'lib/buildkit/client/agents.rb', line 27

def agent(org, id, options = {})
  get("/v2/organizations/#{org}/agents/#{id}", options)
end

#agents(org, options = {}) ⇒ Array<Sawyer::Resource>

List agents

Examples:

Buildkit.agents('my-great-org')

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing Buildkite agents.

See Also:



15
16
17
# File 'lib/buildkit/client/agents.rb', line 15

def agents(org, options = {})
  get("/v2/organizations/#{org}/agents", options)
end

#stop_agent(org, id, options = {}) ⇒ Object

Stop an agent

Examples:

Stop an agent

Buildkit.stop_agent('my-great-org', '16940c91-f12d-4122-8154-0edf6c0978c2')

Parameters:

  • org (String)

    Organization slug.

  • id (String)

    Agent id.

See Also:



38
39
40
# File 'lib/buildkit/client/agents.rb', line 38

def stop_agent(org, id, options = {})
  put("/v2/organizations/#{org}/agents/#{id}/stop", options)
end