Skip to content

Commit

Permalink
allow empty string as security policy mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan committed Nov 21, 2024
1 parent c3c514c commit 0beb2c8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions catalystwan/models/policy/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class UnifiedSecurityPolicyDefinition(PolicyDefinition):


class SecurityPolicy(PolicyCreationPayload):
policy_mode: Literal[None, "security"] = Field(
policy_mode: Literal[None, "", "security"] = Field(
default="security", serialization_alias="policyMode", validation_alias="policyMode"
)
policy_type: str = Field(default="feature", serialization_alias="policyType", validation_alias="policyType")
Expand All @@ -138,26 +138,26 @@ class SecurityPolicy(PolicyCreationPayload):
def get_assemby_item_uuids(self) -> Set[UUID]:
return set((item.definition_id for item in self.policy_definition.assembly))

def add_item(self, item: SecurityPolicyAssemblyItem) -> None:
def _add_item(self, item: SecurityPolicyAssemblyItem) -> None:
self.policy_definition.assembly.append(item)

def add_zone_based_fw(self, definition_id: UUID) -> None:
self.add_item(ZoneBasedFWAssemblyItem(definition_id=definition_id))
self._add_item(ZoneBasedFWAssemblyItem(definition_id=definition_id))

def add_dns_security(self, definition_id: UUID) -> None:
self.add_item(DNSSecurityAssemblyItem(definition_id=definition_id))
self._add_item(DNSSecurityAssemblyItem(definition_id=definition_id))

def add_intrusion_prevention(self, definition_id: UUID) -> None:
self.add_item(IntrusionPreventionAssemblyItem(definition_id=definition_id))
self._add_item(IntrusionPreventionAssemblyItem(definition_id=definition_id))

def add_url_filtering(self, definition_id: UUID) -> None:
self.add_item(URLFilteringAssemblyItem(definition_id=definition_id))
self._add_item(URLFilteringAssemblyItem(definition_id=definition_id))

def add_advanced_malware_protection(self, definition_id: UUID) -> None:
self.add_item(AdvancedMalwareProtectionAssemblyItem(definition_id=definition_id))
self._add_item(AdvancedMalwareProtectionAssemblyItem(definition_id=definition_id))

def add_ssl_decryption(self, definition_id: UUID) -> None:
self.add_item(SSLDecryptionAssemblyItem(definition_id=definition_id))
self._add_item(SSLDecryptionAssemblyItem(definition_id=definition_id))

@field_validator("policy_definition", mode="before")
@classmethod
Expand Down

0 comments on commit 0beb2c8

Please sign in to comment.