Sha256: 5d01b2625845d4139fc6d384125654b665a85206509c4217b2268bda337e0990

Contents?: true

Size: 1.38 KB

Versions: 10

Compression:

Stored size: 1.38 KB

Contents

# Create a detection rule with type 'workload_security' returns "OK" response

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

body = DatadogAPIClient::V2::SecurityMonitoringRuleCreatePayload.new({
  name: "Example-Create_a_detection_rule_with_type_workload_security_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,
  type: DatadogAPIClient::V2::SecurityMonitoringRuleTypeCreate::WORKLOAD_SECURITY,
})
p api_instance.create_security_monitoring_rule(body)

Version data entries

10 entries across 10 versions & 1 rubygems

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