From 3d54c84eff56122443bd06fdec81b9120ee58a99 Mon Sep 17 00:00:00 2001 From: sbasan Date: Wed, 6 Sep 2023 11:53:03 +0200 Subject: [PATCH] add validation of name field, description is optional --- ENDPOINTS.md | 8 ++++---- vmngclient/model/policy_list.py | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ENDPOINTS.md b/ENDPOINTS.md index 41a71d931..b9c2908a5 100644 --- a/ENDPOINTS.md +++ b/ENDPOINTS.md @@ -52,8 +52,8 @@ PUT /template/policy/list/dataprefix/{id}||[**ConfigurationPolicyDataPrefixListB GET /template/policy/list/dataprefix/{id}||[**ConfigurationPolicyDataPrefixListBuilder.get_lists_by_id**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L62)||[**DataPrefixList**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L38)| GET /template/policy/list/dataprefix||[**ConfigurationPolicyDataPrefixListBuilder.get_policy_lists**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L66)||DataSequence[[**DataPrefixList**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L38)]| GET /template/policy/list/dataprefix/filtered||[**ConfigurationPolicyDataPrefixListBuilder.get_policy_lists_with_info_tag**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L70)||DataSequence[[**DataPrefixList**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L38)]| -POST /template/policy/list/dataprefix/preview||[**ConfigurationPolicyDataPrefixListBuilder.preview_policy_list**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L77)|[**DataPrefixListCreationPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L30)|[**PolicyListPreview**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L37)| -GET /template/policy/list/dataprefix/preview/{id}||[**ConfigurationPolicyDataPrefixListBuilder.preview_policy_list_by_id**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L82)||[**PolicyListPreview**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L37)| +POST /template/policy/list/dataprefix/preview||[**ConfigurationPolicyDataPrefixListBuilder.preview_policy_list**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L77)|[**DataPrefixListCreationPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L30)|[**PolicyListPreview**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L40)| +GET /template/policy/list/dataprefix/preview/{id}||[**ConfigurationPolicyDataPrefixListBuilder.preview_policy_list_by_id**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L82)||[**PolicyListPreview**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L40)| POST /template/policy/list/site/defaultsite||[**ConfigurationPolicySiteListBuilder.create_default_site_list**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L43)|[**SiteListCreationPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L30)|[**PolicyListId**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L11)| POST /template/policy/list/site||[**ConfigurationPolicySiteListBuilder.create_policy_list**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L47)|[**SiteListCreationPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L30)|[**PolicyListId**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L11)| DELETE /template/policy/list/site/{id}||[**ConfigurationPolicySiteListBuilder.delete_policy_list**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L51)||None| @@ -62,8 +62,8 @@ PUT /template/policy/list/site/{id}||[**ConfigurationPolicySiteListBuilder.edit_ GET /template/policy/list/site/{id}||[**ConfigurationPolicySiteListBuilder.get_lists_by_id**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L66)||[**SiteList**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L38)| GET /template/policy/list/site||[**ConfigurationPolicySiteListBuilder.get_policy_lists**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L70)||DataSequence[[**SiteList**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L38)]| GET /template/policy/list/site/filtered||[**ConfigurationPolicySiteListBuilder.get_policy_lists_with_info_tag**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L74)||DataSequence[[**SiteList**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L38)]| -POST /template/policy/list/site/preview||[**ConfigurationPolicySiteListBuilder.preview_policy_list**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L81)|[**SiteListCreationPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L30)|[**PolicyListPreview**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L37)| -GET /template/policy/list/site/preview/{id}||[**ConfigurationPolicySiteListBuilder.preview_policy_list_by_id**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L85)||[**PolicyListPreview**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L37)| +POST /template/policy/list/site/preview||[**ConfigurationPolicySiteListBuilder.preview_policy_list**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L81)|[**SiteListCreationPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L30)|[**PolicyListPreview**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L40)| +GET /template/policy/list/site/preview/{id}||[**ConfigurationPolicySiteListBuilder.preview_policy_list_by_id**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_site_list_builder.py#L85)||[**PolicyListPreview**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L40)| GET /settings/configuration/{setting_type}||[**ConfigurationSettings.get_configuration_by_setting_type**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_settings.py#L208)||dict| GET /settings/configuration/organization||[**ConfigurationSettings.get_organizations**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_settings.py#L212)||DataSequence[[**Organization**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_settings.py#L29)]| GET /settings/configuration/device||[**ConfigurationSettings.get_devices**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_settings.py#L216)||DataSequence[[**Device**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_settings.py#L35)]| diff --git a/vmngclient/model/policy_list.py b/vmngclient/model/policy_list.py index 9f48f1825..25b6b8d5f 100644 --- a/vmngclient/model/policy_list.py +++ b/vmngclient/model/policy_list.py @@ -13,8 +13,11 @@ class PolicyListId(BaseModel): class PolicyListCreationPayload(BaseModel): - name: str - description: str + name: str = Field( + regex="^[a-zA-Z0-9_-]{1,32}$", + description="Can include only alpha-numeric characters, hyphen '-' or underscore '_'; maximum 32 characters", + ) + description: Optional[str] = "Desc Not Required" type: str entries: List