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,140 @@
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/attack/{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
+ """Manages Attack configurations through standard CRUD operations.
51
+
52
+ This ViewSet allows clients to:
53
+ - Create new Attack configurations.
54
+ - List existing Attack configurations (with filtering based on user/org).
55
+ - Retrieve details of a specific Attack configuration.
56
+ - Update an existing Attack configuration.
57
+ - Delete an Attack configuration.
58
+
59
+ The actual execution of an attack based on these configurations, and the
60
+ management of run statuses or results, are handled by other parts of the API
61
+ (e.g., potentially a RunViewSet or similar).
62
+
63
+ Attributes:
64
+ queryset: The base queryset, retrieving all Attack objects with related
65
+ entities (agent, owner, organization) pre-fetched.
66
+ serializer_class: The serializer (`AttackSerializer`) used for data
67
+ conversion for Attack configurations.
68
+ authentication_classes: List of authentication backends used.
69
+ permission_classes: List of permission enforcement classes.
70
+ parser_classes: List of parsers for request data (JSONParser).
71
+ lookup_field: The model field used for looking up individual instances ('id').
72
+
73
+ Args:
74
+ id (UUID):
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
+ kwargs = _get_kwargs(
85
+ id=id,
86
+ )
87
+
88
+ response = client.get_httpx_client().request(
89
+ **kwargs,
90
+ )
91
+
92
+ return _build_response(client=client, response=response)
93
+
94
+
95
+ async def asyncio_detailed(
96
+ id: UUID,
97
+ *,
98
+ client: AuthenticatedClient,
99
+ ) -> Response[Any]:
100
+ """Manages Attack configurations through standard CRUD operations.
101
+
102
+ This ViewSet allows clients to:
103
+ - Create new Attack configurations.
104
+ - List existing Attack configurations (with filtering based on user/org).
105
+ - Retrieve details of a specific Attack configuration.
106
+ - Update an existing Attack configuration.
107
+ - Delete an Attack configuration.
108
+
109
+ The actual execution of an attack based on these configurations, and the
110
+ management of run statuses or results, are handled by other parts of the API
111
+ (e.g., potentially a RunViewSet or similar).
112
+
113
+ Attributes:
114
+ queryset: The base queryset, retrieving all Attack objects with related
115
+ entities (agent, owner, organization) pre-fetched.
116
+ serializer_class: The serializer (`AttackSerializer`) used for data
117
+ conversion for Attack configurations.
118
+ authentication_classes: List of authentication backends used.
119
+ permission_classes: List of permission enforcement classes.
120
+ parser_classes: List of parsers for request data (JSONParser).
121
+ lookup_field: The model field used for looking up individual instances ('id').
122
+
123
+ Args:
124
+ id (UUID):
125
+
126
+ Raises:
127
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
128
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
129
+
130
+ Returns:
131
+ Response[Any]
132
+ """
133
+
134
+ kwargs = _get_kwargs(
135
+ id=id,
136
+ )
137
+
138
+ response = await client.get_async_httpx_client().request(**kwargs)
139
+
140
+ return _build_response(client=client, response=response)
@@ -0,0 +1,242 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.paginated_attack_list import PaginatedAttackList
9
+ from ...types import UNSET, Response, Unset
10
+
11
+
12
+ def _get_kwargs(
13
+ *,
14
+ page: Union[Unset, int] = UNSET,
15
+ ) -> dict[str, Any]:
16
+ params: dict[str, Any] = {}
17
+
18
+ params["page"] = page
19
+
20
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "get",
24
+ "url": "/api/attack",
25
+ "params": params,
26
+ }
27
+
28
+ return _kwargs
29
+
30
+
31
+ def _parse_response(
32
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
33
+ ) -> Optional[PaginatedAttackList]:
34
+ if response.status_code == 200:
35
+ response_200 = PaginatedAttackList.from_dict(response.json())
36
+
37
+ return response_200
38
+ if client.raise_on_unexpected_status:
39
+ raise errors.UnexpectedStatus(response.status_code, response.content)
40
+ else:
41
+ return None
42
+
43
+
44
+ def _build_response(
45
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
46
+ ) -> Response[PaginatedAttackList]:
47
+ return Response(
48
+ status_code=HTTPStatus(response.status_code),
49
+ content=response.content,
50
+ headers=response.headers,
51
+ parsed=_parse_response(client=client, response=response),
52
+ )
53
+
54
+
55
+ def sync_detailed(
56
+ *,
57
+ client: AuthenticatedClient,
58
+ page: Union[Unset, int] = UNSET,
59
+ ) -> Response[PaginatedAttackList]:
60
+ """Manages Attack configurations through standard CRUD operations.
61
+
62
+ This ViewSet allows clients to:
63
+ - Create new Attack configurations.
64
+ - List existing Attack configurations (with filtering based on user/org).
65
+ - Retrieve details of a specific Attack configuration.
66
+ - Update an existing Attack configuration.
67
+ - Delete an Attack configuration.
68
+
69
+ The actual execution of an attack based on these configurations, and the
70
+ management of run statuses or results, are handled by other parts of the API
71
+ (e.g., potentially a RunViewSet or similar).
72
+
73
+ Attributes:
74
+ queryset: The base queryset, retrieving all Attack objects with related
75
+ entities (agent, owner, organization) pre-fetched.
76
+ serializer_class: The serializer (`AttackSerializer`) used for data
77
+ conversion for Attack configurations.
78
+ authentication_classes: List of authentication backends used.
79
+ permission_classes: List of permission enforcement classes.
80
+ parser_classes: List of parsers for request data (JSONParser).
81
+ lookup_field: The model field used for looking up individual instances ('id').
82
+
83
+ Args:
84
+ page (Union[Unset, int]):
85
+
86
+ Raises:
87
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
88
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
89
+
90
+ Returns:
91
+ Response[PaginatedAttackList]
92
+ """
93
+
94
+ kwargs = _get_kwargs(
95
+ page=page,
96
+ )
97
+
98
+ response = client.get_httpx_client().request(
99
+ **kwargs,
100
+ )
101
+
102
+ return _build_response(client=client, response=response)
103
+
104
+
105
+ def sync(
106
+ *,
107
+ client: AuthenticatedClient,
108
+ page: Union[Unset, int] = UNSET,
109
+ ) -> Optional[PaginatedAttackList]:
110
+ """Manages Attack configurations through standard CRUD operations.
111
+
112
+ This ViewSet allows clients to:
113
+ - Create new Attack configurations.
114
+ - List existing Attack configurations (with filtering based on user/org).
115
+ - Retrieve details of a specific Attack configuration.
116
+ - Update an existing Attack configuration.
117
+ - Delete an Attack configuration.
118
+
119
+ The actual execution of an attack based on these configurations, and the
120
+ management of run statuses or results, are handled by other parts of the API
121
+ (e.g., potentially a RunViewSet or similar).
122
+
123
+ Attributes:
124
+ queryset: The base queryset, retrieving all Attack objects with related
125
+ entities (agent, owner, organization) pre-fetched.
126
+ serializer_class: The serializer (`AttackSerializer`) used for data
127
+ conversion for Attack configurations.
128
+ authentication_classes: List of authentication backends used.
129
+ permission_classes: List of permission enforcement classes.
130
+ parser_classes: List of parsers for request data (JSONParser).
131
+ lookup_field: The model field used for looking up individual instances ('id').
132
+
133
+ Args:
134
+ page (Union[Unset, int]):
135
+
136
+ Raises:
137
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
138
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
139
+
140
+ Returns:
141
+ PaginatedAttackList
142
+ """
143
+
144
+ return sync_detailed(
145
+ client=client,
146
+ page=page,
147
+ ).parsed
148
+
149
+
150
+ async def asyncio_detailed(
151
+ *,
152
+ client: AuthenticatedClient,
153
+ page: Union[Unset, int] = UNSET,
154
+ ) -> Response[PaginatedAttackList]:
155
+ """Manages Attack configurations through standard CRUD operations.
156
+
157
+ This ViewSet allows clients to:
158
+ - Create new Attack configurations.
159
+ - List existing Attack configurations (with filtering based on user/org).
160
+ - Retrieve details of a specific Attack configuration.
161
+ - Update an existing Attack configuration.
162
+ - Delete an Attack configuration.
163
+
164
+ The actual execution of an attack based on these configurations, and the
165
+ management of run statuses or results, are handled by other parts of the API
166
+ (e.g., potentially a RunViewSet or similar).
167
+
168
+ Attributes:
169
+ queryset: The base queryset, retrieving all Attack objects with related
170
+ entities (agent, owner, organization) pre-fetched.
171
+ serializer_class: The serializer (`AttackSerializer`) used for data
172
+ conversion for Attack configurations.
173
+ authentication_classes: List of authentication backends used.
174
+ permission_classes: List of permission enforcement classes.
175
+ parser_classes: List of parsers for request data (JSONParser).
176
+ lookup_field: The model field used for looking up individual instances ('id').
177
+
178
+ Args:
179
+ page (Union[Unset, int]):
180
+
181
+ Raises:
182
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
183
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
184
+
185
+ Returns:
186
+ Response[PaginatedAttackList]
187
+ """
188
+
189
+ kwargs = _get_kwargs(
190
+ page=page,
191
+ )
192
+
193
+ response = await client.get_async_httpx_client().request(**kwargs)
194
+
195
+ return _build_response(client=client, response=response)
196
+
197
+
198
+ async def asyncio(
199
+ *,
200
+ client: AuthenticatedClient,
201
+ page: Union[Unset, int] = UNSET,
202
+ ) -> Optional[PaginatedAttackList]:
203
+ """Manages Attack configurations through standard CRUD operations.
204
+
205
+ This ViewSet allows clients to:
206
+ - Create new Attack configurations.
207
+ - List existing Attack configurations (with filtering based on user/org).
208
+ - Retrieve details of a specific Attack configuration.
209
+ - Update an existing Attack configuration.
210
+ - Delete an Attack configuration.
211
+
212
+ The actual execution of an attack based on these configurations, and the
213
+ management of run statuses or results, are handled by other parts of the API
214
+ (e.g., potentially a RunViewSet or similar).
215
+
216
+ Attributes:
217
+ queryset: The base queryset, retrieving all Attack objects with related
218
+ entities (agent, owner, organization) pre-fetched.
219
+ serializer_class: The serializer (`AttackSerializer`) used for data
220
+ conversion for Attack configurations.
221
+ authentication_classes: List of authentication backends used.
222
+ permission_classes: List of permission enforcement classes.
223
+ parser_classes: List of parsers for request data (JSONParser).
224
+ lookup_field: The model field used for looking up individual instances ('id').
225
+
226
+ Args:
227
+ page (Union[Unset, int]):
228
+
229
+ Raises:
230
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
231
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
232
+
233
+ Returns:
234
+ PaginatedAttackList
235
+ """
236
+
237
+ return (
238
+ await asyncio_detailed(
239
+ client=client,
240
+ page=page,
241
+ )
242
+ ).parsed
@@ -0,0 +1,278 @@
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.attack import Attack
10
+ from ...models.patched_attack_request import PatchedAttackRequest
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: UUID,
16
+ *,
17
+ body: PatchedAttackRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "patch",
23
+ "url": f"/api/attack/{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[Attack]:
38
+ if response.status_code == 200:
39
+ response_200 = Attack.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[Attack]:
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: PatchedAttackRequest,
64
+ ) -> Response[Attack]:
65
+ """Manages Attack configurations through standard CRUD operations.
66
+
67
+ This ViewSet allows clients to:
68
+ - Create new Attack configurations.
69
+ - List existing Attack configurations (with filtering based on user/org).
70
+ - Retrieve details of a specific Attack configuration.
71
+ - Update an existing Attack configuration.
72
+ - Delete an Attack configuration.
73
+
74
+ The actual execution of an attack based on these configurations, and the
75
+ management of run statuses or results, are handled by other parts of the API
76
+ (e.g., potentially a RunViewSet or similar).
77
+
78
+ Attributes:
79
+ queryset: The base queryset, retrieving all Attack objects with related
80
+ entities (agent, owner, organization) pre-fetched.
81
+ serializer_class: The serializer (`AttackSerializer`) used for data
82
+ conversion for Attack configurations.
83
+ authentication_classes: List of authentication backends used.
84
+ permission_classes: List of permission enforcement classes.
85
+ parser_classes: List of parsers for request data (JSONParser).
86
+ lookup_field: The model field used for looking up individual instances ('id').
87
+
88
+ Args:
89
+ id (UUID):
90
+ body (PatchedAttackRequest): Serializer for the Attack model, which represents an Attack
91
+ configuration.
92
+
93
+ Handles the conversion of Attack configuration instances to JSON (and vice-versa)
94
+ for API requests and responses. It includes read-only fields for related
95
+ object names (like agent_name, owner_username) for convenience in API outputs.
96
+
97
+ Raises:
98
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
99
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
100
+
101
+ Returns:
102
+ Response[Attack]
103
+ """
104
+
105
+ kwargs = _get_kwargs(
106
+ id=id,
107
+ body=body,
108
+ )
109
+
110
+ response = client.get_httpx_client().request(
111
+ **kwargs,
112
+ )
113
+
114
+ return _build_response(client=client, response=response)
115
+
116
+
117
+ def sync(
118
+ id: UUID,
119
+ *,
120
+ client: AuthenticatedClient,
121
+ body: PatchedAttackRequest,
122
+ ) -> Optional[Attack]:
123
+ """Manages Attack configurations through standard CRUD operations.
124
+
125
+ This ViewSet allows clients to:
126
+ - Create new Attack configurations.
127
+ - List existing Attack configurations (with filtering based on user/org).
128
+ - Retrieve details of a specific Attack configuration.
129
+ - Update an existing Attack configuration.
130
+ - Delete an Attack configuration.
131
+
132
+ The actual execution of an attack based on these configurations, and the
133
+ management of run statuses or results, are handled by other parts of the API
134
+ (e.g., potentially a RunViewSet or similar).
135
+
136
+ Attributes:
137
+ queryset: The base queryset, retrieving all Attack objects with related
138
+ entities (agent, owner, organization) pre-fetched.
139
+ serializer_class: The serializer (`AttackSerializer`) used for data
140
+ conversion for Attack configurations.
141
+ authentication_classes: List of authentication backends used.
142
+ permission_classes: List of permission enforcement classes.
143
+ parser_classes: List of parsers for request data (JSONParser).
144
+ lookup_field: The model field used for looking up individual instances ('id').
145
+
146
+ Args:
147
+ id (UUID):
148
+ body (PatchedAttackRequest): Serializer for the Attack model, which represents an Attack
149
+ configuration.
150
+
151
+ Handles the conversion of Attack configuration instances to JSON (and vice-versa)
152
+ for API requests and responses. It includes read-only fields for related
153
+ object names (like agent_name, owner_username) for convenience in API outputs.
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
+ Attack
161
+ """
162
+
163
+ return sync_detailed(
164
+ id=id,
165
+ client=client,
166
+ body=body,
167
+ ).parsed
168
+
169
+
170
+ async def asyncio_detailed(
171
+ id: UUID,
172
+ *,
173
+ client: AuthenticatedClient,
174
+ body: PatchedAttackRequest,
175
+ ) -> Response[Attack]:
176
+ """Manages Attack configurations through standard CRUD operations.
177
+
178
+ This ViewSet allows clients to:
179
+ - Create new Attack configurations.
180
+ - List existing Attack configurations (with filtering based on user/org).
181
+ - Retrieve details of a specific Attack configuration.
182
+ - Update an existing Attack configuration.
183
+ - Delete an Attack configuration.
184
+
185
+ The actual execution of an attack based on these configurations, and the
186
+ management of run statuses or results, are handled by other parts of the API
187
+ (e.g., potentially a RunViewSet or similar).
188
+
189
+ Attributes:
190
+ queryset: The base queryset, retrieving all Attack objects with related
191
+ entities (agent, owner, organization) pre-fetched.
192
+ serializer_class: The serializer (`AttackSerializer`) used for data
193
+ conversion for Attack configurations.
194
+ authentication_classes: List of authentication backends used.
195
+ permission_classes: List of permission enforcement classes.
196
+ parser_classes: List of parsers for request data (JSONParser).
197
+ lookup_field: The model field used for looking up individual instances ('id').
198
+
199
+ Args:
200
+ id (UUID):
201
+ body (PatchedAttackRequest): Serializer for the Attack model, which represents an Attack
202
+ configuration.
203
+
204
+ Handles the conversion of Attack configuration instances to JSON (and vice-versa)
205
+ for API requests and responses. It includes read-only fields for related
206
+ object names (like agent_name, owner_username) for convenience in API outputs.
207
+
208
+ Raises:
209
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
210
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
211
+
212
+ Returns:
213
+ Response[Attack]
214
+ """
215
+
216
+ kwargs = _get_kwargs(
217
+ id=id,
218
+ body=body,
219
+ )
220
+
221
+ response = await client.get_async_httpx_client().request(**kwargs)
222
+
223
+ return _build_response(client=client, response=response)
224
+
225
+
226
+ async def asyncio(
227
+ id: UUID,
228
+ *,
229
+ client: AuthenticatedClient,
230
+ body: PatchedAttackRequest,
231
+ ) -> Optional[Attack]:
232
+ """Manages Attack configurations through standard CRUD operations.
233
+
234
+ This ViewSet allows clients to:
235
+ - Create new Attack configurations.
236
+ - List existing Attack configurations (with filtering based on user/org).
237
+ - Retrieve details of a specific Attack configuration.
238
+ - Update an existing Attack configuration.
239
+ - Delete an Attack configuration.
240
+
241
+ The actual execution of an attack based on these configurations, and the
242
+ management of run statuses or results, are handled by other parts of the API
243
+ (e.g., potentially a RunViewSet or similar).
244
+
245
+ Attributes:
246
+ queryset: The base queryset, retrieving all Attack objects with related
247
+ entities (agent, owner, organization) pre-fetched.
248
+ serializer_class: The serializer (`AttackSerializer`) used for data
249
+ conversion for Attack configurations.
250
+ authentication_classes: List of authentication backends used.
251
+ permission_classes: List of permission enforcement classes.
252
+ parser_classes: List of parsers for request data (JSONParser).
253
+ lookup_field: The model field used for looking up individual instances ('id').
254
+
255
+ Args:
256
+ id (UUID):
257
+ body (PatchedAttackRequest): Serializer for the Attack model, which represents an Attack
258
+ configuration.
259
+
260
+ Handles the conversion of Attack configuration instances to JSON (and vice-versa)
261
+ for API requests and responses. It includes read-only fields for related
262
+ object names (like agent_name, owner_username) for convenience in API outputs.
263
+
264
+ Raises:
265
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
266
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
267
+
268
+ Returns:
269
+ Attack
270
+ """
271
+
272
+ return (
273
+ await asyncio_detailed(
274
+ id=id,
275
+ client=client,
276
+ body=body,
277
+ )
278
+ ).parsed