Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev' into converter/tgapi
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkrajewski authored Jul 24, 2024
2 parents 6235116 + fab7d4d commit 53a8da7
Show file tree
Hide file tree
Showing 26 changed files with 532 additions and 258 deletions.
20 changes: 20 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "pip"
directory: "/"
target-branch: "python-dependencies"
open-pull-requests-limit: 1
schedule:
interval: "weekly"
groups:
python-dev:
applies-to: version-updates
update-types:
- "minor"
- "patch"
32 changes: 0 additions & 32 deletions .github/workflows/documentation.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Static code analyzer
on:
pull_request:

permissions: read-all

jobs:
analyze_code:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Publish to PyPi


on:
push:
tags:
- '*.*.*'

permissions: read-all

jobs:
publish_release:
runs-on: ubuntu-latest
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: scorecard

on:
push:
branches:
# Run on pushes to default branch
- main
schedule:
# Run weekly on Saturdays
- cron: "30 1 * * 6"
# Run when branch protection rules change
branch_protection_rule:
# Run the workflow manually
workflow_dispatch:

# Declare default permissions as read-only
permissions: read-all

jobs:
run-scorecard:
# Call reusable workflow file
uses: cisco-ospo/.github/.github/workflows/_scorecard.yml@main
permissions:
id-token: write
security-events: write
secrets: inherit
with:
# Publish results of Scorecard analysis
publish-results: true
2 changes: 2 additions & 0 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Run unittests
on:
pull_request:

permissions: read-all

jobs:
unittests:
runs-on: ubuntu-latest
Expand Down
52 changes: 0 additions & 52 deletions .github/workflows/version.yml

This file was deleted.

284 changes: 142 additions & 142 deletions ENDPOINTS.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion catalystwan/api/admin_tech_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def generate(
except ManagerHTTPError as http_error:
response = http_error.response # type: ignore
if response.status_code == 200:
return response.json()["fileName"]
filename = response.json()["fileName"]
self._get_token_id(filename=filename, timeout=request_timeout, interval=polling_interval)
return filename
if response.status_code == 400 and create_admin_tech_error_msgs in response.json().get("error", {}).get(
"details", ""
):
Expand Down
22 changes: 22 additions & 0 deletions catalystwan/api/policy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
from catalystwan.endpoints.configuration.policy.list.extended_community import ConfigurationPolicyExtendedCommunityList
from catalystwan.endpoints.configuration.policy.list.fqdn import ConfigurationPolicyFQDNList, FQDNListInfo
from catalystwan.endpoints.configuration.policy.list.geo_location import ConfigurationPolicyGeoLocationList
from catalystwan.endpoints.configuration.policy.list.identity import ConfigurationPolicyIdentityList
from catalystwan.endpoints.configuration.policy.list.ips_signature import ConfigurationPolicyIPSSignatureList
from catalystwan.endpoints.configuration.policy.list.ipv6_prefix import ConfigurationPolicyIPv6PrefixList
from catalystwan.endpoints.configuration.policy.list.local_app import ConfigurationPolicyLocalAppList, LocalAppListInfo
Expand All @@ -77,6 +78,7 @@
ProtocolNameListInfo,
)
from catalystwan.endpoints.configuration.policy.list.region import ConfigurationPolicyRegionList, RegionListInfo
from catalystwan.endpoints.configuration.policy.list.scalable_group_tag import ConfigurationPolicyScalableGroupTagList
from catalystwan.endpoints.configuration.policy.list.site import ConfigurationPolicySiteList, SiteListInfo
from catalystwan.endpoints.configuration.policy.list.sla import ConfigurationPolicySLAClassList, SLAClassListInfo
from catalystwan.endpoints.configuration.policy.list.threat_grid_api_key import ConfigurationPolicyThreatGridApiKeyList
Expand Down Expand Up @@ -183,9 +185,11 @@
from catalystwan.models.policy.list.data_ipv6_prefix import DataIPv6PrefixListInfo
from catalystwan.models.policy.list.data_prefix import DataPrefixListInfo
from catalystwan.models.policy.list.geo_location import GeoLocationListInfo
from catalystwan.models.policy.list.identity import IdentityList, IdentityListInfo
from catalystwan.models.policy.list.ips_signature import IPSSignatureListInfo
from catalystwan.models.policy.list.ipv6_prefix import IPv6PrefixListInfo
from catalystwan.models.policy.list.local_domain import LocalDomainListInfo
from catalystwan.models.policy.list.scalable_group_tag import ScalableGroupTagList, ScalableGroupTagListInfo
from catalystwan.models.policy.list.threat_grid_api_key import ThreatGridApiKeyList, ThreatGridApiKeyListInfo
from catalystwan.models.policy.list.trunkgroup import TrunkGroupList, TrunkGroupListInfo
from catalystwan.models.policy.list.umbrella_data import UmbrellaDataList, UmbrellaDataListInfo
Expand Down Expand Up @@ -233,6 +237,7 @@
LocalDomainList: ConfigurationPolicyLocalDomainList,
MirrorList: ConfigurationPolicyMirrorList,
PolicerList: ConfigurationPolicyPolicerClassList,
ScalableGroupTagList: ConfigurationPolicyScalableGroupTagList,
PortList: ConfigurationPolicyPortList,
PreferredColorGroupList: ConfigurationPreferredColorGroupList,
PrefixList: ConfigurationPolicyPrefixList,
Expand All @@ -248,6 +253,7 @@
URLAllowList: ConfigurationPolicyURLAllowList,
VPNList: ConfigurationPolicyVPNList,
ZoneList: ConfigurationPolicyZoneList,
IdentityList: ConfigurationPolicyIdentityList,
}

