-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[client] Enhance collectors management for security platforms (#31)
- Loading branch information
1 parent
2af95a7
commit 8ca89ed
Showing
6 changed files
with
74 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
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,33 @@ | ||
from typing import Any, Dict | ||
|
||
from pyobas import exceptions as exc | ||
from pyobas.base import RESTManager, RESTObject | ||
from pyobas.mixins import CreateMixin, GetMixin, ListMixin, UpdateMixin | ||
from pyobas.utils import RequiredOptional | ||
|
||
|
||
class SecurityPlatform(RESTObject): | ||
pass | ||
|
||
|
||
class SecurityPlatformManager( | ||
GetMixin, ListMixin, CreateMixin, UpdateMixin, RESTManager | ||
): | ||
_path = "/security_platforms" | ||
_obj_cls = SecurityPlatform | ||
_create_attrs = RequiredOptional( | ||
required=("asset_name", "security_platform_type"), | ||
optional=( | ||
"asset_description", | ||
"security_platform_logo_light", | ||
"security_platform_logo_dark", | ||
), | ||
) | ||
|
||
@exc.on_http_error(exc.OpenBASUpdateError) | ||
def upsert( | ||
self, security_platform: Dict[str, Any], **kwargs: Any | ||
) -> Dict[str, Any]: | ||
path = f"{self.path}/upsert" | ||
result = self.openbas.http_post(path, post_data=security_platform, **kwargs) | ||
return result |
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