Skip to content

Commit 2b28b24

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Updated findings api error responses (#1486)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 48416e7 commit 2b28b24

File tree

8 files changed

+115
-105
lines changed

8 files changed

+115
-105
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.4",
7-
"regenerated": "2023-06-14 07:21:00.798021",
8-
"spec_repo_commit": "87ef2d8d"
7+
"regenerated": "2023-06-14 09:53:27.834820",
8+
"spec_repo_commit": "e0974b9b"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-06-14 07:21:00.814393",
13-
"spec_repo_commit": "87ef2d8d"
12+
"regenerated": "2023-06-14 09:53:27.851959",
13+
"spec_repo_commit": "e0974b9b"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 78 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,31 @@ components:
477477
schema:
478478
$ref: '#/components/schemas/APIErrorResponse'
479479
description: Conflict
480+
FindingsBadRequestResponse:
481+
content:
482+
application/json:
483+
schema:
484+
$ref: '#/components/schemas/JSONAPIErrorResponse'
485+
description: 'Bad Request: The server cannot process the request due to invalid
486+
syntax in the request.'
487+
FindingsForbiddenResponse:
488+
content:
489+
application/json:
490+
schema:
491+
$ref: '#/components/schemas/JSONAPIErrorResponse'
492+
description: 'Forbidden: Access denied'
493+
FindingsNotFoundResponse:
494+
content:
495+
application/json:
496+
schema:
497+
$ref: '#/components/schemas/JSONAPIErrorResponse'
498+
description: 'Not Found: The requested finding cannot be found.'
499+
FindingsTooManyRequestsResponse:
500+
content:
501+
application/json:
502+
schema:
503+
$ref: '#/components/schemas/JSONAPIErrorResponse'
504+
description: 'Too many requests: The rate limit set by the API has been exceeded.'
480505
ForbiddenResponse:
481506
content:
482507
application/json:
@@ -4520,34 +4545,6 @@ components:
45204545
type: string
45214546
x-enum-varnames:
45224547
- FINDING
4523-
FindingsErrorItem:
4524-
description: API error response body
4525-
properties:
4526-
detail:
4527-
description: A human-readable explanation specific to this occurrence of
4528-
the error.
4529-
example: attribute "muted" is required
4530-
type: string
4531-
status:
4532-
description: Status code of the response.
4533-
example: '400'
4534-
type: string
4535-
title:
4536-
description: Short human-readable summary of the error.
4537-
example: Bad Request
4538-
type: string
4539-
type: object
4540-
FindingsErrorResponse:
4541-
description: API error response.
4542-
properties:
4543-
errors:
4544-
description: A list of errors.
4545-
items:
4546-
$ref: '#/components/schemas/FindingsErrorItem'
4547-
type: array
4548-
required:
4549-
- errors
4550-
type: object
45514548
FormulaLimit:
45524549
description: Message for specifying limits to the number of values returned
45534550
by a query.
@@ -6839,6 +6836,34 @@ components:
68396836
type: string
68406837
type: array
68416838
type: object
6839+
JSONAPIErrorItem:
6840+
description: API error response body
6841+
properties:
6842+
detail:
6843+
description: A human-readable explanation specific to this occurrence of
6844+
the error.
6845+
example: Missing required attribute in body
6846+
type: string
6847+
status:
6848+
description: Status code of the response.
6849+
example: '400'
6850+
type: string
6851+
title:
6852+
description: Short human-readable summary of the error.
6853+
example: Bad Request
6854+
type: string
6855+
type: object
6856+
JSONAPIErrorResponse:
6857+
description: API error response.
6858+
properties:
6859+
errors:
6860+
description: A list of errors.
6861+
items:
6862+
$ref: '#/components/schemas/JSONAPIErrorItem'
6863+
type: array
6864+
required:
6865+
- errors
6866+
type: object
68426867
JiraIntegrationMetadata:
68436868
description: Incident integration metadata for the Jira integration.
68446869
properties:
@@ -20715,13 +20740,16 @@ paths:
2071520740
can also use the negation operator on strings. For example, use `filter[resource_type]=-aws*`
2071620741
to filter for any non-AWS resources.\n\nThe operator must come after the equal
2071720742
sign. For example, to filter with the `>=` operator, add the operator after
20718-
the equal sign: `filter[evaluation_changed_at]=>=1678809373257`.\n\n### Response\n\nThe
20719-
response includes an array of finding objects, pagination metadata, and a
20720-
count of items that match the query.\n\nEach finding object contains the following:\n\n-
20721-
The finding ID that can be used in a `GetFinding` request to retrieve the
20722-
full finding details.\n- Core attributes, including status, evaluation, high-level
20723-
resource details, muted state, and rule details.\n- `evaluation_changed_at`
20724-
and `resource_discovery_date` time stamps.\n- An array of associated tags.\n"
20743+
the equal sign: `filter[evaluation_changed_at]=>=1678809373257`.\n\nQuery
20744+
parameters must be only among the documented ones and with values of correct
20745+
types. Duplicated query parameters (e.g. `filter[status]=low&filter[status]=info`)
20746+
are not allowed.\n\n### Response\n\nThe response includes an array of finding
20747+
objects, pagination metadata, and a count of items that match the query.\n\nEach
20748+
finding object contains the following:\n\n- The finding ID that can be used
20749+
in a `GetFinding` request to retrieve the full finding details.\n- Core attributes,
20750+
including status, evaluation, high-level resource details, muted state, and
20751+
rule details.\n- `evaluation_changed_at` and `resource_discovery_date` time
20752+
stamps.\n- An array of associated tags.\n"
2072520753
operationId: ListFindings
2072620754
parameters:
2072720755
- description: Limit the number of findings returned. Must be <= 1000.
@@ -20821,17 +20849,13 @@ paths:
2082120849
$ref: '#/components/schemas/ListFindingsResponse'
2082220850
description: OK
2082320851
'400':
20824-
content:
20825-
application/json:
20826-
schema:
20827-
$ref: '#/components/schemas/APIErrorResponse'
20828-
description: Bad Request
20852+
$ref: '#/components/responses/FindingsBadRequestResponse'
2082920853
'403':
20830-
$ref: '#/components/responses/ForbiddenResponse'
20854+
$ref: '#/components/responses/FindingsForbiddenResponse'
2083120855
'404':
20832-
$ref: '#/components/responses/NotFoundResponse'
20856+
$ref: '#/components/responses/FindingsNotFoundResponse'
2083320857
'429':
20834-
$ref: '#/components/responses/TooManyRequestsResponse'
20858+
$ref: '#/components/responses/FindingsTooManyRequestsResponse'
2083520859
security:
2083620860
- apiKeyAuth: []
2083720861
appKeyAuth: []
@@ -20876,17 +20900,13 @@ paths:
2087620900
$ref: '#/components/schemas/GetFindingResponse'
2087720901
description: OK
2087820902
'400':
20879-
content:
20880-
application/json:
20881-
schema:
20882-
$ref: '#/components/schemas/APIErrorResponse'
20883-
description: Bad Request
20903+
$ref: '#/components/responses/FindingsBadRequestResponse'
2088420904
'403':
20885-
$ref: '#/components/responses/ForbiddenResponse'
20905+
$ref: '#/components/responses/FindingsForbiddenResponse'
2088620906
'404':
20887-
$ref: '#/components/responses/NotFoundResponse'
20907+
$ref: '#/components/responses/FindingsNotFoundResponse'
2088820908
'429':
20889-
$ref: '#/components/responses/TooManyRequestsResponse'
20909+
$ref: '#/components/responses/FindingsTooManyRequestsResponse'
2089020910
security:
2089120911
- apiKeyAuth: []
2089220912
appKeyAuth: []
@@ -20934,39 +20954,27 @@ paths:
2093420954
$ref: '#/components/schemas/MuteFindingResponse'
2093520955
description: OK
2093620956
'400':
20937-
content:
20938-
application/json:
20939-
schema:
20940-
$ref: '#/components/schemas/FindingsErrorResponse'
20941-
description: 'Bad Request: The server cannot process the request due to
20942-
invalid syntax in the request.'
20957+
$ref: '#/components/responses/FindingsBadRequestResponse'
20958+
'403':
20959+
$ref: '#/components/responses/FindingsForbiddenResponse'
2094320960
'404':
20944-
content:
20945-
application/json:
20946-
schema:
20947-
$ref: '#/components/schemas/FindingsErrorResponse'
20948-
description: 'Not Found: The requested finding cannot be found.'
20961+
$ref: '#/components/responses/FindingsNotFoundResponse'
2094920962
'409':
2095020963
content:
2095120964
application/json:
2095220965
schema:
20953-
$ref: '#/components/schemas/FindingsErrorResponse'
20966+
$ref: '#/components/schemas/JSONAPIErrorResponse'
2095420967
description: 'Resource Conflict: The finding has already been muted or unmuted
2095520968
within the last 60 seconds.'
2095620969
'422':
2095720970
content:
2095820971
application/json:
2095920972
schema:
20960-
$ref: '#/components/schemas/FindingsErrorResponse'
20973+
$ref: '#/components/schemas/JSONAPIErrorResponse'
2096120974
description: 'Invalid Request: The server understands the request syntax
2096220975
but cannot process it due to invalid data.'
2096320976
'429':
20964-
content:
20965-
application/json:
20966-
schema:
20967-
$ref: '#/components/schemas/FindingsErrorResponse'
20968-
description: 'Too many requests: The rate limit set by the API has been
20969-
exceeded.'
20977+
$ref: '#/components/responses/FindingsTooManyRequestsResponse'
2097020978
security:
2097120979
- apiKeyAuth: []
2097220980
appKeyAuth: []

docs/datadog_api_client.v2.model.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,20 +1737,6 @@ finding\_type
17371737
:members:
17381738
:show-inheritance:
17391739

1740-
findings\_error\_item
1741-
---------------------
1742-
1743-
.. automodule:: datadog_api_client.v2.model.findings_error_item
1744-
:members:
1745-
:show-inheritance:
1746-
1747-
findings\_error\_response
1748-
-------------------------
1749-
1750-
.. automodule:: datadog_api_client.v2.model.findings_error_response
1751-
:members:
1752-
:show-inheritance:
1753-
17541740
formula\_limit
17551741
--------------
17561742

@@ -2871,6 +2857,20 @@ jira\_integration\_metadata\_issues\_item
28712857
:members:
28722858
:show-inheritance:
28732859

2860+
jsonapi\_error\_item
2861+
--------------------
2862+
2863+
.. automodule:: datadog_api_client.v2.model.jsonapi_error_item
2864+
:members:
2865+
:show-inheritance:
2866+
2867+
jsonapi\_error\_response
2868+
------------------------
2869+
2870+
.. automodule:: datadog_api_client.v2.model.jsonapi_error_response
2871+
:members:
2872+
:show-inheritance:
2873+
28742874
list\_application\_keys\_response
28752875
---------------------------------
28762876

src/datadog_api_client/v2/api/security_monitoring_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,8 @@ def list_findings(
888888
889889
The operator must come after the equal sign. For example, to filter with the ``>=`` operator, add the operator after the equal sign: ``filter[evaluation_changed_at]=>=1678809373257``.
890890
891+
Query parameters must be only among the documented ones and with values of correct types. Duplicated query parameters (e.g. ``filter[status]=low&filter[status]=info`` ) are not allowed.
892+
891893
**Response**
892894
893895
The response includes an array of finding objects, pagination metadata, and a count of items that match the query.

src/datadog_api_client/v2/model/findings_error_item.py renamed to src/datadog_api_client/v2/model/jsonapi_error_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
)
1414

1515

16-
class FindingsErrorItem(ModelNormal):
16+
class JSONAPIErrorItem(ModelNormal):
1717
@cached_property
1818
def openapi_types(_):
1919
return {

src/datadog_api_client/v2/model/findings_error_response.py renamed to src/datadog_api_client/v2/model/jsonapi_error_response.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@
1212

1313

1414
if TYPE_CHECKING:
15-
from datadog_api_client.v2.model.findings_error_item import FindingsErrorItem
15+
from datadog_api_client.v2.model.jsonapi_error_item import JSONAPIErrorItem
1616

1717

18-
class FindingsErrorResponse(ModelNormal):
18+
class JSONAPIErrorResponse(ModelNormal):
1919
@cached_property
2020
def openapi_types(_):
21-
from datadog_api_client.v2.model.findings_error_item import FindingsErrorItem
21+
from datadog_api_client.v2.model.jsonapi_error_item import JSONAPIErrorItem
2222

2323
return {
24-
"errors": ([FindingsErrorItem],),
24+
"errors": ([JSONAPIErrorItem],),
2525
}
2626

2727
attribute_map = {
2828
"errors": "errors",
2929
}
3030

31-
def __init__(self_, errors: List[FindingsErrorItem], **kwargs):
31+
def __init__(self_, errors: List[JSONAPIErrorItem], **kwargs):
3232
"""
3333
API error response.
3434
3535
:param errors: A list of errors.
36-
:type errors: [FindingsErrorItem]
36+
:type errors: [JSONAPIErrorItem]
3737
"""
3838
super().__init__(kwargs)
3939

src/datadog_api_client/v2/models/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,6 @@
292292
from datadog_api_client.v2.model.finding_rule import FindingRule
293293
from datadog_api_client.v2.model.finding_status import FindingStatus
294294
from datadog_api_client.v2.model.finding_type import FindingType
295-
from datadog_api_client.v2.model.findings_error_item import FindingsErrorItem
296-
from datadog_api_client.v2.model.findings_error_response import FindingsErrorResponse
297295
from datadog_api_client.v2.model.formula_limit import FormulaLimit
298296
from datadog_api_client.v2.model.full_api_key import FullAPIKey
299297
from datadog_api_client.v2.model.full_api_key_attributes import FullAPIKeyAttributes
@@ -484,6 +482,8 @@
484482
from datadog_api_client.v2.model.incident_update_request import IncidentUpdateRequest
485483
from datadog_api_client.v2.model.incidents_response import IncidentsResponse
486484
from datadog_api_client.v2.model.intake_payload_accepted import IntakePayloadAccepted
485+
from datadog_api_client.v2.model.jsonapi_error_item import JSONAPIErrorItem
486+
from datadog_api_client.v2.model.jsonapi_error_response import JSONAPIErrorResponse
487487
from datadog_api_client.v2.model.jira_integration_metadata import JiraIntegrationMetadata
488488
from datadog_api_client.v2.model.jira_integration_metadata_issues_item import JiraIntegrationMetadataIssuesItem
489489
from datadog_api_client.v2.model.list_application_keys_response import ListApplicationKeysResponse

tests/v2/features/security_monitoring.feature

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,20 +199,20 @@ Feature: Security Monitoring
199199
And the response "id" has the same value as "cloud_configuration_rule.id"
200200

201201
@generated @skip @team:DataDog/cloud-security-posture-management
202-
Scenario: Get a finding returns "Bad Request" response
202+
Scenario: Get a finding returns "Bad Request: The server cannot process the request due to invalid syntax in the request." response
203203
Given operation "GetFinding" enabled
204204
And new "GetFinding" request
205205
And request contains "finding_id" parameter from "REPLACE.ME"
206206
When the request is sent
207-
Then the response status is 400 Bad Request
207+
Then the response status is 400 Bad Request: The server cannot process the request due to invalid syntax in the request.
208208

209209
@generated @skip @team:DataDog/cloud-security-posture-management
210-
Scenario: Get a finding returns "Not Found" response
210+
Scenario: Get a finding returns "Not Found: The requested finding cannot be found." response
211211
Given operation "GetFinding" enabled
212212
And new "GetFinding" request
213213
And request contains "finding_id" parameter from "REPLACE.ME"
214214
When the request is sent
215-
Then the response status is 404 Not Found
215+
Then the response status is 404 Not Found: The requested finding cannot be found.
216216

217217
@replay-only @team:DataDog/cloud-security-posture-management
218218
Scenario: Get a finding returns "OK" response
@@ -325,18 +325,18 @@ Feature: Security Monitoring
325325
And the response "data" has item with field "attributes.is_builtin" with value true
326326

327327
@generated @skip @team:DataDog/cloud-security-posture-management
328-
Scenario: List findings returns "Bad Request" response
328+
Scenario: List findings returns "Bad Request: The server cannot process the request due to invalid syntax in the request." response
329329
Given operation "ListFindings" enabled
330330
And new "ListFindings" request
331331
When the request is sent
332-
Then the response status is 400 Bad Request
332+
Then the response status is 400 Bad Request: The server cannot process the request due to invalid syntax in the request.
333333

334334
@generated @skip @team:DataDog/cloud-security-posture-management
335-
Scenario: List findings returns "Not Found" response
335+
Scenario: List findings returns "Not Found: The requested finding cannot be found." response
336336
Given operation "ListFindings" enabled
337337
And new "ListFindings" request
338338
When the request is sent
339-
Then the response status is 404 Not Found
339+
Then the response status is 404 Not Found: The requested finding cannot be found.
340340

341341
@replay-only @team:DataDog/cloud-security-posture-management
342342
Scenario: List findings returns "OK" response

0 commit comments

Comments
 (0)