v1_slack_integration_CreateSlackIntegrationChannel/
v1_slack-integration_CreateSlackIntegrationChannel.rs

1// Create a Slack integration channel returns "OK" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV1::api_slack_integration::SlackIntegrationAPI;
4use datadog_api_client::datadogV1::model::SlackIntegrationChannel;
5use datadog_api_client::datadogV1::model::SlackIntegrationChannelDisplay;
6
7#[tokio::main]
8async fn main() {
9    let body = SlackIntegrationChannel::new()
10        .display(
11            SlackIntegrationChannelDisplay::new()
12                .message(true)
13                .mute_buttons(false)
14                .notified(true)
15                .snapshot(true)
16                .tags(true),
17        )
18        .name("#general".to_string());
19    let configuration = datadog::Configuration::new();
20    let api = SlackIntegrationAPI::with_config(configuration);
21    let resp = api
22        .create_slack_integration_channel("account_name".to_string(), body)
23        .await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}