devhelm 0.6.0__tar.gz → 0.6.2__tar.gz
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.
- {devhelm-0.6.0 → devhelm-0.6.2}/PKG-INFO +16 -15
- {devhelm-0.6.0 → devhelm-0.6.2}/README.md +15 -14
- {devhelm-0.6.0 → devhelm-0.6.2}/pyproject.toml +1 -1
- {devhelm-0.6.0 → devhelm-0.6.2}/tests/run_sdk.py +14 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/tests/test_client.py +29 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/uv.lock +1 -1
- {devhelm-0.6.0 → devhelm-0.6.2}/.github/workflows/ci.yml +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/.github/workflows/release.yml +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/.github/workflows/spec-check.yml +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/.gitignore +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/LICENSE +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/Makefile +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/docs/openapi/monitoring-api.json +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/scripts/inject_strict_config.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/scripts/regen-from.sh +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/scripts/release.sh +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/scripts/typegen.sh +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/__init__.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/_errors.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/_generated.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/_http.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/_pagination.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/_validation.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/client.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/py.typed +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/__init__.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/alert_channels.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/api_keys.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/dependencies.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/deploy_lock.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/environments.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/forensics.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/incidents.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/monitors.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/notification_policies.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/resource_groups.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/secrets.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/status.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/status_pages.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/tags.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/resources/webhooks.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/src/devhelm/types.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/tests/__init__.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/tests/test_errors.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/tests/test_http.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/tests/test_negative_validation.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/tests/test_schemas.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/tests/test_spec_parity.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/tests/test_typing.py +0 -0
- {devhelm-0.6.0 → devhelm-0.6.2}/tests/test_validation_helpers.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devhelm
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: DevHelm SDK for Python — typed client for monitors, incidents, alerting, and more
|
|
5
5
|
Project-URL: Homepage, https://github.com/devhelmhq/sdk-python
|
|
6
6
|
Project-URL: Repository, https://github.com/devhelmhq/sdk-python.git
|
|
@@ -37,11 +37,7 @@ pip install devhelm
|
|
|
37
37
|
```python
|
|
38
38
|
from devhelm import Devhelm
|
|
39
39
|
|
|
40
|
-
client = Devhelm(
|
|
41
|
-
token="your-api-token",
|
|
42
|
-
org_id="your-org-id",
|
|
43
|
-
workspace_id="your-workspace-id",
|
|
44
|
-
)
|
|
40
|
+
client = Devhelm(token="your-api-token")
|
|
45
41
|
|
|
46
42
|
# List all monitors
|
|
47
43
|
monitors = client.monitors.list()
|
|
@@ -55,6 +51,11 @@ monitor = client.monitors.create({
|
|
|
55
51
|
"config": {"url": "https://api.example.com/health", "method": "GET"},
|
|
56
52
|
"frequencySeconds": 60,
|
|
57
53
|
"regions": ["us-east"],
|
|
54
|
+
# `managedBy` records who reconciles drift on this resource. Use
|
|
55
|
+
# "DASHBOARD" (the default for one-off SDK scripts), "CLI" if the
|
|
56
|
+
# monitor lives in a `devhelm.yml` you re-deploy, or "TERRAFORM"
|
|
57
|
+
# if it lives in `.tf` you re-apply.
|
|
58
|
+
"managedBy": "DASHBOARD",
|
|
58
59
|
})
|
|
59
60
|
|
|
60
61
|
# Get a single monitor
|
|
@@ -74,20 +75,20 @@ client.monitors.delete(monitor.id)
|
|
|
74
75
|
from devhelm import Devhelm
|
|
75
76
|
|
|
76
77
|
client = Devhelm(
|
|
77
|
-
token="your-api-token",
|
|
78
|
-
org_id="1", #
|
|
79
|
-
workspace_id="1", #
|
|
78
|
+
token="your-api-token", # required (or DEVHELM_API_TOKEN env var)
|
|
79
|
+
org_id="1", # optional — see notes below
|
|
80
|
+
workspace_id="1", # optional — see notes below
|
|
80
81
|
base_url="https://api.devhelm.io", # optional, defaults to production
|
|
81
82
|
)
|
|
82
83
|
```
|
|
83
84
|
|
|
84
85
|
Environment variables are used as fallbacks when constructor arguments are not provided:
|
|
85
86
|
|
|
86
|
-
| Parameter | Env Variable
|
|
87
|
-
| -------------- |
|
|
88
|
-
| `token` | `DEVHELM_API_TOKEN`
|
|
89
|
-
| `org_id` | `DEVHELM_ORG_ID`
|
|
90
|
-
| `workspace_id` | `DEVHELM_WORKSPACE_ID`
|
|
87
|
+
| Parameter | Required | Env Variable | Notes |
|
|
88
|
+
| -------------- | -------- | ---------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
89
|
+
| `token` | Yes | `DEVHELM_API_TOKEN` | Personal or workspace API token. |
|
|
90
|
+
| `org_id` | No | `DEVHELM_ORG_ID` | Auto-resolved if your token is scoped to one org. Required only when the token has access to multiple. |
|
|
91
|
+
| `workspace_id` | No | `DEVHELM_WORKSPACE_ID` | Auto-resolved if your token is scoped to one workspace. Required only when the token spans multiple. |
|
|
91
92
|
|
|
92
93
|
## Resources
|
|
93
94
|
|
|
@@ -154,7 +155,7 @@ Every `DevhelmApiError` carries:
|
|
|
154
155
|
```python
|
|
155
156
|
from devhelm import Devhelm, DevhelmAuthError, DevhelmError
|
|
156
157
|
|
|
157
|
-
client = Devhelm(token="bad-token"
|
|
158
|
+
client = Devhelm(token="bad-token")
|
|
158
159
|
|
|
159
160
|
try:
|
|
160
161
|
client.monitors.list()
|
|
@@ -13,11 +13,7 @@ pip install devhelm
|
|
|
13
13
|
```python
|
|
14
14
|
from devhelm import Devhelm
|
|
15
15
|
|
|
16
|
-
client = Devhelm(
|
|
17
|
-
token="your-api-token",
|
|
18
|
-
org_id="your-org-id",
|
|
19
|
-
workspace_id="your-workspace-id",
|
|
20
|
-
)
|
|
16
|
+
client = Devhelm(token="your-api-token")
|
|
21
17
|
|
|
22
18
|
# List all monitors
|
|
23
19
|
monitors = client.monitors.list()
|
|
@@ -31,6 +27,11 @@ monitor = client.monitors.create({
|
|
|
31
27
|
"config": {"url": "https://api.example.com/health", "method": "GET"},
|
|
32
28
|
"frequencySeconds": 60,
|
|
33
29
|
"regions": ["us-east"],
|
|
30
|
+
# `managedBy` records who reconciles drift on this resource. Use
|
|
31
|
+
# "DASHBOARD" (the default for one-off SDK scripts), "CLI" if the
|
|
32
|
+
# monitor lives in a `devhelm.yml` you re-deploy, or "TERRAFORM"
|
|
33
|
+
# if it lives in `.tf` you re-apply.
|
|
34
|
+
"managedBy": "DASHBOARD",
|
|
34
35
|
})
|
|
35
36
|
|
|
36
37
|
# Get a single monitor
|
|
@@ -50,20 +51,20 @@ client.monitors.delete(monitor.id)
|
|
|
50
51
|
from devhelm import Devhelm
|
|
51
52
|
|
|
52
53
|
client = Devhelm(
|
|
53
|
-
token="your-api-token",
|
|
54
|
-
org_id="1", #
|
|
55
|
-
workspace_id="1", #
|
|
54
|
+
token="your-api-token", # required (or DEVHELM_API_TOKEN env var)
|
|
55
|
+
org_id="1", # optional — see notes below
|
|
56
|
+
workspace_id="1", # optional — see notes below
|
|
56
57
|
base_url="https://api.devhelm.io", # optional, defaults to production
|
|
57
58
|
)
|
|
58
59
|
```
|
|
59
60
|
|
|
60
61
|
Environment variables are used as fallbacks when constructor arguments are not provided:
|
|
61
62
|
|
|
62
|
-
| Parameter | Env Variable
|
|
63
|
-
| -------------- |
|
|
64
|
-
| `token` | `DEVHELM_API_TOKEN`
|
|
65
|
-
| `org_id` | `DEVHELM_ORG_ID`
|
|
66
|
-
| `workspace_id` | `DEVHELM_WORKSPACE_ID`
|
|
63
|
+
| Parameter | Required | Env Variable | Notes |
|
|
64
|
+
| -------------- | -------- | ---------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
65
|
+
| `token` | Yes | `DEVHELM_API_TOKEN` | Personal or workspace API token. |
|
|
66
|
+
| `org_id` | No | `DEVHELM_ORG_ID` | Auto-resolved if your token is scoped to one org. Required only when the token has access to multiple. |
|
|
67
|
+
| `workspace_id` | No | `DEVHELM_WORKSPACE_ID` | Auto-resolved if your token is scoped to one workspace. Required only when the token spans multiple. |
|
|
67
68
|
|
|
68
69
|
## Resources
|
|
69
70
|
|
|
@@ -130,7 +131,7 @@ Every `DevhelmApiError` carries:
|
|
|
130
131
|
```python
|
|
131
132
|
from devhelm import Devhelm, DevhelmAuthError, DevhelmError
|
|
132
133
|
|
|
133
|
-
client = Devhelm(token="bad-token"
|
|
134
|
+
client = Devhelm(token="bad-token")
|
|
134
135
|
|
|
135
136
|
try:
|
|
136
137
|
client.monitors.list()
|
|
@@ -393,6 +393,20 @@ def run(client: Devhelm, resource: str, action: str, rest: list[str]) -> Any: #
|
|
|
393
393
|
client.status_pages.subscribers.remove(rest[0], rest[1])
|
|
394
394
|
return None
|
|
395
395
|
|
|
396
|
+
# -- Forensics --
|
|
397
|
+
if op == "forensics.incident-timeline":
|
|
398
|
+
return client.forensics.incident_timeline(rest[0])
|
|
399
|
+
if op == "forensics.check-trace":
|
|
400
|
+
return client.forensics.check_trace(rest[0])
|
|
401
|
+
if op == "forensics.policy-snapshot":
|
|
402
|
+
return client.forensics.policy_snapshot(rest[0])
|
|
403
|
+
if op == "forensics.monitor-rule-evaluations":
|
|
404
|
+
opts = json.loads(rest[1]) if len(rest) > 1 and rest[1] else {}
|
|
405
|
+
return client.forensics.monitor_rule_evaluations(rest[0], **opts)
|
|
406
|
+
if op == "forensics.monitor-transitions":
|
|
407
|
+
opts = json.loads(rest[1]) if len(rest) > 1 and rest[1] else {}
|
|
408
|
+
return client.forensics.monitor_transitions(rest[0], **opts)
|
|
409
|
+
|
|
396
410
|
# -- Status Page Domains --
|
|
397
411
|
if op == "status-pages.domains.list":
|
|
398
412
|
return client.status_pages.domains.list(rest[0])
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import pytest
|
|
6
6
|
|
|
7
7
|
from devhelm import Devhelm
|
|
8
|
+
from devhelm._http import DevhelmConfig
|
|
8
9
|
from devhelm.resources.alert_channels import AlertChannels
|
|
9
10
|
from devhelm.resources.api_keys import ApiKeys
|
|
10
11
|
from devhelm.resources.dependencies import Dependencies
|
|
@@ -131,3 +132,31 @@ class TestStatusPagesResource:
|
|
|
131
132
|
assert callable(d.add)
|
|
132
133
|
assert callable(d.verify)
|
|
133
134
|
assert callable(d.remove)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class TestClientOptionalTenantArgs:
|
|
138
|
+
"""`org_id` / `workspace_id` are optional — single-tenant tokens
|
|
139
|
+
auto-resolve them server-side, so the README quickstart and the
|
|
140
|
+
constructor must work with just a token (the most common case).
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
def test_constructible_without_org_or_workspace(
|
|
144
|
+
self, monkeypatch: pytest.MonkeyPatch
|
|
145
|
+
) -> None:
|
|
146
|
+
# Strip any env fallback so we prove the constructor itself accepts
|
|
147
|
+
# missing tenant args, not that the test environment leaks them in.
|
|
148
|
+
monkeypatch.delenv("DEVHELM_ORG_ID", raising=False)
|
|
149
|
+
monkeypatch.delenv("DEVHELM_WORKSPACE_ID", raising=False)
|
|
150
|
+
|
|
151
|
+
client = Devhelm(token="test-token", base_url="http://localhost:8080")
|
|
152
|
+
|
|
153
|
+
assert client.monitors is not None
|
|
154
|
+
assert client.incidents is not None
|
|
155
|
+
|
|
156
|
+
def test_config_defaults_tenant_ids_to_none(self) -> None:
|
|
157
|
+
# Documents the API contract: leaving them unset on the config
|
|
158
|
+
# dataclass yields ``None``, which ``build_client`` then resolves
|
|
159
|
+
# via env var or the server-side default.
|
|
160
|
+
config = DevhelmConfig(token="test-token")
|
|
161
|
+
assert config.org_id is None
|
|
162
|
+
assert config.workspace_id is None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|