8000 add a space for acl function descriptions · python-microservices/consulate@61ca857 · GitHub
[go: up one dir, main page]

Skip to content

Commit 61ca857

Browse files
committed
add a space for acl function descriptions
1 parent 2ebd6ce commit 61ca857

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

consulate/api/acl.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ class ACL(base.Endpoint):
2626
"""
2727
def list_policies(self):
2828
"""List all ACL policies available in cluster.
29+
2930
:param rtype: list
3031
3132
"""
3233
return self._get(["policies"])
3334

3435
def read_policy(self, id):
3536
"""Read an existing policy with the given ID.
37+
3638
:param str id: The ID of the policy.
3739
:param rtype: dict
3840
@@ -68,6 +70,7 @@ def update_policy(self,
6870
description=None,
6971
rules=None):
7072
"""Update policy with id given.
73+
7174
:param str id: A UUID for the policy to update.
7275
:param str name: name of the policy
7376
:param list() datacenters: A list of datacenters to filter on policy.
@@ -86,6 +89,7 @@ def update_policy(self,
8689

8790
def delete_policy(self, id):
8891
"""Delete an existing policy with the given ID.
92+
8993
:param str id: The ID of the policy.
9094
:param rtype: bool
9195
@@ -101,6 +105,7 @@ def list_roles(self):
101105

102106
def read_role(self, id=None, name=None):
103107
"""Read an existing role with the given ID or Name.
108+
104109
:param str id: The ID of the role.
105110
:param str name: The name of the role.
106111
:param rtype: dict
@@ -119,6 +124,7 @@ def create_role(self,
119124
policies=None,
120125
service_identities=None):
121126
"""Create an ACL role from a list of policies or service identities.
127+
122128
:param str name: The name of the ACL role. Must be unique.
123129
:param str description: The description of the ACL role.
124130
:param PolicyLinks policies: An array of PolicyLink.
@@ -141,6 +147,7 @@ def update_role(self,
141147
policies=None,
142148
service_identities=None):
143149
"""Update role with id given.
150+
144151
:param str id: A UUID for the policy to update.
145152
:param str name: name of the policy
146153
:param list() datacenters: A list of datacenters to filter on policy.
@@ -159,6 +166,7 @@ def update_role(self,
159166

160167
def delete_role(self, id):
161168
"""Delete an existing role with the given ID.
169+
162170
:param str id: The ID of the role.
163171
:param rtype: bool
164172
@@ -167,13 +175,15 @@ def delete_role(self, id):
167175

168176
def list_tokens(self):
169177
"""List all ACL tokens available in cluster.
178+
170179
:param rtype: list
171180
172181
"""
173182
return self._get(["tokens"])
174183

175184
def read_token(self, accessor_id):
176185
"""Read an existing token with the given ID.
186+
177187
:param str id: The ID of the role.
178188
:param rtype: dict
179189
@@ -182,6 +192,7 @@ def read_token(self, accessor_id):
182192

183193
def read_self_token(self):
184194
"""Retrieve the currently used token.
195+
185196
:param rtype: dict
186197
187198
"""
@@ -199,6 +210,7 @@ def create_token(self,
199210
service_identities=None):
200211
"""Create a token from the roles, policies, and service identities
201212
provided.
213+
202214
:param str accessor_id: A UUID for accessing the token.
203215
:param str description: A human-readable description of the token.
204216
:param str expiration_time: The amount of time till the token expires.
@@ -225,6 +237,15 @@ def create_token(self,
225237
roles=roles,
226238
service_identities=service_identities)))
227239

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+
228249
# NOTE: Everything below here is deprecated post consul-1.4.0.
229250

230251
def bootstrap(self):

consulate/models/acl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
def _validate_link_array(value, model):
99
""" Validate the policies or roles links are formatted correctly.
10+
1011
:param list(dict()) value: An array of PolicyLink or RoleLink.
1112
:param rtype: bool
1213
:param consulate.models.agent.Check model: The model instance.
@@ -19,6 +20,7 @@ def _validate_link_array(value, model):
1920

2021
def _validate_service_identities(value, model):
2122
""" Validate service_identities is formatted correctly.
23+
2224
:param list(dict()) value: A ServiceIdentity list
2325
:param rtype: bool
2426

0 commit comments

Comments
 (0)
0