acl.py
This module contains interfaces that support CRUD operations on ACL.
__all__ = ['ACLException', 'ACLManager']
module-attribute
¶
ACLException
¶
Bases: Exception
Exception raised by ACLManager.
Source code in solnlib/acl.py
30 31 32 33 |
|
ACLManager
¶
ACL manager.
Examples:
>>> import solnlib.acl as sacl
>>> saclm = sacl.ACLManager(session_key, 'Splunk_TA_test')
>>> saclm.get('data/transforms/extractions')
>>> saclm.update('data/transforms/extractions/_acl',
perms_read=['*'], perms_write=['*'])
Source code in solnlib/acl.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
__init__(session_key, app, owner='nobody', scheme=None, host=None, port=None, **context)
¶
Initializes ACLManager.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session_key |
str
|
Splunk access token. |
required |
app |
str
|
App name of namespace. |
required |
owner |
str
|
(optional) Owner of namespace, default is |
'nobody'
|
scheme |
str
|
(optional) The access scheme, default is None. |
None
|
host |
str
|
(optional) The host name, default is None. |
None
|
port |
int
|
(optional) The port number, default is None. |
None
|
context |
dict
|
Other configurations for Splunk rest client. |
{}
|
Source code in solnlib/acl.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
get(path)
¶
Get ACL of /servicesNS/{owner
}/{app
}/{path
}.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path of ACL relative to /servicesNS/{ |
required |
Returns:
Type | Description |
---|---|
dict
|
A dict contains ACL. |
Raises:
Type | Description |
---|---|
ACLException
|
If |
Examples:
>>> aclm = acl.ACLManager(session_key, 'Splunk_TA_test')
>>> perms = aclm.get('data/transforms/extractions/_acl')
Source code in solnlib/acl.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
update(path, owner=None, perms_read=None, perms_write=None)
¶
Update ACL of /servicesNS/{owner
}/{app
}/{path
}.
If the ACL is per-entity (ends in /acl), owner can be reassigned. If the acl is endpoint-level (ends in _acl), owner will be ignored. The ‘sharing’ setting is always retrieved from the current.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path of ACL relative to /servicesNS/{owner}/{app}. MUST end with /acl or /_acl indicating whether the permission is applied at the per-entity level or endpoint level respectively. |
required |
owner |
str
|
(optional) New owner of ACL, default is |
None
|
perms_read |
List
|
(optional) List of roles ([‘*’] for all roles). If unspecified we will POST with current (if available) perms.read, default is None. |
None
|
perms_write |
List
|
(optional) List of roles ([‘*’] for all roles). If unspecified we will POST with current (if available) perms.write, default is None. |
None
|
Returns:
Type | Description |
---|---|
dict
|
A dict contains ACL after update. |
Raises:
Type | Description |
---|---|
ACLException
|
If |
Examples:
>>> aclm = acl.ACLManager(session_key, 'Splunk_TA_test')
>>> perms = aclm.update('data/transforms/extractions/_acl',
perms_read=['admin'], perms_write=['admin'])
Source code in solnlib/acl.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|