Sha256: 357cc915fee9813903e27968d266aa131916a6fc9f302ac16bf76ac69d9fc5c1

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

# Create a detection rule returns "OK" response

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

body = DatadogAPIClient::V2::SecurityMonitoringRuleCreatePayload.new({
  name: "Example-Create_a_detection_rule_returns_OK_response",
  queries: [
    DatadogAPIClient::V2::SecurityMonitoringRuleQueryCreate.new({
      query: "@test:true",
      aggregation: DatadogAPIClient::V2::SecurityMonitoringRuleQueryAggregation::COUNT,
      group_by_fields: [],
      distinct_fields: [],
      metric: "",
    }),
  ],
  filters: [],
  cases: [
    DatadogAPIClient::V2::SecurityMonitoringRuleCaseCreate.new({
      name: "",
      status: DatadogAPIClient::V2::SecurityMonitoringRuleSeverity::INFO,
      condition: "a > 0",
      notifications: [],
    }),
  ],
  options: DatadogAPIClient::V2::SecurityMonitoringRuleOptions.new({
    evaluation_window: DatadogAPIClient::V2::SecurityMonitoringRuleEvaluationWindow::FIFTEEN_MINUTES,
    keep_alive: DatadogAPIClient::V2::SecurityMonitoringRuleKeepAlive::ONE_HOUR,
    max_signal_duration: DatadogAPIClient::V2::SecurityMonitoringRuleMaxSignalDuration::ONE_DAY,
  }),
  message: "Test rule",
  tags: [],
  is_enabled: true,
})
p api_instance.create_security_monitoring_rule(body)

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
datadog_api_client-2.1.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb
datadog_api_client-2.0.2 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb
datadog_api_client-2.0.1 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb
datadog_api_client-2.0.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb
datadog_api_client-1.11.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb
datadog_api_client-1.10.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb
datadog_api_client-1.9.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb
datadog_api_client-1.8.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb
datadog_api_client-1.7.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb
datadog_api_client-1.6.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb
datadog_api_client-1.5.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb