-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] scanner package resource (#139)
* scanner package resource --------- Co-authored-by: TJ Murphy <[email protected]>
- Loading branch information
Showing
12 changed files
with
153 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "CIS_BENCHMARKS", | ||
"enabled": true, | ||
"schedule": "0 0 0 * * UTC" | ||
} |
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
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,43 @@ | ||
from dataclasses import dataclass | ||
|
||
from ..enums import ResourceType | ||
from ..props import ( | ||
Props, | ||
) | ||
from ..resource_name import ResourceName | ||
from ..scope import AccountScope | ||
from .resource import NamedResource, Resource, ResourceSpec | ||
|
||
|
||
@dataclass(unsafe_hash=True) | ||
class _ScannerPackage(ResourceSpec): | ||
name: ResourceName | ||
enabled: bool = True | ||
schedule: str = "0 0 * * * UTC" | ||
|
||
def __post_init__(self): | ||
super().__post_init__() | ||
if self.name == "SECURITY_ESSENTIALS": | ||
raise ValueError("SECURITY_ESSENTIALS is a system scanner package and cannot be used") | ||
|
||
|
||
class ScannerPackage(NamedResource, Resource): | ||
|
||
resource_type = ResourceType.SCANNER_PACKAGE | ||
props = Props() | ||
scope = AccountScope() | ||
spec = _ScannerPackage | ||
|
||
def __init__( | ||
self, | ||
name: str, | ||
enabled: bool = True, | ||
schedule: str = "0 0 * * * UTC", | ||
**kwargs, | ||
): | ||
super().__init__(name, **kwargs) | ||
self._data: _ScannerPackage = _ScannerPackage( | ||
name=self._name, | ||
enabled=enabled, | ||
schedule=schedule, | ||
) |
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