Skip to content

Commit

Permalink
Release 0.7.0 (#18)
Browse files Browse the repository at this point in the history
## [0.7.0] - 2023-10-12

- `runzero.types.ImportAsset` now supports associating vulnerabilities
with an asset by adding a `runzero.types.Vulnerability` type to be set
on the `ImportAsset.vulnerabilities` field.
- `runzero.types.ImportAsset` now supports associating software with an
asset by adding a `runzero.types.Software` type to be set on the
`ImportAsset.software` field.
- `runzero.types.ImportAsset.custom_attributes` no longer requires using
the `CustomAttribute` type to wrap your string values. You can now use a
`Dict[str, str]` directly.
- `runzero.types.CustomAttribute` has been deprecated and will be
removed in the `v1.0` release of the SDK.
- Updated license requirement verbiage to reflect the new [Platform
license](https://www.runzero.com/product/pricing/) requirement.
- Added official support for Python 3.12.
  • Loading branch information
treyburn authored Oct 12, 2023
1 parent 2aa36e8 commit 091b2d1
Show file tree
Hide file tree
Showing 14 changed files with 1,243 additions and 265 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v3
- run: pipx install poetry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v3
- run: pipx install poetry
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.7.0] - 2023-10-12

- `runzero.types.ImportAsset` now supports associating vulnerabilities with an asset by adding a `runzero.types.Vulnerability` type to be set on the `ImportAsset.vulnerabilities` field.
- `runzero.types.ImportAsset` now supports associating software with an asset by adding a `runzero.types.Software` type to be set on the `ImportAsset.software` field.
- `runzero.types.ImportAsset.custom_attributes` no longer requires using the `CustomAttribute` type to wrap your string values. You can now use a `Dict[str, str]` directly.
- `runzero.types.CustomAttribute` has been deprecated and will be removed in the `v1.0` release of the SDK.
- Updated license requirement verbiage to reflect the new [Platform license](https://www.runzero.com/product/pricing/) requirement.
- Added official support for Python 3.12.

## [0.6.0] - 2023-09-14

- The SDK now supports the `exclude_unknown` option in the `ImportTask` object which will ignore any asset that does not merge into an existing asset in your inventory.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This project is currently in beta and subject to change.
This is a Python API client for [runZero](https://www.runzero.com/) - a product that provides asset discovery and
network visibility to help you build and maintain a comprehensive inventory of your cyber assets. runZero customers can use this project to interact with their environment using runZero and Python.

Note: the APIs used with this client are only available to customers of the [Professional and Enterprise editions](https://www.runzero.com/product/pricing/) of runZero.
Note: the APIs used with this client require a [Platform license](https://www.runzero.com/product/pricing/).

This project seeks to do only what is necessary to make interactions with runZero in your own Python code feel more
like any other local, Pythonic API. It uses code generated from the runZero
Expand Down
14 changes: 4 additions & 10 deletions examples/create_assets_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
from typing import Any, Dict, List
from uuid import UUID

from runzero.types import (
CustomAttribute,
ImportAsset,
IPv4Address,
IPv6Address,
NetworkInterface,
)
from runzero.types import ImportAsset, IPv4Address, IPv6Address, NetworkInterface


def build_assets_from_json(
Expand Down Expand Up @@ -37,16 +31,16 @@ def build_assets_from_json(
network = build_network_interface(mac, ip)

# handle the custom attributes
custom_attrs: Dict[str, CustomAttribute] = {"otherAttribute": CustomAttribute(other_attr)}
custom_attrs: Dict[str, str] = {"otherAttribute": other_attr}
# in this case drive might not always be present and needs to be checked
drive = item.get("drive_type")
if drive is not None:
custom_attrs["driveType"] = CustomAttribute(item.pop("drive_type"))
custom_attrs["driveType"] = item.pop("drive_type")

# handle any additional values and insert into custom_attrs
# this works because of the use of items.pop for all other attributes which removed them from the dict
for key, value in item.items():
custom_attrs[key] = CustomAttribute(value)
custom_attrs[key] = value

# Consider the runZero ID for force-merging if you know it ahead of time. In this case, if the asset's ID and
# the runZero ID mapped, runZero will force the merge rather than using the built-in merge logic which matches
Expand Down
243 changes: 115 additions & 128 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "runzero-sdk"
version = "0.6.0"
version = "0.7.0"
description = "The runZero platform sdk"
license = "BSD-2-Clause"
authors = ["runZero <[email protected]>"]
Expand All @@ -13,7 +13,6 @@ packages = [{include = "runzero"}]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: Pydantic",
"Framework :: Pytest",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Topic :: Security",
Expand Down Expand Up @@ -53,7 +52,7 @@ mypy-extensions = "^1.0.0"
tox = "^4.4.7"

[tool.poetry.group.codegen.dependencies]
datamodel-code-generator = { version = ">=0.17.1,<0.22.0", extras = ["http"]}
datamodel-code-generator = { version = ">=0.17.1,<0.23.0", extras = ["http"]}

[tool.poetry.group.docs.dependencies]
sphinx = ">=6.1.3,<8.0.0"
Expand Down
4 changes: 4 additions & 0 deletions runzero/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
ScanOptions,
ScanTemplate,
ScanTemplateOptions,
Software,
Tag,
Vulnerability,
)

__all__ = [
Expand All @@ -62,10 +64,12 @@
"ScanOptions",
"ScanTemplate",
"ScanTemplateOptions",
"Software",
"Site",
"SiteOptions",
"Tag",
"Task",
"TaskOptions",
"ValidationError",
"Vulnerability",
]
Loading

0 comments on commit 091b2d1

Please sign in to comment.