hackagent 0.1.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.
Files changed (117) hide show
  1. hackagent/__init__.py +23 -0
  2. hackagent/agent.py +193 -0
  3. hackagent/api/__init__.py +1 -0
  4. hackagent/api/agent/__init__.py +1 -0
  5. hackagent/api/agent/agent_create.py +340 -0
  6. hackagent/api/agent/agent_destroy.py +136 -0
  7. hackagent/api/agent/agent_list.py +234 -0
  8. hackagent/api/agent/agent_partial_update.py +354 -0
  9. hackagent/api/agent/agent_retrieve.py +227 -0
  10. hackagent/api/agent/agent_update.py +354 -0
  11. hackagent/api/attack/__init__.py +1 -0
  12. hackagent/api/attack/attack_create.py +264 -0
  13. hackagent/api/attack/attack_destroy.py +140 -0
  14. hackagent/api/attack/attack_list.py +242 -0
  15. hackagent/api/attack/attack_partial_update.py +278 -0
  16. hackagent/api/attack/attack_retrieve.py +235 -0
  17. hackagent/api/attack/attack_update.py +278 -0
  18. hackagent/api/key/__init__.py +1 -0
  19. hackagent/api/key/key_create.py +168 -0
  20. hackagent/api/key/key_destroy.py +97 -0
  21. hackagent/api/key/key_list.py +158 -0
  22. hackagent/api/key/key_retrieve.py +150 -0
  23. hackagent/api/prompt/__init__.py +1 -0
  24. hackagent/api/prompt/prompt_create.py +160 -0
  25. hackagent/api/prompt/prompt_destroy.py +98 -0
  26. hackagent/api/prompt/prompt_list.py +173 -0
  27. hackagent/api/prompt/prompt_partial_update.py +174 -0
  28. hackagent/api/prompt/prompt_retrieve.py +151 -0
  29. hackagent/api/prompt/prompt_update.py +174 -0
  30. hackagent/api/result/__init__.py +1 -0
  31. hackagent/api/result/result_create.py +160 -0
  32. hackagent/api/result/result_destroy.py +98 -0
  33. hackagent/api/result/result_list.py +233 -0
  34. hackagent/api/result/result_partial_update.py +178 -0
  35. hackagent/api/result/result_retrieve.py +151 -0
  36. hackagent/api/result/result_trace_create.py +178 -0
  37. hackagent/api/result/result_update.py +174 -0
  38. hackagent/api/run/__init__.py +1 -0
  39. hackagent/api/run/run_create.py +172 -0
  40. hackagent/api/run/run_destroy.py +104 -0
  41. hackagent/api/run/run_list.py +260 -0
  42. hackagent/api/run/run_partial_update.py +186 -0
  43. hackagent/api/run/run_result_create.py +178 -0
  44. hackagent/api/run/run_retrieve.py +163 -0
  45. hackagent/api/run/run_run_tests_create.py +172 -0
  46. hackagent/api/run/run_update.py +186 -0
  47. hackagent/attacks/AdvPrefix/README.md +7 -0
  48. hackagent/attacks/AdvPrefix/__init__.py +0 -0
  49. hackagent/attacks/AdvPrefix/completer.py +438 -0
  50. hackagent/attacks/AdvPrefix/config.py +59 -0
  51. hackagent/attacks/AdvPrefix/preprocessing.py +521 -0
  52. hackagent/attacks/AdvPrefix/scorer.py +259 -0
  53. hackagent/attacks/AdvPrefix/scorer_parser.py +498 -0
  54. hackagent/attacks/AdvPrefix/selector.py +246 -0
  55. hackagent/attacks/AdvPrefix/step1_generate.py +324 -0
  56. hackagent/attacks/AdvPrefix/step4_compute_ce.py +293 -0
  57. hackagent/attacks/AdvPrefix/step6_get_completions.py +387 -0
  58. hackagent/attacks/AdvPrefix/step7_evaluate_responses.py +289 -0
  59. hackagent/attacks/AdvPrefix/step8_aggregate_evaluations.py +177 -0
  60. hackagent/attacks/AdvPrefix/step9_select_prefixes.py +59 -0
  61. hackagent/attacks/AdvPrefix/utils.py +192 -0
  62. hackagent/attacks/__init__.py +6 -0
  63. hackagent/attacks/advprefix.py +1136 -0
  64. hackagent/attacks/base.py +50 -0
  65. hackagent/attacks/strategies.py +539 -0
  66. hackagent/branding.py +143 -0
  67. hackagent/client.py +328 -0
  68. hackagent/errors.py +31 -0
  69. hackagent/logger.py +67 -0
  70. hackagent/models/__init__.py +71 -0
  71. hackagent/models/agent.py +240 -0
  72. hackagent/models/agent_request.py +169 -0
  73. hackagent/models/agent_type_enum.py +12 -0
  74. hackagent/models/attack.py +154 -0
  75. hackagent/models/attack_request.py +82 -0
  76. hackagent/models/evaluation_status_enum.py +14 -0
  77. hackagent/models/organization_minimal.py +68 -0
  78. hackagent/models/paginated_agent_list.py +123 -0
  79. hackagent/models/paginated_attack_list.py +123 -0
  80. hackagent/models/paginated_prompt_list.py +123 -0
  81. hackagent/models/paginated_result_list.py +123 -0
  82. hackagent/models/paginated_run_list.py +123 -0
  83. hackagent/models/paginated_user_api_key_list.py +123 -0
  84. hackagent/models/patched_agent_request.py +176 -0
  85. hackagent/models/patched_attack_request.py +92 -0
  86. hackagent/models/patched_prompt_request.py +162 -0
  87. hackagent/models/patched_result_request.py +237 -0
  88. hackagent/models/patched_run_request.py +138 -0
  89. hackagent/models/prompt.py +226 -0
  90. hackagent/models/prompt_request.py +155 -0
  91. hackagent/models/result.py +294 -0
  92. hackagent/models/result_list_evaluation_status.py +14 -0
  93. hackagent/models/result_request.py +232 -0
  94. hackagent/models/run.py +233 -0
  95. hackagent/models/run_list_status.py +12 -0
  96. hackagent/models/run_request.py +133 -0
  97. hackagent/models/status_enum.py +12 -0
  98. hackagent/models/step_type_enum.py +14 -0
  99. hackagent/models/trace.py +121 -0
  100. hackagent/models/trace_request.py +94 -0
  101. hackagent/models/user_api_key.py +201 -0
  102. hackagent/models/user_api_key_request.py +73 -0
  103. hackagent/models/user_profile_minimal.py +76 -0
  104. hackagent/py.typed +1 -0
  105. hackagent/router/__init__.py +11 -0
  106. hackagent/router/adapters/__init__.py +5 -0
  107. hackagent/router/adapters/google_adk.py +658 -0
  108. hackagent/router/adapters/litellm_adapter.py +290 -0
  109. hackagent/router/base.py +48 -0
  110. hackagent/router/router.py +753 -0
  111. hackagent/types.py +46 -0
  112. hackagent/utils.py +61 -0
  113. hackagent/vulnerabilities/__init__.py +0 -0
  114. hackagent-0.1.0.dist-info/LICENSE +202 -0
  115. hackagent-0.1.0.dist-info/METADATA +173 -0
  116. hackagent-0.1.0.dist-info/RECORD +117 -0
  117. hackagent-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,104 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs(
13
+ id: UUID,
14
+ ) -> dict[str, Any]:
15
+ _kwargs: dict[str, Any] = {
16
+ "method": "delete",
17
+ "url": f"/api/run/{id}",
18
+ }
19
+
20
+ return _kwargs
21
+
22
+
23
+ def _parse_response(
24
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25
+ ) -> Optional[Any]:
26
+ if response.status_code == 204:
27
+ return None
28
+ if client.raise_on_unexpected_status:
29
+ raise errors.UnexpectedStatus(response.status_code, response.content)
30
+ else:
31
+ return None
32
+
33
+
34
+ def _build_response(
35
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
36
+ ) -> Response[Any]:
37
+ return Response(
38
+ status_code=HTTPStatus(response.status_code),
39
+ content=response.content,
40
+ headers=response.headers,
41
+ parsed=_parse_response(client=client, response=response),
42
+ )
43
+
44
+
45
+ def sync_detailed(
46
+ id: UUID,
47
+ *,
48
+ client: AuthenticatedClient,
49
+ ) -> Response[Any]:
50
+ """ViewSet for managing Run instances.
51
+ Primarily for listing/retrieving runs.
52
+ Creation of server-side runs is handled by custom actions.
53
+ Runs initiated from Attack definitions are created via AttackViewSet.
54
+
55
+ Args:
56
+ id (UUID):
57
+
58
+ Raises:
59
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
60
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
61
+
62
+ Returns:
63
+ Response[Any]
64
+ """
65
+
66
+ kwargs = _get_kwargs(
67
+ id=id,
68
+ )
69
+
70
+ response = client.get_httpx_client().request(
71
+ **kwargs,
72
+ )
73
+
74
+ return _build_response(client=client, response=response)
75
+
76
+
77
+ async def asyncio_detailed(
78
+ id: UUID,
79
+ *,
80
+ client: AuthenticatedClient,
81
+ ) -> Response[Any]:
82
+ """ViewSet for managing Run instances.
83
+ Primarily for listing/retrieving runs.
84
+ Creation of server-side runs is handled by custom actions.
85
+ Runs initiated from Attack definitions are created via AttackViewSet.
86
+
87
+ Args:
88
+ id (UUID):
89
+
90
+ Raises:
91
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
92
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
93
+
94
+ Returns:
95
+ Response[Any]
96
+ """
97
+
98
+ kwargs = _get_kwargs(
99
+ id=id,
100
+ )
101
+
102
+ response = await client.get_async_httpx_client().request(**kwargs)
103
+
104
+ return _build_response(client=client, response=response)
@@ -0,0 +1,260 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.paginated_run_list import PaginatedRunList
10
+ from ...models.run_list_status import RunListStatus
11
+ from ...types import UNSET, Response, Unset
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ agent: Union[Unset, UUID] = UNSET,
17
+ attack: Union[Unset, UUID] = UNSET,
18
+ is_client_executed: Union[Unset, bool] = UNSET,
19
+ organization: Union[Unset, UUID] = UNSET,
20
+ page: Union[Unset, int] = UNSET,
21
+ status: Union[Unset, RunListStatus] = UNSET,
22
+ ) -> dict[str, Any]:
23
+ params: dict[str, Any] = {}
24
+
25
+ json_agent: Union[Unset, str] = UNSET
26
+ if not isinstance(agent, Unset):
27
+ json_agent = str(agent)
28
+ params["agent"] = json_agent
29
+
30
+ json_attack: Union[Unset, str] = UNSET
31
+ if not isinstance(attack, Unset):
32
+ json_attack = str(attack)
33
+ params["attack"] = json_attack
34
+
35
+ params["is_client_executed"] = is_client_executed
36
+
37
+ json_organization: Union[Unset, str] = UNSET
38
+ if not isinstance(organization, Unset):
39
+ json_organization = str(organization)
40
+ params["organization"] = json_organization
41
+
42
+ params["page"] = page
43
+
44
+ json_status: Union[Unset, str] = UNSET
45
+ if not isinstance(status, Unset):
46
+ json_status = status.value
47
+
48
+ params["status"] = json_status
49
+
50
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
51
+
52
+ _kwargs: dict[str, Any] = {
53
+ "method": "get",
54
+ "url": "/api/run",
55
+ "params": params,
56
+ }
57
+
58
+ return _kwargs
59
+
60
+
61
+ def _parse_response(
62
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
63
+ ) -> Optional[PaginatedRunList]:
64
+ if response.status_code == 200:
65
+ response_200 = PaginatedRunList.from_dict(response.json())
66
+
67
+ return response_200
68
+ if client.raise_on_unexpected_status:
69
+ raise errors.UnexpectedStatus(response.status_code, response.content)
70
+ else:
71
+ return None
72
+
73
+
74
+ def _build_response(
75
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
76
+ ) -> Response[PaginatedRunList]:
77
+ return Response(
78
+ status_code=HTTPStatus(response.status_code),
79
+ content=response.content,
80
+ headers=response.headers,
81
+ parsed=_parse_response(client=client, response=response),
82
+ )
83
+
84
+
85
+ def sync_detailed(
86
+ *,
87
+ client: AuthenticatedClient,
88
+ agent: Union[Unset, UUID] = UNSET,
89
+ attack: Union[Unset, UUID] = UNSET,
90
+ is_client_executed: Union[Unset, bool] = UNSET,
91
+ organization: Union[Unset, UUID] = UNSET,
92
+ page: Union[Unset, int] = UNSET,
93
+ status: Union[Unset, RunListStatus] = UNSET,
94
+ ) -> Response[PaginatedRunList]:
95
+ """ViewSet for managing Run instances.
96
+ Primarily for listing/retrieving runs.
97
+ Creation of server-side runs is handled by custom actions.
98
+ Runs initiated from Attack definitions are created via AttackViewSet.
99
+
100
+ Args:
101
+ agent (Union[Unset, UUID]):
102
+ attack (Union[Unset, UUID]):
103
+ is_client_executed (Union[Unset, bool]):
104
+ organization (Union[Unset, UUID]):
105
+ page (Union[Unset, int]):
106
+ status (Union[Unset, RunListStatus]):
107
+
108
+ Raises:
109
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
110
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
111
+
112
+ Returns:
113
+ Response[PaginatedRunList]
114
+ """
115
+
116
+ kwargs = _get_kwargs(
117
+ agent=agent,
118
+ attack=attack,
119
+ is_client_executed=is_client_executed,
120
+ organization=organization,
121
+ page=page,
122
+ status=status,
123
+ )
124
+
125
+ response = client.get_httpx_client().request(
126
+ **kwargs,
127
+ )
128
+
129
+ return _build_response(client=client, response=response)
130
+
131
+
132
+ def sync(
133
+ *,
134
+ client: AuthenticatedClient,
135
+ agent: Union[Unset, UUID] = UNSET,
136
+ attack: Union[Unset, UUID] = UNSET,
137
+ is_client_executed: Union[Unset, bool] = UNSET,
138
+ organization: Union[Unset, UUID] = UNSET,
139
+ page: Union[Unset, int] = UNSET,
140
+ status: Union[Unset, RunListStatus] = UNSET,
141
+ ) -> Optional[PaginatedRunList]:
142
+ """ViewSet for managing Run instances.
143
+ Primarily for listing/retrieving runs.
144
+ Creation of server-side runs is handled by custom actions.
145
+ Runs initiated from Attack definitions are created via AttackViewSet.
146
+
147
+ Args:
148
+ agent (Union[Unset, UUID]):
149
+ attack (Union[Unset, UUID]):
150
+ is_client_executed (Union[Unset, bool]):
151
+ organization (Union[Unset, UUID]):
152
+ page (Union[Unset, int]):
153
+ status (Union[Unset, RunListStatus]):
154
+
155
+ Raises:
156
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
158
+
159
+ Returns:
160
+ PaginatedRunList
161
+ """
162
+
163
+ return sync_detailed(
164
+ client=client,
165
+ agent=agent,
166
+ attack=attack,
167
+ is_client_executed=is_client_executed,
168
+ organization=organization,
169
+ page=page,
170
+ status=status,
171
+ ).parsed
172
+
173
+
174
+ async def asyncio_detailed(
175
+ *,
176
+ client: AuthenticatedClient,
177
+ agent: Union[Unset, UUID] = UNSET,
178
+ attack: Union[Unset, UUID] = UNSET,
179
+ is_client_executed: Union[Unset, bool] = UNSET,
180
+ organization: Union[Unset, UUID] = UNSET,
181
+ page: Union[Unset, int] = UNSET,
182
+ status: Union[Unset, RunListStatus] = UNSET,
183
+ ) -> Response[PaginatedRunList]:
184
+ """ViewSet for managing Run instances.
185
+ Primarily for listing/retrieving runs.
186
+ Creation of server-side runs is handled by custom actions.
187
+ Runs initiated from Attack definitions are created via AttackViewSet.
188
+
189
+ Args:
190
+ agent (Union[Unset, UUID]):
191
+ attack (Union[Unset, UUID]):
192
+ is_client_executed (Union[Unset, bool]):
193
+ organization (Union[Unset, UUID]):
194
+ page (Union[Unset, int]):
195
+ status (Union[Unset, RunListStatus]):
196
+
197
+ Raises:
198
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
199
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
200
+
201
+ Returns:
202
+ Response[PaginatedRunList]
203
+ """
204
+
205
+ kwargs = _get_kwargs(
206
+ agent=agent,
207
+ attack=attack,
208
+ is_client_executed=is_client_executed,
209
+ organization=organization,
210
+ page=page,
211
+ status=status,
212
+ )
213
+
214
+ response = await client.get_async_httpx_client().request(**kwargs)
215
+
216
+ return _build_response(client=client, response=response)
217
+
218
+
219
+ async def asyncio(
220
+ *,
221
+ client: AuthenticatedClient,
222
+ agent: Union[Unset, UUID] = UNSET,
223
+ attack: Union[Unset, UUID] = UNSET,
224
+ is_client_executed: Union[Unset, bool] = UNSET,
225
+ organization: Union[Unset, UUID] = UNSET,
226
+ page: Union[Unset, int] = UNSET,
227
+ status: Union[Unset, RunListStatus] = UNSET,
228
+ ) -> Optional[PaginatedRunList]:
229
+ """ViewSet for managing Run instances.
230
+ Primarily for listing/retrieving runs.
231
+ Creation of server-side runs is handled by custom actions.
232
+ Runs initiated from Attack definitions are created via AttackViewSet.
233
+
234
+ Args:
235
+ agent (Union[Unset, UUID]):
236
+ attack (Union[Unset, UUID]):
237
+ is_client_executed (Union[Unset, bool]):
238
+ organization (Union[Unset, UUID]):
239
+ page (Union[Unset, int]):
240
+ status (Union[Unset, RunListStatus]):
241
+
242
+ Raises:
243
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
244
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
245
+
246
+ Returns:
247
+ PaginatedRunList
248
+ """
249
+
250
+ return (
251
+ await asyncio_detailed(
252
+ client=client,
253
+ agent=agent,
254
+ attack=attack,
255
+ is_client_executed=is_client_executed,
256
+ organization=organization,
257
+ page=page,
258
+ status=status,
259
+ )
260
+ ).parsed
@@ -0,0 +1,186 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.patched_run_request import PatchedRunRequest
10
+ from ...models.run import Run
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: UUID,
16
+ *,
17
+ body: PatchedRunRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "patch",
23
+ "url": f"/api/run/{id}",
24
+ }
25
+
26
+ _body = body.to_dict()
27
+
28
+ _kwargs["json"] = _body
29
+ headers["Content-Type"] = "application/json"
30
+
31
+ _kwargs["headers"] = headers
32
+ return _kwargs
33
+
34
+
35
+ def _parse_response(
36
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
37
+ ) -> Optional[Run]:
38
+ if response.status_code == 200:
39
+ response_200 = Run.from_dict(response.json())
40
+
41
+ return response_200
42
+ if client.raise_on_unexpected_status:
43
+ raise errors.UnexpectedStatus(response.status_code, response.content)
44
+ else:
45
+ return None
46
+
47
+
48
+ def _build_response(
49
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
50
+ ) -> Response[Run]:
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
+ id: UUID,
61
+ *,
62
+ client: AuthenticatedClient,
63
+ body: PatchedRunRequest,
64
+ ) -> Response[Run]:
65
+ """ViewSet for managing Run instances.
66
+ Primarily for listing/retrieving runs.
67
+ Creation of server-side runs is handled by custom actions.
68
+ Runs initiated from Attack definitions are created via AttackViewSet.
69
+
70
+ Args:
71
+ id (UUID):
72
+ body (PatchedRunRequest): Serializer for the Run model, used for both input and output.
73
+
74
+ Raises:
75
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
76
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
77
+
78
+ Returns:
79
+ Response[Run]
80
+ """
81
+
82
+ kwargs = _get_kwargs(
83
+ id=id,
84
+ body=body,
85
+ )
86
+
87
+ response = client.get_httpx_client().request(
88
+ **kwargs,
89
+ )
90
+
91
+ return _build_response(client=client, response=response)
92
+
93
+
94
+ def sync(
95
+ id: UUID,
96
+ *,
97
+ client: AuthenticatedClient,
98
+ body: PatchedRunRequest,
99
+ ) -> Optional[Run]:
100
+ """ViewSet for managing Run instances.
101
+ Primarily for listing/retrieving runs.
102
+ Creation of server-side runs is handled by custom actions.
103
+ Runs initiated from Attack definitions are created via AttackViewSet.
104
+
105
+ Args:
106
+ id (UUID):
107
+ body (PatchedRunRequest): Serializer for the Run model, used for both input and output.
108
+
109
+ Raises:
110
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
111
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
112
+
113
+ Returns:
114
+ Run
115
+ """
116
+
117
+ return sync_detailed(
118
+ id=id,
119
+ client=client,
120
+ body=body,
121
+ ).parsed
122
+
123
+
124
+ async def asyncio_detailed(
125
+ id: UUID,
126
+ *,
127
+ client: AuthenticatedClient,
128
+ body: PatchedRunRequest,
129
+ ) -> Response[Run]:
130
+ """ViewSet for managing Run instances.
131
+ Primarily for listing/retrieving runs.
132
+ Creation of server-side runs is handled by custom actions.
133
+ Runs initiated from Attack definitions are created via AttackViewSet.
134
+
135
+ Args:
136
+ id (UUID):
137
+ body (PatchedRunRequest): Serializer for the Run model, used for both input and output.
138
+
139
+ Raises:
140
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
141
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
142
+
143
+ Returns:
144
+ Response[Run]
145
+ """
146
+
147
+ kwargs = _get_kwargs(
148
+ id=id,
149
+ body=body,
150
+ )
151
+
152
+ response = await client.get_async_httpx_client().request(**kwargs)
153
+
154
+ return _build_response(client=client, response=response)
155
+
156
+
157
+ async def asyncio(
158
+ id: UUID,
159
+ *,
160
+ client: AuthenticatedClient,
161
+ body: PatchedRunRequest,
162
+ ) -> Optional[Run]:
163
+ """ViewSet for managing Run instances.
164
+ Primarily for listing/retrieving runs.
165
+ Creation of server-side runs is handled by custom actions.
166
+ Runs initiated from Attack definitions are created via AttackViewSet.
167
+
168
+ Args:
169
+ id (UUID):
170
+ body (PatchedRunRequest): Serializer for the Run model, used for both input and output.
171
+
172
+ Raises:
173
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
174
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
175
+
176
+ Returns:
177
+ Run
178
+ """
179
+
180
+ return (
181
+ await asyncio_detailed(
182
+ id=id,
183
+ client=client,
184
+ body=body,
185
+ )
186
+ ).parsed