mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01:00
update the python sdk to support both reserved shares and unique names (#123)
This commit is contained in:
parent
5ef3924ac0
commit
b6de71bb17
@ -15,6 +15,8 @@ PUBLIC_SHARE_MODE: ShareMode = "public"
|
||||
|
||||
@dataclass
|
||||
class ShareRequest:
|
||||
Reserved: bool = false
|
||||
UniqueName: str = ""
|
||||
BackendMode: BackendMode
|
||||
ShareMode: ShareMode
|
||||
Target: str
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user