-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Handle get_targets_response item
- Loading branch information
1 parent
228b2d4
commit 7b4556e
Showing
9 changed files
with
321 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import datetime | ||
from typing import Optional | ||
|
||
from pydantic_xml import attr, element | ||
|
||
from gvm_sync_targets.models.model import IntBoolean, Model | ||
|
||
|
||
class Owner(Model, tag="owner"): | ||
name: str = element() | ||
|
||
|
||
class Permission(Model, tag="permission"): | ||
name: str = element() | ||
|
||
|
||
class Permissions(Model, tag="permissions"): | ||
permissions: list[Permission] = element() | ||
|
||
|
||
class Keyword(Model, tag="keyword"): | ||
column: str = element() | ||
relation: str = element() | ||
value: str = element() | ||
|
||
|
||
class Keywords(Model, tag="keywords"): | ||
keywords: list[Keyword] = element() | ||
|
||
|
||
class Filters(Model, tag="filters"): | ||
uuid: str = attr("id") | ||
|
||
term: str = element() | ||
keywords: Keywords = element() | ||
|
||
|
||
class Count(Model): | ||
total: int | ||
filtered: int = element() | ||
page: int = element() | ||
|
||
|
||
class Pagination(Model): | ||
start: int = attr() | ||
max: int = attr() | ||
|
||
|
||
class SortField(Model, tag="field"): | ||
name: str | ||
order: str = element() | ||
|
||
|
||
class Sort(Model, tag="sort"): | ||
field: SortField | ||
|
||
|
||
class Resource(Model): | ||
uuid: str = attr("id") | ||
|
||
owner: Owner | ||
name: str = element() | ||
comment: Optional[str] = element(default=None) | ||
creation_time: datetime.datetime = element() | ||
modification_time: datetime.datetime = element() | ||
writable: IntBoolean = element() | ||
in_use: IntBoolean = element() | ||
|
||
permissions: Permissions = element() |
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,72 @@ | ||
from typing import Optional | ||
|
||
from pydantic_xml import attr, element | ||
|
||
from gvm_sync_targets.models.model import IntBoolean, Model | ||
from gvm_sync_targets.models.resource import ( | ||
Count, | ||
Filters, | ||
Pagination, | ||
Resource, | ||
Sort, | ||
) | ||
from gvm_sync_targets.models.response import Response | ||
|
||
|
||
class Credential(Model): | ||
uuid: str = attr("id") | ||
name: Optional[str] = element(default=None) | ||
|
||
trash: IntBoolean = element(tag="trash") | ||
|
||
|
||
class SSHCredential(Credential, tag="ssh_credential"): | ||
port: int = element(tag="port") | ||
|
||
|
||
class SMBCredential(Credential, tag="smb_credential"): | ||
pass | ||
|
||
|
||
class ESXICredential(Credential, tag="esxi_credential"): | ||
pass | ||
|
||
|
||
class SNMPCredential(Credential, tag="snmp_credential"): | ||
pass | ||
|
||
|
||
class SSHElevateCredential(Credential, tag="ssh_elevate_credential"): | ||
pass | ||
|
||
|
||
class PortList(Model, tag="port_list"): | ||
uuid: str = attr("id") | ||
|
||
name: str = element() | ||
trash: IntBoolean = element() | ||
|
||
|
||
class Target(Resource, tag="target"): | ||
hosts: str = element() | ||
exclude_hosts: Optional[str] = element(default=None) | ||
max_hosts: int = element() | ||
port_list: PortList = element() | ||
ssh_credential: SSHCredential = element() | ||
smb_credential: SMBCredential = element() | ||
esxi_credential: ESXICredential = element() | ||
snmp_credential: SNMPCredential = element() | ||
ssh_elevate_credential: SSHElevateCredential = element() | ||
|
||
reverse_lookup_only: IntBoolean = element() | ||
reverse_lookup_unify: IntBoolean = element() | ||
alive_tests: str = element() | ||
allow_simultaneous_ips: IntBoolean = element() | ||
|
||
|
||
class GetTargetsResponse(Response, tag="get_targets_response"): | ||
targets: list[Target] = element() | ||
filters: Filters | ||
sort: Sort | ||
pagination: Pagination = element("targets") | ||
asset_count: Count = element("target_count") |
Empty file.
Oops, something went wrong.