hyperdock 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5f73a7f73c8d3f0c07ed74ff994c019d154c880
4
- data.tar.gz: b10ae9ce250ab37a1aabec1a08e6092a4323e2a6
3
+ metadata.gz: 1ac5a7d70d6c21f9b17ff97cdb95f87702d2f7b9
4
+ data.tar.gz: 9e2bd811a87c6ad98b6c9e8ee3cbe749a6585c8a
5
5
  SHA512:
6
- metadata.gz: b4daa5340379d8adf09b8869edb031f2000c9a107838a93fa34b1c21dff1bd3bdeabbc6179ebc4ff96b60a5a0134302f62abff8d5ac84419ffcda98b03da8efb
7
- data.tar.gz: d12d164a42736eac0214750f0a7b82a159d7bd3110bb3153ed93a52d91900f7326ab38917a0e032f2b67cabdf1c227f24ef929c712affa5c034d2c46b89baa0e
6
+ metadata.gz: 9923ac33a2733ebe90707113a97090a25ab56f27803e6fe5d80d5fbc3e7647836e0703e2cd1b3baf5fe123e6a2d94cdc75e1fbedd967a06bb0f914cc889318df
7
+ data.tar.gz: 88b3b036cf3583e38456ae74815d4fbe23f6bc249f77acb2c15ae334b62b433a05e38d062c554a62c5307fd6081272319d5ba2b3013d193c54559b20ba790ee8
@@ -15,6 +15,7 @@ Webmachine.application.routes do
15
15
  add ['networks'], HyperDock::Resource::Networks
16
16
  add ['network', :network], HyperDock::Resource::Network
17
17
  add ['volumes'], HyperDock::Resource::Volumes
18
+ add ['volume', :volume], HyperDock::Resource::Volume
18
19
  end
19
20
 
20
21
  Webmachine.application.run
@@ -28,9 +28,17 @@ module HyperDock
28
28
  .map { |network| { href: "/network/#{network}" } }
29
29
  end
30
30
 
31
+ def volumes
32
+ @volumes ||= container
33
+ .info
34
+ .fetch('Mounts') { [] }
35
+ .map { |volume| { href: "/volume/#{volume.fetch('Name')}" } }
36
+ end
37
+
31
38
  def links
32
39
  @links ||= {
33
40
  networks: networks,
41
+ volumes: volumes,
34
42
  ports: { href: "/#{request.disp_path}/ports" }
35
43
  }
36
44
  end
@@ -19,7 +19,8 @@ module HyperDock
19
19
  'container:ports' => { href: '/container/{container}/ports', templated: true },
20
20
  networks: { href: '/networks' },
21
21
  network: { href: '/network/{network}', templated: true },
22
- volumes: { href: '/volumes' }
22
+ volumes: { href: '/volumes' },
23
+ volume: { href: '/volume/{volume}', templated: true }
23
24
  }
24
25
  end
25
26
  end
@@ -0,0 +1,24 @@
1
+ require 'docker-api'
2
+ require_relative 'core'
3
+
4
+ module HyperDock
5
+ module Resource
6
+ class Volume < Core
7
+ Contract None => Maybe[::Docker::Volume]
8
+ def volume
9
+ @volume ||= ::Docker::Volume.get request.path_info[:volume]
10
+ end
11
+
12
+ Contract None => Bool
13
+ def resource_exists?
14
+ !volume.nil?
15
+ rescue ::Docker::Error::NotFoundError
16
+ false
17
+ end
18
+
19
+ def attributes
20
+ volume.info
21
+ end
22
+ end
23
+ end
24
+ end
@@ -9,3 +9,4 @@ require_relative 'resource/project_services'
9
9
  require_relative 'resource/projects'
10
10
  require_relative 'resource/root'
11
11
  require_relative 'resource/volumes'
12
+ require_relative 'resource/volume'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperdock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Olstrom
@@ -94,6 +94,7 @@ files:
94
94
  - lib/hyperdock/resource/project_services.rb
95
95
  - lib/hyperdock/resource/projects.rb
96
96
  - lib/hyperdock/resource/root.rb
97
+ - lib/hyperdock/resource/volume.rb
97
98
  - lib/hyperdock/resource/volumes.rb
98
99
  - lib/hyperdock/resources.rb
99
100
  homepage: https://github.com/colstrom/hyperdock