Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7232,6 +7232,9 @@ components:
description: The identifier of the user or system that created the rule. Server-assigned by the rulesets endpoints; ignored by this operation.
readOnly: true
type: string
creation_message:
description: The message associated with the custom rule revision. Forwarded from the custom rulesets endpoints; ignored by this operation.
type: string
cve:
description: The CVE identifier associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation.
type: string
Expand Down Expand Up @@ -7289,6 +7292,11 @@ components:
should_use_ai_fix:
description: Whether an AI-generated fix should be offered. Forwarded from the rulesets endpoints; ignored by this operation.
type: boolean
tags:
description: Tags associated with the custom rule revision. Forwarded from the custom rulesets endpoints; ignored by this operation.
items:
type: string
type: array
tests:
description: The test cases associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation.
items:
Expand All @@ -7302,6 +7310,10 @@ components:
description: The rule type indicating the detection mechanism (for example, `TREE_SITTER_QUERY`).
example: TREE_SITTER_QUERY
type: string
version_id:
description: The custom rule revision version. Forwarded from the custom rulesets endpoints; ignored by this operation.
format: int64
type: integer
required:
- id
- category
Expand Down Expand Up @@ -29696,13 +29708,14 @@ components:
- PERFORMANCE
CustomRuleRevisionAttributesSeverity:
description: Rule severity
enum: [ERROR, WARNING, NOTICE]
enum: [ERROR, WARNING, NOTICE, NONE]
example: ERROR
type: string
x-enum-varnames:
- ERROR
- WARNING
- NOTICE
- NONE
CustomRuleRevisionDataType:
description: Resource type
enum: [custom_rule_revision]
Expand Down Expand Up @@ -65192,6 +65205,18 @@ components:
- PHP
- KOTLIN
- SWIFT
- DART
- DOCKERFILE
- ELIXIR
- JSON
- RUST
- TERRAFORM
- STARLARK
- BASH
- MARKDOWN
- APEX
- R
- SQL
example: PYTHON
type: string
x-enum-varnames:
Expand All @@ -65206,6 +65231,18 @@ components:
- PHP
- KOTLIN
- SWIFT
- DART
- DOCKERFILE
- ELIXIR
- JSON
- RUST
- TERRAFORM
- STARLARK
- BASH
- MARKDOWN
- APEX
- R
- SQL
LatestVersionMatchPolicy:
description: The policy for matching the latest form version during an upsert operation.
enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
name: "no-exit",
regex: nil,
severity: "WARNING",
tags: [],
tests: [
DatadogAPIClient::V2::AnalysisRequestRuleTest.new({}),
],
Expand Down
4 changes: 2 additions & 2 deletions features/v2/security_monitoring.feature
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ Feature: Security Monitoring
Scenario: Analyze code returns "Bad Request" response
Given operation "CreateStaticAnalysisServerAnalysis" enabled
And new "CreateStaticAnalysisServerAnalysis" request
And body with value {"data": {"attributes": {"code": "aW1wb3J0IHN5cw==", "file_encoding": "utf-8", "filename": "test.py", "language": "python", "rules": [{"arguments": [{}], "category": "BEST_PRACTICES", "checksum": "abc123def456", "code": "ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=", "entity_checked": null, "id": "python-best-practices/no-exit", "language": "python", "name": "no-exit", "regex": null, "severity": "WARNING", "tests": [{}], "tree_sitter_query": "KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==", "type": "TREE_SITTER_QUERY"}]}, "type": "analysis_request"}}
And body with value {"data": {"attributes": {"code": "aW1wb3J0IHN5cw==", "file_encoding": "utf-8", "filename": "test.py", "language": "python", "rules": [{"arguments": [{}], "category": "BEST_PRACTICES", "checksum": "abc123def456", "code": "ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=", "entity_checked": null, "id": "python-best-practices/no-exit", "language": "python", "name": "no-exit", "regex": null, "severity": "WARNING", "tags": [], "tests": [{}], "tree_sitter_query": "KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==", "type": "TREE_SITTER_QUERY"}]}, "type": "analysis_request"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/k9-vm-ast
Scenario: Analyze code returns "OK" response
Given operation "CreateStaticAnalysisServerAnalysis" enabled
And new "CreateStaticAnalysisServerAnalysis" request
And body with value {"data": {"attributes": {"code": "aW1wb3J0IHN5cw==", "file_encoding": "utf-8", "filename": "test.py", "language": "python", "rules": [{"arguments": [{}], "category": "BEST_PRACTICES", "checksum": "abc123def456", "code": "ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=", "entity_checked": null, "id": "python-best-practices/no-exit", "language": "python", "name": "no-exit", "regex": null, "severity": "WARNING", "tests": [{}], "tree_sitter_query": "KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==", "type": "TREE_SITTER_QUERY"}]}, "type": "analysis_request"}}
And body with value {"data": {"attributes": {"code": "aW1wb3J0IHN5cw==", "file_encoding": "utf-8", "filename": "test.py", "language": "python", "rules": [{"arguments": [{}], "category": "BEST_PRACTICES", "checksum": "abc123def456", "code": "ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=", "entity_checked": null, "id": "python-best-practices/no-exit", "language": "python", "name": "no-exit", "regex": null, "severity": "WARNING", "tags": [], "tests": [{}], "tree_sitter_query": "KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==", "type": "TREE_SITTER_QUERY"}]}, "type": "analysis_request"}}
When the request is sent
Then the response status is 200 OK

Expand Down
38 changes: 35 additions & 3 deletions lib/datadog_api_client/v2/models/analysis_request_rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class AnalysisRequestRule
# The identifier of the user or system that created the rule. Server-assigned by the rulesets endpoints; ignored by this operation.
attr_accessor :created_by

# The message associated with the custom rule revision. Forwarded from the custom rulesets endpoints; ignored by this operation.
attr_accessor :creation_message

# The CVE identifier associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation.
attr_accessor :cve

Expand Down Expand Up @@ -93,6 +96,9 @@ class AnalysisRequestRule
# Whether an AI-generated fix should be offered. Forwarded from the rulesets endpoints; ignored by this operation.
attr_accessor :should_use_ai_fix

# Tags associated with the custom rule revision. Forwarded from the custom rulesets endpoints; ignored by this operation.
attr_accessor :tags

# The test cases associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation.
attr_accessor :tests

Expand All @@ -102,6 +108,9 @@ class AnalysisRequestRule
# The rule type indicating the detection mechanism (for example, `TREE_SITTER_QUERY`).
attr_reader :type

# The custom rule revision version. Forwarded from the custom rulesets endpoints; ignored by this operation.
attr_accessor :version_id

attr_accessor :additional_properties

# Attribute mapping from ruby-style variable name to JSON key.
Expand All @@ -114,6 +123,7 @@ def self.attribute_map
:'code' => :'code',
:'created_at' => :'created_at',
:'created_by' => :'created_by',
:'creation_message' => :'creation_message',
:'cve' => :'cve',
:'cwe' => :'cwe',
:'description' => :'description',
Expand All @@ -130,9 +140,11 @@ def self.attribute_map
:'severity' => :'severity',
:'short_description' => :'short_description',
:'should_use_ai_fix' => :'should_use_ai_fix',
:'tags' => :'tags',
:'tests' => :'tests',
:'tree_sitter_query' => :'tree_sitter_query',
:'type' => :'type'
:'type' => :'type',
:'version_id' => :'version_id'
}
end

Expand All @@ -146,6 +158,7 @@ def self.openapi_types
:'code' => :'String',
:'created_at' => :'Time',
:'created_by' => :'String',
:'creation_message' => :'String',
:'cve' => :'String',
:'cwe' => :'String',
:'description' => :'String',
Expand All @@ -162,9 +175,11 @@ def self.openapi_types
:'severity' => :'String',
:'short_description' => :'String',
:'should_use_ai_fix' => :'Boolean',
:'tags' => :'Array<String>',
:'tests' => :'Array<AnalysisRequestRuleTest>',
:'tree_sitter_query' => :'String',
:'type' => :'String'
:'type' => :'String',
:'version_id' => :'Integer'
}
end

