MCPcopy Index your code
hub / github.com/docker/docker-py / NodeCollection

Class NodeCollection

docker/models/nodes.py:64–107  ·  view source on GitHub ↗

Nodes on the Docker server.

Source from the content-addressed store, hash-verified

62
63
64class NodeCollection(Collection):
65 """Nodes on the Docker server."""
66 model = Node
67
68 def get(self, node_id):
69 """
70 Get a node.
71
72 Args:
73 node_id (string): ID of the node to be inspected.
74
75 Returns:
76 A :py:class:`Node` object.
77
78 Raises:
79 :py:class:`docker.errors.APIError`
80 If the server returns an error.
81 """
82 return self.prepare_model(self.client.api.inspect_node(node_id))
83
84 def list(self, *args, **kwargs):
85 """
86 List swarm nodes.
87
88 Args:
89 filters (dict): Filters to process on the nodes list. Valid
90 filters: ``id``, ``name``, ``membership`` and ``role``.
91 Default: ``None``
92
93 Returns:
94 A list of :py:class:`Node` objects.
95
96 Raises:
97 :py:class:`docker.errors.APIError`
98 If the server returns an error.
99
100 Example:
101
102 >>> client.nodes.list(filters={'role': 'manager'})
103 """
104 return [
105 self.prepare_model(n)
106 for n in self.client.api.nodes(*args, **kwargs)
107 ]

Callers 1

nodesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected