From df2719bfbf8f4606d459792c9adad4ff58c871b4 Mon Sep 17 00:00:00 2001 From: parteek65 Date: Mon, 29 Jul 2024 11:01:56 +0530 Subject: [PATCH 1/2] Added Recommendation query Executor --- .openapi-generator/FILES | 24 +- README.md | 2 + docs/Auth0UserAllFields.md | 2 + docs/QueryExecutorRequest.md | 30 ++ docs/RecommendationEngineServiceApi.md | 68 +++++ onelens_backend_client/__init__.py | 1 + .../api/recommendation_engine_service_api.py | 272 ++++++++++++++++++ onelens_backend_client/models/__init__.py | 1 + .../models/auth0_user_all_fields.py | 18 +- .../models/query_executor_request.py | 89 ++++++ test/test_query_executor_request.py | 54 ++++ 11 files changed, 538 insertions(+), 23 deletions(-) create mode 100644 docs/QueryExecutorRequest.md create mode 100644 onelens_backend_client/models/query_executor_request.py create mode 100644 test/test_query_executor_request.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 9e3a9116..6471ab1d 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -285,6 +285,7 @@ docs/ProviderConfigInput.md docs/ProviderConfigOutput.md docs/PublishCustomHierarchyRequest.md docs/QueryDetailsDerivedVariables.md +docs/QueryExecutorRequest.md docs/QueryFilters.md docs/QueryOrder.md docs/RecommendationApi.md @@ -818,6 +819,7 @@ onelens_backend_client/models/provider_config_input.py onelens_backend_client/models/provider_config_output.py onelens_backend_client/models/publish_custom_hierarchy_request.py onelens_backend_client/models/query_details_derived_variables.py +onelens_backend_client/models/query_executor_request.py onelens_backend_client/models/query_filters.py onelens_backend_client/models/query_order.py onelens_backend_client/models/recommendation_engine.py @@ -1009,25 +1011,5 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_action_type.py -test/test_action_type_filters.py -test/test_action_type_filters_services_inner.py -test/test_create_action_type_request.py -test/test_create_action_type_response.py -test/test_create_recommendation_unit_request.py -test/test_create_recommendation_unit_response.py -test/test_get_action_type_request.py -test/test_get_action_type_response.py -test/test_get_recommendation_unit_request.py -test/test_query_details_derived_variables.py -test/test_recommendation_query_details.py -test/test_recommendation_unit.py -test/test_recommendation_unit_filters.py -test/test_recommendation_unit_service_api.py -test/test_recommendation_unit_with_action_type.py -test/test_service.py -test/test_update_action_type_request.py -test/test_update_action_type_response.py -test/test_update_recommendation_unit_request.py -test/test_update_recommendation_unit_response.py +test/test_query_executor_request.py tox.ini diff --git a/README.md b/README.md index b073ff7b..eb2856a8 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,7 @@ Class | Method | Description *RecommendationEngineServiceApi* | [**create_action_type**](docs/RecommendationEngineServiceApi.md#create_action_type) | Create Action Type *RecommendationEngineServiceApi* | [**get_action_types**](docs/RecommendationEngineServiceApi.md#get_action_types) | Get Action Types *RecommendationEngineServiceApi* | [**get_recommendations**](docs/RecommendationEngineServiceApi.md#get_recommendations) | Get recommendations. +*RecommendationEngineServiceApi* | [**query_executor**](docs/RecommendationEngineServiceApi.md#query_executor) | Query Executor *RecommendationEngineServiceApi* | [**update_action_type**](docs/RecommendationEngineServiceApi.md#update_action_type) | Update Action Type *RecommendationServiceApi* | [**bulk_create**](docs/RecommendationServiceApi.md#bulk_create) | Creates bulk recommendations. *RecommendationServiceApi* | [**get_recommendation_by_ticket_id**](docs/RecommendationServiceApi.md#get_recommendation_by_ticket_id) | Get recommendations by ticket id. @@ -545,6 +546,7 @@ Class | Method | Description - [ProviderConfigOutput](docs/ProviderConfigOutput.md) - [PublishCustomHierarchyRequest](docs/PublishCustomHierarchyRequest.md) - [QueryDetailsDerivedVariables](docs/QueryDetailsDerivedVariables.md) + - [QueryExecutorRequest](docs/QueryExecutorRequest.md) - [QueryFilters](docs/QueryFilters.md) - [QueryOrder](docs/QueryOrder.md) - [RecommendationEngine](docs/RecommendationEngine.md) diff --git a/docs/Auth0UserAllFields.md b/docs/Auth0UserAllFields.md index 86c563e0..d9b6afdf 100644 --- a/docs/Auth0UserAllFields.md +++ b/docs/Auth0UserAllFields.md @@ -19,6 +19,8 @@ Name | Type | Description | Notes **last_ip** | **str** | | [optional] **last_login** | **datetime** | | [optional] **logins_count** | **int** | | [optional] +**given_name** | **str** | | [optional] +**family_name** | **str** | | [optional] ## Example diff --git a/docs/QueryExecutorRequest.md b/docs/QueryExecutorRequest.md new file mode 100644 index 00000000..d31a415e --- /dev/null +++ b/docs/QueryExecutorRequest.md @@ -0,0 +1,30 @@ +# QueryExecutorRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**query** | **str** | sql query | +**recommendation_unit_id** | **str** | Recommendation Unit ID | + +## Example + +```python +from onelens_backend_client.models.query_executor_request import QueryExecutorRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of QueryExecutorRequest from a JSON string +query_executor_request_instance = QueryExecutorRequest.from_json(json) +# print the JSON string representation of the object +print(QueryExecutorRequest.to_json()) + +# convert the object into a dict +query_executor_request_dict = query_executor_request_instance.to_dict() +# create an instance of QueryExecutorRequest from a dict +query_executor_request_form_dict = query_executor_request.from_dict(query_executor_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RecommendationEngineServiceApi.md b/docs/RecommendationEngineServiceApi.md index 017cb11a..3a231c0d 100644 --- a/docs/RecommendationEngineServiceApi.md +++ b/docs/RecommendationEngineServiceApi.md @@ -7,6 +7,7 @@ Method | Description [**create_action_type**](RecommendationEngineServiceApi.md#create_action_type) | Create Action Type [**get_action_types**](RecommendationEngineServiceApi.md#get_action_types) | Get Action Types [**get_recommendations**](RecommendationEngineServiceApi.md#get_recommendations) | Get recommendations. +[**query_executor**](RecommendationEngineServiceApi.md#query_executor) | Query Executor [**update_action_type**](RecommendationEngineServiceApi.md#update_action_type) | Update Action Type @@ -214,6 +215,73 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **query_executor** +> object query_executor(query_executor_request) + +Query Executor + +### Example + + +```python +import onelens_backend_client +from onelens_backend_client.models.query_executor_request import QueryExecutorRequest +from onelens_backend_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = onelens_backend_client.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +with onelens_backend_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = onelens_backend_client.RecommendationEngineServiceApi(api_client) + query_executor_request = onelens_backend_client.QueryExecutorRequest() # QueryExecutorRequest | + + try: + # Query Executor + api_response = api_instance.query_executor(query_executor_request) + print("The response of RecommendationEngineServiceApi->query_executor:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RecommendationEngineServiceApi->query_executor: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_executor_request** | [**QueryExecutorRequest**](QueryExecutorRequest.md)| | + +### Return type + +**object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **update_action_type** > UpdateActionTypeResponse update_action_type(update_action_type_request) diff --git a/onelens_backend_client/__init__.py b/onelens_backend_client/__init__.py index d51738fb..57c6a3af 100644 --- a/onelens_backend_client/__init__.py +++ b/onelens_backend_client/__init__.py @@ -342,6 +342,7 @@ from onelens_backend_client.models.provider_config_output import ProviderConfigOutput from onelens_backend_client.models.publish_custom_hierarchy_request import PublishCustomHierarchyRequest from onelens_backend_client.models.query_details_derived_variables import QueryDetailsDerivedVariables +from onelens_backend_client.models.query_executor_request import QueryExecutorRequest from onelens_backend_client.models.query_filters import QueryFilters from onelens_backend_client.models.query_order import QueryOrder from onelens_backend_client.models.recommendation_engine import RecommendationEngine diff --git a/onelens_backend_client/api/recommendation_engine_service_api.py b/onelens_backend_client/api/recommendation_engine_service_api.py index aafc001f..950810fd 100644 --- a/onelens_backend_client/api/recommendation_engine_service_api.py +++ b/onelens_backend_client/api/recommendation_engine_service_api.py @@ -16,10 +16,12 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from typing import Any from onelens_backend_client.models.create_action_type_request import CreateActionTypeRequest from onelens_backend_client.models.create_action_type_response import CreateActionTypeResponse from onelens_backend_client.models.get_action_type_request import GetActionTypeRequest from onelens_backend_client.models.get_action_type_response import GetActionTypeResponse +from onelens_backend_client.models.query_executor_request import QueryExecutorRequest from onelens_backend_client.models.recommendation_engine_request import RecommendationEngineRequest from onelens_backend_client.models.recommendation_engine_response import RecommendationEngineResponse from onelens_backend_client.models.update_action_type_request import UpdateActionTypeRequest @@ -853,6 +855,276 @@ def _get_recommendations_serialize( + @validate_call + def query_executor( + self, + query_executor_request: QueryExecutorRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> object: + """Query Executor + + + :param query_executor_request: (required) + :type query_executor_request: QueryExecutorRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._query_executor_serialize( + query_executor_request=query_executor_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def query_executor_with_http_info( + self, + query_executor_request: QueryExecutorRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[object]: + """Query Executor + + + :param query_executor_request: (required) + :type query_executor_request: QueryExecutorRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._query_executor_serialize( + query_executor_request=query_executor_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def query_executor_without_preload_content( + self, + query_executor_request: QueryExecutorRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Query Executor + + + :param query_executor_request: (required) + :type query_executor_request: QueryExecutorRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._query_executor_serialize( + query_executor_request=query_executor_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _query_executor_serialize( + self, + query_executor_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if query_executor_request is not None: + _body_params = query_executor_request + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/rpc/recommendation_engine_service/query_executor', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def update_action_type( self, diff --git a/onelens_backend_client/models/__init__.py b/onelens_backend_client/models/__init__.py index e2382fd5..e7b298bc 100644 --- a/onelens_backend_client/models/__init__.py +++ b/onelens_backend_client/models/__init__.py @@ -283,6 +283,7 @@ from onelens_backend_client.models.provider_config_output import ProviderConfigOutput from onelens_backend_client.models.publish_custom_hierarchy_request import PublishCustomHierarchyRequest from onelens_backend_client.models.query_details_derived_variables import QueryDetailsDerivedVariables +from onelens_backend_client.models.query_executor_request import QueryExecutorRequest from onelens_backend_client.models.query_filters import QueryFilters from onelens_backend_client.models.query_order import QueryOrder from onelens_backend_client.models.recommendation_engine import RecommendationEngine diff --git a/onelens_backend_client/models/auth0_user_all_fields.py b/onelens_backend_client/models/auth0_user_all_fields.py index 1a94ef68..cf523c92 100644 --- a/onelens_backend_client/models/auth0_user_all_fields.py +++ b/onelens_backend_client/models/auth0_user_all_fields.py @@ -41,7 +41,9 @@ class Auth0UserAllFields(BaseModel): last_ip: Optional[StrictStr] = None last_login: Optional[datetime] = None logins_count: Optional[StrictInt] = None - __properties: ClassVar[List[str]] = ["email", "email_verified", "created_at", "identities", "name", "nickname", "picture", "updated_at", "user_id", "user_metadata", "app_metadata", "last_ip", "last_login", "logins_count"] + given_name: Optional[StrictStr] = None + family_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["email", "email_verified", "created_at", "identities", "name", "nickname", "picture", "updated_at", "user_id", "user_metadata", "app_metadata", "last_ip", "last_login", "logins_count", "given_name", "family_name"] model_config = ConfigDict( populate_by_name=True, @@ -142,6 +144,16 @@ def to_dict(self) -> Dict[str, Any]: if self.logins_count is None and "logins_count" in self.model_fields_set: _dict['logins_count'] = None + # set to None if given_name (nullable) is None + # and model_fields_set contains the field + if self.given_name is None and "given_name" in self.model_fields_set: + _dict['given_name'] = None + + # set to None if family_name (nullable) is None + # and model_fields_set contains the field + if self.family_name is None and "family_name" in self.model_fields_set: + _dict['family_name'] = None + return _dict @classmethod @@ -167,7 +179,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "app_metadata": obj.get("app_metadata"), "last_ip": obj.get("last_ip"), "last_login": obj.get("last_login"), - "logins_count": obj.get("logins_count") + "logins_count": obj.get("logins_count"), + "given_name": obj.get("given_name"), + "family_name": obj.get("family_name") }) return _obj diff --git a/onelens_backend_client/models/query_executor_request.py b/onelens_backend_client/models/query_executor_request.py new file mode 100644 index 00000000..7f197645 --- /dev/null +++ b/onelens_backend_client/models/query_executor_request.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class QueryExecutorRequest(BaseModel): + """ + QueryExecutorRequest + """ # noqa: E501 + query: StrictStr = Field(description="sql query") + recommendation_unit_id: StrictStr = Field(description="Recommendation Unit ID") + __properties: ClassVar[List[str]] = ["query", "recommendation_unit_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QueryExecutorRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QueryExecutorRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "query": obj.get("query"), + "recommendation_unit_id": obj.get("recommendation_unit_id") + }) + return _obj + + diff --git a/test/test_query_executor_request.py b/test/test_query_executor_request.py new file mode 100644 index 00000000..befb04e8 --- /dev/null +++ b/test/test_query_executor_request.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from onelens_backend_client.models.query_executor_request import QueryExecutorRequest + +class TestQueryExecutorRequest(unittest.TestCase): + """QueryExecutorRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> QueryExecutorRequest: + """Test QueryExecutorRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `QueryExecutorRequest` + """ + model = QueryExecutorRequest() + if include_optional: + return QueryExecutorRequest( + query = '', + recommendation_unit_id = '' + ) + else: + return QueryExecutorRequest( + query = '', + recommendation_unit_id = '', + ) + """ + + def testQueryExecutorRequest(self): + """Test QueryExecutorRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() From 5301e4360c77184def89cbd3550c156445741b19 Mon Sep 17 00:00:00 2001 From: parteek65 Date: Mon, 29 Jul 2024 14:37:00 +0530 Subject: [PATCH 2/2] added recommendation unit github migrations --- .openapi-generator/FILES | 11 +- README.md | 6 + docs/CreateRecommenadtionUnitPullResponse.md | 29 + docs/CreateRecommendationUnitPullRequest.md | 33 + docs/RecommendationUnitMigrationServiceApi.md | 146 +++++ docs/SyncRecommendationUnitFromRepoRequest.md | 29 + .../SyncRecommendationUnitFromRepoResponse.md | 29 + onelens_backend_client/__init__.py | 5 + onelens_backend_client/api/__init__.py | 1 + ...commendation_unit_migration_service_api.py | 579 ++++++++++++++++++ onelens_backend_client/models/__init__.py | 4 + ...reate_recommenadtion_unit_pull_response.py | 88 +++ ...create_recommendation_unit_pull_request.py | 95 +++ ...c_recommendation_unit_from_repo_request.py | 87 +++ ..._recommendation_unit_from_repo_response.py | 87 +++ ...reate_recommenadtion_unit_pull_response.py | 52 ++ ...create_recommendation_unit_pull_request.py | 60 ++ ...commendation_unit_migration_service_api.py | 45 ++ ...c_recommendation_unit_from_repo_request.py | 52 ++ ..._recommendation_unit_from_repo_response.py | 52 ++ 20 files changed, 1489 insertions(+), 1 deletion(-) create mode 100644 docs/CreateRecommenadtionUnitPullResponse.md create mode 100644 docs/CreateRecommendationUnitPullRequest.md create mode 100644 docs/RecommendationUnitMigrationServiceApi.md create mode 100644 docs/SyncRecommendationUnitFromRepoRequest.md create mode 100644 docs/SyncRecommendationUnitFromRepoResponse.md create mode 100644 onelens_backend_client/api/recommendation_unit_migration_service_api.py create mode 100644 onelens_backend_client/models/create_recommenadtion_unit_pull_response.py create mode 100644 onelens_backend_client/models/create_recommendation_unit_pull_request.py create mode 100644 onelens_backend_client/models/sync_recommendation_unit_from_repo_request.py create mode 100644 onelens_backend_client/models/sync_recommendation_unit_from_repo_response.py create mode 100644 test/test_create_recommenadtion_unit_pull_response.py create mode 100644 test/test_create_recommendation_unit_pull_request.py create mode 100644 test/test_recommendation_unit_migration_service_api.py create mode 100644 test/test_sync_recommendation_unit_from_repo_request.py create mode 100644 test/test_sync_recommendation_unit_from_repo_response.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 6471ab1d..09f6517f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -49,6 +49,8 @@ docs/CreatePolicyTemplatePullRequest.md docs/CreatePolicyTemplatePullResponse.md docs/CreatePolicyTemplateRequest.md docs/CreatePolicyTemplateResponse.md +docs/CreateRecommenadtionUnitPullResponse.md +docs/CreateRecommendationUnitPullRequest.md docs/CreateRecommendationUnitRequest.md docs/CreateRecommendationUnitResponse.md docs/CreateTenantEmbedAppsLinksRequest.md @@ -305,6 +307,7 @@ docs/RecommendationTicketRequest.md docs/RecommendationTicketResponse.md docs/RecommendationUnit.md docs/RecommendationUnitFilters.md +docs/RecommendationUnitMigrationServiceApi.md docs/RecommendationUnitServiceApi.md docs/RecommendationUnitWithActionType.md docs/RelationshipConfigItem.md @@ -403,6 +406,8 @@ docs/Statuses.md docs/StorageLensConfig.md docs/SyncPoliciesFromRepoRequest.md docs/SyncPoliciesFromRepoResponse.md +docs/SyncRecommendationUnitFromRepoRequest.md +docs/SyncRecommendationUnitFromRepoResponse.md docs/Tenant.md docs/TenantAnomaliesApi.md docs/TenantAnomalyServiceApi.md @@ -519,6 +524,7 @@ onelens_backend_client/api/recommendation_api.py onelens_backend_client/api/recommendation_engine_api.py onelens_backend_client/api/recommendation_engine_service_api.py onelens_backend_client/api/recommendation_service_api.py +onelens_backend_client/api/recommendation_unit_migration_service_api.py onelens_backend_client/api/recommendation_unit_service_api.py onelens_backend_client/api/resource_catalog_api.py onelens_backend_client/api/resource_catalog_service_api.py @@ -593,6 +599,8 @@ onelens_backend_client/models/create_policy_template_pull_request.py onelens_backend_client/models/create_policy_template_pull_response.py onelens_backend_client/models/create_policy_template_request.py onelens_backend_client/models/create_policy_template_response.py +onelens_backend_client/models/create_recommenadtion_unit_pull_response.py +onelens_backend_client/models/create_recommendation_unit_pull_request.py onelens_backend_client/models/create_recommendation_unit_request.py onelens_backend_client/models/create_recommendation_unit_response.py onelens_backend_client/models/create_tenant_embed_apps_links_request.py @@ -927,6 +935,8 @@ onelens_backend_client/models/statuses.py onelens_backend_client/models/storage_lens_config.py onelens_backend_client/models/sync_policies_from_repo_request.py onelens_backend_client/models/sync_policies_from_repo_response.py +onelens_backend_client/models/sync_recommendation_unit_from_repo_request.py +onelens_backend_client/models/sync_recommendation_unit_from_repo_response.py onelens_backend_client/models/tenant.py onelens_backend_client/models/tenant_anomaly_setting_filters.py onelens_backend_client/models/tenant_anomaly_settings.py @@ -1011,5 +1021,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_query_executor_request.py tox.ini diff --git a/README.md b/README.md index eb2856a8..77ecee7f 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,8 @@ Class | Method | Description *RecommendationEngineServiceApi* | [**update_action_type**](docs/RecommendationEngineServiceApi.md#update_action_type) | Update Action Type *RecommendationServiceApi* | [**bulk_create**](docs/RecommendationServiceApi.md#bulk_create) | Creates bulk recommendations. *RecommendationServiceApi* | [**get_recommendation_by_ticket_id**](docs/RecommendationServiceApi.md#get_recommendation_by_ticket_id) | Get recommendations by ticket id. +*RecommendationUnitMigrationServiceApi* | [**create_recommendation_unit_pull_request**](docs/RecommendationUnitMigrationServiceApi.md#create_recommendation_unit_pull_request) | Create a pull request for the recommendation_unit template +*RecommendationUnitMigrationServiceApi* | [**sync_recommendation_unit_from_repo**](docs/RecommendationUnitMigrationServiceApi.md#sync_recommendation_unit_from_repo) | Sync recommendation_unit from repo *RecommendationUnitServiceApi* | [**create_recommendation_unit**](docs/RecommendationUnitServiceApi.md#create_recommendation_unit) | Create recommendation unit *RecommendationUnitServiceApi* | [**get_recommendation_unit_by_id**](docs/RecommendationUnitServiceApi.md#get_recommendation_unit_by_id) | Retrieves Recommendation unit ID. *RecommendationUnitServiceApi* | [**get_recommendation_units**](docs/RecommendationUnitServiceApi.md#get_recommendation_units) | Retrieves all recommendation units with filters @@ -320,6 +322,8 @@ Class | Method | Description - [CreatePolicyTemplatePullResponse](docs/CreatePolicyTemplatePullResponse.md) - [CreatePolicyTemplateRequest](docs/CreatePolicyTemplateRequest.md) - [CreatePolicyTemplateResponse](docs/CreatePolicyTemplateResponse.md) + - [CreateRecommenadtionUnitPullResponse](docs/CreateRecommenadtionUnitPullResponse.md) + - [CreateRecommendationUnitPullRequest](docs/CreateRecommendationUnitPullRequest.md) - [CreateRecommendationUnitRequest](docs/CreateRecommendationUnitRequest.md) - [CreateRecommendationUnitResponse](docs/CreateRecommendationUnitResponse.md) - [CreateTenantEmbedAppsLinksRequest](docs/CreateTenantEmbedAppsLinksRequest.md) @@ -654,6 +658,8 @@ Class | Method | Description - [StorageLensConfig](docs/StorageLensConfig.md) - [SyncPoliciesFromRepoRequest](docs/SyncPoliciesFromRepoRequest.md) - [SyncPoliciesFromRepoResponse](docs/SyncPoliciesFromRepoResponse.md) + - [SyncRecommendationUnitFromRepoRequest](docs/SyncRecommendationUnitFromRepoRequest.md) + - [SyncRecommendationUnitFromRepoResponse](docs/SyncRecommendationUnitFromRepoResponse.md) - [Tenant](docs/Tenant.md) - [TenantAnomalySettingFilters](docs/TenantAnomalySettingFilters.md) - [TenantAnomalySettings](docs/TenantAnomalySettings.md) diff --git a/docs/CreateRecommenadtionUnitPullResponse.md b/docs/CreateRecommenadtionUnitPullResponse.md new file mode 100644 index 00000000..2c99bc53 --- /dev/null +++ b/docs/CreateRecommenadtionUnitPullResponse.md @@ -0,0 +1,29 @@ +# CreateRecommenadtionUnitPullResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pr_link** | **str** | The recommendation unit pull request link. | + +## Example + +```python +from onelens_backend_client.models.create_recommenadtion_unit_pull_response import CreateRecommenadtionUnitPullResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateRecommenadtionUnitPullResponse from a JSON string +create_recommenadtion_unit_pull_response_instance = CreateRecommenadtionUnitPullResponse.from_json(json) +# print the JSON string representation of the object +print(CreateRecommenadtionUnitPullResponse.to_json()) + +# convert the object into a dict +create_recommenadtion_unit_pull_response_dict = create_recommenadtion_unit_pull_response_instance.to_dict() +# create an instance of CreateRecommenadtionUnitPullResponse from a dict +create_recommenadtion_unit_pull_response_form_dict = create_recommenadtion_unit_pull_response.from_dict(create_recommenadtion_unit_pull_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateRecommendationUnitPullRequest.md b/docs/CreateRecommendationUnitPullRequest.md new file mode 100644 index 00000000..5290c588 --- /dev/null +++ b/docs/CreateRecommendationUnitPullRequest.md @@ -0,0 +1,33 @@ +# CreateRecommendationUnitPullRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | The title of the pull request. | +**description** | **str** | The description of the pull request. | +**source_branch** | **str** | The source branch of the pull request. | +**branch_name** | **str** | The branch name of the pull request. | +**id** | **str** | The unique identifier of the recommendation unit template by alias. | + +## Example + +```python +from onelens_backend_client.models.create_recommendation_unit_pull_request import CreateRecommendationUnitPullRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateRecommendationUnitPullRequest from a JSON string +create_recommendation_unit_pull_request_instance = CreateRecommendationUnitPullRequest.from_json(json) +# print the JSON string representation of the object +print(CreateRecommendationUnitPullRequest.to_json()) + +# convert the object into a dict +create_recommendation_unit_pull_request_dict = create_recommendation_unit_pull_request_instance.to_dict() +# create an instance of CreateRecommendationUnitPullRequest from a dict +create_recommendation_unit_pull_request_form_dict = create_recommendation_unit_pull_request.from_dict(create_recommendation_unit_pull_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RecommendationUnitMigrationServiceApi.md b/docs/RecommendationUnitMigrationServiceApi.md new file mode 100644 index 00000000..e9329a12 --- /dev/null +++ b/docs/RecommendationUnitMigrationServiceApi.md @@ -0,0 +1,146 @@ +# RecommendationUnitMigrationServiceApi + +All URIs are relative to *http://localhost* + +Method | Description +------------- | ------------- +[**create_recommendation_unit_pull_request**](RecommendationUnitMigrationServiceApi.md#create_recommendation_unit_pull_request) | Create a pull request for the recommendation_unit template +[**sync_recommendation_unit_from_repo**](RecommendationUnitMigrationServiceApi.md#sync_recommendation_unit_from_repo) | Sync recommendation_unit from repo + + +# **create_recommendation_unit_pull_request** +> CreateRecommenadtionUnitPullResponse create_recommendation_unit_pull_request(create_recommendation_unit_pull_request) + +Create a pull request for the recommendation_unit template + +### Example + + +```python +import onelens_backend_client +from onelens_backend_client.models.create_recommenadtion_unit_pull_response import CreateRecommenadtionUnitPullResponse +from onelens_backend_client.models.create_recommendation_unit_pull_request import CreateRecommendationUnitPullRequest +from onelens_backend_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = onelens_backend_client.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +with onelens_backend_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = onelens_backend_client.RecommendationUnitMigrationServiceApi(api_client) + create_recommendation_unit_pull_request = onelens_backend_client.CreateRecommendationUnitPullRequest() # CreateRecommendationUnitPullRequest | + + try: + # Create a pull request for the recommendation_unit template + api_response = api_instance.create_recommendation_unit_pull_request(create_recommendation_unit_pull_request) + print("The response of RecommendationUnitMigrationServiceApi->create_recommendation_unit_pull_request:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RecommendationUnitMigrationServiceApi->create_recommendation_unit_pull_request: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_recommendation_unit_pull_request** | [**CreateRecommendationUnitPullRequest**](CreateRecommendationUnitPullRequest.md)| | + +### Return type + +[**CreateRecommenadtionUnitPullResponse**](CreateRecommenadtionUnitPullResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **sync_recommendation_unit_from_repo** +> SyncRecommendationUnitFromRepoResponse sync_recommendation_unit_from_repo(sync_recommendation_unit_from_repo_request) + +Sync recommendation_unit from repo + +### Example + + +```python +import onelens_backend_client +from onelens_backend_client.models.sync_recommendation_unit_from_repo_request import SyncRecommendationUnitFromRepoRequest +from onelens_backend_client.models.sync_recommendation_unit_from_repo_response import SyncRecommendationUnitFromRepoResponse +from onelens_backend_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = onelens_backend_client.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +with onelens_backend_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = onelens_backend_client.RecommendationUnitMigrationServiceApi(api_client) + sync_recommendation_unit_from_repo_request = onelens_backend_client.SyncRecommendationUnitFromRepoRequest() # SyncRecommendationUnitFromRepoRequest | + + try: + # Sync recommendation_unit from repo + api_response = api_instance.sync_recommendation_unit_from_repo(sync_recommendation_unit_from_repo_request) + print("The response of RecommendationUnitMigrationServiceApi->sync_recommendation_unit_from_repo:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RecommendationUnitMigrationServiceApi->sync_recommendation_unit_from_repo: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **sync_recommendation_unit_from_repo_request** | [**SyncRecommendationUnitFromRepoRequest**](SyncRecommendationUnitFromRepoRequest.md)| | + +### Return type + +[**SyncRecommendationUnitFromRepoResponse**](SyncRecommendationUnitFromRepoResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/SyncRecommendationUnitFromRepoRequest.md b/docs/SyncRecommendationUnitFromRepoRequest.md new file mode 100644 index 00000000..1ff67c23 --- /dev/null +++ b/docs/SyncRecommendationUnitFromRepoRequest.md @@ -0,0 +1,29 @@ +# SyncRecommendationUnitFromRepoRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier of the recommendation unit template by alias. | + +## Example + +```python +from onelens_backend_client.models.sync_recommendation_unit_from_repo_request import SyncRecommendationUnitFromRepoRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of SyncRecommendationUnitFromRepoRequest from a JSON string +sync_recommendation_unit_from_repo_request_instance = SyncRecommendationUnitFromRepoRequest.from_json(json) +# print the JSON string representation of the object +print(SyncRecommendationUnitFromRepoRequest.to_json()) + +# convert the object into a dict +sync_recommendation_unit_from_repo_request_dict = sync_recommendation_unit_from_repo_request_instance.to_dict() +# create an instance of SyncRecommendationUnitFromRepoRequest from a dict +sync_recommendation_unit_from_repo_request_form_dict = sync_recommendation_unit_from_repo_request.from_dict(sync_recommendation_unit_from_repo_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SyncRecommendationUnitFromRepoResponse.md b/docs/SyncRecommendationUnitFromRepoResponse.md new file mode 100644 index 00000000..02faf426 --- /dev/null +++ b/docs/SyncRecommendationUnitFromRepoResponse.md @@ -0,0 +1,29 @@ +# SyncRecommendationUnitFromRepoResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The recommendation unit which got updated. | + +## Example + +```python +from onelens_backend_client.models.sync_recommendation_unit_from_repo_response import SyncRecommendationUnitFromRepoResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of SyncRecommendationUnitFromRepoResponse from a JSON string +sync_recommendation_unit_from_repo_response_instance = SyncRecommendationUnitFromRepoResponse.from_json(json) +# print the JSON string representation of the object +print(SyncRecommendationUnitFromRepoResponse.to_json()) + +# convert the object into a dict +sync_recommendation_unit_from_repo_response_dict = sync_recommendation_unit_from_repo_response_instance.to_dict() +# create an instance of SyncRecommendationUnitFromRepoResponse from a dict +sync_recommendation_unit_from_repo_response_form_dict = sync_recommendation_unit_from_repo_response.from_dict(sync_recommendation_unit_from_repo_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/onelens_backend_client/__init__.py b/onelens_backend_client/__init__.py index 57c6a3af..2c80b17f 100644 --- a/onelens_backend_client/__init__.py +++ b/onelens_backend_client/__init__.py @@ -34,6 +34,7 @@ from onelens_backend_client.api.policy_template_service_api import PolicyTemplateServiceApi from onelens_backend_client.api.recommendation_engine_service_api import RecommendationEngineServiceApi from onelens_backend_client.api.recommendation_service_api import RecommendationServiceApi +from onelens_backend_client.api.recommendation_unit_migration_service_api import RecommendationUnitMigrationServiceApi from onelens_backend_client.api.recommendation_unit_service_api import RecommendationUnitServiceApi from onelens_backend_client.api.resource_catalog_api import ResourceCatalogApi from onelens_backend_client.api.resource_catalog_service_api import ResourceCatalogServiceApi @@ -116,6 +117,8 @@ from onelens_backend_client.models.create_policy_template_pull_response import CreatePolicyTemplatePullResponse from onelens_backend_client.models.create_policy_template_request import CreatePolicyTemplateRequest from onelens_backend_client.models.create_policy_template_response import CreatePolicyTemplateResponse +from onelens_backend_client.models.create_recommenadtion_unit_pull_response import CreateRecommenadtionUnitPullResponse +from onelens_backend_client.models.create_recommendation_unit_pull_request import CreateRecommendationUnitPullRequest from onelens_backend_client.models.create_recommendation_unit_request import CreateRecommendationUnitRequest from onelens_backend_client.models.create_recommendation_unit_response import CreateRecommendationUnitResponse from onelens_backend_client.models.create_tenant_embed_apps_links_request import CreateTenantEmbedAppsLinksRequest @@ -450,6 +453,8 @@ from onelens_backend_client.models.storage_lens_config import StorageLensConfig from onelens_backend_client.models.sync_policies_from_repo_request import SyncPoliciesFromRepoRequest from onelens_backend_client.models.sync_policies_from_repo_response import SyncPoliciesFromRepoResponse +from onelens_backend_client.models.sync_recommendation_unit_from_repo_request import SyncRecommendationUnitFromRepoRequest +from onelens_backend_client.models.sync_recommendation_unit_from_repo_response import SyncRecommendationUnitFromRepoResponse from onelens_backend_client.models.tenant import Tenant from onelens_backend_client.models.tenant_anomaly_setting_filters import TenantAnomalySettingFilters from onelens_backend_client.models.tenant_anomaly_settings import TenantAnomalySettings diff --git a/onelens_backend_client/api/__init__.py b/onelens_backend_client/api/__init__.py index b5976a4b..834dc632 100644 --- a/onelens_backend_client/api/__init__.py +++ b/onelens_backend_client/api/__init__.py @@ -18,6 +18,7 @@ from onelens_backend_client.api.policy_template_service_api import PolicyTemplateServiceApi from onelens_backend_client.api.recommendation_engine_service_api import RecommendationEngineServiceApi from onelens_backend_client.api.recommendation_service_api import RecommendationServiceApi +from onelens_backend_client.api.recommendation_unit_migration_service_api import RecommendationUnitMigrationServiceApi from onelens_backend_client.api.recommendation_unit_service_api import RecommendationUnitServiceApi from onelens_backend_client.api.resource_catalog_api import ResourceCatalogApi from onelens_backend_client.api.resource_catalog_service_api import ResourceCatalogServiceApi diff --git a/onelens_backend_client/api/recommendation_unit_migration_service_api.py b/onelens_backend_client/api/recommendation_unit_migration_service_api.py new file mode 100644 index 00000000..c05955b4 --- /dev/null +++ b/onelens_backend_client/api/recommendation_unit_migration_service_api.py @@ -0,0 +1,579 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from onelens_backend_client.models.create_recommenadtion_unit_pull_response import CreateRecommenadtionUnitPullResponse +from onelens_backend_client.models.create_recommendation_unit_pull_request import CreateRecommendationUnitPullRequest +from onelens_backend_client.models.sync_recommendation_unit_from_repo_request import SyncRecommendationUnitFromRepoRequest +from onelens_backend_client.models.sync_recommendation_unit_from_repo_response import SyncRecommendationUnitFromRepoResponse + +from onelens_backend_client.api_client import ApiClient, RequestSerialized +from onelens_backend_client.api_response import ApiResponse +from onelens_backend_client.rest import RESTResponseType + + +class RecommendationUnitMigrationServiceApi: + """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) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_recommendation_unit_pull_request( + self, + create_recommendation_unit_pull_request: CreateRecommendationUnitPullRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateRecommenadtionUnitPullResponse: + """Create a pull request for the recommendation_unit template + + + :param create_recommendation_unit_pull_request: (required) + :type create_recommendation_unit_pull_request: CreateRecommendationUnitPullRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_recommendation_unit_pull_request_serialize( + create_recommendation_unit_pull_request=create_recommendation_unit_pull_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateRecommenadtionUnitPullResponse", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_recommendation_unit_pull_request_with_http_info( + self, + create_recommendation_unit_pull_request: CreateRecommendationUnitPullRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateRecommenadtionUnitPullResponse]: + """Create a pull request for the recommendation_unit template + + + :param create_recommendation_unit_pull_request: (required) + :type create_recommendation_unit_pull_request: CreateRecommendationUnitPullRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_recommendation_unit_pull_request_serialize( + create_recommendation_unit_pull_request=create_recommendation_unit_pull_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateRecommenadtionUnitPullResponse", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_recommendation_unit_pull_request_without_preload_content( + self, + create_recommendation_unit_pull_request: CreateRecommendationUnitPullRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a pull request for the recommendation_unit template + + + :param create_recommendation_unit_pull_request: (required) + :type create_recommendation_unit_pull_request: CreateRecommendationUnitPullRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_recommendation_unit_pull_request_serialize( + create_recommendation_unit_pull_request=create_recommendation_unit_pull_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateRecommenadtionUnitPullResponse", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_recommendation_unit_pull_request_serialize( + self, + create_recommendation_unit_pull_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if create_recommendation_unit_pull_request is not None: + _body_params = create_recommendation_unit_pull_request + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/rpc/recommendation_unit_migration_service/create_recommendation_unit_pull_request', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def sync_recommendation_unit_from_repo( + self, + sync_recommendation_unit_from_repo_request: SyncRecommendationUnitFromRepoRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SyncRecommendationUnitFromRepoResponse: + """Sync recommendation_unit from repo + + + :param sync_recommendation_unit_from_repo_request: (required) + :type sync_recommendation_unit_from_repo_request: SyncRecommendationUnitFromRepoRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._sync_recommendation_unit_from_repo_serialize( + sync_recommendation_unit_from_repo_request=sync_recommendation_unit_from_repo_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SyncRecommendationUnitFromRepoResponse", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def sync_recommendation_unit_from_repo_with_http_info( + self, + sync_recommendation_unit_from_repo_request: SyncRecommendationUnitFromRepoRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SyncRecommendationUnitFromRepoResponse]: + """Sync recommendation_unit from repo + + + :param sync_recommendation_unit_from_repo_request: (required) + :type sync_recommendation_unit_from_repo_request: SyncRecommendationUnitFromRepoRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._sync_recommendation_unit_from_repo_serialize( + sync_recommendation_unit_from_repo_request=sync_recommendation_unit_from_repo_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SyncRecommendationUnitFromRepoResponse", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def sync_recommendation_unit_from_repo_without_preload_content( + self, + sync_recommendation_unit_from_repo_request: SyncRecommendationUnitFromRepoRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Sync recommendation_unit from repo + + + :param sync_recommendation_unit_from_repo_request: (required) + :type sync_recommendation_unit_from_repo_request: SyncRecommendationUnitFromRepoRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._sync_recommendation_unit_from_repo_serialize( + sync_recommendation_unit_from_repo_request=sync_recommendation_unit_from_repo_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SyncRecommendationUnitFromRepoResponse", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _sync_recommendation_unit_from_repo_serialize( + self, + sync_recommendation_unit_from_repo_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if sync_recommendation_unit_from_repo_request is not None: + _body_params = sync_recommendation_unit_from_repo_request + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/rpc/recommendation_unit_migration_service/sync_recommendation_unit_from_repo', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/onelens_backend_client/models/__init__.py b/onelens_backend_client/models/__init__.py index e7b298bc..ff502134 100644 --- a/onelens_backend_client/models/__init__.py +++ b/onelens_backend_client/models/__init__.py @@ -57,6 +57,8 @@ from onelens_backend_client.models.create_policy_template_pull_response import CreatePolicyTemplatePullResponse from onelens_backend_client.models.create_policy_template_request import CreatePolicyTemplateRequest from onelens_backend_client.models.create_policy_template_response import CreatePolicyTemplateResponse +from onelens_backend_client.models.create_recommenadtion_unit_pull_response import CreateRecommenadtionUnitPullResponse +from onelens_backend_client.models.create_recommendation_unit_pull_request import CreateRecommendationUnitPullRequest from onelens_backend_client.models.create_recommendation_unit_request import CreateRecommendationUnitRequest from onelens_backend_client.models.create_recommendation_unit_response import CreateRecommendationUnitResponse from onelens_backend_client.models.create_tenant_embed_apps_links_request import CreateTenantEmbedAppsLinksRequest @@ -391,6 +393,8 @@ from onelens_backend_client.models.storage_lens_config import StorageLensConfig from onelens_backend_client.models.sync_policies_from_repo_request import SyncPoliciesFromRepoRequest from onelens_backend_client.models.sync_policies_from_repo_response import SyncPoliciesFromRepoResponse +from onelens_backend_client.models.sync_recommendation_unit_from_repo_request import SyncRecommendationUnitFromRepoRequest +from onelens_backend_client.models.sync_recommendation_unit_from_repo_response import SyncRecommendationUnitFromRepoResponse from onelens_backend_client.models.tenant import Tenant from onelens_backend_client.models.tenant_anomaly_setting_filters import TenantAnomalySettingFilters from onelens_backend_client.models.tenant_anomaly_settings import TenantAnomalySettings diff --git a/onelens_backend_client/models/create_recommenadtion_unit_pull_response.py b/onelens_backend_client/models/create_recommenadtion_unit_pull_response.py new file mode 100644 index 00000000..bce0a18a --- /dev/null +++ b/onelens_backend_client/models/create_recommenadtion_unit_pull_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class CreateRecommenadtionUnitPullResponse(BaseModel): + """ + CreateRecommenadtionUnitPullResponse + """ # noqa: E501 + pr_link: Annotated[str, Field(min_length=1, strict=True, max_length=2083)] = Field(description="The recommendation unit pull request link.") + __properties: ClassVar[List[str]] = ["pr_link"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateRecommenadtionUnitPullResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateRecommenadtionUnitPullResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pr_link": obj.get("pr_link") + }) + return _obj + + diff --git a/onelens_backend_client/models/create_recommendation_unit_pull_request.py b/onelens_backend_client/models/create_recommendation_unit_pull_request.py new file mode 100644 index 00000000..5f914a2b --- /dev/null +++ b/onelens_backend_client/models/create_recommendation_unit_pull_request.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class CreateRecommendationUnitPullRequest(BaseModel): + """ + CreateRecommendationUnitPullRequest + """ # noqa: E501 + title: StrictStr = Field(description="The title of the pull request.") + description: StrictStr = Field(description="The description of the pull request.") + source_branch: StrictStr = Field(description="The source branch of the pull request.") + branch_name: StrictStr = Field(description="The branch name of the pull request.") + id: StrictStr = Field(description="The unique identifier of the recommendation unit template by alias.") + __properties: ClassVar[List[str]] = ["title", "description", "source_branch", "branch_name", "id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateRecommendationUnitPullRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateRecommendationUnitPullRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "description": obj.get("description"), + "source_branch": obj.get("source_branch"), + "branch_name": obj.get("branch_name"), + "id": obj.get("id") + }) + return _obj + + diff --git a/onelens_backend_client/models/sync_recommendation_unit_from_repo_request.py b/onelens_backend_client/models/sync_recommendation_unit_from_repo_request.py new file mode 100644 index 00000000..f2ba3213 --- /dev/null +++ b/onelens_backend_client/models/sync_recommendation_unit_from_repo_request.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class SyncRecommendationUnitFromRepoRequest(BaseModel): + """ + SyncRecommendationUnitFromRepoRequest + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the recommendation unit template by alias.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SyncRecommendationUnitFromRepoRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SyncRecommendationUnitFromRepoRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") + }) + return _obj + + diff --git a/onelens_backend_client/models/sync_recommendation_unit_from_repo_response.py b/onelens_backend_client/models/sync_recommendation_unit_from_repo_response.py new file mode 100644 index 00000000..abbfd092 --- /dev/null +++ b/onelens_backend_client/models/sync_recommendation_unit_from_repo_response.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class SyncRecommendationUnitFromRepoResponse(BaseModel): + """ + SyncRecommendationUnitFromRepoResponse + """ # noqa: E501 + id: StrictStr = Field(description="The recommendation unit which got updated.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SyncRecommendationUnitFromRepoResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SyncRecommendationUnitFromRepoResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") + }) + return _obj + + diff --git a/test/test_create_recommenadtion_unit_pull_response.py b/test/test_create_recommenadtion_unit_pull_response.py new file mode 100644 index 00000000..9b9ebb4b --- /dev/null +++ b/test/test_create_recommenadtion_unit_pull_response.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from onelens_backend_client.models.create_recommenadtion_unit_pull_response import CreateRecommenadtionUnitPullResponse + +class TestCreateRecommenadtionUnitPullResponse(unittest.TestCase): + """CreateRecommenadtionUnitPullResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateRecommenadtionUnitPullResponse: + """Test CreateRecommenadtionUnitPullResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `CreateRecommenadtionUnitPullResponse` + """ + model = CreateRecommenadtionUnitPullResponse() + if include_optional: + return CreateRecommenadtionUnitPullResponse( + pr_link = '0' + ) + else: + return CreateRecommenadtionUnitPullResponse( + pr_link = '0', + ) + """ + + def testCreateRecommenadtionUnitPullResponse(self): + """Test CreateRecommenadtionUnitPullResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_recommendation_unit_pull_request.py b/test/test_create_recommendation_unit_pull_request.py new file mode 100644 index 00000000..7c3a8296 --- /dev/null +++ b/test/test_create_recommendation_unit_pull_request.py @@ -0,0 +1,60 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from onelens_backend_client.models.create_recommendation_unit_pull_request import CreateRecommendationUnitPullRequest + +class TestCreateRecommendationUnitPullRequest(unittest.TestCase): + """CreateRecommendationUnitPullRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateRecommendationUnitPullRequest: + """Test CreateRecommendationUnitPullRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `CreateRecommendationUnitPullRequest` + """ + model = CreateRecommendationUnitPullRequest() + if include_optional: + return CreateRecommendationUnitPullRequest( + title = '', + description = '', + source_branch = '', + branch_name = '', + id = '' + ) + else: + return CreateRecommendationUnitPullRequest( + title = '', + description = '', + source_branch = '', + branch_name = '', + id = '', + ) + """ + + def testCreateRecommendationUnitPullRequest(self): + """Test CreateRecommendationUnitPullRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_recommendation_unit_migration_service_api.py b/test/test_recommendation_unit_migration_service_api.py new file mode 100644 index 00000000..931928b4 --- /dev/null +++ b/test/test_recommendation_unit_migration_service_api.py @@ -0,0 +1,45 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from onelens_backend_client.api.recommendation_unit_migration_service_api import RecommendationUnitMigrationServiceApi + + +class TestRecommendationUnitMigrationServiceApi(unittest.TestCase): + """RecommendationUnitMigrationServiceApi unit test stubs""" + + def setUp(self) -> None: + self.api = RecommendationUnitMigrationServiceApi() + + def tearDown(self) -> None: + pass + + def test_create_recommendation_unit_pull_request(self) -> None: + """Test case for create_recommendation_unit_pull_request + + Create a pull request for the recommendation_unit template + """ + pass + + def test_sync_recommendation_unit_from_repo(self) -> None: + """Test case for sync_recommendation_unit_from_repo + + Sync recommendation_unit from repo + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_sync_recommendation_unit_from_repo_request.py b/test/test_sync_recommendation_unit_from_repo_request.py new file mode 100644 index 00000000..cfaf2f82 --- /dev/null +++ b/test/test_sync_recommendation_unit_from_repo_request.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from onelens_backend_client.models.sync_recommendation_unit_from_repo_request import SyncRecommendationUnitFromRepoRequest + +class TestSyncRecommendationUnitFromRepoRequest(unittest.TestCase): + """SyncRecommendationUnitFromRepoRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SyncRecommendationUnitFromRepoRequest: + """Test SyncRecommendationUnitFromRepoRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `SyncRecommendationUnitFromRepoRequest` + """ + model = SyncRecommendationUnitFromRepoRequest() + if include_optional: + return SyncRecommendationUnitFromRepoRequest( + id = '' + ) + else: + return SyncRecommendationUnitFromRepoRequest( + id = '', + ) + """ + + def testSyncRecommendationUnitFromRepoRequest(self): + """Test SyncRecommendationUnitFromRepoRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_sync_recommendation_unit_from_repo_response.py b/test/test_sync_recommendation_unit_from_repo_response.py new file mode 100644 index 00000000..8399e4b2 --- /dev/null +++ b/test/test_sync_recommendation_unit_from_repo_response.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from onelens_backend_client.models.sync_recommendation_unit_from_repo_response import SyncRecommendationUnitFromRepoResponse + +class TestSyncRecommendationUnitFromRepoResponse(unittest.TestCase): + """SyncRecommendationUnitFromRepoResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SyncRecommendationUnitFromRepoResponse: + """Test SyncRecommendationUnitFromRepoResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `SyncRecommendationUnitFromRepoResponse` + """ + model = SyncRecommendationUnitFromRepoResponse() + if include_optional: + return SyncRecommendationUnitFromRepoResponse( + id = '' + ) + else: + return SyncRecommendationUnitFromRepoResponse( + id = '', + ) + """ + + def testSyncRecommendationUnitFromRepoResponse(self): + """Test SyncRecommendationUnitFromRepoResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()