POLICY_DEFINITION_ENDPOINTS_MAP: Mapping[type, type] = {
Expand Down Expand Up @@ -544,6 +550,14 @@ def get(self, type: Type[VPNList]) -> DataSequence[VPNListInfo]:
def get(self, type: Type[ZoneList]) -> DataSequence[ZoneListInfo]:
...

@overload
def get(self, type: Type[ScalableGroupTagList]) -> DataSequence[ScalableGroupTagListInfo]:
...

@overload
def get(self, type: Type[IdentityList]) -> DataSequence[IdentityListInfo]:
...

# get by id

@overload
Expand Down Expand Up @@ -678,6 +692,14 @@ def get(self, type: Type[VPNList], id: UUID) -> VPNListInfo:
def get(self, type: Type[ZoneList], id: UUID) -> ZoneListInfo:
...

@overload
def get(self, type: Type[ScalableGroupTagList], id: UUID) -> ScalableGroupTagListInfo:
...

@overload
def get(self, type: Type[IdentityList], id: UUID) -> IdentityListInfo:
...

def get(self, type: Type[AnyPolicyList], id: Optional[UUID] = None) -> Any:
endpoints = self.__get_list_endpoints_instance(type)
if id is not None:
Expand Down
48 changes: 48 additions & 0 deletions catalystwan/endpoints/configuration/policy/list/identity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2023 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 PolicyListEndpoints
from catalystwan.models.policy.list.identity import IdentityList, IdentityListEditPayload, IdentityListInfo
from catalystwan.models.policy.policy_list import InfoTag, PolicyListId, PolicyListPreview
from catalystwan.typed_list import DataSequence


class ConfigurationPolicyIdentityList(APIEndpoints, PolicyListEndpoints):
@post("/template/policy/list/identity")
def create_policy_list(self, payload: IdentityList) -> PolicyListId:
...

@delete("/template/policy/list/identity/{id}")
def delete_policy_list(self, id: UUID) -> None:
...

@delete("/template/policy/list/identity")
def delete_policy_lists_with_info_tag(self, params: InfoTag) -> None:
...

@put("/template/policy/list/identity/{id}")
def edit_policy_list(self, id: UUID, payload: IdentityListEditPayload) -> None:
...

@get("/template/policy/list/identity/{id}")
def get_lists_by_id(self, id: UUID) -> IdentityListInfo:
...

@get("/template/policy/list/identity", "data")
def get_policy_lists(self) -> DataSequence[IdentityListInfo]:
...

@get("/template/policy/list/identity/filtered", "data")
def get_policy_lists_with_info_tag(self, params: InfoTag) -> DataSequence[IdentityListInfo]:
...

@post("/template/policy/list/identity/preview")
def preview_policy_list(self, payload: IdentityList) -> PolicyListPreview:
...

@get("/template/policy/list/identity/preview/{id}")
def preview_policy_list_by_id(self, id: UUID) -> PolicyListPreview:
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2023 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 PolicyListEndpoints
from catalystwan.models.policy.list.scalable_group_tag import (
ScalableGroupTagList,
ScalableGroupTagListEditPayload,
ScalableGroupTagListInfo,
)
from catalystwan.models.policy.policy_list import InfoTag, PolicyListId, PolicyListPreview
from catalystwan.typed_list import DataSequence


class ConfigurationPolicyScalableGroupTagList(APIEndpoints, PolicyListEndpoints):
@post("/template/policy/list/scalablegrouptag")
def create_policy_list(self, payload: ScalableGroupTagList) -> PolicyListId:
...

@delete("/template/policy/list/scalablegrouptag/{id}")
def delete_policy_list(self, id: UUID) -> None:
...

@delete("/template/policy/list/scalablegrouptag")
def delete_policy_lists_with_info_tag(self, params: InfoTag) -> None:
...

@put("/template/policy/list/scalablegrouptag/{id}")
def edit_policy_list(self, id: UUID, payload: ScalableGroupTagListEditPayload) -> None:
...

@get("/template/policy/list/scalablegrouptag/{id}")
def get_lists_by_id(self, id: UUID) -> ScalableGroupTagListInfo:
...

@get("/template/policy/list/scalablegrouptag", "data")
def get_policy_lists(self) -> DataSequence[ScalableGroupTagListInfo]:
...

@get("/template/policy/list/scalablegrouptag/filtered", "data")
def get_policy_lists_with_info_tag(self, params: InfoTag) -> DataSequence[ScalableGroupTagListInfo]:
...

@post("/template/policy/list/scalablegrouptag/preview")
def preview_policy_list(self, payload: ScalableGroupTagList) -> PolicyListPreview:
...

@get("/template/policy/list/scalablegrouptag/preview/{id}")
def preview_policy_list_by_id(self, id: UUID) -> PolicyListPreview:
...
6 changes: 4 additions & 2 deletions catalystwan/endpoints/configuration_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ class HardwareRootCA(BaseModel):
class Certificate(BaseModel):
model_config = ConfigDict(populate_by_name=True)
certificate_signing: str = Field(serialization_alias="certificateSigning", validation_alias="certificateSigning")
validity_period: Optional[str] = Field(serialization_alias="validityPeriod", validation_alias="validityPeriod")
validity_period: Optional[str] = Field(
default=None, serialization_alias="validityPeriod", validation_alias="validityPeriod"
)
retrieve_interval: Optional[str] = Field(
serialization_alias="retrieveInterval", validation_alias="retrieveInterval"
default=None, serialization_alias="retrieveInterval", validation_alias="retrieveInterval"
)
first_name: Optional[str] = Field(default=None, serialization_alias="firstName", validation_alias="firstName")
last_name: Optional[str] = Field(default=None, serialization_alias="lastName", validation_alias="lastName")
Expand Down
Loading

0 comments on commit 53a8da7

Please sign in to comment.