-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerate client from commit e2da1982 of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Oct 9, 2024
1 parent
f5d2b01
commit 446f38f
Showing
24 changed files
with
2,149 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Post a change event returns "OK" response | ||
use datadog_api_client::datadog; | ||
use datadog_api_client::datadogV2::api_events::EventsAPI; | ||
use datadog_api_client::datadogV2::model::ChangeEvent; | ||
use datadog_api_client::datadogV2::model::ChangeEventCategory; | ||
use datadog_api_client::datadogV2::model::ChangeEventCreateRequest; | ||
use datadog_api_client::datadogV2::model::ChangeEventCreateRequestType; | ||
use datadog_api_client::datadogV2::model::ChangeEventCustomAttributes; | ||
use datadog_api_client::datadogV2::model::ChangeEventCustomAttributesAuthor; | ||
use datadog_api_client::datadogV2::model::ChangeEventCustomAttributesAuthorType; | ||
use datadog_api_client::datadogV2::model::ChangeEventCustomAttributesChangedResource; | ||
use datadog_api_client::datadogV2::model::ChangeEventCustomAttributesChangedResourceType; | ||
use datadog_api_client::datadogV2::model::ChangeEventCustomAttributesImpactedResourcesItems; | ||
use datadog_api_client::datadogV2::model::ChangeEventCustomAttributesImpactedResourcesItemsType; | ||
use serde_json::Value; | ||
use std::collections::BTreeMap; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let body = ChangeEventCreateRequest::new() | ||
.attributes( | ||
ChangeEvent::new( | ||
ChangeEventCustomAttributes::new(ChangeEventCustomAttributesChangedResource::new( | ||
"fallback_payments_test".to_string(), | ||
ChangeEventCustomAttributesChangedResourceType::FEATURE_FLAG, | ||
)) | ||
.author(ChangeEventCustomAttributesAuthor::new( | ||
"".to_string(), | ||
ChangeEventCustomAttributesAuthorType::USER, | ||
)) | ||
.change_metadata(BTreeMap::from([( | ||
"resource_link".to_string(), | ||
Value::from("/feature/fallback_payments_test"), | ||
)])) | ||
.impacted_resources(vec![ | ||
ChangeEventCustomAttributesImpactedResourcesItems::new( | ||
"payments_api".to_string(), | ||
ChangeEventCustomAttributesImpactedResourcesItemsType::SERVICE, | ||
), | ||
]) | ||
.new_value(BTreeMap::from([ | ||
("enabled".to_string(), Value::from(True)), | ||
("percentage".to_string(), Value::from("50%")), | ||
])) | ||
.prev_value(BTreeMap::from([ | ||
("enabled".to_string(), Value::from(True)), | ||
("percentage".to_string(), Value::from("10%")), | ||
])), | ||
ChangeEventCategory::CHANGE, | ||
"payment_processed feature flag updated".to_string(), | ||
) | ||
.message("payment_processed feature flag has been enabled".to_string()) | ||
.tags(vec!["environment:test".to_string()]), | ||
) | ||
.type_(ChangeEventCreateRequestType::EVENT); | ||
let configuration = datadog::Configuration::new(); | ||
let api = EventsAPI::with_config(configuration); | ||
let resp = api.create_event(body).await; | ||
if let Ok(value) = resp { | ||
println!("{:#?}", value); | ||
} else { | ||
println!("{:#?}", resp.unwrap_err()); | ||
} | ||
} |
Oops, something went wrong.