-
Notifications
You must be signed in to change notification settings - Fork 21
[DOCS-10044] Fix outdated feature name in CI Visibility Tests API docs #2244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 2025-02-06T16:50:39.787Z |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Create a detection rule with type 'application_security 'returns "OK" response | ||
|
|
||
| require "datadog_api_client" | ||
| api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new | ||
|
|
||
| body = DatadogAPIClient::V2::SecurityMonitoringStandardRuleCreatePayload.new({ | ||
| type: DatadogAPIClient::V2::SecurityMonitoringRuleTypeCreate::APPLICATION_SECURITY, | ||
| name: "Example-Security-Monitoring_appsec_rule", | ||
| queries: [ | ||
| DatadogAPIClient::V2::SecurityMonitoringStandardRuleQuery.new({ | ||
| query: "@appsec.security_activity:business_logic.users.login.failure", | ||
| aggregation: DatadogAPIClient::V2::SecurityMonitoringRuleQueryAggregation::COUNT, | ||
| group_by_fields: [ | ||
| "service", | ||
| "@http.client_ip", | ||
| ], | ||
| distinct_fields: [], | ||
| }), | ||
| ], | ||
| filters: [], | ||
| cases: [ | ||
| DatadogAPIClient::V2::SecurityMonitoringRuleCaseCreate.new({ | ||
| name: "", | ||
| status: DatadogAPIClient::V2::SecurityMonitoringRuleSeverity::INFO, | ||
| notifications: [], | ||
| condition: "a > 100000", | ||
| actions: [ | ||
| DatadogAPIClient::V2::SecurityMonitoringRuleCaseAction.new({ | ||
| type: DatadogAPIClient::V2::SecurityMonitoringRuleCaseActionType::BLOCK_IP, | ||
| options: DatadogAPIClient::V2::SecurityMonitoringRuleCaseActionOptions.new({ | ||
| duration: 900, | ||
| }), | ||
| }), | ||
| ], | ||
| }), | ||
| ], | ||
| options: DatadogAPIClient::V2::SecurityMonitoringRuleOptions.new({ | ||
| keep_alive: DatadogAPIClient::V2::SecurityMonitoringRuleKeepAlive::ONE_HOUR, | ||
| max_signal_duration: DatadogAPIClient::V2::SecurityMonitoringRuleMaxSignalDuration::ONE_DAY, | ||
| evaluation_window: DatadogAPIClient::V2::SecurityMonitoringRuleEvaluationWindow::FIFTEEN_MINUTES, | ||
| detection_method: DatadogAPIClient::V2::SecurityMonitoringRuleDetectionMethod::THRESHOLD, | ||
| }), | ||
| is_enabled: true, | ||
| message: "Test rule", | ||
| tags: [], | ||
| group_signals_by: [ | ||
| "service", | ||
| ], | ||
|
Comment on lines
+46
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ Code Quality ViolationConsider using the %W syntax instead (...read more)The rule "Prefer This rule is important because it helps to keep the code concise and easy to read. The To follow this rule, replace the traditional array syntax with the |
||
| }) | ||
| p api_instance.create_security_monitoring_rule(body) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,9 @@ class JobDefinition | |
| # Starting time of data analyzed by the job. | ||
| attr_reader :from | ||
|
|
||
| # Additional grouping to perform on top of the existing groups in the query section. Must be a subset of the existing groups. | ||
| attr_accessor :group_signals_by | ||
|
|
||
| # Index used to load the data. | ||
| attr_reader :index | ||
|
|
||
|
|
@@ -69,6 +72,7 @@ def self.attribute_map | |
| :'calculated_fields' => :'calculatedFields', | ||
| :'cases' => :'cases', | ||
| :'from' => :'from', | ||
| :'group_signals_by' => :'groupSignalsBy', | ||
| :'index' => :'index', | ||
| :'message' => :'message', | ||
| :'name' => :'name', | ||
|
|
@@ -89,6 +93,7 @@ def self.openapi_types | |
| :'calculated_fields' => :'Array<CalculatedField>', | ||
| :'cases' => :'Array<SecurityMonitoringRuleCaseCreate>', | ||
| :'from' => :'Integer', | ||
| :'group_signals_by' => :'Array<String>', | ||
| :'index' => :'String', | ||
| :'message' => :'String', | ||
| :'name' => :'String', | ||
|
|
@@ -136,6 +141,12 @@ def initialize(attributes = {}) | |
| self.from = attributes[:'from'] | ||
| end | ||
|
|
||
| if attributes.key?(:'group_signals_by') | ||
| if (value = attributes[:'group_signals_by']).is_a?(Array) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ Code Quality ViolationConsider using Array() to ensure the type is that of an array (...read more)The rule "Use The By using |
||
| self.group_signals_by = value | ||
| end | ||
| end | ||
|
|
||
| if attributes.key?(:'index') | ||
| self.index = attributes[:'index'] | ||
| end | ||
|
|
@@ -298,6 +309,7 @@ def ==(o) | |
| calculated_fields == o.calculated_fields && | ||
| cases == o.cases && | ||
| from == o.from && | ||
| group_signals_by == o.group_signals_by && | ||
| index == o.index && | ||
| message == o.message && | ||
| name == o.name && | ||
|
|
@@ -315,7 +327,7 @@ def ==(o) | |
| # @return [Integer] Hash code | ||
| # @!visibility private | ||
| def hash | ||
| [calculated_fields, cases, from, index, message, name, options, queries, reference_tables, tags, third_party_cases, to, type, additional_properties].hash | ||
| [calculated_fields, cases, from, group_signals_by, index, message, name, options, queries, reference_tables, tags, third_party_cases, to, type, additional_properties].hash | ||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ Code Quality Violation
Consider using the %W syntax instead (...read more)
The rule "Prefer
%wto the literal array syntax" is a Ruby style guideline that encourages the use of%wnotation instead of the traditional array syntax when defining arrays of strings. This rule is part of the Ruby community's efforts to promote readability and simplicity in Ruby code.This rule is important because it helps to keep the code concise and easy to read. The
%wnotation allows you to define an array of strings without having to use quotes and commas. This can make the code cleaner and easier to understand, especially when dealing with large arrays.To follow this rule, replace the traditional array syntax with the
%wnotation. For example, instead of writing['foo', 'bar', 'baz'], you should write%w[foo bar baz]. This will create the same array, but in a more readable and concise way. By following this rule, you can help to make your Ruby code cleaner and easier to understand.