forward-sdk 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- forward_sdk/__init__.py +53 -0
- forward_sdk/_async/__init__.py +7 -0
- forward_sdk/_async/client.py +154 -0
- forward_sdk/_async/services/__init__.py +0 -0
- forward_sdk/_async/services/_base.py +51 -0
- forward_sdk/_async/services/_generated/__init__.py +158 -0
- forward_sdk/_async/services/_generated/aliases.py +77 -0
- forward_sdk/_async/services/_generated/checks.py +88 -0
- forward_sdk/_async/services/_generated/classic_devices.py +212 -0
- forward_sdk/_async/services/_generated/collection_schedules.py +99 -0
- forward_sdk/_async/services/_generated/collector_tasks.py +64 -0
- forward_sdk/_async/services/_generated/credentials.py +225 -0
- forward_sdk/_async/services/_generated/data_connectors.py +124 -0
- forward_sdk/_async/services/_generated/data_files.py +41 -0
- forward_sdk/_async/services/_generated/encryptors.py +117 -0
- forward_sdk/_async/services/_generated/endpoint_profiles.py +138 -0
- forward_sdk/_async/services/_generated/internet_node.py +131 -0
- forward_sdk/_async/services/_generated/intranet_nodes.py +191 -0
- forward_sdk/_async/services/_generated/jump_servers.py +89 -0
- forward_sdk/_async/services/_generated/l2vpns.py +181 -0
- forward_sdk/_async/services/_generated/l3vpns.py +189 -0
- forward_sdk/_async/services/_generated/legacy_collection.py +79 -0
- forward_sdk/_async/services/_generated/network_endpoints.py +255 -0
- forward_sdk/_async/services/_generated/network_locations.py +273 -0
- forward_sdk/_async/services/_generated/network_topology.py +181 -0
- forward_sdk/_async/services/_generated/path_search.py +138 -0
- forward_sdk/_async/services/_generated/system_administration.py +45 -0
- forward_sdk/_async/services/_generated/user_accounts.py +93 -0
- forward_sdk/_async/services/_generated/vulnerability_analysis.py +188 -0
- forward_sdk/_async/services/_generated/wan_circuits.py +117 -0
- forward_sdk/_async/services/ai.py +222 -0
- forward_sdk/_async/services/device_tags.py +122 -0
- forward_sdk/_async/services/devices.py +145 -0
- forward_sdk/_async/services/networks.py +76 -0
- forward_sdk/_async/services/nqe.py +581 -0
- forward_sdk/_async/services/nqe_repo.py +363 -0
- forward_sdk/_async/services/snapshots.py +410 -0
- forward_sdk/_async/throttle.py +52 -0
- forward_sdk/_async/transport.py +283 -0
- forward_sdk/_generated/__init__.py +0 -0
- forward_sdk/_generated/_base.py +58 -0
- forward_sdk/_generated/_defs.py +74 -0
- forward_sdk/_generated/models.py +8662 -0
- forward_sdk/_generated/operations.py +3214 -0
- forward_sdk/_http.py +235 -0
- forward_sdk/_ops/__init__.py +137 -0
- forward_sdk/_ops/_generic.py +209 -0
- forward_sdk/_ops/ai.py +76 -0
- forward_sdk/_ops/core.py +356 -0
- forward_sdk/_ops/nqe.py +149 -0
- forward_sdk/_ops/nqe_repo.py +125 -0
- forward_sdk/_ops/rest.py +59 -0
- forward_sdk/_sync/__init__.py +10 -0
- forward_sdk/_sync/client.py +157 -0
- forward_sdk/_sync/services/__init__.py +3 -0
- forward_sdk/_sync/services/_base.py +54 -0
- forward_sdk/_sync/services/_generated/__init__.py +161 -0
- forward_sdk/_sync/services/_generated/aliases.py +80 -0
- forward_sdk/_sync/services/_generated/checks.py +91 -0
- forward_sdk/_sync/services/_generated/classic_devices.py +215 -0
- forward_sdk/_sync/services/_generated/collection_schedules.py +102 -0
- forward_sdk/_sync/services/_generated/collector_tasks.py +63 -0
- forward_sdk/_sync/services/_generated/credentials.py +228 -0
- forward_sdk/_sync/services/_generated/data_connectors.py +127 -0
- forward_sdk/_sync/services/_generated/data_files.py +44 -0
- forward_sdk/_sync/services/_generated/encryptors.py +120 -0
- forward_sdk/_sync/services/_generated/endpoint_profiles.py +139 -0
- forward_sdk/_sync/services/_generated/internet_node.py +134 -0
- forward_sdk/_sync/services/_generated/intranet_nodes.py +194 -0
- forward_sdk/_sync/services/_generated/jump_servers.py +92 -0
- forward_sdk/_sync/services/_generated/l2vpns.py +182 -0
- forward_sdk/_sync/services/_generated/l3vpns.py +190 -0
- forward_sdk/_sync/services/_generated/legacy_collection.py +80 -0
- forward_sdk/_sync/services/_generated/network_endpoints.py +258 -0
- forward_sdk/_sync/services/_generated/network_locations.py +274 -0
- forward_sdk/_sync/services/_generated/network_topology.py +182 -0
- forward_sdk/_sync/services/_generated/path_search.py +141 -0
- forward_sdk/_sync/services/_generated/system_administration.py +48 -0
- forward_sdk/_sync/services/_generated/user_accounts.py +96 -0
- forward_sdk/_sync/services/_generated/vulnerability_analysis.py +191 -0
- forward_sdk/_sync/services/_generated/wan_circuits.py +120 -0
- forward_sdk/_sync/services/ai.py +222 -0
- forward_sdk/_sync/services/device_tags.py +119 -0
- forward_sdk/_sync/services/devices.py +146 -0
- forward_sdk/_sync/services/networks.py +79 -0
- forward_sdk/_sync/services/nqe.py +583 -0
- forward_sdk/_sync/services/nqe_repo.py +362 -0
- forward_sdk/_sync/services/snapshots.py +408 -0
- forward_sdk/_sync/throttle.py +55 -0
- forward_sdk/_sync/transport.py +285 -0
- forward_sdk/_version.py +1 -0
- forward_sdk/config.py +281 -0
- forward_sdk/errors.py +253 -0
- forward_sdk/models/__init__.py +770 -0
- forward_sdk/nqe/__init__.py +21 -0
- forward_sdk/nqe/files.py +201 -0
- forward_sdk/nqe/pagination.py +202 -0
- forward_sdk/nqe/query_ref.py +212 -0
- forward_sdk/nqe/repository.py +198 -0
- forward_sdk/nqe/telemetry.py +105 -0
- forward_sdk/nqe/where.py +117 -0
- forward_sdk/py.typed +0 -0
- forward_sdk/telemetry.py +160 -0
- forward_sdk-0.1.1.dist-info/METADATA +108 -0
- forward_sdk-0.1.1.dist-info/RECORD +107 -0
- forward_sdk-0.1.1.dist-info/WHEEL +4 -0
- forward_sdk-0.1.1.dist-info/licenses/LICENSE +21 -0
forward_sdk/__init__.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Python SDK for the Forward Networks REST API.
|
|
2
|
+
|
|
3
|
+
A Forward Networks Field Integration: built and maintained by the field team,
|
|
4
|
+
not a supported Forward Networks product. See the README for what that means.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from forward_sdk._async.client import AsyncForwardClient
|
|
10
|
+
from forward_sdk._sync.client import ForwardClient
|
|
11
|
+
from forward_sdk._version import __version__
|
|
12
|
+
from forward_sdk.errors import (
|
|
13
|
+
ForwardAPIError,
|
|
14
|
+
ForwardAuthError,
|
|
15
|
+
ForwardBadRequestError,
|
|
16
|
+
ForwardConfigurationError,
|
|
17
|
+
ForwardConflictError,
|
|
18
|
+
ForwardError,
|
|
19
|
+
ForwardExecutionError,
|
|
20
|
+
ForwardNotFoundError,
|
|
21
|
+
ForwardNqeQueryError,
|
|
22
|
+
ForwardPaginationError,
|
|
23
|
+
ForwardPermissionError,
|
|
24
|
+
ForwardRateLimitError,
|
|
25
|
+
ForwardServerError,
|
|
26
|
+
ForwardTimeoutError,
|
|
27
|
+
ForwardTransportError,
|
|
28
|
+
)
|
|
29
|
+
from forward_sdk.nqe import LATEST_PROCESSED, PageGuards, QueryRef
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
"LATEST_PROCESSED",
|
|
33
|
+
"AsyncForwardClient",
|
|
34
|
+
"ForwardAPIError",
|
|
35
|
+
"ForwardAuthError",
|
|
36
|
+
"ForwardBadRequestError",
|
|
37
|
+
"ForwardClient",
|
|
38
|
+
"ForwardConfigurationError",
|
|
39
|
+
"ForwardConflictError",
|
|
40
|
+
"ForwardError",
|
|
41
|
+
"ForwardExecutionError",
|
|
42
|
+
"ForwardNotFoundError",
|
|
43
|
+
"ForwardNqeQueryError",
|
|
44
|
+
"ForwardPaginationError",
|
|
45
|
+
"ForwardPermissionError",
|
|
46
|
+
"ForwardRateLimitError",
|
|
47
|
+
"ForwardServerError",
|
|
48
|
+
"ForwardTimeoutError",
|
|
49
|
+
"ForwardTransportError",
|
|
50
|
+
"PageGuards",
|
|
51
|
+
"QueryRef",
|
|
52
|
+
"__version__",
|
|
53
|
+
]
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""The Forward client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Literal
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from forward_sdk._async.services._generated import AsyncGeneratedServices
|
|
10
|
+
from forward_sdk._async.services.ai import AsyncAiService
|
|
11
|
+
from forward_sdk._async.services.device_tags import AsyncDeviceTagsService
|
|
12
|
+
from forward_sdk._async.services.devices import AsyncDevicesService
|
|
13
|
+
from forward_sdk._async.services.networks import AsyncNetworksService
|
|
14
|
+
from forward_sdk._async.services.nqe import AsyncNqeService
|
|
15
|
+
from forward_sdk._async.services.snapshots import AsyncSnapshotsService
|
|
16
|
+
from forward_sdk._async.throttle import Throttle
|
|
17
|
+
from forward_sdk._async.transport import AsyncTransport
|
|
18
|
+
from forward_sdk.config import ClientConfig, RetryPolicy, build_config, config_from_env
|
|
19
|
+
from forward_sdk.telemetry import Counters, CounterSnapshot, Hooks
|
|
20
|
+
|
|
21
|
+
__all__ = ["AsyncForwardClient"]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class AsyncForwardClient(AsyncGeneratedServices):
|
|
25
|
+
"""Talks to a Forward Networks instance.
|
|
26
|
+
|
|
27
|
+
Authentication is HTTP basic. Use an API token: its access key is the
|
|
28
|
+
username and its secret is the password. A login name and password also
|
|
29
|
+
work, but are subject to two-factor authentication and account lockout.
|
|
30
|
+
|
|
31
|
+
One client holds one connection pool, so reuse it rather than creating one
|
|
32
|
+
per call. It is bound to the event loop it was created on.
|
|
33
|
+
|
|
34
|
+
Services hang off the client by group: ``client.networks``,
|
|
35
|
+
``client.snapshots``, ``client.devices``, ``client.device_tags`` and
|
|
36
|
+
``client.nqe`` are hand-written for the paths integrations use most; the
|
|
37
|
+
remaining groups (``client.checks``, ``client.path_search``,
|
|
38
|
+
``client.aliases`` and so on) are generated from Forward's API description,
|
|
39
|
+
and their method names are the operation ids in Python casing.
|
|
40
|
+
|
|
41
|
+
Example:
|
|
42
|
+
>>> async with AsyncForwardClient.from_env() as client:
|
|
43
|
+
... networks = await client.networks.list()
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
base_url: The instance URL, with or without a trailing ``/api``.
|
|
47
|
+
username: API token access key, or a login name.
|
|
48
|
+
password: API token secret, or a password.
|
|
49
|
+
verify: TLS verification. Disable only for a deployment using a
|
|
50
|
+
self-signed certificate, and prefer passing a CA bundle path.
|
|
51
|
+
timeout: A full ``httpx.Timeout``, or a read deadline in seconds.
|
|
52
|
+
retries: A :class:`RetryPolicy`, or a retry count.
|
|
53
|
+
rate_limit_rpm: Client-side pacing. ``"auto"`` paces requests against
|
|
54
|
+
Forward's hosted service, where a server-side ceiling exists, and
|
|
55
|
+
leaves self-hosted deployments alone.
|
|
56
|
+
network_id: Default network for calls that omit one.
|
|
57
|
+
snapshot_id: Default snapshot. ``None`` means each call uses the
|
|
58
|
+
network's latest processed snapshot.
|
|
59
|
+
user_agent: Identifies your application in the ``User-Agent`` header.
|
|
60
|
+
transport: An ``httpx`` transport, mainly for tests.
|
|
61
|
+
throttle: A custom pacer, for coordinating across processes.
|
|
62
|
+
hooks: Callbacks around each request.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
def __init__(
|
|
66
|
+
self,
|
|
67
|
+
base_url: str,
|
|
68
|
+
*,
|
|
69
|
+
username: str | None = None,
|
|
70
|
+
password: str | None = None,
|
|
71
|
+
verify: bool | str = True,
|
|
72
|
+
timeout: httpx.Timeout | float | None = None,
|
|
73
|
+
retries: RetryPolicy | int | None = None,
|
|
74
|
+
rate_limit_rpm: int | Literal["auto"] | None = "auto",
|
|
75
|
+
network_id: str | None = None,
|
|
76
|
+
snapshot_id: str | None = None,
|
|
77
|
+
user_agent: str | None = None,
|
|
78
|
+
cache_ttl: float = 60.0,
|
|
79
|
+
proxy: str | None = None,
|
|
80
|
+
trust_env: bool = True,
|
|
81
|
+
transport: httpx.AsyncBaseTransport | None = None,
|
|
82
|
+
throttle: Throttle | None = None,
|
|
83
|
+
hooks: Hooks | None = None,
|
|
84
|
+
) -> None:
|
|
85
|
+
self.config: ClientConfig = build_config(
|
|
86
|
+
base_url,
|
|
87
|
+
username=username,
|
|
88
|
+
password=password,
|
|
89
|
+
verify=verify,
|
|
90
|
+
timeout=timeout,
|
|
91
|
+
retries=retries,
|
|
92
|
+
rate_limit_rpm=rate_limit_rpm,
|
|
93
|
+
network_id=network_id,
|
|
94
|
+
snapshot_id=snapshot_id,
|
|
95
|
+
user_agent=user_agent,
|
|
96
|
+
cache_ttl=cache_ttl,
|
|
97
|
+
proxy=proxy,
|
|
98
|
+
trust_env=trust_env,
|
|
99
|
+
)
|
|
100
|
+
self._transport = AsyncTransport(
|
|
101
|
+
self.config, transport=transport, throttle=throttle, hooks=hooks
|
|
102
|
+
)
|
|
103
|
+
self.networks = AsyncNetworksService(self._transport)
|
|
104
|
+
self.snapshots = AsyncSnapshotsService(self._transport)
|
|
105
|
+
self.devices = AsyncDevicesService(self._transport)
|
|
106
|
+
self.device_tags = AsyncDeviceTagsService(self._transport)
|
|
107
|
+
self.nqe = AsyncNqeService(self._transport)
|
|
108
|
+
self.ai = AsyncAiService(self._transport)
|
|
109
|
+
|
|
110
|
+
# The rest of the API, one attribute per group; see scripts/gen_services.py.
|
|
111
|
+
self._attach_generated_services(self._transport)
|
|
112
|
+
|
|
113
|
+
@classmethod
|
|
114
|
+
def from_env(cls, **overrides: Any) -> AsyncForwardClient:
|
|
115
|
+
"""Build a client from ``FORWARD_*`` environment variables.
|
|
116
|
+
|
|
117
|
+
Reads ``FORWARD_URL``, ``FORWARD_USERNAME``, ``FORWARD_PASSWORD``,
|
|
118
|
+
``FORWARD_NETWORK_ID``, ``FORWARD_SNAPSHOT_ID``, ``FORWARD_VERIFY_TLS``,
|
|
119
|
+
``FORWARD_TIMEOUT``, ``FORWARD_RETRIES``, ``FORWARD_RATE_LIMIT_RPM`` and
|
|
120
|
+
``FORWARD_USER_AGENT``. Keyword arguments win over the environment.
|
|
121
|
+
"""
|
|
122
|
+
settings = config_from_env(**overrides)
|
|
123
|
+
base_url = settings.pop("base_url")
|
|
124
|
+
return cls(base_url, **settings)
|
|
125
|
+
|
|
126
|
+
async def version(self) -> Any:
|
|
127
|
+
"""The Forward release this instance is running."""
|
|
128
|
+
return await self.networks.version()
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
def counters(self) -> CounterSnapshot:
|
|
132
|
+
"""A reading of this client's request counters."""
|
|
133
|
+
return self._transport.counters.snapshot()
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def counters_raw(self) -> Counters:
|
|
137
|
+
"""The live counters, for readings that are not a flat record.
|
|
138
|
+
|
|
139
|
+
:meth:`Counters.status_classes` in particular, which is a mapping and
|
|
140
|
+
so does not belong in the snapshot's scalars.
|
|
141
|
+
"""
|
|
142
|
+
return self._transport.counters
|
|
143
|
+
|
|
144
|
+
async def aclose(self) -> None:
|
|
145
|
+
await self._transport.aclose()
|
|
146
|
+
|
|
147
|
+
async def __aenter__(self) -> AsyncForwardClient:
|
|
148
|
+
return self
|
|
149
|
+
|
|
150
|
+
async def __aexit__(self, *exc: object) -> None:
|
|
151
|
+
await self.aclose()
|
|
152
|
+
|
|
153
|
+
def __repr__(self) -> str:
|
|
154
|
+
return f"<AsyncForwardClient {self.config.base_url}>"
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Shared plumbing for service objects."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Any
|
|
6
|
+
|
|
7
|
+
from forward_sdk._ops import RequestSpec
|
|
8
|
+
from forward_sdk.errors import ForwardConfigurationError
|
|
9
|
+
from forward_sdk.nqe.query_ref import LATEST_PROCESSED
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
12
|
+
from forward_sdk._async.transport import AsyncTransport
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class AsyncService:
|
|
16
|
+
"""Base for the grouped call surfaces hanging off a client."""
|
|
17
|
+
|
|
18
|
+
def __init__(self, transport: AsyncTransport) -> None:
|
|
19
|
+
self._transport = transport
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def _config(self) -> Any:
|
|
23
|
+
return self._transport.config
|
|
24
|
+
|
|
25
|
+
def _network(self, network_id: str | None) -> str:
|
|
26
|
+
"""Resolve a network id, falling back to the client's default."""
|
|
27
|
+
resolved = network_id or self._config.network_id
|
|
28
|
+
if not resolved:
|
|
29
|
+
raise ForwardConfigurationError(
|
|
30
|
+
"no network id: pass network_id, or set one on the client "
|
|
31
|
+
"(ForwardClient(..., network_id=...) or FORWARD_NETWORK_ID)"
|
|
32
|
+
)
|
|
33
|
+
return str(resolved)
|
|
34
|
+
|
|
35
|
+
def _snapshot(self, snapshot_id: str | None) -> str | None:
|
|
36
|
+
"""Resolve a snapshot id.
|
|
37
|
+
|
|
38
|
+
``None`` is meaningful: Forward interprets an omitted snapshot as the
|
|
39
|
+
network's latest processed one, so it is passed through rather than
|
|
40
|
+
resolved eagerly.
|
|
41
|
+
"""
|
|
42
|
+
resolved = snapshot_id if snapshot_id is not None else self._config.snapshot_id
|
|
43
|
+
if resolved in (None, "", LATEST_PROCESSED):
|
|
44
|
+
return None
|
|
45
|
+
return str(resolved)
|
|
46
|
+
|
|
47
|
+
async def _send_json(self, spec: RequestSpec) -> Any:
|
|
48
|
+
response = await self._transport.send(spec)
|
|
49
|
+
if not response.content:
|
|
50
|
+
return None
|
|
51
|
+
return response.json()
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"""Service classes generated from the Forward API description.
|
|
2
|
+
|
|
3
|
+
Generated by scripts/gen_services.py -- do not edit.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
from forward_sdk._async.services._generated.aliases import AsyncAliasesService
|
|
11
|
+
from forward_sdk._async.services._generated.checks import AsyncChecksService
|
|
12
|
+
from forward_sdk._async.services._generated.classic_devices import AsyncClassicDevicesService
|
|
13
|
+
from forward_sdk._async.services._generated.collection_schedules import (
|
|
14
|
+
AsyncCollectionSchedulesService,
|
|
15
|
+
)
|
|
16
|
+
from forward_sdk._async.services._generated.collector_tasks import AsyncCollectorTasksService
|
|
17
|
+
from forward_sdk._async.services._generated.credentials import AsyncCredentialsService
|
|
18
|
+
from forward_sdk._async.services._generated.data_connectors import AsyncDataConnectorsService
|
|
19
|
+
from forward_sdk._async.services._generated.data_files import AsyncDataFilesService
|
|
20
|
+
from forward_sdk._async.services._generated.encryptors import AsyncEncryptorsService
|
|
21
|
+
from forward_sdk._async.services._generated.endpoint_profiles import AsyncEndpointProfilesService
|
|
22
|
+
from forward_sdk._async.services._generated.internet_node import AsyncInternetNodeService
|
|
23
|
+
from forward_sdk._async.services._generated.intranet_nodes import AsyncIntranetNodesService
|
|
24
|
+
from forward_sdk._async.services._generated.jump_servers import AsyncJumpServersService
|
|
25
|
+
from forward_sdk._async.services._generated.l2vpns import AsyncL2vpnsService
|
|
26
|
+
from forward_sdk._async.services._generated.l3vpns import AsyncL3vpnsService
|
|
27
|
+
from forward_sdk._async.services._generated.legacy_collection import AsyncLegacyCollectionService
|
|
28
|
+
from forward_sdk._async.services._generated.network_endpoints import AsyncNetworkEndpointsService
|
|
29
|
+
from forward_sdk._async.services._generated.network_locations import AsyncNetworkLocationsService
|
|
30
|
+
from forward_sdk._async.services._generated.network_topology import AsyncNetworkTopologyService
|
|
31
|
+
from forward_sdk._async.services._generated.path_search import AsyncPathSearchService
|
|
32
|
+
from forward_sdk._async.services._generated.system_administration import (
|
|
33
|
+
AsyncSystemAdministrationService,
|
|
34
|
+
)
|
|
35
|
+
from forward_sdk._async.services._generated.user_accounts import AsyncUserAccountsService
|
|
36
|
+
from forward_sdk._async.services._generated.vulnerability_analysis import (
|
|
37
|
+
AsyncVulnerabilityAnalysisService,
|
|
38
|
+
)
|
|
39
|
+
from forward_sdk._async.services._generated.wan_circuits import AsyncWANCircuitsService
|
|
40
|
+
|
|
41
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
42
|
+
from forward_sdk._async.transport import AsyncTransport
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
"AsyncAliasesService",
|
|
46
|
+
"AsyncChecksService",
|
|
47
|
+
"AsyncClassicDevicesService",
|
|
48
|
+
"AsyncCollectionSchedulesService",
|
|
49
|
+
"AsyncCollectorTasksService",
|
|
50
|
+
"AsyncCredentialsService",
|
|
51
|
+
"AsyncDataConnectorsService",
|
|
52
|
+
"AsyncDataFilesService",
|
|
53
|
+
"AsyncEncryptorsService",
|
|
54
|
+
"AsyncEndpointProfilesService",
|
|
55
|
+
"AsyncGeneratedServices",
|
|
56
|
+
"AsyncInternetNodeService",
|
|
57
|
+
"AsyncIntranetNodesService",
|
|
58
|
+
"AsyncJumpServersService",
|
|
59
|
+
"AsyncL2vpnsService",
|
|
60
|
+
"AsyncL3vpnsService",
|
|
61
|
+
"AsyncLegacyCollectionService",
|
|
62
|
+
"AsyncNetworkEndpointsService",
|
|
63
|
+
"AsyncNetworkLocationsService",
|
|
64
|
+
"AsyncNetworkTopologyService",
|
|
65
|
+
"AsyncPathSearchService",
|
|
66
|
+
"AsyncSystemAdministrationService",
|
|
67
|
+
"AsyncUserAccountsService",
|
|
68
|
+
"AsyncVulnerabilityAnalysisService",
|
|
69
|
+
"AsyncWANCircuitsService",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class AsyncGeneratedServices:
|
|
74
|
+
"""The API groups whose services are generated.
|
|
75
|
+
|
|
76
|
+
Declared as attributes rather than attached dynamically so that type
|
|
77
|
+
checkers and editors can see them.
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
aliases: AsyncAliasesService
|
|
81
|
+
checks: AsyncChecksService
|
|
82
|
+
classic_devices: AsyncClassicDevicesService
|
|
83
|
+
collection_schedules: AsyncCollectionSchedulesService
|
|
84
|
+
collector_tasks: AsyncCollectorTasksService
|
|
85
|
+
credentials: AsyncCredentialsService
|
|
86
|
+
data_connectors: AsyncDataConnectorsService
|
|
87
|
+
data_files: AsyncDataFilesService
|
|
88
|
+
encryptors: AsyncEncryptorsService
|
|
89
|
+
endpoint_profiles: AsyncEndpointProfilesService
|
|
90
|
+
internet_node: AsyncInternetNodeService
|
|
91
|
+
intranet_nodes: AsyncIntranetNodesService
|
|
92
|
+
jump_servers: AsyncJumpServersService
|
|
93
|
+
l2vpns: AsyncL2vpnsService
|
|
94
|
+
l3vpns: AsyncL3vpnsService
|
|
95
|
+
legacy_collection: AsyncLegacyCollectionService
|
|
96
|
+
network_endpoints: AsyncNetworkEndpointsService
|
|
97
|
+
network_locations: AsyncNetworkLocationsService
|
|
98
|
+
network_topology: AsyncNetworkTopologyService
|
|
99
|
+
path_search: AsyncPathSearchService
|
|
100
|
+
system_administration: AsyncSystemAdministrationService
|
|
101
|
+
user_accounts: AsyncUserAccountsService
|
|
102
|
+
vulnerability_analysis: AsyncVulnerabilityAnalysisService
|
|
103
|
+
wan_circuits: AsyncWANCircuitsService
|
|
104
|
+
|
|
105
|
+
def _attach_generated_services(self, transport: AsyncTransport) -> None:
|
|
106
|
+
self.aliases = AsyncAliasesService(transport)
|
|
107
|
+
self.checks = AsyncChecksService(transport)
|
|
108
|
+
self.classic_devices = AsyncClassicDevicesService(transport)
|
|
109
|
+
self.collection_schedules = AsyncCollectionSchedulesService(transport)
|
|
110
|
+
self.collector_tasks = AsyncCollectorTasksService(transport)
|
|
111
|
+
self.credentials = AsyncCredentialsService(transport)
|
|
112
|
+
self.data_connectors = AsyncDataConnectorsService(transport)
|
|
113
|
+
self.data_files = AsyncDataFilesService(transport)
|
|
114
|
+
self.encryptors = AsyncEncryptorsService(transport)
|
|
115
|
+
self.endpoint_profiles = AsyncEndpointProfilesService(transport)
|
|
116
|
+
self.internet_node = AsyncInternetNodeService(transport)
|
|
117
|
+
self.intranet_nodes = AsyncIntranetNodesService(transport)
|
|
118
|
+
self.jump_servers = AsyncJumpServersService(transport)
|
|
119
|
+
self.l2vpns = AsyncL2vpnsService(transport)
|
|
120
|
+
self.l3vpns = AsyncL3vpnsService(transport)
|
|
121
|
+
self.legacy_collection = AsyncLegacyCollectionService(transport)
|
|
122
|
+
self.network_endpoints = AsyncNetworkEndpointsService(transport)
|
|
123
|
+
self.network_locations = AsyncNetworkLocationsService(transport)
|
|
124
|
+
self.network_topology = AsyncNetworkTopologyService(transport)
|
|
125
|
+
self.path_search = AsyncPathSearchService(transport)
|
|
126
|
+
self.system_administration = AsyncSystemAdministrationService(transport)
|
|
127
|
+
self.user_accounts = AsyncUserAccountsService(transport)
|
|
128
|
+
self.vulnerability_analysis = AsyncVulnerabilityAnalysisService(transport)
|
|
129
|
+
self.wan_circuits = AsyncWANCircuitsService(transport)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
#: API group name to the client attribute carrying its service.
|
|
133
|
+
SERVICE_TAGS: dict[str, str] = {
|
|
134
|
+
"Aliases": "aliases",
|
|
135
|
+
"Checks": "checks",
|
|
136
|
+
"Classic Devices": "classic_devices",
|
|
137
|
+
"Collection Schedules": "collection_schedules",
|
|
138
|
+
"Collector Tasks": "collector_tasks",
|
|
139
|
+
"Credentials": "credentials",
|
|
140
|
+
"Data Connectors": "data_connectors",
|
|
141
|
+
"Data Files": "data_files",
|
|
142
|
+
"Encryptors": "encryptors",
|
|
143
|
+
"Endpoint Profiles": "endpoint_profiles",
|
|
144
|
+
"Internet Node": "internet_node",
|
|
145
|
+
"Intranet Nodes": "intranet_nodes",
|
|
146
|
+
"Jump Servers": "jump_servers",
|
|
147
|
+
"L2VPNs": "l2vpns",
|
|
148
|
+
"L3VPNs": "l3vpns",
|
|
149
|
+
"Legacy Collection": "legacy_collection",
|
|
150
|
+
"Network Endpoints": "network_endpoints",
|
|
151
|
+
"Network Locations": "network_locations",
|
|
152
|
+
"Network Topology": "network_topology",
|
|
153
|
+
"Path Search": "path_search",
|
|
154
|
+
"System Administration": "system_administration",
|
|
155
|
+
"User Accounts": "user_accounts",
|
|
156
|
+
"Vulnerability Analysis": "vulnerability_analysis",
|
|
157
|
+
"WAN Circuits": "wan_circuits",
|
|
158
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Aliases.
|
|
2
|
+
|
|
3
|
+
Generated by scripts/gen_services.py -- do not edit.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from collections.abc import Sequence
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
from forward_sdk._async.services._base import AsyncService
|
|
12
|
+
from forward_sdk._generated import models
|
|
13
|
+
from forward_sdk._ops import rest as ops
|
|
14
|
+
|
|
15
|
+
__all__ = ["AsyncAliasesService"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AsyncAliasesService(AsyncService):
|
|
19
|
+
"""Aliases."""
|
|
20
|
+
|
|
21
|
+
async def create_alias(
|
|
22
|
+
self,
|
|
23
|
+
*,
|
|
24
|
+
snapshot_id: str,
|
|
25
|
+
name: str,
|
|
26
|
+
body: Any,
|
|
27
|
+
) -> models.Alias:
|
|
28
|
+
"""Create an Alias."""
|
|
29
|
+
payload = await self._send_json(
|
|
30
|
+
ops.BUILDERS["createAlias"](snapshot_id=snapshot_id, name=name, body=body)
|
|
31
|
+
)
|
|
32
|
+
return models.Alias.model_validate(payload or {})
|
|
33
|
+
|
|
34
|
+
async def deactivate_alias(
|
|
35
|
+
self,
|
|
36
|
+
*,
|
|
37
|
+
snapshot_id: str,
|
|
38
|
+
name: str,
|
|
39
|
+
) -> models.Alias:
|
|
40
|
+
"""Delete an Alias."""
|
|
41
|
+
payload = await self._send_json(
|
|
42
|
+
ops.BUILDERS["deactivateAlias"](snapshot_id=snapshot_id, name=name)
|
|
43
|
+
)
|
|
44
|
+
return models.Alias.model_validate(payload or {})
|
|
45
|
+
|
|
46
|
+
async def deactivate_aliases(
|
|
47
|
+
self,
|
|
48
|
+
*,
|
|
49
|
+
snapshot_id: str,
|
|
50
|
+
name: Sequence[str] | None = None,
|
|
51
|
+
) -> models.Aliases:
|
|
52
|
+
"""Delete Aliases."""
|
|
53
|
+
payload = await self._send_json(
|
|
54
|
+
ops.BUILDERS["deactivateAliases"](snapshot_id=snapshot_id, name=name)
|
|
55
|
+
)
|
|
56
|
+
return models.Aliases.model_validate(payload or {})
|
|
57
|
+
|
|
58
|
+
async def get_all_aliases(
|
|
59
|
+
self,
|
|
60
|
+
*,
|
|
61
|
+
snapshot_id: str,
|
|
62
|
+
) -> models.Aliases:
|
|
63
|
+
"""Get all Aliases."""
|
|
64
|
+
payload = await self._send_json(ops.BUILDERS["getAllAliases"](snapshot_id=snapshot_id))
|
|
65
|
+
return models.Aliases.model_validate(payload or {})
|
|
66
|
+
|
|
67
|
+
async def get_single_alias(
|
|
68
|
+
self,
|
|
69
|
+
*,
|
|
70
|
+
snapshot_id: str,
|
|
71
|
+
name: str,
|
|
72
|
+
) -> models.AliasAndValue:
|
|
73
|
+
"""Get an Alias."""
|
|
74
|
+
payload = await self._send_json(
|
|
75
|
+
ops.BUILDERS["getSingleAlias"](snapshot_id=snapshot_id, name=name)
|
|
76
|
+
)
|
|
77
|
+
return models.AliasAndValue.model_validate(payload or {})
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""Checks.
|
|
2
|
+
|
|
3
|
+
Generated by scripts/gen_services.py -- do not edit.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from collections.abc import Sequence
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
from forward_sdk._async.services._base import AsyncService
|
|
12
|
+
from forward_sdk._generated import models
|
|
13
|
+
from forward_sdk._ops import rest as ops
|
|
14
|
+
|
|
15
|
+
__all__ = ["AsyncChecksService"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AsyncChecksService(AsyncService):
|
|
19
|
+
"""Checks."""
|
|
20
|
+
|
|
21
|
+
async def add_check(
|
|
22
|
+
self,
|
|
23
|
+
*,
|
|
24
|
+
snapshot_id: str,
|
|
25
|
+
body: Any,
|
|
26
|
+
persistent: bool | None = None,
|
|
27
|
+
) -> models.NetworkCheckResult:
|
|
28
|
+
"""Add a check."""
|
|
29
|
+
payload = await self._send_json(
|
|
30
|
+
ops.BUILDERS["addCheck"](snapshot_id=snapshot_id, body=body, persistent=persistent)
|
|
31
|
+
)
|
|
32
|
+
return models.NetworkCheckResult.model_validate(payload or {})
|
|
33
|
+
|
|
34
|
+
async def deactivate_check(
|
|
35
|
+
self,
|
|
36
|
+
*,
|
|
37
|
+
snapshot_id: str,
|
|
38
|
+
check_id: str,
|
|
39
|
+
) -> Any:
|
|
40
|
+
"""Deactivate a check."""
|
|
41
|
+
payload = await self._send_json(
|
|
42
|
+
ops.BUILDERS["deactivateCheck"](snapshot_id=snapshot_id, check_id=check_id)
|
|
43
|
+
)
|
|
44
|
+
return payload
|
|
45
|
+
|
|
46
|
+
async def deactivate_checks(
|
|
47
|
+
self,
|
|
48
|
+
*,
|
|
49
|
+
snapshot_id: str,
|
|
50
|
+
) -> Any:
|
|
51
|
+
"""Deactivate all checks."""
|
|
52
|
+
payload = await self._send_json(ops.BUILDERS["deactivateChecks"](snapshot_id=snapshot_id))
|
|
53
|
+
return payload
|
|
54
|
+
|
|
55
|
+
async def get_available_predefined_checks(
|
|
56
|
+
self,
|
|
57
|
+
) -> list[models.AvailablePredefinedCheck]:
|
|
58
|
+
"""Get available Predefined checks."""
|
|
59
|
+
payload = await self._send_json(ops.BUILDERS["getAvailablePredefinedChecks"]())
|
|
60
|
+
return [models.AvailablePredefinedCheck.model_validate(row) for row in payload or []]
|
|
61
|
+
|
|
62
|
+
async def get_check(
|
|
63
|
+
self,
|
|
64
|
+
*,
|
|
65
|
+
snapshot_id: str,
|
|
66
|
+
check_id: str,
|
|
67
|
+
) -> models.NetworkCheckResultWithDiagnosis:
|
|
68
|
+
"""Get a check (with status)."""
|
|
69
|
+
payload = await self._send_json(
|
|
70
|
+
ops.BUILDERS["getCheck"](snapshot_id=snapshot_id, check_id=check_id)
|
|
71
|
+
)
|
|
72
|
+
return models.NetworkCheckResultWithDiagnosis.model_validate(payload or {})
|
|
73
|
+
|
|
74
|
+
async def get_checks(
|
|
75
|
+
self,
|
|
76
|
+
*,
|
|
77
|
+
snapshot_id: str,
|
|
78
|
+
type: Sequence[str] | None = None,
|
|
79
|
+
priority: Sequence[str] | None = None,
|
|
80
|
+
status: Sequence[str] | None = None,
|
|
81
|
+
) -> list[models.NetworkCheckResult]:
|
|
82
|
+
"""Get checks (with status)."""
|
|
83
|
+
payload = await self._send_json(
|
|
84
|
+
ops.BUILDERS["getChecks"](
|
|
85
|
+
snapshot_id=snapshot_id, type=type, priority=priority, status=status
|
|
86
|
+
)
|
|
87
|
+
)
|
|
88
|
+
return [models.NetworkCheckResult.model_validate(row) for row in payload or []]
|