Skip to content

Commit bb6f300

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit f883233 of spec repo
1 parent 7bbc37c commit bb6f300

File tree

61 files changed

+7041
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+7041
-68
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 750 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Create a personal access token returns "Created" response
2+
use chrono::{DateTime, Utc};
3+
use datadog_api_client::datadog;
4+
use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
5+
use datadog_api_client::datadogV2::model::PersonalAccessTokenCreateAttributes;
6+
use datadog_api_client::datadogV2::model::PersonalAccessTokenCreateData;
7+
use datadog_api_client::datadogV2::model::PersonalAccessTokenCreateRequest;
8+
use datadog_api_client::datadogV2::model::PersonalAccessTokensType;
9+
10+
#[tokio::main]
11+
async fn main() {
12+
let body = PersonalAccessTokenCreateRequest::new(PersonalAccessTokenCreateData::new(
13+
PersonalAccessTokenCreateAttributes::new(
14+
DateTime::parse_from_rfc3339("2022-11-11T11:11:11+00:00")
15+
.expect("Failed to parse datetime")
16+
.with_timezone(&Utc),
17+
"Example-Personal-Access-Token".to_string(),
18+
vec!["dashboards_read".to_string()],
19+
),
20+
PersonalAccessTokensType::PERSONAL_ACCESS_TOKENS,
21+
));
22+
let configuration = datadog::Configuration::new();
23+
let api = KeyManagementAPI::with_config(configuration);
24+
let resp = api.create_personal_access_token(body).await;
25+
if let Ok(value) = resp {
26+
println!("{:#?}", value);
27+
} else {
28+
println!("{:#?}", resp.unwrap_err());
29+
}
30+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Get a personal access token returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "personal_access_token" in the system
8+
let personal_access_token_data_id = std::env::var("PERSONAL_ACCESS_TOKEN_DATA_ID").unwrap();
9+
let configuration = datadog::Configuration::new();
10+
let api = KeyManagementAPI::with_config(configuration);
11+
let resp = api
12+
.get_personal_access_token(personal_access_token_data_id.clone())
13+
.await;
14+
if let Ok(value) = resp {
15+
println!("{:#?}", value);
16+
} else {
17+
println!("{:#?}", resp.unwrap_err());
18+
}
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Get all personal access tokens returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
4+
use datadog_api_client::datadogV2::api_key_management::ListPersonalAccessTokensOptionalParams;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
let configuration = datadog::Configuration::new();
9+
let api = KeyManagementAPI::with_config(configuration);
10+
let resp = api
11+
.list_personal_access_tokens(ListPersonalAccessTokensOptionalParams::default())
12+
.await;
13+
if let Ok(value) = resp {
14+
println!("{:#?}", value);
15+
} else {
16+
println!("{:#?}", resp.unwrap_err());
17+
}
18+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Revoke a personal access token returns "No Content" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "personal_access_token" in the system
8+
let personal_access_token_data_id = std::env::var("PERSONAL_ACCESS_TOKEN_DATA_ID").unwrap();
9+
let configuration = datadog::Configuration::new();
10+
let api = KeyManagementAPI::with_config(configuration);
11+
let resp = api
12+
.revoke_personal_access_token(personal_access_token_data_id.clone())
13+
.await;
14+
if let Ok(value) = resp {
15+
println!("{:#?}", value);
16+
} else {
17+
println!("{:#?}", resp.unwrap_err());
18+
}
19+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Update a personal access token returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
4+
use datadog_api_client::datadogV2::model::PersonalAccessTokenUpdateAttributes;
5+
use datadog_api_client::datadogV2::model::PersonalAccessTokenUpdateData;
6+
use datadog_api_client::datadogV2::model::PersonalAccessTokenUpdateRequest;
7+
use datadog_api_client::datadogV2::model::PersonalAccessTokensType;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
// there is a valid "personal_access_token" in the system
12+
let personal_access_token_data_id = std::env::var("PERSONAL_ACCESS_TOKEN_DATA_ID").unwrap();
13+
let body = PersonalAccessTokenUpdateRequest::new(PersonalAccessTokenUpdateData::new(
14+
PersonalAccessTokenUpdateAttributes::new()
15+
.name("Example-Personal-Access-Token-updated".to_string()),
16+
personal_access_token_data_id.clone(),
17+
PersonalAccessTokensType::PERSONAL_ACCESS_TOKENS,
18+
));
19+
let configuration = datadog::Configuration::new();
20+
let api = KeyManagementAPI::with_config(configuration);
21+
let resp = api
22+
.update_personal_access_token(personal_access_token_data_id.clone(), body)
23+
.await;
24+
if let Ok(value) = resp {
25+
println!("{:#?}", value);
26+
} else {
27+
println!("{:#?}", resp.unwrap_err());
28+
}
29+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Create an access token for a service account returns "Created" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_service_accounts::ServiceAccountsAPI;
4+
use datadog_api_client::datadogV2::model::PersonalAccessTokensType;
5+
use datadog_api_client::datadogV2::model::ServiceAccountAccessTokenCreateAttributes;
6+
use datadog_api_client::datadogV2::model::ServiceAccountAccessTokenCreateData;
7+
use datadog_api_client::datadogV2::model::ServiceAccountAccessTokenCreateRequest;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
// there is a valid "service_account_user" in the system
12+
let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
13+
let body =
14+
ServiceAccountAccessTokenCreateRequest::new(ServiceAccountAccessTokenCreateData::new(
15+
ServiceAccountAccessTokenCreateAttributes::new(
16+
"Example-Service-Account".to_string(),
17+
vec!["dashboards_read".to_string()],
18+
),
19+
PersonalAccessTokensType::PERSONAL_ACCESS_TOKENS,
20+
));
21+
let configuration = datadog::Configuration::new();
22+
let api = ServiceAccountsAPI::with_config(configuration);
23+
let resp = api
24+
.create_service_account_access_token(service_account_user_data_id.clone(), body)
25+
.await;
26+
if let Ok(value) = resp {
27+
println!("{:#?}", value);
28+
} else {
29+
println!("{:#?}", resp.unwrap_err());
30+
}
31+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Get an access token for a service account returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_service_accounts::ServiceAccountsAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "service_account_user" in the system
8+
let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
9+
10+
// there is a valid "service_account_access_token" for "service_account_user"
11+
let service_account_access_token_data_id =
12+
std::env::var("SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID").unwrap();
13+
let configuration = datadog::Configuration::new();
14+
let api = ServiceAccountsAPI::with_config(configuration);
15+
let resp = api
16+
.get_service_account_access_token(
17+
service_account_user_data_id.clone(),
18+
service_account_access_token_data_id.clone(),
19+
)
20+
.await;
21+
if let Ok(value) = resp {
22+
println!("{:#?}", value);
23+
} else {
24+
println!("{:#?}", resp.unwrap_err());
25+
}
26+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// List access tokens for a service account returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_service_accounts::ListServiceAccountAccessTokensOptionalParams;
4+
use datadog_api_client::datadogV2::api_service_accounts::ServiceAccountsAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
// there is a valid "service_account_user" in the system
9+
let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
10+
let configuration = datadog::Configuration::new();
11+
let api = ServiceAccountsAPI::with_config(configuration);
12+
let resp = api
13+
.list_service_account_access_tokens(
14+
service_account_user_data_id.clone(),
15+
ListServiceAccountAccessTokensOptionalParams::default(),
16+
)
17+
.await;
18+
if let Ok(value) = resp {
19+
println!("{:#?}", value);
20+
} else {
21+
println!("{:#?}", resp.unwrap_err());
22+
}
23+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Revoke an access token for a service account returns "No Content" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_service_accounts::ServiceAccountsAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "service_account_user" in the system
8+
let service_account_user_data_id = std::env::var("SERVICE_ACCOUNT_USER_DATA_ID").unwrap();
9+
10+
// there is a valid "service_account_access_token" for "service_account_user"
11+
let service_account_access_token_data_id =
12+
std::env::var("SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID").unwrap();
13+
let configuration = datadog::Configuration::new();
14+
let api = ServiceAccountsAPI::with_config(configuration);
15+
let resp = api
16+
.revoke_service_account_access_token(
17+
service_account_user_data_id.clone(),
18+
service_account_access_token_data_id.clone(),
19+
)
20+
.await;
21+
if let Ok(value) = resp {
22+
println!("{:#?}", value);
23+
} else {
24+
println!("{:#?}", resp.unwrap_err());
25+
}
26+
}

0 commit comments

Comments
 (0)