Skip to content

Commit ad54190

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add public OpenAPI ops for Webhooks OAuth2 client credentials (#1674)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 5ff802a commit ad54190

32 files changed

Lines changed: 3863 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 509 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Create an OAuth2 client credentials auth method returns "CREATED" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_webhooks_integration::WebhooksIntegrationAPI;
4+
use datadog_api_client::datadogV2::model::WebhooksOAuth2ClientCredentialsCreateAttributes;
5+
use datadog_api_client::datadogV2::model::WebhooksOAuth2ClientCredentialsCreateData;
6+
use datadog_api_client::datadogV2::model::WebhooksOAuth2ClientCredentialsCreateRequest;
7+
use datadog_api_client::datadogV2::model::WebhooksOAuth2ClientCredentialsType;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
let body = WebhooksOAuth2ClientCredentialsCreateRequest::new(
12+
WebhooksOAuth2ClientCredentialsCreateData::new(
13+
WebhooksOAuth2ClientCredentialsCreateAttributes::new(
14+
"https://example.com/oauth/token".to_string(),
15+
"my-client-id".to_string(),
16+
"my-client-secret".to_string(),
17+
"my-oauth2-auth".to_string(),
18+
)
19+
.audience(Some("https://api.example.com".to_string()))
20+
.scope(Some("read:webhooks write:webhooks".to_string())),
21+
WebhooksOAuth2ClientCredentialsType::WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS,
22+
),
23+
);
24+
let configuration = datadog::Configuration::new();
25+
let api = WebhooksIntegrationAPI::with_config(configuration);
26+
let resp = api.create_o_auth2_client_credentials(body).await;
27+
if let Ok(value) = resp {
28+
println!("{:#?}", value);
29+
} else {
30+
println!("{:#?}", resp.unwrap_err());
31+
}
32+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Delete an OAuth2 client credentials auth method returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_webhooks_integration::WebhooksIntegrationAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let configuration = datadog::Configuration::new();
8+
let api = WebhooksIntegrationAPI::with_config(configuration);
9+
let resp = api
10+
.delete_o_auth2_client_credentials("auth_method_id".to_string())
11+
.await;
12+
if let Ok(value) = resp {
13+
println!("{:#?}", value);
14+
} else {
15+
println!("{:#?}", resp.unwrap_err());
16+
}
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Get all auth methods returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_webhooks_integration::GetAllAuthMethodsOptionalParams;
4+
use datadog_api_client::datadogV2::api_webhooks_integration::WebhooksIntegrationAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
let configuration = datadog::Configuration::new();
9+
let api = WebhooksIntegrationAPI::with_config(configuration);
10+
let resp = api
11+
.get_all_auth_methods(GetAllAuthMethodsOptionalParams::default())
12+
.await;
13+
if let Ok(value) = resp {
14+
println!("{:#?}", value);
15+
} else {
16+
println!("{:#?}", resp.unwrap_err());
17+
}
18+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Get an OAuth2 client credentials auth method returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_webhooks_integration::WebhooksIntegrationAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let configuration = datadog::Configuration::new();
8+
let api = WebhooksIntegrationAPI::with_config(configuration);
9+
let resp = api
10+
.get_o_auth2_client_credentials("auth_method_id".to_string())
11+
.await;
12+
if let Ok(value) = resp {
13+
println!("{:#?}", value);
14+
} else {
15+
println!("{:#?}", resp.unwrap_err());
16+
}
17+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Update an OAuth2 client credentials auth method returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_webhooks_integration::WebhooksIntegrationAPI;
4+
use datadog_api_client::datadogV2::model::WebhooksOAuth2ClientCredentialsType;
5+
use datadog_api_client::datadogV2::model::WebhooksOAuth2ClientCredentialsUpdateAttributes;
6+
use datadog_api_client::datadogV2::model::WebhooksOAuth2ClientCredentialsUpdateData;
7+
use datadog_api_client::datadogV2::model::WebhooksOAuth2ClientCredentialsUpdateRequest;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
let body = WebhooksOAuth2ClientCredentialsUpdateRequest::new(
12+
WebhooksOAuth2ClientCredentialsUpdateData::new(
13+
WebhooksOAuth2ClientCredentialsUpdateAttributes::new()
14+
.access_token_url("https://example.com/oauth/token".to_string())
15+
.audience(Some("https://api.example.com".to_string()))
16+
.client_id("my-client-id".to_string())
17+
.client_secret("my-client-secret".to_string())
18+
.name("my-oauth2-auth".to_string())
19+
.scope(Some("read:webhooks write:webhooks".to_string())),
20+
WebhooksOAuth2ClientCredentialsType::WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS,
21+
),
22+
);
23+
let configuration = datadog::Configuration::new();
24+
let api = WebhooksIntegrationAPI::with_config(configuration);
25+
let resp = api
26+
.update_o_auth2_client_credentials("auth_method_id".to_string(), body)
27+
.await;
28+
if let Ok(value) = resp {
29+
println!("{:#?}", value);
30+
} else {
31+
println!("{:#?}", resp.unwrap_err());
32+
}
33+
}

0 commit comments

Comments
 (0)