Skip to content

Commit

Permalink
Regenerate client from commit 0f37d2e6 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Apr 22, 2024
1 parent 847438f commit 84b60da
Show file tree
Hide file tree
Showing 27 changed files with 857 additions and 367 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-04-19 20:49:39.245621",
"spec_repo_commit": "c3db9ec1"
"regenerated": "2024-04-22 11:29:42.562557",
"spec_repo_commit": "0f37d2e6"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-04-19 20:49:39.263464",
"spec_repo_commit": "c3db9ec1"
"regenerated": "2024-04-22 11:29:42.579972",
"spec_repo_commit": "0f37d2e6"
}
}
}
40 changes: 40 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13627,6 +13627,7 @@ components:
oneOf:
- $ref: '#/components/schemas/SyntheticsAssertionTarget'
- $ref: '#/components/schemas/SyntheticsAssertionJSONPathTarget'
- $ref: '#/components/schemas/SyntheticsAssertionJSONSchemaTarget'
- $ref: '#/components/schemas/SyntheticsAssertionXPathTarget'
SyntheticsAssertionJSONPathOperator:
description: Assertion operator to apply.
Expand Down Expand Up @@ -13664,6 +13665,45 @@ components:
targetValue:
description: The path target value to compare to.
type: object
SyntheticsAssertionJSONSchemaMetaSchema:
description: The JSON Schema meta-schema version used in the assertion.
enum:
- draft-07
- draft-06
type: string
x-enum-varnames:
- DRAFT_07
- DRAFT_06
SyntheticsAssertionJSONSchemaOperator:
description: Assertion operator to apply.
enum:
- validatesJSONSchema
example: validatesJSONSchema
type: string
x-enum-varnames:
- VALIDATES_JSON_SCHEMA
SyntheticsAssertionJSONSchemaTarget:
description: An assertion for the `validatesJSONSchema` operator.
properties:
operator:
$ref: '#/components/schemas/SyntheticsAssertionJSONSchemaOperator'
target:
$ref: '#/components/schemas/SyntheticsAssertionJSONSchemaTargetTarget'
type:
$ref: '#/components/schemas/SyntheticsAssertionType'
required:
- type
- operator
type: object
SyntheticsAssertionJSONSchemaTargetTarget:
description: Composed target for `validatesJSONSchema` operator.
properties:
jsonSchema:
description: The JSON Schema to assert.
type: string
metaSchema:
$ref: '#/components/schemas/SyntheticsAssertionJSONSchemaMetaSchema'
type: object
SyntheticsAssertionOperator:
description: Assertion operator to apply.
enum:
Expand Down
252 changes: 137 additions & 115 deletions examples/v1_synthetics_create_synthetics_api_test_1487281163.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ use datadog_api_client::datadogV1::model::SyntheticsAssertion;
use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONPathOperator;
use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONPathTarget;
use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONPathTargetTarget;
use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONSchemaMetaSchema;
use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONSchemaOperator;
use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONSchemaTarget;
use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONSchemaTargetTarget;
use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator;
use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget;
use datadog_api_client::datadogV1::model::SyntheticsAssertionTimingsScope;
Expand All @@ -35,123 +39,141 @@ use std::collections::BTreeMap;

