Skip to content

Commit

Permalink
Sync API Data Model Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMcGrath committed Feb 13, 2025
1 parent b25f8ce commit 27eda44
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
17 changes: 14 additions & 3 deletions tenable/io/sync/models/device_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from ipaddress import IPv4Address, IPv6Address
from typing import Literal

from arrow import ArrowFactory
from pydantic import (
AwareDatetime,
BeforeValidator,
Expand Down Expand Up @@ -46,7 +47,8 @@ def list_of_addresses(
and value not in resp
):
resp.append(value)
return resp
if len(resp) > 0:
return resp


NonLocalAddressSerializer = PlainSerializer(list_of_addresses)
Expand Down Expand Up @@ -207,10 +209,19 @@ class DeviceDiscoveryAuth(BaseModel):

class DeviceDiscovery(BaseModel):
authentication: DeviceDiscoveryAuth | None = None
first_observed_at: AwareDatetime | None = None
first_assessed_on: AwareDatetime | None = None
last_assessed_on: AwareDatetime | None = None
first_observed_on: AwareDatetime | None = None
last_observed_on: AwareDatetime | None = None
id: str64 | None = None
produced_findings: bool | None = None
assessment_status: Annotated[
Literal["ATTEMPTED_FINDINGS", "SKIPPED_FINDINGS"],
UpperCaseStr,
]
assessment_type: (
Annotated[Literal["KEEP_ALIVE", "INVENTORY", "RISK_ASSESSMENT"], UpperCaseStr]
| None
) = None


class DeviceExternalId(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion tenable/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "1.7.1"
version = "1.7.2"
version_info = tuple(int(d) for d in version.split("-")[0].split("."))
8 changes: 8 additions & 0 deletions tests/io/sync/models/test_device_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ def test_list_of_addresses():
assert len(resp) == 3


def test_list_of_ipaddresses_nonetype():
test_set = [
d.DeviceIPv4(address="169.254.1.1"),
d.DeviceIPv4(address="127.0.0.1"),
]
assert d.list_of_addresses(test_set) is None


def test_device_networking():
obj = d.DeviceNetworking(
fqdns=[
Expand Down

0 comments on commit 27eda44

Please # to comment.