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 @@ -38,6 +38,7 @@
AnalysisRequestRule.JSON_PROPERTY_CODE,
AnalysisRequestRule.JSON_PROPERTY_CREATED_AT,
AnalysisRequestRule.JSON_PROPERTY_CREATED_BY,
AnalysisRequestRule.JSON_PROPERTY_CREATION_MESSAGE,
AnalysisRequestRule.JSON_PROPERTY_CVE,
AnalysisRequestRule.JSON_PROPERTY_CWE,
AnalysisRequestRule.JSON_PROPERTY_DESCRIPTION,
Expand All @@ -54,9 +55,11 @@
AnalysisRequestRule.JSON_PROPERTY_SEVERITY,
AnalysisRequestRule.JSON_PROPERTY_SHORT_DESCRIPTION,
AnalysisRequestRule.JSON_PROPERTY_SHOULD_USE_AI_FIX,
AnalysisRequestRule.JSON_PROPERTY_TAGS,
AnalysisRequestRule.JSON_PROPERTY_TESTS,
AnalysisRequestRule.JSON_PROPERTY_TREE_SITTER_QUERY,
AnalysisRequestRule.JSON_PROPERTY_TYPE
AnalysisRequestRule.JSON_PROPERTY_TYPE,
AnalysisRequestRule.JSON_PROPERTY_VERSION_ID
})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
Expand All @@ -80,6 +83,9 @@ public class AnalysisRequestRule {
public static final String JSON_PROPERTY_CREATED_BY = "created_by";
private String createdBy;

public static final String JSON_PROPERTY_CREATION_MESSAGE = "creation_message";
private String creationMessage;

public static final String JSON_PROPERTY_CVE = "cve";
private String cve;

Expand Down Expand Up @@ -128,6 +134,9 @@ public class AnalysisRequestRule {
public static final String JSON_PROPERTY_SHOULD_USE_AI_FIX = "should_use_ai_fix";
private Boolean shouldUseAiFix;

public static final String JSON_PROPERTY_TAGS = "tags";
private List<String> tags = null;

public static final String JSON_PROPERTY_TESTS = "tests";
private List<AnalysisRequestRuleTest> tests = null;

Expand All @@ -137,6 +146,9 @@ public class AnalysisRequestRule {
public static final String JSON_PROPERTY_TYPE = "type";
private String type;

public static final String JSON_PROPERTY_VERSION_ID = "version_id";
private Long versionId;

public AnalysisRequestRule() {}

@JsonCreator
Expand Down Expand Up @@ -287,6 +299,28 @@ public String getCreatedBy() {
return createdBy;
}

public AnalysisRequestRule creationMessage(String creationMessage) {
this.creationMessage = creationMessage;
return this;
}

/**
* The message associated with the custom rule revision. Forwarded from the custom rulesets
* endpoints; ignored by this operation.
*
* @return creationMessage
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_CREATION_MESSAGE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getCreationMessage() {
return creationMessage;
}

public void setCreationMessage(String creationMessage) {
this.creationMessage = creationMessage;
}

public AnalysisRequestRule cve(String cve) {
this.cve = cve;
return this;
Expand Down Expand Up @@ -634,6 +668,36 @@ public void setShouldUseAiFix(Boolean shouldUseAiFix) {
this.shouldUseAiFix = shouldUseAiFix;
}

public AnalysisRequestRule tags(List<String> tags) {
this.tags = tags;
return this;
}

public AnalysisRequestRule addTagsItem(String tagsItem) {
if (this.tags == null) {
this.tags = new ArrayList<>();
}
this.tags.add(tagsItem);
return this;
}

/**
* Tags associated with the custom rule revision. Forwarded from the custom rulesets endpoints;
* ignored by this operation.
*
* @return tags
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<String> getTags() {
return tags;
}

public void setTags(List<String> tags) {
this.tags = tags;
}

public AnalysisRequestRule tests(List<AnalysisRequestRuleTest> tests) {
this.tests = tests;
if (tests != null) {
Expand Down Expand Up @@ -715,6 +779,28 @@ public void setType(String type) {
this.type = type;
}

public AnalysisRequestRule versionId(Long versionId) {
this.versionId = versionId;
return this;
}

/**
* The custom rule revision version. Forwarded from the custom rulesets endpoints; ignored by this
* operation.
*
* @return versionId
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_VERSION_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Long getVersionId() {
return versionId;
}

public void setVersionId(Long versionId) {
this.versionId = versionId;
}

/**
* A container for additional, undeclared properties. This is a holder for any undeclared
* properties as specified with the 'additionalProperties' keyword in the OAS document.
Expand Down Expand Up @@ -777,6 +863,7 @@ public boolean equals(Object o) {
&& Objects.equals(this.code, analysisRequestRule.code)
&& Objects.equals(this.createdAt, analysisRequestRule.createdAt)
&& Objects.equals(this.createdBy, analysisRequestRule.createdBy)
&& Objects.equals(this.creationMessage, analysisRequestRule.creationMessage)
&& Objects.equals(this.cve, analysisRequestRule.cve)
&& Objects.equals(this.cwe, analysisRequestRule.cwe)
&& Objects.equals(this.description, analysisRequestRule.description)
Expand All @@ -793,9 +880,11 @@ public boolean equals(Object o) {
&& Objects.equals(this.severity, analysisRequestRule.severity)
&& Objects.equals(this.shortDescription, analysisRequestRule.shortDescription)
&& Objects.equals(this.shouldUseAiFix, analysisRequestRule.shouldUseAiFix)
&& Objects.equals(this.tags, analysisRequestRule.tags)
&& Objects.equals(this.tests, analysisRequestRule.tests)
&& Objects.equals(this.treeSitterQuery, analysisRequestRule.treeSitterQuery)
&& Objects.equals(this.type, analysisRequestRule.type)
&& Objects.equals(this.versionId, analysisRequestRule.versionId)
&& Objects.equals(this.additionalProperties, analysisRequestRule.additionalProperties);
}

Expand All @@ -808,6 +897,7 @@ public int hashCode() {
code,
createdAt,
createdBy,
creationMessage,
cve,
cwe,
description,
Expand All @@ -824,9 +914,11 @@ public int hashCode() {
severity,
shortDescription,
shouldUseAiFix,
tags,
tests,
treeSitterQuery,
type,
versionId,
additionalProperties);
}

Expand All @@ -840,6 +932,7 @@ public String toString() {
sb.append(" code: ").append(toIndentedString(code)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n");
sb.append(" creationMessage: ").append(toIndentedString(creationMessage)).append("\n");
sb.append(" cve: ").append(toIndentedString(cve)).append("\n");
sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
Expand All @@ -856,9 +949,11 @@ public String toString() {
sb.append(" severity: ").append(toIndentedString(severity)).append("\n");
sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n");
sb.append(" shouldUseAiFix: ").append(toIndentedString(shouldUseAiFix)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" tests: ").append(toIndentedString(tests)).append("\n");
sb.append(" treeSitterQuery: ").append(toIndentedString(treeSitterQuery)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" versionId: ").append(toIndentedString(versionId)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
.append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@
public class CustomRuleRevisionAttributesSeverity extends ModelEnum<String> {

private static final Set<String> allowedValues =
new HashSet<String>(Arrays.asList("ERROR", "WARNING", "NOTICE"));
new HashSet<String>(Arrays.asList("ERROR", "WARNING", "NOTICE", "NONE"));

public static final CustomRuleRevisionAttributesSeverity ERROR =
new CustomRuleRevisionAttributesSeverity("ERROR");
public static final CustomRuleRevisionAttributesSeverity WARNING =
new CustomRuleRevisionAttributesSeverity("WARNING");
public static final CustomRuleRevisionAttributesSeverity NOTICE =
new CustomRuleRevisionAttributesSeverity("NOTICE");
public static final CustomRuleRevisionAttributesSeverity NONE =
new CustomRuleRevisionAttributesSeverity("NONE");

CustomRuleRevisionAttributesSeverity(String value) {
super(value, allowedValues);
Expand Down
26 changes: 25 additions & 1 deletion src/main/java/com/datadog/api/client/v2/model/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,19 @@ public class Language extends ModelEnum<String> {
"CSHARP",
"PHP",
"KOTLIN",
"SWIFT"));
"SWIFT",
"DART",
"DOCKERFILE",
"ELIXIR",
"JSON",
"RUST",
"TERRAFORM",
"STARLARK",
"BASH",
"MARKDOWN",
"APEX",
"R",
"SQL"));

public static final Language PYTHON = new Language("PYTHON");
public static final Language JAVASCRIPT = new Language("JAVASCRIPT");
Expand All @@ -48,6 +60,18 @@ public class Language extends ModelEnum<String> {
public static final Language PHP = new Language("PHP");
public static final Language KOTLIN = new Language("KOTLIN");
public static final Language SWIFT = new Language("SWIFT");
public static final Language DART = new Language("DART");
public static final Language DOCKERFILE = new Language("DOCKERFILE");
public static final Language ELIXIR = new Language("ELIXIR");
public static final Language JSON = new Language("JSON");
public static final Language RUST = new Language("RUST");
public static final Language TERRAFORM = new Language("TERRAFORM");
public static final Language STARLARK = new Language("STARLARK");
public static final Language BASH = new Language("BASH");
public static final Language MARKDOWN = new Language("MARKDOWN");
public static final Language APEX = new Language("APEX");
public static final Language R = new Language("R");
public static final Language SQL = new Language("SQL");

Language(String value) {
super(value, allowedValues);
Expand Down
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