update the python sdk to support both reserved shares and unique names (#123)

This commit is contained in:
Michael Quigley 2023-12-08 13:02:54 -05:00
parent 5ef3924ac0
commit b6de71bb17
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 6 additions and 3 deletions

View File

@ -15,6 +15,8 @@ PUBLIC_SHARE_MODE: ShareMode = "public"
@dataclass
class ShareRequest:
Reserved: bool = false
UniqueName: str = ""
BackendMode: BackendMode
ShareMode: ShareMode
Target: str

View File

@ -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: