v2_teams_CreateTeam/
v2_teams_CreateTeam.rs

1// Create a team returns "CREATED" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_teams::TeamsAPI;
4use datadog_api_client::datadogV2::model::RelationshipToUsers;
5use datadog_api_client::datadogV2::model::TeamCreate;
6use datadog_api_client::datadogV2::model::TeamCreateAttributes;
7use datadog_api_client::datadogV2::model::TeamCreateRelationships;
8use datadog_api_client::datadogV2::model::TeamCreateRequest;
9use datadog_api_client::datadogV2::model::TeamType;
10
11#[tokio::main]
12async fn main() {
13    let body = TeamCreateRequest::new(
14        TeamCreate::new(
15            TeamCreateAttributes::new(
16                "test-handle-a0fc0297eb519635".to_string(),
17                "test-name-a0fc0297eb519635".to_string(),
18            ),
19            TeamType::TEAM,
20        )
21        .relationships(TeamCreateRelationships::new().users(RelationshipToUsers::new(vec![]))),
22    );
23    let configuration = datadog::Configuration::new();
24    let api = TeamsAPI::with_config(configuration);
25    let resp = api.create_team(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}