Class: Docker::Swarm::Network

Inherits:
Object
  • Object
show all
Defined in:
lib/docker/swarm/network.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(swarm, hash) ⇒ Network

Returns a new instance of Network.



6
7
8
9
# File 'lib/docker/swarm/network.rb', line 6

def initialize(swarm, hash)
  @hash = hash
  @swarm = swarm
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



4
5
6
# File 'lib/docker/swarm/network.rb', line 4

def hash
  @hash
end

Instance Method Details

#connectionObject



11
12
13
# File 'lib/docker/swarm/network.rb', line 11

def connection
  return @swarm.connection
end

#driverObject



23
24
25
# File 'lib/docker/swarm/network.rb', line 23

def driver
  return @hash['Driver']
end

#idObject



15
16
17
# File 'lib/docker/swarm/network.rb', line 15

def id
  return @hash['Id']
end

#nameObject



19
20
21
# File 'lib/docker/swarm/network.rb', line 19

def name
  return @hash['Name']
end

#removeObject



34
35
36
37
38
39
40
# File 'lib/docker/swarm/network.rb', line 34

def remove
  if (@swarm)
    @swarm.nodes.each do |node|
      node.remove_network(self)
    end
  end
end

#subnetsObject



27
28
29
30
31
32
# File 'lib/docker/swarm/network.rb', line 27

def subnets
  if (@hash['IPAM']) && (@hash['IPAM']['Config'])
    return @hash['IPAM']['Config']
  end
  return []
end