Skip to content

Commit

Permalink
Add 409 Conflict to CreateGlobalVariable (#2586)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Jul 26, 2024
1 parent 69c04c5 commit d55de74
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 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.6",
"regenerated": "2024-07-26 15:05:45.922448",
"spec_repo_commit": "bdcf730e"
"regenerated": "2024-07-26 17:47:45.339350",
"spec_repo_commit": "187cfa14"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-26 15:05:45.941135",
"spec_repo_commit": "bdcf730e"
"regenerated": "2024-07-26 17:47:45.357712",
"spec_repo_commit": "187cfa14"
}
}
}
6 changes: 6 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31092,6 +31092,12 @@ paths:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
'409':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Conflict
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV1/api_synthetics.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (a *SyntheticsApi) CreateGlobalVariable(ctx _context.Context, body Syntheti
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions tests/scenarios/features/v1/synthetics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ Feature: Synthetics
Then the response status is 200 OK
And the response "name" is equal to "GLOBAL_VARIABLE_PAYLOAD_{{ unique_upper_alnum }}"

@generated @skip @team:DataDog/synthetics-ct
Scenario: Create a global variable returns "Conflict" response
Given new "CreateGlobalVariable" request
And body with value {"attributes": {"restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]}, "description": "Example description", "name": "MY_VARIABLE", "parse_test_options": {"field": "content-type", "localVariableName": "LOCAL_VARIABLE", "parser": {"type": "regex", "value": ".*"}, "type": "http_body"}, "parse_test_public_id": "abc-def-123", "tags": ["team:front", "test:workflow-1"], "value": {"secure": true, "value": "value"}}
When the request is sent
Then the response status is 409 Conflict

@generated @skip @team:DataDog/synthetics-ct
Scenario: Create a global variable returns "Invalid request" response
Given new "CreateGlobalVariable" request
Expand Down

0 comments on commit d55de74

Please sign in to comment.