-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerate client from commit 65b2053a of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Dec 8, 2022
1 parent
debc4b7
commit 097483f
Showing
8 changed files
with
341 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
examples/v1/synthetics/CreateSyntheticsAPITest_960766374.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
// Create an API HTTP with oauth-rop test returns "OK - Returns the created test details." response | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/DataDog/datadog-api-client-go/v2/api/datadog" | ||
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1" | ||
) | ||
|
||
func main() { | ||
body := datadogV1.SyntheticsAPITest{ | ||
Config: datadogV1.SyntheticsAPITestConfig{ | ||
Assertions: []datadogV1.SyntheticsAssertion{ | ||
datadogV1.SyntheticsAssertion{ | ||
SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{ | ||
Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS, | ||
Property: datadog.PtrString("{{ PROPERTY }}"), | ||
Target: "text/html", | ||
Type: datadogV1.SYNTHETICSASSERTIONTYPE_HEADER, | ||
}}, | ||
datadogV1.SyntheticsAssertion{ | ||
SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{ | ||
Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_LESS_THAN, | ||
Target: 2000, | ||
Type: datadogV1.SYNTHETICSASSERTIONTYPE_RESPONSE_TIME, | ||
}}, | ||
datadogV1.SyntheticsAssertion{ | ||
SyntheticsAssertionJSONPathTarget: &datadogV1.SyntheticsAssertionJSONPathTarget{ | ||
Operator: datadogV1.SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH, | ||
Target: &datadogV1.SyntheticsAssertionJSONPathTargetTarget{ | ||
JsonPath: datadog.PtrString("topKey"), | ||
Operator: datadog.PtrString("isNot"), | ||
TargetValue: "0", | ||
}, | ||
Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY, | ||
}}, | ||
datadogV1.SyntheticsAssertion{ | ||
SyntheticsAssertionXPathTarget: &datadogV1.SyntheticsAssertionXPathTarget{ | ||
Operator: datadogV1.SYNTHETICSASSERTIONXPATHOPERATOR_VALIDATES_X_PATH, | ||
Target: &datadogV1.SyntheticsAssertionXPathTargetTarget{ | ||
XPath: datadog.PtrString("target-xpath"), | ||
TargetValue: "0", | ||
Operator: datadog.PtrString("contains"), | ||
}, | ||
Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY, | ||
}}, | ||
}, | ||
ConfigVariables: []datadogV1.SyntheticsConfigVariable{ | ||
{ | ||
Example: datadog.PtrString("content-type"), | ||
Name: "PROPERTY", | ||
Pattern: datadog.PtrString("content-type"), | ||
Type: datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT, | ||
}, | ||
}, | ||
Request: &datadogV1.SyntheticsTestRequest{ | ||
Certificate: &datadogV1.SyntheticsTestRequestCertificate{ | ||
Cert: &datadogV1.SyntheticsTestRequestCertificateItem{ | ||
Content: datadog.PtrString("cert-content"), | ||
Filename: datadog.PtrString("cert-filename"), | ||
UpdatedAt: datadog.PtrString("2020-10-16T09:23:24.857Z"), | ||
}, | ||
Key: &datadogV1.SyntheticsTestRequestCertificateItem{ | ||
Content: datadog.PtrString("key-content"), | ||
Filename: datadog.PtrString("key-filename"), | ||
UpdatedAt: datadog.PtrString("2020-10-16T09:23:24.857Z"), | ||
}, | ||
}, | ||
Headers: map[string]string{ | ||
"unique": "examplecreateanapihttpwithoauthroptestreturnsokreturnsthecreatedtestdetailsresponse", | ||
}, | ||
Method: datadogV1.HTTPMETHOD_GET.Ptr(), | ||
Timeout: datadog.PtrFloat64(10), | ||
Url: datadog.PtrString("https://datadoghq.com"), | ||
Proxy: &datadogV1.SyntheticsTestRequestProxy{ | ||
Url: "https://datadoghq.com", | ||
Headers: map[string]string{}, | ||
}, | ||
BasicAuth: &datadogV1.SyntheticsBasicAuth{ | ||
SyntheticsBasicAuthOauthROP: &datadogV1.SyntheticsBasicAuthOauthROP{ | ||
AccessTokenUrl: "https://datadog-token.com", | ||
Audience: datadog.PtrString("audience"), | ||
ClientId: datadog.PtrString("client-id"), | ||
ClientSecret: datadog.PtrString("client-secret"), | ||
Resource: datadog.PtrString("resource"), | ||
Scope: datadog.PtrString("yoyo"), | ||
TokenApiAuthentication: datadogV1.SYNTHETICSBASICAUTHOAUTHTOKENAPIAUTHENTICATION_BODY, | ||
Type: datadogV1.SYNTHETICSBASICAUTHOAUTHROPTYPE_OAUTH_ROP.Ptr(), | ||
Username: "oauth-usermame", | ||
Password: "oauth-password", | ||
}}, | ||
}, | ||
}, | ||
Locations: []string{ | ||
"aws:us-east-2", | ||
}, | ||
Message: "BDD test payload: synthetics_api_http_test_payload.json", | ||
Name: "Example-Create_an_API_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response", | ||
Options: datadogV1.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_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response"), | ||
MonitorPriority: datadog.PtrInt32(5), | ||
Retry: &datadogV1.SyntheticsTestOptionsRetry{ | ||
Count: datadog.PtrInt64(3), | ||
Interval: datadog.PtrFloat64(10), | ||
}, | ||
TickEvery: datadog.PtrInt64(60), | ||
}, | ||
Subtype: datadogV1.SYNTHETICSTESTDETAILSSUBTYPE_HTTP.Ptr(), | ||
Tags: []string{ | ||
"testing:api", | ||
}, | ||
Type: datadogV1.SYNTHETICSAPITESTTYPE_API, | ||
} | ||
ctx := datadog.NewDefaultContext(context.Background()) | ||
configuration := datadog.NewConfiguration() | ||
apiClient := datadog.NewAPIClient(configuration) | ||
api := datadogV1.NewSyntheticsApi(apiClient) | ||
resp, r, err := api.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) | ||
} |
1 change: 1 addition & 0 deletions
1
...I_HTTP_with_oauth-rop_test_returns_OK_-_Returns_the_created_test_details._response.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2022-12-07T10:36:18.554Z |
44 changes: 44 additions & 0 deletions
44
...API_HTTP_with_oauth-rop_test_returns_OK_-_Returns_the_created_test_details._response.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
interactions: | ||
- request: | ||
body: | | ||
{"config":{"assertions":[{"operator":"is","property":"{{ PROPERTY }}","target":"text/html","type":"header"},{"operator":"lessThan","target":2000,"type":"responseTime"},{"operator":"validatesJSONPath","target":{"jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"},{"operator":"validatesXPath","target":{"operator":"contains","targetValue":"0","xPath":"target-xpath"},"type":"body"}],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"basicAuth":{"accessTokenUrl":"https://datadog-token.com","audience":"audience","clientId":"client-id","clientSecret":"client-secret","password":"oauth-password","resource":"resource","scope":"yoyo","tokenApiAuthentication":"body","type":"oauth-rop","username":"oauth-usermame"},"certificate":{"cert":{"content":"cert-content","filename":"cert-filename","updatedAt":"2020-10-16T09:23:24.857Z"},"key":{"content":"key-content","filename":"key-filename","updatedAt":"2020-10-16T09:23:24.857Z"}},"headers":{"unique":"testcreateanapihttpwithoauthroptestreturnsokreturnsthecreatedtestdetailsresponse1670409378"},"method":"GET","proxy":{"headers":{},"url":"https://datadoghq.com"},"timeout":10,"url":"https://datadoghq.com"}},"locations":["aws:us-east-2"],"message":"BDD test payload: synthetics_api_http_test_payload.json","name":"Test-Create_an_API_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response-1670409378","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_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response-1670409378","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","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":"u7x-e98-98f","tags":["testing:api"],"org_id":569509,"locations":["aws:us-east-2"],"message":"BDD | ||
test payload: synthetics_api_http_test_payload.json","deleted_at":null,"name":"Test-Create_an_API_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response-1670409378","monitor_id":105046994,"type":"api","created_at":"2022-12-07T10:36:19.000736+00:00","modified_at":"2022-12-07T10:36:19.000736+00:00","subtype":"http","config":{"request":{"certificate":{"cert":{"filename":"cert-filename","updatedAt":"2020-10-16T09:23:24.857Z"},"key":{"filename":"key-filename","updatedAt":"2020-10-16T09:23:24.857Z"}},"url":"https://datadoghq.com","basicAuth":{"username":"oauth-usermame","clientSecret":"client-secret","resource":"resource","accessTokenUrl":"https://datadog-token.com","audience":"audience","clientId":"client-id","scope":"yoyo","password":"oauth-password","type":"oauth-rop","tokenApiAuthentication":"body"},"headers":{"unique":"testcreateanapihttpwithoauthroptestreturnsokreturnsthecreatedtestdetailsresponse1670409378"},"proxy":{"url":"https://datadoghq.com","headers":{}},"timeout":10,"method":"GET"},"assertions":[{"operator":"is","property":"{{ | ||
PROPERTY }}","type":"header","target":"text/html"},{"operator":"lessThan","type":"responseTime","target":2000},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"0","xPath":"target-xpath"}}],"configVariables":[{"pattern":"content-type","type":"text","example":"content-type","name":"PROPERTY"}]},"options":{"accept_self_signed":false,"retry":{"count":3,"interval":10},"min_location_failed":1,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"monitor_priority":5,"monitor_name":"Test-Create_an_API_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response-1670409378","tick_every":60}}' | ||
code: 200 | ||
duration: '' | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
- request: | ||
body: | | ||
{"public_ids":["u7x-e98-98f"]} | ||
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-12-07T10:36:19.441845+00:00","public_id":"u7x-e98-98f"}]} | ||
' | ||
code: 200 | ||
duration: '' | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.