From 5c0a52aafe3bb0881dcdf9cd36e3f2b3cd1d2237 Mon Sep 17 00:00:00 2001 From: Szymon Basan Date: Mon, 7 Oct 2024 18:30:57 +0200 Subject: [PATCH] draft: endpoints --- .../policy/definition/app_route.py | 50 +++++++++++++++++++ catalystwan/endpoints/endpoints_container.py | 2 + 2 files changed, 52 insertions(+) diff --git a/catalystwan/endpoints/configuration/policy/definition/app_route.py b/catalystwan/endpoints/configuration/policy/definition/app_route.py index e69de29b..5a9d1ad0 100644 --- a/catalystwan/endpoints/configuration/policy/definition/app_route.py +++ b/catalystwan/endpoints/configuration/policy/definition/app_route.py @@ -0,0 +1,50 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates + +# mypy: disable-error-code="empty-body" + +from uuid import UUID + +from catalystwan.endpoints import APIEndpoints, delete, get, post, put +from catalystwan.endpoints.configuration.policy.abstractions import PolicyDefinitionEndpoints +from catalystwan.models.policy.definition.app_route import ( + AppRoutePolicy, + AppRoutePolicyEditPayload, + AppRoutePolicyGetResponse, +) +from catalystwan.models.policy.policy_definition import ( + PolicyDefinitionEditResponse, + PolicyDefinitionId, + PolicyDefinitionInfo, + PolicyDefinitionPreview, +) +from catalystwan.typed_list import DataSequence + + +class ConfigurationPolicyAppRouteDefinition(APIEndpoints, PolicyDefinitionEndpoints): + @post("/template/policy/definition/approute/") + def create_policy_definition(self, payload: AppRoutePolicy) -> PolicyDefinitionId: + ... + + @delete("/template/policy/definition/approute/{id}") + def delete_policy_definition(self, id: UUID) -> None: + ... + + @put("/template/policy/definition/approute/{id}") + def edit_policy_definition(self, id: UUID, payload: AppRoutePolicyEditPayload) -> PolicyDefinitionEditResponse: + ... + + @get("/template/policy/definition/approute", "data") + def get_definitions(self) -> DataSequence[PolicyDefinitionInfo]: + ... + + @get("/template/policy/definition/approute/{id}") + def get_policy_definition(self, id: UUID) -> AppRoutePolicyGetResponse: + ... + + @post("/template/policy/definition/approute/preview") + def preview_policy_definition(self, payload: AppRoutePolicy) -> PolicyDefinitionPreview: + ... + + @get("/template/policy/definition/approute/preview/{id}") + def preview_policy_definition_by_id(self, id: UUID) -> PolicyDefinitionPreview: + ... diff --git a/catalystwan/endpoints/endpoints_container.py b/catalystwan/endpoints/endpoints_container.py index f824dfdd..c235174f 100644 --- a/catalystwan/endpoints/endpoints_container.py +++ b/catalystwan/endpoints/endpoints_container.py @@ -24,6 +24,7 @@ ) from catalystwan.endpoints.configuration.policy.definition.aip import ConfigurationPolicyAIPDefinition from catalystwan.endpoints.configuration.policy.definition.amp import ConfigurationPolicyAMPDefinition +from catalystwan.endpoints.configuration.policy.definition.app_route import ConfigurationPolicyAppRouteDefinition from catalystwan.endpoints.configuration.policy.definition.control import ConfigurationPolicyControlDefinition from catalystwan.endpoints.configuration.policy.definition.device_access import ( ConfigurationPolicyDeviceAccessDefinition, @@ -151,6 +152,7 @@ def __init__(self, session: ManagerSession): self.acl_ipv6 = ConfigurationPolicyAclIPv6Definition(session) self.advanced_inspection_profile = ConfigurationPolicyAIPDefinition(session) self.advanced_malware_protection = ConfigurationPolicyAMPDefinition(session) + self.app_route = ConfigurationPolicyAppRouteDefinition(session) self.control = ConfigurationPolicyControlDefinition(session) self.data = ConfigurationPolicyDataDefinition(session) self.device_access = ConfigurationPolicyDeviceAccessDefinition(session)