Skip to content

Commit b959702

Browse files
committed
saving sample in main
1 parent 038cd3f commit b959702

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea/
22
.pytest_cache/
33
*.egg
4-
tests/.env
4+
tests/.env
5+
*.zip

cloudshell/sandbox_rest/sandbox_api.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class SandboxRestApiSession:
2525
"""
2626

2727
def __init__(
28-
self, host: str, username: str, password="", token="", domain="Global", port=82, is_https=False, api_version="v2"
28+
self, host: str, username="", password="", token="", domain="Global", port=82, is_https=False, api_version="v2"
2929
):
3030
""" login to api and store headers for future requests """
3131
_protocol = "https" if is_https else "http"
@@ -398,3 +398,12 @@ def delete_execution(self, execution_id: str) -> dict:
398398
if not response.ok:
399399
raise SandboxRestException(f"Failed to delete execution for '{execution_id}'", response)
400400
return response.json()
401+
402+
403+
if __name__ == "__main__":
404+
admin_api = SandboxRestApiSession(host="localhost", username="admin", password="admin", domain="end_users")
405+
user_token = admin_api.get_token_for_target_user("end_user")
406+
user_api = SandboxRestApiSession(host="localhost", token=user_token)
407+
response = user_api.start_sandbox(blueprint_id="end user bp")
408+
commands = user_api.get_sandbox_command_details()
409+
pass

0 commit comments

Comments
 (0)