@@ -26,13 +26,15 @@ class ACL(base.Endpoint):
26
26
"""
27
27
def list_policies (self ):
28
28
"""List all ACL policies available in cluster.
29
+
29
30
:param rtype: list
30
31
31
32
"""
32
33
return self ._get (["policies" ])
33
34
34
35
def read_policy (self , id ):
35
36
"""Read an existing policy with the given ID.
37
+
36
38
:param str id: The ID of the policy.
37
39
:param rtype: dict
38
40
@@ -68,6 +70,7 @@ def update_policy(self,
68
70
description = None ,
69
71
rules = None ):
70
72
"""Update policy with id given.
73
+
71
74
:param str id: A UUID for the policy to update.
72
75
:param str name: name of the policy
73
76
:param list() datacenters: A list of datacenters to filter on policy.
@@ -86,6 +89,7 @@ def update_policy(self,
86
89
87
90
def delete_policy (self , id ):
88
91
"""Delete an existing policy with the given ID.
92
+
89
93
:param str id: The ID of the policy.
90
94
:param rtype: bool
91
95
@@ -101,6 +105,7 @@ def list_roles(self):
101
105
102
106
def read_role (self , id = None , name = None ):
103
107
"""Read an existing role with the given ID or Name.
108
+
104
109
:param str id: The ID of the role.
105
110
:param str name: The name of the role.
106
111
:param rtype: dict
@@ -119,6 +124,7 @@ def create_role(self,
119
124
policies = None ,
120
125
service_identities = None ):
121
126
"""Create an ACL role from a list of policies or service identities.
127
+
122
128
:param str name: The name of the ACL role. Must be unique.
123
129
:param str description: The description of the ACL role.
124
130
:param PolicyLinks policies: An array of PolicyLink.
@@ -141,6 +147,7 @@ def update_role(self,
141
147
policies = None ,
142
148
service_identities = None ):
143
149
"""Update role with id given.
150
+
144
151
:param str id: A UUID for the policy to update.
145
152
:param str name: name of the policy
146
153
:param list() datacenters: A list of datacenters to filter on policy.
@@ -159,6 +166,7 @@ def update_role(self,
159
166
160
167
def delete_role (self , id ):
161
168
"""Delete an existing role with the given ID.
169
+
162
170
:param str id: The ID of the role.
163
171
:param rtype: bool
164
172
@@ -167,13 +175,15 @@ def delete_role(self, id):
167
175
168
176
def list_tokens (self ):
169
177
"""List all ACL tokens available in cluster.
178
+
170
179
:param rtype: list
171
180
172
181
"""
173
182
return self ._get (["tokens" ])
174
183
175
184
def read_token (self , accessor_id ):
176
185
"""Read an existing token with the given ID.
186
+
177
187
:param str id: The ID of the role.
178
188
:param rtype: dict
179
189
@@ -182,6 +192,7 @@ def read_token(self, accessor_id):
182
192
183
193
def read_self_token (self ):
184
194
"""Retrieve the currently used token.
195
+
185
196
:param rtype: dict
186
197
187
198
"""
@@ -199,6 +210,7 @@ def create_token(self,
199
210
service_identities = None ):
200
211
"""Create a token from the roles, policies, and service identities
201
212
provided.
213
+
202
214
:param str accessor_id: A UUID for accessing the token.
203
215
:param str description: A human-readable description of the token.
204
216
:param str expiration_time: The amount of time till the token expires.
@@ -225,6 +237,15 @@ def create_token(self,
225
237
roles = roles ,
226
238
service_identities = service_identities )))
227
239
240
+ def delete_token (self , accessor_id ):
241
+ """Delete an existing token with the given AcccessorID.
242
+
243
+ :param str id: The AccessorID of the token.
244
+ :param rtype: bool
245
+
246
+ """
247
+ return self ._delete (["token" , accessor_id ])
248
+
228
249
# NOTE: Everything below here is deprecated post consul-1.4.0.
229
250
230
251
def bootstrap (self ):
0 commit comments