#[tokio::main]
async fn main() {
let body = SyntheticsAPITest::new(
SyntheticsAPITestConfig::new()
.assertions(vec![
SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
SyntheticsAssertionTarget::new(
SyntheticsAssertionOperator::IS,
Value::from("text/html"),
SyntheticsAssertionType::HEADER,
)
.property("{{ PROPERTY }}".to_string()),
)),
SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
SyntheticsAssertionTarget::new(
SyntheticsAssertionOperator::LESS_THAN,
Value::from(2000),
SyntheticsAssertionType::RESPONSE_TIME,
)
.timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS),
)),
SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(Box::new(
SyntheticsAssertionJSONPathTarget::new(
SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
SyntheticsAssertionType::BODY,
)
.target(
SyntheticsAssertionJSONPathTargetTarget::new()
.json_path("topKey".to_string())
.operator("isNot".to_string())
.target_value(Value::from("0")),
),
)),
SyntheticsAssertion::SyntheticsAssertionXPathTarget(Box::new(
SyntheticsAssertionXPathTarget::new(
SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
SyntheticsAssertionType::BODY,
)
.target(
SyntheticsAssertionXPathTargetTarget::new()
.operator("contains".to_string())
.target_value(Value::from("0"))
.x_path("target-xpath".to_string()),
),
)),
])
.config_variables(vec![SyntheticsConfigVariable::new(
"PROPERTY".to_string(),
SyntheticsConfigVariableType::TEXT,
)
.example("content-type".to_string())
.pattern("content-type".to_string())])
.request(
SyntheticsTestRequest::new()
.basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
Box::new(
SyntheticsBasicAuthOauthClient::new(
"https://datadog-token.com".to_string(),
"client-id".to_string(),
"client-secret".to_string(),
SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
)
.audience("audience".to_string())
.resource("resource".to_string())
.scope("yoyo".to_string())
.type_(SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT),
let body =
SyntheticsAPITest::new(
SyntheticsAPITestConfig::new()
.assertions(
vec![
SyntheticsAssertion::SyntheticsAssertionTarget(
Box::new(
SyntheticsAssertionTarget::new(
SyntheticsAssertionOperator::IS,
Value::from("text/html"),
SyntheticsAssertionType::HEADER,
).property("{{ PROPERTY }}".to_string()),
),
),
SyntheticsAssertion::SyntheticsAssertionTarget(
Box::new(
SyntheticsAssertionTarget::new(
SyntheticsAssertionOperator::LESS_THAN,
Value::from(2000),
SyntheticsAssertionType::RESPONSE_TIME,
).timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS),
),
),
SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(
Box::new(
SyntheticsAssertionJSONPathTarget::new(
SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
SyntheticsAssertionType::BODY,
).target(
SyntheticsAssertionJSONPathTargetTarget::new()
.json_path("topKey".to_string())
.operator("isNot".to_string())
.target_value(Value::from("0")),
),
),
),
SyntheticsAssertion::SyntheticsAssertionJSONSchemaTarget(
Box::new(
SyntheticsAssertionJSONSchemaTarget::new(
SyntheticsAssertionJSONSchemaOperator::VALIDATES_JSON_SCHEMA,
SyntheticsAssertionType::BODY,
).target(
SyntheticsAssertionJSONSchemaTargetTarget::new()
.json_schema(
r#"{"type": "object", "properties":{"slideshow":{"type":"object"}}}"#.to_string(),
)
.meta_schema(SyntheticsAssertionJSONSchemaMetaSchema::DRAFT_07),
),
),
),
))
.certificate(
SyntheticsTestRequestCertificate::new()
.cert(
SyntheticsTestRequestCertificateItem::new()
.content("cert-content".to_string())
.filename("cert-filename".to_string())
.updated_at("2020-10-16T09:23:24.857Z".to_string()),
)
.key(
SyntheticsTestRequestCertificateItem::new()
.content("key-content".to_string())
.filename("key-filename".to_string())
.updated_at("2020-10-16T09:23:24.857Z".to_string()),
SyntheticsAssertion::SyntheticsAssertionXPathTarget(
Box::new(
SyntheticsAssertionXPathTarget::new(
SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
SyntheticsAssertionType::BODY,
).target(
SyntheticsAssertionXPathTargetTarget::new()
.operator("contains".to_string())
.target_value(Value::from("0"))
.x_path("target-xpath".to_string()),
),
),
)
],
)
.config_variables(
vec![
SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
.example("content-type".to_string())
.pattern("content-type".to_string())
],
)
.request(
SyntheticsTestRequest::new()
.basic_auth(
SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
Box::new(
SyntheticsBasicAuthOauthClient::new(
"https://datadog-token.com".to_string(),
"client-id".to_string(),
"client-secret".to_string(),
SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
)
.audience("audience".to_string())
.resource("resource".to_string())
.scope("yoyo".to_string())
.type_(SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT),
),
),
)
.headers(BTreeMap::from([(
"unique".to_string(),
"examplesynthetic".to_string(),
)]))
.method("GET".to_string())
.persist_cookies(true)
.proxy(
SyntheticsTestRequestProxy::new("https://datadoghq.com".to_string())
.headers(BTreeMap::from([])),
)
.timeout(10.0 as f64)
.url("https://datadoghq.com".to_string()),
)
.variables_from_script(r#"dd.variable.set("FOO", "foo")"#.to_string()),
vec!["aws:us-east-2".to_string()],
"BDD test payload: synthetics_api_http_test_payload.json".to_string(),
"Example-Synthetic".to_string(),
SyntheticsTestOptions::new()
.accept_self_signed(false)
.allow_insecure(true)
.follow_redirects(true)
.http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
.min_failure_duration(10)
.min_location_failed(1)
.monitor_name("Example-Synthetic".to_string())
.monitor_priority(5)
.retry(
SyntheticsTestOptionsRetry::new()
.count(3)
.interval(10.0 as f64),
)
.tick_every(60),
SyntheticsAPITestType::API,
)
.subtype(SyntheticsTestDetailsSubType::HTTP)
.tags(vec!["testing:api".to_string()]);
)
.certificate(
SyntheticsTestRequestCertificate::new()
.cert(
SyntheticsTestRequestCertificateItem::new()
.content("cert-content".to_string())
.filename("cert-filename".to_string())
.updated_at("2020-10-16T09:23:24.857Z".to_string()),
)
.key(
SyntheticsTestRequestCertificateItem::new()
.content("key-content".to_string())
.filename("key-filename".to_string())
.updated_at("2020-10-16T09:23:24.857Z".to_string()),
),
)
.headers(BTreeMap::from([("unique".to_string(), "examplesynthetic".to_string())]))
.method("GET".to_string())
.persist_cookies(true)
.proxy(
SyntheticsTestRequestProxy::new(
"https://datadoghq.com".to_string(),
).headers(BTreeMap::from([])),
)
.timeout(10.0 as f64)
.url("https://datadoghq.com".to_string()),
)
.variables_from_script(r#"dd.variable.set("FOO", "foo")"#.to_string()),
vec!["aws:us-east-2".to_string()],
"BDD test payload: synthetics_api_http_test_payload.json".to_string(),
"Example-Synthetic".to_string(),
SyntheticsTestOptions::new()
.accept_self_signed(false)
.allow_insecure(true)
.follow_redirects(true)
.http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
.min_failure_duration(10)
.min_location_failed(1)
.monitor_name("Example-Synthetic".to_string())
.monitor_priority(5)
.retry(SyntheticsTestOptionsRetry::new().count(3).interval(10.0 as f64))
.tick_every(60),
SyntheticsAPITestType::API,
)
.subtype(SyntheticsTestDetailsSubType::HTTP)
.tags(vec!["testing:api".to_string()]);
let configuration = datadog::Configuration::new();
let api = SyntheticsAPI::with_config(configuration);
let resp = api.create_synthetics_api_test(body).await;
Expand Down
Loading

0 comments on commit 84b60da

Please sign in to comment.