/agent/access handler (#967)

This commit is contained in:
Michael Quigley
2025-06-02 17:01:23 -04:00
parent 662c3a0134
commit 6cd7258fad
41 changed files with 3972 additions and 0 deletions

View File

@@ -45,11 +45,13 @@ docs/Principal.md
docs/RegenerateAccountToken200Response.md
docs/RegenerateAccountTokenRequest.md
docs/RegisterRequest.md
docs/RemoteAccessRequest.md
docs/RemoteShare200Response.md
docs/RemoteShareRequest.md
docs/RemoteStatus200Response.md
docs/RemoteStatus200ResponseAccessesInner.md
docs/RemoteStatus200ResponseSharesInner.md
docs/RemoteUnaccessRequest.md
docs/RemoteUnshareRequest.md
docs/RemoveOrganizationMemberRequest.md
docs/ResetPasswordRequest.md
@@ -114,11 +116,13 @@ 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_access_request.py
test/test_remote_share200_response.py
test/test_remote_share_request.py
test/test_remote_status200_response.py
test/test_remote_status200_response_accesses_inner.py
test/test_remote_status200_response_shares_inner.py
test/test_remote_unaccess_request.py
test/test_remote_unshare_request.py
test/test_remove_organization_member_request.py
test/test_reset_password_request.py
@@ -188,11 +192,13 @@ 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_access_request.py
zrok_api/models/remote_share200_response.py
zrok_api/models/remote_share_request.py
zrok_api/models/remote_status200_response.py
zrok_api/models/remote_status200_response_accesses_inner.py
zrok_api/models/remote_status200_response_shares_inner.py
zrok_api/models/remote_unaccess_request.py
zrok_api/models/remote_unshare_request.py
zrok_api/models/remove_organization_member_request.py
zrok_api/models/reset_password_request.py

View File

@@ -116,8 +116,10 @@ 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_access**](docs/AgentApi.md#remote_access) | **POST** /agent/access |
*AgentApi* | [**remote_share**](docs/AgentApi.md#remote_share) | **POST** /agent/share |
*AgentApi* | [**remote_status**](docs/AgentApi.md#remote_status) | **POST** /agent/status |
*AgentApi* | [**remote_unaccess**](docs/AgentApi.md#remote_unaccess) | **POST** /agent/unaccess |
*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 |
@@ -188,11 +190,13 @@ Class | Method | HTTP request | Description
- [RegenerateAccountToken200Response](docs/RegenerateAccountToken200Response.md)
- [RegenerateAccountTokenRequest](docs/RegenerateAccountTokenRequest.md)
- [RegisterRequest](docs/RegisterRequest.md)
- [RemoteAccessRequest](docs/RemoteAccessRequest.md)
- [RemoteShare200Response](docs/RemoteShare200Response.md)
- [RemoteShareRequest](docs/RemoteShareRequest.md)
- [RemoteStatus200Response](docs/RemoteStatus200Response.md)
- [RemoteStatus200ResponseAccessesInner](docs/RemoteStatus200ResponseAccessesInner.md)
- [RemoteStatus200ResponseSharesInner](docs/RemoteStatus200ResponseSharesInner.md)
- [RemoteUnaccessRequest](docs/RemoteUnaccessRequest.md)
- [RemoteUnshareRequest](docs/RemoteUnshareRequest.md)
- [RemoveOrganizationMemberRequest](docs/RemoveOrganizationMemberRequest.md)
- [ResetPasswordRequest](docs/ResetPasswordRequest.md)

View File

@@ -6,8 +6,10 @@ Method | HTTP request | Description
------------- | ------------- | -------------
[**enroll**](AgentApi.md#enroll) | **POST** /agent/enroll |
[**ping**](AgentApi.md#ping) | **POST** /agent/ping |
[**remote_access**](AgentApi.md#remote_access) | **POST** /agent/access |
[**remote_share**](AgentApi.md#remote_share) | **POST** /agent/share |
[**remote_status**](AgentApi.md#remote_status) | **POST** /agent/status |
[**remote_unaccess**](AgentApi.md#remote_unaccess) | **POST** /agent/unaccess |
[**remote_unshare**](AgentApi.md#remote_unshare) | **POST** /agent/unshare |
[**unenroll**](AgentApi.md#unenroll) | **POST** /agent/unenroll |
@@ -168,6 +170,84 @@ 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_access**
> CreateFrontend201Response remote_access(body=body)
### Example
* Api Key Authentication (key):
```python
import zrok_api
from zrok_api.models.create_frontend201_response import CreateFrontend201Response
from zrok_api.models.remote_access_request import RemoteAccessRequest
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.RemoteAccessRequest() # RemoteAccessRequest | (optional)
try:
api_response = api_instance.remote_access(body=body)
print("The response of AgentApi->remote_access:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling AgentApi->remote_access: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**RemoteAccessRequest**](RemoteAccessRequest.md)| | [optional]
### Return type
[**CreateFrontend201Response**](CreateFrontend201Response.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_share**
> RemoteShare200Response remote_share(body=body)
@@ -324,6 +404,81 @@ 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_unaccess**
> remote_unaccess(body=body)
### Example
* Api Key Authentication (key):
```python
import zrok_api
from zrok_api.models.remote_unaccess_request import RemoteUnaccessRequest
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.RemoteUnaccessRequest() # RemoteUnaccessRequest | (optional)
try:
api_instance.remote_unaccess(body=body)
except Exception as e:
print("Exception when calling AgentApi->remote_unaccess: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**RemoteUnaccessRequest**](RemoteUnaccessRequest.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)
# **remote_unshare**
> remote_unshare(body=body)

View File

@@ -0,0 +1,36 @@
# RemoteAccessRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**env_zid** | **str** | | [optional]
**token** | **str** | | [optional]
**bind_address** | **str** | | [optional]
**auto_mode** | **bool** | | [optional]
**auto_address** | **str** | | [optional]
**auto_start_port** | **int** | | [optional]
**auto_end_port** | **int** | | [optional]
**response_headers** | **List[str]** | | [optional]
## Example
```python
from zrok_api.models.remote_access_request import RemoteAccessRequest
# TODO update the JSON string below
json = "{}"
# create an instance of RemoteAccessRequest from a JSON string
remote_access_request_instance = RemoteAccessRequest.from_json(json)
# print the JSON string representation of the object
print(RemoteAccessRequest.to_json())
# convert the object into a dict
remote_access_request_dict = remote_access_request_instance.to_dict()
# create an instance of RemoteAccessRequest from a dict
remote_access_request_from_dict = RemoteAccessRequest.from_dict(remote_access_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

@@ -0,0 +1,30 @@
# RemoteUnaccessRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**env_zid** | **str** | | [optional]
**frontend_token** | **str** | | [optional]
## Example
```python
from zrok_api.models.remote_unaccess_request import RemoteUnaccessRequest
# TODO update the JSON string below
json = "{}"
# create an instance of RemoteUnaccessRequest from a JSON string
remote_unaccess_request_instance = RemoteUnaccessRequest.from_json(json)
# print the JSON string representation of the object
print(RemoteUnaccessRequest.to_json())
# convert the object into a dict
remote_unaccess_request_dict = remote_unaccess_request_instance.to_dict()
# create an instance of RemoteUnaccessRequest from a dict
remote_unaccess_request_from_dict = RemoteUnaccessRequest.from_dict(remote_unaccess_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,12 @@ class TestAgentApi(unittest.TestCase):
"""
pass
def test_remote_access(self) -> None:
"""Test case for remote_access
"""
pass
def test_remote_share(self) -> None:
"""Test case for remote_share
@@ -50,6 +56,12 @@ class TestAgentApi(unittest.TestCase):
"""
pass
def test_remote_unaccess(self) -> None:
"""Test case for remote_unaccess
"""
pass
def test_remote_unshare(self) -> None:
"""Test case for remote_unshare

View File

@@ -0,0 +1,60 @@
# 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_access_request import RemoteAccessRequest
class TestRemoteAccessRequest(unittest.TestCase):
"""RemoteAccessRequest unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> RemoteAccessRequest:
"""Test RemoteAccessRequest
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 `RemoteAccessRequest`
"""
model = RemoteAccessRequest()
if include_optional:
return RemoteAccessRequest(
env_zid = '',
token = '',
bind_address = '',
auto_mode = True,
auto_address = '',
auto_start_port = 56,
auto_end_port = 56,
response_headers = [
''
]
)
else:
return RemoteAccessRequest(
)
"""
def testRemoteAccessRequest(self):
"""Test RemoteAccessRequest"""
# 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,52 @@
# 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_unaccess_request import RemoteUnaccessRequest
class TestRemoteUnaccessRequest(unittest.TestCase):
"""RemoteUnaccessRequest unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> RemoteUnaccessRequest:
"""Test RemoteUnaccessRequest
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 `RemoteUnaccessRequest`
"""
model = RemoteUnaccessRequest()
if include_optional:
return RemoteUnaccessRequest(
env_zid = '',
frontend_token = ''
)
else:
return RemoteUnaccessRequest(
)
"""
def testRemoteUnaccessRequest(self):
"""Test RemoteUnaccessRequest"""
# 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,11 +76,13 @@ 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_access_request import RemoteAccessRequest
from zrok_api.models.remote_share200_response import RemoteShare200Response
from zrok_api.models.remote_share_request import RemoteShareRequest
from zrok_api.models.remote_status200_response import RemoteStatus200Response
from zrok_api.models.remote_status200_response_accesses_inner import RemoteStatus200ResponseAccessesInner
from zrok_api.models.remote_status200_response_shares_inner import RemoteStatus200ResponseSharesInner
from zrok_api.models.remote_unaccess_request import RemoteUnaccessRequest
from zrok_api.models.remote_unshare_request import RemoteUnshareRequest
from zrok_api.models.remove_organization_member_request import RemoveOrganizationMemberRequest
from zrok_api.models.reset_password_request import ResetPasswordRequest

View File

@@ -17,12 +17,15 @@ from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Optional
from zrok_api.models.create_frontend201_response import CreateFrontend201Response
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_access_request import RemoteAccessRequest
from zrok_api.models.remote_share200_response import RemoteShare200Response
from zrok_api.models.remote_share_request import RemoteShareRequest
from zrok_api.models.remote_status200_response import RemoteStatus200Response
from zrok_api.models.remote_unaccess_request import RemoteUnaccessRequest
from zrok_api.models.remote_unshare_request import RemoteUnshareRequest
from zrok_api.api_client import ApiClient, RequestSerialized
@@ -603,6 +606,286 @@ class AgentApi:
@validate_call
def remote_access(
self,
body: Optional[RemoteAccessRequest] = 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,
) -> CreateFrontend201Response:
"""remote_access
:param body:
:type body: RemoteAccessRequest
: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_access_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': "CreateFrontend201Response",
'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_access_with_http_info(
self,
body: Optional[RemoteAccessRequest] = 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[CreateFrontend201Response]:
"""remote_access
:param body:
:type body: RemoteAccessRequest
: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_access_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': "CreateFrontend201Response",
'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_access_without_preload_content(
self,
body: Optional[RemoteAccessRequest] = 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_access
:param body:
:type body: RemoteAccessRequest
: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_access_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': "CreateFrontend201Response",
'401': None,
'500': None,
'502': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _remote_access_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/access',
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_share(
self,
@@ -1163,6 +1446,279 @@ class AgentApi:
@validate_call
def remote_unaccess(
self,
body: Optional[RemoteUnaccessRequest] = 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_unaccess
:param body:
:type body: RemoteUnaccessRequest
: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_unaccess_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_unaccess_with_http_info(
self,
body: Optional[RemoteUnaccessRequest] = 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_unaccess
:param body:
:type body: RemoteUnaccessRequest
: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_unaccess_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_unaccess_without_preload_content(
self,
body: Optional[RemoteUnaccessRequest] = 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_unaccess
:param body:
:type body: RemoteUnaccessRequest
: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_unaccess_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_unaccess_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/unaccess',
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,

View File

@@ -54,11 +54,13 @@ 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_access_request import RemoteAccessRequest
from zrok_api.models.remote_share200_response import RemoteShare200Response
from zrok_api.models.remote_share_request import RemoteShareRequest
from zrok_api.models.remote_status200_response import RemoteStatus200Response
from zrok_api.models.remote_status200_response_accesses_inner import RemoteStatus200ResponseAccessesInner
from zrok_api.models.remote_status200_response_shares_inner import RemoteStatus200ResponseSharesInner
from zrok_api.models.remote_unaccess_request import RemoteUnaccessRequest
from zrok_api.models.remote_unshare_request import RemoteUnshareRequest
from zrok_api.models.remove_organization_member_request import RemoveOrganizationMemberRequest
from zrok_api.models.reset_password_request import ResetPasswordRequest

View File

@@ -0,0 +1,101 @@
# 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, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class RemoteAccessRequest(BaseModel):
"""
RemoteAccessRequest
""" # noqa: E501
env_zid: Optional[StrictStr] = Field(default=None, alias="envZId")
token: Optional[StrictStr] = None
bind_address: Optional[StrictStr] = Field(default=None, alias="bindAddress")
auto_mode: Optional[StrictBool] = Field(default=None, alias="autoMode")
auto_address: Optional[StrictStr] = Field(default=None, alias="autoAddress")
auto_start_port: Optional[StrictInt] = Field(default=None, alias="autoStartPort")
auto_end_port: Optional[StrictInt] = Field(default=None, alias="autoEndPort")
response_headers: Optional[List[StrictStr]] = Field(default=None, alias="responseHeaders")
__properties: ClassVar[List[str]] = ["envZId", "token", "bindAddress", "autoMode", "autoAddress", "autoStartPort", "autoEndPort", "responseHeaders"]
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 RemoteAccessRequest 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 RemoteAccessRequest from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"envZId": obj.get("envZId"),
"token": obj.get("token"),
"bindAddress": obj.get("bindAddress"),
"autoMode": obj.get("autoMode"),
"autoAddress": obj.get("autoAddress"),
"autoStartPort": obj.get("autoStartPort"),
"autoEndPort": obj.get("autoEndPort"),
"responseHeaders": obj.get("responseHeaders")
})
return _obj

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 RemoteUnaccessRequest(BaseModel):
"""
RemoteUnaccessRequest
""" # noqa: E501
env_zid: Optional[StrictStr] = Field(default=None, alias="envZId")
frontend_token: Optional[StrictStr] = Field(default=None, alias="frontendToken")
__properties: ClassVar[List[str]] = ["envZId", "frontendToken"]
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 RemoteUnaccessRequest 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 RemoteUnaccessRequest from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"envZId": obj.get("envZId"),
"frontendToken": obj.get("frontendToken")
})
return _obj