Sha256: eea34e0f6b224ac0e67d76810cdcbbc316319f8ef30c8efbf1baec1141779d5c

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

# Update an existing rule returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new

body = DatadogAPIClient::V2::SecurityMonitoringRuleUpdatePayload.new({
  cases: [
    DatadogAPIClient::V2::SecurityMonitoringRuleCase.new({
      notifications: [],
      status: DatadogAPIClient::V2::SecurityMonitoringRuleSeverity::CRITICAL,
    }),
  ],
  filters: [
    DatadogAPIClient::V2::SecurityMonitoringFilter.new({
      action: DatadogAPIClient::V2::SecurityMonitoringFilterAction::REQUIRE,
    }),
  ],
  has_extended_title: true,
  options: DatadogAPIClient::V2::SecurityMonitoringRuleOptions.new({
    detection_method: DatadogAPIClient::V2::SecurityMonitoringRuleDetectionMethod::THRESHOLD,
    evaluation_window: DatadogAPIClient::V2::SecurityMonitoringRuleEvaluationWindow::ZERO_MINUTES,
    impossible_travel_options: DatadogAPIClient::V2::SecurityMonitoringRuleImpossibleTravelOptions.new({
      baseline_user_locations: true,
    }),
    keep_alive: DatadogAPIClient::V2::SecurityMonitoringRuleKeepAlive::ZERO_MINUTES,
    max_signal_duration: DatadogAPIClient::V2::SecurityMonitoringRuleMaxSignalDuration::ZERO_MINUTES,
    new_value_options: DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions.new({
      forget_after: DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsForgetAfter::ONE_DAY,
      learning_duration: DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningDuration::ZERO_DAYS,
    }),
  }),
  queries: [
    DatadogAPIClient::V2::SecurityMonitoringRuleQuery.new({
      aggregation: DatadogAPIClient::V2::SecurityMonitoringRuleQueryAggregation::COUNT,
      distinct_fields: [],
      group_by_fields: [],
    }),
  ],
  tags: [],
  version: 1,
})
p api_instance.update_security_monitoring_rule("rule_id", body)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datadog_api_client-1.9.0 examples/v2/security-monitoring/UpdateSecurityMonitoringRule.rb