Skip to content

Commit

Permalink
Regenerate client from commit 184be3f of spec repo (#1277)
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 Jan 4, 2022
1 parent 2aa68be commit 9e2043c
Show file tree
Hide file tree
Showing 9 changed files with 267 additions and 7 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.5.1.dev2",
"regenerated": "2022-01-04 09:34:35.416352",
"spec_repo_commit": "6946869"
"regenerated": "2022-01-04 09:52:32.436445",
"spec_repo_commit": "184be3f"
},
"v2": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2022-01-04 09:34:35.434103",
"spec_repo_commit": "6946869"
"regenerated": "2022-01-04 09:52:32.454722",
"spec_repo_commit": "184be3f"
}
}
}
2 changes: 2 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9465,6 +9465,8 @@ components:
type: string
request:
$ref: '#/components/schemas/SyntheticsTestRequest'
retry:
$ref: '#/components/schemas/SyntheticsTestOptionsRetry'
subtype:
$ref: '#/components/schemas/SyntheticsAPIStepSubtype'
type: object
Expand Down
26 changes: 26 additions & 0 deletions api/v1/datadog/docs/SyntheticsAPIStep.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Name | Type | Description | Notes
**IsCritical** | Pointer to **bool** | Determines whether or not to consider the entire test as failed if this step fails. Can be used only if &#x60;allowFailure&#x60; is &#x60;true&#x60;. | [optional]
**Name** | Pointer to **string** | The name of the step. | [optional]
**Request** | Pointer to [**SyntheticsTestRequest**](SyntheticsTestRequest.md) | | [optional]
**Retry** | Pointer to [**SyntheticsTestOptionsRetry**](SyntheticsTestOptionsRetry.md) | | [optional]
**Subtype** | Pointer to [**SyntheticsAPIStepSubtype**](SyntheticsAPIStepSubtype.md) | | [optional]

## Methods
Expand Down Expand Up @@ -181,6 +182,31 @@ SetRequest sets Request field to given value.

HasRequest returns a boolean if a field has been set.

### GetRetry

`func (o *SyntheticsAPIStep) GetRetry() SyntheticsTestOptionsRetry`

GetRetry returns the Retry field if non-nil, zero value otherwise.

### GetRetryOk

`func (o *SyntheticsAPIStep) GetRetryOk() (*SyntheticsTestOptionsRetry, bool)`

GetRetryOk returns a tuple with the Retry field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetRetry

`func (o *SyntheticsAPIStep) SetRetry(v SyntheticsTestOptionsRetry)`

SetRetry sets Retry field to given value.

### HasRetry

`func (o *SyntheticsAPIStep) HasRetry() bool`

HasRetry returns a boolean if a field has been set.

### GetSubtype

`func (o *SyntheticsAPIStep) GetSubtype() SyntheticsAPIStepSubtype`
Expand Down
44 changes: 41 additions & 3 deletions api/v1/datadog/model_synthetics_api_step.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 88 additions & 0 deletions examples/v1/synthetics/CreateSyntheticsAPITest_1279271422.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Create an API test with multi subtype returns "OK - Returns the created test details." response

package main

