Sha256: 195bb464fd578f45261b26f9da9f10ce3a5ea2082d595f3dc00c4dfb3ef4e8cf

Contents?: true

Size: 1.33 KB

Versions: 19

Compression:

Stored size: 1.33 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::SecurityMonitoringStandardRuleCreatePayload.new({
  name: "Example-Security-Monitoring",
  queries: [
    DatadogAPIClient::V2::SecurityMonitoringStandardRuleQuery.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

19 entries across 19 versions & 1 rubygems

Version Path
datadog_api_client-2.28.1 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.27.1 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.26.1 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.26.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.25.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.24.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.22.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.21.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.20.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.19.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.18.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.17.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.16.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.15.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.14.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.13.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.12.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.11.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb
datadog_api_client-2.10.0 examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb