Class: DockerCloud::ServiceAPI
- Inherits:
-
API
- Object
- API
- DockerCloud::ServiceAPI
show all
- Defined in:
- lib/docker_cloud/api/service_api.rb
Constant Summary
collapse
- TYPE =
'Service'.freeze
Constants inherited
from API
API::API_VERSION, API::BASE_API_PATH
Instance Attribute Summary
Attributes inherited from API
#client, #headers, #type
Instance Method Summary
collapse
Methods inherited from API
#get_from_uri, #http_delete, #http_get, #http_patch, #http_post, #initialize, #parse, #url
Instance Method Details
#all(params = {}) ⇒ Object
9
10
11
12
|
# File 'lib/docker_cloud/api/service_api.rb', line 9
def all(params = {})
response = http_get(resource_url, params)
format_object(response, TYPE)
end
|
#create(params) ⇒ Object
14
15
16
17
|
# File 'lib/docker_cloud/api/service_api.rb', line 14
def create(params)
response = http_post(resource_url, params)
format_object(response, TYPE)
end
|
#get(uuid) ⇒ Object
19
20
21
22
|
# File 'lib/docker_cloud/api/service_api.rb', line 19
def get(uuid)
response = http_get(resource_url(uuid))
format_object(response, TYPE)
end
|
#logs(uuid) ⇒ Object
24
25
26
27
|
# File 'lib/docker_cloud/api/service_api.rb', line 24
def logs(uuid)
url = "#{uuid}/logs/"
http_get(resource_url(url))
end
|
#redeploy(uuid) ⇒ Object
46
47
48
49
50
|
# File 'lib/docker_cloud/api/service_api.rb', line 46
def redeploy(uuid)
url = "#{uuid}/redeploy/"
response = http_post(resource_url(url))
format_object(response, TYPE)
end
|
#resource_url(params = '') ⇒ Object
5
6
7
|
# File 'lib/docker_cloud/api/service_api.rb', line 5
def resource_url(params = '')
"/service/#{params}"
end
|
#start(uuid) ⇒ Object
34
35
36
37
38
|
# File 'lib/docker_cloud/api/service_api.rb', line 34
def start(uuid)
url = "#{uuid}/start/"
response = http_post(resource_url(url))
format_object(response, TYPE)
end
|
#stop(uuid) ⇒ Object
40
41
42
43
44
|
# File 'lib/docker_cloud/api/service_api.rb', line 40
def stop(uuid)
url = "#{uuid}/stop/"
response = http_post(resource_url(url))
format_object(response, TYPE)
end
|
#terminate(uuid) ⇒ Object
52
53
54
55
56
|
# File 'lib/docker_cloud/api/service_api.rb', line 52
def terminate(uuid)
uuid = "#{uuid}/"
response = http_delete(resource_url(uuid))
format_object(response, TYPE)
end
|
#update(uuid, params) ⇒ Object
29
30
31
32
|
# File 'lib/docker_cloud/api/service_api.rb', line 29
def update(uuid, params)
response = http_patch(resource_url(uuid), params)
format_object(response, TYPE)
end
|