/agent/enroll, /agent/unenroll api (#967)

This commit is contained in:
Michael Quigley
2025-05-30 13:35:08 -04:00
parent f4057655be
commit 8a4e535dfb
39 changed files with 3389 additions and 84 deletions

View File

@@ -18,6 +18,8 @@ docs/CreateOrganization201Response.md
docs/CreateOrganizationRequest.md
docs/DisableRequest.md
docs/EnableRequest.md
docs/Enroll200Response.md
docs/EnrollRequest.md
docs/Environment.md
docs/EnvironmentAndResources.md
docs/EnvironmentApi.md
@@ -39,7 +41,6 @@ docs/Metrics.md
docs/MetricsSample.md
docs/Overview.md
docs/Ping200Response.md
docs/PingRequest.md
docs/Principal.md
docs/RegenerateAccountToken200Response.md
docs/RegenerateAccountTokenRequest.md
@@ -80,6 +81,8 @@ test/test_create_organization201_response.py
test/test_create_organization_request.py
test/test_disable_request.py
test/test_enable_request.py
test/test_enroll200_response.py
test/test_enroll_request.py
test/test_environment.py
test/test_environment_and_resources.py
test/test_environment_api.py
@@ -101,7 +104,6 @@ test/test_metrics.py
test/test_metrics_sample.py
test/test_overview.py
test/test_ping200_response.py
test/test_ping_request.py
test/test_principal.py
test/test_regenerate_account_token200_response.py
test/test_regenerate_account_token_request.py
@@ -149,6 +151,8 @@ zrok_api/models/create_organization201_response.py
zrok_api/models/create_organization_request.py
zrok_api/models/disable_request.py
zrok_api/models/enable_request.py
zrok_api/models/enroll200_response.py
zrok_api/models/enroll_request.py
zrok_api/models/environment.py
zrok_api/models/environment_and_resources.py
zrok_api/models/frontend.py
@@ -168,7 +172,6 @@ zrok_api/models/metrics.py
zrok_api/models/metrics_sample.py
zrok_api/models/overview.py
zrok_api/models/ping200_response.py
zrok_api/models/ping_request.py
zrok_api/models/principal.py
zrok_api/models/regenerate_account_token200_response.py
zrok_api/models/regenerate_account_token_request.py

View File

@@ -114,7 +114,9 @@ Class | Method | HTTP request | Description
*AdminApi* | [**list_organizations**](docs/AdminApi.md#list_organizations) | **GET** /organizations |
*AdminApi* | [**remove_organization_member**](docs/AdminApi.md#remove_organization_member) | **POST** /organization/remove |
*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* | [**unenroll**](docs/AgentApi.md#unenroll) | **POST** /agent/unenroll |
*EnvironmentApi* | [**disable**](docs/EnvironmentApi.md#disable) | **POST** /disable |
*EnvironmentApi* | [**enable**](docs/EnvironmentApi.md#enable) | **POST** /enable |
*MetadataApi* | [**client_version_check**](docs/MetadataApi.md#client_version_check) | **POST** /clientVersionCheck |
@@ -158,6 +160,8 @@ Class | Method | HTTP request | Description
- [CreateOrganizationRequest](docs/CreateOrganizationRequest.md)
- [DisableRequest](docs/DisableRequest.md)
- [EnableRequest](docs/EnableRequest.md)
- [Enroll200Response](docs/Enroll200Response.md)
- [EnrollRequest](docs/EnrollRequest.md)
- [Environment](docs/Environment.md)
- [EnvironmentAndResources](docs/EnvironmentAndResources.md)
- [Frontend](docs/Frontend.md)
@@ -177,7 +181,6 @@ Class | Method | HTTP request | Description
- [MetricsSample](docs/MetricsSample.md)
- [Overview](docs/Overview.md)
- [Ping200Response](docs/Ping200Response.md)
- [PingRequest](docs/PingRequest.md)
- [Principal](docs/Principal.md)
- [RegenerateAccountToken200Response](docs/RegenerateAccountToken200Response.md)
- [RegenerateAccountTokenRequest](docs/RegenerateAccountTokenRequest.md)

View File

@@ -4,11 +4,13 @@ All URIs are relative to */api/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**enroll**](AgentApi.md#enroll) | **POST** /agent/enroll |
[**ping**](AgentApi.md#ping) | **POST** /agent/ping |
[**unenroll**](AgentApi.md#unenroll) | **POST** /agent/unenroll |
# **ping**
> Ping200Response ping(body=body)
# **enroll**
> Enroll200Response enroll(body=body)
### Example
@@ -16,8 +18,8 @@ Method | HTTP request | Description
```python
import zrok_api
from zrok_api.models.ping200_response import Ping200Response
from zrok_api.models.ping_request import PingRequest
from zrok_api.models.enroll200_response import Enroll200Response
from zrok_api.models.enroll_request import EnrollRequest
from zrok_api.rest import ApiException
from pprint import pprint
@@ -42,7 +44,85 @@ configuration.api_key['key'] = os.environ["API_KEY"]
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.PingRequest() # PingRequest | (optional)
body = zrok_api.EnrollRequest() # EnrollRequest | (optional)
try:
api_response = api_instance.enroll(body=body)
print("The response of AgentApi->enroll:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling AgentApi->enroll: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**EnrollRequest**](EnrollRequest.md)| | [optional]
### Return type
[**Enroll200Response**](Enroll200Response.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 | - |
**400** | bad request; already enrolled | - |
**401** | unauthorized | - |
**500** | internal server error | - |
[[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)
# **ping**
> Ping200Response ping(body=body)
### Example
* Api Key Authentication (key):
```python
import zrok_api
from zrok_api.models.enroll_request import EnrollRequest
from zrok_api.models.ping200_response import Ping200Response
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.EnrollRequest() # EnrollRequest | (optional)
try:
api_response = api_instance.ping(body=body)
@@ -59,7 +139,7 @@ with zrok_api.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**PingRequest**](PingRequest.md)| | [optional]
**body** | [**EnrollRequest**](EnrollRequest.md)| | [optional]
### Return type
@@ -85,3 +165,78 @@ 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)
# **unenroll**
> unenroll(body=body)
### Example
* Api Key Authentication (key):
```python
import zrok_api
from zrok_api.models.enroll_request import EnrollRequest
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.EnrollRequest() # EnrollRequest | (optional)
try:
api_instance.unenroll(body=body)
except Exception as e:
print("Exception when calling AgentApi->unenroll: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**EnrollRequest**](EnrollRequest.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 | - |
**400** | bad request; not enrolled | - |
**401** | unauthorized | - |
**500** | internal server error | - |
[[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,29 @@
# Enroll200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**token** | **str** | | [optional]
## Example
```python
from zrok_api.models.enroll200_response import Enroll200Response
# TODO update the JSON string below
json = "{}"
# create an instance of Enroll200Response from a JSON string
enroll200_response_instance = Enroll200Response.from_json(json)
# print the JSON string representation of the object
print(Enroll200Response.to_json())
# convert the object into a dict
enroll200_response_dict = enroll200_response_instance.to_dict()
# create an instance of Enroll200Response from a dict
enroll200_response_from_dict = Enroll200Response.from_dict(enroll200_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

@@ -1,4 +1,4 @@
# PingRequest
# EnrollRequest
## Properties
@@ -10,19 +10,19 @@ Name | Type | Description | Notes
## Example
```python
from zrok_api.models.ping_request import PingRequest
from zrok_api.models.enroll_request import EnrollRequest
# TODO update the JSON string below
json = "{}"
# create an instance of PingRequest from a JSON string
ping_request_instance = PingRequest.from_json(json)
# create an instance of EnrollRequest from a JSON string
enroll_request_instance = EnrollRequest.from_json(json)
# print the JSON string representation of the object
print(PingRequest.to_json())
print(EnrollRequest.to_json())
# convert the object into a dict
ping_request_dict = ping_request_instance.to_dict()
# create an instance of PingRequest from a dict
ping_request_from_dict = PingRequest.from_dict(ping_request_dict)
enroll_request_dict = enroll_request_instance.to_dict()
# create an instance of EnrollRequest from a dict
enroll_request_from_dict = EnrollRequest.from_dict(enroll_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

@@ -26,12 +26,24 @@ class TestAgentApi(unittest.TestCase):
def tearDown(self) -> None:
pass
def test_enroll(self) -> None:
"""Test case for enroll
"""
pass
def test_ping(self) -> None:
"""Test case for ping
"""
pass
def test_unenroll(self) -> None:
"""Test case for unenroll
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,51 @@
# 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.enroll200_response import Enroll200Response
class TestEnroll200Response(unittest.TestCase):
"""Enroll200Response unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> Enroll200Response:
"""Test Enroll200Response
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 `Enroll200Response`
"""
model = Enroll200Response()
if include_optional:
return Enroll200Response(
token = ''
)
else:
return Enroll200Response(
)
"""
def testEnroll200Response(self):
"""Test Enroll200Response"""
# 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

@@ -14,10 +14,10 @@
import unittest
from zrok_api.models.ping_request import PingRequest
from zrok_api.models.enroll_request import EnrollRequest
class TestPingRequest(unittest.TestCase):
"""PingRequest unit test stubs"""
class TestEnrollRequest(unittest.TestCase):
"""EnrollRequest unit test stubs"""
def setUp(self):
pass
@@ -25,25 +25,25 @@ class TestPingRequest(unittest.TestCase):
def tearDown(self):
pass
def make_instance(self, include_optional) -> PingRequest:
"""Test PingRequest
def make_instance(self, include_optional) -> EnrollRequest:
"""Test EnrollRequest
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 `PingRequest`
# uncomment below to create an instance of `EnrollRequest`
"""
model = PingRequest()
model = EnrollRequest()
if include_optional:
return PingRequest(
return EnrollRequest(
env_zid = ''
)
else:
return PingRequest(
return EnrollRequest(
)
"""
def testPingRequest(self):
"""Test PingRequest"""
def testEnrollRequest(self):
"""Test EnrollRequest"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)

View File

@@ -51,6 +51,8 @@ from zrok_api.models.create_organization201_response import CreateOrganization20
from zrok_api.models.create_organization_request import CreateOrganizationRequest
from zrok_api.models.disable_request import DisableRequest
from zrok_api.models.enable_request import EnableRequest
from zrok_api.models.enroll200_response import Enroll200Response
from zrok_api.models.enroll_request import EnrollRequest
from zrok_api.models.environment import Environment
from zrok_api.models.environment_and_resources import EnvironmentAndResources
from zrok_api.models.frontend import Frontend
@@ -70,7 +72,6 @@ from zrok_api.models.metrics import Metrics
from zrok_api.models.metrics_sample import MetricsSample
from zrok_api.models.overview import Overview
from zrok_api.models.ping200_response import Ping200Response
from zrok_api.models.ping_request import PingRequest
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

View File

@@ -17,8 +17,9 @@ from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
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.ping_request import PingRequest
from zrok_api.api_client import ApiClient, RequestSerialized
from zrok_api.api_response import ApiResponse
@@ -38,10 +39,290 @@ class AgentApi:
self.api_client = api_client
@validate_call
def enroll(
self,
body: Optional[EnrollRequest] = 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,
) -> Enroll200Response:
"""enroll
:param body:
:type body: EnrollRequest
: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._enroll_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': "Enroll200Response",
'400': None,
'401': None,
'500': 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 enroll_with_http_info(
self,
body: Optional[EnrollRequest] = 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[Enroll200Response]:
"""enroll
:param body:
:type body: EnrollRequest
: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._enroll_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': "Enroll200Response",
'400': None,
'401': None,
'500': 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 enroll_without_preload_content(
self,
body: Optional[EnrollRequest] = 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:
"""enroll
:param body:
:type body: EnrollRequest
: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._enroll_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': "Enroll200Response",
'400': None,
'401': None,
'500': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _enroll_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/enroll',
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 ping(
self,
body: Optional[PingRequest] = None,
body: Optional[EnrollRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@@ -59,7 +340,7 @@ class AgentApi:
:param body:
:type body: PingRequest
:type body: EnrollRequest
: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
@@ -110,7 +391,7 @@ class AgentApi:
@validate_call
def ping_with_http_info(
self,
body: Optional[PingRequest] = None,
body: Optional[EnrollRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@@ -128,7 +409,7 @@ class AgentApi:
:param body:
:type body: PingRequest
:type body: EnrollRequest
: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
@@ -179,7 +460,7 @@ class AgentApi:
@validate_call
def ping_without_preload_content(
self,
body: Optional[PingRequest] = None,
body: Optional[EnrollRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@@ -197,7 +478,7 @@ class AgentApi:
:param body:
:type body: PingRequest
:type body: EnrollRequest
: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
@@ -316,3 +597,276 @@ class AgentApi:
)
@validate_call
def unenroll(
self,
body: Optional[EnrollRequest] = 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:
"""unenroll
:param body:
:type body: EnrollRequest
: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._unenroll_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,
'400': None,
'401': None,
'500': 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 unenroll_with_http_info(
self,
body: Optional[EnrollRequest] = 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]:
"""unenroll
:param body:
:type body: EnrollRequest
: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._unenroll_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,
'400': None,
'401': None,
'500': 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 unenroll_without_preload_content(
self,
body: Optional[EnrollRequest] = 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:
"""unenroll
:param body:
:type body: EnrollRequest
: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._unenroll_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,
'400': None,
'401': None,
'500': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _unenroll_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/unenroll',
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
)

View File

@@ -29,6 +29,8 @@ from zrok_api.models.create_organization201_response import CreateOrganization20
from zrok_api.models.create_organization_request import CreateOrganizationRequest
from zrok_api.models.disable_request import DisableRequest
from zrok_api.models.enable_request import EnableRequest
from zrok_api.models.enroll200_response import Enroll200Response
from zrok_api.models.enroll_request import EnrollRequest
from zrok_api.models.environment import Environment
from zrok_api.models.environment_and_resources import EnvironmentAndResources
from zrok_api.models.frontend import Frontend
@@ -48,7 +50,6 @@ from zrok_api.models.metrics import Metrics
from zrok_api.models.metrics_sample import MetricsSample
from zrok_api.models.overview import Overview
from zrok_api.models.ping200_response import Ping200Response
from zrok_api.models.ping_request import PingRequest
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

View File

@@ -0,0 +1,87 @@
# 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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class Enroll200Response(BaseModel):
"""
Enroll200Response
""" # noqa: E501
token: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["token"]
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 Enroll200Response 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 Enroll200Response 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")
})
return _obj

View File

@@ -22,9 +22,9 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class PingRequest(BaseModel):
class EnrollRequest(BaseModel):
"""
PingRequest
EnrollRequest
""" # noqa: E501
env_zid: Optional[StrictStr] = Field(default=None, alias="envZId")
__properties: ClassVar[List[str]] = ["envZId"]
@@ -47,7 +47,7 @@ class PingRequest(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of PingRequest from a JSON string"""
"""Create an instance of EnrollRequest from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
@@ -72,7 +72,7 @@ class PingRequest(BaseModel):
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of PingRequest from a dict"""
"""Create an instance of EnrollRequest from a dict"""
if obj is None:
return None