-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework policies; Introduce separate sequence for destroy action; Remo…
…ve references to NETWORK_RULE before dropping it
- Loading branch information
Showing
58 changed files
with
1,092 additions
and
193 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
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
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,37 @@ | ||
from snowddl.blueprint import AccountObjectIdent, NetworkPolicyBlueprint, NetworkPolicyReference, ObjectType | ||
from snowddl.parser.abc_parser import AbstractParser, ParsedFile | ||
|
||
from typing import Type | ||
|
||
|
||
# fmt: off | ||
account_policy_json_schema = { | ||
"type": "object", | ||
"properties": { | ||
"network_policy": { | ||
"type": "string" | ||
}, | ||
}, | ||
"additionalProperties": False | ||
} | ||
# fmt: on | ||
|
||
|
||
class AccountPolicyParser(AbstractParser): | ||
def load_blueprints(self): | ||
self.parse_single_file(self.base_path / "account_policy.yaml", account_policy_json_schema, self.process_account_policy) | ||
|
||
def process_account_policy(self, f: ParsedFile): | ||
if self.env_prefix: | ||
# Account-level policies are ignored with env_prefix is present | ||
# Can only assign one account-level policy per account, no way around it | ||
return | ||
|
||
if f.params.get("network_policy"): | ||
policy_name = AccountObjectIdent(self.env_prefix, f.params.get("network_policy")) | ||
|
||
ref = NetworkPolicyReference( | ||
object_type=ObjectType.ACCOUNT, | ||
) | ||
|
||
self.config.add_policy_reference_to_blueprint(NetworkPolicyBlueprint, policy_name, ref) |
Oops, something went wrong.