Skip to content

Commit a24bad0

Browse files
committed
added acl_update method
- added acl_update method to update ACL properties of an entity
1 parent 7585d0f commit a24bad0

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

splunklib/client.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,36 @@ def reload(self):
12161216
self.post("_reload")
12171217
return self
12181218

1219+
def acl_update(self, **kwargs):
1220+
"""To update Access Control List (ACL) properties for an endpoint.
1221+
1222+
:param kwargs: Additional entity-specific arguments (required).
1223+
1224+
- "owner" (``string``): The Splunk username, such as "admin". A value of "nobody" means no specific user (required).
1225+
1226+
- "sharing" (``string``): A mode that indicates how the resource is shared. The sharing mode can be "user", "app", "global", or "system" (required).
1227+
1228+
:type kwargs: ``dict``
1229+
1230+
**Example**::
1231+
1232+
import splunklib.client as client
1233+
service = client.connect(...)
1234+
saved_search = service.saved_searches["name"]
1235+
saved_search.acl_update(sharing="app", owner="nobody", app="search", **{"perms.read": "admin, nobody"})
1236+
"""
1237+
if "body" not in kwargs:
1238+
kwargs = {"body": {**kwargs}}
1239+
1240+
if "sharing" not in kwargs["body"]:
1241+
raise ValueError("Required argument 'sharing' is missing.")
1242+
if "owner" not in kwargs["body"]:
1243+
raise ValueError("Required argument 'owner' is missing.")
1244+
1245+
self.post("acl", **kwargs)
1246+
self.refresh()
1247+
return self
1248+
12191249
@property
12201250
def state(self):
12211251
"""Returns the entity's state record.

0 commit comments

Comments
 (0)