From b6de71bb17ceb235695cd92bd926cff80ba79b58 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 8 Dec 2023 13:02:54 -0500 Subject: [PATCH] update the python sdk to support both reserved shares and unique names (#123) --- sdk/python/sdk/zrok/zrok/model.py | 2 ++ sdk/python/sdk/zrok/zrok/share.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sdk/python/sdk/zrok/zrok/model.py b/sdk/python/sdk/zrok/zrok/model.py index 28efecca..63e19c79 100644 --- a/sdk/python/sdk/zrok/zrok/model.py +++ b/sdk/python/sdk/zrok/zrok/model.py @@ -15,6 +15,8 @@ PUBLIC_SHARE_MODE: ShareMode = "public" @dataclass class ShareRequest: + Reserved: bool = false + UniqueName: str = "" BackendMode: BackendMode ShareMode: ShareMode Target: str diff --git a/sdk/python/sdk/zrok/zrok/share.py b/sdk/python/sdk/zrok/zrok/share.py index 52f135af..73639fc8 100644 --- a/sdk/python/sdk/zrok/zrok/share.py +++ b/sdk/python/sdk/zrok/zrok/share.py @@ -14,7 +14,10 @@ def CreateShare(root: Root, request: model.ShareRequest) -> model.Share: out = __newPublicShare(root, request) case _: raise Exception("unknown share mode " + request.ShareMode) - + out.reserved = request.reserved + if request.reserved: + out.unique_name = request.unique_name + if len(request.BasicAuth) > 0: out.auth_scheme = model.AUTH_SCHEME_BASIC for pair in request.BasicAuth: @@ -27,8 +30,6 @@ def CreateShare(root: Root, request: model.ShareRequest) -> model.Share: if request.OauthProvider != "": out.auth_scheme = model.AUTH_SCHEME_OAUTH - - try: zrok = root.Client() except Exception as e: