Sha256: 77f9e8577a087331e7263901dd1e5dfba84278fe1dd2e6a64b2546bdf5b0d391

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

# Update an existing rule returns "Rule updated successfully" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.update_scorecard_rule".to_sym] = true
end
api_instance = DatadogAPIClient::V2::ServiceScorecardsAPI.new

# there is a valid "create_scorecard_rule" in the system
CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME = ENV["CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME"]
CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME = ENV["CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME"]
CREATE_SCORECARD_RULE_DATA_ID = ENV["CREATE_SCORECARD_RULE_DATA_ID"]

body = DatadogAPIClient::V2::UpdateRuleRequest.new({
  data: DatadogAPIClient::V2::UpdateRuleRequestData.new({
    attributes: DatadogAPIClient::V2::RuleAttributes.new({
      enabled: true,
      name: CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME,
      scorecard_name: CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME,
      description: "Updated description via test",
    }),
  }),
})
p api_instance.update_scorecard_rule(CREATE_SCORECARD_RULE_DATA_ID, body)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
datadog_api_client-2.28.1 examples/v2/service-scorecards/UpdateScorecardRule.rb
datadog_api_client-2.27.1 examples/v2/service-scorecards/UpdateScorecardRule.rb
datadog_api_client-2.26.1 examples/v2/service-scorecards/UpdateScorecardRule.rb
datadog_api_client-2.26.0 examples/v2/service-scorecards/UpdateScorecardRule.rb
datadog_api_client-2.25.0 examples/v2/service-scorecards/UpdateScorecardRule.rb