-
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.
Add PUT endpoint to scorecards APIs (#219)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
- Loading branch information
1 parent
61a8006
commit 449d881
Showing
16 changed files
with
876 additions
and
12 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
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,36 @@ | ||
// Update an existing rule returns "Rule updated successfully" response | ||
use datadog_api_client::datadog; | ||
use datadog_api_client::datadogV2::api_service_scorecards::ServiceScorecardsAPI; | ||
use datadog_api_client::datadogV2::model::RuleAttributes; | ||
use datadog_api_client::datadogV2::model::UpdateRuleRequest; | ||
use datadog_api_client::datadogV2::model::UpdateRuleRequestData; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
// there is a valid "create_scorecard_rule" in the system | ||
let create_scorecard_rule_data_attributes_name = | ||
std::env::var("CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME").unwrap(); | ||
let create_scorecard_rule_data_attributes_scorecard_name = | ||
std::env::var("CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME").unwrap(); | ||
let create_scorecard_rule_data_id = std::env::var("CREATE_SCORECARD_RULE_DATA_ID").unwrap(); | ||
let body = UpdateRuleRequest::new().data( | ||
UpdateRuleRequestData::new().attributes( | ||
RuleAttributes::new() | ||
.description("Updated description via test".to_string()) | ||
.enabled(true) | ||
.name(create_scorecard_rule_data_attributes_name.clone()) | ||
.scorecard_name(create_scorecard_rule_data_attributes_scorecard_name.clone()), | ||
), | ||
); | ||
let mut configuration = datadog::Configuration::new(); | ||
configuration.set_unstable_operation_enabled("v2.UpdateScorecardRule", true); | ||
let api = ServiceScorecardsAPI::with_config(configuration); | ||
let resp = api | ||
.update_scorecard_rule(create_scorecard_rule_data_id.clone(), body) | ||
.await; | ||
if let Ok(value) = resp { | ||
println!("{:#?}", value); | ||
} else { | ||
println!("{:#?}", resp.unwrap_err()); | ||
} | ||
} |
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
Oops, something went wrong.