hyperdock 0.11.0 → 0.12.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: 4e946bc2ec1ecb40ec5f68a4e7604b9cf5daf1ec
4
- data.tar.gz: f84db2d9a6488ed9f6389fc0282c506bdc611a7f
3
+ metadata.gz: ece6869475b8063978c9ea067048e8cea3b07af8
4
+ data.tar.gz: a53ed407488432bea41bcaf47f81482523df94c6
5
5
  SHA512:
6
- metadata.gz: 7d9c26caa2007ff5699b1bd2145333074ad4e6ce86e1d4621b699bfe522da7a8ce7c3f057f96141453d182867fc149f60360f3ee09ac5729c617d0996c91c1ac
7
- data.tar.gz: 250df60d1a6d01c52cf4f2ec4a41e1066085b2bc84eb41f452a07c6e3f0aa7d7b90e5333aa0be496fd31ca4fa440080da9eb35c9643d3e769f18c70e1faf0d94
6
+ metadata.gz: d0b6b9f5813a591456252fdd0f6c6a04e997f1d983e212fcd8a88cf8a973d44e989926c3749b71496852923564bbb95a2d9c321d7fd74803e9a6e4274a0e5fd4
7
+ data.tar.gz: cdb1bbad3acc14b62d78602656a194670d2803b852825c2321ad6ad3bcb6b850d30d1ebf979e39e4e1f617e2966b70789a8e2e7944e46e84c3fbbaec6131775f
@@ -11,6 +11,7 @@ Webmachine.application.routes do
11
11
  add ['project', :project, 'service', :service], HyperDock::Resource::ProjectService
12
12
  add ['containers'], HyperDock::Resource::Containers
13
13
  add ['container', :container], HyperDock::Resource::Container
14
+ add ['container', :container, 'networks'], HyperDock::Resource::ContainerNetworks
14
15
  add ['container', :container, 'ports'], HyperDock::Resource::ContainerPorts
15
16
  end
16
17
 
@@ -21,7 +21,6 @@ module HyperDock
21
21
 
22
22
  def links
23
23
  @links ||= {
24
- mounts: { href: "/#{request.disp_path}/mounts" },
25
24
  networks: { href: "/#{request.disp_path}/networks" },
26
25
  ports: { href: "/#{request.disp_path}/ports" }
27
26
  }
@@ -0,0 +1,24 @@
1
+ require_relative 'container'
2
+
3
+ module HyperDock
4
+ module Resource
5
+ class ContainerNetworks < Container
6
+ Contract None => ArrayOf[String]
7
+ def networks
8
+ @networks ||= (container.info.dig('NetworkSettings', 'Networks') || {} ).values.map do |network|
9
+ network['NetworkID']
10
+ end.compact
11
+ end
12
+
13
+ def links
14
+ @links ||= {
15
+ networks: networks.map { |network| { "network:#{network}" => "/network/#{network}" } }.reduce(&:merge)
16
+ }
17
+ end
18
+
19
+ def attributes
20
+ { networks: networks }
21
+ end
22
+ end
23
+ end
24
+ end
@@ -32,6 +32,10 @@ module HyperDock
32
32
  @udp ||= ports.select { |port| port['Type'] == 'udp' }
33
33
  end
34
34
 
35
+ def links
36
+ {}
37
+ end
38
+
35
39
  def attributes
36
40
  {
37
41
  all: ports,
@@ -1,4 +1,5 @@
1
1
  require_relative 'resource/container'
2
+ require_relative 'resource/container_networks'
2
3
  require_relative 'resource/container_ports'
3
4
  require_relative 'resource/containers'
4
5
  require_relative 'resource/project'
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.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Olstrom
@@ -83,6 +83,7 @@ files:
83
83
  - hyperdock.gemspec
84
84
  - lib/hyperdock.rb
85
85
  - lib/hyperdock/resource/container.rb
86
+ - lib/hyperdock/resource/container_networks.rb
86
87
  - lib/hyperdock/resource/container_ports.rb
87
88
  - lib/hyperdock/resource/containers.rb
88
89
  - lib/hyperdock/resource/core.rb