Browse code

change node ls and service ls api and docs

Signed-off-by: allencloud <allen.sun@daocloud.io>

allencloud authored on 2016/11/09 13:06:00
Showing 4 changed files
... ...
@@ -3952,9 +3952,10 @@ List nodes
3952 3952
 - **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
3953 3953
   nodes list. Available filters:
3954 3954
   - `id=<node id>`
3955
+  - `label=<engine label>`
3956
+  - `membership=`(`accepted`|`pending`)`
3955 3957
   - `name=<node name>`
3956
-  - `membership=`(`pending`|`accepted`|`rejected`)`
3957
-  - `role=`(`worker`|`manager`)`
3958
+  - `role=`(`manager`|`worker`)`
3958 3959
 
3959 3960
 **Status codes**:
3960 3961
 
... ...
@@ -4501,8 +4502,9 @@ List services
4501 4501
 
4502 4502
 - **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
4503 4503
   services list. Available filters:
4504
-  - `id=<node id>`
4505
-  - `name=<node name>`
4504
+  - `id=<service id>`
4505
+  - `label=<service label>`
4506
+  - `name=<service name>`
4506 4507
 
4507 4508
 **Status codes**:
4508 4509
 
... ...
@@ -4554,9 +4554,10 @@ List nodes
4554 4554
 - **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
4555 4555
   nodes list. Available filters:
4556 4556
   - `id=<node id>`
4557
+  - `label=<engine label>`
4558
+  - `membership=`(`accepted`|`pending`)`
4557 4559
   - `name=<node name>`
4558
-  - `membership=`(`pending`|`accepted`|`rejected`)`
4559
-  - `role=`(`worker`|`manager`)`
4560
+  - `role=`(`manager`|`worker`)`
4560 4561
 
4561 4562
 **Status codes**:
4562 4563
 
... ...
@@ -5161,8 +5162,9 @@ List services
5161 5161
 
5162 5162
 - **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
5163 5163
   services list. Available filters:
5164
-  - `id=<node id>`
5165
-  - `name=<node name>`
5164
+  - `id=<service id>`
5165
+  - `label=<service label>`
5166
+  - `name=<service name>`
5166 5167
 
5167 5168
 **Status codes**:
5168 5169
 
... ...
@@ -49,48 +49,76 @@ than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "b
49 49
 
50 50
 The currently supported filters are:
51 51
 
52
-* name
53
-* id
54
-* label
52
+* [id](node_ls.md#id)
53
+* [label](node_ls.md#label)
54
+* [membership](node_ls.md#membership)
55
+* [name](node_ls.md#name)
56
+* [role](node_ls.md#role)
55 57
 
56
-### name
58
+#### ID
57 59
 
58
-The `name` filter matches on all or part of a node name.
59
-
60
-The following filter matches the node with a name equal to `swarm-master` string.
60
+The `id` filter matches all or part of a node's id.
61 61
 
62 62
 ```bash
63
-$ docker node ls -f name=swarm-manager1
63
+$ docker node ls -f id=1
64 64
 
65
-ID                           HOSTNAME        STATUS  AVAILABILITY  MANAGER STATUS
66
-e216jshn25ckzbvmwlnh5jr3g *  swarm-manager1  Ready   Active        Leader
65
+ID                         HOSTNAME       STATUS  AVAILABILITY  MANAGER STATUS
66
+1bcef6utixb0l0ca7gxuivsj0  swarm-worker2  Ready   Active
67 67
 ```
68 68
 
69
-### id
69
+#### Label
70 70
 
71
-The `id` filter matches all or part of a node's id.
71
+The `label` filter matches nodes based on engine labels and on the presence of a `label` alone or a `label` and a value. Node labels are currently not used for filtering.
72
+
73
+The following filter matches nodes with the `foo` label regardless of its value.
72 74
 
73 75
 ```bash
74
-$ docker node ls -f id=1
76
+$ docker node ls -f "label=foo"
75 77
 
76 78
 ID                         HOSTNAME       STATUS  AVAILABILITY  MANAGER STATUS
77 79
 1bcef6utixb0l0ca7gxuivsj0  swarm-worker2  Ready   Active
78 80
 ```
79 81
 
80
-#### label
82
+#### Membership
81 83
 
82
-The `label` filter matches tasks based on the presence of a `label` alone or a `label` and a
83
-value.
84
+The `membership` filter matches nodes based on the presence of a `membership` and a value
85
+`accepted` or `pending`.
84 86
 
85
-The following filter matches nodes with the `usage` label regardless of its value.
87
+The following filter matches nodes with the `membership` of `accepted`.
86 88
 
87 89
 ```bash
88
-$ docker node ls -f "label=foo"
90
+$ docker node ls -f "membership=accepted"
89 91
 
90
-ID                         HOSTNAME       STATUS  AVAILABILITY  MANAGER STATUS
91
-1bcef6utixb0l0ca7gxuivsj0  swarm-worker2  Ready   Active
92
+ID                           HOSTNAME        STATUS  AVAILABILITY  MANAGER STATUS
93
+1bcef6utixb0l0ca7gxuivsj0    swarm-worker2   Ready   Active
94
+38ciaotwjuritcdtn9npbnkuz    swarm-worker1   Ready   Active
92 95
 ```
93 96
 
97
+#### Name
98
+
99
+The `name` filter matches on all or part of a node hostname.
100
+
101
+The following filter matches the nodes with a name equal to `swarm-master` string.
102
+
103
+```bash
104
+$ docker node ls -f name=swarm-manager1
105
+
106
+ID                           HOSTNAME        STATUS  AVAILABILITY  MANAGER STATUS
107
+e216jshn25ckzbvmwlnh5jr3g *  swarm-manager1  Ready   Active        Leader
108
+```
109
+
110
+#### Role
111
+
112
+The `role` filter matches nodes based on the presence of a `role` and a value `worker` or `manager`.
113
+
114
+The following filter matches nodes with the `manager` role.
115
+
116
+```bash
117
+$ docker node ls -f "role=manager"
118
+
119
+ID                           HOSTNAME        STATUS  AVAILABILITY  MANAGER STATUS
120
+e216jshn25ckzbvmwlnh5jr3g *  swarm-manager1  Ready   Active        Leader
121
+```
94 122
 
95 123
 ## Related information
96 124
 
... ...
@@ -51,9 +51,9 @@ than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "b
51 51
 
52 52
 The currently supported filters are:
53 53
 
54
-* [id](#id)
55
-* [label](#label)
56
-* [name](#name)
54
+* [id](service_ls.md#id)
55
+* [label](service_ls.md#label)
56
+* [name](service_ls.md#name)
57 57
 
58 58
 #### ID
59 59
 
... ...
@@ -93,7 +93,7 @@ ID            NAME      MODE        REPLICAS  IMAGE
93 93
 
94 94
 #### Name
95 95
 
96
-The `name` filter matches on all or part of a tasks's name.
96
+The `name` filter matches on all or part of a service's name.
97 97
 
98 98
 The following filter matches services with a name containing `redis`.
99 99