Struct datadog_api_client::datadogV2::api::api_logs_custom_destinations::LogsCustomDestinationsAPI
source · pub struct LogsCustomDestinationsAPI { /* private fields */ }Expand description
Custom Destinations forward all the logs ingested to an external destination.
Note: Log forwarding is not available for the Government (US1-FED) site. Contact your account representative for more information.
See the Custom Destinations Page for a list of the custom destinations currently configured in web UI.
Implementations§
source§impl LogsCustomDestinationsAPI
impl LogsCustomDestinationsAPI
pub fn new() -> Self
sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
More examples
6 7 8 9 10 11 12 13 14 15 16 17 18 19
async fn main() {
// there is a valid "custom_destination" in the system
let custom_destination_data_id = std::env::var("CUSTOM_DESTINATION_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api
.get_logs_custom_destination(custom_destination_data_id.clone())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}6 7 8 9 10 11 12 13 14 15 16 17 18 19
async fn main() {
// there is a valid "custom_destination" in the system
let custom_destination_data_id = std::env::var("CUSTOM_DESTINATION_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api
.delete_logs_custom_destination(custom_destination_data_id.clone())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
async fn main() {
// there is a valid "custom_destination" in the system
let custom_destination_data_id = std::env::var("CUSTOM_DESTINATION_DATA_ID").unwrap();
let body = CustomDestinationUpdateRequest::new().data(
CustomDestinationUpdateRequestDefinition::new(
custom_destination_data_id.clone(),
CustomDestinationType::CUSTOM_DESTINATION,
)
.attributes(
CustomDestinationUpdateRequestAttributes::new()
.enabled(false)
.forward_tags(false)
.forward_tags_restriction_list_type(
CustomDestinationAttributeTagsRestrictionListType::BLOCK_LIST,
)
.name("Nginx logs (Updated)".to_string())
.query("source:nginx".to_string()),
),
);
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api
.update_logs_custom_destination(custom_destination_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
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)
.forward_tags_restriction_list(vec!["datacenter".to_string(), "host".to_string()])
.forward_tags_restriction_list_type(
CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST,
)
.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());
}
}15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
async fn main() {
let body = CustomDestinationCreateRequest::new()
.data(CustomDestinationCreateRequestDefinition::new(
CustomDestinationCreateRequestAttributes::new(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationElasticsearch(
Box::new(
CustomDestinationForwardDestinationElasticsearch::new(
CustomDestinationElasticsearchDestinationAuth::new(
"my-password".to_string(),
"my-username".to_string(),
),
"https://example.com".to_string(),
"nginx-logs".to_string(),
CustomDestinationForwardDestinationElasticsearchType::ELASTICSEARCH,
)
.index_rotation("yyyy-MM-dd".to_string()),
),
),
"Nginx logs".to_string(),
)
.enabled(false)
.forward_tags(false)
.forward_tags_restriction_list(vec!["datacenter".to_string(), "host".to_string()])
.forward_tags_restriction_list_type(
CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST,
)
.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());
}
}pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
sourcepub async fn create_logs_custom_destination(
&self,
body: CustomDestinationCreateRequest,
) -> Result<CustomDestinationResponse, Error<CreateLogsCustomDestinationError>>
pub async fn create_logs_custom_destination( &self, body: CustomDestinationCreateRequest, ) -> Result<CustomDestinationResponse, Error<CreateLogsCustomDestinationError>>
Create a custom destination in your organization.
Examples found in repository?
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
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)
.forward_tags_restriction_list(vec!["datacenter".to_string(), "host".to_string()])
.forward_tags_restriction_list_type(
CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST,
)
.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());
}
}More examples
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
async fn main() {
let body = CustomDestinationCreateRequest::new()
.data(CustomDestinationCreateRequestDefinition::new(
CustomDestinationCreateRequestAttributes::new(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationElasticsearch(
Box::new(
CustomDestinationForwardDestinationElasticsearch::new(
CustomDestinationElasticsearchDestinationAuth::new(
"my-password".to_string(),
"my-username".to_string(),
),
"https://example.com".to_string(),
"nginx-logs".to_string(),
CustomDestinationForwardDestinationElasticsearchType::ELASTICSEARCH,
)
.index_rotation("yyyy-MM-dd".to_string()),
),
),
"Nginx logs".to_string(),
)
.enabled(false)
.forward_tags(false)
.forward_tags_restriction_list(vec!["datacenter".to_string(), "host".to_string()])
.forward_tags_restriction_list_type(
CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST,
)
.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());
}
}17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
async fn main() {
let body = CustomDestinationCreateRequest::new()
.data(CustomDestinationCreateRequestDefinition::new(
CustomDestinationCreateRequestAttributes::new(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationHttp(Box::new(
CustomDestinationForwardDestinationHttp::new(
CustomDestinationHttpDestinationAuth::CustomDestinationHttpDestinationAuthBasic(
Box::new(CustomDestinationHttpDestinationAuthBasic::new(
"datadog-custom-destination-password".to_string(),
CustomDestinationHttpDestinationAuthBasicType::BASIC,
"datadog-custom-destination-username".to_string(),
)),
),
"https://example.com".to_string(),
CustomDestinationForwardDestinationHttpType::HTTP,
),
)),
"Nginx logs".to_string(),
)
.enabled(true)
.forward_tags(true)
.forward_tags_restriction_list(vec!["datacenter".to_string(), "host".to_string()])
.forward_tags_restriction_list_type(
CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST,
)
.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());
}
}17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
async fn main() {
let body = CustomDestinationCreateRequest::new()
.data(CustomDestinationCreateRequestDefinition::new(
CustomDestinationCreateRequestAttributes::new(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationHttp(Box::new(
CustomDestinationForwardDestinationHttp::new(
CustomDestinationHttpDestinationAuth::CustomDestinationHttpDestinationAuthBasic(
Box::new(CustomDestinationHttpDestinationAuthBasic::new(
"datadog-custom-destination-password".to_string(),
CustomDestinationHttpDestinationAuthBasicType::BASIC,
"datadog-custom-destination-username".to_string(),
)),
),
"https://example.com".to_string(),
CustomDestinationForwardDestinationHttpType::HTTP,
),
)),
"Nginx logs".to_string(),
)
.enabled(false)
.forward_tags(false)
.forward_tags_restriction_list(vec!["datacenter".to_string(), "host".to_string()])
.forward_tags_restriction_list_type(
CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST,
)
.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());
}
}17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
async fn main() {
let body =
CustomDestinationCreateRequest
::new().data(
CustomDestinationCreateRequestDefinition::new(
CustomDestinationCreateRequestAttributes::new(
CustomDestinationForwardDestination::CustomDestinationForwardDestinationHttp(
Box::new(
CustomDestinationForwardDestinationHttp::new(
CustomDestinationHttpDestinationAuth::CustomDestinationHttpDestinationAuthCustomHeader(
Box::new(
CustomDestinationHttpDestinationAuthCustomHeader::new(
"MY-AUTHENTICATION-HEADER".to_string(),
"my-secret".to_string(),
CustomDestinationHttpDestinationAuthCustomHeaderType::CUSTOM_HEADER,
),
),
),
"https://example.com".to_string(),
CustomDestinationForwardDestinationHttpType::HTTP,
),
),
),
"Nginx logs".to_string(),
)
.enabled(false)
.forward_tags(false)
.forward_tags_restriction_list(vec!["datacenter".to_string(), "host".to_string()])
.forward_tags_restriction_list_type(CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST)
.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());
}
}sourcepub async fn create_logs_custom_destination_with_http_info(
&self,
body: CustomDestinationCreateRequest,
) -> Result<ResponseContent<CustomDestinationResponse>, Error<CreateLogsCustomDestinationError>>
pub async fn create_logs_custom_destination_with_http_info( &self, body: CustomDestinationCreateRequest, ) -> Result<ResponseContent<CustomDestinationResponse>, Error<CreateLogsCustomDestinationError>>
Create a custom destination in your organization.
sourcepub async fn delete_logs_custom_destination(
&self,
custom_destination_id: String,
) -> Result<(), Error<DeleteLogsCustomDestinationError>>
pub async fn delete_logs_custom_destination( &self, custom_destination_id: String, ) -> Result<(), Error<DeleteLogsCustomDestinationError>>
Delete a specific custom destination in your organization.
Examples found in repository?
6 7 8 9 10 11 12 13 14 15 16 17 18 19
async fn main() {
// there is a valid "custom_destination" in the system
let custom_destination_data_id = std::env::var("CUSTOM_DESTINATION_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api
.delete_logs_custom_destination(custom_destination_data_id.clone())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn delete_logs_custom_destination_with_http_info(
&self,
custom_destination_id: String,
) -> Result<ResponseContent<()>, Error<DeleteLogsCustomDestinationError>>
pub async fn delete_logs_custom_destination_with_http_info( &self, custom_destination_id: String, ) -> Result<ResponseContent<()>, Error<DeleteLogsCustomDestinationError>>
Delete a specific custom destination in your organization.
sourcepub async fn get_logs_custom_destination(
&self,
custom_destination_id: String,
) -> Result<CustomDestinationResponse, Error<GetLogsCustomDestinationError>>
pub async fn get_logs_custom_destination( &self, custom_destination_id: String, ) -> Result<CustomDestinationResponse, Error<GetLogsCustomDestinationError>>
Get a specific custom destination in your organization.
Examples found in repository?
6 7 8 9 10 11 12 13 14 15 16 17 18 19
async fn main() {
// there is a valid "custom_destination" in the system
let custom_destination_data_id = std::env::var("CUSTOM_DESTINATION_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api
.get_logs_custom_destination(custom_destination_data_id.clone())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn get_logs_custom_destination_with_http_info(
&self,
custom_destination_id: String,
) -> Result<ResponseContent<CustomDestinationResponse>, Error<GetLogsCustomDestinationError>>
pub async fn get_logs_custom_destination_with_http_info( &self, custom_destination_id: String, ) -> Result<ResponseContent<CustomDestinationResponse>, Error<GetLogsCustomDestinationError>>
Get a specific custom destination in your organization.
sourcepub async fn list_logs_custom_destinations(
&self,
) -> Result<CustomDestinationsResponse, Error<ListLogsCustomDestinationsError>>
pub async fn list_logs_custom_destinations( &self, ) -> Result<CustomDestinationsResponse, Error<ListLogsCustomDestinationsError>>
Get the list of configured custom destinations in your organization with their definitions.
sourcepub async fn list_logs_custom_destinations_with_http_info(
&self,
) -> Result<ResponseContent<CustomDestinationsResponse>, Error<ListLogsCustomDestinationsError>>
pub async fn list_logs_custom_destinations_with_http_info( &self, ) -> Result<ResponseContent<CustomDestinationsResponse>, Error<ListLogsCustomDestinationsError>>
Get the list of configured custom destinations in your organization with their definitions.
sourcepub async fn update_logs_custom_destination(
&self,
custom_destination_id: String,
body: CustomDestinationUpdateRequest,
) -> Result<CustomDestinationResponse, Error<UpdateLogsCustomDestinationError>>
pub async fn update_logs_custom_destination( &self, custom_destination_id: String, body: CustomDestinationUpdateRequest, ) -> Result<CustomDestinationResponse, Error<UpdateLogsCustomDestinationError>>
Update the given fields of a specific custom destination in your organization.
Examples found in repository?
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
async fn main() {
// there is a valid "custom_destination" in the system
let custom_destination_data_id = std::env::var("CUSTOM_DESTINATION_DATA_ID").unwrap();
let body = CustomDestinationUpdateRequest::new().data(
CustomDestinationUpdateRequestDefinition::new(
custom_destination_data_id.clone(),
CustomDestinationType::CUSTOM_DESTINATION,
)
.attributes(
CustomDestinationUpdateRequestAttributes::new()
.enabled(false)
.forward_tags(false)
.forward_tags_restriction_list_type(
CustomDestinationAttributeTagsRestrictionListType::BLOCK_LIST,
)
.name("Nginx logs (Updated)".to_string())
.query("source:nginx".to_string()),
),
);
let configuration = datadog::Configuration::new();
let api = LogsCustomDestinationsAPI::with_config(configuration);
let resp = api
.update_logs_custom_destination(custom_destination_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn update_logs_custom_destination_with_http_info(
&self,
custom_destination_id: String,
body: CustomDestinationUpdateRequest,
) -> Result<ResponseContent<CustomDestinationResponse>, Error<UpdateLogsCustomDestinationError>>
pub async fn update_logs_custom_destination_with_http_info( &self, custom_destination_id: String, body: CustomDestinationUpdateRequest, ) -> Result<ResponseContent<CustomDestinationResponse>, Error<UpdateLogsCustomDestinationError>>
Update the given fields of a specific custom destination in your organization.
Trait Implementations§
source§impl Clone for LogsCustomDestinationsAPI
impl Clone for LogsCustomDestinationsAPI
source§fn clone(&self) -> LogsCustomDestinationsAPI
fn clone(&self) -> LogsCustomDestinationsAPI
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for LogsCustomDestinationsAPI
impl Debug for LogsCustomDestinationsAPI
Auto Trait Implementations§
impl Freeze for LogsCustomDestinationsAPI
impl !RefUnwindSafe for LogsCustomDestinationsAPI
impl Send for LogsCustomDestinationsAPI
impl Sync for LogsCustomDestinationsAPI
impl Unpin for LogsCustomDestinationsAPI
impl !UnwindSafe for LogsCustomDestinationsAPI
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)