diff --git a/.flake8 b/.flake8 index 7976b0ec4..dae21715f 100644 --- a/.flake8 +++ b/.flake8 @@ -1,7 +1,7 @@ [flake8] per-file-ignores = catalystwan/models/policy/__init__.py: F401 - catalystwan/models/configuration/feature_profile/sdwan/interest_groups/__init__.py: F401 + catalystwan/models/configuration/feature_profile/sdwan/policy_object/__init__.py: F401 max-line-length = 120 inline-quotes = double # https://black.readthedocs.io/en/stable/faq.html#why-are-flake8-s-e203-and-w503-violated diff --git a/catalystwan/api/feature_profile_api.py b/catalystwan/api/feature_profile_api.py index 962b73aef..abdf84871 100644 --- a/catalystwan/api/feature_profile_api.py +++ b/catalystwan/api/feature_profile_api.py @@ -9,7 +9,7 @@ from catalystwan.session import ManagerSession from catalystwan.api.parcel_api import SDRoutingFullConfigParcelAPI -from catalystwan.endpoints.configuration.feature_profile.sdwan.interest_groups import PolicyObjectFeatureProfile +from catalystwan.endpoints.configuration.feature_profile.sdwan.policy_object import PolicyObjectFeatureProfile from catalystwan.endpoints.configuration_feature_profile import SDRoutingConfigurationFeatureProfile from catalystwan.models.configuration.feature_profile.common import ( FeatureProfileCreationPayload, @@ -17,9 +17,9 @@ Parcel, ParcelCreationResponse, ) -from catalystwan.models.configuration.feature_profile.sdwan.interest_groups import ( - INTEREST_GROUP_PAYLOAD_ENDPOINT_MAPPING, - AnyInterestGroupParcel, +from catalystwan.models.configuration.feature_profile.sdwan.policy_object import ( + POLICY_OBJECT_PAYLOAD_ENDPOINT_MAPPING, + AnyPolicyObjectParcel, ApplicationListParcel, AppProbeParcel, ColorParcel, @@ -337,14 +337,14 @@ def get(self, profile_id: UUID, parcel_type: Type[URLBlockParcel], parcel_id: UU def get( self, profile_id: UUID, - parcel_type: Type[AnyInterestGroupParcel], + parcel_type: Type[AnyPolicyObjectParcel], parcel_id: Union[UUID, None] = None, ) -> DataSequence[Parcel[Any]]: """ Get all Policy Objects for selected profile_id and selected type or get one Policy Object given parcel id """ - policy_object_list_type = INTEREST_GROUP_PAYLOAD_ENDPOINT_MAPPING[parcel_type] + policy_object_list_type = POLICY_OBJECT_PAYLOAD_ENDPOINT_MAPPING[parcel_type] if not parcel_id: return self.endpoint.get_all(profile_id=profile_id, policy_object_list_type=policy_object_list_type) parcel = self.endpoint.get_by_id( @@ -352,22 +352,22 @@ def get( ) return DataSequence(Parcel, [parcel]) - def create(self, profile_id: UUID, payload: AnyInterestGroupParcel) -> ParcelCreationResponse: + def create(self, profile_id: UUID, payload: AnyPolicyObjectParcel) -> ParcelCreationResponse: """ Create Policy Object for selected profile_id based on payload type """ - policy_object_list_type = INTEREST_GROUP_PAYLOAD_ENDPOINT_MAPPING[type(payload)] + policy_object_list_type = POLICY_OBJECT_PAYLOAD_ENDPOINT_MAPPING[type(payload)] return self.endpoint.create( profile_id=profile_id, policy_object_list_type=policy_object_list_type, payload=payload ) - def update(self, profile_id: UUID, payload: AnyInterestGroupParcel, list_object_id: UUID): + def update(self, profile_id: UUID, payload: AnyPolicyObjectParcel, list_object_id: UUID): """ Update Policy Object for selected profile_id based on payload type """ - policy_type = INTEREST_GROUP_PAYLOAD_ENDPOINT_MAPPING[type(payload)] + policy_type = POLICY_OBJECT_PAYLOAD_ENDPOINT_MAPPING[type(payload)] return self.endpoint.update( profile_id=profile_id, policy_object_list_type=policy_type, list_object_id=list_object_id, payload=payload ) @@ -468,12 +468,12 @@ def delete(self, profile_id: UUID, parcel_type: Type[URLAllowParcel], list_objec def delete(self, profile_id: UUID, parcel_type: Type[URLBlockParcel], list_object_id: UUID) -> None: ... - def delete(self, profile_id: UUID, parcel_type: Type[AnyInterestGroupParcel], list_object_id: UUID) -> None: + def delete(self, profile_id: UUID, parcel_type: Type[AnyPolicyObjectParcel], list_object_id: UUID) -> None: """ Delete Policy Object for selected profile_id based on payload type """ - policy_object_list_type = INTEREST_GROUP_PAYLOAD_ENDPOINT_MAPPING[parcel_type] + policy_object_list_type = POLICY_OBJECT_PAYLOAD_ENDPOINT_MAPPING[parcel_type] return self.endpoint.delete( profile_id=profile_id, policy_object_list_type=policy_object_list_type, list_object_id=list_object_id ) diff --git a/catalystwan/endpoints/configuration/feature_profile/sdwan/interest_groups.py b/catalystwan/endpoints/configuration/feature_profile/sdwan/policy_object.py similarity index 95% rename from catalystwan/endpoints/configuration/feature_profile/sdwan/interest_groups.py rename to catalystwan/endpoints/configuration/feature_profile/sdwan/policy_object.py index d86319ff6..31f7aa587 100644 --- a/catalystwan/endpoints/configuration/feature_profile/sdwan/interest_groups.py +++ b/catalystwan/endpoints/configuration/feature_profile/sdwan/policy_object.py @@ -3,7 +3,7 @@ from catalystwan.endpoints import APIEndpoints, delete, get, post, put, versions from catalystwan.models.configuration.feature_profile.common import Parcel, ParcelCreationResponse -from catalystwan.models.configuration.feature_profile.sdwan.interest_groups import AnyInterestGroupParcel +from catalystwan.models.configuration.feature_profile.sdwan.policy_object import AnyPolicyObjectParcel from catalystwan.typed_list import DataSequence @@ -11,7 +11,7 @@ class PolicyObjectFeatureProfile(APIEndpoints): @versions(supported_versions=(">=20.13"), raises=False) @post("/v1/feature-profile/sdwan/policy-object/{profile_id}/{policy_object_list_type}") def create( - self, profile_id: UUID, policy_object_list_type: str, payload: AnyInterestGroupParcel + self, profile_id: UUID, policy_object_list_type: str, payload: AnyPolicyObjectParcel ) -> ParcelCreationResponse: ... @@ -37,7 +37,7 @@ def delete(self, profile_id: UUID, policy_object_list_type: str, list_object_id: @versions(supported_versions=(">=20.13"), raises=False) @put("/v1/feature-profile/sdwan/policy-object/{profile_id}/{policy_object_list_type}/{list_object_id}") def update( - self, profile_id: UUID, policy_object_list_type: str, list_object_id: UUID, payload: AnyInterestGroupParcel + self, profile_id: UUID, policy_object_list_type: str, list_object_id: UUID, payload: AnyPolicyObjectParcel ) -> ParcelCreationResponse: ... diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/__init__.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/__init__.py similarity index 98% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/__init__.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/__init__.py index 4bc1c4c40..a2a32939f 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/__init__.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/__init__.py @@ -59,7 +59,7 @@ from .security.zone import SecurityZoneListEntry as SecurityZoneListEntry from .security.zone import SecurityZoneListParcel as SecurityZoneListParcel -AnyInterestGroupParcel = Annotated[ +AnyPolicyObjectParcel = Annotated[ Union[ AppProbeParcel, ApplicationListParcel, @@ -90,7 +90,7 @@ Field(discriminator="type"), ] -INTEREST_GROUP_PAYLOAD_ENDPOINT_MAPPING: Mapping[type, str] = { +POLICY_OBJECT_PAYLOAD_ENDPOINT_MAPPING: Mapping[type, str] = { AppProbeParcel: "app-probe", ApplicationListParcel: "app-list", ColorParcel: "color", diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/app_probe.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/app_probe.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/app_probe.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/app_probe.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/application_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/application_list.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/application_list.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/application_list.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/color_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/color_list.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/color_list.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/color_list.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/data_prefix.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/data_prefix.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/data_prefix.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/data_prefix.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/expanded_community_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/expanded_community_list.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/expanded_community_list.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/expanded_community_list.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/fowarding_class.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/fowarding_class.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/fowarding_class.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/fowarding_class.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/ipv6_data_prefix.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_data_prefix.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/ipv6_data_prefix.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_data_prefix.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/ipv6_prefix_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_prefix_list.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/ipv6_prefix_list.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_prefix_list.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/policier.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/policier.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/policier.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/policier.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/prefered_group_color.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/prefered_group_color.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/prefered_group_color.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/prefered_group_color.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/prefix_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/prefix_list.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/prefix_list.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/prefix_list.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/sla_class.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/sla_class.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/sla_class.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/sla_class.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/standard_community.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/standard_community.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/standard_community.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/standard_community.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/tloc_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/tloc_list.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/policy/tloc_list.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/tloc_list.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/application_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/application_list.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/application_list.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/application_list.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/data_prefix.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/data_prefix.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/data_prefix.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/data_prefix.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/fqdn.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/fqdn.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/fqdn.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/fqdn.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/geolocation_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/geolocation_list.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/geolocation_list.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/geolocation_list.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/ips_signature.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/ips_signature.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/ips_signature.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/ips_signature.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/local_domain.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/local_domain.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/local_domain.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/local_domain.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/protocol_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/protocol_list.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/protocol_list.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/protocol_list.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/security_port.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/security_port.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/security_port.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/security_port.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/url.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/url.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/url.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/url.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/zone.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/zone.py similarity index 100% rename from catalystwan/models/configuration/feature_profile/sdwan/interest_groups/security/zone.py rename to catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/zone.py diff --git a/examples/parcel_configuration_guide.py b/examples/parcel_configuration_guide.py index 30a70bab7..a66bfb264 100644 --- a/examples/parcel_configuration_guide.py +++ b/examples/parcel_configuration_guide.py @@ -9,7 +9,7 @@ from catalystwan.endpoints.configuration_feature_profile import ConfigurationFeatureProfile from catalystwan.models.common import InterfaceTypeEnum, TLOCColorEnum, WellKnownBGPCommunitiesEnum from catalystwan.models.configuration.feature_profile.common import ParcelCreationResponse -from catalystwan.models.configuration.feature_profile.sdwan.interest_groups import ( +from catalystwan.models.configuration.feature_profile.sdwan.policy_object import ( ApplicationListParcel, AppProbeParcel, ColorParcel,