agent remote share, remote unshare api stubs (#967)

This commit is contained in:
Michael Quigley
2025-06-02 15:05:35 -04:00
parent e11beb8f6f
commit 5529e77967
42 changed files with 4292 additions and 5 deletions

View File

@@ -45,6 +45,8 @@ docs/Principal.md
docs/RegenerateAccountToken200Response.md
docs/RegenerateAccountTokenRequest.md
docs/RegisterRequest.md
docs/RemoteShare200Response.md
docs/RemoteShareRequest.md
docs/RemoveOrganizationMemberRequest.md
docs/ResetPasswordRequest.md
docs/Share.md
@@ -108,6 +110,8 @@ test/test_principal.py
test/test_regenerate_account_token200_response.py
test/test_regenerate_account_token_request.py
test/test_register_request.py
test/test_remote_share200_response.py
test/test_remote_share_request.py
test/test_remove_organization_member_request.py
test/test_reset_password_request.py
test/test_share.py
@@ -176,6 +180,8 @@ zrok_api/models/principal.py
zrok_api/models/regenerate_account_token200_response.py
zrok_api/models/regenerate_account_token_request.py
zrok_api/models/register_request.py
zrok_api/models/remote_share200_response.py
zrok_api/models/remote_share_request.py
zrok_api/models/remove_organization_member_request.py
zrok_api/models/reset_password_request.py
zrok_api/models/share.py

View File

@@ -116,6 +116,8 @@ Class | Method | HTTP request | Description
*AdminApi* | [**update_frontend**](docs/AdminApi.md#update_frontend) | **PATCH** /frontend |
*AgentApi* | [**enroll**](docs/AgentApi.md#enroll) | **POST** /agent/enroll |
*AgentApi* | [**ping**](docs/AgentApi.md#ping) | **POST** /agent/ping |
*AgentApi* | [**remote_share**](docs/AgentApi.md#remote_share) | **POST** /agent/share |
*AgentApi* | [**remote_unshare**](docs/AgentApi.md#remote_unshare) | **POST** /agent/unshare |
*AgentApi* | [**unenroll**](docs/AgentApi.md#unenroll) | **POST** /agent/unenroll |
*EnvironmentApi* | [**disable**](docs/EnvironmentApi.md#disable) | **POST** /disable |
*EnvironmentApi* | [**enable**](docs/EnvironmentApi.md#enable) | **POST** /enable |
@@ -185,6 +187,8 @@ Class | Method | HTTP request | Description
- [RegenerateAccountToken200Response](docs/RegenerateAccountToken200Response.md)
- [RegenerateAccountTokenRequest](docs/RegenerateAccountTokenRequest.md)
- [RegisterRequest](docs/RegisterRequest.md)
- [RemoteShare200Response](docs/RemoteShare200Response.md)
- [RemoteShareRequest](docs/RemoteShareRequest.md)
- [RemoveOrganizationMemberRequest](docs/RemoveOrganizationMemberRequest.md)
- [ResetPasswordRequest](docs/ResetPasswordRequest.md)
- [Share](docs/Share.md)

View File

@@ -6,6 +6,8 @@ Method | HTTP request | Description
------------- | ------------- | -------------
[**enroll**](AgentApi.md#enroll) | **POST** /agent/enroll |
[**ping**](AgentApi.md#ping) | **POST** /agent/ping |
[**remote_share**](AgentApi.md#remote_share) | **POST** /agent/share |
[**remote_unshare**](AgentApi.md#remote_unshare) | **POST** /agent/unshare |
[**unenroll**](AgentApi.md#unenroll) | **POST** /agent/unenroll |
@@ -165,6 +167,159 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **remote_share**
> RemoteShare200Response remote_share(body=body)
### Example
* Api Key Authentication (key):
```python
import zrok_api
from zrok_api.models.remote_share200_response import RemoteShare200Response
from zrok_api.models.remote_share_request import RemoteShareRequest
from zrok_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to /api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = zrok_api.Configuration(
host = "/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: key
configuration.api_key['key'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['key'] = 'Bearer'
# Enter a context with an instance of the API client
with zrok_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = zrok_api.AgentApi(api_client)
body = zrok_api.RemoteShareRequest() # RemoteShareRequest | (optional)
try:
api_response = api_instance.remote_share(body=body)
print("The response of AgentApi->remote_share:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling AgentApi->remote_share: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**RemoteShareRequest**](RemoteShareRequest.md)| | [optional]
### Return type
[**RemoteShare200Response**](RemoteShare200Response.md)
### Authorization
[key](../README.md#key)
### HTTP request headers
- **Content-Type**: application/zrok.v1+json
- **Accept**: application/zrok.v1+json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | ok | - |
**401** | unauthorized | - |
**500** | internal server error | - |
**502** | bad gateway; agent not reachable | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **remote_unshare**
> remote_unshare(body=body)
### Example
* Api Key Authentication (key):
```python
import zrok_api
from zrok_api.models.enroll200_response import Enroll200Response
from zrok_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to /api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = zrok_api.Configuration(
host = "/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: key
configuration.api_key['key'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['key'] = 'Bearer'
# Enter a context with an instance of the API client
with zrok_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = zrok_api.AgentApi(api_client)
body = zrok_api.Enroll200Response() # Enroll200Response | (optional)
try:
api_instance.remote_unshare(body=body)
except Exception as e:
print("Exception when calling AgentApi->remote_unshare: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Enroll200Response**](Enroll200Response.md)| | [optional]
### Return type
void (empty response body)
### Authorization
[key](../README.md#key)
### HTTP request headers
- **Content-Type**: application/zrok.v1+json
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | ok | - |
**401** | unauthorized | - |
**500** | internal server error | - |
**502** | bad gateway; agent not reachable | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **unenroll**
> unenroll(body=body)
@@ -236,7 +391,7 @@ void (empty response body)
**200** | ok | - |
**400** | bad request; not enrolled | - |
**401** | unauthorized | - |
**500** | internal server error | - |
**500** | internal server er | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,30 @@
# RemoteShare200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**token** | **str** | | [optional]
**frontend_endpoints** | **List[str]** | | [optional]
## Example
```python
from zrok_api.models.remote_share200_response import RemoteShare200Response
# TODO update the JSON string below
json = "{}"
# create an instance of RemoteShare200Response from a JSON string
remote_share200_response_instance = RemoteShare200Response.from_json(json)
# print the JSON string representation of the object
print(RemoteShare200Response.to_json())
# convert the object into a dict
remote_share200_response_dict = remote_share200_response_instance.to_dict()
# create an instance of RemoteShare200Response from a dict
remote_share200_response_from_dict = RemoteShare200Response.from_dict(remote_share200_response_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,40 @@
# RemoteShareRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**share_mode** | **str** | | [optional]
**token** | **str** | | [optional]
**target** | **str** | | [optional]
**basic_auth** | **List[str]** | | [optional]
**frontend_selection** | **List[str]** | | [optional]
**backend_mode** | **str** | | [optional]
**insecure** | **bool** | | [optional]
**oauth_provider** | **str** | | [optional]
**oauth_email_address_patterns** | **List[str]** | | [optional]
**oauth_check_interval** | **str** | | [optional]
**open** | **bool** | | [optional]
**access_grants** | **List[str]** | | [optional]
## Example
```python
from zrok_api.models.remote_share_request import RemoteShareRequest
# TODO update the JSON string below
json = "{}"
# create an instance of RemoteShareRequest from a JSON string
remote_share_request_instance = RemoteShareRequest.from_json(json)
# print the JSON string representation of the object
print(RemoteShareRequest.to_json())
# convert the object into a dict
remote_share_request_dict = remote_share_request_instance.to_dict()
# create an instance of RemoteShareRequest from a dict
remote_share_request_from_dict = RemoteShareRequest.from_dict(remote_share_request_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -38,6 +38,18 @@ class TestAgentApi(unittest.TestCase):
"""
pass
def test_remote_share(self) -> None:
"""Test case for remote_share
"""
pass
def test_remote_unshare(self) -> None:
"""Test case for remote_unshare
"""
pass
def test_unenroll(self) -> None:
"""Test case for unenroll

View File

@@ -0,0 +1,54 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from zrok_api.models.remote_share200_response import RemoteShare200Response
class TestRemoteShare200Response(unittest.TestCase):
"""RemoteShare200Response unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> RemoteShare200Response:
"""Test RemoteShare200Response
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `RemoteShare200Response`
"""
model = RemoteShare200Response()
if include_optional:
return RemoteShare200Response(
token = '',
frontend_endpoints = [
''
]
)
else:
return RemoteShare200Response(
)
"""
def testRemoteShare200Response(self):
"""Test RemoteShare200Response"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,70 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from zrok_api.models.remote_share_request import RemoteShareRequest
class TestRemoteShareRequest(unittest.TestCase):
"""RemoteShareRequest unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> RemoteShareRequest:
"""Test RemoteShareRequest
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `RemoteShareRequest`
"""
model = RemoteShareRequest()
if include_optional:
return RemoteShareRequest(
share_mode = '',
token = '',
target = '',
basic_auth = [
''
],
frontend_selection = [
''
],
backend_mode = 'proxy',
insecure = True,
oauth_provider = '',
oauth_email_address_patterns = [
''
],
oauth_check_interval = '',
open = True,
access_grants = [
''
]
)
else:
return RemoteShareRequest(
)
"""
def testRemoteShareRequest(self):
"""Test RemoteShareRequest"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -76,6 +76,8 @@ from zrok_api.models.principal import Principal
from zrok_api.models.regenerate_account_token200_response import RegenerateAccountToken200Response
from zrok_api.models.regenerate_account_token_request import RegenerateAccountTokenRequest
from zrok_api.models.register_request import RegisterRequest
from zrok_api.models.remote_share200_response import RemoteShare200Response
from zrok_api.models.remote_share_request import RemoteShareRequest
from zrok_api.models.remove_organization_member_request import RemoveOrganizationMemberRequest
from zrok_api.models.reset_password_request import ResetPasswordRequest
from zrok_api.models.share import Share

View File

@@ -20,6 +20,8 @@ from typing import Optional
from zrok_api.models.enroll200_response import Enroll200Response
from zrok_api.models.enroll_request import EnrollRequest
from zrok_api.models.ping200_response import Ping200Response
from zrok_api.models.remote_share200_response import RemoteShare200Response
from zrok_api.models.remote_share_request import RemoteShareRequest
from zrok_api.api_client import ApiClient, RequestSerialized
from zrok_api.api_response import ApiResponse
@@ -599,6 +601,559 @@ class AgentApi:
@validate_call
def remote_share(
self,
body: Optional[RemoteShareRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RemoteShare200Response:
"""remote_share
:param body:
:type body: RemoteShareRequest
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._remote_share_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "RemoteShare200Response",
'401': None,
'500': None,
'502': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def remote_share_with_http_info(
self,
body: Optional[RemoteShareRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[RemoteShare200Response]:
"""remote_share
:param body:
:type body: RemoteShareRequest
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._remote_share_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "RemoteShare200Response",
'401': None,
'500': None,
'502': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def remote_share_without_preload_content(
self,
body: Optional[RemoteShareRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""remote_share
:param body:
:type body: RemoteShareRequest
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._remote_share_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "RemoteShare200Response",
'401': None,
'500': None,
'502': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _remote_share_serialize(
self,
body,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
if body is not None:
_body_params = body
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/zrok.v1+json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/zrok.v1+json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'key'
]
return self.api_client.param_serialize(
method='POST',
resource_path='/agent/share',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def remote_unshare(
self,
body: Optional[Enroll200Response] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""remote_unshare
:param body:
:type body: Enroll200Response
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._remote_unshare_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'401': None,
'500': None,
'502': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def remote_unshare_with_http_info(
self,
body: Optional[Enroll200Response] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""remote_unshare
:param body:
:type body: Enroll200Response
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._remote_unshare_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'401': None,
'500': None,
'502': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def remote_unshare_without_preload_content(
self,
body: Optional[Enroll200Response] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""remote_unshare
:param body:
:type body: Enroll200Response
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._remote_unshare_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'401': None,
'500': None,
'502': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _remote_unshare_serialize(
self,
body,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
if body is not None:
_body_params = body
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/zrok.v1+json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'key'
]
return self.api_client.param_serialize(
method='POST',
resource_path='/agent/unshare',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def unenroll(
self,

View File

@@ -54,6 +54,8 @@ from zrok_api.models.principal import Principal
from zrok_api.models.regenerate_account_token200_response import RegenerateAccountToken200Response
from zrok_api.models.regenerate_account_token_request import RegenerateAccountTokenRequest
from zrok_api.models.register_request import RegisterRequest
from zrok_api.models.remote_share200_response import RemoteShare200Response
from zrok_api.models.remote_share_request import RemoteShareRequest
from zrok_api.models.remove_organization_member_request import RemoveOrganizationMemberRequest
from zrok_api.models.reset_password_request import ResetPasswordRequest
from zrok_api.models.share import Share

View File

@@ -0,0 +1,89 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class RemoteShare200Response(BaseModel):
"""
RemoteShare200Response
""" # noqa: E501
token: Optional[StrictStr] = None
frontend_endpoints: Optional[List[StrictStr]] = Field(default=None, alias="frontendEndpoints")
__properties: ClassVar[List[str]] = ["token", "frontendEndpoints"]
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of RemoteShare200Response from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of RemoteShare200Response from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"token": obj.get("token"),
"frontendEndpoints": obj.get("frontendEndpoints")
})
return _obj

View File

@@ -0,0 +1,119 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class RemoteShareRequest(BaseModel):
"""
RemoteShareRequest
""" # noqa: E501
share_mode: Optional[StrictStr] = Field(default=None, alias="shareMode")
token: Optional[StrictStr] = None
target: Optional[StrictStr] = None
basic_auth: Optional[List[StrictStr]] = Field(default=None, alias="basicAuth")
frontend_selection: Optional[List[StrictStr]] = Field(default=None, alias="frontendSelection")
backend_mode: Optional[StrictStr] = Field(default=None, alias="backendMode")
insecure: Optional[StrictBool] = None
oauth_provider: Optional[StrictStr] = Field(default=None, alias="oauthProvider")
oauth_email_address_patterns: Optional[List[StrictStr]] = Field(default=None, alias="oauthEmailAddressPatterns")
oauth_check_interval: Optional[StrictStr] = Field(default=None, alias="oauthCheckInterval")
open: Optional[StrictBool] = None
access_grants: Optional[List[StrictStr]] = Field(default=None, alias="accessGrants")
__properties: ClassVar[List[str]] = ["shareMode", "token", "target", "basicAuth", "frontendSelection", "backendMode", "insecure", "oauthProvider", "oauthEmailAddressPatterns", "oauthCheckInterval", "open", "accessGrants"]
@field_validator('backend_mode')
def backend_mode_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value
if value not in set(['proxy', 'web', 'tcpTunnel', 'udpTunnel', 'caddy', 'drive', 'socks', 'vpn']):
raise ValueError("must be one of enum values ('proxy', 'web', 'tcpTunnel', 'udpTunnel', 'caddy', 'drive', 'socks', 'vpn')")
return value
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of RemoteShareRequest from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of RemoteShareRequest from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"shareMode": obj.get("shareMode"),
"token": obj.get("token"),
"target": obj.get("target"),
"basicAuth": obj.get("basicAuth"),
"frontendSelection": obj.get("frontendSelection"),
"backendMode": obj.get("backendMode"),
"insecure": obj.get("insecure"),
"oauthProvider": obj.get("oauthProvider"),
"oauthEmailAddressPatterns": obj.get("oauthEmailAddressPatterns"),
"oauthCheckInterval": obj.get("oauthCheckInterval"),
"open": obj.get("open"),
"accessGrants": obj.get("accessGrants")
})
return _obj