Class: Buildkite::Cluster

Inherits:
Object
  • Object
show all
Defined in:
lib/buildkite/models/cluster.rb

Class Method Summary collapse

Methods inherited from Object

#initialize, #to_ostruct

Constructor Details

This class inherits a constructor from Buildkite::Object

Class Method Details

.create(org: Buildkite.config.org, name:, **args) ⇒ Object



16
17
18
19
20
# File 'lib/buildkite/models/cluster.rb', line 16

def create(org: Buildkite.config.org, name:, **args)
  data = {name: name}
  response = Client.post_request("organizations/#{org}/clusters", body: data.merge(args))
  Cluster.new response.body
end

.delete(org: Buildkite.config.org, id:) ⇒ Object



27
28
29
# File 'lib/buildkite/models/cluster.rb', line 27

def delete(org: Buildkite.config.org, id:)
  Client.delete_request("organizations/#{org}/clusters/#{id}")
end

.list(org: Buildkite.config.org) ⇒ Object



6
7
8
9
# File 'lib/buildkite/models/cluster.rb', line 6

def list(org: Buildkite.config.org)
  response = Client.get_request("organizations/#{org}/clusters")
  Collection.from_response(response, type: Cluster)
end

.retrieve(org: Buildkite.config.org, id:) ⇒ Object



11
12
13
14
# File 'lib/buildkite/models/cluster.rb', line 11

def retrieve(org: Buildkite.config.org, id:)
  response = Client.get_request("organizations/#{org}/clusters/#{id}")
  Cluster.new response.body
end

.update(org: Buildkite.config.org, id:, **args) ⇒ Object



22
23
24
25
# File 'lib/buildkite/models/cluster.rb', line 22

def update(org: Buildkite.config.org, id:, **args)
  response = Client.patch_request("organizations/#{org}/clusters/#{id}", body: args)
  Cluster.new response.body
end