This repository has been archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add basic support for policy-group endpoints, introduce runner * bump dev version
- Loading branch information
Showing
8 changed files
with
329 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 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, versions | ||
from catalystwan.models.configuration.policy_group import PolicyGroup, PolicyGroupId | ||
from catalystwan.typed_list import DataSequence | ||
|
||
|
||
class PolicyGroupEndpoints(APIEndpoints): | ||
@post("/v1/policy-group") | ||
@versions(">=20.12") | ||
def create_policy_group(self, payload: PolicyGroup) -> PolicyGroupId: | ||
... | ||
|
||
@get("/v1/policy-group") | ||
@versions(">=20.12") | ||
def get_all(self) -> DataSequence[PolicyGroupId]: | ||
... | ||
|
||
@delete("/v1/policy-group/{group_id}") | ||
@versions(">=20.12") | ||
def delete(self, group_id: UUID) -> None: | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from typing import List, Literal, Optional | ||
from uuid import UUID | ||
|
||
from pydantic import BaseModel, ConfigDict, Field | ||
|
||
|
||
class Profile(BaseModel): | ||
id: UUID | ||
|
||
|
||
Solution = Literal[ | ||
"sd-routing", | ||
"sdwan", | ||
] | ||
|
||
|
||
class FromPolicyGroup(BaseModel): | ||
model_config = ConfigDict(populate_by_name=True) | ||
copy_: UUID = Field(validation_alias="copy", serialization_alias="copy") | ||
|
||
|
||
class PolicyGroup(BaseModel): | ||
model_config = ConfigDict(populate_by_name=True) | ||
description: str = Field() | ||
name: str = Field(pattern='^[^&<>! "]+$') | ||
from_policy_group: Optional[FromPolicyGroup] = Field( | ||
default=None, validation_alias="fromPolicyGroup", serialization_alias="fromPolicyGroup" | ||
) | ||
profiles: Optional[List[Profile]] = Field( | ||
default=None, description="list of profile ids that belongs to the policy group" | ||
) | ||
solution: Optional[Solution] = Field(default=None) | ||
|
||
|
||
class ProfileInfo(BaseModel): | ||
model_config = ConfigDict(populate_by_name=True) | ||
id: str = Field() | ||
profile_type: Optional[Literal["global"]] = Field( | ||
default=None, validation_alias="profileType", serialization_alias="profileType" | ||
) | ||
|
||
|
||
class PolicyGroupId(BaseModel): | ||
model_config = ConfigDict(populate_by_name=True) | ||
id: UUID | ||
profiles: Optional[List[ProfileInfo]] = Field( | ||
default=None, | ||
description="(Optional - only applicable for AON) List of profile ids that belongs to the policy group", | ||
) |
Oops, something went wrong.