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 @@ -33,6 +33,7 @@
name="no-exit",
regex=None,
severity="WARNING",
tags=[],
tests=[
AnalysisRequestRuleTest(),
],
Expand Down
24 changes: 24 additions & 0 deletions src/datadog_api_client/v2/model/analysis_request_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def openapi_types(_):
"code": (str,),
"created_at": (datetime,),
"created_by": (str,),
"creation_message": (str,),
"cve": (str,),
"cwe": (str,),
"description": (str,),
Expand All @@ -49,9 +50,11 @@ def openapi_types(_):
"severity": (str,),
"short_description": (str,),
"should_use_ai_fix": (bool,),
"tags": ([str],),
"tests": ([AnalysisRequestRuleTest],),
"tree_sitter_query": (str,),
"type": (str,),
"version_id": (int,),
}

attribute_map = {
Expand All @@ -61,6 +64,7 @@ def openapi_types(_):
"code": "code",
"created_at": "created_at",
"created_by": "created_by",
"creation_message": "creation_message",
"cve": "cve",
"cwe": "cwe",
"description": "description",
Expand All @@ -77,9 +81,11 @@ def openapi_types(_):
"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",
"version_id": "version_id",
}
read_only_vars = {
"created_at",
Expand All @@ -101,6 +107,7 @@ def __init__(
arguments: Union[List[AnalysisRequestRuleArgument], UnsetType] = unset,
created_at: Union[datetime, UnsetType] = unset,
created_by: Union[str, UnsetType] = unset,
creation_message: Union[str, UnsetType] = unset,
cve: Union[str, UnsetType] = unset,
cwe: Union[str, UnsetType] = unset,
description: Union[str, UnsetType] = unset,
Expand All @@ -114,7 +121,9 @@ def __init__(
regex: Union[str, none_type, UnsetType] = unset,
short_description: Union[str, UnsetType] = unset,
should_use_ai_fix: Union[bool, UnsetType] = unset,
tags: Union[List[str], UnsetType] = unset,
tests: Union[List[AnalysisRequestRuleTest], UnsetType] = unset,
version_id: Union[int, UnsetType] = unset,
**kwargs,
):
"""
Expand Down Expand Up @@ -144,6 +153,9 @@ def __init__(
:param created_by: The identifier of the user or system that created the rule. Server-assigned by the rulesets endpoints; ignored by this operation.
:type created_by: str, optional

:param creation_message: The message associated with the custom rule revision. Forwarded from the custom rulesets endpoints; ignored by this operation.
:type creation_message: str, optional

:param cve: The CVE identifier associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation.
:type cve: str, optional

Expand Down Expand Up @@ -192,6 +204,9 @@ def __init__(
:param should_use_ai_fix: Whether an AI-generated fix should be offered. Forwarded from the rulesets endpoints; ignored by this operation.
:type should_use_ai_fix: bool, optional

:param tags: Tags associated with the custom rule revision. Forwarded from the custom rulesets endpoints; ignored by this operation.
:type tags: [str], optional

:param tests: The test cases associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation.
:type tests: [AnalysisRequestRuleTest], optional

Expand All @@ -200,13 +215,18 @@ def __init__(

:param type: The rule type indicating the detection mechanism (for example, ``TREE_SITTER_QUERY`` ).
:type type: str

:param version_id: The custom rule revision version. Forwarded from the custom rulesets endpoints; ignored by this operation.
:type version_id: int, optional
"""
if arguments is not unset:
kwargs["arguments"] = arguments
if created_at is not unset:
kwargs["created_at"] = created_at
if created_by is not unset:
kwargs["created_by"] = created_by
if creation_message is not unset:
kwargs["creation_message"] = creation_message
if cve is not unset:
kwargs["cve"] = cve
if cwe is not unset:
Expand All @@ -233,8 +253,12 @@ def __init__(
kwargs["short_description"] = short_description
if should_use_ai_fix is not unset:
kwargs["should_use_ai_fix"] = should_use_ai_fix
if tags is not unset:
kwargs["tags"] = tags
if tests is not unset:
kwargs["tests"] = tests
if version_id is not unset:
kwargs["version_id"] = version_id
super().__init__(kwargs)

self_.category = category
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ class CustomRuleRevisionAttributesSeverity(ModelSimple):
"""
Rule severity

:param value: Must be one of ["ERROR", "WARNING", "NOTICE"].
:param value: Must be one of ["ERROR", "WARNING", "NOTICE", "NONE"].
:type value: str
"""

allowed_values = {
"ERROR",
"WARNING",
"NOTICE",
"NONE",
}
ERROR: ClassVar["CustomRuleRevisionAttributesSeverity"]
WARNING: ClassVar["CustomRuleRevisionAttributesSeverity"]
NOTICE: ClassVar["CustomRuleRevisionAttributesSeverity"]
NONE: ClassVar["CustomRuleRevisionAttributesSeverity"]

@cached_property
def openapi_types(_):
Expand All @@ -39,3 +41,4 @@ def openapi_types(_):
CustomRuleRevisionAttributesSeverity.ERROR = CustomRuleRevisionAttributesSeverity("ERROR")
CustomRuleRevisionAttributesSeverity.WARNING = CustomRuleRevisionAttributesSeverity("WARNING")
CustomRuleRevisionAttributesSeverity.NOTICE = CustomRuleRevisionAttributesSeverity("NOTICE")
CustomRuleRevisionAttributesSeverity.NONE = CustomRuleRevisionAttributesSeverity("NONE")
38 changes: 37 additions & 1 deletion src/datadog_api_client/v2/model/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Language(ModelSimple):
"""
Programming language

:param value: Must be one of ["PYTHON", "JAVASCRIPT", "TYPESCRIPT", "JAVA", "GO", "YAML", "RUBY", "CSHARP", "PHP", "KOTLIN", "SWIFT"].
:param value: Must be one of ["PYTHON", "JAVASCRIPT", "TYPESCRIPT", "JAVA", "GO", "YAML", "RUBY", "CSHARP", "PHP", "KOTLIN", "SWIFT", "DART", "DOCKERFILE", "ELIXIR", "JSON", "RUST", "TERRAFORM", "STARLARK", "BASH", "MARKDOWN", "APEX", "R", "SQL"].
:type value: str
"""

Expand All @@ -32,6 +32,18 @@ class Language(ModelSimple):
"PHP",
"KOTLIN",
"SWIFT",
"DART",
"DOCKERFILE",
"ELIXIR",
"JSON",
"RUST",
"TERRAFORM",
"STARLARK",
"BASH",
"MARKDOWN",
"APEX",
"R",
"SQL",
}
PYTHON: ClassVar["Language"]
JAVASCRIPT: ClassVar["Language"]
Expand All @@ -44,6 +56,18 @@ class Language(ModelSimple):
PHP: ClassVar["Language"]
KOTLIN: ClassVar["Language"]
SWIFT: ClassVar["Language"]
DART: ClassVar["Language"]
DOCKERFILE: ClassVar["Language"]
ELIXIR: ClassVar["Language"]
JSON: ClassVar["Language"]
RUST: ClassVar["Language"]
TERRAFORM: ClassVar["Language"]
STARLARK: ClassVar["Language"]
BASH: ClassVar["Language"]
MARKDOWN: ClassVar["Language"]
APEX: ClassVar["Language"]
R: ClassVar["Language"]
SQL: ClassVar["Language"]

@cached_property
def openapi_types(_):
Expand All @@ -63,3 +87,15 @@ def openapi_types(_):
Language.PHP = Language("PHP")
Language.KOTLIN = Language("KOTLIN")
Language.SWIFT = Language("SWIFT")
Language.DART = Language("DART")
Language.DOCKERFILE = Language("DOCKERFILE")
Language.ELIXIR = Language("ELIXIR")
Language.JSON = Language("JSON")
Language.RUST = Language("RUST")
Language.TERRAFORM = Language("TERRAFORM")
Language.STARLARK = Language("STARLARK")
Language.BASH = Language("BASH")
Language.MARKDOWN = Language("MARKDOWN")
Language.APEX = Language("APEX")
Language.R = Language("R")
Language.SQL = Language("SQL")
4 changes: 2 additions & 2 deletions tests/v2/features/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
Loading