Class: Docker::Swarm::Service
- Inherits:
-
Object
- Object
- Docker::Swarm::Service
- Includes:
- Base
- Defined in:
- lib/docker/swarm/service.rb
Overview
This class represents a Docker Swarm Service.
Class Method Summary collapse
- .all(opts = {}, conn = Docker.connection) ⇒ Object
- .get(id, opts = {}, conn = Docker.connection) ⇒ Object
Class Method Details
.all(opts = {}, conn = Docker.connection) ⇒ Object
12 13 14 15 |
# File 'lib/docker/swarm/service.rb', line 12 def all(opts = {}, conn = Docker.connection) hashes = Docker::Util.parse_json(conn.get('/services', opts)) || [] hashes.map { |hash| new(conn, hash) } end |
.get(id, opts = {}, conn = Docker.connection) ⇒ Object
6 7 8 9 10 |
# File 'lib/docker/swarm/service.rb', line 6 def get(id, opts = {}, conn = Docker.connection) service_json = conn.get("/services/#{URI.encode(id)}", opts) hash = Docker::Util.parse_json(service_json) || {} new(conn, hash) end |