Skip to content

chore(nhi): added is_secret_vaulted attribute to PolicyBreak #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pygitguardian/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ class PolicyBreakSchema(BaseSchema):
diff_kind = fields.Enum(
DiffKind, by_value=True, required=False, load_default=None, dump_default=None
)
is_secret_vaulted = fields.Boolean(
required=False, load_default=False, dump_default=False
)

@post_load
def make_policy_break(self, data: Dict[str, Any], **kwargs: Any) -> "PolicyBreak":
Expand Down Expand Up @@ -261,6 +264,7 @@ def __init__(
is_excluded: bool = False,
exclude_reason: Optional[str] = None,
diff_kind: Optional[DiffKind] = None,
is_secret_vaulted: bool = False,
**kwargs: Any,
) -> None:
super().__init__()
Expand All @@ -276,6 +280,7 @@ def __init__(
self.is_excluded = is_excluded
self.exclude_reason = exclude_reason
self.diff_kind = diff_kind
self.is_secret_vaulted = is_secret_vaulted

@property
def is_secret(self) -> bool:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def test_document_handle_surrogates(self):
"is_excluded": False,
"exclude_reason": None,
"diff_kind": None,
"is_secret_vaulted": False,
},
),
(
Expand All @@ -191,6 +192,7 @@ def test_document_handle_surrogates(self):
"is_excluded": False,
"exclude_reason": None,
"diff_kind": "addition",
"is_secret_vaulted": True,
},
),
(
Expand Down
Loading