From 0b30f6b7e34ccc51c6a557ac819d0c5595d1f38f Mon Sep 17 00:00:00 2001 From: Sidhant Panda Date: Wed, 20 Mar 2024 17:09:46 +0530 Subject: [PATCH] Add alias and policy template pack service --- .openapi-generator/FILES | 14 +- README.md | 10 +- docs/CreatePolicyTemplateRequest.md | 1 + docs/CreatePolicyTemplateResponse.md | 1 + docs/GetPolicyTemplateByIDResponse.md | 1 + docs/GetPolicyTemplatePackByIdRequest.md | 29 + docs/PolicyTemplate.md | 1 + docs/PolicyTemplatePackServiceApi.md | 215 +++++ docs/UpdatePolicyTemplateResponse.md | 1 + onelens_backend_client/__init__.py | 6 +- onelens_backend_client/api/__init__.py | 2 +- .../api/policy_template_pack_service_api.py | 851 ++++++++++++++++++ onelens_backend_client/models/__init__.py | 4 +- .../models/create_policy_template_request.py | 4 +- .../models/create_policy_template_response.py | 4 +- .../get_policy_template_by_id_response.py | 4 +- .../get_policy_template_pack_by_id_request.py | 87 ++ .../models/policy_template.py | 4 +- .../models/update_policy_template_response.py | 4 +- ..._get_policy_template_pack_by_id_request.py | 52 ++ test/test_policy_template_pack_service_api.py | 52 ++ 21 files changed, 1320 insertions(+), 27 deletions(-) create mode 100644 docs/GetPolicyTemplatePackByIdRequest.md create mode 100644 docs/PolicyTemplatePackServiceApi.md create mode 100644 onelens_backend_client/api/policy_template_pack_service_api.py create mode 100644 onelens_backend_client/models/get_policy_template_pack_by_id_request.py create mode 100644 test/test_get_policy_template_pack_by_id_request.py create mode 100644 test/test_policy_template_pack_service_api.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 7462b062..8800aacc 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -38,6 +38,7 @@ docs/GetAllUsersRequest.md docs/GetAllUsersResponse.md docs/GetPolicyTemplateByIDRequest.md docs/GetPolicyTemplateByIDResponse.md +docs/GetPolicyTemplatePackByIdRequest.md docs/GetPolicyTemplatePackByIdResponse.md docs/GetPolicyTemplatePacksRequest.md docs/GetPolicyTemplatePacksResponse.md @@ -63,7 +64,6 @@ docs/PaginationParams.md docs/ParentId.md docs/ParentId1.md docs/ParentIds.md -docs/PoliciesPolicyTemplatePacksApi.md docs/PolicyCategory.md docs/PolicyExecutionType.md docs/PolicyTemplate.md @@ -72,17 +72,15 @@ docs/PolicyTemplateDetailsRuleType.md docs/PolicyTemplateFilters.md docs/PolicyTemplatePack.md docs/PolicyTemplatePackDetails.md +docs/PolicyTemplatePackServiceApi.md docs/PolicyTemplatePackState.md docs/PolicyTemplateServiceApi.md docs/PolicyTemplateState.md docs/Provider.md docs/ProviderConfig.md -docs/ResponseCreatePolicyTemplatePackResponse.md docs/ResponseCreateTenantUserResponse.md docs/ResponseCreateUserTenantMappingResponse.md docs/ResponseDisableTenantProviderResponse.md -docs/ResponseGetPolicyTemplatePackByIdResponse.md -docs/ResponseGetPolicyTemplatePacksResponse.md docs/ResponseGetTenantProviderByIDResponse.md docs/ResponseGetTenantProvidersResponse.md docs/ResponseTenantVerifyResponse.md @@ -135,7 +133,7 @@ git_push.sh onelens_backend_client/__init__.py onelens_backend_client/api/__init__.py onelens_backend_client/api/default_api.py -onelens_backend_client/api/policies_policy_template_packs_api.py +onelens_backend_client/api/policy_template_pack_service_api.py onelens_backend_client/api/policy_template_service_api.py onelens_backend_client/api/tenant_service_api.py onelens_backend_client/api/tenant_users_api.py @@ -182,6 +180,7 @@ onelens_backend_client/models/get_all_users_request.py onelens_backend_client/models/get_all_users_response.py onelens_backend_client/models/get_policy_template_by_id_request.py onelens_backend_client/models/get_policy_template_by_id_response.py +onelens_backend_client/models/get_policy_template_pack_by_id_request.py onelens_backend_client/models/get_policy_template_pack_by_id_response.py onelens_backend_client/models/get_policy_template_packs_request.py onelens_backend_client/models/get_policy_template_packs_response.py @@ -219,12 +218,9 @@ onelens_backend_client/models/policy_template_pack_state.py onelens_backend_client/models/policy_template_state.py onelens_backend_client/models/provider.py onelens_backend_client/models/provider_config.py -onelens_backend_client/models/response_create_policy_template_pack_response.py onelens_backend_client/models/response_create_tenant_user_response.py onelens_backend_client/models/response_create_user_tenant_mapping_response.py onelens_backend_client/models/response_disable_tenant_provider_response.py -onelens_backend_client/models/response_get_policy_template_pack_by_id_response.py -onelens_backend_client/models/response_get_policy_template_packs_response.py onelens_backend_client/models/response_get_tenant_provider_by_id_response.py onelens_backend_client/models/response_get_tenant_providers_response.py onelens_backend_client/models/response_tenant_verify_response.py @@ -275,4 +271,6 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_get_policy_template_pack_by_id_request.py +test/test_policy_template_pack_service_api.py tox.ini diff --git a/README.md b/README.md index 9b397312..e6e7aa37 100644 --- a/README.md +++ b/README.md @@ -85,9 +85,9 @@ All URIs are relative to *http://localhost* Class | Method | Description ------------ | ------------- | ------------- *DefaultApi* | [**root**](docs/DefaultApi.md#root) | Root -*PoliciesPolicyTemplatePacksApi* | [**create_policy_template_pack**](docs/PoliciesPolicyTemplatePacksApi.md#create_policy_template_pack) | Create Policy Template Pack -*PoliciesPolicyTemplatePacksApi* | [**get_policy_template_pack**](docs/PoliciesPolicyTemplatePacksApi.md#get_policy_template_pack) | Get Policy Template Pack -*PoliciesPolicyTemplatePacksApi* | [**get_policy_template_packs**](docs/PoliciesPolicyTemplatePacksApi.md#get_policy_template_packs) | Get Policy Template Packs +*PolicyTemplatePackServiceApi* | [**create_policy_template_pack**](docs/PolicyTemplatePackServiceApi.md#create_policy_template_pack) | Create a new policy template pack. +*PolicyTemplatePackServiceApi* | [**get_policy_template_pack_by_id**](docs/PolicyTemplatePackServiceApi.md#get_policy_template_pack_by_id) | Get a policy template pack by id. +*PolicyTemplatePackServiceApi* | [**get_policy_template_packs**](docs/PolicyTemplatePackServiceApi.md#get_policy_template_packs) | Get all policy template packs. *PolicyTemplateServiceApi* | [**activate_policy_template**](docs/PolicyTemplateServiceApi.md#activate_policy_template) | Deprecate a policy template. *PolicyTemplateServiceApi* | [**create_policy_template**](docs/PolicyTemplateServiceApi.md#create_policy_template) | Creates a new policy template. *PolicyTemplateServiceApi* | [**deactivate_policy_template**](docs/PolicyTemplateServiceApi.md#deactivate_policy_template) | Deprecate a policy template. @@ -151,6 +151,7 @@ Class | Method | Description - [GetAllUsersResponse](docs/GetAllUsersResponse.md) - [GetPolicyTemplateByIDRequest](docs/GetPolicyTemplateByIDRequest.md) - [GetPolicyTemplateByIDResponse](docs/GetPolicyTemplateByIDResponse.md) + - [GetPolicyTemplatePackByIdRequest](docs/GetPolicyTemplatePackByIdRequest.md) - [GetPolicyTemplatePackByIdResponse](docs/GetPolicyTemplatePackByIdResponse.md) - [GetPolicyTemplatePacksRequest](docs/GetPolicyTemplatePacksRequest.md) - [GetPolicyTemplatePacksResponse](docs/GetPolicyTemplatePacksResponse.md) @@ -188,12 +189,9 @@ Class | Method | Description - [PolicyTemplateState](docs/PolicyTemplateState.md) - [Provider](docs/Provider.md) - [ProviderConfig](docs/ProviderConfig.md) - - [ResponseCreatePolicyTemplatePackResponse](docs/ResponseCreatePolicyTemplatePackResponse.md) - [ResponseCreateTenantUserResponse](docs/ResponseCreateTenantUserResponse.md) - [ResponseCreateUserTenantMappingResponse](docs/ResponseCreateUserTenantMappingResponse.md) - [ResponseDisableTenantProviderResponse](docs/ResponseDisableTenantProviderResponse.md) - - [ResponseGetPolicyTemplatePackByIdResponse](docs/ResponseGetPolicyTemplatePackByIdResponse.md) - - [ResponseGetPolicyTemplatePacksResponse](docs/ResponseGetPolicyTemplatePacksResponse.md) - [ResponseGetTenantProviderByIDResponse](docs/ResponseGetTenantProviderByIDResponse.md) - [ResponseGetTenantProvidersResponse](docs/ResponseGetTenantProvidersResponse.md) - [ResponseTenantVerifyResponse](docs/ResponseTenantVerifyResponse.md) diff --git a/docs/CreatePolicyTemplateRequest.md b/docs/CreatePolicyTemplateRequest.md index 488c1ebd..b436e65e 100644 --- a/docs/CreatePolicyTemplateRequest.md +++ b/docs/CreatePolicyTemplateRequest.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **parent_ptp_id** | **str** | The id of the parent policy template pack. | **title** | **str** | The title of the policy template. | +**alias** | **str** | The alias of the policy template. | **description** | **str** | The description of the policy template. | [optional] **services** | [**List[CreatePolicyTemplateRequestServicesInner]**](CreatePolicyTemplateRequestServicesInner.md) | The list of services associated the policy template. | **execution_type** | [**PolicyExecutionType**](PolicyExecutionType.md) | The execution type of the policy template. | diff --git a/docs/CreatePolicyTemplateResponse.md b/docs/CreatePolicyTemplateResponse.md index 8fc35cfb..0331d7cd 100644 --- a/docs/CreatePolicyTemplateResponse.md +++ b/docs/CreatePolicyTemplateResponse.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **parent_ptp_id** | **str** | The id of the parent policy template pack. | **title** | **str** | The title of the policy template. | +**alias** | **str** | The alias of the policy template. | **description** | **str** | The description of the policy template. | [optional] **services** | [**List[CreatePolicyTemplateRequestServicesInner]**](CreatePolicyTemplateRequestServicesInner.md) | The list of services associated the policy template. | **execution_type** | [**PolicyExecutionType**](PolicyExecutionType.md) | The execution type of the policy template. | diff --git a/docs/GetPolicyTemplateByIDResponse.md b/docs/GetPolicyTemplateByIDResponse.md index 9756d28f..d66e0d04 100644 --- a/docs/GetPolicyTemplateByIDResponse.md +++ b/docs/GetPolicyTemplateByIDResponse.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **parent_ptp_id** | **str** | The id of the parent policy template pack. | **title** | **str** | The title of the policy template. | +**alias** | **str** | The alias of the policy template. | **description** | **str** | The description of the policy template. | [optional] **services** | [**List[CreatePolicyTemplateRequestServicesInner]**](CreatePolicyTemplateRequestServicesInner.md) | The list of services associated the policy template. | **execution_type** | [**PolicyExecutionType**](PolicyExecutionType.md) | The execution type of the policy template. | diff --git a/docs/GetPolicyTemplatePackByIdRequest.md b/docs/GetPolicyTemplatePackByIdRequest.md new file mode 100644 index 00000000..ec33fb94 --- /dev/null +++ b/docs/GetPolicyTemplatePackByIdRequest.md @@ -0,0 +1,29 @@ +# GetPolicyTemplatePackByIdRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier of the policy template pack | + +## Example + +```python +from onelens_backend_client.models.get_policy_template_pack_by_id_request import GetPolicyTemplatePackByIdRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of GetPolicyTemplatePackByIdRequest from a JSON string +get_policy_template_pack_by_id_request_instance = GetPolicyTemplatePackByIdRequest.from_json(json) +# print the JSON string representation of the object +print(GetPolicyTemplatePackByIdRequest.to_json()) + +# convert the object into a dict +get_policy_template_pack_by_id_request_dict = get_policy_template_pack_by_id_request_instance.to_dict() +# create an instance of GetPolicyTemplatePackByIdRequest from a dict +get_policy_template_pack_by_id_request_form_dict = get_policy_template_pack_by_id_request.from_dict(get_policy_template_pack_by_id_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/PolicyTemplate.md b/docs/PolicyTemplate.md index dcb60ad9..43a44aa4 100644 --- a/docs/PolicyTemplate.md +++ b/docs/PolicyTemplate.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **parent_ptp_id** | **str** | The id of the parent policy template pack. | **title** | **str** | The title of the policy template. | +**alias** | **str** | The alias of the policy template. | **description** | **str** | The description of the policy template. | [optional] **services** | [**List[CreatePolicyTemplateRequestServicesInner]**](CreatePolicyTemplateRequestServicesInner.md) | The list of services associated the policy template. | **execution_type** | [**PolicyExecutionType**](PolicyExecutionType.md) | The execution type of the policy template. | diff --git a/docs/PolicyTemplatePackServiceApi.md b/docs/PolicyTemplatePackServiceApi.md new file mode 100644 index 00000000..0cb9343e --- /dev/null +++ b/docs/PolicyTemplatePackServiceApi.md @@ -0,0 +1,215 @@ +# PolicyTemplatePackServiceApi + +All URIs are relative to *http://localhost* + +Method | Description +------------- | ------------- +[**create_policy_template_pack**](PolicyTemplatePackServiceApi.md#create_policy_template_pack) | Create a new policy template pack. +[**get_policy_template_pack_by_id**](PolicyTemplatePackServiceApi.md#get_policy_template_pack_by_id) | Get a policy template pack by id. +[**get_policy_template_packs**](PolicyTemplatePackServiceApi.md#get_policy_template_packs) | Get all policy template packs. + + +# **create_policy_template_pack** +> CreatePolicyTemplatePackResponse create_policy_template_pack(create_policy_template_pack_request) + +Create a new policy template pack. + +### Example + + +```python +import onelens_backend_client +from onelens_backend_client.models.create_policy_template_pack_request import CreatePolicyTemplatePackRequest +from onelens_backend_client.models.create_policy_template_pack_response import CreatePolicyTemplatePackResponse +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.PolicyTemplatePackServiceApi(api_client) + create_policy_template_pack_request = onelens_backend_client.CreatePolicyTemplatePackRequest() # CreatePolicyTemplatePackRequest | + + try: + # Create a new policy template pack. + api_response = api_instance.create_policy_template_pack(create_policy_template_pack_request) + print("The response of PolicyTemplatePackServiceApi->create_policy_template_pack:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PolicyTemplatePackServiceApi->create_policy_template_pack: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_policy_template_pack_request** | [**CreatePolicyTemplatePackRequest**](CreatePolicyTemplatePackRequest.md)| | + +### Return type + +[**CreatePolicyTemplatePackResponse**](CreatePolicyTemplatePackResponse.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) + +# **get_policy_template_pack_by_id** +> GetPolicyTemplatePackByIdResponse get_policy_template_pack_by_id(get_policy_template_pack_by_id_request) + +Get a policy template pack by id. + +### Example + + +```python +import onelens_backend_client +from onelens_backend_client.models.get_policy_template_pack_by_id_request import GetPolicyTemplatePackByIdRequest +from onelens_backend_client.models.get_policy_template_pack_by_id_response import GetPolicyTemplatePackByIdResponse +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.PolicyTemplatePackServiceApi(api_client) + get_policy_template_pack_by_id_request = onelens_backend_client.GetPolicyTemplatePackByIdRequest() # GetPolicyTemplatePackByIdRequest | + + try: + # Get a policy template pack by id. + api_response = api_instance.get_policy_template_pack_by_id(get_policy_template_pack_by_id_request) + print("The response of PolicyTemplatePackServiceApi->get_policy_template_pack_by_id:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PolicyTemplatePackServiceApi->get_policy_template_pack_by_id: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **get_policy_template_pack_by_id_request** | [**GetPolicyTemplatePackByIdRequest**](GetPolicyTemplatePackByIdRequest.md)| | + +### Return type + +[**GetPolicyTemplatePackByIdResponse**](GetPolicyTemplatePackByIdResponse.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) + +# **get_policy_template_packs** +> GetPolicyTemplatePacksResponse get_policy_template_packs(get_policy_template_packs_request) + +Get all policy template packs. + +### Example + + +```python +import onelens_backend_client +from onelens_backend_client.models.get_policy_template_packs_request import GetPolicyTemplatePacksRequest +from onelens_backend_client.models.get_policy_template_packs_response import GetPolicyTemplatePacksResponse +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.PolicyTemplatePackServiceApi(api_client) + get_policy_template_packs_request = onelens_backend_client.GetPolicyTemplatePacksRequest() # GetPolicyTemplatePacksRequest | + + try: + # Get all policy template packs. + api_response = api_instance.get_policy_template_packs(get_policy_template_packs_request) + print("The response of PolicyTemplatePackServiceApi->get_policy_template_packs:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PolicyTemplatePackServiceApi->get_policy_template_packs: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **get_policy_template_packs_request** | [**GetPolicyTemplatePacksRequest**](GetPolicyTemplatePacksRequest.md)| | + +### Return type + +[**GetPolicyTemplatePacksResponse**](GetPolicyTemplatePacksResponse.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/UpdatePolicyTemplateResponse.md b/docs/UpdatePolicyTemplateResponse.md index b28da0fd..07c4ccea 100644 --- a/docs/UpdatePolicyTemplateResponse.md +++ b/docs/UpdatePolicyTemplateResponse.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **parent_ptp_id** | **str** | The id of the parent policy template pack. | **title** | **str** | The title of the policy template. | +**alias** | **str** | The alias of the policy template. | **description** | **str** | The description of the policy template. | [optional] **services** | [**List[CreatePolicyTemplateRequestServicesInner]**](CreatePolicyTemplateRequestServicesInner.md) | The list of services associated the policy template. | **execution_type** | [**PolicyExecutionType**](PolicyExecutionType.md) | The execution type of the policy template. | diff --git a/onelens_backend_client/__init__.py b/onelens_backend_client/__init__.py index cd469c74..7a96dba3 100644 --- a/onelens_backend_client/__init__.py +++ b/onelens_backend_client/__init__.py @@ -18,7 +18,7 @@ # import apis into sdk package from onelens_backend_client.api.default_api import DefaultApi -from onelens_backend_client.api.policies_policy_template_packs_api import PoliciesPolicyTemplatePacksApi +from onelens_backend_client.api.policy_template_pack_service_api import PolicyTemplatePackServiceApi from onelens_backend_client.api.policy_template_service_api import PolicyTemplateServiceApi from onelens_backend_client.api.tenant_service_api import TenantServiceApi from onelens_backend_client.api.tenant_users_api import TenantUsersApi @@ -73,6 +73,7 @@ from onelens_backend_client.models.get_all_users_response import GetAllUsersResponse from onelens_backend_client.models.get_policy_template_by_id_request import GetPolicyTemplateByIDRequest from onelens_backend_client.models.get_policy_template_by_id_response import GetPolicyTemplateByIDResponse +from onelens_backend_client.models.get_policy_template_pack_by_id_request import GetPolicyTemplatePackByIdRequest from onelens_backend_client.models.get_policy_template_pack_by_id_response import GetPolicyTemplatePackByIdResponse from onelens_backend_client.models.get_policy_template_packs_request import GetPolicyTemplatePacksRequest from onelens_backend_client.models.get_policy_template_packs_response import GetPolicyTemplatePacksResponse @@ -110,12 +111,9 @@ from onelens_backend_client.models.policy_template_state import PolicyTemplateState from onelens_backend_client.models.provider import Provider from onelens_backend_client.models.provider_config import ProviderConfig -from onelens_backend_client.models.response_create_policy_template_pack_response import ResponseCreatePolicyTemplatePackResponse from onelens_backend_client.models.response_create_tenant_user_response import ResponseCreateTenantUserResponse from onelens_backend_client.models.response_create_user_tenant_mapping_response import ResponseCreateUserTenantMappingResponse from onelens_backend_client.models.response_disable_tenant_provider_response import ResponseDisableTenantProviderResponse -from onelens_backend_client.models.response_get_policy_template_pack_by_id_response import ResponseGetPolicyTemplatePackByIdResponse -from onelens_backend_client.models.response_get_policy_template_packs_response import ResponseGetPolicyTemplatePacksResponse from onelens_backend_client.models.response_get_tenant_provider_by_id_response import ResponseGetTenantProviderByIDResponse from onelens_backend_client.models.response_get_tenant_providers_response import ResponseGetTenantProvidersResponse from onelens_backend_client.models.response_tenant_verify_response import ResponseTenantVerifyResponse diff --git a/onelens_backend_client/api/__init__.py b/onelens_backend_client/api/__init__.py index 905542f4..350de227 100644 --- a/onelens_backend_client/api/__init__.py +++ b/onelens_backend_client/api/__init__.py @@ -2,7 +2,7 @@ # import apis into api package from onelens_backend_client.api.default_api import DefaultApi -from onelens_backend_client.api.policies_policy_template_packs_api import PoliciesPolicyTemplatePacksApi +from onelens_backend_client.api.policy_template_pack_service_api import PolicyTemplatePackServiceApi from onelens_backend_client.api.policy_template_service_api import PolicyTemplateServiceApi from onelens_backend_client.api.tenant_service_api import TenantServiceApi from onelens_backend_client.api.tenant_users_api import TenantUsersApi diff --git a/onelens_backend_client/api/policy_template_pack_service_api.py b/onelens_backend_client/api/policy_template_pack_service_api.py new file mode 100644 index 00000000..0301dc37 --- /dev/null +++ b/onelens_backend_client/api/policy_template_pack_service_api.py @@ -0,0 +1,851 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import 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_policy_template_pack_request import CreatePolicyTemplatePackRequest +from onelens_backend_client.models.create_policy_template_pack_response import CreatePolicyTemplatePackResponse +from onelens_backend_client.models.get_policy_template_pack_by_id_request import GetPolicyTemplatePackByIdRequest +from onelens_backend_client.models.get_policy_template_pack_by_id_response import GetPolicyTemplatePackByIdResponse +from onelens_backend_client.models.get_policy_template_packs_request import GetPolicyTemplatePacksRequest +from onelens_backend_client.models.get_policy_template_packs_response import GetPolicyTemplatePacksResponse + +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 PolicyTemplatePackServiceApi: + """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_policy_template_pack( + self, + create_policy_template_pack_request: CreatePolicyTemplatePackRequest, + _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, + ) -> CreatePolicyTemplatePackResponse: + """Create a new policy template pack. + + + :param create_policy_template_pack_request: (required) + :type create_policy_template_pack_request: CreatePolicyTemplatePackRequest + :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_policy_template_pack_serialize( + create_policy_template_pack_request=create_policy_template_pack_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreatePolicyTemplatePackResponse", + '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_policy_template_pack_with_http_info( + self, + create_policy_template_pack_request: CreatePolicyTemplatePackRequest, + _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[CreatePolicyTemplatePackResponse]: + """Create a new policy template pack. + + + :param create_policy_template_pack_request: (required) + :type create_policy_template_pack_request: CreatePolicyTemplatePackRequest + :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_policy_template_pack_serialize( + create_policy_template_pack_request=create_policy_template_pack_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreatePolicyTemplatePackResponse", + '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_policy_template_pack_without_preload_content( + self, + create_policy_template_pack_request: CreatePolicyTemplatePackRequest, + _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 new policy template pack. + + + :param create_policy_template_pack_request: (required) + :type create_policy_template_pack_request: CreatePolicyTemplatePackRequest + :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_policy_template_pack_serialize( + create_policy_template_pack_request=create_policy_template_pack_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreatePolicyTemplatePackResponse", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_policy_template_pack_serialize( + self, + create_policy_template_pack_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_policy_template_pack_request is not None: + _body_params = create_policy_template_pack_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/policy_template_pack_service/create_policy_template_pack', + 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 get_policy_template_pack_by_id( + self, + get_policy_template_pack_by_id_request: GetPolicyTemplatePackByIdRequest, + _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, + ) -> GetPolicyTemplatePackByIdResponse: + """Get a policy template pack by id. + + + :param get_policy_template_pack_by_id_request: (required) + :type get_policy_template_pack_by_id_request: GetPolicyTemplatePackByIdRequest + :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._get_policy_template_pack_by_id_serialize( + get_policy_template_pack_by_id_request=get_policy_template_pack_by_id_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPolicyTemplatePackByIdResponse", + '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 get_policy_template_pack_by_id_with_http_info( + self, + get_policy_template_pack_by_id_request: GetPolicyTemplatePackByIdRequest, + _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[GetPolicyTemplatePackByIdResponse]: + """Get a policy template pack by id. + + + :param get_policy_template_pack_by_id_request: (required) + :type get_policy_template_pack_by_id_request: GetPolicyTemplatePackByIdRequest + :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._get_policy_template_pack_by_id_serialize( + get_policy_template_pack_by_id_request=get_policy_template_pack_by_id_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPolicyTemplatePackByIdResponse", + '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 get_policy_template_pack_by_id_without_preload_content( + self, + get_policy_template_pack_by_id_request: GetPolicyTemplatePackByIdRequest, + _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: + """Get a policy template pack by id. + + + :param get_policy_template_pack_by_id_request: (required) + :type get_policy_template_pack_by_id_request: GetPolicyTemplatePackByIdRequest + :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._get_policy_template_pack_by_id_serialize( + get_policy_template_pack_by_id_request=get_policy_template_pack_by_id_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPolicyTemplatePackByIdResponse", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_policy_template_pack_by_id_serialize( + self, + get_policy_template_pack_by_id_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 get_policy_template_pack_by_id_request is not None: + _body_params = get_policy_template_pack_by_id_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/policy_template_pack_service/get_policy_template_pack_by_id', + 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 get_policy_template_packs( + self, + get_policy_template_packs_request: GetPolicyTemplatePacksRequest, + _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, + ) -> GetPolicyTemplatePacksResponse: + """Get all policy template packs. + + + :param get_policy_template_packs_request: (required) + :type get_policy_template_packs_request: GetPolicyTemplatePacksRequest + :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._get_policy_template_packs_serialize( + get_policy_template_packs_request=get_policy_template_packs_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPolicyTemplatePacksResponse", + '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 get_policy_template_packs_with_http_info( + self, + get_policy_template_packs_request: GetPolicyTemplatePacksRequest, + _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[GetPolicyTemplatePacksResponse]: + """Get all policy template packs. + + + :param get_policy_template_packs_request: (required) + :type get_policy_template_packs_request: GetPolicyTemplatePacksRequest + :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._get_policy_template_packs_serialize( + get_policy_template_packs_request=get_policy_template_packs_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPolicyTemplatePacksResponse", + '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 get_policy_template_packs_without_preload_content( + self, + get_policy_template_packs_request: GetPolicyTemplatePacksRequest, + _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: + """Get all policy template packs. + + + :param get_policy_template_packs_request: (required) + :type get_policy_template_packs_request: GetPolicyTemplatePacksRequest + :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._get_policy_template_packs_serialize( + get_policy_template_packs_request=get_policy_template_packs_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPolicyTemplatePacksResponse", + '422': "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_policy_template_packs_serialize( + self, + get_policy_template_packs_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 get_policy_template_packs_request is not None: + _body_params = get_policy_template_packs_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/policy_template_pack_service/get_policy_template_packs', + 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 608c87db..13cf5648 100644 --- a/onelens_backend_client/models/__init__.py +++ b/onelens_backend_client/models/__init__.py @@ -48,6 +48,7 @@ from onelens_backend_client.models.get_all_users_response import GetAllUsersResponse from onelens_backend_client.models.get_policy_template_by_id_request import GetPolicyTemplateByIDRequest from onelens_backend_client.models.get_policy_template_by_id_response import GetPolicyTemplateByIDResponse +from onelens_backend_client.models.get_policy_template_pack_by_id_request import GetPolicyTemplatePackByIdRequest from onelens_backend_client.models.get_policy_template_pack_by_id_response import GetPolicyTemplatePackByIdResponse from onelens_backend_client.models.get_policy_template_packs_request import GetPolicyTemplatePacksRequest from onelens_backend_client.models.get_policy_template_packs_response import GetPolicyTemplatePacksResponse @@ -85,12 +86,9 @@ from onelens_backend_client.models.policy_template_state import PolicyTemplateState from onelens_backend_client.models.provider import Provider from onelens_backend_client.models.provider_config import ProviderConfig -from onelens_backend_client.models.response_create_policy_template_pack_response import ResponseCreatePolicyTemplatePackResponse from onelens_backend_client.models.response_create_tenant_user_response import ResponseCreateTenantUserResponse from onelens_backend_client.models.response_create_user_tenant_mapping_response import ResponseCreateUserTenantMappingResponse from onelens_backend_client.models.response_disable_tenant_provider_response import ResponseDisableTenantProviderResponse -from onelens_backend_client.models.response_get_policy_template_pack_by_id_response import ResponseGetPolicyTemplatePackByIdResponse -from onelens_backend_client.models.response_get_policy_template_packs_response import ResponseGetPolicyTemplatePacksResponse from onelens_backend_client.models.response_get_tenant_provider_by_id_response import ResponseGetTenantProviderByIDResponse from onelens_backend_client.models.response_get_tenant_providers_response import ResponseGetTenantProvidersResponse from onelens_backend_client.models.response_tenant_verify_response import ResponseTenantVerifyResponse diff --git a/onelens_backend_client/models/create_policy_template_request.py b/onelens_backend_client/models/create_policy_template_request.py index 25a660d6..77382c81 100644 --- a/onelens_backend_client/models/create_policy_template_request.py +++ b/onelens_backend_client/models/create_policy_template_request.py @@ -31,11 +31,12 @@ class CreatePolicyTemplateRequest(BaseModel): """ # noqa: E501 parent_ptp_id: StrictStr = Field(description="The id of the parent policy template pack.") title: StrictStr = Field(description="The title of the policy template.") + alias: StrictStr = Field(description="The alias of the policy template.") description: Optional[StrictStr] = Field(default=None, description="The description of the policy template.") services: List[CreatePolicyTemplateRequestServicesInner] = Field(description="The list of services associated the policy template.") execution_type: PolicyExecutionType = Field(description="The execution type of the policy template.") details: PolicyTemplateDetails = Field(description="The details of the policy template.") - __properties: ClassVar[List[str]] = ["parent_ptp_id", "title", "description", "services", "execution_type", "details"] + __properties: ClassVar[List[str]] = ["parent_ptp_id", "title", "alias", "description", "services", "execution_type", "details"] model_config = ConfigDict( populate_by_name=True, @@ -100,6 +101,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "parent_ptp_id": obj.get("parent_ptp_id"), "title": obj.get("title"), + "alias": obj.get("alias"), "description": obj.get("description"), "services": [CreatePolicyTemplateRequestServicesInner.from_dict(_item) for _item in obj["services"]] if obj.get("services") is not None else None, "execution_type": obj.get("execution_type"), diff --git a/onelens_backend_client/models/create_policy_template_response.py b/onelens_backend_client/models/create_policy_template_response.py index fb19f719..ad19ed12 100644 --- a/onelens_backend_client/models/create_policy_template_response.py +++ b/onelens_backend_client/models/create_policy_template_response.py @@ -34,6 +34,7 @@ class CreatePolicyTemplateResponse(BaseModel): """ # noqa: E501 parent_ptp_id: StrictStr = Field(description="The id of the parent policy template pack.") title: StrictStr = Field(description="The title of the policy template.") + alias: StrictStr = Field(description="The alias of the policy template.") description: Optional[StrictStr] = Field(default=None, description="The description of the policy template.") services: List[CreatePolicyTemplateRequestServicesInner] = Field(description="The list of services associated the policy template.") execution_type: PolicyExecutionType = Field(description="The execution type of the policy template.") @@ -42,7 +43,7 @@ class CreatePolicyTemplateResponse(BaseModel): state: PolicyTemplateState = Field(description="The state of the policy template.") category: PolicyCategory = Field(description="The category of the policy template.") provider: Provider = Field(description="The cloud provider of the policy template.") - __properties: ClassVar[List[str]] = ["parent_ptp_id", "title", "description", "services", "execution_type", "details", "id", "state", "category", "provider"] + __properties: ClassVar[List[str]] = ["parent_ptp_id", "title", "alias", "description", "services", "execution_type", "details", "id", "state", "category", "provider"] model_config = ConfigDict( populate_by_name=True, @@ -107,6 +108,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "parent_ptp_id": obj.get("parent_ptp_id"), "title": obj.get("title"), + "alias": obj.get("alias"), "description": obj.get("description"), "services": [CreatePolicyTemplateRequestServicesInner.from_dict(_item) for _item in obj["services"]] if obj.get("services") is not None else None, "execution_type": obj.get("execution_type"), diff --git a/onelens_backend_client/models/get_policy_template_by_id_response.py b/onelens_backend_client/models/get_policy_template_by_id_response.py index d7e94ba9..7f8e4f94 100644 --- a/onelens_backend_client/models/get_policy_template_by_id_response.py +++ b/onelens_backend_client/models/get_policy_template_by_id_response.py @@ -34,6 +34,7 @@ class GetPolicyTemplateByIDResponse(BaseModel): """ # noqa: E501 parent_ptp_id: StrictStr = Field(description="The id of the parent policy template pack.") title: StrictStr = Field(description="The title of the policy template.") + alias: StrictStr = Field(description="The alias of the policy template.") description: Optional[StrictStr] = Field(default=None, description="The description of the policy template.") services: List[CreatePolicyTemplateRequestServicesInner] = Field(description="The list of services associated the policy template.") execution_type: PolicyExecutionType = Field(description="The execution type of the policy template.") @@ -42,7 +43,7 @@ class GetPolicyTemplateByIDResponse(BaseModel): state: PolicyTemplateState = Field(description="The state of the policy template.") category: PolicyCategory = Field(description="The category of the policy template.") provider: Provider = Field(description="The cloud provider of the policy template.") - __properties: ClassVar[List[str]] = ["parent_ptp_id", "title", "description", "services", "execution_type", "details", "id", "state", "category", "provider"] + __properties: ClassVar[List[str]] = ["parent_ptp_id", "title", "alias", "description", "services", "execution_type", "details", "id", "state", "category", "provider"] model_config = ConfigDict( populate_by_name=True, @@ -107,6 +108,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "parent_ptp_id": obj.get("parent_ptp_id"), "title": obj.get("title"), + "alias": obj.get("alias"), "description": obj.get("description"), "services": [CreatePolicyTemplateRequestServicesInner.from_dict(_item) for _item in obj["services"]] if obj.get("services") is not None else None, "execution_type": obj.get("execution_type"), diff --git a/onelens_backend_client/models/get_policy_template_pack_by_id_request.py b/onelens_backend_client/models/get_policy_template_pack_by_id_request.py new file mode 100644 index 00000000..8ff2f7e9 --- /dev/null +++ b/onelens_backend_client/models/get_policy_template_pack_by_id_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: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class GetPolicyTemplatePackByIdRequest(BaseModel): + """ + GetPolicyTemplatePackByIdRequest + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the policy template pack") + __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 GetPolicyTemplatePackByIdRequest 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 GetPolicyTemplatePackByIdRequest 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/policy_template.py b/onelens_backend_client/models/policy_template.py index 98820d94..7a502ab5 100644 --- a/onelens_backend_client/models/policy_template.py +++ b/onelens_backend_client/models/policy_template.py @@ -34,6 +34,7 @@ class PolicyTemplate(BaseModel): """ # noqa: E501 parent_ptp_id: StrictStr = Field(description="The id of the parent policy template pack.") title: StrictStr = Field(description="The title of the policy template.") + alias: StrictStr = Field(description="The alias of the policy template.") description: Optional[StrictStr] = Field(default=None, description="The description of the policy template.") services: List[CreatePolicyTemplateRequestServicesInner] = Field(description="The list of services associated the policy template.") execution_type: PolicyExecutionType = Field(description="The execution type of the policy template.") @@ -42,7 +43,7 @@ class PolicyTemplate(BaseModel): state: PolicyTemplateState = Field(description="The state of the policy template.") category: PolicyCategory = Field(description="The category of the policy template.") provider: Provider = Field(description="The cloud provider of the policy template.") - __properties: ClassVar[List[str]] = ["parent_ptp_id", "title", "description", "services", "execution_type", "details", "id", "state", "category", "provider"] + __properties: ClassVar[List[str]] = ["parent_ptp_id", "title", "alias", "description", "services", "execution_type", "details", "id", "state", "category", "provider"] model_config = ConfigDict( populate_by_name=True, @@ -107,6 +108,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "parent_ptp_id": obj.get("parent_ptp_id"), "title": obj.get("title"), + "alias": obj.get("alias"), "description": obj.get("description"), "services": [CreatePolicyTemplateRequestServicesInner.from_dict(_item) for _item in obj["services"]] if obj.get("services") is not None else None, "execution_type": obj.get("execution_type"), diff --git a/onelens_backend_client/models/update_policy_template_response.py b/onelens_backend_client/models/update_policy_template_response.py index 17647488..192aac05 100644 --- a/onelens_backend_client/models/update_policy_template_response.py +++ b/onelens_backend_client/models/update_policy_template_response.py @@ -34,6 +34,7 @@ class UpdatePolicyTemplateResponse(BaseModel): """ # noqa: E501 parent_ptp_id: StrictStr = Field(description="The id of the parent policy template pack.") title: StrictStr = Field(description="The title of the policy template.") + alias: StrictStr = Field(description="The alias of the policy template.") description: Optional[StrictStr] = Field(default=None, description="The description of the policy template.") services: List[CreatePolicyTemplateRequestServicesInner] = Field(description="The list of services associated the policy template.") execution_type: PolicyExecutionType = Field(description="The execution type of the policy template.") @@ -42,7 +43,7 @@ class UpdatePolicyTemplateResponse(BaseModel): state: PolicyTemplateState = Field(description="The state of the policy template.") category: PolicyCategory = Field(description="The category of the policy template.") provider: Provider = Field(description="The cloud provider of the policy template.") - __properties: ClassVar[List[str]] = ["parent_ptp_id", "title", "description", "services", "execution_type", "details", "id", "state", "category", "provider"] + __properties: ClassVar[List[str]] = ["parent_ptp_id", "title", "alias", "description", "services", "execution_type", "details", "id", "state", "category", "provider"] model_config = ConfigDict( populate_by_name=True, @@ -107,6 +108,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "parent_ptp_id": obj.get("parent_ptp_id"), "title": obj.get("title"), + "alias": obj.get("alias"), "description": obj.get("description"), "services": [CreatePolicyTemplateRequestServicesInner.from_dict(_item) for _item in obj["services"]] if obj.get("services") is not None else None, "execution_type": obj.get("execution_type"), diff --git a/test/test_get_policy_template_pack_by_id_request.py b/test/test_get_policy_template_pack_by_id_request.py new file mode 100644 index 00000000..086a0024 --- /dev/null +++ b/test/test_get_policy_template_pack_by_id_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: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from onelens_backend_client.models.get_policy_template_pack_by_id_request import GetPolicyTemplatePackByIdRequest + +class TestGetPolicyTemplatePackByIdRequest(unittest.TestCase): + """GetPolicyTemplatePackByIdRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> GetPolicyTemplatePackByIdRequest: + """Test GetPolicyTemplatePackByIdRequest + 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 `GetPolicyTemplatePackByIdRequest` + """ + model = GetPolicyTemplatePackByIdRequest() + if include_optional: + return GetPolicyTemplatePackByIdRequest( + id = '' + ) + else: + return GetPolicyTemplatePackByIdRequest( + id = '', + ) + """ + + def testGetPolicyTemplatePackByIdRequest(self): + """Test GetPolicyTemplatePackByIdRequest""" + # 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_policy_template_pack_service_api.py b/test/test_policy_template_pack_service_api.py new file mode 100644 index 00000000..faf69a65 --- /dev/null +++ b/test/test_policy_template_pack_service_api.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: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from onelens_backend_client.api.policy_template_pack_service_api import PolicyTemplatePackServiceApi + + +class TestPolicyTemplatePackServiceApi(unittest.TestCase): + """PolicyTemplatePackServiceApi unit test stubs""" + + def setUp(self) -> None: + self.api = PolicyTemplatePackServiceApi() + + def tearDown(self) -> None: + pass + + def test_create_policy_template_pack(self) -> None: + """Test case for create_policy_template_pack + + Create a new policy template pack. + """ + pass + + def test_get_policy_template_pack_by_id(self) -> None: + """Test case for get_policy_template_pack_by_id + + Get a policy template pack by id. + """ + pass + + def test_get_policy_template_packs(self) -> None: + """Test case for get_policy_template_packs + + Get all policy template packs. + """ + pass + + +if __name__ == '__main__': + unittest.main()