From 81daa4c249a70eaa4535b5dc138c578cbe8b9c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 10 Mar 2022 15:49:21 +0100 Subject: [PATCH] OAPI: regenerate Python code This commit also switches to a hardcoded version ("3.0") to the version from Git (like the Go executables use). Because there are no tags for this branch yet, this is just the Git commit hash. --- addon/flamenco/manager/__init__.py | 2 +- addon/flamenco/manager/api/meta_api.py | 152 ++++++++++ addon/flamenco/manager/api_client.py | 2 +- addon/flamenco/manager/apis/__init__.py | 1 + addon/flamenco/manager/configuration.py | 2 +- .../flamenco/manager/docs/FlamencoVersion.md | 13 + addon/flamenco/manager/docs/MetaApi.md | 70 +++++ addon/flamenco/manager/docs/TaskUpdate.md | 2 +- .../manager/model/flamenco_version.py | 267 ++++++++++++++++++ addon/flamenco/manager/model/task_update.py | 4 +- addon/flamenco/manager/models/__init__.py | 1 + addon/flamenco/manager_README.md | 4 +- 12 files changed, 513 insertions(+), 7 deletions(-) create mode 100644 addon/flamenco/manager/api/meta_api.py create mode 100644 addon/flamenco/manager/docs/FlamencoVersion.md create mode 100644 addon/flamenco/manager/docs/MetaApi.md create mode 100644 addon/flamenco/manager/model/flamenco_version.py diff --git a/addon/flamenco/manager/__init__.py b/addon/flamenco/manager/__init__.py index 3db6a87a..305d3dba 100644 --- a/addon/flamenco/manager/__init__.py +++ b/addon/flamenco/manager/__init__.py @@ -10,7 +10,7 @@ """ -__version__ = "3.0" +__version__ = "51b23a38" # import ApiClient from flamenco.manager.api_client import ApiClient diff --git a/addon/flamenco/manager/api/meta_api.py b/addon/flamenco/manager/api/meta_api.py new file mode 100644 index 00000000..a3ad502c --- /dev/null +++ b/addon/flamenco/manager/api/meta_api.py @@ -0,0 +1,152 @@ +""" + Flamenco manager + + Render Farm manager API # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from flamenco.manager.api_client import ApiClient, Endpoint as _Endpoint +from flamenco.manager.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from flamenco.manager.model.flamenco_version import FlamencoVersion + + +class MetaApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + self.get_version_endpoint = _Endpoint( + settings={ + 'response_type': (FlamencoVersion,), + 'auth': [], + 'endpoint_path': '/api/version', + 'operation_id': 'get_version', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + }, + 'attribute_map': { + }, + 'location_map': { + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client + ) + + def get_version( + self, + **kwargs + ): + """Get the Flamenco version of this Manager # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_version(async_req=True) + >>> result = thread.get() + + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): 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. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + FlamencoVersion + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_spec_property_naming'] = kwargs.get( + '_spec_property_naming', False + ) + kwargs['_content_type'] = kwargs.get( + '_content_type') + kwargs['_host_index'] = kwargs.get('_host_index') + return self.get_version_endpoint.call_with_http_info(**kwargs) + diff --git a/addon/flamenco/manager/api_client.py b/addon/flamenco/manager/api_client.py index 634dd2a3..8fd30248 100644 --- a/addon/flamenco/manager/api_client.py +++ b/addon/flamenco/manager/api_client.py @@ -76,7 +76,7 @@ class ApiClient(object): self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'Flamenco/3.0 (Blender add-on)' + self.user_agent = 'Flamenco/51b23a38 (Blender add-on)' def __enter__(self): return self diff --git a/addon/flamenco/manager/apis/__init__.py b/addon/flamenco/manager/apis/__init__.py index 47770fe6..f566d49c 100644 --- a/addon/flamenco/manager/apis/__init__.py +++ b/addon/flamenco/manager/apis/__init__.py @@ -15,4 +15,5 @@ # Import APIs into API package: from flamenco.manager.api.jobs_api import JobsApi +from flamenco.manager.api.meta_api import MetaApi from flamenco.manager.api.worker_api import WorkerApi diff --git a/addon/flamenco/manager/configuration.py b/addon/flamenco/manager/configuration.py index f315fa1f..1831960b 100644 --- a/addon/flamenco/manager/configuration.py +++ b/addon/flamenco/manager/configuration.py @@ -404,7 +404,7 @@ conf = flamenco.manager.Configuration( "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 1.0.0\n"\ - "SDK Package Version: 3.0".\ + "SDK Package Version: 51b23a38".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/addon/flamenco/manager/docs/FlamencoVersion.md b/addon/flamenco/manager/docs/FlamencoVersion.md new file mode 100644 index 00000000..449e2543 --- /dev/null +++ b/addon/flamenco/manager/docs/FlamencoVersion.md @@ -0,0 +1,13 @@ +# FlamencoVersion + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**version** | **str** | | +**name** | **str** | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/addon/flamenco/manager/docs/MetaApi.md b/addon/flamenco/manager/docs/MetaApi.md new file mode 100644 index 00000000..e07208a1 --- /dev/null +++ b/addon/flamenco/manager/docs/MetaApi.md @@ -0,0 +1,70 @@ +# flamenco.manager.MetaApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_version**](MetaApi.md#get_version) | **GET** /api/version | Get the Flamenco version of this Manager + + +# **get_version** +> FlamencoVersion get_version() + +Get the Flamenco version of this Manager + +### Example + + +```python +import time +import flamenco.manager +from flamenco.manager.api import meta_api +from flamenco.manager.model.flamenco_version import FlamencoVersion +from pprint import pprint +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = flamenco.manager.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +with flamenco.manager.ApiClient() as api_client: + # Create an instance of the API class + api_instance = meta_api.MetaApi(api_client) + + # example, this endpoint has no required or optional parameters + try: + # Get the Flamenco version of this Manager + api_response = api_instance.get_version() + pprint(api_response) + except flamenco.manager.ApiException as e: + print("Exception when calling MetaApi->get_version: %s\n" % e) +``` + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FlamencoVersion**](FlamencoVersion.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | normal response | - | + +[[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) + diff --git a/addon/flamenco/manager/docs/TaskUpdate.md b/addon/flamenco/manager/docs/TaskUpdate.md index 8f09de6a..361221c8 100644 --- a/addon/flamenco/manager/docs/TaskUpdate.md +++ b/addon/flamenco/manager/docs/TaskUpdate.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **task_status** | [**TaskStatus**](TaskStatus.md) | | [optional] **activity** | **str** | One-liner to indicate what's currently happening with the task. Overwrites previously sent activity strings. | [optional] -**log** | **str** | Log lines for this task | [optional] +**log** | **str** | Log lines for this task, will be appended to logs sent earlier. | [optional] **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/addon/flamenco/manager/model/flamenco_version.py b/addon/flamenco/manager/model/flamenco_version.py new file mode 100644 index 00000000..5325683d --- /dev/null +++ b/addon/flamenco/manager/model/flamenco_version.py @@ -0,0 +1,267 @@ +""" + Flamenco manager + + Render Farm manager API # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from flamenco.manager.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel +) +from flamenco.manager.exceptions import ApiAttributeError + + + +class FlamencoVersion(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'version': (str,), # noqa: E501 + 'name': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'version': 'version', # noqa: E501 + 'name': 'name', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, version, name, *args, **kwargs): # noqa: E501 + """FlamencoVersion - a model defined in OpenAPI + + Args: + version (str): + name (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.version = version + self.name = name + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, version, name, *args, **kwargs): # noqa: E501 + """FlamencoVersion - a model defined in OpenAPI + + Args: + version (str): + name (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.version = version + self.name = name + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/addon/flamenco/manager/model/task_update.py b/addon/flamenco/manager/model/task_update.py index d256b2a2..5ebe6ac6 100644 --- a/addon/flamenco/manager/model/task_update.py +++ b/addon/flamenco/manager/model/task_update.py @@ -146,7 +146,7 @@ class TaskUpdate(ModelNormal): _visited_composed_classes = (Animal,) task_status (TaskStatus): [optional] # noqa: E501 activity (str): One-liner to indicate what's currently happening with the task. Overwrites previously sent activity strings.. [optional] # noqa: E501 - log (str): Log lines for this task. [optional] # noqa: E501 + log (str): Log lines for this task, will be appended to logs sent earlier.. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -230,7 +230,7 @@ class TaskUpdate(ModelNormal): _visited_composed_classes = (Animal,) task_status (TaskStatus): [optional] # noqa: E501 activity (str): One-liner to indicate what's currently happening with the task. Overwrites previously sent activity strings.. [optional] # noqa: E501 - log (str): Log lines for this task. [optional] # noqa: E501 + log (str): Log lines for this task, will be appended to logs sent earlier.. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/addon/flamenco/manager/models/__init__.py b/addon/flamenco/manager/models/__init__.py index a6c37767..951a6201 100644 --- a/addon/flamenco/manager/models/__init__.py +++ b/addon/flamenco/manager/models/__init__.py @@ -19,6 +19,7 @@ from flamenco.manager.model.command import Command from flamenco.manager.model.configuration import Configuration from flamenco.manager.model.configuration_meta import ConfigurationMeta from flamenco.manager.model.error import Error +from flamenco.manager.model.flamenco_version import FlamencoVersion from flamenco.manager.model.job import Job from flamenco.manager.model.job_all_of import JobAllOf from flamenco.manager.model.job_metadata import JobMetadata diff --git a/addon/flamenco/manager_README.md b/addon/flamenco/manager_README.md index 8b1ee6ae..4b79d1f9 100644 --- a/addon/flamenco/manager_README.md +++ b/addon/flamenco/manager_README.md @@ -4,7 +4,7 @@ Render Farm manager API The `flamenco.manager` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 1.0.0 -- Package version: 3.0 +- Package version: 51b23a38 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://flamenco.io/](https://flamenco.io/) @@ -67,6 +67,7 @@ Class | Method | HTTP request | Description *JobsApi* | [**fetch_job**](flamenco/manager/docs/JobsApi.md#fetch_job) | **GET** /api/jobs/{job_id} | Fetch info about the job. *JobsApi* | [**get_job_types**](flamenco/manager/docs/JobsApi.md#get_job_types) | **GET** /api/jobs/types | Get list of job types and their parameters. *JobsApi* | [**submit_job**](flamenco/manager/docs/JobsApi.md#submit_job) | **POST** /api/jobs | Submit a new job for Flamenco Manager to execute. +*MetaApi* | [**get_version**](flamenco/manager/docs/MetaApi.md#get_version) | **GET** /api/version | Get the Flamenco version of this Manager *WorkerApi* | [**register_worker**](flamenco/manager/docs/WorkerApi.md#register_worker) | **POST** /api/worker/register-worker | Register a new worker *WorkerApi* | [**schedule_task**](flamenco/manager/docs/WorkerApi.md#schedule_task) | **POST** /api/worker/task | Obtain a new task to execute *WorkerApi* | [**sign_off**](flamenco/manager/docs/WorkerApi.md#sign_off) | **POST** /api/worker/sign-off | Mark the worker as offline @@ -88,6 +89,7 @@ Class | Method | HTTP request | Description - [Configuration](flamenco/manager/docs/Configuration.md) - [ConfigurationMeta](flamenco/manager/docs/ConfigurationMeta.md) - [Error](flamenco/manager/docs/Error.md) + - [FlamencoVersion](flamenco/manager/docs/FlamencoVersion.md) - [Job](flamenco/manager/docs/Job.md) - [JobAllOf](flamenco/manager/docs/JobAllOf.md) - [JobMetadata](flamenco/manager/docs/JobMetadata.md)