Skip to content

Commit 5aead18

Browse files
committed
added scope handling
1 parent ef12f91 commit 5aead18

File tree

11 files changed

+20
-12
lines changed

11 files changed

+20
-12
lines changed

CHANGES.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@
2626
- Added `comment` and `title` as optional parameters for the `remove_from_environment` method of a Split
2727
- Updated default logging to be more useful
2828
3.1.8 (Jun 29nd, 2023)
29-
- Added suggestedValues for attributes
29+
- Added suggestedValues for attributes
30+
3.1.9 (Aug 18, 2023)
31+
- Added scope options for admin api

bin/activate

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

41-
VIRTUAL_ENV="/Users/joshuaklein/code/py_add_suggest_values/python-api"
41+
VIRTUAL_ENV="/Users/joshuaklein/code/py_add_scopes/python-api"
4242
export VIRTUAL_ENV
4343

4444
_OLD_VIRTUAL_PATH="$PATH"

bin/activate.csh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ 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_add_suggest_values/python-api"
11+
setenv VIRTUAL_ENV "/Users/joshuaklein/code/py_add_scopes/python-api"
1212

1313
set _OLD_VIRTUAL_PATH="$PATH"
1414
setenv PATH "$VIRTUAL_ENV/bin:$PATH"

bin/activate.fish

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

36-
set -gx VIRTUAL_ENV "/Users/joshuaklein/code/py_add_suggest_values/python-api"
36+
set -gx VIRTUAL_ENV "/Users/joshuaklein/code/py_add_scopes/python-api"
3737

3838
set -gx _OLD_VIRTUAL_PATH $PATH
3939
set -gx PATH "$VIRTUAL_ENV/bin" $PATH

bin/pip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/Users/joshuaklein/code/py_add_suggest_values/python-api/bin/python3.11
1+
#!/Users/joshuaklein/code/py_add_scopes/python-api/bin/python3.11
22
# -*- coding: utf-8 -*-
33
import re
44
import sys

bin/pip3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/Users/joshuaklein/code/py_add_suggest_values/python-api/bin/python3.11
1+
#!/Users/joshuaklein/code/py_add_scopes/python-api/bin/python3.11
22
# -*- coding: utf-8 -*-
33
import re
44
import sys

bin/pip3.11

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/Users/joshuaklein/code/py_add_suggest_values/python-api/bin/python3.11
1+
#!/Users/joshuaklein/code/py_add_scopes/python-api/bin/python3.11
22
# -*- coding: utf-8 -*-
33
import re
44
import sys

pyvenv.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
home = /usr/local/opt/[email protected]/bin
22
include-system-site-packages = false
33
version = 3.11.4
4-
executable = /usr/local/Cellar/[email protected]/3.11.4/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_add_suggest_values/python-api
4+
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_add_scopes/python-api

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)