Class: Docker::API::Config

Inherits:
Base
  • Object
show all
Defined in:
lib/docker/api/config.rb

Overview

This class represents the Docker API endpoints regarding configs.

Configs are application configurations that can be used by services. Swarm mode must be enabled for these endpoints to work.

Instance Attribute Summary

Attributes inherited from Base

#api_version

Instance Method Summary collapse

Methods inherited from Base

#initialize, #request

Constructor Details

This class inherits a constructor from Docker::API::Base

Instance Method Details

#create(body = {}) ⇒ Object

Create a config

Docker API: POST /configs/create



26
27
28
# File 'lib/docker/api/config.rb', line 26

def create body = {}
    request(method: :post, path: "/configs/create", headers: {"Content-Type": "application/json"}, body: body.to_json)
end

#details(name) ⇒ Object

Inspect a config

Docker API: GET /configs/id



37
38
39
# File 'lib/docker/api/config.rb', line 37

def details name
    get("/configs/#{name}")
end

#list(params = {}) ⇒ Object

List configs

Docker API: GET /configs



15
16
17
# File 'lib/docker/api/config.rb', line 15

def list params = {}
    get("/configs", params)
end

#remove(name) ⇒ Object

Delete a config

Docker API: DELETE /configs/id



63
64
65
# File 'lib/docker/api/config.rb', line 63

def remove name
    delete("/configs/#{name}")
end

#update(name, params = {}, body = {}) ⇒ Object

Update a config

Docker API: POST /configs/id/update



52
53
54
# File 'lib/docker/api/config.rb', line 52

def update name, params = {}, body = {}
    request(method: :post, path: "/configs/#{name}/update", params: params, headers: {"Content-Type": "application/json"}, body: body.to_json)
end