Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17420,6 +17420,16 @@ components:
Must have HTTPS scheme and forwarding back to Datadog is not allowed.
example: https://example.com
type: string
sourcetype:
description: |-
The Splunk sourcetype for the events sent to this Splunk destination.

If absent, the default sourcetype `_json` is used. If set to null, the `sourcetype`
field is omitted from the Splunk HEC payload entirely. Otherwise, the provided string
value is used as the sourcetype.
example: my-source
nullable: true
type: string
type:
$ref: "#/components/schemas/CustomDestinationForwardDestinationSplunkType"
required:
Expand Down Expand Up @@ -17695,6 +17705,16 @@ components:
Must have HTTPS scheme and forwarding back to Datadog is not allowed.
example: https://example.com
type: string
sourcetype:
description: |-
The Splunk sourcetype for the events sent to this Splunk destination.

If absent, the default sourcetype `_json` is used. If set to null, the `sourcetype`
field is omitted from the Splunk HEC payload entirely. Otherwise, the provided string
value is used as the sourcetype.
example: my-source
nullable: true
type: string
type:
$ref: "#/components/schemas/CustomDestinationResponseForwardDestinationSplunkType"
required:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Create a Splunk custom destination with a sourcetype returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
use datadog_api_client::datadogV2::model::CustomDestinationType;

#[tokio::main]
async fn main() {
let body =
CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new(
CustomDestinationCreateRequestAttributes::new(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
Box::new(
CustomDestinationForwardDestinationSplunk::new(
"my-access-token".to_string(),
"https://example.com".to_string(),
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
)
.sourcetype(Some("my-sourcetype".to_string())),
),
),
"Nginx logs".to_string(),
)
.enabled(false)
.forward_tags(false)
.query("source:nginx".to_string()),
CustomDestinationType::CUSTOM_DESTINATION,
));
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api.create_logs_custom_destination(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Create a Splunk custom destination without a sourcetype returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
use datadog_api_client::datadogV2::model::CustomDestinationType;

#[tokio::main]
async fn main() {
let body =
CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new(
CustomDestinationCreateRequestAttributes::new(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
Box::new(CustomDestinationForwardDestinationSplunk::new(
"my-access-token".to_string(),
"https://example.com".to_string(),
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
)),
),
"Nginx logs".to_string(),
)
.enabled(false)
.forward_tags(false)
.query("source:nginx".to_string()),
CustomDestinationType::CUSTOM_DESTINATION,
));
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api.create_logs_custom_destination(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Create a Splunk custom destination with a null sourcetype returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
use datadog_api_client::datadogV2::model::CustomDestinationType;

#[tokio::main]
async fn main() {
let body =
CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new(
CustomDestinationCreateRequestAttributes::new(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
Box::new(
CustomDestinationForwardDestinationSplunk::new(
"my-access-token".to_string(),
"https://example.com".to_string(),
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
)
.sourcetype(None),
),
),
"Nginx logs".to_string(),
)
.enabled(false)
.forward_tags(false)
.query("source:nginx".to_string()),
CustomDestinationType::CUSTOM_DESTINATION,
));
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api.create_logs_custom_destination(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Create a Splunk custom destination with an empty string sourcetype returns "OK"
// response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes;
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
use datadog_api_client::datadogV2::model::CustomDestinationType;

#[tokio::main]
async fn main() {
let body =
CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new(
CustomDestinationCreateRequestAttributes::new(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
Box::new(
CustomDestinationForwardDestinationSplunk::new(
"my-access-token".to_string(),
"https://example.com".to_string(),
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
)
.sourcetype(Some("".to_string())),
),
),
"Nginx logs".to_string(),
)
.enabled(false)
.forward_tags(false)
.query("source:nginx".to_string()),
CustomDestinationType::CUSTOM_DESTINATION,
));
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api.create_logs_custom_destination(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Update a Splunk custom destination's destination preserves the null sourcetype
// returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
use datadog_api_client::datadogV2::model::CustomDestinationType;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition;

#[tokio::main]
async fn main() {
// there is a valid "custom_destination_splunk_with_null_sourcetype" in the system
let custom_destination_splunk_with_null_sourcetype_data_id =
std::env::var("CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID").unwrap();
let body = CustomDestinationUpdateRequest::new().data(
CustomDestinationUpdateRequestDefinition::new(
custom_destination_splunk_with_null_sourcetype_data_id.clone(),
CustomDestinationType::CUSTOM_DESTINATION,
)
.attributes(
CustomDestinationUpdateRequestAttributes::new().forwarder_destination(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
Box::new(CustomDestinationForwardDestinationSplunk::new(
"my-access-token".to_string(),
"https://updated-example.com".to_string(),
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
)),
),
),
),
);
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api
.update_logs_custom_destination(
custom_destination_splunk_with_null_sourcetype_data_id.clone(),
body,
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Update a Splunk custom destination with a sourcetype returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
use datadog_api_client::datadogV2::model::CustomDestinationType;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition;

#[tokio::main]
async fn main() {
// there is a valid "custom_destination_splunk" in the system
let custom_destination_splunk_data_id =
std::env::var("CUSTOM_DESTINATION_SPLUNK_DATA_ID").unwrap();
let body = CustomDestinationUpdateRequest::new().data(
CustomDestinationUpdateRequestDefinition::new(
custom_destination_splunk_data_id.clone(),
CustomDestinationType::CUSTOM_DESTINATION,
)
.attributes(
CustomDestinationUpdateRequestAttributes::new().forwarder_destination(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
Box::new(
CustomDestinationForwardDestinationSplunk::new(
"my-access-token".to_string(),
"https://example.com".to_string(),
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
)
.sourcetype(Some("new-sourcetype".to_string())),
),
),
),
),
);
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api
.update_logs_custom_destination(custom_destination_splunk_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Update a Splunk custom destination with a null sourcetype returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk;
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType;
use datadog_api_client::datadogV2::model::CustomDestinationType;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition;

#[tokio::main]
async fn main() {
// there is a valid "custom_destination_splunk_with_sourcetype" in the system
let custom_destination_splunk_with_sourcetype_data_id =
std::env::var("CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID").unwrap();
let body = CustomDestinationUpdateRequest::new().data(
CustomDestinationUpdateRequestDefinition::new(
custom_destination_splunk_with_sourcetype_data_id.clone(),
CustomDestinationType::CUSTOM_DESTINATION,
)
.attributes(
CustomDestinationUpdateRequestAttributes::new().forwarder_destination(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk(
Box::new(
CustomDestinationForwardDestinationSplunk::new(
"my-access-token".to_string(),
"https://example.com".to_string(),
CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC,
)
.sourcetype(None),
),
),
),
),
);
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api
.update_logs_custom_destination(
custom_destination_splunk_with_sourcetype_data_id.clone(),
body,
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Update a Splunk custom destination's attributes preserves the absent sourcetype
// returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
use datadog_api_client::datadogV2::model::CustomDestinationType;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes;
use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition;

#[tokio::main]
async fn main() {
// there is a valid "custom_destination_splunk" in the system
let custom_destination_splunk_data_id =
std::env::var("CUSTOM_DESTINATION_SPLUNK_DATA_ID").unwrap();
let body = CustomDestinationUpdateRequest::new().data(
CustomDestinationUpdateRequestDefinition::new(
custom_destination_splunk_data_id.clone(),
CustomDestinationType::CUSTOM_DESTINATION,
)
.attributes(
CustomDestinationUpdateRequestAttributes::new()
.name("Nginx logs (Updated)".to_string()),
),
);
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api
.update_logs_custom_destination(custom_destination_splunk_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Loading
Loading