Skip to content

Commit

Permalink
Updated findings api error responses (#2016)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Jun 14, 2023
1 parent 2412663 commit b5bd96e
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 125 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2023-06-14 07:20:56.714030",
"spec_repo_commit": "87ef2d8d"
"regenerated": "2023-06-14 09:53:27.267618",
"spec_repo_commit": "e0974b9b"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-06-14 07:20:56.729433",
"spec_repo_commit": "87ef2d8d"
"regenerated": "2023-06-14 09:53:27.281255",
"spec_repo_commit": "e0974b9b"
}
}
}
148 changes: 78 additions & 70 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,31 @@ components:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Conflict
FindingsBadRequestResponse:
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: 'Bad Request: The server cannot process the request due to invalid
syntax in the request.'
FindingsForbiddenResponse:
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: 'Forbidden: Access denied'
FindingsNotFoundResponse:
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: 'Not Found: The requested finding cannot be found.'
FindingsTooManyRequestsResponse:
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: 'Too many requests: The rate limit set by the API has been exceeded.'
ForbiddenResponse:
content:
application/json:
Expand Down Expand Up @@ -4520,34 +4545,6 @@ components:
type: string
x-enum-varnames:
- FINDING
FindingsErrorItem:
description: API error response body
properties:
detail:
description: A human-readable explanation specific to this occurrence of
the error.
example: attribute "muted" is required
type: string
status:
description: Status code of the response.
example: '400'
type: string
title:
description: Short human-readable summary of the error.
example: Bad Request
type: string
type: object
FindingsErrorResponse:
description: API error response.
properties:
errors:
description: A list of errors.
items:
$ref: '#/components/schemas/FindingsErrorItem'
type: array
required:
- errors
type: object
FormulaLimit:
description: Message for specifying limits to the number of values returned
by a query.
Expand Down Expand Up @@ -6839,6 +6836,34 @@ components:
type: string
type: array
type: object
JSONAPIErrorItem:
description: API error response body
properties:
detail:
description: A human-readable explanation specific to this occurrence of
the error.
example: Missing required attribute in body
type: string
status:
description: Status code of the response.
example: '400'
type: string
title:
description: Short human-readable summary of the error.
example: Bad Request
type: string
type: object
JSONAPIErrorResponse:
description: API error response.
properties:
errors:
description: A list of errors.
items:
$ref: '#/components/schemas/JSONAPIErrorItem'
type: array
required:
- errors
type: object
JiraIntegrationMetadata:
description: Incident integration metadata for the Jira integration.
properties:
Expand Down Expand Up @@ -20715,13 +20740,16 @@ paths:
can also use the negation operator on strings. For example, use `filter[resource_type]=-aws*`
to filter for any non-AWS resources.\n\nThe 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`.\n\n### Response\n\nThe
response includes an array of finding objects, pagination metadata, and a
count of items that match the query.\n\nEach finding object contains the following:\n\n-
The finding ID that can be used in a `GetFinding` request to retrieve the
full finding details.\n- Core attributes, including status, evaluation, high-level
resource details, muted state, and rule details.\n- `evaluation_changed_at`
and `resource_discovery_date` time stamps.\n- An array of associated tags.\n"
the equal sign: `filter[evaluation_changed_at]=>=1678809373257`.\n\nQuery
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.\n\n### Response\n\nThe response includes an array of finding
objects, pagination metadata, and a count of items that match the query.\n\nEach
finding object contains the following:\n\n- The finding ID that can be used
in a `GetFinding` request to retrieve the full finding details.\n- Core attributes,
including status, evaluation, high-level resource details, muted state, and
rule details.\n- `evaluation_changed_at` and `resource_discovery_date` time
stamps.\n- An array of associated tags.\n"
operationId: ListFindings
parameters:
- description: Limit the number of findings returned. Must be <= 1000.
Expand Down Expand Up @@ -20821,17 +20849,13 @@ paths:
$ref: '#/components/schemas/ListFindingsResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
$ref: '#/components/responses/FindingsBadRequestResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
$ref: '#/components/responses/FindingsForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
$ref: '#/components/responses/FindingsNotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
$ref: '#/components/responses/FindingsTooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
Expand Down Expand Up @@ -20876,17 +20900,13 @@ paths:
$ref: '#/components/schemas/GetFindingResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
$ref: '#/components/responses/FindingsBadRequestResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
$ref: '#/components/responses/FindingsForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
$ref: '#/components/responses/FindingsNotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
$ref: '#/components/responses/FindingsTooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
Expand Down Expand Up @@ -20934,39 +20954,27 @@ paths:
$ref: '#/components/schemas/MuteFindingResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/FindingsErrorResponse'
description: 'Bad Request: The server cannot process the request due to
invalid syntax in the request.'
$ref: '#/components/responses/FindingsBadRequestResponse'
'403':
$ref: '#/components/responses/FindingsForbiddenResponse'
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/FindingsErrorResponse'
description: 'Not Found: The requested finding cannot be found.'
$ref: '#/components/responses/FindingsNotFoundResponse'
'409':
content:
application/json:
schema:
$ref: '#/components/schemas/FindingsErrorResponse'
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: 'Resource Conflict: The finding has already been muted or unmuted
within the last 60 seconds.'
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/FindingsErrorResponse'
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: 'Invalid Request: The server understands the request syntax
but cannot process it due to invalid data.'
'429':
content:
application/json:
schema:
$ref: '#/components/schemas/FindingsErrorResponse'
description: 'Too many requests: The rate limit set by the API has been
exceeded.'
$ref: '#/components/responses/FindingsTooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
Expand Down
10 changes: 6 additions & 4 deletions api/datadogV2/api_security_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ func (a *SecurityMonitoringApi) GetFinding(ctx _context.Context, findingId strin
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
var v JSONAPIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, newErr
Expand Down Expand Up @@ -947,6 +947,8 @@ func (r *ListFindingsOptionalParameters) WithFilterStatus(filterStatus FindingSt
//
// 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`.
//
// 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.
//
// ### Response
//
// The response includes an array of finding objects, pagination metadata, and a count of items that match the query.
Expand Down Expand Up @@ -1055,7 +1057,7 @@ func (a *SecurityMonitoringApi) ListFindings(ctx _context.Context, o ...ListFind
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
var v JSONAPIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, newErr
Expand Down Expand Up @@ -1746,8 +1748,8 @@ func (a *SecurityMonitoringApi) UpdateFinding(ctx _context.Context, findingId st
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 422 || localVarHTTPResponse.StatusCode == 429 {
var v FindingsErrorResponse
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 422 || localVarHTTPResponse.StatusCode == 429 {
var v JSONAPIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, newErr
Expand Down
Loading

0 comments on commit b5bd96e

Please sign in to comment.