Skip to content

Commit 8e75a45

Browse files
authored
Merge pull request #16 from splitio/admin-api-key-add-scopes
added scope handling
2 parents 454955c + 9380d4b commit 8e75a45

File tree

10 files changed

+32
-10
lines changed

10 files changed

+32
-10
lines changed

CHANGES.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@
2828
3.1.8 (Jun 29nd, 2023)
2929
- Added suggestedValues for attributes
3030
3.1.9 (Sept 7th, 2023)
31-
- Fixed `to_dict()` method for Segments, Segment Definitions and Split Definitions
31+
- Fixed `to_dict()` method for Segments, Segment Definitions and Split Definitions
32+
3.1.10 (Aug 18, 2023)
33+
- Added scope options for admin api
34+

bin/activate

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ deactivate () {
3838
# unset irrelevant variables
3939
deactivate nondestructive
4040

41-
VIRTUAL_ENV="/Users/joshuaklein/code/py_fix_splitDef_dict/python-api"
41+
VIRTUAL_ENV="/Users/joshuaklein/code/py_add_scopes/python-api"
42+
4243
export VIRTUAL_ENV
4344

4445
_OLD_VIRTUAL_PATH="$PATH"

bin/activate.csh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PA
88
# Unset irrelevant variables.
99
deactivate nondestructive
1010

11-
setenv VIRTUAL_ENV "/Users/joshuaklein/code/py_fix_splitDef_dict/python-api"
11+
12+
setenv VIRTUAL_ENV "/Users/joshuaklein/code/py_add_scopes/python-api"
13+
1214

1315
set _OLD_VIRTUAL_PATH="$PATH"
1416
setenv PATH "$VIRTUAL_ENV/bin:$PATH"

bin/activate.fish

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ end
3333
# Unset irrelevant variables.
3434
deactivate nondestructive
3535

36-
set -gx VIRTUAL_ENV "/Users/joshuaklein/code/py_fix_splitDef_dict/python-api"
36+
37+
set -gx VIRTUAL_ENV "/Users/joshuaklein/code/py_add_scopes/python-api"
38+
3739

3840
set -gx _OLD_VIRTUAL_PATH $PATH
3941
set -gx PATH "$VIRTUAL_ENV/bin" $PATH

bin/pip

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/Users/joshuaklein/code/py_fix_splitDef_dict/python-api/bin/python3.11
1+
2+
#!/Users/joshuaklein/code/py_add_scopes/python-api/bin/python3.11
3+
24
# -*- coding: utf-8 -*-
35
import re
46
import sys

bin/pip3

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/Users/joshuaklein/code/py_fix_splitDef_dict/python-api/bin/python3.11
1+
2+
#!/Users/joshuaklein/code/py_add_scopes/python-api/bin/python3.11
3+
24
# -*- coding: utf-8 -*-
35
import re
46
import sys

bin/pip3.11

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/Users/joshuaklein/code/py_fix_splitDef_dict/python-api/bin/python3.11
1+
2+
#!/Users/joshuaklein/code/py_add_scopes/python-api/bin/python3.11
3+
24
# -*- coding: utf-8 -*-
35
import re
46
import sys

pyvenv.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ home = /usr/local/opt/[email protected]/bin
22
include-system-site-packages = false
33
version = 3.11.4
44
executable = /usr/local/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/bin/python3.11
5-
command = /usr/local/opt/[email protected]/bin/python3.11 -m venv /Users/joshuaklein/code/py_fix_splitDef_dict/python-api
5+
6+
command = /usr/local/opt/[email protected]/bin/python3.11 -m venv /Users/joshuaklein/code/py_add_scopes/python-api
7+

splitapiclient/microclients/apikey_microclient.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ def __init__(self, http_client):
3838
'''
3939
self._http_client = http_client
4040

41-
def create_apikey(self, api_key_name, api_key_type, environment_ids, workspace_id):
41+
def create_apikey(self, api_key_name, api_key_type, environment_ids, workspace_id, roles = None):
4242
'''
4343
create new apikey
4444
45-
:param: apikey info, environment and workaspce
45+
:param: apikey info, environment workspace and (optional) roles array
4646
4747
:returns: APIKey object
4848
:rtype: APIKey
@@ -55,6 +55,8 @@ def create_apikey(self, api_key_name, api_key_type, environment_ids, workspace_i
5555
data['environments'] = environmentIds
5656
if workspace_id is not None:
5757
data['workspace'] = {'type':'workspace', 'id': workspace_id}
58+
if roles is not None:
59+
data['roles'] = roles
5860
response = self._http_client.make_request(
5961
self._endpoint['create_apikey'],
6062
body = data
@@ -75,3 +77,5 @@ def delete_apikey(self, apikey_id):
7577
apikeyId = apikey_id
7678
)
7779
return True
80+
81+

splitapiclient/resources/apikey.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class APIKey(BaseResource):
3030
'type': 'string',
3131
'id': 'string'
3232
},
33+
'roles': ['string'],
3334
type: 'api_key'
3435
}
3536

@@ -47,6 +48,7 @@ def __init__(self, data=None, client=None):
4748
self._environments = data.get('environments') if 'environments' in data else []
4849
self._workspace = data.get('workspace') if 'workspace' in data else {}
4950
self._type = data.get('type')
51+
self._roles = data.get('roles')
5052

5153
@property
5254
def key(self):

0 commit comments

Comments
 (0)