From 878b2195a6e24f6572982eb5817e86d6924e875d Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Thu, 14 Oct 2021 12:53:34 +0200 Subject: [PATCH 1/8] feat: add how to use Cloud Functions --- examples/README.md | 1 + examples/managed_functions.py | 60 +++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 examples/managed_functions.py diff --git a/examples/README.md b/examples/README.md index 08620e4b..67899530 100644 --- a/examples/README.md +++ b/examples/README.md @@ -24,4 +24,5 @@ - [influx_cloud.py](influx_cloud.py) - How to connect to InfluxDB 2 Cloud - [influxdb_18_example.py](influxdb_18_example.py) - How to connect to InfluxDB 1.8 - [nanosecond_precision.py](nanosecond_precision.py) - How to use nanoseconds precision +- [managed_functions.py](managed_functions.py) - How to use Cloud Managed Functions \ No newline at end of file diff --git a/examples/managed_functions.py b/examples/managed_functions.py new file mode 100644 index 00000000..fc589d5f --- /dev/null +++ b/examples/managed_functions.py @@ -0,0 +1,60 @@ +""" +How to use Cloud Managed Functions +""" +import datetime + +from influxdb_client import InfluxDBClient, FunctionCreateRequest, FunctionLanguage, FunctionInvocationParams +from influxdb_client.service import FunctionsService + +""" +Define credentials +""" +influx_cloud_url = 'https://us-west-2-1.aws.cloud2.influxdata.com' +influx_cloud_token = '...' +bucket_name = '...' +org_name = '...' + +with InfluxDBClient(url=influx_cloud_url, token=influx_cloud_token, org=org_name, debug=True, timeout=20_000) as client: + uniqueId = str(datetime.datetime.now()) + """ + Find Organization ID by Organization API. + """ + org = client.organizations_api().find_organizations(org=org_name)[0] + + functions_service = FunctionsService(api_client=client.api_client) + + """ + Create Managed function + """ + print(f"------- Create -------\n") + create_request = FunctionCreateRequest(name=f"my_func_{uniqueId}", + description="my first try", + language=FunctionLanguage.FLUX, + org_id=org.id, + script=f"from(bucket: \"bucket-for-testing-2\") |> range(start: -7d) |> limit(n:2)") + + created_function = functions_service.post_functions(function_create_request=create_request) + print(created_function) + + """ + Invoke Function + """ + print(f"\n------- Invoke Function: -------\n") + response = functions_service.post_functions_id_invoke(function_id=created_function.id, + function_invocation_params=FunctionInvocationParams( + params={"bucket_name": bucket_name})) + + """ + List all Functions + """ + print(f"\n------- Functions: -------\n") + functions = functions_service.get_functions(org=org).functions + print("\n".join([f" ---\n ID: {it.id}\n Name: {it.name}\n Description: {it.description}" for it in functions])) + print("---") + + """ + Delete previously created Function + """ + print(f"------- Delete -------\n") + functions_service.delete_functions_id(created_function.id) + print(f" successfully deleted function: {created_function.name}") From 872b393cd06e77a59289bf135fc1f26ecc29a644 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Thu, 14 Oct 2021 13:02:05 +0200 Subject: [PATCH 2/8] feat: add managed functions API --- examples/managed_functions.py | 2 +- influxdb_client/__init__.py | 16 + influxdb_client/client/__init__.py | 1 + influxdb_client/client/write/__init__.py | 1 + influxdb_client/domain/__init__.py | 15 + influxdb_client/domain/function.py | 304 +++++ .../domain/function_create_request.py | 209 ++++ .../domain/function_http_response.py | 112 ++ .../domain/function_http_response_data.py | 84 ++ .../domain/function_http_response_no_data.py | 178 +++ .../domain/function_invocation_params.py | 109 ++ influxdb_client/domain/function_language.py | 90 ++ influxdb_client/domain/function_run.py | 112 ++ influxdb_client/domain/function_run_base.py | 224 ++++ influxdb_client/domain/function_run_log.py | 155 +++ influxdb_client/domain/function_runs.py | 109 ++ .../domain/function_trigger_request.py | 211 ++++ .../domain/function_trigger_response.py | 112 ++ .../domain/function_update_request.py | 159 +++ influxdb_client/domain/functions.py | 109 ++ influxdb_client/service/__init__.py | 1 + influxdb_client/service/functions_service.py | 1093 +++++++++++++++++ tests/__init__.py | 1 + 23 files changed, 3406 insertions(+), 1 deletion(-) create mode 100644 influxdb_client/domain/function.py create mode 100644 influxdb_client/domain/function_create_request.py create mode 100644 influxdb_client/domain/function_http_response.py create mode 100644 influxdb_client/domain/function_http_response_data.py create mode 100644 influxdb_client/domain/function_http_response_no_data.py create mode 100644 influxdb_client/domain/function_invocation_params.py create mode 100644 influxdb_client/domain/function_language.py create mode 100644 influxdb_client/domain/function_run.py create mode 100644 influxdb_client/domain/function_run_base.py create mode 100644 influxdb_client/domain/function_run_log.py create mode 100644 influxdb_client/domain/function_runs.py create mode 100644 influxdb_client/domain/function_trigger_request.py create mode 100644 influxdb_client/domain/function_trigger_response.py create mode 100644 influxdb_client/domain/function_update_request.py create mode 100644 influxdb_client/domain/functions.py create mode 100644 influxdb_client/service/functions_service.py diff --git a/examples/managed_functions.py b/examples/managed_functions.py index fc589d5f..1d601a17 100644 --- a/examples/managed_functions.py +++ b/examples/managed_functions.py @@ -31,7 +31,7 @@ description="my first try", language=FunctionLanguage.FLUX, org_id=org.id, - script=f"from(bucket: \"bucket-for-testing-2\") |> range(start: -7d) |> limit(n:2)") + script=f"from(bucket: \"{bucket_name}\") |> range(start: -7d) |> limit(n:2)") created_function = functions_service.post_functions(function_create_request=create_request) print(created_function) diff --git a/influxdb_client/__init__.py b/influxdb_client/__init__.py index 896d780a..7bbe8f68 100644 --- a/influxdb_client/__init__.py +++ b/influxdb_client/__init__.py @@ -43,6 +43,7 @@ from influxdb_client.service.views_service import ViewsService from influxdb_client.service.write_service import WriteService from influxdb_client.service.default_service import DefaultService +from influxdb_client.service.functions_service import FunctionsService # import ApiClient from influxdb_client.api_client import ApiClient @@ -286,6 +287,21 @@ from influxdb_client.domain.write_precision import WritePrecision from influxdb_client.domain.xy_geom import XYGeom from influxdb_client.domain.xy_view_properties import XYViewProperties +from influxdb_client.domain.function import Function +from influxdb_client.domain.function_create_request import FunctionCreateRequest +from influxdb_client.domain.function_http_response import FunctionHTTPResponse +from influxdb_client.domain.function_http_response_data import FunctionHTTPResponseData +from influxdb_client.domain.function_http_response_no_data import FunctionHTTPResponseNoData +from influxdb_client.domain.function_invocation_params import FunctionInvocationParams +from influxdb_client.domain.function_language import FunctionLanguage +from influxdb_client.domain.function_run import FunctionRun +from influxdb_client.domain.function_run_base import FunctionRunBase +from influxdb_client.domain.function_run_log import FunctionRunLog +from influxdb_client.domain.function_runs import FunctionRuns +from influxdb_client.domain.function_trigger_request import FunctionTriggerRequest +from influxdb_client.domain.function_trigger_response import FunctionTriggerResponse +from influxdb_client.domain.function_update_request import FunctionUpdateRequest +from influxdb_client.domain.functions import Functions from influxdb_client.client.authorizations_api import AuthorizationsApi from influxdb_client.client.bucket_api import BucketsApi diff --git a/influxdb_client/client/__init__.py b/influxdb_client/client/__init__.py index 97568e15..866760b1 100644 --- a/influxdb_client/client/__init__.py +++ b/influxdb_client/client/__init__.py @@ -41,3 +41,4 @@ from influxdb_client.service.views_service import ViewsService from influxdb_client.service.write_service import WriteService from influxdb_client.service.default_service import DefaultService +from influxdb_client.service.functions_service import FunctionsService diff --git a/influxdb_client/client/write/__init__.py b/influxdb_client/client/write/__init__.py index 97568e15..866760b1 100644 --- a/influxdb_client/client/write/__init__.py +++ b/influxdb_client/client/write/__init__.py @@ -41,3 +41,4 @@ from influxdb_client.service.views_service import ViewsService from influxdb_client.service.write_service import WriteService from influxdb_client.service.default_service import DefaultService +from influxdb_client.service.functions_service import FunctionsService diff --git a/influxdb_client/domain/__init__.py b/influxdb_client/domain/__init__.py index d1f3b363..08b0124d 100644 --- a/influxdb_client/domain/__init__.py +++ b/influxdb_client/domain/__init__.py @@ -252,3 +252,18 @@ from influxdb_client.domain.write_precision import WritePrecision from influxdb_client.domain.xy_geom import XYGeom from influxdb_client.domain.xy_view_properties import XYViewProperties +from influxdb_client.domain.function import Function +from influxdb_client.domain.function_create_request import FunctionCreateRequest +from influxdb_client.domain.function_http_response import FunctionHTTPResponse +from influxdb_client.domain.function_http_response_data import FunctionHTTPResponseData +from influxdb_client.domain.function_http_response_no_data import FunctionHTTPResponseNoData +from influxdb_client.domain.function_invocation_params import FunctionInvocationParams +from influxdb_client.domain.function_language import FunctionLanguage +from influxdb_client.domain.function_run import FunctionRun +from influxdb_client.domain.function_run_base import FunctionRunBase +from influxdb_client.domain.function_run_log import FunctionRunLog +from influxdb_client.domain.function_runs import FunctionRuns +from influxdb_client.domain.function_trigger_request import FunctionTriggerRequest +from influxdb_client.domain.function_trigger_response import FunctionTriggerResponse +from influxdb_client.domain.function_update_request import FunctionUpdateRequest +from influxdb_client.domain.functions import Functions diff --git a/influxdb_client/domain/function.py b/influxdb_client/domain/function.py new file mode 100644 index 00000000..d22936a5 --- /dev/null +++ b/influxdb_client/domain/function.py @@ -0,0 +1,304 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class Function(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'id': 'str', + 'name': 'str', + 'description': 'str', + 'org_id': 'str', + 'script': 'str', + 'language': 'FunctionLanguage', + 'url': 'str', + 'created_at': 'datetime', + 'updated_at': 'datetime' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'description': 'description', + 'org_id': 'orgID', + 'script': 'script', + 'language': 'language', + 'url': 'url', + 'created_at': 'createdAt', + 'updated_at': 'updatedAt' + } + + def __init__(self, id=None, name=None, description=None, org_id=None, script=None, language=None, url=None, created_at=None, updated_at=None): # noqa: E501,D401,D403 + """Function - a model defined in OpenAPI.""" # noqa: E501 + self._id = None + self._name = None + self._description = None + self._org_id = None + self._script = None + self._language = None + self._url = None + self._created_at = None + self._updated_at = None + self.discriminator = None + + if id is not None: + self.id = id + self.name = name + if description is not None: + self.description = description + self.org_id = org_id + self.script = script + if language is not None: + self.language = language + if url is not None: + self.url = url + if created_at is not None: + self.created_at = created_at + if updated_at is not None: + self.updated_at = updated_at + + @property + def id(self): + """Get the id of this Function. + + :return: The id of this Function. + :rtype: str + """ # noqa: E501 + return self._id + + @id.setter + def id(self, id): + """Set the id of this Function. + + :param id: The id of this Function. + :type: str + """ # noqa: E501 + self._id = id + + @property + def name(self): + """Get the name of this Function. + + :return: The name of this Function. + :rtype: str + """ # noqa: E501 + return self._name + + @name.setter + def name(self, name): + """Set the name of this Function. + + :param name: The name of this Function. + :type: str + """ # noqa: E501 + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + self._name = name + + @property + def description(self): + """Get the description of this Function. + + :return: The description of this Function. + :rtype: str + """ # noqa: E501 + return self._description + + @description.setter + def description(self, description): + """Set the description of this Function. + + :param description: The description of this Function. + :type: str + """ # noqa: E501 + self._description = description + + @property + def org_id(self): + """Get the org_id of this Function. + + :return: The org_id of this Function. + :rtype: str + """ # noqa: E501 + return self._org_id + + @org_id.setter + def org_id(self, org_id): + """Set the org_id of this Function. + + :param org_id: The org_id of this Function. + :type: str + """ # noqa: E501 + if org_id is None: + raise ValueError("Invalid value for `org_id`, must not be `None`") # noqa: E501 + self._org_id = org_id + + @property + def script(self): + """Get the script of this Function. + + script is script to be executed + + :return: The script of this Function. + :rtype: str + """ # noqa: E501 + return self._script + + @script.setter + def script(self, script): + """Set the script of this Function. + + script is script to be executed + + :param script: The script of this Function. + :type: str + """ # noqa: E501 + if script is None: + raise ValueError("Invalid value for `script`, must not be `None`") # noqa: E501 + self._script = script + + @property + def language(self): + """Get the language of this Function. + + :return: The language of this Function. + :rtype: FunctionLanguage + """ # noqa: E501 + return self._language + + @language.setter + def language(self, language): + """Set the language of this Function. + + :param language: The language of this Function. + :type: FunctionLanguage + """ # noqa: E501 + self._language = language + + @property + def url(self): + """Get the url of this Function. + + invocation endpoint address + + :return: The url of this Function. + :rtype: str + """ # noqa: E501 + return self._url + + @url.setter + def url(self, url): + """Set the url of this Function. + + invocation endpoint address + + :param url: The url of this Function. + :type: str + """ # noqa: E501 + self._url = url + + @property + def created_at(self): + """Get the created_at of this Function. + + :return: The created_at of this Function. + :rtype: datetime + """ # noqa: E501 + return self._created_at + + @created_at.setter + def created_at(self, created_at): + """Set the created_at of this Function. + + :param created_at: The created_at of this Function. + :type: datetime + """ # noqa: E501 + self._created_at = created_at + + @property + def updated_at(self): + """Get the updated_at of this Function. + + :return: The updated_at of this Function. + :rtype: datetime + """ # noqa: E501 + return self._updated_at + + @updated_at.setter + def updated_at(self, updated_at): + """Set the updated_at of this Function. + + :param updated_at: The updated_at of this Function. + :type: datetime + """ # noqa: E501 + self._updated_at = updated_at + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, Function): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_create_request.py b/influxdb_client/domain/function_create_request.py new file mode 100644 index 00000000..a97fa74d --- /dev/null +++ b/influxdb_client/domain/function_create_request.py @@ -0,0 +1,209 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FunctionCreateRequest(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'name': 'str', + 'description': 'str', + 'org_id': 'str', + 'script': 'str', + 'language': 'FunctionLanguage' + } + + attribute_map = { + 'name': 'name', + 'description': 'description', + 'org_id': 'orgID', + 'script': 'script', + 'language': 'language' + } + + def __init__(self, name=None, description=None, org_id=None, script=None, language=None): # noqa: E501,D401,D403 + """FunctionCreateRequest - a model defined in OpenAPI.""" # noqa: E501 + self._name = None + self._description = None + self._org_id = None + self._script = None + self._language = None + self.discriminator = None + + self.name = name + if description is not None: + self.description = description + self.org_id = org_id + self.script = script + self.language = language + + @property + def name(self): + """Get the name of this FunctionCreateRequest. + + :return: The name of this FunctionCreateRequest. + :rtype: str + """ # noqa: E501 + return self._name + + @name.setter + def name(self, name): + """Set the name of this FunctionCreateRequest. + + :param name: The name of this FunctionCreateRequest. + :type: str + """ # noqa: E501 + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + self._name = name + + @property + def description(self): + """Get the description of this FunctionCreateRequest. + + :return: The description of this FunctionCreateRequest. + :rtype: str + """ # noqa: E501 + return self._description + + @description.setter + def description(self, description): + """Set the description of this FunctionCreateRequest. + + :param description: The description of this FunctionCreateRequest. + :type: str + """ # noqa: E501 + self._description = description + + @property + def org_id(self): + """Get the org_id of this FunctionCreateRequest. + + :return: The org_id of this FunctionCreateRequest. + :rtype: str + """ # noqa: E501 + return self._org_id + + @org_id.setter + def org_id(self, org_id): + """Set the org_id of this FunctionCreateRequest. + + :param org_id: The org_id of this FunctionCreateRequest. + :type: str + """ # noqa: E501 + if org_id is None: + raise ValueError("Invalid value for `org_id`, must not be `None`") # noqa: E501 + self._org_id = org_id + + @property + def script(self): + """Get the script of this FunctionCreateRequest. + + script is script to be executed + + :return: The script of this FunctionCreateRequest. + :rtype: str + """ # noqa: E501 + return self._script + + @script.setter + def script(self, script): + """Set the script of this FunctionCreateRequest. + + script is script to be executed + + :param script: The script of this FunctionCreateRequest. + :type: str + """ # noqa: E501 + if script is None: + raise ValueError("Invalid value for `script`, must not be `None`") # noqa: E501 + self._script = script + + @property + def language(self): + """Get the language of this FunctionCreateRequest. + + :return: The language of this FunctionCreateRequest. + :rtype: FunctionLanguage + """ # noqa: E501 + return self._language + + @language.setter + def language(self, language): + """Set the language of this FunctionCreateRequest. + + :param language: The language of this FunctionCreateRequest. + :type: FunctionLanguage + """ # noqa: E501 + if language is None: + raise ValueError("Invalid value for `language`, must not be `None`") # noqa: E501 + self._language = language + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_http_response.py b/influxdb_client/domain/function_http_response.py new file mode 100644 index 00000000..af3d2135 --- /dev/null +++ b/influxdb_client/domain/function_http_response.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six +from influxdb_client.domain.function_http_response_no_data import FunctionHTTPResponseNoData + + +class FunctionHTTPResponse(FunctionHTTPResponseNoData): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'data': 'FunctionHTTPResponseData' + } + + attribute_map = { + 'data': 'data' + } + + def __init__(self, data=None): # noqa: E501,D401,D403 + """FunctionHTTPResponse - a model defined in OpenAPI.""" # noqa: E501 + FunctionHTTPResponseNoData.__init__(self) # noqa: E501 + + self._data = None + self.discriminator = None + + if data is not None: + self.data = data + + @property + def data(self): + """Get the data of this FunctionHTTPResponse. + + :return: The data of this FunctionHTTPResponse. + :rtype: FunctionHTTPResponseData + """ # noqa: E501 + return self._data + + @data.setter + def data(self, data): + """Set the data of this FunctionHTTPResponse. + + :param data: The data of this FunctionHTTPResponse. + :type: FunctionHTTPResponseData + """ # noqa: E501 + self._data = data + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionHTTPResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_http_response_data.py b/influxdb_client/domain/function_http_response_data.py new file mode 100644 index 00000000..972c7a6c --- /dev/null +++ b/influxdb_client/domain/function_http_response_data.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FunctionHTTPResponseData(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501,D401,D403 + """FunctionHTTPResponseData - a model defined in OpenAPI.""" # noqa: E501 self.discriminator = None + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionHTTPResponseData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_http_response_no_data.py b/influxdb_client/domain/function_http_response_no_data.py new file mode 100644 index 00000000..528c4661 --- /dev/null +++ b/influxdb_client/domain/function_http_response_no_data.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FunctionHTTPResponseNoData(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'type': 'str', + 'data_type': 'str', + 'headers': 'object', + 'status_code': 'str' + } + + attribute_map = { + 'type': 'type', + 'data_type': 'dataType', + 'headers': 'headers', + 'status_code': 'statusCode' + } + + def __init__(self, type=None, data_type=None, headers=None, status_code=None): # noqa: E501,D401,D403 + """FunctionHTTPResponseNoData - a model defined in OpenAPI.""" # noqa: E501 + self._type = None + self._data_type = None + self._headers = None + self._status_code = None + self.discriminator = None + + if type is not None: + self.type = type + if data_type is not None: + self.data_type = data_type + if headers is not None: + self.headers = headers + if status_code is not None: + self.status_code = status_code + + @property + def type(self): + """Get the type of this FunctionHTTPResponseNoData. + + :return: The type of this FunctionHTTPResponseNoData. + :rtype: str + """ # noqa: E501 + return self._type + + @type.setter + def type(self, type): + """Set the type of this FunctionHTTPResponseNoData. + + :param type: The type of this FunctionHTTPResponseNoData. + :type: str + """ # noqa: E501 + self._type = type + + @property + def data_type(self): + """Get the data_type of this FunctionHTTPResponseNoData. + + :return: The data_type of this FunctionHTTPResponseNoData. + :rtype: str + """ # noqa: E501 + return self._data_type + + @data_type.setter + def data_type(self, data_type): + """Set the data_type of this FunctionHTTPResponseNoData. + + :param data_type: The data_type of this FunctionHTTPResponseNoData. + :type: str + """ # noqa: E501 + self._data_type = data_type + + @property + def headers(self): + """Get the headers of this FunctionHTTPResponseNoData. + + :return: The headers of this FunctionHTTPResponseNoData. + :rtype: object + """ # noqa: E501 + return self._headers + + @headers.setter + def headers(self, headers): + """Set the headers of this FunctionHTTPResponseNoData. + + :param headers: The headers of this FunctionHTTPResponseNoData. + :type: object + """ # noqa: E501 + self._headers = headers + + @property + def status_code(self): + """Get the status_code of this FunctionHTTPResponseNoData. + + :return: The status_code of this FunctionHTTPResponseNoData. + :rtype: str + """ # noqa: E501 + return self._status_code + + @status_code.setter + def status_code(self, status_code): + """Set the status_code of this FunctionHTTPResponseNoData. + + :param status_code: The status_code of this FunctionHTTPResponseNoData. + :type: str + """ # noqa: E501 + self._status_code = status_code + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionHTTPResponseNoData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_invocation_params.py b/influxdb_client/domain/function_invocation_params.py new file mode 100644 index 00000000..eb0ac113 --- /dev/null +++ b/influxdb_client/domain/function_invocation_params.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FunctionInvocationParams(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'params': 'object' + } + + attribute_map = { + 'params': 'params' + } + + def __init__(self, params=None): # noqa: E501,D401,D403 + """FunctionInvocationParams - a model defined in OpenAPI.""" # noqa: E501 + self._params = None + self.discriminator = None + + if params is not None: + self.params = params + + @property + def params(self): + """Get the params of this FunctionInvocationParams. + + :return: The params of this FunctionInvocationParams. + :rtype: object + """ # noqa: E501 + return self._params + + @params.setter + def params(self, params): + """Set the params of this FunctionInvocationParams. + + :param params: The params of this FunctionInvocationParams. + :type: object + """ # noqa: E501 + self._params = params + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionInvocationParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_language.py b/influxdb_client/domain/function_language.py new file mode 100644 index 00000000..fed8df1d --- /dev/null +++ b/influxdb_client/domain/function_language.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FunctionLanguage(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + allowed enum values + """ + PYTHON = "python" + FLUX = "flux" + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501,D401,D403 + """FunctionLanguage - a model defined in OpenAPI.""" # noqa: E501 self.discriminator = None + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionLanguage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_run.py b/influxdb_client/domain/function_run.py new file mode 100644 index 00000000..51eb7500 --- /dev/null +++ b/influxdb_client/domain/function_run.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six +from influxdb_client.domain.function_run_base import FunctionRunBase + + +class FunctionRun(FunctionRunBase): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'response': 'FunctionHTTPResponseNoData' + } + + attribute_map = { + 'response': 'response' + } + + def __init__(self, response=None): # noqa: E501,D401,D403 + """FunctionRun - a model defined in OpenAPI.""" # noqa: E501 + FunctionRunBase.__init__(self) # noqa: E501 + + self._response = None + self.discriminator = None + + if response is not None: + self.response = response + + @property + def response(self): + """Get the response of this FunctionRun. + + :return: The response of this FunctionRun. + :rtype: FunctionHTTPResponseNoData + """ # noqa: E501 + return self._response + + @response.setter + def response(self, response): + """Set the response of this FunctionRun. + + :param response: The response of this FunctionRun. + :type: FunctionHTTPResponseNoData + """ # noqa: E501 + self._response = response + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionRun): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_run_base.py b/influxdb_client/domain/function_run_base.py new file mode 100644 index 00000000..4ba29e91 --- /dev/null +++ b/influxdb_client/domain/function_run_base.py @@ -0,0 +1,224 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FunctionRunBase(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'id': 'str', + 'status': 'str', + 'error': 'str', + 'logs': 'list[FunctionRunLog]', + 'response': 'FunctionHTTPResponseNoData', + 'started_at': 'datetime' + } + + attribute_map = { + 'id': 'id', + 'status': 'status', + 'error': 'error', + 'logs': 'logs', + 'response': 'response', + 'started_at': 'startedAt' + } + + def __init__(self, id=None, status=None, error=None, logs=None, response=None, started_at=None): # noqa: E501,D401,D403 + """FunctionRunBase - a model defined in OpenAPI.""" # noqa: E501 + self._id = None + self._status = None + self._error = None + self._logs = None + self._response = None + self._started_at = None + self.discriminator = None + + if id is not None: + self.id = id + if status is not None: + self.status = status + if error is not None: + self.error = error + if logs is not None: + self.logs = logs + if response is not None: + self.response = response + if started_at is not None: + self.started_at = started_at + + @property + def id(self): + """Get the id of this FunctionRunBase. + + :return: The id of this FunctionRunBase. + :rtype: str + """ # noqa: E501 + return self._id + + @id.setter + def id(self, id): + """Set the id of this FunctionRunBase. + + :param id: The id of this FunctionRunBase. + :type: str + """ # noqa: E501 + self._id = id + + @property + def status(self): + """Get the status of this FunctionRunBase. + + :return: The status of this FunctionRunBase. + :rtype: str + """ # noqa: E501 + return self._status + + @status.setter + def status(self, status): + """Set the status of this FunctionRunBase. + + :param status: The status of this FunctionRunBase. + :type: str + """ # noqa: E501 + self._status = status + + @property + def error(self): + """Get the error of this FunctionRunBase. + + :return: The error of this FunctionRunBase. + :rtype: str + """ # noqa: E501 + return self._error + + @error.setter + def error(self, error): + """Set the error of this FunctionRunBase. + + :param error: The error of this FunctionRunBase. + :type: str + """ # noqa: E501 + self._error = error + + @property + def logs(self): + """Get the logs of this FunctionRunBase. + + :return: The logs of this FunctionRunBase. + :rtype: list[FunctionRunLog] + """ # noqa: E501 + return self._logs + + @logs.setter + def logs(self, logs): + """Set the logs of this FunctionRunBase. + + :param logs: The logs of this FunctionRunBase. + :type: list[FunctionRunLog] + """ # noqa: E501 + self._logs = logs + + @property + def response(self): + """Get the response of this FunctionRunBase. + + :return: The response of this FunctionRunBase. + :rtype: FunctionHTTPResponseNoData + """ # noqa: E501 + return self._response + + @response.setter + def response(self, response): + """Set the response of this FunctionRunBase. + + :param response: The response of this FunctionRunBase. + :type: FunctionHTTPResponseNoData + """ # noqa: E501 + self._response = response + + @property + def started_at(self): + """Get the started_at of this FunctionRunBase. + + :return: The started_at of this FunctionRunBase. + :rtype: datetime + """ # noqa: E501 + return self._started_at + + @started_at.setter + def started_at(self, started_at): + """Set the started_at of this FunctionRunBase. + + :param started_at: The started_at of this FunctionRunBase. + :type: datetime + """ # noqa: E501 + self._started_at = started_at + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionRunBase): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_run_log.py b/influxdb_client/domain/function_run_log.py new file mode 100644 index 00000000..4a1562c1 --- /dev/null +++ b/influxdb_client/domain/function_run_log.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FunctionRunLog(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'message': 'str', + 'timestamp': 'datetime', + 'severity': 'object' + } + + attribute_map = { + 'message': 'message', + 'timestamp': 'timestamp', + 'severity': 'severity' + } + + def __init__(self, message=None, timestamp=None, severity=None): # noqa: E501,D401,D403 + """FunctionRunLog - a model defined in OpenAPI.""" # noqa: E501 + self._message = None + self._timestamp = None + self._severity = None + self.discriminator = None + + if message is not None: + self.message = message + if timestamp is not None: + self.timestamp = timestamp + if severity is not None: + self.severity = severity + + @property + def message(self): + """Get the message of this FunctionRunLog. + + :return: The message of this FunctionRunLog. + :rtype: str + """ # noqa: E501 + return self._message + + @message.setter + def message(self, message): + """Set the message of this FunctionRunLog. + + :param message: The message of this FunctionRunLog. + :type: str + """ # noqa: E501 + self._message = message + + @property + def timestamp(self): + """Get the timestamp of this FunctionRunLog. + + :return: The timestamp of this FunctionRunLog. + :rtype: datetime + """ # noqa: E501 + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Set the timestamp of this FunctionRunLog. + + :param timestamp: The timestamp of this FunctionRunLog. + :type: datetime + """ # noqa: E501 + self._timestamp = timestamp + + @property + def severity(self): + """Get the severity of this FunctionRunLog. + + :return: The severity of this FunctionRunLog. + :rtype: object + """ # noqa: E501 + return self._severity + + @severity.setter + def severity(self, severity): + """Set the severity of this FunctionRunLog. + + :param severity: The severity of this FunctionRunLog. + :type: object + """ # noqa: E501 + self._severity = severity + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionRunLog): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_runs.py b/influxdb_client/domain/function_runs.py new file mode 100644 index 00000000..9af5cf35 --- /dev/null +++ b/influxdb_client/domain/function_runs.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FunctionRuns(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'runs': 'list[FunctionRun]' + } + + attribute_map = { + 'runs': 'runs' + } + + def __init__(self, runs=None): # noqa: E501,D401,D403 + """FunctionRuns - a model defined in OpenAPI.""" # noqa: E501 + self._runs = None + self.discriminator = None + + if runs is not None: + self.runs = runs + + @property + def runs(self): + """Get the runs of this FunctionRuns. + + :return: The runs of this FunctionRuns. + :rtype: list[FunctionRun] + """ # noqa: E501 + return self._runs + + @runs.setter + def runs(self, runs): + """Set the runs of this FunctionRuns. + + :param runs: The runs of this FunctionRuns. + :type: list[FunctionRun] + """ # noqa: E501 + self._runs = runs + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionRuns): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_trigger_request.py b/influxdb_client/domain/function_trigger_request.py new file mode 100644 index 00000000..233ea7d0 --- /dev/null +++ b/influxdb_client/domain/function_trigger_request.py @@ -0,0 +1,211 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six +from influxdb_client.domain.function_invocation_params import FunctionInvocationParams + + +class FunctionTriggerRequest(FunctionInvocationParams): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'script': 'str', + 'method': 'str', + 'org_id': 'str', + 'org': 'str', + 'language': 'FunctionLanguage' + } + + attribute_map = { + 'script': 'script', + 'method': 'method', + 'org_id': 'orgID', + 'org': 'org', + 'language': 'language' + } + + def __init__(self, script=None, method=None, org_id=None, org=None, language=None): # noqa: E501,D401,D403 + """FunctionTriggerRequest - a model defined in OpenAPI.""" # noqa: E501 + FunctionInvocationParams.__init__(self) # noqa: E501 + + self._script = None + self._method = None + self._org_id = None + self._org = None + self._language = None + self.discriminator = None + + self.script = script + self.method = method + if org_id is not None: + self.org_id = org_id + if org is not None: + self.org = org + self.language = language + + @property + def script(self): + """Get the script of this FunctionTriggerRequest. + + script is script to be executed + + :return: The script of this FunctionTriggerRequest. + :rtype: str + """ # noqa: E501 + return self._script + + @script.setter + def script(self, script): + """Set the script of this FunctionTriggerRequest. + + script is script to be executed + + :param script: The script of this FunctionTriggerRequest. + :type: str + """ # noqa: E501 + if script is None: + raise ValueError("Invalid value for `script`, must not be `None`") # noqa: E501 + self._script = script + + @property + def method(self): + """Get the method of this FunctionTriggerRequest. + + :return: The method of this FunctionTriggerRequest. + :rtype: str + """ # noqa: E501 + return self._method + + @method.setter + def method(self, method): + """Set the method of this FunctionTriggerRequest. + + :param method: The method of this FunctionTriggerRequest. + :type: str + """ # noqa: E501 + if method is None: + raise ValueError("Invalid value for `method`, must not be `None`") # noqa: E501 + self._method = method + + @property + def org_id(self): + """Get the org_id of this FunctionTriggerRequest. + + :return: The org_id of this FunctionTriggerRequest. + :rtype: str + """ # noqa: E501 + return self._org_id + + @org_id.setter + def org_id(self, org_id): + """Set the org_id of this FunctionTriggerRequest. + + :param org_id: The org_id of this FunctionTriggerRequest. + :type: str + """ # noqa: E501 + self._org_id = org_id + + @property + def org(self): + """Get the org of this FunctionTriggerRequest. + + :return: The org of this FunctionTriggerRequest. + :rtype: str + """ # noqa: E501 + return self._org + + @org.setter + def org(self, org): + """Set the org of this FunctionTriggerRequest. + + :param org: The org of this FunctionTriggerRequest. + :type: str + """ # noqa: E501 + self._org = org + + @property + def language(self): + """Get the language of this FunctionTriggerRequest. + + :return: The language of this FunctionTriggerRequest. + :rtype: FunctionLanguage + """ # noqa: E501 + return self._language + + @language.setter + def language(self, language): + """Set the language of this FunctionTriggerRequest. + + :param language: The language of this FunctionTriggerRequest. + :type: FunctionLanguage + """ # noqa: E501 + if language is None: + raise ValueError("Invalid value for `language`, must not be `None`") # noqa: E501 + self._language = language + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionTriggerRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_trigger_response.py b/influxdb_client/domain/function_trigger_response.py new file mode 100644 index 00000000..50fdfcdc --- /dev/null +++ b/influxdb_client/domain/function_trigger_response.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six +from influxdb_client.domain.function_run_base import FunctionRunBase + + +class FunctionTriggerResponse(FunctionRunBase): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'response': 'FunctionHTTPResponse' + } + + attribute_map = { + 'response': 'response' + } + + def __init__(self, response=None): # noqa: E501,D401,D403 + """FunctionTriggerResponse - a model defined in OpenAPI.""" # noqa: E501 + FunctionRunBase.__init__(self) # noqa: E501 + + self._response = None + self.discriminator = None + + if response is not None: + self.response = response + + @property + def response(self): + """Get the response of this FunctionTriggerResponse. + + :return: The response of this FunctionTriggerResponse. + :rtype: FunctionHTTPResponse + """ # noqa: E501 + return self._response + + @response.setter + def response(self, response): + """Set the response of this FunctionTriggerResponse. + + :param response: The response of this FunctionTriggerResponse. + :type: FunctionHTTPResponse + """ # noqa: E501 + self._response = response + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionTriggerResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/function_update_request.py b/influxdb_client/domain/function_update_request.py new file mode 100644 index 00000000..8be28ac0 --- /dev/null +++ b/influxdb_client/domain/function_update_request.py @@ -0,0 +1,159 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FunctionUpdateRequest(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'name': 'str', + 'description': 'str', + 'script': 'str' + } + + attribute_map = { + 'name': 'name', + 'description': 'description', + 'script': 'script' + } + + def __init__(self, name=None, description=None, script=None): # noqa: E501,D401,D403 + """FunctionUpdateRequest - a model defined in OpenAPI.""" # noqa: E501 + self._name = None + self._description = None + self._script = None + self.discriminator = None + + if name is not None: + self.name = name + if description is not None: + self.description = description + if script is not None: + self.script = script + + @property + def name(self): + """Get the name of this FunctionUpdateRequest. + + :return: The name of this FunctionUpdateRequest. + :rtype: str + """ # noqa: E501 + return self._name + + @name.setter + def name(self, name): + """Set the name of this FunctionUpdateRequest. + + :param name: The name of this FunctionUpdateRequest. + :type: str + """ # noqa: E501 + self._name = name + + @property + def description(self): + """Get the description of this FunctionUpdateRequest. + + :return: The description of this FunctionUpdateRequest. + :rtype: str + """ # noqa: E501 + return self._description + + @description.setter + def description(self, description): + """Set the description of this FunctionUpdateRequest. + + :param description: The description of this FunctionUpdateRequest. + :type: str + """ # noqa: E501 + self._description = description + + @property + def script(self): + """Get the script of this FunctionUpdateRequest. + + script is script to be executed + + :return: The script of this FunctionUpdateRequest. + :rtype: str + """ # noqa: E501 + return self._script + + @script.setter + def script(self, script): + """Set the script of this FunctionUpdateRequest. + + script is script to be executed + + :param script: The script of this FunctionUpdateRequest. + :type: str + """ # noqa: E501 + self._script = script + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, FunctionUpdateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/domain/functions.py b/influxdb_client/domain/functions.py new file mode 100644 index 00000000..cd6df088 --- /dev/null +++ b/influxdb_client/domain/functions.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" +InfluxData Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class Functions(object): + """NOTE: This class is auto generated by OpenAPI Generator. + + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'functions': 'list[Function]' + } + + attribute_map = { + 'functions': 'functions' + } + + def __init__(self, functions=None): # noqa: E501,D401,D403 + """Functions - a model defined in OpenAPI.""" # noqa: E501 + self._functions = None + self.discriminator = None + + if functions is not None: + self.functions = functions + + @property + def functions(self): + """Get the functions of this Functions. + + :return: The functions of this Functions. + :rtype: list[Function] + """ # noqa: E501 + return self._functions + + @functions.setter + def functions(self, functions): + """Set the functions of this Functions. + + :param functions: The functions of this Functions. + :type: list[Function] + """ # noqa: E501 + self._functions = functions + + def to_dict(self): + """Return the model properties as a dict.""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Return the string representation of the model.""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`.""" + return self.to_str() + + def __eq__(self, other): + """Return true if both objects are equal.""" + if not isinstance(other, Functions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Return true if both objects are not equal.""" + return not self == other diff --git a/influxdb_client/service/__init__.py b/influxdb_client/service/__init__.py index 97568e15..866760b1 100644 --- a/influxdb_client/service/__init__.py +++ b/influxdb_client/service/__init__.py @@ -41,3 +41,4 @@ from influxdb_client.service.views_service import ViewsService from influxdb_client.service.write_service import WriteService from influxdb_client.service.default_service import DefaultService +from influxdb_client.service.functions_service import FunctionsService diff --git a/influxdb_client/service/functions_service.py b/influxdb_client/service/functions_service.py new file mode 100644 index 00000000..d45a4e23 --- /dev/null +++ b/influxdb_client/service/functions_service.py @@ -0,0 +1,1093 @@ +# coding: utf-8 + +""" +Influxdata Managed Functions CRUD API. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 0.1.0 +Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + + +class FunctionsService(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): # noqa: E501,D401,D403 + """FunctionsService - a operation defined in OpenAPI.""" + if api_client is None: + raise ValueError("Invalid value for `api_client`, must be defined.") + self.api_client = api_client + + def delete_functions_id(self, function_id, **kwargs): # noqa: E501,D401,D403 + """Delete a function. + + Deletes a function and all associated records + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_functions_id(function_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: The ID of the function to delete. (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_functions_id_with_http_info(function_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_functions_id_with_http_info(function_id, **kwargs) # noqa: E501 + return data + + def delete_functions_id_with_http_info(self, function_id, **kwargs): # noqa: E501,D401,D403 + """Delete a function. + + Deletes a function and all associated records + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_functions_id_with_http_info(function_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: The ID of the function to delete. (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['function_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_functions_id" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'function_id' is set + if ('function_id' not in local_var_params or + local_var_params['function_id'] is None): + raise ValueError("Missing the required parameter `function_id` when calling `delete_functions_id`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'function_id' in local_var_params: + path_params['functionID'] = local_var_params['function_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/functions/{functionID}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def get_functions(self, **kwargs): # noqa: E501,D401,D403 + """List all Functions. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_functions(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str org: The name of the organization. + :param str org_id: The organization ID. + :param int limit: The number of functions to return + :param int offset: Offset for pagination + :return: Functions + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_functions_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_functions_with_http_info(**kwargs) # noqa: E501 + return data + + def get_functions_with_http_info(self, **kwargs): # noqa: E501,D401,D403 + """List all Functions. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_functions_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str org: The name of the organization. + :param str org_id: The organization ID. + :param int limit: The number of functions to return + :param int offset: Offset for pagination + :return: Functions + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['org', 'org_id', 'limit', 'offset'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_functions" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'org' in local_var_params: + query_params.append(('org', local_var_params['org'])) # noqa: E501 + if 'org_id' in local_var_params: + query_params.append(('orgID', local_var_params['org_id'])) # noqa: E501 + if 'limit' in local_var_params: + query_params.append(('limit', local_var_params['limit'])) # noqa: E501 + if 'offset' in local_var_params: + query_params.append(('offset', local_var_params['offset'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/functions', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Functions', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def get_functions_id(self, function_id, **kwargs): # noqa: E501,D401,D403 + """Retrieve a function. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_functions_id(function_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: The function ID. (required) + :return: Function + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_functions_id_with_http_info(function_id, **kwargs) # noqa: E501 + else: + (data) = self.get_functions_id_with_http_info(function_id, **kwargs) # noqa: E501 + return data + + def get_functions_id_with_http_info(self, function_id, **kwargs): # noqa: E501,D401,D403 + """Retrieve a function. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_functions_id_with_http_info(function_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: The function ID. (required) + :return: Function + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['function_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_functions_id" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'function_id' is set + if ('function_id' not in local_var_params or + local_var_params['function_id'] is None): + raise ValueError("Missing the required parameter `function_id` when calling `get_functions_id`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'function_id' in local_var_params: + path_params['functionID'] = local_var_params['function_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/functions/{functionID}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Function', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def get_functions_id_invoke(self, function_id, **kwargs): # noqa: E501,D401,D403 + """Manually invoke a function with params in query. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_functions_id_invoke(function_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: (required) + :param dict(str, object) params: + :return: FunctionHTTPResponseData + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_functions_id_invoke_with_http_info(function_id, **kwargs) # noqa: E501 + else: + (data) = self.get_functions_id_invoke_with_http_info(function_id, **kwargs) # noqa: E501 + return data + + def get_functions_id_invoke_with_http_info(self, function_id, **kwargs): # noqa: E501,D401,D403 + """Manually invoke a function with params in query. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_functions_id_invoke_with_http_info(function_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: (required) + :param dict(str, object) params: + :return: FunctionHTTPResponseData + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['function_id', 'params'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_functions_id_invoke" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'function_id' is set + if ('function_id' not in local_var_params or + local_var_params['function_id'] is None): + raise ValueError("Missing the required parameter `function_id` when calling `get_functions_id_invoke`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'function_id' in local_var_params: + path_params['functionID'] = local_var_params['function_id'] # noqa: E501 + + query_params = [] + if 'params' in local_var_params: + query_params.append(('params', local_var_params['params'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/functions/{functionID}/invoke', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FunctionHTTPResponseData', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def get_functions_id_runs(self, function_id, **kwargs): # noqa: E501,D401,D403 + """List runs for a function. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_functions_id_runs(function_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: The ID of the function to get runs for. (required) + :param int limit: The number of functions to return + :param int offset: Offset for pagination + :return: FunctionRuns + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_functions_id_runs_with_http_info(function_id, **kwargs) # noqa: E501 + else: + (data) = self.get_functions_id_runs_with_http_info(function_id, **kwargs) # noqa: E501 + return data + + def get_functions_id_runs_with_http_info(self, function_id, **kwargs): # noqa: E501,D401,D403 + """List runs for a function. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_functions_id_runs_with_http_info(function_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: The ID of the function to get runs for. (required) + :param int limit: The number of functions to return + :param int offset: Offset for pagination + :return: FunctionRuns + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['function_id', 'limit', 'offset'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_functions_id_runs" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'function_id' is set + if ('function_id' not in local_var_params or + local_var_params['function_id'] is None): + raise ValueError("Missing the required parameter `function_id` when calling `get_functions_id_runs`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'function_id' in local_var_params: + path_params['functionID'] = local_var_params['function_id'] # noqa: E501 + + query_params = [] + if 'limit' in local_var_params: + query_params.append(('limit', local_var_params['limit'])) # noqa: E501 + if 'offset' in local_var_params: + query_params.append(('offset', local_var_params['offset'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/functions/{functionID}/runs', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FunctionRuns', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def get_functions_id_runs_id(self, function_id, run_id, **kwargs): # noqa: E501,D401,D403 + """Retrieve a single run for a function. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_functions_id_runs_id(function_id, run_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: The function ID. (required) + :param str run_id: The run ID. (required) + :return: FunctionRun + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_functions_id_runs_id_with_http_info(function_id, run_id, **kwargs) # noqa: E501 + else: + (data) = self.get_functions_id_runs_id_with_http_info(function_id, run_id, **kwargs) # noqa: E501 + return data + + def get_functions_id_runs_id_with_http_info(self, function_id, run_id, **kwargs): # noqa: E501,D401,D403 + """Retrieve a single run for a function. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_functions_id_runs_id_with_http_info(function_id, run_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: The function ID. (required) + :param str run_id: The run ID. (required) + :return: FunctionRun + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['function_id', 'run_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_functions_id_runs_id" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'function_id' is set + if ('function_id' not in local_var_params or + local_var_params['function_id'] is None): + raise ValueError("Missing the required parameter `function_id` when calling `get_functions_id_runs_id`") # noqa: E501 + # verify the required parameter 'run_id' is set + if ('run_id' not in local_var_params or + local_var_params['run_id'] is None): + raise ValueError("Missing the required parameter `run_id` when calling `get_functions_id_runs_id`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'function_id' in local_var_params: + path_params['functionID'] = local_var_params['function_id'] # noqa: E501 + if 'run_id' in local_var_params: + path_params['runID'] = local_var_params['run_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/functions/{functionID}/runs/{runID}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FunctionRun', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def patch_functions_id(self, function_id, function_update_request, **kwargs): # noqa: E501,D401,D403 + """Update a function. + + Update a function + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.patch_functions_id(function_id, function_update_request, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: The function ID. (required) + :param FunctionUpdateRequest function_update_request: Function update to apply (required) + :return: Function + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.patch_functions_id_with_http_info(function_id, function_update_request, **kwargs) # noqa: E501 + else: + (data) = self.patch_functions_id_with_http_info(function_id, function_update_request, **kwargs) # noqa: E501 + return data + + def patch_functions_id_with_http_info(self, function_id, function_update_request, **kwargs): # noqa: E501,D401,D403 + """Update a function. + + Update a function + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.patch_functions_id_with_http_info(function_id, function_update_request, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: The function ID. (required) + :param FunctionUpdateRequest function_update_request: Function update to apply (required) + :return: Function + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['function_id', 'function_update_request'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method patch_functions_id" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'function_id' is set + if ('function_id' not in local_var_params or + local_var_params['function_id'] is None): + raise ValueError("Missing the required parameter `function_id` when calling `patch_functions_id`") # noqa: E501 + # verify the required parameter 'function_update_request' is set + if ('function_update_request' not in local_var_params or + local_var_params['function_update_request'] is None): + raise ValueError("Missing the required parameter `function_update_request` when calling `patch_functions_id`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'function_id' in local_var_params: + path_params['functionID'] = local_var_params['function_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'function_update_request' in local_var_params: + body_params = local_var_params['function_update_request'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/functions/{functionID}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Function', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def post_functions(self, function_create_request, **kwargs): # noqa: E501,D401,D403 + """Create a new function. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_functions(function_create_request, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param FunctionCreateRequest function_create_request: Function to create (required) + :return: Function + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_functions_with_http_info(function_create_request, **kwargs) # noqa: E501 + else: + (data) = self.post_functions_with_http_info(function_create_request, **kwargs) # noqa: E501 + return data + + def post_functions_with_http_info(self, function_create_request, **kwargs): # noqa: E501,D401,D403 + """Create a new function. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_functions_with_http_info(function_create_request, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param FunctionCreateRequest function_create_request: Function to create (required) + :return: Function + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['function_create_request'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_functions" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'function_create_request' is set + if ('function_create_request' not in local_var_params or + local_var_params['function_create_request'] is None): + raise ValueError("Missing the required parameter `function_create_request` when calling `post_functions`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'function_create_request' in local_var_params: + body_params = local_var_params['function_create_request'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/functions', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Function', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def post_functions_id_invoke(self, function_id, **kwargs): # noqa: E501,D401,D403 + """Manually invoke a function with params in request body. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_functions_id_invoke(function_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: (required) + :param FunctionInvocationParams function_invocation_params: + :return: FunctionHTTPResponseData + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_functions_id_invoke_with_http_info(function_id, **kwargs) # noqa: E501 + else: + (data) = self.post_functions_id_invoke_with_http_info(function_id, **kwargs) # noqa: E501 + return data + + def post_functions_id_invoke_with_http_info(self, function_id, **kwargs): # noqa: E501,D401,D403 + """Manually invoke a function with params in request body. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_functions_id_invoke_with_http_info(function_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str function_id: (required) + :param FunctionInvocationParams function_invocation_params: + :return: FunctionHTTPResponseData + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['function_id', 'function_invocation_params'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_functions_id_invoke" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'function_id' is set + if ('function_id' not in local_var_params or + local_var_params['function_id'] is None): + raise ValueError("Missing the required parameter `function_id` when calling `post_functions_id_invoke`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'function_id' in local_var_params: + path_params['functionID'] = local_var_params['function_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'function_invocation_params' in local_var_params: + body_params = local_var_params['function_invocation_params'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/functions/{functionID}/invoke', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FunctionHTTPResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def post_functions_trigger(self, function_trigger_request, **kwargs): # noqa: E501,D401,D403 + """Manually trigger a function without creating an associated function resource. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_functions_trigger(function_trigger_request, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param FunctionTriggerRequest function_trigger_request: Function to be triggered (required) + :return: FunctionTriggerResponse + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_functions_trigger_with_http_info(function_trigger_request, **kwargs) # noqa: E501 + else: + (data) = self.post_functions_trigger_with_http_info(function_trigger_request, **kwargs) # noqa: E501 + return data + + def post_functions_trigger_with_http_info(self, function_trigger_request, **kwargs): # noqa: E501,D401,D403 + """Manually trigger a function without creating an associated function resource. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_functions_trigger_with_http_info(function_trigger_request, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param FunctionTriggerRequest function_trigger_request: Function to be triggered (required) + :return: FunctionTriggerResponse + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['function_trigger_request'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_functions_trigger" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'function_trigger_request' is set + if ('function_trigger_request' not in local_var_params or + local_var_params['function_trigger_request'] is None): + raise ValueError("Missing the required parameter `function_trigger_request` when calling `post_functions_trigger`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'function_trigger_request' in local_var_params: + body_params = local_var_params['function_trigger_request'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/functions/trigger', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FunctionTriggerResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) diff --git a/tests/__init__.py b/tests/__init__.py index 97568e15..866760b1 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -41,3 +41,4 @@ from influxdb_client.service.views_service import ViewsService from influxdb_client.service.write_service import WriteService from influxdb_client.service.default_service import DefaultService +from influxdb_client.service.functions_service import FunctionsService From cfccff804b6149fe3ad43842224e5ec78507e878 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Thu, 14 Oct 2021 13:28:16 +0200 Subject: [PATCH 3/8] feat: improve the example --- examples/managed_functions.py | 11 ++++++----- influxdb_client/service/functions_service.py | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/managed_functions.py b/examples/managed_functions.py index 1d601a17..7767a3e3 100644 --- a/examples/managed_functions.py +++ b/examples/managed_functions.py @@ -14,7 +14,7 @@ bucket_name = '...' org_name = '...' -with InfluxDBClient(url=influx_cloud_url, token=influx_cloud_token, org=org_name, debug=True, timeout=20_000) as client: +with InfluxDBClient(url=influx_cloud_url, token=influx_cloud_token, org=org_name, debug=False, timeout=20_000) as client: uniqueId = str(datetime.datetime.now()) """ Find Organization ID by Organization API. @@ -31,7 +31,7 @@ description="my first try", language=FunctionLanguage.FLUX, org_id=org.id, - script=f"from(bucket: \"{bucket_name}\") |> range(start: -7d) |> limit(n:2)") + script=f"from(bucket: \"{bucket_name}\") |> range(start: -30d) |> limit(n:2)") created_function = functions_service.post_functions(function_create_request=create_request) print(created_function) @@ -39,15 +39,16 @@ """ Invoke Function """ - print(f"\n------- Invoke Function: -------\n") + print(f"\n------- Invoke -------\n") response = functions_service.post_functions_id_invoke(function_id=created_function.id, function_invocation_params=FunctionInvocationParams( params={"bucket_name": bucket_name})) + print(response) """ List all Functions """ - print(f"\n------- Functions: -------\n") + print(f"\n------- List -------\n") functions = functions_service.get_functions(org=org).functions print("\n".join([f" ---\n ID: {it.id}\n Name: {it.name}\n Description: {it.description}" for it in functions])) print("---") @@ -57,4 +58,4 @@ """ print(f"------- Delete -------\n") functions_service.delete_functions_id(created_function.id) - print(f" successfully deleted function: {created_function.name}") + print(f" Successfully deleted function: '{created_function.name}'") diff --git a/influxdb_client/service/functions_service.py b/influxdb_client/service/functions_service.py index d45a4e23..55c9b541 100644 --- a/influxdb_client/service/functions_service.py +++ b/influxdb_client/service/functions_service.py @@ -353,7 +353,7 @@ def get_functions_id_invoke(self, function_id, **kwargs): # noqa: E501,D401,D40 :param async_req bool :param str function_id: (required) :param dict(str, object) params: - :return: FunctionHTTPResponseData + :return: str If the method is called asynchronously, returns the request thread. """ # noqa: E501 @@ -375,7 +375,7 @@ def get_functions_id_invoke_with_http_info(self, function_id, **kwargs): # noqa :param async_req bool :param str function_id: (required) :param dict(str, object) params: - :return: FunctionHTTPResponseData + :return: str If the method is called asynchronously, returns the request thread. """ # noqa: E501 @@ -437,7 +437,7 @@ def get_functions_id_invoke_with_http_info(self, function_id, **kwargs): # noqa body=body_params, post_params=form_params, files=local_var_files, - response_type='FunctionHTTPResponseData', # noqa: E501 + response_type='str', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -891,7 +891,7 @@ def post_functions_id_invoke(self, function_id, **kwargs): # noqa: E501,D401,D4 :param async_req bool :param str function_id: (required) :param FunctionInvocationParams function_invocation_params: - :return: FunctionHTTPResponseData + :return: str If the method is called asynchronously, returns the request thread. """ # noqa: E501 @@ -913,7 +913,7 @@ def post_functions_id_invoke_with_http_info(self, function_id, **kwargs): # noq :param async_req bool :param str function_id: (required) :param FunctionInvocationParams function_invocation_params: - :return: FunctionHTTPResponseData + :return: str If the method is called asynchronously, returns the request thread. """ # noqa: E501 @@ -979,7 +979,7 @@ def post_functions_id_invoke_with_http_info(self, function_id, **kwargs): # noq body=body_params, post_params=form_params, files=local_var_files, - response_type='FunctionHTTPResponse', # noqa: E501 + response_type='str', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 From 9d900de86a3d1ce004ce2d26eaf060f10973cbec Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Thu, 14 Oct 2021 13:29:34 +0200 Subject: [PATCH 4/8] feat: improve the example --- examples/managed_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/managed_functions.py b/examples/managed_functions.py index 7767a3e3..8dd9d421 100644 --- a/examples/managed_functions.py +++ b/examples/managed_functions.py @@ -31,7 +31,7 @@ description="my first try", language=FunctionLanguage.FLUX, org_id=org.id, - script=f"from(bucket: \"{bucket_name}\") |> range(start: -30d) |> limit(n:2)") + script=f"from(bucket: params.bucket_name) |> range(start: -30d) |> limit(n:2)") created_function = functions_service.post_functions(function_create_request=create_request) print(created_function) From 420b47ea62ded8d918e5ed76a2a13ec82c09d24e Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Tue, 19 Oct 2021 11:55:30 +0200 Subject: [PATCH 5/8] chore: sources generated by our generator --- influxdb_client/__init__.py | 29 ++- influxdb_client/client/__init__.py | 2 +- influxdb_client/client/write/__init__.py | 2 +- influxdb_client/domain/__init__.py | 27 ++- influxdb_client/domain/function.py | 4 +- .../domain/function_create_request.py | 4 +- .../domain/function_http_response.py | 112 ----------- .../domain/function_http_response_data.py | 84 --------- .../domain/function_http_response_no_data.py | 178 ------------------ .../domain/function_invocation_params.py | 4 +- influxdb_client/domain/function_language.py | 4 +- influxdb_client/domain/function_run.py | 22 ++- influxdb_client/domain/function_run_base.py | 29 +-- influxdb_client/domain/function_run_log.py | 4 +- influxdb_client/domain/function_runs.py | 4 +- .../domain/function_trigger_request.py | 14 +- .../domain/function_trigger_response.py | 22 ++- .../domain/function_update_request.py | 4 +- influxdb_client/domain/functions.py | 4 +- influxdb_client/service/__init__.py | 2 +- influxdb_client/service/functions_service.py | 4 +- tests/__init__.py | 2 +- 22 files changed, 90 insertions(+), 471 deletions(-) delete mode 100644 influxdb_client/domain/function_http_response.py delete mode 100644 influxdb_client/domain/function_http_response_data.py delete mode 100644 influxdb_client/domain/function_http_response_no_data.py diff --git a/influxdb_client/__init__.py b/influxdb_client/__init__.py index 7bbe8f68..ee4cfbf8 100644 --- a/influxdb_client/__init__.py +++ b/influxdb_client/__init__.py @@ -22,6 +22,7 @@ from influxdb_client.service.dbr_ps_service import DBRPsService from influxdb_client.service.dashboards_service import DashboardsService from influxdb_client.service.delete_service import DeleteService +from influxdb_client.service.functions_service import FunctionsService from influxdb_client.service.health_service import HealthService from influxdb_client.service.labels_service import LabelsService from influxdb_client.service.notification_endpoints_service import NotificationEndpointsService @@ -43,7 +44,6 @@ from influxdb_client.service.views_service import ViewsService from influxdb_client.service.write_service import WriteService from influxdb_client.service.default_service import DefaultService -from influxdb_client.service.functions_service import FunctionsService # import ApiClient from influxdb_client.api_client import ApiClient @@ -127,7 +127,19 @@ from influxdb_client.domain.flux_response import FluxResponse from influxdb_client.domain.flux_suggestion import FluxSuggestion from influxdb_client.domain.flux_suggestions import FluxSuggestions +from influxdb_client.domain.function import Function +from influxdb_client.domain.function_create_request import FunctionCreateRequest from influxdb_client.domain.function_expression import FunctionExpression +from influxdb_client.domain.function_invocation_params import FunctionInvocationParams +from influxdb_client.domain.function_language import FunctionLanguage +from influxdb_client.domain.function_run import FunctionRun +from influxdb_client.domain.function_run_base import FunctionRunBase +from influxdb_client.domain.function_run_log import FunctionRunLog +from influxdb_client.domain.function_runs import FunctionRuns +from influxdb_client.domain.function_trigger_request import FunctionTriggerRequest +from influxdb_client.domain.function_trigger_response import FunctionTriggerResponse +from influxdb_client.domain.function_update_request import FunctionUpdateRequest +from influxdb_client.domain.functions import Functions from influxdb_client.domain.gauge_view_properties import GaugeViewProperties from influxdb_client.domain.greater_threshold import GreaterThreshold from influxdb_client.domain.http_notification_endpoint import HTTPNotificationEndpoint @@ -287,21 +299,6 @@ from influxdb_client.domain.write_precision import WritePrecision from influxdb_client.domain.xy_geom import XYGeom from influxdb_client.domain.xy_view_properties import XYViewProperties -from influxdb_client.domain.function import Function -from influxdb_client.domain.function_create_request import FunctionCreateRequest -from influxdb_client.domain.function_http_response import FunctionHTTPResponse -from influxdb_client.domain.function_http_response_data import FunctionHTTPResponseData -from influxdb_client.domain.function_http_response_no_data import FunctionHTTPResponseNoData -from influxdb_client.domain.function_invocation_params import FunctionInvocationParams -from influxdb_client.domain.function_language import FunctionLanguage -from influxdb_client.domain.function_run import FunctionRun -from influxdb_client.domain.function_run_base import FunctionRunBase -from influxdb_client.domain.function_run_log import FunctionRunLog -from influxdb_client.domain.function_runs import FunctionRuns -from influxdb_client.domain.function_trigger_request import FunctionTriggerRequest -from influxdb_client.domain.function_trigger_response import FunctionTriggerResponse -from influxdb_client.domain.function_update_request import FunctionUpdateRequest -from influxdb_client.domain.functions import Functions from influxdb_client.client.authorizations_api import AuthorizationsApi from influxdb_client.client.bucket_api import BucketsApi diff --git a/influxdb_client/client/__init__.py b/influxdb_client/client/__init__.py index 866760b1..a549c2e1 100644 --- a/influxdb_client/client/__init__.py +++ b/influxdb_client/client/__init__.py @@ -20,6 +20,7 @@ from influxdb_client.service.dbr_ps_service import DBRPsService from influxdb_client.service.dashboards_service import DashboardsService from influxdb_client.service.delete_service import DeleteService +from influxdb_client.service.functions_service import FunctionsService from influxdb_client.service.health_service import HealthService from influxdb_client.service.labels_service import LabelsService from influxdb_client.service.notification_endpoints_service import NotificationEndpointsService @@ -41,4 +42,3 @@ from influxdb_client.service.views_service import ViewsService from influxdb_client.service.write_service import WriteService from influxdb_client.service.default_service import DefaultService -from influxdb_client.service.functions_service import FunctionsService diff --git a/influxdb_client/client/write/__init__.py b/influxdb_client/client/write/__init__.py index 866760b1..a549c2e1 100644 --- a/influxdb_client/client/write/__init__.py +++ b/influxdb_client/client/write/__init__.py @@ -20,6 +20,7 @@ from influxdb_client.service.dbr_ps_service import DBRPsService from influxdb_client.service.dashboards_service import DashboardsService from influxdb_client.service.delete_service import DeleteService +from influxdb_client.service.functions_service import FunctionsService from influxdb_client.service.health_service import HealthService from influxdb_client.service.labels_service import LabelsService from influxdb_client.service.notification_endpoints_service import NotificationEndpointsService @@ -41,4 +42,3 @@ from influxdb_client.service.views_service import ViewsService from influxdb_client.service.write_service import WriteService from influxdb_client.service.default_service import DefaultService -from influxdb_client.service.functions_service import FunctionsService diff --git a/influxdb_client/domain/__init__.py b/influxdb_client/domain/__init__.py index 08b0124d..4d33bed5 100644 --- a/influxdb_client/domain/__init__.py +++ b/influxdb_client/domain/__init__.py @@ -92,7 +92,19 @@ from influxdb_client.domain.flux_response import FluxResponse from influxdb_client.domain.flux_suggestion import FluxSuggestion from influxdb_client.domain.flux_suggestions import FluxSuggestions +from influxdb_client.domain.function import Function +from influxdb_client.domain.function_create_request import FunctionCreateRequest from influxdb_client.domain.function_expression import FunctionExpression +from influxdb_client.domain.function_invocation_params import FunctionInvocationParams +from influxdb_client.domain.function_language import FunctionLanguage +from influxdb_client.domain.function_run import FunctionRun +from influxdb_client.domain.function_run_base import FunctionRunBase +from influxdb_client.domain.function_run_log import FunctionRunLog +from influxdb_client.domain.function_runs import FunctionRuns +from influxdb_client.domain.function_trigger_request import FunctionTriggerRequest +from influxdb_client.domain.function_trigger_response import FunctionTriggerResponse +from influxdb_client.domain.function_update_request import FunctionUpdateRequest +from influxdb_client.domain.functions import Functions from influxdb_client.domain.gauge_view_properties import GaugeViewProperties from influxdb_client.domain.greater_threshold import GreaterThreshold from influxdb_client.domain.http_notification_endpoint import HTTPNotificationEndpoint @@ -252,18 +264,3 @@ from influxdb_client.domain.write_precision import WritePrecision from influxdb_client.domain.xy_geom import XYGeom from influxdb_client.domain.xy_view_properties import XYViewProperties -from influxdb_client.domain.function import Function -from influxdb_client.domain.function_create_request import FunctionCreateRequest -from influxdb_client.domain.function_http_response import FunctionHTTPResponse -from influxdb_client.domain.function_http_response_data import FunctionHTTPResponseData -from influxdb_client.domain.function_http_response_no_data import FunctionHTTPResponseNoData -from influxdb_client.domain.function_invocation_params import FunctionInvocationParams -from influxdb_client.domain.function_language import FunctionLanguage -from influxdb_client.domain.function_run import FunctionRun -from influxdb_client.domain.function_run_base import FunctionRunBase -from influxdb_client.domain.function_run_log import FunctionRunLog -from influxdb_client.domain.function_runs import FunctionRuns -from influxdb_client.domain.function_trigger_request import FunctionTriggerRequest -from influxdb_client.domain.function_trigger_response import FunctionTriggerResponse -from influxdb_client.domain.function_update_request import FunctionUpdateRequest -from influxdb_client.domain.functions import Functions diff --git a/influxdb_client/domain/function.py b/influxdb_client/domain/function.py index d22936a5..7e0a6bdf 100644 --- a/influxdb_client/domain/function.py +++ b/influxdb_client/domain/function.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ diff --git a/influxdb_client/domain/function_create_request.py b/influxdb_client/domain/function_create_request.py index a97fa74d..c3dcae20 100644 --- a/influxdb_client/domain/function_create_request.py +++ b/influxdb_client/domain/function_create_request.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ diff --git a/influxdb_client/domain/function_http_response.py b/influxdb_client/domain/function_http_response.py deleted file mode 100644 index af3d2135..00000000 --- a/influxdb_client/domain/function_http_response.py +++ /dev/null @@ -1,112 +0,0 @@ -# coding: utf-8 - -""" -InfluxData Managed Functions CRUD API. - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - -OpenAPI spec version: 0.1.0 -Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six -from influxdb_client.domain.function_http_response_no_data import FunctionHTTPResponseNoData - - -class FunctionHTTPResponse(FunctionHTTPResponseNoData): - """NOTE: This class is auto generated by OpenAPI Generator. - - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - 'data': 'FunctionHTTPResponseData' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501,D401,D403 - """FunctionHTTPResponse - a model defined in OpenAPI.""" # noqa: E501 - FunctionHTTPResponseNoData.__init__(self) # noqa: E501 - - self._data = None - self.discriminator = None - - if data is not None: - self.data = data - - @property - def data(self): - """Get the data of this FunctionHTTPResponse. - - :return: The data of this FunctionHTTPResponse. - :rtype: FunctionHTTPResponseData - """ # noqa: E501 - return self._data - - @data.setter - def data(self, data): - """Set the data of this FunctionHTTPResponse. - - :param data: The data of this FunctionHTTPResponse. - :type: FunctionHTTPResponseData - """ # noqa: E501 - self._data = data - - def to_dict(self): - """Return the model properties as a dict.""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Return the string representation of the model.""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`.""" - return self.to_str() - - def __eq__(self, other): - """Return true if both objects are equal.""" - if not isinstance(other, FunctionHTTPResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Return true if both objects are not equal.""" - return not self == other diff --git a/influxdb_client/domain/function_http_response_data.py b/influxdb_client/domain/function_http_response_data.py deleted file mode 100644 index 972c7a6c..00000000 --- a/influxdb_client/domain/function_http_response_data.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding: utf-8 - -""" -InfluxData Managed Functions CRUD API. - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - -OpenAPI spec version: 0.1.0 -Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FunctionHTTPResponseData(object): - """NOTE: This class is auto generated by OpenAPI Generator. - - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501,D401,D403 - """FunctionHTTPResponseData - a model defined in OpenAPI.""" # noqa: E501 self.discriminator = None - - def to_dict(self): - """Return the model properties as a dict.""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Return the string representation of the model.""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`.""" - return self.to_str() - - def __eq__(self, other): - """Return true if both objects are equal.""" - if not isinstance(other, FunctionHTTPResponseData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Return true if both objects are not equal.""" - return not self == other diff --git a/influxdb_client/domain/function_http_response_no_data.py b/influxdb_client/domain/function_http_response_no_data.py deleted file mode 100644 index 528c4661..00000000 --- a/influxdb_client/domain/function_http_response_no_data.py +++ /dev/null @@ -1,178 +0,0 @@ -# coding: utf-8 - -""" -InfluxData Managed Functions CRUD API. - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - -OpenAPI spec version: 0.1.0 -Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FunctionHTTPResponseNoData(object): - """NOTE: This class is auto generated by OpenAPI Generator. - - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - 'type': 'str', - 'data_type': 'str', - 'headers': 'object', - 'status_code': 'str' - } - - attribute_map = { - 'type': 'type', - 'data_type': 'dataType', - 'headers': 'headers', - 'status_code': 'statusCode' - } - - def __init__(self, type=None, data_type=None, headers=None, status_code=None): # noqa: E501,D401,D403 - """FunctionHTTPResponseNoData - a model defined in OpenAPI.""" # noqa: E501 - self._type = None - self._data_type = None - self._headers = None - self._status_code = None - self.discriminator = None - - if type is not None: - self.type = type - if data_type is not None: - self.data_type = data_type - if headers is not None: - self.headers = headers - if status_code is not None: - self.status_code = status_code - - @property - def type(self): - """Get the type of this FunctionHTTPResponseNoData. - - :return: The type of this FunctionHTTPResponseNoData. - :rtype: str - """ # noqa: E501 - return self._type - - @type.setter - def type(self, type): - """Set the type of this FunctionHTTPResponseNoData. - - :param type: The type of this FunctionHTTPResponseNoData. - :type: str - """ # noqa: E501 - self._type = type - - @property - def data_type(self): - """Get the data_type of this FunctionHTTPResponseNoData. - - :return: The data_type of this FunctionHTTPResponseNoData. - :rtype: str - """ # noqa: E501 - return self._data_type - - @data_type.setter - def data_type(self, data_type): - """Set the data_type of this FunctionHTTPResponseNoData. - - :param data_type: The data_type of this FunctionHTTPResponseNoData. - :type: str - """ # noqa: E501 - self._data_type = data_type - - @property - def headers(self): - """Get the headers of this FunctionHTTPResponseNoData. - - :return: The headers of this FunctionHTTPResponseNoData. - :rtype: object - """ # noqa: E501 - return self._headers - - @headers.setter - def headers(self, headers): - """Set the headers of this FunctionHTTPResponseNoData. - - :param headers: The headers of this FunctionHTTPResponseNoData. - :type: object - """ # noqa: E501 - self._headers = headers - - @property - def status_code(self): - """Get the status_code of this FunctionHTTPResponseNoData. - - :return: The status_code of this FunctionHTTPResponseNoData. - :rtype: str - """ # noqa: E501 - return self._status_code - - @status_code.setter - def status_code(self, status_code): - """Set the status_code of this FunctionHTTPResponseNoData. - - :param status_code: The status_code of this FunctionHTTPResponseNoData. - :type: str - """ # noqa: E501 - self._status_code = status_code - - def to_dict(self): - """Return the model properties as a dict.""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Return the string representation of the model.""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`.""" - return self.to_str() - - def __eq__(self, other): - """Return true if both objects are equal.""" - if not isinstance(other, FunctionHTTPResponseNoData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Return true if both objects are not equal.""" - return not self == other diff --git a/influxdb_client/domain/function_invocation_params.py b/influxdb_client/domain/function_invocation_params.py index eb0ac113..599c3940 100644 --- a/influxdb_client/domain/function_invocation_params.py +++ b/influxdb_client/domain/function_invocation_params.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ diff --git a/influxdb_client/domain/function_language.py b/influxdb_client/domain/function_language.py index fed8df1d..d51fbe7c 100644 --- a/influxdb_client/domain/function_language.py +++ b/influxdb_client/domain/function_language.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ diff --git a/influxdb_client/domain/function_run.py b/influxdb_client/domain/function_run.py index 51eb7500..549a0d5d 100644 --- a/influxdb_client/domain/function_run.py +++ b/influxdb_client/domain/function_run.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ @@ -33,16 +33,26 @@ class FunctionRun(FunctionRunBase): and the value is json key in definition. """ openapi_types = { - 'response': 'FunctionHTTPResponseNoData' + 'response': 'FunctionHTTPResponseNoData', + 'id': 'str', + 'status': 'str', + 'error': 'str', + 'logs': 'list[FunctionRunLog]', + 'started_at': 'datetime' } attribute_map = { - 'response': 'response' + 'response': 'response', + 'id': 'id', + 'status': 'status', + 'error': 'error', + 'logs': 'logs', + 'started_at': 'startedAt' } - def __init__(self, response=None): # noqa: E501,D401,D403 + def __init__(self, response=None, id=None, status=None, error=None, logs=None, started_at=None): # noqa: E501,D401,D403 """FunctionRun - a model defined in OpenAPI.""" # noqa: E501 - FunctionRunBase.__init__(self) # noqa: E501 + FunctionRunBase.__init__(self, id=id, status=status, error=error, logs=logs, started_at=started_at) # noqa: E501 self._response = None self.discriminator = None diff --git a/influxdb_client/domain/function_run_base.py b/influxdb_client/domain/function_run_base.py index 4ba29e91..c574b518 100644 --- a/influxdb_client/domain/function_run_base.py +++ b/influxdb_client/domain/function_run_base.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ @@ -36,7 +36,6 @@ class FunctionRunBase(object): 'status': 'str', 'error': 'str', 'logs': 'list[FunctionRunLog]', - 'response': 'FunctionHTTPResponseNoData', 'started_at': 'datetime' } @@ -45,17 +44,15 @@ class FunctionRunBase(object): 'status': 'status', 'error': 'error', 'logs': 'logs', - 'response': 'response', 'started_at': 'startedAt' } - def __init__(self, id=None, status=None, error=None, logs=None, response=None, started_at=None): # noqa: E501,D401,D403 + def __init__(self, id=None, status=None, error=None, logs=None, started_at=None): # noqa: E501,D401,D403 """FunctionRunBase - a model defined in OpenAPI.""" # noqa: E501 self._id = None self._status = None self._error = None self._logs = None - self._response = None self._started_at = None self.discriminator = None @@ -67,8 +64,6 @@ def __init__(self, id=None, status=None, error=None, logs=None, response=None, s self.error = error if logs is not None: self.logs = logs - if response is not None: - self.response = response if started_at is not None: self.started_at = started_at @@ -144,24 +139,6 @@ def logs(self, logs): """ # noqa: E501 self._logs = logs - @property - def response(self): - """Get the response of this FunctionRunBase. - - :return: The response of this FunctionRunBase. - :rtype: FunctionHTTPResponseNoData - """ # noqa: E501 - return self._response - - @response.setter - def response(self, response): - """Set the response of this FunctionRunBase. - - :param response: The response of this FunctionRunBase. - :type: FunctionHTTPResponseNoData - """ # noqa: E501 - self._response = response - @property def started_at(self): """Get the started_at of this FunctionRunBase. diff --git a/influxdb_client/domain/function_run_log.py b/influxdb_client/domain/function_run_log.py index 4a1562c1..380cf8ac 100644 --- a/influxdb_client/domain/function_run_log.py +++ b/influxdb_client/domain/function_run_log.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ diff --git a/influxdb_client/domain/function_runs.py b/influxdb_client/domain/function_runs.py index 9af5cf35..091d3ecc 100644 --- a/influxdb_client/domain/function_runs.py +++ b/influxdb_client/domain/function_runs.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ diff --git a/influxdb_client/domain/function_trigger_request.py b/influxdb_client/domain/function_trigger_request.py index 233ea7d0..e2013f10 100644 --- a/influxdb_client/domain/function_trigger_request.py +++ b/influxdb_client/domain/function_trigger_request.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ @@ -37,7 +37,8 @@ class FunctionTriggerRequest(FunctionInvocationParams): 'method': 'str', 'org_id': 'str', 'org': 'str', - 'language': 'FunctionLanguage' + 'language': 'FunctionLanguage', + 'params': 'object' } attribute_map = { @@ -45,12 +46,13 @@ class FunctionTriggerRequest(FunctionInvocationParams): 'method': 'method', 'org_id': 'orgID', 'org': 'org', - 'language': 'language' + 'language': 'language', + 'params': 'params' } - def __init__(self, script=None, method=None, org_id=None, org=None, language=None): # noqa: E501,D401,D403 + def __init__(self, script=None, method=None, org_id=None, org=None, language=None, params=None): # noqa: E501,D401,D403 """FunctionTriggerRequest - a model defined in OpenAPI.""" # noqa: E501 - FunctionInvocationParams.__init__(self) # noqa: E501 + FunctionInvocationParams.__init__(self, params=params) # noqa: E501 self._script = None self._method = None diff --git a/influxdb_client/domain/function_trigger_response.py b/influxdb_client/domain/function_trigger_response.py index 50fdfcdc..5fa26406 100644 --- a/influxdb_client/domain/function_trigger_response.py +++ b/influxdb_client/domain/function_trigger_response.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ @@ -33,16 +33,26 @@ class FunctionTriggerResponse(FunctionRunBase): and the value is json key in definition. """ openapi_types = { - 'response': 'FunctionHTTPResponse' + 'response': 'FunctionHTTPResponse', + 'id': 'str', + 'status': 'str', + 'error': 'str', + 'logs': 'list[FunctionRunLog]', + 'started_at': 'datetime' } attribute_map = { - 'response': 'response' + 'response': 'response', + 'id': 'id', + 'status': 'status', + 'error': 'error', + 'logs': 'logs', + 'started_at': 'startedAt' } - def __init__(self, response=None): # noqa: E501,D401,D403 + def __init__(self, response=None, id=None, status=None, error=None, logs=None, started_at=None): # noqa: E501,D401,D403 """FunctionTriggerResponse - a model defined in OpenAPI.""" # noqa: E501 - FunctionRunBase.__init__(self) # noqa: E501 + FunctionRunBase.__init__(self, id=id, status=status, error=error, logs=logs, started_at=started_at) # noqa: E501 self._response = None self.discriminator = None diff --git a/influxdb_client/domain/function_update_request.py b/influxdb_client/domain/function_update_request.py index 8be28ac0..32094d2a 100644 --- a/influxdb_client/domain/function_update_request.py +++ b/influxdb_client/domain/function_update_request.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ diff --git a/influxdb_client/domain/functions.py b/influxdb_client/domain/functions.py index cd6df088..9f41701a 100644 --- a/influxdb_client/domain/functions.py +++ b/influxdb_client/domain/functions.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -InfluxData Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ diff --git a/influxdb_client/service/__init__.py b/influxdb_client/service/__init__.py index 866760b1..a549c2e1 100644 --- a/influxdb_client/service/__init__.py +++ b/influxdb_client/service/__init__.py @@ -20,6 +20,7 @@ from influxdb_client.service.dbr_ps_service import DBRPsService from influxdb_client.service.dashboards_service import DashboardsService from influxdb_client.service.delete_service import DeleteService +from influxdb_client.service.functions_service import FunctionsService from influxdb_client.service.health_service import HealthService from influxdb_client.service.labels_service import LabelsService from influxdb_client.service.notification_endpoints_service import NotificationEndpointsService @@ -41,4 +42,3 @@ from influxdb_client.service.views_service import ViewsService from influxdb_client.service.write_service import WriteService from influxdb_client.service.default_service import DefaultService -from influxdb_client.service.functions_service import FunctionsService diff --git a/influxdb_client/service/functions_service.py b/influxdb_client/service/functions_service.py index 55c9b541..6f21b5ae 100644 --- a/influxdb_client/service/functions_service.py +++ b/influxdb_client/service/functions_service.py @@ -1,11 +1,11 @@ # coding: utf-8 """ -Influxdata Managed Functions CRUD API. +Influx OSS API Service. No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 -OpenAPI spec version: 0.1.0 +OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ diff --git a/tests/__init__.py b/tests/__init__.py index 866760b1..a549c2e1 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -20,6 +20,7 @@ from influxdb_client.service.dbr_ps_service import DBRPsService from influxdb_client.service.dashboards_service import DashboardsService from influxdb_client.service.delete_service import DeleteService +from influxdb_client.service.functions_service import FunctionsService from influxdb_client.service.health_service import HealthService from influxdb_client.service.labels_service import LabelsService from influxdb_client.service.notification_endpoints_service import NotificationEndpointsService @@ -41,4 +42,3 @@ from influxdb_client.service.views_service import ViewsService from influxdb_client.service.write_service import WriteService from influxdb_client.service.default_service import DefaultService -from influxdb_client.service.functions_service import FunctionsService From 7db236031943d3f2f5c2c6dcd339e728323e312a Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Mon, 25 Oct 2021 07:39:32 +0200 Subject: [PATCH 6/8] chore: rename `managed functions` to `invocable scripts` --- examples/README.md | 2 +- examples/invocable_scripts.py | 61 + examples/managed_functions.py | 61 - influxdb_client/__init__.py | 20 +- influxdb_client/client/__init__.py | 2 +- influxdb_client/client/write/__init__.py | 2 +- influxdb_client/domain/__init__.py | 18 +- influxdb_client/domain/function_run.py | 122 -- influxdb_client/domain/function_run_base.py | 201 --- influxdb_client/domain/function_run_log.py | 155 --- .../domain/function_trigger_request.py | 213 ---- .../domain/function_trigger_response.py | 122 -- influxdb_client/domain/functions.py | 109 -- .../domain/{function.py => script.py} | 88 +- ...te_request.py => script_create_request.py} | 65 +- ..._params.py => script_invocation_params.py} | 14 +- ...unction_language.py => script_language.py} | 7 +- ...te_request.py => script_update_request.py} | 30 +- .../domain/{function_runs.py => scripts.py} | 40 +- influxdb_client/service/__init__.py | 2 +- influxdb_client/service/functions_service.py | 1093 ----------------- .../service/invocable_scripts_service.py | 665 ++++++++++ tests/__init__.py | 2 +- 23 files changed, 868 insertions(+), 2226 deletions(-) create mode 100644 examples/invocable_scripts.py delete mode 100644 examples/managed_functions.py delete mode 100644 influxdb_client/domain/function_run.py delete mode 100644 influxdb_client/domain/function_run_base.py delete mode 100644 influxdb_client/domain/function_run_log.py delete mode 100644 influxdb_client/domain/function_trigger_request.py delete mode 100644 influxdb_client/domain/function_trigger_response.py delete mode 100644 influxdb_client/domain/functions.py rename influxdb_client/domain/{function.py => script.py} (75%) rename influxdb_client/domain/{function_create_request.py => script_create_request.py} (70%) rename influxdb_client/domain/{function_invocation_params.py => script_invocation_params.py} (85%) rename influxdb_client/domain/{function_language.py => script_language.py} (91%) rename influxdb_client/domain/{function_update_request.py => script_update_request.py} (79%) rename influxdb_client/domain/{function_runs.py => scripts.py} (75%) delete mode 100644 influxdb_client/service/functions_service.py create mode 100644 influxdb_client/service/invocable_scripts_service.py diff --git a/examples/README.md b/examples/README.md index 67899530..53b8370f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -24,5 +24,5 @@ - [influx_cloud.py](influx_cloud.py) - How to connect to InfluxDB 2 Cloud - [influxdb_18_example.py](influxdb_18_example.py) - How to connect to InfluxDB 1.8 - [nanosecond_precision.py](nanosecond_precision.py) - How to use nanoseconds precision -- [managed_functions.py](managed_functions.py) - How to use Cloud Managed Functions +- [invocable_scripts.py](invocable_scripts.py) - How to use Invocable scripts Cloud API to create custom endpoints that query data \ No newline at end of file diff --git a/examples/invocable_scripts.py b/examples/invocable_scripts.py new file mode 100644 index 00000000..25ceb3b6 --- /dev/null +++ b/examples/invocable_scripts.py @@ -0,0 +1,61 @@ +""" +How to use Invocable scripts Cloud API to create custom endpoints that query data +""" +import datetime + +from influxdb_client import InfluxDBClient, InvocableScriptsService, ScriptCreateRequest, ScriptInvocationParams, \ + ScriptLanguage + +""" +Define credentials +""" +influx_cloud_url = 'https://us-west-2-1.aws.cloud2.influxdata.com' +influx_cloud_token = '...' +bucket_name = '...' +org_name = '...' + +with InfluxDBClient(url=influx_cloud_url, token=influx_cloud_token, org=org_name, debug=False, timeout=20_000) as client: + uniqueId = str(datetime.datetime.now()) + """ + Find Organization ID by Organization API. + """ + org = client.organizations_api().find_organizations(org=org_name)[0] + + scripts_service = InvocableScriptsService(api_client=client.api_client) + + """ + Create Invocable Script + """ + print(f"------- Create -------\n") + create_request = ScriptCreateRequest(name=f"my_scrupt_{uniqueId}", + description="my first try", + language=ScriptLanguage.FLUX, + org_id=org.id, + script=f"from(bucket: params.bucket_name) |> range(start: -30d) |> limit(n:2)") + + created_script = scripts_service.post_scripts(script_create_request=create_request) + print(created_script) + + """ + Invoke a script + """ + print(f"\n------- Invoke -------\n") + response = scripts_service.post_scripts_id_invoke(script_id=created_script.id, + script_invocation_params=ScriptInvocationParams( + params={"bucket_name": bucket_name})) + print(response) + + """ + List scripts + """ + print(f"\n------- List -------\n") + scripts = scripts_service.get_scripts().scripts + print("\n".join([f" ---\n ID: {it.id}\n Name: {it.name}\n Description: {it.description}" for it in scripts])) + print("---") + + """ + Delete previously created Script + """ + print(f"------- Delete -------\n") + scripts_service.delete_scripts_id(script_id=created_script.id) + print(f" Successfully deleted script: '{created_script.name}'") diff --git a/examples/managed_functions.py b/examples/managed_functions.py deleted file mode 100644 index 8dd9d421..00000000 --- a/examples/managed_functions.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -How to use Cloud Managed Functions -""" -import datetime - -from influxdb_client import InfluxDBClient, FunctionCreateRequest, FunctionLanguage, FunctionInvocationParams -from influxdb_client.service import FunctionsService - -""" -Define credentials -""" -influx_cloud_url = 'https://us-west-2-1.aws.cloud2.influxdata.com' -influx_cloud_token = '...' -bucket_name = '...' -org_name = '...' - -with InfluxDBClient(url=influx_cloud_url, token=influx_cloud_token, org=org_name, debug=False, timeout=20_000) as client: - uniqueId = str(datetime.datetime.now()) - """ - Find Organization ID by Organization API. - """ - org = client.organizations_api().find_organizations(org=org_name)[0] - - functions_service = FunctionsService(api_client=client.api_client) - - """ - Create Managed function - """ - print(f"------- Create -------\n") - create_request = FunctionCreateRequest(name=f"my_func_{uniqueId}", - description="my first try", - language=FunctionLanguage.FLUX, - org_id=org.id, - script=f"from(bucket: params.bucket_name) |> range(start: -30d) |> limit(n:2)") - - created_function = functions_service.post_functions(function_create_request=create_request) - print(created_function) - - """ - Invoke Function - """ - print(f"\n------- Invoke -------\n") - response = functions_service.post_functions_id_invoke(function_id=created_function.id, - function_invocation_params=FunctionInvocationParams( - params={"bucket_name": bucket_name})) - print(response) - - """ - List all Functions - """ - print(f"\n------- List -------\n") - functions = functions_service.get_functions(org=org).functions - print("\n".join([f" ---\n ID: {it.id}\n Name: {it.name}\n Description: {it.description}" for it in functions])) - print("---") - - """ - Delete previously created Function - """ - print(f"------- Delete -------\n") - functions_service.delete_functions_id(created_function.id) - print(f" Successfully deleted function: '{created_function.name}'") diff --git a/influxdb_client/__init__.py b/influxdb_client/__init__.py index ee4cfbf8..1bb36a36 100644 --- a/influxdb_client/__init__.py +++ b/influxdb_client/__init__.py @@ -22,8 +22,8 @@ from influxdb_client.service.dbr_ps_service import DBRPsService from influxdb_client.service.dashboards_service import DashboardsService from influxdb_client.service.delete_service import DeleteService -from influxdb_client.service.functions_service import FunctionsService from influxdb_client.service.health_service import HealthService +from influxdb_client.service.invocable_scripts_service import InvocableScriptsService from influxdb_client.service.labels_service import LabelsService from influxdb_client.service.notification_endpoints_service import NotificationEndpointsService from influxdb_client.service.notification_rules_service import NotificationRulesService @@ -127,19 +127,7 @@ from influxdb_client.domain.flux_response import FluxResponse from influxdb_client.domain.flux_suggestion import FluxSuggestion from influxdb_client.domain.flux_suggestions import FluxSuggestions -from influxdb_client.domain.function import Function -from influxdb_client.domain.function_create_request import FunctionCreateRequest from influxdb_client.domain.function_expression import FunctionExpression -from influxdb_client.domain.function_invocation_params import FunctionInvocationParams -from influxdb_client.domain.function_language import FunctionLanguage -from influxdb_client.domain.function_run import FunctionRun -from influxdb_client.domain.function_run_base import FunctionRunBase -from influxdb_client.domain.function_run_log import FunctionRunLog -from influxdb_client.domain.function_runs import FunctionRuns -from influxdb_client.domain.function_trigger_request import FunctionTriggerRequest -from influxdb_client.domain.function_trigger_response import FunctionTriggerResponse -from influxdb_client.domain.function_update_request import FunctionUpdateRequest -from influxdb_client.domain.functions import Functions from influxdb_client.domain.gauge_view_properties import GaugeViewProperties from influxdb_client.domain.greater_threshold import GreaterThreshold from influxdb_client.domain.http_notification_endpoint import HTTPNotificationEndpoint @@ -246,6 +234,12 @@ from influxdb_client.domain.scraper_target_request import ScraperTargetRequest from influxdb_client.domain.scraper_target_response import ScraperTargetResponse from influxdb_client.domain.scraper_target_responses import ScraperTargetResponses +from influxdb_client.domain.script import Script +from influxdb_client.domain.script_create_request import ScriptCreateRequest +from influxdb_client.domain.script_invocation_params import ScriptInvocationParams +from influxdb_client.domain.script_language import ScriptLanguage +from influxdb_client.domain.script_update_request import ScriptUpdateRequest +from influxdb_client.domain.scripts import Scripts from influxdb_client.domain.secret_keys import SecretKeys from influxdb_client.domain.secret_keys_response import SecretKeysResponse from influxdb_client.domain.single_stat_view_properties import SingleStatViewProperties diff --git a/influxdb_client/client/__init__.py b/influxdb_client/client/__init__.py index a549c2e1..5858de7f 100644 --- a/influxdb_client/client/__init__.py +++ b/influxdb_client/client/__init__.py @@ -20,8 +20,8 @@ from influxdb_client.service.dbr_ps_service import DBRPsService from influxdb_client.service.dashboards_service import DashboardsService from influxdb_client.service.delete_service import DeleteService -from influxdb_client.service.functions_service import FunctionsService from influxdb_client.service.health_service import HealthService +from influxdb_client.service.invocable_scripts_service import InvocableScriptsService from influxdb_client.service.labels_service import LabelsService from influxdb_client.service.notification_endpoints_service import NotificationEndpointsService from influxdb_client.service.notification_rules_service import NotificationRulesService diff --git a/influxdb_client/client/write/__init__.py b/influxdb_client/client/write/__init__.py index a549c2e1..5858de7f 100644 --- a/influxdb_client/client/write/__init__.py +++ b/influxdb_client/client/write/__init__.py @@ -20,8 +20,8 @@ from influxdb_client.service.dbr_ps_service import DBRPsService from influxdb_client.service.dashboards_service import DashboardsService from influxdb_client.service.delete_service import DeleteService -from influxdb_client.service.functions_service import FunctionsService from influxdb_client.service.health_service import HealthService +from influxdb_client.service.invocable_scripts_service import InvocableScriptsService from influxdb_client.service.labels_service import LabelsService from influxdb_client.service.notification_endpoints_service import NotificationEndpointsService from influxdb_client.service.notification_rules_service import NotificationRulesService diff --git a/influxdb_client/domain/__init__.py b/influxdb_client/domain/__init__.py index 4d33bed5..463fcb26 100644 --- a/influxdb_client/domain/__init__.py +++ b/influxdb_client/domain/__init__.py @@ -92,19 +92,7 @@ from influxdb_client.domain.flux_response import FluxResponse from influxdb_client.domain.flux_suggestion import FluxSuggestion from influxdb_client.domain.flux_suggestions import FluxSuggestions -from influxdb_client.domain.function import Function -from influxdb_client.domain.function_create_request import FunctionCreateRequest from influxdb_client.domain.function_expression import FunctionExpression -from influxdb_client.domain.function_invocation_params import FunctionInvocationParams -from influxdb_client.domain.function_language import FunctionLanguage -from influxdb_client.domain.function_run import FunctionRun -from influxdb_client.domain.function_run_base import FunctionRunBase -from influxdb_client.domain.function_run_log import FunctionRunLog -from influxdb_client.domain.function_runs import FunctionRuns -from influxdb_client.domain.function_trigger_request import FunctionTriggerRequest -from influxdb_client.domain.function_trigger_response import FunctionTriggerResponse -from influxdb_client.domain.function_update_request import FunctionUpdateRequest -from influxdb_client.domain.functions import Functions from influxdb_client.domain.gauge_view_properties import GaugeViewProperties from influxdb_client.domain.greater_threshold import GreaterThreshold from influxdb_client.domain.http_notification_endpoint import HTTPNotificationEndpoint @@ -211,6 +199,12 @@ from influxdb_client.domain.scraper_target_request import ScraperTargetRequest from influxdb_client.domain.scraper_target_response import ScraperTargetResponse from influxdb_client.domain.scraper_target_responses import ScraperTargetResponses +from influxdb_client.domain.script import Script +from influxdb_client.domain.script_create_request import ScriptCreateRequest +from influxdb_client.domain.script_invocation_params import ScriptInvocationParams +from influxdb_client.domain.script_language import ScriptLanguage +from influxdb_client.domain.script_update_request import ScriptUpdateRequest +from influxdb_client.domain.scripts import Scripts from influxdb_client.domain.secret_keys import SecretKeys from influxdb_client.domain.secret_keys_response import SecretKeysResponse from influxdb_client.domain.single_stat_view_properties import SingleStatViewProperties diff --git a/influxdb_client/domain/function_run.py b/influxdb_client/domain/function_run.py deleted file mode 100644 index 549a0d5d..00000000 --- a/influxdb_client/domain/function_run.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding: utf-8 - -""" -Influx OSS API Service. - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - -OpenAPI spec version: 2.0.0 -Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six -from influxdb_client.domain.function_run_base import FunctionRunBase - - -class FunctionRun(FunctionRunBase): - """NOTE: This class is auto generated by OpenAPI Generator. - - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - 'response': 'FunctionHTTPResponseNoData', - 'id': 'str', - 'status': 'str', - 'error': 'str', - 'logs': 'list[FunctionRunLog]', - 'started_at': 'datetime' - } - - attribute_map = { - 'response': 'response', - 'id': 'id', - 'status': 'status', - 'error': 'error', - 'logs': 'logs', - 'started_at': 'startedAt' - } - - def __init__(self, response=None, id=None, status=None, error=None, logs=None, started_at=None): # noqa: E501,D401,D403 - """FunctionRun - a model defined in OpenAPI.""" # noqa: E501 - FunctionRunBase.__init__(self, id=id, status=status, error=error, logs=logs, started_at=started_at) # noqa: E501 - - self._response = None - self.discriminator = None - - if response is not None: - self.response = response - - @property - def response(self): - """Get the response of this FunctionRun. - - :return: The response of this FunctionRun. - :rtype: FunctionHTTPResponseNoData - """ # noqa: E501 - return self._response - - @response.setter - def response(self, response): - """Set the response of this FunctionRun. - - :param response: The response of this FunctionRun. - :type: FunctionHTTPResponseNoData - """ # noqa: E501 - self._response = response - - def to_dict(self): - """Return the model properties as a dict.""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Return the string representation of the model.""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`.""" - return self.to_str() - - def __eq__(self, other): - """Return true if both objects are equal.""" - if not isinstance(other, FunctionRun): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Return true if both objects are not equal.""" - return not self == other diff --git a/influxdb_client/domain/function_run_base.py b/influxdb_client/domain/function_run_base.py deleted file mode 100644 index c574b518..00000000 --- a/influxdb_client/domain/function_run_base.py +++ /dev/null @@ -1,201 +0,0 @@ -# coding: utf-8 - -""" -Influx OSS API Service. - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - -OpenAPI spec version: 2.0.0 -Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FunctionRunBase(object): - """NOTE: This class is auto generated by OpenAPI Generator. - - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - 'id': 'str', - 'status': 'str', - 'error': 'str', - 'logs': 'list[FunctionRunLog]', - 'started_at': 'datetime' - } - - attribute_map = { - 'id': 'id', - 'status': 'status', - 'error': 'error', - 'logs': 'logs', - 'started_at': 'startedAt' - } - - def __init__(self, id=None, status=None, error=None, logs=None, started_at=None): # noqa: E501,D401,D403 - """FunctionRunBase - a model defined in OpenAPI.""" # noqa: E501 - self._id = None - self._status = None - self._error = None - self._logs = None - self._started_at = None - self.discriminator = None - - if id is not None: - self.id = id - if status is not None: - self.status = status - if error is not None: - self.error = error - if logs is not None: - self.logs = logs - if started_at is not None: - self.started_at = started_at - - @property - def id(self): - """Get the id of this FunctionRunBase. - - :return: The id of this FunctionRunBase. - :rtype: str - """ # noqa: E501 - return self._id - - @id.setter - def id(self, id): - """Set the id of this FunctionRunBase. - - :param id: The id of this FunctionRunBase. - :type: str - """ # noqa: E501 - self._id = id - - @property - def status(self): - """Get the status of this FunctionRunBase. - - :return: The status of this FunctionRunBase. - :rtype: str - """ # noqa: E501 - return self._status - - @status.setter - def status(self, status): - """Set the status of this FunctionRunBase. - - :param status: The status of this FunctionRunBase. - :type: str - """ # noqa: E501 - self._status = status - - @property - def error(self): - """Get the error of this FunctionRunBase. - - :return: The error of this FunctionRunBase. - :rtype: str - """ # noqa: E501 - return self._error - - @error.setter - def error(self, error): - """Set the error of this FunctionRunBase. - - :param error: The error of this FunctionRunBase. - :type: str - """ # noqa: E501 - self._error = error - - @property - def logs(self): - """Get the logs of this FunctionRunBase. - - :return: The logs of this FunctionRunBase. - :rtype: list[FunctionRunLog] - """ # noqa: E501 - return self._logs - - @logs.setter - def logs(self, logs): - """Set the logs of this FunctionRunBase. - - :param logs: The logs of this FunctionRunBase. - :type: list[FunctionRunLog] - """ # noqa: E501 - self._logs = logs - - @property - def started_at(self): - """Get the started_at of this FunctionRunBase. - - :return: The started_at of this FunctionRunBase. - :rtype: datetime - """ # noqa: E501 - return self._started_at - - @started_at.setter - def started_at(self, started_at): - """Set the started_at of this FunctionRunBase. - - :param started_at: The started_at of this FunctionRunBase. - :type: datetime - """ # noqa: E501 - self._started_at = started_at - - def to_dict(self): - """Return the model properties as a dict.""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Return the string representation of the model.""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`.""" - return self.to_str() - - def __eq__(self, other): - """Return true if both objects are equal.""" - if not isinstance(other, FunctionRunBase): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Return true if both objects are not equal.""" - return not self == other diff --git a/influxdb_client/domain/function_run_log.py b/influxdb_client/domain/function_run_log.py deleted file mode 100644 index 380cf8ac..00000000 --- a/influxdb_client/domain/function_run_log.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -""" -Influx OSS API Service. - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - -OpenAPI spec version: 2.0.0 -Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FunctionRunLog(object): - """NOTE: This class is auto generated by OpenAPI Generator. - - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - 'message': 'str', - 'timestamp': 'datetime', - 'severity': 'object' - } - - attribute_map = { - 'message': 'message', - 'timestamp': 'timestamp', - 'severity': 'severity' - } - - def __init__(self, message=None, timestamp=None, severity=None): # noqa: E501,D401,D403 - """FunctionRunLog - a model defined in OpenAPI.""" # noqa: E501 - self._message = None - self._timestamp = None - self._severity = None - self.discriminator = None - - if message is not None: - self.message = message - if timestamp is not None: - self.timestamp = timestamp - if severity is not None: - self.severity = severity - - @property - def message(self): - """Get the message of this FunctionRunLog. - - :return: The message of this FunctionRunLog. - :rtype: str - """ # noqa: E501 - return self._message - - @message.setter - def message(self, message): - """Set the message of this FunctionRunLog. - - :param message: The message of this FunctionRunLog. - :type: str - """ # noqa: E501 - self._message = message - - @property - def timestamp(self): - """Get the timestamp of this FunctionRunLog. - - :return: The timestamp of this FunctionRunLog. - :rtype: datetime - """ # noqa: E501 - return self._timestamp - - @timestamp.setter - def timestamp(self, timestamp): - """Set the timestamp of this FunctionRunLog. - - :param timestamp: The timestamp of this FunctionRunLog. - :type: datetime - """ # noqa: E501 - self._timestamp = timestamp - - @property - def severity(self): - """Get the severity of this FunctionRunLog. - - :return: The severity of this FunctionRunLog. - :rtype: object - """ # noqa: E501 - return self._severity - - @severity.setter - def severity(self, severity): - """Set the severity of this FunctionRunLog. - - :param severity: The severity of this FunctionRunLog. - :type: object - """ # noqa: E501 - self._severity = severity - - def to_dict(self): - """Return the model properties as a dict.""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Return the string representation of the model.""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`.""" - return self.to_str() - - def __eq__(self, other): - """Return true if both objects are equal.""" - if not isinstance(other, FunctionRunLog): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Return true if both objects are not equal.""" - return not self == other diff --git a/influxdb_client/domain/function_trigger_request.py b/influxdb_client/domain/function_trigger_request.py deleted file mode 100644 index e2013f10..00000000 --- a/influxdb_client/domain/function_trigger_request.py +++ /dev/null @@ -1,213 +0,0 @@ -# coding: utf-8 - -""" -Influx OSS API Service. - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - -OpenAPI spec version: 2.0.0 -Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six -from influxdb_client.domain.function_invocation_params import FunctionInvocationParams - - -class FunctionTriggerRequest(FunctionInvocationParams): - """NOTE: This class is auto generated by OpenAPI Generator. - - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - 'script': 'str', - 'method': 'str', - 'org_id': 'str', - 'org': 'str', - 'language': 'FunctionLanguage', - 'params': 'object' - } - - attribute_map = { - 'script': 'script', - 'method': 'method', - 'org_id': 'orgID', - 'org': 'org', - 'language': 'language', - 'params': 'params' - } - - def __init__(self, script=None, method=None, org_id=None, org=None, language=None, params=None): # noqa: E501,D401,D403 - """FunctionTriggerRequest - a model defined in OpenAPI.""" # noqa: E501 - FunctionInvocationParams.__init__(self, params=params) # noqa: E501 - - self._script = None - self._method = None - self._org_id = None - self._org = None - self._language = None - self.discriminator = None - - self.script = script - self.method = method - if org_id is not None: - self.org_id = org_id - if org is not None: - self.org = org - self.language = language - - @property - def script(self): - """Get the script of this FunctionTriggerRequest. - - script is script to be executed - - :return: The script of this FunctionTriggerRequest. - :rtype: str - """ # noqa: E501 - return self._script - - @script.setter - def script(self, script): - """Set the script of this FunctionTriggerRequest. - - script is script to be executed - - :param script: The script of this FunctionTriggerRequest. - :type: str - """ # noqa: E501 - if script is None: - raise ValueError("Invalid value for `script`, must not be `None`") # noqa: E501 - self._script = script - - @property - def method(self): - """Get the method of this FunctionTriggerRequest. - - :return: The method of this FunctionTriggerRequest. - :rtype: str - """ # noqa: E501 - return self._method - - @method.setter - def method(self, method): - """Set the method of this FunctionTriggerRequest. - - :param method: The method of this FunctionTriggerRequest. - :type: str - """ # noqa: E501 - if method is None: - raise ValueError("Invalid value for `method`, must not be `None`") # noqa: E501 - self._method = method - - @property - def org_id(self): - """Get the org_id of this FunctionTriggerRequest. - - :return: The org_id of this FunctionTriggerRequest. - :rtype: str - """ # noqa: E501 - return self._org_id - - @org_id.setter - def org_id(self, org_id): - """Set the org_id of this FunctionTriggerRequest. - - :param org_id: The org_id of this FunctionTriggerRequest. - :type: str - """ # noqa: E501 - self._org_id = org_id - - @property - def org(self): - """Get the org of this FunctionTriggerRequest. - - :return: The org of this FunctionTriggerRequest. - :rtype: str - """ # noqa: E501 - return self._org - - @org.setter - def org(self, org): - """Set the org of this FunctionTriggerRequest. - - :param org: The org of this FunctionTriggerRequest. - :type: str - """ # noqa: E501 - self._org = org - - @property - def language(self): - """Get the language of this FunctionTriggerRequest. - - :return: The language of this FunctionTriggerRequest. - :rtype: FunctionLanguage - """ # noqa: E501 - return self._language - - @language.setter - def language(self, language): - """Set the language of this FunctionTriggerRequest. - - :param language: The language of this FunctionTriggerRequest. - :type: FunctionLanguage - """ # noqa: E501 - if language is None: - raise ValueError("Invalid value for `language`, must not be `None`") # noqa: E501 - self._language = language - - def to_dict(self): - """Return the model properties as a dict.""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Return the string representation of the model.""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`.""" - return self.to_str() - - def __eq__(self, other): - """Return true if both objects are equal.""" - if not isinstance(other, FunctionTriggerRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Return true if both objects are not equal.""" - return not self == other diff --git a/influxdb_client/domain/function_trigger_response.py b/influxdb_client/domain/function_trigger_response.py deleted file mode 100644 index 5fa26406..00000000 --- a/influxdb_client/domain/function_trigger_response.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding: utf-8 - -""" -Influx OSS API Service. - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - -OpenAPI spec version: 2.0.0 -Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six -from influxdb_client.domain.function_run_base import FunctionRunBase - - -class FunctionTriggerResponse(FunctionRunBase): - """NOTE: This class is auto generated by OpenAPI Generator. - - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - 'response': 'FunctionHTTPResponse', - 'id': 'str', - 'status': 'str', - 'error': 'str', - 'logs': 'list[FunctionRunLog]', - 'started_at': 'datetime' - } - - attribute_map = { - 'response': 'response', - 'id': 'id', - 'status': 'status', - 'error': 'error', - 'logs': 'logs', - 'started_at': 'startedAt' - } - - def __init__(self, response=None, id=None, status=None, error=None, logs=None, started_at=None): # noqa: E501,D401,D403 - """FunctionTriggerResponse - a model defined in OpenAPI.""" # noqa: E501 - FunctionRunBase.__init__(self, id=id, status=status, error=error, logs=logs, started_at=started_at) # noqa: E501 - - self._response = None - self.discriminator = None - - if response is not None: - self.response = response - - @property - def response(self): - """Get the response of this FunctionTriggerResponse. - - :return: The response of this FunctionTriggerResponse. - :rtype: FunctionHTTPResponse - """ # noqa: E501 - return self._response - - @response.setter - def response(self, response): - """Set the response of this FunctionTriggerResponse. - - :param response: The response of this FunctionTriggerResponse. - :type: FunctionHTTPResponse - """ # noqa: E501 - self._response = response - - def to_dict(self): - """Return the model properties as a dict.""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Return the string representation of the model.""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`.""" - return self.to_str() - - def __eq__(self, other): - """Return true if both objects are equal.""" - if not isinstance(other, FunctionTriggerResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Return true if both objects are not equal.""" - return not self == other diff --git a/influxdb_client/domain/functions.py b/influxdb_client/domain/functions.py deleted file mode 100644 index 9f41701a..00000000 --- a/influxdb_client/domain/functions.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" -Influx OSS API Service. - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - -OpenAPI spec version: 2.0.0 -Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class Functions(object): - """NOTE: This class is auto generated by OpenAPI Generator. - - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - 'functions': 'list[Function]' - } - - attribute_map = { - 'functions': 'functions' - } - - def __init__(self, functions=None): # noqa: E501,D401,D403 - """Functions - a model defined in OpenAPI.""" # noqa: E501 - self._functions = None - self.discriminator = None - - if functions is not None: - self.functions = functions - - @property - def functions(self): - """Get the functions of this Functions. - - :return: The functions of this Functions. - :rtype: list[Function] - """ # noqa: E501 - return self._functions - - @functions.setter - def functions(self, functions): - """Set the functions of this Functions. - - :param functions: The functions of this Functions. - :type: list[Function] - """ # noqa: E501 - self._functions = functions - - def to_dict(self): - """Return the model properties as a dict.""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Return the string representation of the model.""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`.""" - return self.to_str() - - def __eq__(self, other): - """Return true if both objects are equal.""" - if not isinstance(other, Functions): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Return true if both objects are not equal.""" - return not self == other diff --git a/influxdb_client/domain/function.py b/influxdb_client/domain/script.py similarity index 75% rename from influxdb_client/domain/function.py rename to influxdb_client/domain/script.py index 7e0a6bdf..a6b5cb3d 100644 --- a/influxdb_client/domain/function.py +++ b/influxdb_client/domain/script.py @@ -16,7 +16,7 @@ import six -class Function(object): +class Script(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -37,7 +37,7 @@ class Function(object): 'description': 'str', 'org_id': 'str', 'script': 'str', - 'language': 'FunctionLanguage', + 'language': 'ScriptLanguage', 'url': 'str', 'created_at': 'datetime', 'updated_at': 'datetime' @@ -56,7 +56,7 @@ class Function(object): } def __init__(self, id=None, name=None, description=None, org_id=None, script=None, language=None, url=None, created_at=None, updated_at=None): # noqa: E501,D401,D403 - """Function - a model defined in OpenAPI.""" # noqa: E501 + """Script - a model defined in OpenAPI.""" # noqa: E501 self._id = None self._name = None self._description = None @@ -86,36 +86,36 @@ def __init__(self, id=None, name=None, description=None, org_id=None, script=Non @property def id(self): - """Get the id of this Function. + """Get the id of this Script. - :return: The id of this Function. + :return: The id of this Script. :rtype: str """ # noqa: E501 return self._id @id.setter def id(self, id): - """Set the id of this Function. + """Set the id of this Script. - :param id: The id of this Function. + :param id: The id of this Script. :type: str """ # noqa: E501 self._id = id @property def name(self): - """Get the name of this Function. + """Get the name of this Script. - :return: The name of this Function. + :return: The name of this Script. :rtype: str """ # noqa: E501 return self._name @name.setter def name(self, name): - """Set the name of this Function. + """Set the name of this Script. - :param name: The name of this Function. + :param name: The name of this Script. :type: str """ # noqa: E501 if name is None: @@ -124,36 +124,36 @@ def name(self, name): @property def description(self): - """Get the description of this Function. + """Get the description of this Script. - :return: The description of this Function. + :return: The description of this Script. :rtype: str """ # noqa: E501 return self._description @description.setter def description(self, description): - """Set the description of this Function. + """Set the description of this Script. - :param description: The description of this Function. + :param description: The description of this Script. :type: str """ # noqa: E501 self._description = description @property def org_id(self): - """Get the org_id of this Function. + """Get the org_id of this Script. - :return: The org_id of this Function. + :return: The org_id of this Script. :rtype: str """ # noqa: E501 return self._org_id @org_id.setter def org_id(self, org_id): - """Set the org_id of this Function. + """Set the org_id of this Script. - :param org_id: The org_id of this Function. + :param org_id: The org_id of this Script. :type: str """ # noqa: E501 if org_id is None: @@ -162,22 +162,22 @@ def org_id(self, org_id): @property def script(self): - """Get the script of this Function. + """Get the script of this Script. - script is script to be executed + script to be executed - :return: The script of this Function. + :return: The script of this Script. :rtype: str """ # noqa: E501 return self._script @script.setter def script(self, script): - """Set the script of this Function. + """Set the script of this Script. - script is script to be executed + script to be executed - :param script: The script of this Function. + :param script: The script of this Script. :type: str """ # noqa: E501 if script is None: @@ -186,76 +186,76 @@ def script(self, script): @property def language(self): - """Get the language of this Function. + """Get the language of this Script. - :return: The language of this Function. - :rtype: FunctionLanguage + :return: The language of this Script. + :rtype: ScriptLanguage """ # noqa: E501 return self._language @language.setter def language(self, language): - """Set the language of this Function. + """Set the language of this Script. - :param language: The language of this Function. - :type: FunctionLanguage + :param language: The language of this Script. + :type: ScriptLanguage """ # noqa: E501 self._language = language @property def url(self): - """Get the url of this Function. + """Get the url of this Script. invocation endpoint address - :return: The url of this Function. + :return: The url of this Script. :rtype: str """ # noqa: E501 return self._url @url.setter def url(self, url): - """Set the url of this Function. + """Set the url of this Script. invocation endpoint address - :param url: The url of this Function. + :param url: The url of this Script. :type: str """ # noqa: E501 self._url = url @property def created_at(self): - """Get the created_at of this Function. + """Get the created_at of this Script. - :return: The created_at of this Function. + :return: The created_at of this Script. :rtype: datetime """ # noqa: E501 return self._created_at @created_at.setter def created_at(self, created_at): - """Set the created_at of this Function. + """Set the created_at of this Script. - :param created_at: The created_at of this Function. + :param created_at: The created_at of this Script. :type: datetime """ # noqa: E501 self._created_at = created_at @property def updated_at(self): - """Get the updated_at of this Function. + """Get the updated_at of this Script. - :return: The updated_at of this Function. + :return: The updated_at of this Script. :rtype: datetime """ # noqa: E501 return self._updated_at @updated_at.setter def updated_at(self, updated_at): - """Set the updated_at of this Function. + """Set the updated_at of this Script. - :param updated_at: The updated_at of this Function. + :param updated_at: The updated_at of this Script. :type: datetime """ # noqa: E501 self._updated_at = updated_at @@ -294,7 +294,7 @@ def __repr__(self): def __eq__(self, other): """Return true if both objects are equal.""" - if not isinstance(other, Function): + if not isinstance(other, Script): return False return self.__dict__ == other.__dict__ diff --git a/influxdb_client/domain/function_create_request.py b/influxdb_client/domain/script_create_request.py similarity index 70% rename from influxdb_client/domain/function_create_request.py rename to influxdb_client/domain/script_create_request.py index c3dcae20..7adacc5e 100644 --- a/influxdb_client/domain/function_create_request.py +++ b/influxdb_client/domain/script_create_request.py @@ -16,7 +16,7 @@ import six -class FunctionCreateRequest(object): +class ScriptCreateRequest(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -36,7 +36,7 @@ class FunctionCreateRequest(object): 'description': 'str', 'org_id': 'str', 'script': 'str', - 'language': 'FunctionLanguage' + 'language': 'ScriptLanguage' } attribute_map = { @@ -48,7 +48,7 @@ class FunctionCreateRequest(object): } def __init__(self, name=None, description=None, org_id=None, script=None, language=None): # noqa: E501,D401,D403 - """FunctionCreateRequest - a model defined in OpenAPI.""" # noqa: E501 + """ScriptCreateRequest - a model defined in OpenAPI.""" # noqa: E501 self._name = None self._description = None self._org_id = None @@ -57,26 +57,29 @@ def __init__(self, name=None, description=None, org_id=None, script=None, langua self.discriminator = None self.name = name - if description is not None: - self.description = description + self.description = description self.org_id = org_id self.script = script self.language = language @property def name(self): - """Get the name of this FunctionCreateRequest. + """Get the name of this ScriptCreateRequest. - :return: The name of this FunctionCreateRequest. + The name of the script. The name must be unique within the organization. + + :return: The name of this ScriptCreateRequest. :rtype: str """ # noqa: E501 return self._name @name.setter def name(self, name): - """Set the name of this FunctionCreateRequest. + """Set the name of this ScriptCreateRequest. + + The name of the script. The name must be unique within the organization. - :param name: The name of this FunctionCreateRequest. + :param name: The name of this ScriptCreateRequest. :type: str """ # noqa: E501 if name is None: @@ -85,36 +88,38 @@ def name(self, name): @property def description(self): - """Get the description of this FunctionCreateRequest. + """Get the description of this ScriptCreateRequest. - :return: The description of this FunctionCreateRequest. + :return: The description of this ScriptCreateRequest. :rtype: str """ # noqa: E501 return self._description @description.setter def description(self, description): - """Set the description of this FunctionCreateRequest. + """Set the description of this ScriptCreateRequest. - :param description: The description of this FunctionCreateRequest. + :param description: The description of this ScriptCreateRequest. :type: str """ # noqa: E501 + if description is None: + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @property def org_id(self): - """Get the org_id of this FunctionCreateRequest. + """Get the org_id of this ScriptCreateRequest. - :return: The org_id of this FunctionCreateRequest. + :return: The org_id of this ScriptCreateRequest. :rtype: str """ # noqa: E501 return self._org_id @org_id.setter def org_id(self, org_id): - """Set the org_id of this FunctionCreateRequest. + """Set the org_id of this ScriptCreateRequest. - :param org_id: The org_id of this FunctionCreateRequest. + :param org_id: The org_id of this ScriptCreateRequest. :type: str """ # noqa: E501 if org_id is None: @@ -123,22 +128,22 @@ def org_id(self, org_id): @property def script(self): - """Get the script of this FunctionCreateRequest. + """Get the script of this ScriptCreateRequest. - script is script to be executed + The script to execute. - :return: The script of this FunctionCreateRequest. + :return: The script of this ScriptCreateRequest. :rtype: str """ # noqa: E501 return self._script @script.setter def script(self, script): - """Set the script of this FunctionCreateRequest. + """Set the script of this ScriptCreateRequest. - script is script to be executed + The script to execute. - :param script: The script of this FunctionCreateRequest. + :param script: The script of this ScriptCreateRequest. :type: str """ # noqa: E501 if script is None: @@ -147,19 +152,19 @@ def script(self, script): @property def language(self): - """Get the language of this FunctionCreateRequest. + """Get the language of this ScriptCreateRequest. - :return: The language of this FunctionCreateRequest. - :rtype: FunctionLanguage + :return: The language of this ScriptCreateRequest. + :rtype: ScriptLanguage """ # noqa: E501 return self._language @language.setter def language(self, language): - """Set the language of this FunctionCreateRequest. + """Set the language of this ScriptCreateRequest. - :param language: The language of this FunctionCreateRequest. - :type: FunctionLanguage + :param language: The language of this ScriptCreateRequest. + :type: ScriptLanguage """ # noqa: E501 if language is None: raise ValueError("Invalid value for `language`, must not be `None`") # noqa: E501 @@ -199,7 +204,7 @@ def __repr__(self): def __eq__(self, other): """Return true if both objects are equal.""" - if not isinstance(other, FunctionCreateRequest): + if not isinstance(other, ScriptCreateRequest): return False return self.__dict__ == other.__dict__ diff --git a/influxdb_client/domain/function_invocation_params.py b/influxdb_client/domain/script_invocation_params.py similarity index 85% rename from influxdb_client/domain/function_invocation_params.py rename to influxdb_client/domain/script_invocation_params.py index 599c3940..1299b94d 100644 --- a/influxdb_client/domain/function_invocation_params.py +++ b/influxdb_client/domain/script_invocation_params.py @@ -16,7 +16,7 @@ import six -class FunctionInvocationParams(object): +class ScriptInvocationParams(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -40,7 +40,7 @@ class FunctionInvocationParams(object): } def __init__(self, params=None): # noqa: E501,D401,D403 - """FunctionInvocationParams - a model defined in OpenAPI.""" # noqa: E501 + """ScriptInvocationParams - a model defined in OpenAPI.""" # noqa: E501 self._params = None self.discriminator = None @@ -49,18 +49,18 @@ def __init__(self, params=None): # noqa: E501,D401,D403 @property def params(self): - """Get the params of this FunctionInvocationParams. + """Get the params of this ScriptInvocationParams. - :return: The params of this FunctionInvocationParams. + :return: The params of this ScriptInvocationParams. :rtype: object """ # noqa: E501 return self._params @params.setter def params(self, params): - """Set the params of this FunctionInvocationParams. + """Set the params of this ScriptInvocationParams. - :param params: The params of this FunctionInvocationParams. + :param params: The params of this ScriptInvocationParams. :type: object """ # noqa: E501 self._params = params @@ -99,7 +99,7 @@ def __repr__(self): def __eq__(self, other): """Return true if both objects are equal.""" - if not isinstance(other, FunctionInvocationParams): + if not isinstance(other, ScriptInvocationParams): return False return self.__dict__ == other.__dict__ diff --git a/influxdb_client/domain/function_language.py b/influxdb_client/domain/script_language.py similarity index 91% rename from influxdb_client/domain/function_language.py rename to influxdb_client/domain/script_language.py index d51fbe7c..b3ca3ab5 100644 --- a/influxdb_client/domain/function_language.py +++ b/influxdb_client/domain/script_language.py @@ -16,7 +16,7 @@ import six -class FunctionLanguage(object): +class ScriptLanguage(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -27,7 +27,6 @@ class FunctionLanguage(object): """ allowed enum values """ - PYTHON = "python" FLUX = "flux" """ @@ -44,7 +43,7 @@ class FunctionLanguage(object): } def __init__(self): # noqa: E501,D401,D403 - """FunctionLanguage - a model defined in OpenAPI.""" # noqa: E501 self.discriminator = None + """ScriptLanguage - a model defined in OpenAPI.""" # noqa: E501 self.discriminator = None def to_dict(self): """Return the model properties as a dict.""" @@ -80,7 +79,7 @@ def __repr__(self): def __eq__(self, other): """Return true if both objects are equal.""" - if not isinstance(other, FunctionLanguage): + if not isinstance(other, ScriptLanguage): return False return self.__dict__ == other.__dict__ diff --git a/influxdb_client/domain/function_update_request.py b/influxdb_client/domain/script_update_request.py similarity index 79% rename from influxdb_client/domain/function_update_request.py rename to influxdb_client/domain/script_update_request.py index 32094d2a..b373aeda 100644 --- a/influxdb_client/domain/function_update_request.py +++ b/influxdb_client/domain/script_update_request.py @@ -16,7 +16,7 @@ import six -class FunctionUpdateRequest(object): +class ScriptUpdateRequest(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -44,7 +44,7 @@ class FunctionUpdateRequest(object): } def __init__(self, name=None, description=None, script=None): # noqa: E501,D401,D403 - """FunctionUpdateRequest - a model defined in OpenAPI.""" # noqa: E501 + """ScriptUpdateRequest - a model defined in OpenAPI.""" # noqa: E501 self._name = None self._description = None self._script = None @@ -59,58 +59,58 @@ def __init__(self, name=None, description=None, script=None): # noqa: E501,D401 @property def name(self): - """Get the name of this FunctionUpdateRequest. + """Get the name of this ScriptUpdateRequest. - :return: The name of this FunctionUpdateRequest. + :return: The name of this ScriptUpdateRequest. :rtype: str """ # noqa: E501 return self._name @name.setter def name(self, name): - """Set the name of this FunctionUpdateRequest. + """Set the name of this ScriptUpdateRequest. - :param name: The name of this FunctionUpdateRequest. + :param name: The name of this ScriptUpdateRequest. :type: str """ # noqa: E501 self._name = name @property def description(self): - """Get the description of this FunctionUpdateRequest. + """Get the description of this ScriptUpdateRequest. - :return: The description of this FunctionUpdateRequest. + :return: The description of this ScriptUpdateRequest. :rtype: str """ # noqa: E501 return self._description @description.setter def description(self, description): - """Set the description of this FunctionUpdateRequest. + """Set the description of this ScriptUpdateRequest. - :param description: The description of this FunctionUpdateRequest. + :param description: The description of this ScriptUpdateRequest. :type: str """ # noqa: E501 self._description = description @property def script(self): - """Get the script of this FunctionUpdateRequest. + """Get the script of this ScriptUpdateRequest. script is script to be executed - :return: The script of this FunctionUpdateRequest. + :return: The script of this ScriptUpdateRequest. :rtype: str """ # noqa: E501 return self._script @script.setter def script(self, script): - """Set the script of this FunctionUpdateRequest. + """Set the script of this ScriptUpdateRequest. script is script to be executed - :param script: The script of this FunctionUpdateRequest. + :param script: The script of this ScriptUpdateRequest. :type: str """ # noqa: E501 self._script = script @@ -149,7 +149,7 @@ def __repr__(self): def __eq__(self, other): """Return true if both objects are equal.""" - if not isinstance(other, FunctionUpdateRequest): + if not isinstance(other, ScriptUpdateRequest): return False return self.__dict__ == other.__dict__ diff --git a/influxdb_client/domain/function_runs.py b/influxdb_client/domain/scripts.py similarity index 75% rename from influxdb_client/domain/function_runs.py rename to influxdb_client/domain/scripts.py index 091d3ecc..1f5b0f12 100644 --- a/influxdb_client/domain/function_runs.py +++ b/influxdb_client/domain/scripts.py @@ -16,7 +16,7 @@ import six -class FunctionRuns(object): +class Scripts(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -32,38 +32,38 @@ class FunctionRuns(object): and the value is json key in definition. """ openapi_types = { - 'runs': 'list[FunctionRun]' + 'scripts': 'list[Script]' } attribute_map = { - 'runs': 'runs' + 'scripts': 'scripts' } - def __init__(self, runs=None): # noqa: E501,D401,D403 - """FunctionRuns - a model defined in OpenAPI.""" # noqa: E501 - self._runs = None + def __init__(self, scripts=None): # noqa: E501,D401,D403 + """Scripts - a model defined in OpenAPI.""" # noqa: E501 + self._scripts = None self.discriminator = None - if runs is not None: - self.runs = runs + if scripts is not None: + self.scripts = scripts @property - def runs(self): - """Get the runs of this FunctionRuns. + def scripts(self): + """Get the scripts of this Scripts. - :return: The runs of this FunctionRuns. - :rtype: list[FunctionRun] + :return: The scripts of this Scripts. + :rtype: list[Script] """ # noqa: E501 - return self._runs + return self._scripts - @runs.setter - def runs(self, runs): - """Set the runs of this FunctionRuns. + @scripts.setter + def scripts(self, scripts): + """Set the scripts of this Scripts. - :param runs: The runs of this FunctionRuns. - :type: list[FunctionRun] + :param scripts: The scripts of this Scripts. + :type: list[Script] """ # noqa: E501 - self._runs = runs + self._scripts = scripts def to_dict(self): """Return the model properties as a dict.""" @@ -99,7 +99,7 @@ def __repr__(self): def __eq__(self, other): """Return true if both objects are equal.""" - if not isinstance(other, FunctionRuns): + if not isinstance(other, Scripts): return False return self.__dict__ == other.__dict__ diff --git a/influxdb_client/service/__init__.py b/influxdb_client/service/__init__.py index a549c2e1..5858de7f 100644 --- a/influxdb_client/service/__init__.py +++ b/influxdb_client/service/__init__.py @@ -20,8 +20,8 @@ from influxdb_client.service.dbr_ps_service import DBRPsService from influxdb_client.service.dashboards_service import DashboardsService from influxdb_client.service.delete_service import DeleteService -from influxdb_client.service.functions_service import FunctionsService from influxdb_client.service.health_service import HealthService +from influxdb_client.service.invocable_scripts_service import InvocableScriptsService from influxdb_client.service.labels_service import LabelsService from influxdb_client.service.notification_endpoints_service import NotificationEndpointsService from influxdb_client.service.notification_rules_service import NotificationRulesService diff --git a/influxdb_client/service/functions_service.py b/influxdb_client/service/functions_service.py deleted file mode 100644 index 6f21b5ae..00000000 --- a/influxdb_client/service/functions_service.py +++ /dev/null @@ -1,1093 +0,0 @@ -# coding: utf-8 - -""" -Influx OSS API Service. - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - -OpenAPI spec version: 2.0.0 -Generated by: https://openapi-generator.tech -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - - -class FunctionsService(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): # noqa: E501,D401,D403 - """FunctionsService - a operation defined in OpenAPI.""" - if api_client is None: - raise ValueError("Invalid value for `api_client`, must be defined.") - self.api_client = api_client - - def delete_functions_id(self, function_id, **kwargs): # noqa: E501,D401,D403 - """Delete a function. - - Deletes a function and all associated records - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_functions_id(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: The ID of the function to delete. (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.delete_functions_id_with_http_info(function_id, **kwargs) # noqa: E501 - else: - (data) = self.delete_functions_id_with_http_info(function_id, **kwargs) # noqa: E501 - return data - - def delete_functions_id_with_http_info(self, function_id, **kwargs): # noqa: E501,D401,D403 - """Delete a function. - - Deletes a function and all associated records - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_functions_id_with_http_info(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: The ID of the function to delete. (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - local_var_params = locals() - - all_params = ['function_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - all_params.append('urlopen_kw') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_functions_id" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in local_var_params or - local_var_params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `delete_functions_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in local_var_params: - path_params['functionID'] = local_var_params['function_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - # urlopen optional setting - urlopen_kw = None - if 'urlopen_kw' in kwargs: - urlopen_kw = kwargs['urlopen_kw'] - - return self.api_client.call_api( - '/api/v2/functions/{functionID}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats, - urlopen_kw=urlopen_kw) - - def get_functions(self, **kwargs): # noqa: E501,D401,D403 - """List all Functions. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_functions(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str org: The name of the organization. - :param str org_id: The organization ID. - :param int limit: The number of functions to return - :param int offset: Offset for pagination - :return: Functions - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_functions_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.get_functions_with_http_info(**kwargs) # noqa: E501 - return data - - def get_functions_with_http_info(self, **kwargs): # noqa: E501,D401,D403 - """List all Functions. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_functions_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str org: The name of the organization. - :param str org_id: The organization ID. - :param int limit: The number of functions to return - :param int offset: Offset for pagination - :return: Functions - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - local_var_params = locals() - - all_params = ['org', 'org_id', 'limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - all_params.append('urlopen_kw') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_functions" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'org' in local_var_params: - query_params.append(('org', local_var_params['org'])) # noqa: E501 - if 'org_id' in local_var_params: - query_params.append(('orgID', local_var_params['org_id'])) # noqa: E501 - if 'limit' in local_var_params: - query_params.append(('limit', local_var_params['limit'])) # noqa: E501 - if 'offset' in local_var_params: - query_params.append(('offset', local_var_params['offset'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - # urlopen optional setting - urlopen_kw = None - if 'urlopen_kw' in kwargs: - urlopen_kw = kwargs['urlopen_kw'] - - return self.api_client.call_api( - '/api/v2/functions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Functions', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats, - urlopen_kw=urlopen_kw) - - def get_functions_id(self, function_id, **kwargs): # noqa: E501,D401,D403 - """Retrieve a function. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_functions_id(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: The function ID. (required) - :return: Function - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_functions_id_with_http_info(function_id, **kwargs) # noqa: E501 - else: - (data) = self.get_functions_id_with_http_info(function_id, **kwargs) # noqa: E501 - return data - - def get_functions_id_with_http_info(self, function_id, **kwargs): # noqa: E501,D401,D403 - """Retrieve a function. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_functions_id_with_http_info(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: The function ID. (required) - :return: Function - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - local_var_params = locals() - - all_params = ['function_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - all_params.append('urlopen_kw') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_functions_id" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in local_var_params or - local_var_params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `get_functions_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in local_var_params: - path_params['functionID'] = local_var_params['function_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - # urlopen optional setting - urlopen_kw = None - if 'urlopen_kw' in kwargs: - urlopen_kw = kwargs['urlopen_kw'] - - return self.api_client.call_api( - '/api/v2/functions/{functionID}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Function', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats, - urlopen_kw=urlopen_kw) - - def get_functions_id_invoke(self, function_id, **kwargs): # noqa: E501,D401,D403 - """Manually invoke a function with params in query. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_functions_id_invoke(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: (required) - :param dict(str, object) params: - :return: str - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_functions_id_invoke_with_http_info(function_id, **kwargs) # noqa: E501 - else: - (data) = self.get_functions_id_invoke_with_http_info(function_id, **kwargs) # noqa: E501 - return data - - def get_functions_id_invoke_with_http_info(self, function_id, **kwargs): # noqa: E501,D401,D403 - """Manually invoke a function with params in query. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_functions_id_invoke_with_http_info(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: (required) - :param dict(str, object) params: - :return: str - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - local_var_params = locals() - - all_params = ['function_id', 'params'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - all_params.append('urlopen_kw') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_functions_id_invoke" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in local_var_params or - local_var_params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `get_functions_id_invoke`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in local_var_params: - path_params['functionID'] = local_var_params['function_id'] # noqa: E501 - - query_params = [] - if 'params' in local_var_params: - query_params.append(('params', local_var_params['params'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - # urlopen optional setting - urlopen_kw = None - if 'urlopen_kw' in kwargs: - urlopen_kw = kwargs['urlopen_kw'] - - return self.api_client.call_api( - '/api/v2/functions/{functionID}/invoke', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='str', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats, - urlopen_kw=urlopen_kw) - - def get_functions_id_runs(self, function_id, **kwargs): # noqa: E501,D401,D403 - """List runs for a function. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_functions_id_runs(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: The ID of the function to get runs for. (required) - :param int limit: The number of functions to return - :param int offset: Offset for pagination - :return: FunctionRuns - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_functions_id_runs_with_http_info(function_id, **kwargs) # noqa: E501 - else: - (data) = self.get_functions_id_runs_with_http_info(function_id, **kwargs) # noqa: E501 - return data - - def get_functions_id_runs_with_http_info(self, function_id, **kwargs): # noqa: E501,D401,D403 - """List runs for a function. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_functions_id_runs_with_http_info(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: The ID of the function to get runs for. (required) - :param int limit: The number of functions to return - :param int offset: Offset for pagination - :return: FunctionRuns - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - local_var_params = locals() - - all_params = ['function_id', 'limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - all_params.append('urlopen_kw') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_functions_id_runs" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in local_var_params or - local_var_params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `get_functions_id_runs`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in local_var_params: - path_params['functionID'] = local_var_params['function_id'] # noqa: E501 - - query_params = [] - if 'limit' in local_var_params: - query_params.append(('limit', local_var_params['limit'])) # noqa: E501 - if 'offset' in local_var_params: - query_params.append(('offset', local_var_params['offset'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - # urlopen optional setting - urlopen_kw = None - if 'urlopen_kw' in kwargs: - urlopen_kw = kwargs['urlopen_kw'] - - return self.api_client.call_api( - '/api/v2/functions/{functionID}/runs', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionRuns', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats, - urlopen_kw=urlopen_kw) - - def get_functions_id_runs_id(self, function_id, run_id, **kwargs): # noqa: E501,D401,D403 - """Retrieve a single run for a function. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_functions_id_runs_id(function_id, run_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: The function ID. (required) - :param str run_id: The run ID. (required) - :return: FunctionRun - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_functions_id_runs_id_with_http_info(function_id, run_id, **kwargs) # noqa: E501 - else: - (data) = self.get_functions_id_runs_id_with_http_info(function_id, run_id, **kwargs) # noqa: E501 - return data - - def get_functions_id_runs_id_with_http_info(self, function_id, run_id, **kwargs): # noqa: E501,D401,D403 - """Retrieve a single run for a function. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_functions_id_runs_id_with_http_info(function_id, run_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: The function ID. (required) - :param str run_id: The run ID. (required) - :return: FunctionRun - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - local_var_params = locals() - - all_params = ['function_id', 'run_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - all_params.append('urlopen_kw') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_functions_id_runs_id" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in local_var_params or - local_var_params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `get_functions_id_runs_id`") # noqa: E501 - # verify the required parameter 'run_id' is set - if ('run_id' not in local_var_params or - local_var_params['run_id'] is None): - raise ValueError("Missing the required parameter `run_id` when calling `get_functions_id_runs_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in local_var_params: - path_params['functionID'] = local_var_params['function_id'] # noqa: E501 - if 'run_id' in local_var_params: - path_params['runID'] = local_var_params['run_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - # urlopen optional setting - urlopen_kw = None - if 'urlopen_kw' in kwargs: - urlopen_kw = kwargs['urlopen_kw'] - - return self.api_client.call_api( - '/api/v2/functions/{functionID}/runs/{runID}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionRun', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats, - urlopen_kw=urlopen_kw) - - def patch_functions_id(self, function_id, function_update_request, **kwargs): # noqa: E501,D401,D403 - """Update a function. - - Update a function - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.patch_functions_id(function_id, function_update_request, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: The function ID. (required) - :param FunctionUpdateRequest function_update_request: Function update to apply (required) - :return: Function - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.patch_functions_id_with_http_info(function_id, function_update_request, **kwargs) # noqa: E501 - else: - (data) = self.patch_functions_id_with_http_info(function_id, function_update_request, **kwargs) # noqa: E501 - return data - - def patch_functions_id_with_http_info(self, function_id, function_update_request, **kwargs): # noqa: E501,D401,D403 - """Update a function. - - Update a function - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.patch_functions_id_with_http_info(function_id, function_update_request, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: The function ID. (required) - :param FunctionUpdateRequest function_update_request: Function update to apply (required) - :return: Function - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - local_var_params = locals() - - all_params = ['function_id', 'function_update_request'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - all_params.append('urlopen_kw') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method patch_functions_id" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in local_var_params or - local_var_params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `patch_functions_id`") # noqa: E501 - # verify the required parameter 'function_update_request' is set - if ('function_update_request' not in local_var_params or - local_var_params['function_update_request'] is None): - raise ValueError("Missing the required parameter `function_update_request` when calling `patch_functions_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in local_var_params: - path_params['functionID'] = local_var_params['function_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'function_update_request' in local_var_params: - body_params = local_var_params['function_update_request'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - # urlopen optional setting - urlopen_kw = None - if 'urlopen_kw' in kwargs: - urlopen_kw = kwargs['urlopen_kw'] - - return self.api_client.call_api( - '/api/v2/functions/{functionID}', 'PATCH', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Function', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats, - urlopen_kw=urlopen_kw) - - def post_functions(self, function_create_request, **kwargs): # noqa: E501,D401,D403 - """Create a new function. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.post_functions(function_create_request, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionCreateRequest function_create_request: Function to create (required) - :return: Function - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.post_functions_with_http_info(function_create_request, **kwargs) # noqa: E501 - else: - (data) = self.post_functions_with_http_info(function_create_request, **kwargs) # noqa: E501 - return data - - def post_functions_with_http_info(self, function_create_request, **kwargs): # noqa: E501,D401,D403 - """Create a new function. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.post_functions_with_http_info(function_create_request, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionCreateRequest function_create_request: Function to create (required) - :return: Function - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - local_var_params = locals() - - all_params = ['function_create_request'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - all_params.append('urlopen_kw') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method post_functions" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'function_create_request' is set - if ('function_create_request' not in local_var_params or - local_var_params['function_create_request'] is None): - raise ValueError("Missing the required parameter `function_create_request` when calling `post_functions`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'function_create_request' in local_var_params: - body_params = local_var_params['function_create_request'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - # urlopen optional setting - urlopen_kw = None - if 'urlopen_kw' in kwargs: - urlopen_kw = kwargs['urlopen_kw'] - - return self.api_client.call_api( - '/api/v2/functions', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Function', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats, - urlopen_kw=urlopen_kw) - - def post_functions_id_invoke(self, function_id, **kwargs): # noqa: E501,D401,D403 - """Manually invoke a function with params in request body. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.post_functions_id_invoke(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: (required) - :param FunctionInvocationParams function_invocation_params: - :return: str - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.post_functions_id_invoke_with_http_info(function_id, **kwargs) # noqa: E501 - else: - (data) = self.post_functions_id_invoke_with_http_info(function_id, **kwargs) # noqa: E501 - return data - - def post_functions_id_invoke_with_http_info(self, function_id, **kwargs): # noqa: E501,D401,D403 - """Manually invoke a function with params in request body. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.post_functions_id_invoke_with_http_info(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str function_id: (required) - :param FunctionInvocationParams function_invocation_params: - :return: str - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - local_var_params = locals() - - all_params = ['function_id', 'function_invocation_params'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - all_params.append('urlopen_kw') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method post_functions_id_invoke" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in local_var_params or - local_var_params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `post_functions_id_invoke`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in local_var_params: - path_params['functionID'] = local_var_params['function_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'function_invocation_params' in local_var_params: - body_params = local_var_params['function_invocation_params'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - # urlopen optional setting - urlopen_kw = None - if 'urlopen_kw' in kwargs: - urlopen_kw = kwargs['urlopen_kw'] - - return self.api_client.call_api( - '/api/v2/functions/{functionID}/invoke', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='str', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats, - urlopen_kw=urlopen_kw) - - def post_functions_trigger(self, function_trigger_request, **kwargs): # noqa: E501,D401,D403 - """Manually trigger a function without creating an associated function resource. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.post_functions_trigger(function_trigger_request, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionTriggerRequest function_trigger_request: Function to be triggered (required) - :return: FunctionTriggerResponse - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.post_functions_trigger_with_http_info(function_trigger_request, **kwargs) # noqa: E501 - else: - (data) = self.post_functions_trigger_with_http_info(function_trigger_request, **kwargs) # noqa: E501 - return data - - def post_functions_trigger_with_http_info(self, function_trigger_request, **kwargs): # noqa: E501,D401,D403 - """Manually trigger a function without creating an associated function resource. - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.post_functions_trigger_with_http_info(function_trigger_request, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionTriggerRequest function_trigger_request: Function to be triggered (required) - :return: FunctionTriggerResponse - If the method is called asynchronously, - returns the request thread. - """ # noqa: E501 - local_var_params = locals() - - all_params = ['function_trigger_request'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - all_params.append('urlopen_kw') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method post_functions_trigger" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'function_trigger_request' is set - if ('function_trigger_request' not in local_var_params or - local_var_params['function_trigger_request'] is None): - raise ValueError("Missing the required parameter `function_trigger_request` when calling `post_functions_trigger`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'function_trigger_request' in local_var_params: - body_params = local_var_params['function_trigger_request'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - # urlopen optional setting - urlopen_kw = None - if 'urlopen_kw' in kwargs: - urlopen_kw = kwargs['urlopen_kw'] - - return self.api_client.call_api( - '/api/v2/functions/trigger', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionTriggerResponse', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats, - urlopen_kw=urlopen_kw) diff --git a/influxdb_client/service/invocable_scripts_service.py b/influxdb_client/service/invocable_scripts_service.py new file mode 100644 index 00000000..dca8bff2 --- /dev/null +++ b/influxdb_client/service/invocable_scripts_service.py @@ -0,0 +1,665 @@ +# coding: utf-8 + +""" +Influx OSS API Service. + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + +OpenAPI spec version: 2.0.0 +Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + + +class InvocableScriptsService(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): # noqa: E501,D401,D403 + """InvocableScriptsService - a operation defined in OpenAPI.""" + if api_client is None: + raise ValueError("Invalid value for `api_client`, must be defined.") + self.api_client = api_client + + def delete_scripts_id(self, script_id, **kwargs): # noqa: E501,D401,D403 + """Delete a script. + + Deletes a script and all associated records. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_scripts_id(script_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str script_id: The ID of the script to delete. (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_scripts_id_with_http_info(script_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_scripts_id_with_http_info(script_id, **kwargs) # noqa: E501 + return data + + def delete_scripts_id_with_http_info(self, script_id, **kwargs): # noqa: E501,D401,D403 + """Delete a script. + + Deletes a script and all associated records. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_scripts_id_with_http_info(script_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str script_id: The ID of the script to delete. (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['script_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_scripts_id" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'script_id' is set + if ('script_id' not in local_var_params or + local_var_params['script_id'] is None): + raise ValueError("Missing the required parameter `script_id` when calling `delete_scripts_id`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'script_id' in local_var_params: + path_params['scriptID'] = local_var_params['script_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/scripts/{scriptID}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def get_scripts(self, **kwargs): # noqa: E501,D401,D403 + """List scripts. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scripts(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: The number of scripts to return. + :param int offset: The offset for pagination. + :return: Scripts + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_scripts_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_scripts_with_http_info(**kwargs) # noqa: E501 + return data + + def get_scripts_with_http_info(self, **kwargs): # noqa: E501,D401,D403 + """List scripts. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scripts_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: The number of scripts to return. + :param int offset: The offset for pagination. + :return: Scripts + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['limit', 'offset'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_scripts" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'limit' in local_var_params: + query_params.append(('limit', local_var_params['limit'])) # noqa: E501 + if 'offset' in local_var_params: + query_params.append(('offset', local_var_params['offset'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/scripts', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Scripts', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def get_scripts_id(self, script_id, **kwargs): # noqa: E501,D401,D403 + """Retrieve a script. + + Uses script ID to retrieve details of an invocable script. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scripts_id(script_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str script_id: The script ID. (required) + :return: Script + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_scripts_id_with_http_info(script_id, **kwargs) # noqa: E501 + else: + (data) = self.get_scripts_id_with_http_info(script_id, **kwargs) # noqa: E501 + return data + + def get_scripts_id_with_http_info(self, script_id, **kwargs): # noqa: E501,D401,D403 + """Retrieve a script. + + Uses script ID to retrieve details of an invocable script. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scripts_id_with_http_info(script_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str script_id: The script ID. (required) + :return: Script + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['script_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_scripts_id" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'script_id' is set + if ('script_id' not in local_var_params or + local_var_params['script_id'] is None): + raise ValueError("Missing the required parameter `script_id` when calling `get_scripts_id`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'script_id' in local_var_params: + path_params['scriptID'] = local_var_params['script_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/scripts/{scriptID}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Script', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def patch_scripts_id(self, script_id, script_update_request, **kwargs): # noqa: E501,D401,D403 + """Update a script. + + Updates properties (`name`, `description`, and `script`) of an invocable script. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.patch_scripts_id(script_id, script_update_request, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str script_id: The script ID. (required) + :param ScriptUpdateRequest script_update_request: Script update to apply (required) + :return: Script + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.patch_scripts_id_with_http_info(script_id, script_update_request, **kwargs) # noqa: E501 + else: + (data) = self.patch_scripts_id_with_http_info(script_id, script_update_request, **kwargs) # noqa: E501 + return data + + def patch_scripts_id_with_http_info(self, script_id, script_update_request, **kwargs): # noqa: E501,D401,D403 + """Update a script. + + Updates properties (`name`, `description`, and `script`) of an invocable script. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.patch_scripts_id_with_http_info(script_id, script_update_request, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str script_id: The script ID. (required) + :param ScriptUpdateRequest script_update_request: Script update to apply (required) + :return: Script + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['script_id', 'script_update_request'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method patch_scripts_id" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'script_id' is set + if ('script_id' not in local_var_params or + local_var_params['script_id'] is None): + raise ValueError("Missing the required parameter `script_id` when calling `patch_scripts_id`") # noqa: E501 + # verify the required parameter 'script_update_request' is set + if ('script_update_request' not in local_var_params or + local_var_params['script_update_request'] is None): + raise ValueError("Missing the required parameter `script_update_request` when calling `patch_scripts_id`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'script_id' in local_var_params: + path_params['scriptID'] = local_var_params['script_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'script_update_request' in local_var_params: + body_params = local_var_params['script_update_request'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/scripts/{scriptID}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Script', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def post_scripts(self, script_create_request, **kwargs): # noqa: E501,D401,D403 + """Create a script. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_scripts(script_create_request, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ScriptCreateRequest script_create_request: The script to create. (required) + :return: Script + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_scripts_with_http_info(script_create_request, **kwargs) # noqa: E501 + else: + (data) = self.post_scripts_with_http_info(script_create_request, **kwargs) # noqa: E501 + return data + + def post_scripts_with_http_info(self, script_create_request, **kwargs): # noqa: E501,D401,D403 + """Create a script. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_scripts_with_http_info(script_create_request, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ScriptCreateRequest script_create_request: The script to create. (required) + :return: Script + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['script_create_request'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_scripts" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'script_create_request' is set + if ('script_create_request' not in local_var_params or + local_var_params['script_create_request'] is None): + raise ValueError("Missing the required parameter `script_create_request` when calling `post_scripts`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'script_create_request' in local_var_params: + body_params = local_var_params['script_create_request'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/scripts', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Script', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) + + def post_scripts_id_invoke(self, script_id, **kwargs): # noqa: E501,D401,D403 + """Invoke a script. + + Invokes a script and substitutes `params` keys referenced in the script with `params` key-values sent in the request body. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_scripts_id_invoke(script_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str script_id: (required) + :param ScriptInvocationParams script_invocation_params: + :return: str + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_scripts_id_invoke_with_http_info(script_id, **kwargs) # noqa: E501 + else: + (data) = self.post_scripts_id_invoke_with_http_info(script_id, **kwargs) # noqa: E501 + return data + + def post_scripts_id_invoke_with_http_info(self, script_id, **kwargs): # noqa: E501,D401,D403 + """Invoke a script. + + Invokes a script and substitutes `params` keys referenced in the script with `params` key-values sent in the request body. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_scripts_id_invoke_with_http_info(script_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str script_id: (required) + :param ScriptInvocationParams script_invocation_params: + :return: str + If the method is called asynchronously, + returns the request thread. + """ # noqa: E501 + local_var_params = locals() + + all_params = ['script_id', 'script_invocation_params'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('urlopen_kw') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_scripts_id_invoke" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'script_id' is set + if ('script_id' not in local_var_params or + local_var_params['script_id'] is None): + raise ValueError("Missing the required parameter `script_id` when calling `post_scripts_id_invoke`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'script_id' in local_var_params: + path_params['scriptID'] = local_var_params['script_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'script_invocation_params' in local_var_params: + body_params = local_var_params['script_invocation_params'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + # urlopen optional setting + urlopen_kw = None + if 'urlopen_kw' in kwargs: + urlopen_kw = kwargs['urlopen_kw'] + + return self.api_client.call_api( + '/api/v2/scripts/{scriptID}/invoke', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + urlopen_kw=urlopen_kw) diff --git a/tests/__init__.py b/tests/__init__.py index a549c2e1..5858de7f 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -20,8 +20,8 @@ from influxdb_client.service.dbr_ps_service import DBRPsService from influxdb_client.service.dashboards_service import DashboardsService from influxdb_client.service.delete_service import DeleteService -from influxdb_client.service.functions_service import FunctionsService from influxdb_client.service.health_service import HealthService +from influxdb_client.service.invocable_scripts_service import InvocableScriptsService from influxdb_client.service.labels_service import LabelsService from influxdb_client.service.notification_endpoints_service import NotificationEndpointsService from influxdb_client.service.notification_rules_service import NotificationRulesService From b00625d9942978036840ff0fe0532ae03b8de3fc Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Mon, 25 Oct 2021 07:55:51 +0200 Subject: [PATCH 7/8] fix: code style --- influxdb_client/service/invocable_scripts_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/influxdb_client/service/invocable_scripts_service.py b/influxdb_client/service/invocable_scripts_service.py index dca8bff2..50a5c4f6 100644 --- a/influxdb_client/service/invocable_scripts_service.py +++ b/influxdb_client/service/invocable_scripts_service.py @@ -339,7 +339,7 @@ def get_scripts_id_with_http_info(self, script_id, **kwargs): # noqa: E501,D401 def patch_scripts_id(self, script_id, script_update_request, **kwargs): # noqa: E501,D401,D403 """Update a script. - Updates properties (`name`, `description`, and `script`) of an invocable script. + Updates properties (`name`, `description`, and `script`) of an invocable script. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_scripts_id(script_id, script_update_request, async_req=True) @@ -362,7 +362,7 @@ def patch_scripts_id(self, script_id, script_update_request, **kwargs): # noqa: def patch_scripts_id_with_http_info(self, script_id, script_update_request, **kwargs): # noqa: E501,D401,D403 """Update a script. - Updates properties (`name`, `description`, and `script`) of an invocable script. + Updates properties (`name`, `description`, and `script`) of an invocable script. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_scripts_id_with_http_info(script_id, script_update_request, async_req=True) From 7a105def44fea77ae35b4e504ee702c5547f59f0 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Mon, 25 Oct 2021 07:58:25 +0200 Subject: [PATCH 8/8] docs: update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c1d28a1..68c47051 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ ### Features 1. [#352](https://github.com/influxdata/influxdb-client-python/pull/352): Add `PingService` to check status of OSS and Cloud instance +### Documentation +1. [#344](https://github.com/influxdata/influxdb-client-python/pull/344): Add an example How to use Invocable scripts Cloud API + ## 1.22.0 [2021-10-22] ### Features