Skip to content

Commit 4bb7da8

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 89aa4b5 of spec repo
1 parent 6becc78 commit 4bb7da8

File tree

34 files changed

+1450
-0
lines changed

34 files changed

+1450
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17412,6 +17412,16 @@ components:
1741217412
Must have HTTPS scheme and forwarding back to Datadog is not allowed.
1741317413
example: https://example.com
1741417414
type: string
17415+
sourcetype:
17416+
description: |-
17417+
The Splunk sourcetype for the events sent to this Splunk destination.
17418+
17419+
If absent, the default sourcetype `_json` is used. If set to `null`, the `sourcetype`
17420+
field is omitted from the Splunk HEC payload entirely. Otherwise, the provided string
17421+
value is used as the sourcetype.
17422+
example: my-source
17423+
nullable: true
17424+
type: string
1741517425
type:
1741617426
$ref: "#/components/schemas/CustomDestinationForwardDestinationSplunkType"
1741717427
required:
@@ -17687,6 +17697,16 @@ components:
1768717697
Must have HTTPS scheme and forwarding back to Datadog is not allowed.
1768817698
example: https://example.com
1768917699
type: string
17700+
sourcetype:
17701+
description: |-
17702+
The Splunk sourcetype for the events sent to this Splunk destination.
17703+
17704+
If absent, the default sourcetype `_json` is used. If set to `null`, the `sourcetype`
17705+
field is omitted from the Splunk HEC payload entirely. Otherwise, the provided string
17706+
value is used as the sourcetype.
17707+
example: my-source
17708+
nullable: true
17709+
type: string
1769017710
type:
1769117711
$ref: "#/components/schemas/CustomDestinationResponseForwardDestinationSplunkType"
1769217712
required:
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Create a Splunk custom destination with a sourcetype returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
4+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest;
5+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes;
6+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition;
7+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
8+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
9+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
10+
use datadog_api_client::datadogV2::model::CustomDestinationType;
11+
12+
#[tokio::main]
13+
async fn main() {
14+
let body =
15+
CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new(
16+
CustomDestinationCreateRequestAttributes::new(
17+
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
18+
Box::new(
19+
CustomDestinationForwardDestinationSplunk::new(
20+
"my-access-token".to_string(),
21+
"https://example.com".to_string(),
22+
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
23+
)
24+
.sourcetype(Some("my-sourcetype".to_string())),
25+
),
26+
),
27+
"Nginx logs".to_string(),
28+
)
29+
.enabled(false)
30+
.forward_tags(false)
31+
.query("source:nginx".to_string()),
32+
CustomDestinationType::CUSTOM_DESTINATION,
33+
));
34+
let configuration = datadog::Configuration::new();
35+
let api = LogsCustomDestinationsAPI::with_config(configuration);
36+
let resp = api.create_logs_custom_destination(body).await;
37+
if let Ok(value) = resp {
38+
println!("{:#?}", value);
39+
} else {
40+
println!("{:#?}", resp.unwrap_err());
41+
}
42+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Create a Splunk custom destination without a sourcetype returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
4+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest;
5+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes;
6+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition;
7+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
8+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
9+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
10+
use datadog_api_client::datadogV2::model::CustomDestinationType;
11+
12+
#[tokio::main]
13+
async fn main() {
14+
let body =
15+
CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new(
16+
CustomDestinationCreateRequestAttributes::new(
17+
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
18+
Box::new(CustomDestinationForwardDestinationSplunk::new(
19+
"my-access-token".to_string(),
20+
"https://example.com".to_string(),
21+
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
22+
)),
23+
),
24+
"Nginx logs".to_string(),
25+
)
26+
.enabled(false)
27+
.forward_tags(false)
28+
.query("source:nginx".to_string()),
29+
CustomDestinationType::CUSTOM_DESTINATION,
30+
));
31+
let configuration = datadog::Configuration::new();
32+
let api = LogsCustomDestinationsAPI::with_config(configuration);
33+
let resp = api.create_logs_custom_destination(body).await;
34+
if let Ok(value) = resp {
35+
println!("{:#?}", value);
36+
} else {
37+
println!("{:#?}", resp.unwrap_err());
38+
}
39+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Create a Splunk custom destination with a null sourcetype returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
4+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest;
5+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes;
6+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition;
7+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
8+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
9+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
10+
use datadog_api_client::datadogV2::model::CustomDestinationType;
11+
12+
#[tokio::main]
13+
async fn main() {
14+
let body =
15+
CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new(
16+
CustomDestinationCreateRequestAttributes::new(
17+
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
18+
Box::new(
19+
CustomDestinationForwardDestinationSplunk::new(
20+
"my-access-token".to_string(),
21+
"https://example.com".to_string(),
22+
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
23+
)
24+
.sourcetype(None),
25+
),
26+
),
27+
"Nginx logs".to_string(),
28+
)
29+
.enabled(false)
30+
.forward_tags(false)
31+
.query("source:nginx".to_string()),
32+
CustomDestinationType::CUSTOM_DESTINATION,
33+
));
34+
let configuration = datadog::Configuration::new();
35+
let api = LogsCustomDestinationsAPI::with_config(configuration);
36+
let resp = api.create_logs_custom_destination(body).await;
37+
if let Ok(value) = resp {
38+
println!("{:#?}", value);
39+
} else {
40+
println!("{:#?}", resp.unwrap_err());
41+
}
42+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Create a Splunk custom destination with an empty string sourcetype returns "OK"
2+
// response
3+
use datadog_api_client::datadog;
4+
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
5+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest;
6+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes;
7+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition;
8+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
9+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
10+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
11+
use datadog_api_client::datadogV2::model::CustomDestinationType;
12+
13+
#[tokio::main]
14+
async fn main() {
15+
let body =
16+
CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new(
17+
CustomDestinationCreateRequestAttributes::new(
18+
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
19+
Box::new(
20+
CustomDestinationForwardDestinationSplunk::new(
21+
"my-access-token".to_string(),
22+
"https://example.com".to_string(),
23+
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
24+
)
25+
.sourcetype(Some("".to_string())),
26+
),
27+
),
28+
"Nginx logs".to_string(),
29+
)
30+
.enabled(false)
31+
.forward_tags(false)
32+
.query("source:nginx".to_string()),
33+
CustomDestinationType::CUSTOM_DESTINATION,
34+
));
35+
let configuration = datadog::Configuration::new();
36+
let api = LogsCustomDestinationsAPI::with_config(configuration);
37+
let resp = api.create_logs_custom_destination(body).await;
38+
if let Ok(value) = resp {
39+
println!("{:#?}", value);
40+
} else {
41+
println!("{:#?}", resp.unwrap_err());
42+
}
43+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Update a Splunk custom destination's destination preserves the null sourcetype
2+
// returns "OK" response
3+
use datadog_api_client::datadog;
4+
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
5+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
6+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
7+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
8+
use datadog_api_client::datadogV2::model::CustomDestinationType;
9+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest;
10+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes;
11+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition;
12+
13+
#[tokio::main]
14+
async fn main() {
15+
// there is a valid "custom_destination_splunk_with_null_sourcetype" in the system
16+
let custom_destination_splunk_with_null_sourcetype_data_id =
17+
std::env::var("CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID").unwrap();
18+
let body = CustomDestinationUpdateRequest::new().data(
19+
CustomDestinationUpdateRequestDefinition::new(
20+
custom_destination_splunk_with_null_sourcetype_data_id.clone(),
21+
CustomDestinationType::CUSTOM_DESTINATION,
22+
)
23+
.attributes(
24+
CustomDestinationUpdateRequestAttributes::new().forwarder_destination(
25+
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
26+
Box::new(CustomDestinationForwardDestinationSplunk::new(
27+
"my-access-token".to_string(),
28+
"https://updated-example.com".to_string(),
29+
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
30+
)),
31+
),
32+
),
33+
),
34+
);
35+
let configuration = datadog::Configuration::new();
36+
let api = LogsCustomDestinationsAPI::with_config(configuration);
37+
let resp = api
38+
.update_logs_custom_destination(
39+
custom_destination_splunk_with_null_sourcetype_data_id.clone(),
40+
body,
41+
)
42+
.await;
43+
if let Ok(value) = resp {
44+
println!("{:#?}", value);
45+
} else {
46+
println!("{:#?}", resp.unwrap_err());
47+
}
48+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Update a Splunk custom destination with a sourcetype returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
4+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
5+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
6+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
7+
use datadog_api_client::datadogV2::model::CustomDestinationType;
8+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest;
9+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes;
10+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition;
11+
12+
#[tokio::main]
13+
async fn main() {
14+
// there is a valid "custom_destination_splunk" in the system
15+
let custom_destination_splunk_data_id =
16+
std::env::var("CUSTOM_DESTINATION_SPLUNK_DATA_ID").unwrap();
17+
let body = CustomDestinationUpdateRequest::new().data(
18+
CustomDestinationUpdateRequestDefinition::new(
19+
custom_destination_splunk_data_id.clone(),
20+
CustomDestinationType::CUSTOM_DESTINATION,
21+
)
22+
.attributes(
23+
CustomDestinationUpdateRequestAttributes::new().forwarder_destination(
24+
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
25+
Box::new(
26+
CustomDestinationForwardDestinationSplunk::new(
27+
"my-access-token".to_string(),
28+
"https://example.com".to_string(),
29+
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
30+
)
31+
.sourcetype(Some("new-sourcetype".to_string())),
32+
),
33+
),
34+
),
35+
),
36+
);
37+
let configuration = datadog::Configuration::new();
38+
let api = LogsCustomDestinationsAPI::with_config(configuration);
39+
let resp = api
40+
.update_logs_custom_destination(custom_destination_splunk_data_id.clone(), body)
41+
.await;
42+
if let Ok(value) = resp {
43+
println!("{:#?}", value);
44+
} else {
45+
println!("{:#?}", resp.unwrap_err());
46+
}
47+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Update a Splunk custom destination with a null sourcetype returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
4+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
5+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
6+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
7+
use datadog_api_client::datadogV2::model::CustomDestinationType;
8+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest;
9+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes;
10+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition;
11+
12+
#[tokio::main]
13+
async fn main() {
14+
// there is a valid "custom_destination_splunk_with_sourcetype" in the system
15+
let custom_destination_splunk_with_sourcetype_data_id =
16+
std::env::var("CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID").unwrap();
17+
let body = CustomDestinationUpdateRequest::new().data(
18+
CustomDestinationUpdateRequestDefinition::new(
19+
custom_destination_splunk_with_sourcetype_data_id.clone(),
20+
CustomDestinationType::CUSTOM_DESTINATION,
21+
)
22+
.attributes(
23+
CustomDestinationUpdateRequestAttributes::new().forwarder_destination(
24+
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
25+
Box::new(
26+
CustomDestinationForwardDestinationSplunk::new(
27+
"my-access-token".to_string(),
28+
"https://example.com".to_string(),
29+
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
30+
)
31+
.sourcetype(None),
32+
),
33+
),
34+
),
35+
),
36+
);
37+
let configuration = datadog::Configuration::new();
38+
let api = LogsCustomDestinationsAPI::with_config(configuration);
39+
let resp = api
40+
.update_logs_custom_destination(
41+
custom_destination_splunk_with_sourcetype_data_id.clone(),
42+
body,
43+
)
44+
.await;
45+
if let Ok(value) = resp {
46+
println!("{:#?}", value);
47+
} else {
48+
println!("{:#?}", resp.unwrap_err());
49+
}
50+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Update a Splunk custom destination's attributes preserves the absent sourcetype
2+
// returns "OK" response
3+
use datadog_api_client::datadog;
4+
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
5+
use datadog_api_client::datadogV2::model::CustomDestinationType;
6+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest;
7+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes;
8+
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition;
9+
10+
#[tokio::main]
11+
async fn main() {
12+
// there is a valid "custom_destination_splunk" in the system
13+
let custom_destination_splunk_data_id =
14+
std::env::var("CUSTOM_DESTINATION_SPLUNK_DATA_ID").unwrap();
15+
let body = CustomDestinationUpdateRequest::new().data(
16+
CustomDestinationUpdateRequestDefinition::new(
17+
custom_destination_splunk_data_id.clone(),
18+
CustomDestinationType::CUSTOM_DESTINATION,
19+
)
20+
.attributes(
21+
CustomDestinationUpdateRequestAttributes::new()
22+
.name("Nginx logs (Updated)".to_string()),
23+
),
24+
);
25+
let configuration = datadog::Configuration::new();
26+
let api = LogsCustomDestinationsAPI::with_config(configuration);
27+
let resp = api
28+
.update_logs_custom_destination(custom_destination_splunk_data_id.clone(), body)
29+
.await;
30+
if let Ok(value) = resp {
31+
println!("{:#?}", value);
32+
} else {
33+
println!("{:#?}", resp.unwrap_err());
34+
}
35+
}

0 commit comments

Comments
 (0)