Expand Down Expand Up @@ -221,6 +236,10 @@ def initialize(attributes = {})
self.created_by = attributes[:'created_by']
end

if attributes.key?(:'creation_message')
self.creation_message = attributes[:'creation_message']
end

if attributes.key?(:'cve')
self.cve = attributes[:'cve']
end
Expand Down Expand Up @@ -285,6 +304,12 @@ def initialize(attributes = {})
self.should_use_ai_fix = attributes[:'should_use_ai_fix']
end

if attributes.key?(:'tags')
if (value = attributes[:'tags']).is_a?(Array)
self.tags = value
end
end

if attributes.key?(:'tests')
if (value = attributes[:'tests']).is_a?(Array)
self.tests = value
Expand All @@ -298,6 +323,10 @@ def initialize(attributes = {})
if attributes.key?(:'type')
self.type = attributes[:'type']
end

if attributes.key?(:'version_id')
self.version_id = attributes[:'version_id']
end
end

# Check to see if the all the properties in the model are valid
Expand Down Expand Up @@ -427,6 +456,7 @@ def ==(o)
code == o.code &&
created_at == o.created_at &&
created_by == o.created_by &&
creation_message == o.creation_message &&
cve == o.cve &&
cwe == o.cwe &&
description == o.description &&
Expand All @@ -443,17 +473,19 @@ def ==(o)
severity == o.severity &&
short_description == o.short_description &&
should_use_ai_fix == o.should_use_ai_fix &&
tags == o.tags &&
tests == o.tests &&
tree_sitter_query == o.tree_sitter_query &&
type == o.type &&
version_id == o.version_id &&
additional_properties == o.additional_properties
end

# Calculates hash code according to all attributes.
# @return [Integer] Hash code
# @!visibility private
def hash
[arguments, category, checksum, code, created_at, created_by, cve, cwe, description, documentation_url, entity_checked, id, is_published, is_testing, language, last_updated_at, last_updated_by, name, regex, severity, short_description, should_use_ai_fix, tests, tree_sitter_query, type, additional_properties].hash
[arguments, category, checksum, code, created_at, created_by, creation_message, cve, cwe, description, documentation_url, entity_checked, id, is_published, is_testing, language, last_updated_at, last_updated_by, name, regex, severity, short_description, should_use_ai_fix, tags, tests, tree_sitter_query, type, version_id, additional_properties].hash
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ class CustomRuleRevisionAttributesSeverity
ERROR = "ERROR".freeze
WARNING = "WARNING".freeze
NOTICE = "NOTICE".freeze
NONE = "NONE".freeze
end
end
12 changes: 12 additions & 0 deletions lib/datadog_api_client/v2/models/language.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,17 @@ class Language
PHP = "PHP".freeze
KOTLIN = "KOTLIN".freeze
SWIFT = "SWIFT".freeze
DART = "DART".freeze
DOCKERFILE = "DOCKERFILE".freeze
ELIXIR = "ELIXIR".freeze
JSON = "JSON".freeze
RUST = "RUST".freeze
TERRAFORM = "TERRAFORM".freeze
STARLARK = "STARLARK".freeze
BASH = "BASH".freeze
MARKDOWN = "MARKDOWN".freeze
APEX = "APEX".freeze
R = "R".freeze
SQL = "SQL".freeze
end
end
Loading