trafficmorph 0.3.0__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.
- trafficmorph/__init__.py +30 -0
- trafficmorph/api/__init__.py +1 -0
- trafficmorph/api/captures/__init__.py +1 -0
- trafficmorph/api/captures/analyse.py +132 -0
- trafficmorph/api/captures/import_capture.py +158 -0
- trafficmorph/api/domains/__init__.py +1 -0
- trafficmorph/api/domains/add.py +131 -0
- trafficmorph/api/domains/list_domains.py +107 -0
- trafficmorph/api/domains/remove.py +124 -0
- trafficmorph/api/domains/verify_dns.py +124 -0
- trafficmorph/api/domains/verify_http.py +122 -0
- trafficmorph/api/history/__init__.py +1 -0
- trafficmorph/api/history/get_history_item.py +122 -0
- trafficmorph/api/history/list_history.py +210 -0
- trafficmorph/api/profiles/__init__.py +1 -0
- trafficmorph/api/profiles/create_profile.py +143 -0
- trafficmorph/api/profiles/delete_profile.py +124 -0
- trafficmorph/api/profiles/get_profile.py +122 -0
- trafficmorph/api/profiles/list_profiles.py +107 -0
- trafficmorph/api/profiles/update_profile.py +162 -0
- trafficmorph/api/runs/__init__.py +1 -0
- trafficmorph/api/runs/pause.py +122 -0
- trafficmorph/api/runs/resume.py +120 -0
- trafficmorph/api/runs/start.py +120 -0
- trafficmorph/api/runs/stop.py +122 -0
- trafficmorph/api/variables_sets/__init__.py +1 -0
- trafficmorph/api/variables_sets/change_mode.py +142 -0
- trafficmorph/api/variables_sets/create.py +157 -0
- trafficmorph/api/variables_sets/delete.py +132 -0
- trafficmorph/api/variables_sets/get.py +120 -0
- trafficmorph/api/variables_sets/list_variables_sets.py +109 -0
- trafficmorph/api/variables_sets/rename.py +134 -0
- trafficmorph/client.py +271 -0
- trafficmorph/errors.py +14 -0
- trafficmorph/models/__init__.py +63 -0
- trafficmorph/models/add_domain_request.py +76 -0
- trafficmorph/models/analyse_body.py +102 -0
- trafficmorph/models/api_profile_request.py +257 -0
- trafficmorph/models/api_profile_response.py +313 -0
- trafficmorph/models/capture_analysis_response.py +122 -0
- trafficmorph/models/capture_import_result.py +152 -0
- trafficmorph/models/change_variables_set_mode_request.py +80 -0
- trafficmorph/models/change_variables_set_mode_request_mode.py +9 -0
- trafficmorph/models/create_variables_set_request.py +96 -0
- trafficmorph/models/create_variables_set_request_mode.py +9 -0
- trafficmorph/models/created_profile.py +87 -0
- trafficmorph/models/curve_point.py +87 -0
- trafficmorph/models/group.py +197 -0
- trafficmorph/models/import_capture_body.py +101 -0
- trafficmorph/models/rename_variables_set_request.py +76 -0
- trafficmorph/models/schedule_block.py +125 -0
- trafficmorph/models/scheduled_run_response.py +150 -0
- trafficmorph/models/skipped_selection.py +96 -0
- trafficmorph/models/slot_input.py +87 -0
- trafficmorph/models/slot_response.py +127 -0
- trafficmorph/models/stats.py +123 -0
- trafficmorph/models/traffic_profile_point_request.py +84 -0
- trafficmorph/models/traffic_profile_point_response.py +87 -0
- trafficmorph/models/traffic_profile_summary_response.py +109 -0
- trafficmorph/models/traffic_run_control_response.py +96 -0
- trafficmorph/models/variable.py +129 -0
- trafficmorph/models/variables_set_response.py +190 -0
- trafficmorph/models/variables_set_response_mode.py +9 -0
- trafficmorph/models/verified_domain_response.py +173 -0
- trafficmorph/sdk.py +360 -0
- trafficmorph/types.py +53 -0
- trafficmorph-0.3.0.dist-info/METADATA +278 -0
- trafficmorph-0.3.0.dist-info/RECORD +70 -0
- trafficmorph-0.3.0.dist-info/WHEEL +4 -0
- trafficmorph-0.3.0.dist-info/licenses/LICENSE +201 -0
trafficmorph/__init__.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
""" A client library for accessing TrafficMorph API """
|
|
3
|
+
from .client import AuthenticatedClient, Client
|
|
4
|
+
|
|
5
|
+
__all__ = (
|
|
6
|
+
"AuthenticatedClient",
|
|
7
|
+
"Client",
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
# === TM-WRAPPER-BLOCK-v1 === (managed by Makefile regen-client; do not hand-edit)
|
|
11
|
+
from . import api, errors, models, types # noqa: F401
|
|
12
|
+
from .sdk import ( # noqa: E402, F401
|
|
13
|
+
Client,
|
|
14
|
+
SPEC_VERSION,
|
|
15
|
+
DEFAULT_USER_AGENT,
|
|
16
|
+
DEFAULT_TIMEOUT,
|
|
17
|
+
EnvBaseURL,
|
|
18
|
+
EnvAPIKey,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
__all__ = (
|
|
22
|
+
"Client",
|
|
23
|
+
"AuthenticatedClient",
|
|
24
|
+
"SPEC_VERSION",
|
|
25
|
+
"DEFAULT_USER_AGENT",
|
|
26
|
+
"DEFAULT_TIMEOUT",
|
|
27
|
+
"EnvBaseURL",
|
|
28
|
+
"EnvAPIKey",
|
|
29
|
+
)
|
|
30
|
+
# === END TM-WRAPPER-BLOCK-v1 ===
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains methods for accessing the API """
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.analyse_body import AnalyseBody
|
|
12
|
+
from ...types import UNSET, Unset
|
|
13
|
+
from typing import cast
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
*,
|
|
19
|
+
body: AnalyseBody | Unset = UNSET,
|
|
20
|
+
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
_kwargs: dict[str, Any] = {
|
|
30
|
+
"method": "post",
|
|
31
|
+
"url": "/api/v1/captures/analyse",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if not isinstance(body, Unset):
|
|
35
|
+
_kwargs["files"] = body.to_multipart()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
_kwargs["headers"] = headers
|
|
40
|
+
return _kwargs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None:
|
|
45
|
+
if client.raise_on_unexpected_status:
|
|
46
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
47
|
+
else:
|
|
48
|
+
return None
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]:
|
|
52
|
+
return Response(
|
|
53
|
+
status_code=HTTPStatus(response.status_code),
|
|
54
|
+
content=response.content,
|
|
55
|
+
headers=response.headers,
|
|
56
|
+
parsed=_parse_response(client=client, response=response),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def sync_detailed(
|
|
61
|
+
*,
|
|
62
|
+
client: AuthenticatedClient | Client,
|
|
63
|
+
body: AnalyseBody | Unset = UNSET,
|
|
64
|
+
|
|
65
|
+
) -> Response[Any]:
|
|
66
|
+
""" Analyse a JSONL capture and preview the proposed profiles
|
|
67
|
+
|
|
68
|
+
Uploads a JSONL traffic capture and returns a structured preview â per detected endpoint: the
|
|
69
|
+
proposed URL skeleton, derived RPS curve, extracted URL + body variables (with cardinality buckets
|
|
70
|
+
and sample values), and a few sample request URLs. **No state is persisted.** Pair with `/import` to
|
|
71
|
+
commit the selections you want.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
body (AnalyseBody | Unset):
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
78
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
Response[Any]
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
kwargs = _get_kwargs(
|
|
86
|
+
body=body,
|
|
87
|
+
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
response = client.get_httpx_client().request(
|
|
91
|
+
**kwargs,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return _build_response(client=client, response=response)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
async def asyncio_detailed(
|
|
98
|
+
*,
|
|
99
|
+
client: AuthenticatedClient | Client,
|
|
100
|
+
body: AnalyseBody | Unset = UNSET,
|
|
101
|
+
|
|
102
|
+
) -> Response[Any]:
|
|
103
|
+
""" Analyse a JSONL capture and preview the proposed profiles
|
|
104
|
+
|
|
105
|
+
Uploads a JSONL traffic capture and returns a structured preview â per detected endpoint: the
|
|
106
|
+
proposed URL skeleton, derived RPS curve, extracted URL + body variables (with cardinality buckets
|
|
107
|
+
and sample values), and a few sample request URLs. **No state is persisted.** Pair with `/import` to
|
|
108
|
+
commit the selections you want.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
body (AnalyseBody | Unset):
|
|
112
|
+
|
|
113
|
+
Raises:
|
|
114
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
115
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
Response[Any]
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
kwargs = _get_kwargs(
|
|
123
|
+
body=body,
|
|
124
|
+
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
response = await client.get_async_httpx_client().request(
|
|
128
|
+
**kwargs
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
return _build_response(client=client, response=response)
|
|
132
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.import_capture_body import ImportCaptureBody
|
|
12
|
+
from ...types import UNSET, Unset
|
|
13
|
+
from typing import cast
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
*,
|
|
19
|
+
body: ImportCaptureBody | Unset = UNSET,
|
|
20
|
+
selections: str,
|
|
21
|
+
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
params: dict[str, Any] = {}
|
|
29
|
+
|
|
30
|
+
params["selections"] = selections
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
_kwargs: dict[str, Any] = {
|
|
37
|
+
"method": "post",
|
|
38
|
+
"url": "/api/v1/captures/import",
|
|
39
|
+
"params": params,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if not isinstance(body, Unset):
|
|
43
|
+
_kwargs["files"] = body.to_multipart()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
_kwargs["headers"] = headers
|
|
48
|
+
return _kwargs
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None:
|
|
53
|
+
if client.raise_on_unexpected_status:
|
|
54
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
55
|
+
else:
|
|
56
|
+
return None
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]:
|
|
60
|
+
return Response(
|
|
61
|
+
status_code=HTTPStatus(response.status_code),
|
|
62
|
+
content=response.content,
|
|
63
|
+
headers=response.headers,
|
|
64
|
+
parsed=_parse_response(client=client, response=response),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def sync_detailed(
|
|
69
|
+
*,
|
|
70
|
+
client: AuthenticatedClient | Client,
|
|
71
|
+
body: ImportCaptureBody | Unset = UNSET,
|
|
72
|
+
selections: str,
|
|
73
|
+
|
|
74
|
+
) -> Response[Any]:
|
|
75
|
+
""" Import selected endpoints from a JSONL capture as profiles
|
|
76
|
+
|
|
77
|
+
Atomic commit. Re-derives the analysis from the uploaded file (no server-side state is kept between
|
|
78
|
+
`/analyse` and `/import`), picks the groups named in the `selections` JSON, and persists each one as
|
|
79
|
+
a TrafficMorph profile â plus a variables set whenever the group has variable positions. Either
|
|
80
|
+
every selection lands or none. Re-upload the same JSONL file you analysed; selections key by
|
|
81
|
+
`(method, urlSkeleton)` so re-analysis matches the same groups.
|
|
82
|
+
|
|
83
|
+
**Name collisions are NOT errors.** If a chosen `profileName` is already taken for this user, the
|
|
84
|
+
importer auto-suffixes with `(2)`, `(3)`, ⦠until unique. The created entity in the response
|
|
85
|
+
carries the final name, so the client can show what actually landed. (Same convention applies to
|
|
86
|
+
variables-set names.)
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
selections (str):
|
|
90
|
+
body (ImportCaptureBody | Unset):
|
|
91
|
+
|
|
92
|
+
Raises:
|
|
93
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
94
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
Response[Any]
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
kwargs = _get_kwargs(
|
|
102
|
+
body=body,
|
|
103
|
+
selections=selections,
|
|
104
|
+
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
response = client.get_httpx_client().request(
|
|
108
|
+
**kwargs,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
return _build_response(client=client, response=response)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
async def asyncio_detailed(
|
|
115
|
+
*,
|
|
116
|
+
client: AuthenticatedClient | Client,
|
|
117
|
+
body: ImportCaptureBody | Unset = UNSET,
|
|
118
|
+
selections: str,
|
|
119
|
+
|
|
120
|
+
) -> Response[Any]:
|
|
121
|
+
""" Import selected endpoints from a JSONL capture as profiles
|
|
122
|
+
|
|
123
|
+
Atomic commit. Re-derives the analysis from the uploaded file (no server-side state is kept between
|
|
124
|
+
`/analyse` and `/import`), picks the groups named in the `selections` JSON, and persists each one as
|
|
125
|
+
a TrafficMorph profile â plus a variables set whenever the group has variable positions. Either
|
|
126
|
+
every selection lands or none. Re-upload the same JSONL file you analysed; selections key by
|
|
127
|
+
`(method, urlSkeleton)` so re-analysis matches the same groups.
|
|
128
|
+
|
|
129
|
+
**Name collisions are NOT errors.** If a chosen `profileName` is already taken for this user, the
|
|
130
|
+
importer auto-suffixes with `(2)`, `(3)`, ⦠until unique. The created entity in the response
|
|
131
|
+
carries the final name, so the client can show what actually landed. (Same convention applies to
|
|
132
|
+
variables-set names.)
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
selections (str):
|
|
136
|
+
body (ImportCaptureBody | Unset):
|
|
137
|
+
|
|
138
|
+
Raises:
|
|
139
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
140
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
Response[Any]
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
kwargs = _get_kwargs(
|
|
148
|
+
body=body,
|
|
149
|
+
selections=selections,
|
|
150
|
+
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
response = await client.get_async_httpx_client().request(
|
|
154
|
+
**kwargs
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
return _build_response(client=client, response=response)
|
|
158
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.add_domain_request import AddDomainRequest
|
|
12
|
+
from typing import cast
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
*,
|
|
18
|
+
body: AddDomainRequest,
|
|
19
|
+
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
headers: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_kwargs: dict[str, Any] = {
|
|
29
|
+
"method": "post",
|
|
30
|
+
"url": "/api/v1/domains",
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_kwargs["json"] = body.to_dict()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
headers["Content-Type"] = "application/json"
|
|
37
|
+
|
|
38
|
+
_kwargs["headers"] = headers
|
|
39
|
+
return _kwargs
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None:
|
|
44
|
+
if client.raise_on_unexpected_status:
|
|
45
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
46
|
+
else:
|
|
47
|
+
return None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]:
|
|
51
|
+
return Response(
|
|
52
|
+
status_code=HTTPStatus(response.status_code),
|
|
53
|
+
content=response.content,
|
|
54
|
+
headers=response.headers,
|
|
55
|
+
parsed=_parse_response(client=client, response=response),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def sync_detailed(
|
|
60
|
+
*,
|
|
61
|
+
client: AuthenticatedClient | Client,
|
|
62
|
+
body: AddDomainRequest,
|
|
63
|
+
|
|
64
|
+
) -> Response[Any]:
|
|
65
|
+
""" Register a new domain for verification
|
|
66
|
+
|
|
67
|
+
Idempotent. On first call, generates the verification token and creates the record. On subsequent
|
|
68
|
+
calls for the same `(user, domain)`, returns the existing record with the same token â clients can
|
|
69
|
+
safely retry without producing duplicates. The response carries the challenge values the user must
|
|
70
|
+
install before calling `/verify/dns` or `/verify/http`.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
body (AddDomainRequest):
|
|
74
|
+
|
|
75
|
+
Raises:
|
|
76
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
77
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
Response[Any]
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
kwargs = _get_kwargs(
|
|
85
|
+
body=body,
|
|
86
|
+
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
response = client.get_httpx_client().request(
|
|
90
|
+
**kwargs,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
return _build_response(client=client, response=response)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
async def asyncio_detailed(
|
|
97
|
+
*,
|
|
98
|
+
client: AuthenticatedClient | Client,
|
|
99
|
+
body: AddDomainRequest,
|
|
100
|
+
|
|
101
|
+
) -> Response[Any]:
|
|
102
|
+
""" Register a new domain for verification
|
|
103
|
+
|
|
104
|
+
Idempotent. On first call, generates the verification token and creates the record. On subsequent
|
|
105
|
+
calls for the same `(user, domain)`, returns the existing record with the same token â clients can
|
|
106
|
+
safely retry without producing duplicates. The response carries the challenge values the user must
|
|
107
|
+
install before calling `/verify/dns` or `/verify/http`.
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
body (AddDomainRequest):
|
|
111
|
+
|
|
112
|
+
Raises:
|
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
Response[Any]
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
kwargs = _get_kwargs(
|
|
122
|
+
body=body,
|
|
123
|
+
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
response = await client.get_async_httpx_client().request(
|
|
127
|
+
**kwargs
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
return _build_response(client=client, response=response)
|
|
131
|
+
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "get",
|
|
25
|
+
"url": "/api/v1/domains",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None:
|
|
34
|
+
if client.raise_on_unexpected_status:
|
|
35
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
36
|
+
else:
|
|
37
|
+
return None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]:
|
|
41
|
+
return Response(
|
|
42
|
+
status_code=HTTPStatus(response.status_code),
|
|
43
|
+
content=response.content,
|
|
44
|
+
headers=response.headers,
|
|
45
|
+
parsed=_parse_response(client=client, response=response),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def sync_detailed(
|
|
50
|
+
*,
|
|
51
|
+
client: AuthenticatedClient | Client,
|
|
52
|
+
|
|
53
|
+
) -> Response[Any]:
|
|
54
|
+
""" List the user's domains and their verification status
|
|
55
|
+
|
|
56
|
+
Returns all domains the user has added, with each domain's current verification state (`PENDING` /
|
|
57
|
+
`VERIFIED`) and the challenge tokens still in play.
|
|
58
|
+
|
|
59
|
+
Raises:
|
|
60
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
61
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
Response[Any]
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
kwargs = _get_kwargs(
|
|
69
|
+
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
response = client.get_httpx_client().request(
|
|
73
|
+
**kwargs,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
return _build_response(client=client, response=response)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
async def asyncio_detailed(
|
|
80
|
+
*,
|
|
81
|
+
client: AuthenticatedClient | Client,
|
|
82
|
+
|
|
83
|
+
) -> Response[Any]:
|
|
84
|
+
""" List the user's domains and their verification status
|
|
85
|
+
|
|
86
|
+
Returns all domains the user has added, with each domain's current verification state (`PENDING` /
|
|
87
|
+
`VERIFIED`) and the challenge tokens still in play.
|
|
88
|
+
|
|
89
|
+
Raises:
|
|
90
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
91
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
Response[Any]
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
kwargs = _get_kwargs(
|
|
99
|
+
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
response = await client.get_async_httpx_client().request(
|
|
103
|
+
**kwargs
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
return _build_response(client=client, response=response)
|
|
107
|
+
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
id: int,
|
|
16
|
+
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "delete",
|
|
26
|
+
"url": "/api/v1/domains/{id}".format(id=quote(str(id), safe=""),),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None:
|
|
35
|
+
if response.status_code == 204:
|
|
36
|
+
return None
|
|
37
|
+
|
|
38
|
+
if response.status_code == 400:
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
if client.raise_on_unexpected_status:
|
|
42
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
43
|
+
else:
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]:
|
|
48
|
+
return Response(
|
|
49
|
+
status_code=HTTPStatus(response.status_code),
|
|
50
|
+
content=response.content,
|
|
51
|
+
headers=response.headers,
|
|
52
|
+
parsed=_parse_response(client=client, response=response),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def sync_detailed(
|
|
57
|
+
id: int,
|
|
58
|
+
*,
|
|
59
|
+
client: AuthenticatedClient | Client,
|
|
60
|
+
|
|
61
|
+
) -> Response[Any]:
|
|
62
|
+
""" Remove a domain
|
|
63
|
+
|
|
64
|
+
Deletes the domain and its challenges. Profiles targeting this domain remain saved but won't be
|
|
65
|
+
runnable until another verified domain covers the target host.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
id (int):
|
|
69
|
+
|
|
70
|
+
Raises:
|
|
71
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
72
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Response[Any]
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
kwargs = _get_kwargs(
|
|
80
|
+
id=id,
|
|
81
|
+
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
response = client.get_httpx_client().request(
|
|
85
|
+
**kwargs,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
return _build_response(client=client, response=response)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
async def asyncio_detailed(
|
|
92
|
+
id: int,
|
|
93
|
+
*,
|
|
94
|
+
client: AuthenticatedClient | Client,
|
|
95
|
+
|
|
96
|
+
) -> Response[Any]:
|
|
97
|
+
""" Remove a domain
|
|
98
|
+
|
|
99
|
+
Deletes the domain and its challenges. Profiles targeting this domain remain saved but won't be
|
|
100
|
+
runnable until another verified domain covers the target host.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
id (int):
|
|
104
|
+
|
|
105
|
+
Raises:
|
|
106
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
107
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
Response[Any]
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
kwargs = _get_kwargs(
|
|
115
|
+
id=id,
|
|
116
|
+
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
response = await client.get_async_httpx_client().request(
|
|
120
|
+
**kwargs
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
return _build_response(client=client, response=response)
|
|
124
|
+
|