mirror of
https://github.com/openziti/zrok.git
synced 2025-01-24 23:09:32 +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
|
@dataclass
|
||||||
class ShareRequest:
|
class ShareRequest:
|
||||||
|
Reserved: bool = false
|
||||||
|
UniqueName: str = ""
|
||||||
BackendMode: BackendMode
|
BackendMode: BackendMode
|
||||||
ShareMode: ShareMode
|
ShareMode: ShareMode
|
||||||
Target: str
|
Target: str
|
||||||
|
@ -14,6 +14,9 @@ def CreateShare(root: Root, request: model.ShareRequest) -> model.Share:
|
|||||||
out = __newPublicShare(root, request)
|
out = __newPublicShare(root, request)
|
||||||
case _:
|
case _:
|
||||||
raise Exception("unknown share mode " + request.ShareMode)
|
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:
|
if len(request.BasicAuth) > 0:
|
||||||
out.auth_scheme = model.AUTH_SCHEME_BASIC
|
out.auth_scheme = model.AUTH_SCHEME_BASIC
|
||||||
@ -27,8 +30,6 @@ def CreateShare(root: Root, request: model.ShareRequest) -> model.Share:
|
|||||||
if request.OauthProvider != "":
|
if request.OauthProvider != "":
|
||||||
out.auth_scheme = model.AUTH_SCHEME_OAUTH
|
out.auth_scheme = model.AUTH_SCHEME_OAUTH
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
zrok = root.Client()
|
zrok = root.Client()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user