diff --git a/ENDPOINTS.md b/ENDPOINTS.md index 1cefd5d1a..68ce3f2ee 100644 --- a/ENDPOINTS.md +++ b/ENDPOINTS.md @@ -45,6 +45,19 @@ PUT /v1/feature-profile/sdwan/system/{system_id}/aaa/{parcel_id}|>=20.9|[**Confi POST /v1/config-group|>=20.9|[**ConfigurationGroup.create_config_group**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_group.py#L49)|[**ConfigGroupCreationPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_group.py#L21)|[**ConfigGroupCreationResponse**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_group.py#L35)| DELETE /v1/config-group/{config_group_id}|>=20.9|[**ConfigurationGroup.delete_config_group**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_group.py#L54)||None| PUT /v1/config-group/{config_group_id}|>=20.9|[**ConfigurationGroup.edit_config_group**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_group.py#L59)|[**ConfigGroupEditPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_group.py#L28)|[**ConfigGroupEditResponse**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_group.py#L43)| +GET /v1/feature-profile/sdwan/system/aaa/schema|>=20.9|[**ConfigurationFeatureProfile.get_sdwan_system_aaa_parcel_schema**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_feature_profile.py#L55)||None| +GET /v1/feature-profile/sdwan/transport|>=20.9|[**ConfigurationFeatureProfile.get_sdwan_transport_feature_profiles**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_feature_profile.py#L60)|Optional[[**GetFeatureProfilesPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_feature_profile.py#L49)]|DataSequence[[**FeatureProfileInfo**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_feature_profile.py#L28)]| +POST /v1/feature-profile/sdwan/transport|>=20.9|[**ConfigurationFeatureProfile.create_sdwan_transport_feature_profile**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_feature_profile.py#L67)|[**FeatureProfileCreationPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_feature_profile.py#L40)|[**FeatureProfileCreationResponse**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_feature_profile.py#L45)| +DELETE /v1/feature-profile/sdwan/transport/{transport_id}|>=20.9|[**ConfigurationFeatureProfile.delete_sdwan_transport_feature_profile**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_feature_profile.py#L74)||None| +POST /template/policy/list/dataprefix||[**ConfigurationPolicyDataPrefixListBuilder.create_policy_list**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L43)|[**DataPrefixListCreationPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L30)|[**PolicyListId**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/model/policy_list.py#L11)| +DELETE /template/policy/list/dataprefix/{id}||[**ConfigurationPolicyDataPrefixListBuilder.delete_policy_list**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L47)||None| +DELETE /template/policy/list/dataprefix||[**ConfigurationPolicyDataPrefixListBuilder.delete_policy_lists_with_info_tag**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L51)||None| +PUT /template/policy/list/dataprefix/{id}||[**ConfigurationPolicyDataPrefixListBuilder.edit_policy_list**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L58)|[**DataPrefixListEditPayload**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py#L34)|None| +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)|None| +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)| 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/endpoints/configuration_policy_data_prefix_list_builder.py b/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py new file mode 100644 index 000000000..15f79be2f --- /dev/null +++ b/vmngclient/endpoints/configuration_policy_data_prefix_list_builder.py @@ -0,0 +1,84 @@ +# mypy: disable-error-code="empty-body" +from typing import List + +from pydantic import BaseModel, Field, IPvAnyNetwork + +from vmngclient.endpoints import APIEndpoints, delete, get, post, put +from vmngclient.model.policy_list import ( + InfoTag, + PolicyList, + PolicyListCreationPayload, + PolicyListEditPayload, + PolicyListId, + PolicyListPreview, +) +from vmngclient.typed_list import DataSequence + + +class DataPrefixListEntry(BaseModel): + class Config: + allow_population_by_field_name = True + + ip_prefix: IPvAnyNetwork = Field(alias="ipPrefix") + + +class DataPrefixPayload(BaseModel): + entries: List[DataPrefixListEntry] + type: str = Field(default="dataPrefix", const=True) + + +class DataPrefixListCreationPayload(DataPrefixPayload, PolicyListCreationPayload): + pass + + +class DataPrefixListEditPayload(DataPrefixPayload, PolicyListEditPayload): + pass + + +class DataPrefixList(DataPrefixPayload, PolicyList): + pass + + +class ConfigurationPolicyDataPrefixListBuilder(APIEndpoints): + @post("/template/policy/list/dataprefix") + def create_policy_list(self, payload: DataPrefixListCreationPayload) -> PolicyListId: + ... + + @delete("/template/policy/list/dataprefix/{id}") + def delete_policy_list(self, id: str) -> None: + ... + + @delete("/template/policy/list/dataprefix") + def delete_policy_lists_with_info_tag(self, params: InfoTag) -> None: + # TODO: dont know how to assing tags to check if filter works + # (it is present in GET response but cannot be added to POST, PUT payload) + # for now it was tested with default info tag value == "" + ... + + @put("/template/policy/list/dataprefix/{id}") + def edit_policy_list(self, id: str, payload: DataPrefixListEditPayload) -> None: + ... + + @get("/template/policy/list/dataprefix/{id}") + def get_lists_by_id(self, id: str) -> DataPrefixList: + ... + + @get("/template/policy/list/dataprefix", "data") + def get_policy_lists(self) -> DataSequence[DataPrefixList]: + ... + + @get("/template/policy/list/dataprefix/filtered", "data") + def get_policy_lists_with_info_tag(self, params: InfoTag) -> DataSequence[DataPrefixList]: + # TODO: dont know how to assing tags to check if filter works + # (it is present in GET response but cannot be added to POST, PUT payload) + # for now it was tested with default info tag value == "" + ... + + @post("/template/policy/list/dataprefix/preview") + def preview_policy_list(self, payload: DataPrefixListCreationPayload) -> None: + # TODO: not working for some reason + ... + + @get("/template/policy/list/dataprefix/preview/{id}") + def preview_policy_list_by_id(self, id: str) -> PolicyListPreview: + ... diff --git a/vmngclient/endpoints/endpoints_container.py b/vmngclient/endpoints/endpoints_container.py index 1ad3b841e..900faf520 100644 --- a/vmngclient/endpoints/endpoints_container.py +++ b/vmngclient/endpoints/endpoints_container.py @@ -12,6 +12,7 @@ from vmngclient.endpoints.configuration_device_template import ConfigurationDeviceTemplate from vmngclient.endpoints.configuration_feature_profile import ConfigurationFeatureProfile from vmngclient.endpoints.configuration_group import ConfigurationGroup +from vmngclient.endpoints.configuration_policy_data_prefix_list_builder import ConfigurationPolicyDataPrefixListBuilder from vmngclient.endpoints.configuration_settings import ConfigurationSettings from vmngclient.endpoints.monitoring_device_details import MonitoringDeviceDetails from vmngclient.endpoints.monitoring_status import MonitoringStatus @@ -34,6 +35,7 @@ def __init__(self, session: vManageSession): self.configuration_device_actions = ConfigurationDeviceActions(session) self.configuration_device_software_update = ConfigurationDeviceSoftwareUpdate(session) self.configuration_device_template = ConfigurationDeviceTemplate(session) + self.configuration_policy_data_prefix_list_builder = ConfigurationPolicyDataPrefixListBuilder(session) self.configuration_settings = ConfigurationSettings(session) self.monitoring_device_details = MonitoringDeviceDetails(session) self.monitoring_status = MonitoringStatus(session)