Class: Nomad::Allocation

Inherits:
Request show all
Defined in:
lib/nomad/api/allocation.rb

Instance Attribute Summary

Attributes inherited from Request

#client

Instance Method Summary collapse

Methods inherited from Request

#initialize, #inspect, #to_s

Constructor Details

This class inherits a constructor from Nomad::Request

Instance Method Details

#list(**options) ⇒ Array<Alloc>

List allocations.

Parameters:

  • options (String)

    :prefix An optional prefix to filter

Returns:



21
22
23
24
# File 'lib/nomad/api/allocation.rb', line 21

def list(**options)
  json = client.get("/v1/allocations", options)
  return json.map { |item| Alloc.decode(item) }
end

#read(id, **options) ⇒ Alloc

Read a specific allocation.

Parameters:

  • id (String)

    The full ID of the allocation to read

Returns:



31
32
33
34
# File 'lib/nomad/api/allocation.rb', line 31

def read(id, **options)
  json = client.get("/v1/allocation/#{CGI.escape(id)}", options)
  return Alloc.decode(json)
end