import (
"context"
"encoding/json"
"fmt"
"os"

datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
body := datadog.SyntheticsAPITest{
Config: &datadog.SyntheticsAPITestConfig{
ConfigVariables: &[]datadog.SyntheticsConfigVariable{
{
Example: datadog.PtrString("content-type"),
Name: "PROPERTY",
Pattern: datadog.PtrString("content-type"),
Type: datadog.SYNTHETICSCONFIGVARIABLETYPE_TEXT,
},
},
Steps: &[]datadog.SyntheticsAPIStep{
{
AllowFailure: datadog.PtrBool(true),
Assertions: &[]datadog.SyntheticsAssertion{
datadog.SyntheticsAssertion{
SyntheticsAssertionTarget: &datadog.SyntheticsAssertionTarget{
Operator: datadog.SYNTHETICSASSERTIONOPERATOR_IS,
Type: datadog.SYNTHETICSASSERTIONTYPE_STATUS_CODE,
Target: 200,
}},
},
IsCritical: datadog.PtrBool(true),
Name: datadog.PtrString("request is sent"),
Request: &datadog.SyntheticsTestRequest{
Method: datadog.HTTPMETHOD_GET.Ptr(),
Timeout: datadog.PtrFloat64(10),
Url: datadog.PtrString("https://datadoghq.com"),
},
Retry: &datadog.SyntheticsTestOptionsRetry{
Count: datadog.PtrInt64(5),
Interval: datadog.PtrFloat64(1000),
},
Subtype: datadog.SYNTHETICSAPISTEPSUBTYPE_HTTP.Ptr(),
},
},
},
Locations: &[]string{
"aws:us-east-2",
},
Message: datadog.PtrString("BDD test payload: synthetics_api_test_multi_step_payload.json"),
Name: datadog.PtrString("Example-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response"),
Options: &datadog.SyntheticsTestOptions{
AcceptSelfSigned: datadog.PtrBool(false),
AllowInsecure: datadog.PtrBool(true),
FollowRedirects: datadog.PtrBool(true),
MinFailureDuration: datadog.PtrInt64(10),
MinLocationFailed: datadog.PtrInt64(1),
MonitorName: datadog.PtrString("Example-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response"),
MonitorPriority: datadog.PtrInt32(5),
Retry: &datadog.SyntheticsTestOptionsRetry{
Count: datadog.PtrInt64(3),
Interval: datadog.PtrFloat64(1000),
},
TickEvery: datadog.PtrInt64(60),
},
Subtype: datadog.SYNTHETICSTESTDETAILSSUBTYPE_MULTI.Ptr(),
Tags: &[]string{
"testing:api",
},
Type: datadog.SYNTHETICSAPITESTTYPE_API.Ptr(),
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.SyntheticsApi.CreateSyntheticsAPITest(ctx, body)

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreateSyntheticsAPITest`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}

responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsAPITest`:\n%s\n", responseContent)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2022-01-03T17:01:27.947Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
interactions:
- request:
body: |
{"config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"isCritical":true,"name":"request is sent","request":{"method":"GET","timeout":10,"url":"https://datadoghq.com"},"retry":{"count":5,"interval":1000},"subtype":"http"}]},"locations":["aws:us-east-2"],"message":"BDD test payload: synthetics_api_test_multi_step_payload.json","name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1641229287","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1641229287","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"subtype":"multi","tags":["testing:api"],"type":"api"}
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
method: POST
url: https://api.datadoghq.com/api/v1/synthetics/tests/api
response:
body: '{"status":"live","public_id":"u62-zu8-cmw","tags":["testing:api"],"org_id":321813,"locations":["aws:us-east-2"],"message":"BDD
test payload: synthetics_api_test_multi_step_payload.json","deleted_at":null,"name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1641229287","monitor_id":59201884,"type":"api","created_at":"2022-01-03T17:01:28.731353+00:00","modified_at":"2022-01-03T17:01:28.731353+00:00","subtype":"multi","config":{"steps":[{"retry":{"count":5,"interval":1000},"name":"request
is sent","request":{"url":"https://datadoghq.com","method":"GET","timeout":10},"subtype":"http","allowFailure":true,"assertions":[{"operator":"is","type":"statusCode","target":200}],"isCritical":true,"id":"ard-2gj-3s8"}],"configVariables":[{"pattern":"content-type","type":"text","example":"content-type","name":"PROPERTY"}]},"options":{"accept_self_signed":false,"retry":{"count":3,"interval":1000},"min_location_failed":1,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"monitor_priority":5,"monitor_name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1641229287","tick_every":60}}'
code: 200
duration: ''
headers:
Content-Type:
- application/json
status: 200 OK
- request:
body: |
{"public_ids":["u62-zu8-cmw"]}
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
method: POST
url: https://api.datadoghq.com/api/v1/synthetics/tests/delete
response:
body: '{"deleted_tests":[{"deleted_at":"2022-01-03T17:01:29.223304+00:00","public_id":"u62-zu8-cmw"}]}'
code: 200
duration: ''
headers:
Content-Type:
- application/json
status: 200 OK
version: 1
10 changes: 10 additions & 0 deletions tests/scenarios/features/v1/synthetics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ Feature: Synthetics
Then the response status is 200 OK - Returns the created test details.
And the response "name" is equal to "{{ unique }}"

@team:DataDog/synthetics-app
Scenario: Create an API test with multi subtype returns "OK - Returns the created test details." response
Given new "CreateSyntheticsAPITest" request
And body from file "synthetics_api_test_multi_step_payload.json"
When the request is sent
Then the response status is 200 OK - Returns the created test details.
And the response "name" is equal to "{{ unique }}"
And the response "config.steps[0].retry.count" is equal to 5
And the response "config.steps[0].retry.interval" is equal to 1000

@generated @skip @team:DataDog/synthetics-app
Scenario: Delete a global variable returns "JSON format is wrong" response
Given new "DeleteGlobalVariable" request
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"config": {
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"steps": [
{
"allowFailure": true,
"assertions": [
{
"operator": "is",
"type": "statusCode",
"target": 200
}
],
"isCritical": true,
"name": "request is sent",
"request": {
"method": "GET",
"timeout": 10,
"url": "https://datadoghq.com"
},
"retry": {
"count": 5,
"interval": 1000
},
"subtype": "http"
}
]
},
"locations": ["aws:us-east-2"],
"message": "BDD test payload: synthetics_api_test_multi_step_payload.json",
"name": "{{ unique }}",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"monitor_name": "{{ unique }}",
"monitor_priority": 5,
"retry": { "count": 3, "interval": 1000 },
"tick_every": 60
},
"subtype": "multi",
"tags": ["testing:api"],
"type": "api"
}

0 comments on commit 9e2043c

Please sign in to comment.