diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 1a0972d5a2..bdd215f4a9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -7059,6 +7059,9 @@ components: AnalysisRequest: description: The request payload for running static analysis on source code. properties: + _authentication_token: + description: CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + type: string data: $ref: '#/components/schemas/AnalysisRequestData' required: @@ -7119,8 +7122,21 @@ components: x-enum-varnames: - ANALYSIS_REQUEST AnalysisRequestRule: - description: A static analysis rule to apply during code analysis. + additionalProperties: {} + description: |- + A static analysis rule to apply during code analysis. Clients forward complete rule + objects returned by the rulesets endpoints, so every member of that resource is + declared here; only `id`, `category`, `checksum`, `language`, `severity`, + `tree_sitter_query`, `entity_checked`, `regex`, `type` and `code` are read by this + operation and the rest are ignored. The schema stays open so that any member beyond + the forwarded rule resource is reported as a promotion candidate rather than + rejected; it can be closed once that telemetry confirms none remain. properties: + arguments: + description: The configurable arguments accepted by the rule. Forwarded from the rulesets endpoints; ignored by this operation. + items: + $ref: '#/components/schemas/AnalysisRequestRuleArgument' + type: array category: description: The category of the rule (for example, `BEST_PRACTICES`, `SECURITY`). example: BEST_PRACTICES @@ -7133,6 +7149,27 @@ components: description: The base64-encoded rule implementation code. example: ZnVuY3Rpb24gdmlzaXQobm9kZSkge30= type: string + created_at: + description: The date and time when the rule was created. Server-assigned by the rulesets endpoints; ignored by this operation. + format: date-time + readOnly: true + type: string + created_by: + 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 + cve: + description: The CVE identifier associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation. + type: string + cwe: + description: The CWE identifier associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation. + type: string + description: + description: A detailed explanation of what the rule detects. Forwarded from the rulesets endpoints; ignored by this operation. + type: string + documentation_url: + description: A URL pointing to the rule documentation. Forwarded from the rulesets endpoints; ignored by this operation. + type: string entity_checked: description: The code entity type checked by the rule, applicable when rule type is `AST_CHECK`. nullable: true @@ -7141,10 +7178,29 @@ components: description: The unique identifier of the rule. example: python-best-practices/no-exit type: string + is_published: + description: Whether the rule is published. Forwarded from the rulesets endpoints; ignored by this operation. + type: boolean + is_testing: + description: Whether the rule is in testing mode. Forwarded from the rulesets endpoints; ignored by this operation. + type: boolean language: description: The programming language this rule targets. example: python type: string + last_updated_at: + description: The date and time when the rule was last modified. Server-assigned by the rulesets endpoints; ignored by this operation. + format: date-time + readOnly: true + type: string + last_updated_by: + description: The identifier of the user or system that last updated the rule. Server-assigned by the rulesets endpoints; ignored by this operation. + readOnly: true + type: string + name: + description: The name of the rule. Forwarded from the rulesets endpoints; ignored by this operation. + example: no-exit + type: string regex: description: A base64-encoded regex pattern used by the rule, applicable when rule type is `REGEX`. nullable: true @@ -7153,6 +7209,17 @@ components: description: The severity of findings from this rule (for example, `ERROR`, `WARNING`). example: WARNING type: string + short_description: + description: A brief summary of what the rule detects. Forwarded from the rulesets endpoints; ignored by this operation. + type: string + should_use_ai_fix: + description: Whether an AI-generated fix should be offered. Forwarded from the rulesets endpoints; ignored by this operation. + type: boolean + tests: + description: The test cases associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation. + items: + $ref: '#/components/schemas/AnalysisRequestRuleTest' + type: array tree_sitter_query: description: The base64-encoded tree-sitter query used by the rule. example: KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA== @@ -7171,6 +7238,32 @@ components: - type - code type: object + AnalysisRequestRuleArgument: + description: A configurable argument of a forwarded static analysis rule. + properties: + description: + description: An explanation of the argument's purpose and accepted values. + type: string + name: + description: The name of the rule argument. + type: string + type: object + AnalysisRequestRuleTest: + description: A test case of a forwarded static analysis rule. + properties: + annotation_count: + description: The expected number of findings the rule should produce against the test code. + format: int64 + maximum: 65535 + minimum: 0 + type: integer + code: + description: The source code snippet used as input for the rule test. + type: string + filename: + description: The filename associated with the test code snippet. + type: string + type: object AnalysisResponse: description: The response payload from running static analysis on source code. properties: @@ -11273,6 +11366,32 @@ components: - title - detail type: object + AstNode: + description: A node in the abstract syntax tree of the parsed source code. + properties: + ast_type: + description: The tree-sitter node type of this AST node. + example: module + type: string + children: + description: The child nodes of this AST node, or null for a leaf node. + items: + $ref: '#/components/schemas/AstNode' + nullable: true + type: array + end: + $ref: '#/components/schemas/AnalysisPosition' + field_name: + description: The name of the field this node occupies within its parent node, when the parent addresses it by name. + type: string + start: + $ref: '#/components/schemas/AnalysisPosition' + required: + - ast_type + - start + - end + - children + type: object AttachCaseRequest: description: Request for attaching security findings to a case. properties: @@ -29141,30 +29260,79 @@ components: - name type: object CustomRule: - description: A custom static analysis rule within a ruleset. + additionalProperties: false + description: |- + A custom static analysis rule within a ruleset, as supplied in a create or update + request. Nested rules are sent flat, without a `data`/`type`/`attributes` envelope. + `id` and `name` are client-supplied and must match each other. The remaining members + are server-assigned and read-only; they are declared so that a ruleset previously + read back can be supplied unchanged. properties: created_at: description: Creation timestamp example: "2026-01-09T13:00:57.473141Z" format: date-time + readOnly: true type: string created_by: description: Creator identifier example: foobarbaz + readOnly: true + type: string + id: + description: Rule identifier, which is the same as the rule name. + example: my-rule type: string last_revision: - $ref: "#/components/schemas/CustomRuleRevision" + $ref: "#/components/schemas/CustomRuleRevisionInput" description: Most recent revision nullable: true name: description: Rule name example: my-rule type: string + revisions: + description: Revision history of the rule. + items: + $ref: '#/components/schemas/CustomRuleRevisionInput' + nullable: true + type: array + required: + - id + - name + type: object + CustomRuleAttributes: + description: Attributes of a custom static analysis rule, including its most recent revision and revision history. + properties: + created_at: + description: Creation timestamp + example: "2026-01-09T13:00:57.473141Z" + format: date-time + type: string + created_by: + description: Creator identifier + example: foobarbaz + type: string + last_revision: + $ref: "#/components/schemas/CustomRuleRevisionEmbedded" + description: Most recent revision of the rule, or null when the rule has no revisions. + nullable: true + name: + description: Rule name + example: my-rule + type: string + revisions: + description: Revision history of the rule. + items: + $ref: '#/components/schemas/CustomRuleRevisionEmbedded' + nullable: true + type: array required: - name - created_at - created_by - last_revision + - revisions type: object CustomRuleDataType: description: Resource type @@ -29176,6 +29344,9 @@ components: CustomRuleRequest: description: Request body for creating or updating a custom rule. properties: + _authentication_token: + description: CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + type: string data: $ref: '#/components/schemas/CustomRuleRequestData' type: object @@ -29209,7 +29380,7 @@ components: description: Data object returned in a custom rule response, including its ID, type, and attributes. properties: attributes: - $ref: '#/components/schemas/CustomRule' + $ref: '#/components/schemas/CustomRuleAttributes' id: description: Rule identifier example: my-rule @@ -29244,6 +29415,7 @@ components: description: Rule arguments items: $ref: '#/components/schemas/Argument' + nullable: true type: array category: $ref: '#/components/schemas/CustomRuleRevisionAttributesCategory' @@ -29315,17 +29487,25 @@ components: items: description: A tag attached to the rule. type: string + nullable: true type: array tests: description: Rule tests items: $ref: '#/components/schemas/CustomRuleRevisionTest' + nullable: true type: array tree_sitter_query: description: Tree-sitter query example: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== type: string + version_id: + description: Monotonically increasing version number of the revision. + example: 1 + format: int64 + type: integer required: + - version_id - creation_message - short_description - description @@ -29337,14 +29517,11 @@ components: - created_by - severity - category - - cve - - cwe - arguments - tests - tags - is_published - should_use_ai_fix - - documentation_url - is_testing type: object CustomRuleRevisionAttributesCategory: @@ -29374,6 +29551,236 @@ components: type: string x-enum-varnames: - CUSTOM_RULE_REVISION + CustomRuleRevisionEmbedded: + description: A revision of a custom static analysis rule as embedded in a rule or ruleset response. + properties: + arguments: + description: Rule arguments + items: + $ref: '#/components/schemas/Argument' + nullable: true + type: array + category: + $ref: '#/components/schemas/CustomRuleRevisionAttributesCategory' + checksum: + description: Code checksum + example: 8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99 + type: string + code: + description: Rule code + example: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + type: string + created_at: + description: Creation timestamp + example: "2026-01-09T13:00:57.473141Z" + format: date-time + type: string + created_by: + description: Creator identifier + example: foobarbaz + type: string + creation_message: + description: Revision creation message + example: Initial revision + type: string + cve: + description: Associated CVE. Omitted when the revision has no associated CVE. + example: CVE-2024-1234 + type: string + cwe: + description: Associated CWE. Omitted when the revision has no associated CWE. + example: CWE-79 + type: string + description: + description: Full description + example: bG9uZyBkZXNjcmlwdGlvbg== + type: string + documentation_url: + description: Documentation URL. Omitted when the revision has no documentation URL. + example: https://docs.example.com/rules/my-rule + type: string + id: + description: Revision identifier + example: revision-123 + type: string + is_published: + description: Whether the revision is published + example: false + type: boolean + is_testing: + description: Whether this is a testing revision + example: false + type: boolean + language: + $ref: '#/components/schemas/Language' + severity: + $ref: '#/components/schemas/CustomRuleRevisionAttributesSeverity' + short_description: + description: Short description + example: c2hvcnQgZGVzY3JpcHRpb24= + type: string + should_use_ai_fix: + description: Whether to use AI for fixes + example: false + type: boolean + tags: + description: Rule tags + example: + - security + - custom + items: + description: A tag attached to the rule. + type: string + nullable: true + type: array + tests: + description: Rule tests + items: + $ref: '#/components/schemas/CustomRuleRevisionTest' + nullable: true + type: array + tree_sitter_query: + description: Tree-sitter query + example: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + type: string + version_id: + description: Monotonically increasing version number of the revision. + example: 1 + format: int64 + type: integer + required: + - id + - version_id + - creation_message + - short_description + - description + - code + - checksum + - language + - tree_sitter_query + - created_at + - created_by + - severity + - category + - arguments + - tests + - tags + - is_published + - should_use_ai_fix + - is_testing + type: object + CustomRuleRevisionInput: + additionalProperties: false + description: |- + A revision of a custom static analysis rule as embedded in a rule supplied by a create + or update request. Nested revisions are sent flat, without a `data`/`type`/`attributes` + envelope. `id`, `version_id`, `checksum`, `created_at` and `created_by` are server-assigned + and read-only; they are declared so that a ruleset previously read back can be supplied + unchanged. + properties: + arguments: + description: Rule arguments + items: + $ref: '#/components/schemas/Argument' + nullable: true + type: array + category: + $ref: '#/components/schemas/CustomRuleRevisionAttributesCategory' + checksum: + description: Code checksum + example: 8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99 + readOnly: true + type: string + code: + description: Rule code + example: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + type: string + created_at: + description: Creation timestamp + example: "2026-01-09T13:00:57.473141Z" + format: date-time + readOnly: true + type: string + created_by: + description: Creator identifier + example: foobarbaz + readOnly: true + type: string + creation_message: + description: Revision creation message + example: Initial revision + type: string + cve: + description: Associated CVE + example: CVE-2024-1234 + nullable: true + type: string + cwe: + description: Associated CWE + example: CWE-79 + nullable: true + type: string + description: + description: Base64-encoded full description + example: bG9uZyBkZXNjcmlwdGlvbg== + type: string + documentation_url: + description: Documentation URL + example: https://docs.example.com/rules/my-rule + nullable: true + type: string + id: + description: Revision identifier + example: revision-123 + readOnly: true + type: string + is_published: + description: Whether the revision should be published + example: false + type: boolean + is_testing: + description: Whether this is a testing revision + example: false + type: boolean + language: + $ref: '#/components/schemas/Language' + severity: + $ref: '#/components/schemas/CustomRuleRevisionAttributesSeverity' + short_description: + description: Base64-encoded short description + example: c2hvcnQgZGVzY3JpcHRpb24= + type: string + should_use_ai_fix: + description: Whether to use AI for fixes + example: false + type: boolean + tags: + description: Rule tags + example: + - security + - custom + items: + description: A tag attached to the rule. + type: string + nullable: true + type: array + tests: + description: Rule tests + items: + $ref: '#/components/schemas/CustomRuleRevisionTest' + nullable: true + type: array + tree_sitter_query: + description: Tree-sitter query + example: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + type: string + version_id: + description: Monotonically increasing version number of the revision. + example: 1 + format: int64 + readOnly: true + type: integer + type: object CustomRuleRevisionInputAttributes: description: Input attributes for creating or updating a custom rule revision. properties: @@ -29381,13 +29788,30 @@ components: description: Rule arguments items: $ref: '#/components/schemas/Argument' + nullable: true type: array category: $ref: '#/components/schemas/CustomRuleRevisionAttributesCategory' + checksum: + description: Code checksum. Derived by the API from `code`; ignored on write. + example: 8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99 + readOnly: true + type: string code: description: Rule code example: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== type: string + created_at: + description: Creation timestamp. Set by the API; ignored on write. + example: "2026-01-09T13:00:57.473141Z" + format: date-time + readOnly: true + type: string + created_by: + description: Creator identifier. Set by the API from the caller; ignored on write. + example: foobarbaz + readOnly: true + type: string creation_message: description: Revision creation message example: Initial revision @@ -29439,16 +29863,24 @@ components: items: description: A tag attached to the rule. type: string + nullable: true type: array tests: description: Rule tests items: $ref: '#/components/schemas/CustomRuleRevisionTest' + nullable: true type: array tree_sitter_query: description: Tree-sitter query example: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== type: string + version_id: + description: Monotonically increasing version number of the revision. Assigned by the API; ignored on write. + example: 1 + format: int64 + readOnly: true + type: integer required: - creation_message - short_description @@ -29458,19 +29890,19 @@ components: - tree_sitter_query - severity - category - - cve - - cwe - arguments - tests - tags - is_published - should_use_ai_fix - - documentation_url - is_testing type: object CustomRuleRevisionRequest: description: Request body for creating a new custom rule revision. properties: + _authentication_token: + description: CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + type: string data: $ref: '#/components/schemas/CustomRuleRevisionRequestData' type: object @@ -29500,6 +29932,8 @@ components: description: Expected violation count example: 1 format: int64 + maximum: 65535 + minimum: 0 type: integer code: description: Test code @@ -29562,7 +29996,7 @@ components: rules: description: Rules in the ruleset items: - $ref: '#/components/schemas/CustomRule' + $ref: '#/components/schemas/CustomRulesetRuleEmbedded' nullable: true type: array short_description: @@ -29602,24 +30036,37 @@ components: $ref: '#/components/schemas/CustomRulesetRequestData' type: object CustomRulesetRequestData: - description: Data object for a custom ruleset create or update request. + description: |- + Data object for a custom ruleset create or update request. The resource `id` is + required and must equal both `attributes.name` and, on update, the `ruleset_name` + path parameter; a request that omits it or supplies a different value is rejected + with a 412 response. properties: attributes: $ref: '#/components/schemas/CustomRulesetRequestDataAttributes' id: - description: Ruleset identifier + description: Ruleset identifier, which is the same as the ruleset name. + example: my-ruleset type: string type: $ref: '#/components/schemas/CustomRulesetDataType' + required: + - id + - type + - attributes type: object CustomRulesetRequestDataAttributes: - description: Attributes for creating or updating a custom ruleset. + description: |- + Attributes for creating or updating a custom ruleset. `name` is required and must + equal the resource `id`; the server rejects a mismatch with a 412 response. properties: description: description: Base64-encoded full description + example: bG9uZyBkZXNjcmlwdGlvbg== type: string name: - description: Ruleset name + description: Ruleset name, which must be the same as the resource identifier. + example: my-ruleset type: string rules: description: Rules in the ruleset @@ -29629,7 +30076,10 @@ components: type: array short_description: description: Base64-encoded short description + example: c2hvcnQgZGVzY3JpcHRpb24= type: string + required: + - name type: object CustomRulesetResponse: description: Response containing a single custom ruleset. @@ -29639,6 +30089,44 @@ components: required: - data type: object + CustomRulesetRuleEmbedded: + description: A custom static analysis rule as embedded in the rules list of a ruleset response. + properties: + created_at: + description: Creation timestamp + example: "2026-01-09T13:00:57.473141Z" + format: date-time + type: string + created_by: + description: Creator identifier + example: foobarbaz + type: string + id: + description: Rule identifier, which is the same as the rule name. + example: my-rule + type: string + last_revision: + $ref: "#/components/schemas/CustomRuleRevisionEmbedded" + description: Most recent revision of the rule, or null when the rule has no revisions. + nullable: true + name: + description: Rule name + example: my-rule + type: string + revisions: + description: Revision history of the rule. + items: + $ref: '#/components/schemas/CustomRuleRevisionEmbedded' + nullable: true + type: array + required: + - id + - name + - created_at + - created_by + - last_revision + - revisions + type: object CustomerOrgDisableRequest: description: Request payload for disabling the authenticated customer organization. properties: @@ -44979,6 +45467,9 @@ components: GetAstRequest: description: The request payload for parsing source code into an abstract syntax tree. properties: + _authentication_token: + description: CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + type: string data: $ref: '#/components/schemas/GetAstRequestData' required: @@ -45041,23 +45532,25 @@ components: attributes: $ref: '#/components/schemas/GetAstResponseDataAttributes' id: - description: The identifier of the get-AST response resource. + description: The identifier of the get-AST response resource, echoed from the request. + example: "" type: string type: $ref: '#/components/schemas/GetAstResponseDataType' required: + - id - type - attributes type: object GetAstResponseDataAttributes: description: The attributes of the get-AST response, containing the parsed abstract syntax tree. properties: - ast: - additionalProperties: {} - description: The parsed abstract syntax tree as a JSON object. - type: object + result: + $ref: "#/components/schemas/AstNode" + description: The root node of the parsed abstract syntax tree, or null when the source code could not be parsed. + nullable: true required: - - ast + - result type: object GetAstResponseDataType: default: get_ast_response @@ -45464,6 +45957,9 @@ components: GetMultipleRulesetsRequest: description: The request payload for retrieving rules for multiple rulesets in a single batch call. properties: + _authentication_token: + description: CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + type: string data: $ref: '#/components/schemas/GetMultipleRulesetsRequestData' type: object @@ -45510,6 +46006,8 @@ components: properties: data: $ref: '#/components/schemas/GetMultipleRulesetsResponseData' + required: + - data type: object GetMultipleRulesetsResponseData: description: The primary data object in the get-multiple-rulesets response, containing the response attributes and resource type. @@ -45517,12 +46015,15 @@ components: attributes: $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributes' id: - description: The unique identifier of the get-multiple-rulesets response resource. + description: The unique identifier of the get-multiple-rulesets response resource, echoed from the request. + example: "" type: string type: $ref: '#/components/schemas/GetMultipleRulesetsResponseDataType' required: + - id - type + - attributes type: object GetMultipleRulesetsResponseDataAttributes: description: The attributes of the get-multiple-rulesets response, containing the list of requested rulesets. @@ -45532,17 +46033,23 @@ components: items: $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItems' type: array + required: + - rulesets type: object GetMultipleRulesetsResponseDataAttributesRulesetsItems: description: A ruleset returned in the response, containing its metadata and associated rules. properties: - data: - $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsData' description: description: A detailed description of the ruleset's purpose and the types of issues it targets. + example: "" + type: string + id: + description: The unique identifier of the ruleset, which is the same as its name. + example: "" type: string name: description: The unique name of the ruleset. + example: "" type: string rules: description: The list of static analysis rules included in this ruleset. @@ -45551,20 +46058,14 @@ components: type: array short_description: description: A brief summary of the ruleset, suitable for display in listings. + example: "" type: string required: - - data - type: object - GetMultipleRulesetsResponseDataAttributesRulesetsItemsData: - description: The resource identifier and type for a ruleset. - properties: - id: - description: The unique identifier of the ruleset resource. - type: string - type: - $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType' - required: - - type + - id + - name + - short_description + - description + - rules type: object GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType: default: rulesets @@ -45585,19 +46086,24 @@ components: type: array category: description: The category classifying the type of issue this rule detects (e.g., security, style, performance). + example: "" type: string checksum: description: A checksum of the rule definition used to detect changes. + example: "" type: string code: description: The rule implementation code used by the static analysis engine. + example: "" type: string created_at: description: The date and time when the rule was created. + example: "" format: date-time type: string created_by: description: The identifier of the user or system that created the rule. + example: "" type: string cve: description: The CVE identifier associated with the vulnerability this rule detects, if applicable. @@ -45605,10 +46111,9 @@ components: cwe: description: The CWE identifier associated with the weakness category this rule detects, if applicable. type: string - data: - $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData' description: description: A detailed explanation of what the rule detects and why it matters. + example: "" type: string documentation_url: description: A URL pointing to additional documentation for this rule. @@ -45616,36 +46121,49 @@ components: entity_checked: description: The code entity type (e.g., function, class, variable) that this rule inspects. type: string + id: + description: The unique identifier of the rule, which is the same as its name. + example: "" + type: string is_published: description: Indicates whether the rule is publicly published and available to all users. + example: false type: boolean is_testing: description: Indicates whether the rule is in testing mode and not yet promoted to production. + example: false type: boolean language: description: The programming language this rule applies to. + example: "" type: string last_updated_at: description: The date and time when the rule was last modified. + example: "" format: date-time type: string last_updated_by: description: The identifier of the user or system that last updated the rule. + example: "" type: string name: description: The unique name identifying this rule within its ruleset. + example: "" type: string regex: description: A regular expression pattern used by the rule for pattern-based detection. type: string severity: description: The severity level of findings produced by this rule (e.g., ERROR, WARNING, NOTICE). + example: "" type: string short_description: description: A brief summary of what the rule detects, suitable for display in listings. + example: "" type: string should_use_ai_fix: description: Indicates whether an AI-generated fix suggestion should be offered for findings from this rule. + example: false type: boolean tests: description: The list of test cases used to validate the rule's behavior. @@ -45657,9 +46175,28 @@ components: type: string type: description: The rule type indicating the detection mechanism used (e.g., tree_sitter, regex). + example: "" type: string required: - - data + - id + - name + - short_description + - description + - code + - language + - type + - checksum + - created_at + - created_by + - last_updated_at + - last_updated_by + - severity + - category + - arguments + - tests + - is_published + - should_use_ai_fix + - is_testing type: object GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems: description: An argument parameter for a static analysis rule, with a name and description. @@ -45671,26 +46208,6 @@ components: description: The name of the rule argument. type: string type: object - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData: - description: The resource identifier and type for a static analysis rule. - properties: - id: - description: The unique identifier of the rule resource. - type: string - type: - $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType' - required: - - type - type: object - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType: - default: rules - description: Rules resource type. - enum: - - rules - example: rules - type: string - x-enum-varnames: - - RULES GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems: description: A test case associated with a static analysis rule, containing the source code and expected annotation count. properties: @@ -214035,6 +214552,7 @@ paths: attributes: description: My custom ruleset. name: my-custom-ruleset + id: my-custom-ruleset type: custom_ruleset schema: $ref: '#/components/schemas/CustomRulesetRequest' @@ -214048,7 +214566,12 @@ paths: value: data: attributes: + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + description: Example ruleset description name: my-custom-ruleset + rules: [] + short_description: Short description id: my-custom-ruleset type: custom_ruleset schema: @@ -214201,12 +214724,13 @@ paths: value: data: attributes: + name: my-ruleset rules: - - created_at: "2026-01-09T13:00:57.473141Z" - created_by: foobarbaz + - id: my-rule last_revision: - id: revision-123 + creation_message: Initial revision name: my-rule + id: my-ruleset type: custom_ruleset schema: $ref: '#/components/schemas/CustomRulesetRequest' @@ -214289,10 +214813,27 @@ paths: created_at: "2024-01-01T00:00:00+00:00" created_by: example-handle last_revision: - attributes: {} + arguments: [] + category: SECURITY + checksum: 8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99 + code: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + creation_message: Initial revision + description: Example ruleset description id: revision-abc-123 - type: custom_rule_revision + is_published: true + is_testing: false + language: PYTHON + severity: ERROR + short_description: Short description + should_use_ai_fix: false + tags: [] + tests: [] + tree_sitter_query: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + version_id: 1 name: my-rule + revisions: [] id: my-rule type: custom_rule schema: @@ -214400,10 +214941,27 @@ paths: created_at: "2024-01-01T00:00:00+00:00" created_by: example-handle last_revision: - attributes: {} + arguments: [] + category: SECURITY + checksum: 8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99 + code: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + creation_message: Initial revision + description: Example ruleset description id: revision-abc-123 - type: custom_rule_revision + is_published: true + is_testing: false + language: PYTHON + severity: ERROR + short_description: Short description + should_use_ai_fix: false + tags: [] + tests: [] + tree_sitter_query: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + version_id: 1 name: my-rule + revisions: [] id: my-rule type: custom_rule schema: @@ -214482,10 +215040,7 @@ paths: created_at: "2024-01-01T00:00:00+00:00" created_by: example-handle creation_message: Initial revision - cve: - cwe: description: Example ruleset description - documentation_url: is_published: false is_testing: false language: PYTHON @@ -214495,6 +215050,7 @@ paths: tags: [] tests: [] tree_sitter_query: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + version_id: 1 id: revision-123 type: custom_rule_revision schema: @@ -214699,10 +215255,7 @@ paths: created_at: "2024-01-01T00:00:00+00:00" created_by: example-handle creation_message: Initial revision - cve: - cwe: description: Example ruleset description - documentation_url: is_published: false is_testing: false language: PYTHON @@ -214712,6 +215265,7 @@ paths: tags: [] tests: [] tree_sitter_query: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + version_id: 1 id: revision-123 type: custom_rule_revision schema: @@ -215020,7 +215574,16 @@ paths: value: data: attributes: - ast: {} + result: + ast_type: module + children: [] + end: + col: 11 + line: 1 + start: + col: 1 + line: 1 + id: abc-123 type: get_ast_response schema: $ref: '#/components/schemas/GetAstResponse' diff --git a/examples/v2/security-monitoring/CreateStaticAnalysisServerAnalysis.py b/examples/v2/security-monitoring/CreateStaticAnalysisServerAnalysis.py index 3d9700838c..32e4996d37 100644 --- a/examples/v2/security-monitoring/CreateStaticAnalysisServerAnalysis.py +++ b/examples/v2/security-monitoring/CreateStaticAnalysisServerAnalysis.py @@ -9,6 +9,8 @@ from datadog_api_client.v2.model.analysis_request_data_attributes import AnalysisRequestDataAttributes from datadog_api_client.v2.model.analysis_request_data_type import AnalysisRequestDataType from datadog_api_client.v2.model.analysis_request_rule import AnalysisRequestRule +from datadog_api_client.v2.model.analysis_request_rule_argument import AnalysisRequestRuleArgument +from datadog_api_client.v2.model.analysis_request_rule_test import AnalysisRequestRuleTest body = AnalysisRequest( data=AnalysisRequestData( @@ -19,14 +21,21 @@ language="python", rules=[ AnalysisRequestRule( + arguments=[ + AnalysisRequestRuleArgument(), + ], category="BEST_PRACTICES", checksum="abc123def456", code="ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=", entity_checked=None, id="python-best-practices/no-exit", language="python", + name="no-exit", regex=None, severity="WARNING", + tests=[ + AnalysisRequestRuleTest(), + ], tree_sitter_query="KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==", type="TREE_SITTER_QUERY", ), diff --git a/examples/v2/static-analysis/CreateCustomRuleset.py b/examples/v2/static-analysis/CreateCustomRuleset.py index f5683c5931..ce3bd2b9d9 100644 --- a/examples/v2/static-analysis/CreateCustomRuleset.py +++ b/examples/v2/static-analysis/CreateCustomRuleset.py @@ -6,29 +6,60 @@ from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi from datadog_api_client.v2.model.argument import Argument from datadog_api_client.v2.model.custom_rule import CustomRule -from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision -from datadog_api_client.v2.model.custom_rule_revision_attributes import CustomRuleRevisionAttributes from datadog_api_client.v2.model.custom_rule_revision_attributes_category import CustomRuleRevisionAttributesCategory from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import CustomRuleRevisionAttributesSeverity -from datadog_api_client.v2.model.custom_rule_revision_data_type import CustomRuleRevisionDataType +from datadog_api_client.v2.model.custom_rule_revision_input import CustomRuleRevisionInput from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest from datadog_api_client.v2.model.custom_ruleset_data_type import CustomRulesetDataType from datadog_api_client.v2.model.custom_ruleset_request import CustomRulesetRequest from datadog_api_client.v2.model.custom_ruleset_request_data import CustomRulesetRequestData from datadog_api_client.v2.model.custom_ruleset_request_data_attributes import CustomRulesetRequestDataAttributes from datadog_api_client.v2.model.language import Language -from datetime import datetime -from dateutil.tz import tzutc body = CustomRulesetRequest( data=CustomRulesetRequestData( attributes=CustomRulesetRequestDataAttributes( + description="bG9uZyBkZXNjcmlwdGlvbg==", + name="my-ruleset", rules=[ CustomRule( - created_at=datetime(2026, 1, 9, 13, 0, 57, 473141, tzinfo=tzutc()), - created_by="foobarbaz", - last_revision=CustomRuleRevision( - attributes=CustomRuleRevisionAttributes( + id="my-rule", + last_revision=CustomRuleRevisionInput( + arguments=[ + Argument( + description="YXJndW1lbnQgZGVzY3JpcHRpb24=", + name="YXJndW1lbnRfbmFtZQ==", + ), + ], + category=CustomRuleRevisionAttributesCategory.SECURITY, + code="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + creation_message="Initial revision", + cve="CVE-2024-1234", + cwe="CWE-79", + description="bG9uZyBkZXNjcmlwdGlvbg==", + documentation_url="https://docs.example.com/rules/my-rule", + is_published=False, + is_testing=False, + language=Language.PYTHON, + severity=CustomRuleRevisionAttributesSeverity.ERROR, + short_description="c2hvcnQgZGVzY3JpcHRpb24=", + should_use_ai_fix=False, + tags=[ + "security", + "custom", + ], + tests=[ + CustomRuleRevisionTest( + annotation_count=1, + code="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + filename="test.yaml", + ), + ], + tree_sitter_query="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + ), + name="my-rule", + revisions=[ + CustomRuleRevisionInput( arguments=[ Argument( description="YXJndW1lbnQgZGVzY3JpcHRpb24=", @@ -36,10 +67,7 @@ ), ], category=CustomRuleRevisionAttributesCategory.SECURITY, - checksum="8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", code="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", - created_at=datetime(2026, 1, 9, 13, 0, 57, 473141, tzinfo=tzutc()), - created_by="foobarbaz", creation_message="Initial revision", cve="CVE-2024-1234", cwe="CWE-79", @@ -64,13 +92,12 @@ ], tree_sitter_query="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", ), - id="revision-123", - type=CustomRuleRevisionDataType.CUSTOM_RULE_REVISION, - ), - name="my-rule", + ], ), ], + short_description="c2hvcnQgZGVzY3JpcHRpb24=", ), + id="my-ruleset", type=CustomRulesetDataType.CUSTOM_RULESET, ), ) diff --git a/examples/v2/static-analysis/UpdateCustomRuleset.py b/examples/v2/static-analysis/UpdateCustomRuleset.py index 3ef788254e..66ba59f090 100644 --- a/examples/v2/static-analysis/UpdateCustomRuleset.py +++ b/examples/v2/static-analysis/UpdateCustomRuleset.py @@ -6,29 +6,60 @@ from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi from datadog_api_client.v2.model.argument import Argument from datadog_api_client.v2.model.custom_rule import CustomRule -from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision -from datadog_api_client.v2.model.custom_rule_revision_attributes import CustomRuleRevisionAttributes from datadog_api_client.v2.model.custom_rule_revision_attributes_category import CustomRuleRevisionAttributesCategory from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import CustomRuleRevisionAttributesSeverity -from datadog_api_client.v2.model.custom_rule_revision_data_type import CustomRuleRevisionDataType +from datadog_api_client.v2.model.custom_rule_revision_input import CustomRuleRevisionInput from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest from datadog_api_client.v2.model.custom_ruleset_data_type import CustomRulesetDataType from datadog_api_client.v2.model.custom_ruleset_request import CustomRulesetRequest from datadog_api_client.v2.model.custom_ruleset_request_data import CustomRulesetRequestData from datadog_api_client.v2.model.custom_ruleset_request_data_attributes import CustomRulesetRequestDataAttributes from datadog_api_client.v2.model.language import Language -from datetime import datetime -from dateutil.tz import tzutc body = CustomRulesetRequest( data=CustomRulesetRequestData( attributes=CustomRulesetRequestDataAttributes( + description="bG9uZyBkZXNjcmlwdGlvbg==", + name="my-ruleset", rules=[ CustomRule( - created_at=datetime(2026, 1, 9, 13, 0, 57, 473141, tzinfo=tzutc()), - created_by="foobarbaz", - last_revision=CustomRuleRevision( - attributes=CustomRuleRevisionAttributes( + id="my-rule", + last_revision=CustomRuleRevisionInput( + arguments=[ + Argument( + description="YXJndW1lbnQgZGVzY3JpcHRpb24=", + name="YXJndW1lbnRfbmFtZQ==", + ), + ], + category=CustomRuleRevisionAttributesCategory.SECURITY, + code="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + creation_message="Initial revision", + cve="CVE-2024-1234", + cwe="CWE-79", + description="bG9uZyBkZXNjcmlwdGlvbg==", + documentation_url="https://docs.example.com/rules/my-rule", + is_published=False, + is_testing=False, + language=Language.PYTHON, + severity=CustomRuleRevisionAttributesSeverity.ERROR, + short_description="c2hvcnQgZGVzY3JpcHRpb24=", + should_use_ai_fix=False, + tags=[ + "security", + "custom", + ], + tests=[ + CustomRuleRevisionTest( + annotation_count=1, + code="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + filename="test.yaml", + ), + ], + tree_sitter_query="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + ), + name="my-rule", + revisions=[ + CustomRuleRevisionInput( arguments=[ Argument( description="YXJndW1lbnQgZGVzY3JpcHRpb24=", @@ -36,10 +67,7 @@ ), ], category=CustomRuleRevisionAttributesCategory.SECURITY, - checksum="8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", code="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", - created_at=datetime(2026, 1, 9, 13, 0, 57, 473141, tzinfo=tzutc()), - created_by="foobarbaz", creation_message="Initial revision", cve="CVE-2024-1234", cwe="CWE-79", @@ -64,13 +92,12 @@ ], tree_sitter_query="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", ), - id="revision-123", - type=CustomRuleRevisionDataType.CUSTOM_RULE_REVISION, - ), - name="my-rule", + ], ), ], + short_description="c2hvcnQgZGVzY3JpcHRpb24=", ), + id="my-ruleset", type=CustomRulesetDataType.CUSTOM_RULESET, ), ) diff --git a/src/datadog_api_client/v2/model/analysis_request.py b/src/datadog_api_client/v2/model/analysis_request.py index 1be2267c11..ca3a7295c8 100644 --- a/src/datadog_api_client/v2/model/analysis_request.py +++ b/src/datadog_api_client/v2/model/analysis_request.py @@ -3,11 +3,13 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import TYPE_CHECKING +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, + unset, + UnsetType, ) @@ -21,20 +23,27 @@ def openapi_types(_): from datadog_api_client.v2.model.analysis_request_data import AnalysisRequestData return { + "_authentication_token": (str,), "data": (AnalysisRequestData,), } attribute_map = { + "_authentication_token": "_authentication_token", "data": "data", } - def __init__(self_, data: AnalysisRequestData, **kwargs): + def __init__(self_, data: AnalysisRequestData, _authentication_token: Union[str, UnsetType] = unset, **kwargs): """ The request payload for running static analysis on source code. + :param _authentication_token: CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + :type _authentication_token: str, optional + :param data: The primary data object in the analysis request. :type data: AnalysisRequestData """ + if _authentication_token is not unset: + kwargs["_authentication_token"] = _authentication_token super().__init__(kwargs) self_.data = data diff --git a/src/datadog_api_client/v2/model/analysis_request_rule.py b/src/datadog_api_client/v2/model/analysis_request_rule.py index 7026b206b3..b316e56234 100644 --- a/src/datadog_api_client/v2/model/analysis_request_rule.py +++ b/src/datadog_api_client/v2/model/analysis_request_rule.py @@ -3,45 +3,90 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, + datetime, none_type, unset, UnsetType, ) +if TYPE_CHECKING: + from datadog_api_client.v2.model.analysis_request_rule_argument import AnalysisRequestRuleArgument + from datadog_api_client.v2.model.analysis_request_rule_test import AnalysisRequestRuleTest + + class AnalysisRequestRule(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.analysis_request_rule_argument import AnalysisRequestRuleArgument + from datadog_api_client.v2.model.analysis_request_rule_test import AnalysisRequestRuleTest + return { + "arguments": ([AnalysisRequestRuleArgument],), "category": (str,), "checksum": (str,), "code": (str,), + "created_at": (datetime,), + "created_by": (str,), + "cve": (str,), + "cwe": (str,), + "description": (str,), + "documentation_url": (str,), "entity_checked": (str, none_type), "id": (str,), + "is_published": (bool,), + "is_testing": (bool,), "language": (str,), + "last_updated_at": (datetime,), + "last_updated_by": (str,), + "name": (str,), "regex": (str, none_type), "severity": (str,), + "short_description": (str,), + "should_use_ai_fix": (bool,), + "tests": ([AnalysisRequestRuleTest],), "tree_sitter_query": (str,), "type": (str,), } attribute_map = { + "arguments": "arguments", "category": "category", "checksum": "checksum", "code": "code", + "created_at": "created_at", + "created_by": "created_by", + "cve": "cve", + "cwe": "cwe", + "description": "description", + "documentation_url": "documentation_url", "entity_checked": "entity_checked", "id": "id", + "is_published": "is_published", + "is_testing": "is_testing", "language": "language", + "last_updated_at": "last_updated_at", + "last_updated_by": "last_updated_by", + "name": "name", "regex": "regex", "severity": "severity", + "short_description": "short_description", + "should_use_ai_fix": "should_use_ai_fix", + "tests": "tests", "tree_sitter_query": "tree_sitter_query", "type": "type", } + read_only_vars = { + "created_at", + "created_by", + "last_updated_at", + "last_updated_by", + } def __init__( self_, @@ -53,12 +98,36 @@ def __init__( severity: str, tree_sitter_query: str, type: str, + arguments: Union[List[AnalysisRequestRuleArgument], UnsetType] = unset, + created_at: Union[datetime, UnsetType] = unset, + created_by: Union[str, UnsetType] = unset, + cve: Union[str, UnsetType] = unset, + cwe: Union[str, UnsetType] = unset, + description: Union[str, UnsetType] = unset, + documentation_url: Union[str, UnsetType] = unset, entity_checked: Union[str, none_type, UnsetType] = unset, + is_published: Union[bool, UnsetType] = unset, + is_testing: Union[bool, UnsetType] = unset, + last_updated_at: Union[datetime, UnsetType] = unset, + last_updated_by: Union[str, UnsetType] = unset, + name: Union[str, UnsetType] = unset, regex: Union[str, none_type, UnsetType] = unset, + short_description: Union[str, UnsetType] = unset, + should_use_ai_fix: Union[bool, UnsetType] = unset, + tests: Union[List[AnalysisRequestRuleTest], UnsetType] = unset, **kwargs, ): """ - A static analysis rule to apply during code analysis. + A static analysis rule to apply during code analysis. Clients forward complete rule + objects returned by the rulesets endpoints, so every member of that resource is + declared here; only ``id`` , ``category`` , ``checksum`` , ``language`` , ``severity`` , + ``tree_sitter_query`` , ``entity_checked`` , ``regex`` , ``type`` and ``code`` are read by this + operation and the rest are ignored. The schema stays open so that any member beyond + the forwarded rule resource is reported as a promotion candidate rather than + rejected; it can be closed once that telemetry confirms none remain. + + :param arguments: The configurable arguments accepted by the rule. Forwarded from the rulesets endpoints; ignored by this operation. + :type arguments: [AnalysisRequestRuleArgument], optional :param category: The category of the rule (for example, ``BEST_PRACTICES`` , ``SECURITY`` ). :type category: str @@ -69,31 +138,103 @@ def __init__( :param code: The base64-encoded rule implementation code. :type code: str + :param created_at: The date and time when the rule was created. Server-assigned by the rulesets endpoints; ignored by this operation. + :type created_at: datetime, optional + + :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 cve: The CVE identifier associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation. + :type cve: str, optional + + :param cwe: The CWE identifier associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation. + :type cwe: str, optional + + :param description: A detailed explanation of what the rule detects. Forwarded from the rulesets endpoints; ignored by this operation. + :type description: str, optional + + :param documentation_url: A URL pointing to the rule documentation. Forwarded from the rulesets endpoints; ignored by this operation. + :type documentation_url: str, optional + :param entity_checked: The code entity type checked by the rule, applicable when rule type is ``AST_CHECK``. :type entity_checked: str, none_type, optional :param id: The unique identifier of the rule. :type id: str + :param is_published: Whether the rule is published. Forwarded from the rulesets endpoints; ignored by this operation. + :type is_published: bool, optional + + :param is_testing: Whether the rule is in testing mode. Forwarded from the rulesets endpoints; ignored by this operation. + :type is_testing: bool, optional + :param language: The programming language this rule targets. :type language: str + :param last_updated_at: The date and time when the rule was last modified. Server-assigned by the rulesets endpoints; ignored by this operation. + :type last_updated_at: datetime, optional + + :param last_updated_by: The identifier of the user or system that last updated the rule. Server-assigned by the rulesets endpoints; ignored by this operation. + :type last_updated_by: str, optional + + :param name: The name of the rule. Forwarded from the rulesets endpoints; ignored by this operation. + :type name: str, optional + :param regex: A base64-encoded regex pattern used by the rule, applicable when rule type is ``REGEX``. :type regex: str, none_type, optional :param severity: The severity of findings from this rule (for example, ``ERROR`` , ``WARNING`` ). :type severity: str + :param short_description: A brief summary of what the rule detects. Forwarded from the rulesets endpoints; ignored by this operation. + :type short_description: str, optional + + :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 tests: The test cases associated with the rule. Forwarded from the rulesets endpoints; ignored by this operation. + :type tests: [AnalysisRequestRuleTest], optional + :param tree_sitter_query: The base64-encoded tree-sitter query used by the rule. :type tree_sitter_query: str :param type: The rule type indicating the detection mechanism (for example, ``TREE_SITTER_QUERY`` ). :type type: str """ + 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 cve is not unset: + kwargs["cve"] = cve + if cwe is not unset: + kwargs["cwe"] = cwe + if description is not unset: + kwargs["description"] = description + if documentation_url is not unset: + kwargs["documentation_url"] = documentation_url if entity_checked is not unset: kwargs["entity_checked"] = entity_checked + if is_published is not unset: + kwargs["is_published"] = is_published + if is_testing is not unset: + kwargs["is_testing"] = is_testing + if last_updated_at is not unset: + kwargs["last_updated_at"] = last_updated_at + if last_updated_by is not unset: + kwargs["last_updated_by"] = last_updated_by + if name is not unset: + kwargs["name"] = name if regex is not unset: kwargs["regex"] = regex + if short_description is not unset: + kwargs["short_description"] = short_description + if should_use_ai_fix is not unset: + kwargs["should_use_ai_fix"] = should_use_ai_fix + if tests is not unset: + kwargs["tests"] = tests super().__init__(kwargs) self_.category = category diff --git a/src/datadog_api_client/v2/model/analysis_request_rule_argument.py b/src/datadog_api_client/v2/model/analysis_request_rule_argument.py new file mode 100644 index 0000000000..3d75de92cb --- /dev/null +++ b/src/datadog_api_client/v2/model/analysis_request_rule_argument.py @@ -0,0 +1,43 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class AnalysisRequestRuleArgument(ModelNormal): + @cached_property + def openapi_types(_): + return { + "description": (str,), + "name": (str,), + } + + attribute_map = { + "description": "description", + "name": "name", + } + + def __init__(self_, description: Union[str, UnsetType] = unset, name: Union[str, UnsetType] = unset, **kwargs): + """ + A configurable argument of a forwarded static analysis rule. + + :param description: An explanation of the argument's purpose and accepted values. + :type description: str, optional + + :param name: The name of the rule argument. + :type name: str, optional + """ + if description is not unset: + kwargs["description"] = description + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/analysis_request_rule_test.py b/src/datadog_api_client/v2/model/analysis_request_rule_test.py new file mode 100644 index 0000000000..5e49f442e7 --- /dev/null +++ b/src/datadog_api_client/v2/model/analysis_request_rule_test.py @@ -0,0 +1,63 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class AnalysisRequestRuleTest(ModelNormal): + validations = { + "annotation_count": { + "inclusive_maximum": 65535, + "inclusive_minimum": 0, + }, + } + + @cached_property + def openapi_types(_): + return { + "annotation_count": (int,), + "code": (str,), + "filename": (str,), + } + + attribute_map = { + "annotation_count": "annotation_count", + "code": "code", + "filename": "filename", + } + + def __init__( + self_, + annotation_count: Union[int, UnsetType] = unset, + code: Union[str, UnsetType] = unset, + filename: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A test case of a forwarded static analysis rule. + + :param annotation_count: The expected number of findings the rule should produce against the test code. + :type annotation_count: int, optional + + :param code: The source code snippet used as input for the rule test. + :type code: str, optional + + :param filename: The filename associated with the test code snippet. + :type filename: str, optional + """ + if annotation_count is not unset: + kwargs["annotation_count"] = annotation_count + if code is not unset: + kwargs["code"] = code + if filename is not unset: + kwargs["filename"] = filename + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/ast_node.py b/src/datadog_api_client/v2/model/ast_node.py new file mode 100644 index 0000000000..58a5c8f49c --- /dev/null +++ b/src/datadog_api_client/v2/model/ast_node.py @@ -0,0 +1,76 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.analysis_position import AnalysisPosition + + +class AstNode(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.analysis_position import AnalysisPosition + + return { + "ast_type": (str,), + "children": ([AstNode], none_type), + "end": (AnalysisPosition,), + "field_name": (str,), + "start": (AnalysisPosition,), + } + + attribute_map = { + "ast_type": "ast_type", + "children": "children", + "end": "end", + "field_name": "field_name", + "start": "start", + } + + def __init__( + self_, + ast_type: str, + children: Union[List[AstNode], none_type], + end: AnalysisPosition, + start: AnalysisPosition, + field_name: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A node in the abstract syntax tree of the parsed source code. + + :param ast_type: The tree-sitter node type of this AST node. + :type ast_type: str + + :param children: The child nodes of this AST node, or null for a leaf node. + :type children: [AstNode], none_type + + :param end: A position in source code, identified by line and column numbers. + :type end: AnalysisPosition + + :param field_name: The name of the field this node occupies within its parent node, when the parent addresses it by name. + :type field_name: str, optional + + :param start: A position in source code, identified by line and column numbers. + :type start: AnalysisPosition + """ + if field_name is not unset: + kwargs["field_name"] = field_name + super().__init__(kwargs) + + self_.ast_type = ast_type + self_.children = children + self_.end = end + self_.start = start diff --git a/src/datadog_api_client/v2/model/custom_rule.py b/src/datadog_api_client/v2/model/custom_rule.py index 398496b5cf..7a5852f4ae 100644 --- a/src/datadog_api_client/v2/model/custom_rule.py +++ b/src/datadog_api_client/v2/model/custom_rule.py @@ -3,57 +3,101 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, datetime, + none_type, + unset, + UnsetType, ) if TYPE_CHECKING: - from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision + from datadog_api_client.v2.model.custom_rule_revision_input import CustomRuleRevisionInput class CustomRule(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + @cached_property def openapi_types(_): - from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision + from datadog_api_client.v2.model.custom_rule_revision_input import CustomRuleRevisionInput return { "created_at": (datetime,), "created_by": (str,), - "last_revision": (CustomRuleRevision,), + "id": (str,), + "last_revision": (CustomRuleRevisionInput,), "name": (str,), + "revisions": ([CustomRuleRevisionInput], none_type), } attribute_map = { "created_at": "created_at", "created_by": "created_by", + "id": "id", "last_revision": "last_revision", "name": "name", + "revisions": "revisions", + } + read_only_vars = { + "created_at", + "created_by", } - def __init__(self_, created_at: datetime, created_by: str, last_revision: CustomRuleRevision, name: str, **kwargs): + def __init__( + self_, + id: str, + name: str, + created_at: Union[datetime, UnsetType] = unset, + created_by: Union[str, UnsetType] = unset, + last_revision: Union[CustomRuleRevisionInput, UnsetType] = unset, + revisions: Union[List[CustomRuleRevisionInput], none_type, UnsetType] = unset, + **kwargs, + ): """ - A custom static analysis rule within a ruleset. + A custom static analysis rule within a ruleset, as supplied in a create or update + request. Nested rules are sent flat, without a ``data`` / ``type`` / ``attributes`` envelope. + ``id`` and ``name`` are client-supplied and must match each other. The remaining members + are server-assigned and read-only; they are declared so that a ruleset previously + read back can be supplied unchanged. :param created_at: Creation timestamp - :type created_at: datetime + :type created_at: datetime, optional :param created_by: Creator identifier - :type created_by: str + :type created_by: str, optional - :param last_revision: A specific revision of a custom static analysis rule. - :type last_revision: CustomRuleRevision + :param id: Rule identifier, which is the same as the rule name. + :type id: str + + :param last_revision: A revision of a custom static analysis rule as embedded in a rule supplied by a create + or update request. Nested revisions are sent flat, without a ``data`` / ``type`` / ``attributes`` + envelope. ``id`` , ``version_id`` , ``checksum`` , ``created_at`` and ``created_by`` are server-assigned + and read-only; they are declared so that a ruleset previously read back can be supplied + unchanged. + :type last_revision: CustomRuleRevisionInput, optional :param name: Rule name :type name: str + + :param revisions: Revision history of the rule. + :type revisions: [CustomRuleRevisionInput], none_type, optional """ + if created_at is not unset: + kwargs["created_at"] = created_at + if created_by is not unset: + kwargs["created_by"] = created_by + if last_revision is not unset: + kwargs["last_revision"] = last_revision + if revisions is not unset: + kwargs["revisions"] = revisions super().__init__(kwargs) - self_.created_at = created_at - self_.created_by = created_by - self_.last_revision = last_revision + self_.id = id self_.name = name diff --git a/src/datadog_api_client/v2/model/custom_rule_attributes.py b/src/datadog_api_client/v2/model/custom_rule_attributes.py new file mode 100644 index 0000000000..0af1800ef3 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_attributes.py @@ -0,0 +1,74 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_revision_embedded import CustomRuleRevisionEmbedded + + +class CustomRuleAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_revision_embedded import CustomRuleRevisionEmbedded + + return { + "created_at": (datetime,), + "created_by": (str,), + "last_revision": (CustomRuleRevisionEmbedded,), + "name": (str,), + "revisions": ([CustomRuleRevisionEmbedded], none_type), + } + + attribute_map = { + "created_at": "created_at", + "created_by": "created_by", + "last_revision": "last_revision", + "name": "name", + "revisions": "revisions", + } + + def __init__( + self_, + created_at: datetime, + created_by: str, + last_revision: CustomRuleRevisionEmbedded, + name: str, + revisions: Union[List[CustomRuleRevisionEmbedded], none_type], + **kwargs, + ): + """ + Attributes of a custom static analysis rule, including its most recent revision and revision history. + + :param created_at: Creation timestamp + :type created_at: datetime + + :param created_by: Creator identifier + :type created_by: str + + :param last_revision: A revision of a custom static analysis rule as embedded in a rule or ruleset response. + :type last_revision: CustomRuleRevisionEmbedded + + :param name: Rule name + :type name: str + + :param revisions: Revision history of the rule. + :type revisions: [CustomRuleRevisionEmbedded], none_type + """ + super().__init__(kwargs) + + self_.created_at = created_at + self_.created_by = created_by + self_.last_revision = last_revision + self_.name = name + self_.revisions = revisions diff --git a/src/datadog_api_client/v2/model/custom_rule_request.py b/src/datadog_api_client/v2/model/custom_rule_request.py index 2a9f5ba966..fdcc69b98a 100644 --- a/src/datadog_api_client/v2/model/custom_rule_request.py +++ b/src/datadog_api_client/v2/model/custom_rule_request.py @@ -23,20 +23,32 @@ def openapi_types(_): from datadog_api_client.v2.model.custom_rule_request_data import CustomRuleRequestData return { + "_authentication_token": (str,), "data": (CustomRuleRequestData,), } attribute_map = { + "_authentication_token": "_authentication_token", "data": "data", } - def __init__(self_, data: Union[CustomRuleRequestData, UnsetType] = unset, **kwargs): + def __init__( + self_, + _authentication_token: Union[str, UnsetType] = unset, + data: Union[CustomRuleRequestData, UnsetType] = unset, + **kwargs, + ): """ Request body for creating or updating a custom rule. + :param _authentication_token: CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + :type _authentication_token: str, optional + :param data: Data object for a custom rule create or update request. :type data: CustomRuleRequestData, optional """ + if _authentication_token is not unset: + kwargs["_authentication_token"] = _authentication_token if data is not unset: kwargs["data"] = data super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_rule_response_data.py b/src/datadog_api_client/v2/model/custom_rule_response_data.py index bebdc2be57..422630f7d3 100644 --- a/src/datadog_api_client/v2/model/custom_rule_response_data.py +++ b/src/datadog_api_client/v2/model/custom_rule_response_data.py @@ -12,18 +12,18 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.custom_rule import CustomRule + from datadog_api_client.v2.model.custom_rule_attributes import CustomRuleAttributes from datadog_api_client.v2.model.custom_rule_data_type import CustomRuleDataType class CustomRuleResponseData(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.custom_rule import CustomRule + from datadog_api_client.v2.model.custom_rule_attributes import CustomRuleAttributes from datadog_api_client.v2.model.custom_rule_data_type import CustomRuleDataType return { - "attributes": (CustomRule,), + "attributes": (CustomRuleAttributes,), "id": (str,), "type": (CustomRuleDataType,), } @@ -34,12 +34,12 @@ def openapi_types(_): "type": "type", } - def __init__(self_, attributes: CustomRule, id: str, type: CustomRuleDataType, **kwargs): + def __init__(self_, attributes: CustomRuleAttributes, id: str, type: CustomRuleDataType, **kwargs): """ Data object returned in a custom rule response, including its ID, type, and attributes. - :param attributes: A custom static analysis rule within a ruleset. - :type attributes: CustomRule + :param attributes: Attributes of a custom static analysis rule, including its most recent revision and revision history. + :type attributes: CustomRuleAttributes :param id: Rule identifier :type id: str diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_attributes.py b/src/datadog_api_client/v2/model/custom_rule_revision_attributes.py index 5cfd65e182..8b56e610ab 100644 --- a/src/datadog_api_client/v2/model/custom_rule_revision_attributes.py +++ b/src/datadog_api_client/v2/model/custom_rule_revision_attributes.py @@ -10,6 +10,8 @@ cached_property, datetime, none_type, + unset, + UnsetType, ) @@ -39,7 +41,7 @@ def openapi_types(_): from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest return { - "arguments": ([Argument],), + "arguments": ([Argument], none_type), "category": (CustomRuleRevisionAttributesCategory,), "checksum": (str,), "code": (str,), @@ -56,9 +58,10 @@ def openapi_types(_): "severity": (CustomRuleRevisionAttributesSeverity,), "short_description": (str,), "should_use_ai_fix": (bool,), - "tags": ([str],), - "tests": ([CustomRuleRevisionTest],), + "tags": ([str], none_type), + "tests": ([CustomRuleRevisionTest], none_type), "tree_sitter_query": (str,), + "version_id": (int,), } attribute_map = { @@ -82,37 +85,39 @@ def openapi_types(_): "tags": "tags", "tests": "tests", "tree_sitter_query": "tree_sitter_query", + "version_id": "version_id", } def __init__( self_, - arguments: List[Argument], + arguments: Union[List[Argument], none_type], category: CustomRuleRevisionAttributesCategory, checksum: str, code: str, created_at: datetime, created_by: str, creation_message: str, - cve: Union[str, none_type], - cwe: Union[str, none_type], description: str, - documentation_url: Union[str, none_type], is_published: bool, is_testing: bool, language: Language, severity: CustomRuleRevisionAttributesSeverity, short_description: str, should_use_ai_fix: bool, - tags: List[str], - tests: List[CustomRuleRevisionTest], + tags: Union[List[str], none_type], + tests: Union[List[CustomRuleRevisionTest], none_type], tree_sitter_query: str, + version_id: int, + cve: Union[str, none_type, UnsetType] = unset, + cwe: Union[str, none_type, UnsetType] = unset, + documentation_url: Union[str, none_type, UnsetType] = unset, **kwargs, ): """ Attributes of a custom rule revision, including code, metadata, and test cases. :param arguments: Rule arguments - :type arguments: [Argument] + :type arguments: [Argument], none_type :param category: Rule category :type category: CustomRuleRevisionAttributesCategory @@ -133,16 +138,16 @@ def __init__( :type creation_message: str :param cve: Associated CVE - :type cve: str, none_type + :type cve: str, none_type, optional :param cwe: Associated CWE - :type cwe: str, none_type + :type cwe: str, none_type, optional :param description: Full description :type description: str :param documentation_url: Documentation URL - :type documentation_url: str, none_type + :type documentation_url: str, none_type, optional :param is_published: Whether the revision is published :type is_published: bool @@ -163,14 +168,23 @@ def __init__( :type should_use_ai_fix: bool :param tags: Rule tags - :type tags: [str] + :type tags: [str], none_type :param tests: Rule tests - :type tests: [CustomRuleRevisionTest] + :type tests: [CustomRuleRevisionTest], none_type :param tree_sitter_query: Tree-sitter query :type tree_sitter_query: str + + :param version_id: Monotonically increasing version number of the revision. + :type version_id: int """ + if cve is not unset: + kwargs["cve"] = cve + if cwe is not unset: + kwargs["cwe"] = cwe + if documentation_url is not unset: + kwargs["documentation_url"] = documentation_url super().__init__(kwargs) self_.arguments = arguments @@ -180,10 +194,7 @@ def __init__( self_.created_at = created_at self_.created_by = created_by self_.creation_message = creation_message - self_.cve = cve - self_.cwe = cwe self_.description = description - self_.documentation_url = documentation_url self_.is_published = is_published self_.is_testing = is_testing self_.language = language @@ -193,3 +204,4 @@ def __init__( self_.tags = tags self_.tests = tests self_.tree_sitter_query = tree_sitter_query + self_.version_id = version_id diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_embedded.py b/src/datadog_api_client/v2/model/custom_rule_revision_embedded.py new file mode 100644 index 0000000000..fd1f77beca --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision_embedded.py @@ -0,0 +1,214 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.argument import Argument + from datadog_api_client.v2.model.custom_rule_revision_attributes_category import ( + CustomRuleRevisionAttributesCategory, + ) + from datadog_api_client.v2.model.language import Language + from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import ( + CustomRuleRevisionAttributesSeverity, + ) + from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest + + +class CustomRuleRevisionEmbedded(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.argument import Argument + from datadog_api_client.v2.model.custom_rule_revision_attributes_category import ( + CustomRuleRevisionAttributesCategory, + ) + from datadog_api_client.v2.model.language import Language + from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import ( + CustomRuleRevisionAttributesSeverity, + ) + from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest + + return { + "arguments": ([Argument], none_type), + "category": (CustomRuleRevisionAttributesCategory,), + "checksum": (str,), + "code": (str,), + "created_at": (datetime,), + "created_by": (str,), + "creation_message": (str,), + "cve": (str,), + "cwe": (str,), + "description": (str,), + "documentation_url": (str,), + "id": (str,), + "is_published": (bool,), + "is_testing": (bool,), + "language": (Language,), + "severity": (CustomRuleRevisionAttributesSeverity,), + "short_description": (str,), + "should_use_ai_fix": (bool,), + "tags": ([str], none_type), + "tests": ([CustomRuleRevisionTest], none_type), + "tree_sitter_query": (str,), + "version_id": (int,), + } + + attribute_map = { + "arguments": "arguments", + "category": "category", + "checksum": "checksum", + "code": "code", + "created_at": "created_at", + "created_by": "created_by", + "creation_message": "creation_message", + "cve": "cve", + "cwe": "cwe", + "description": "description", + "documentation_url": "documentation_url", + "id": "id", + "is_published": "is_published", + "is_testing": "is_testing", + "language": "language", + "severity": "severity", + "short_description": "short_description", + "should_use_ai_fix": "should_use_ai_fix", + "tags": "tags", + "tests": "tests", + "tree_sitter_query": "tree_sitter_query", + "version_id": "version_id", + } + + def __init__( + self_, + arguments: Union[List[Argument], none_type], + category: CustomRuleRevisionAttributesCategory, + checksum: str, + code: str, + created_at: datetime, + created_by: str, + creation_message: str, + description: str, + id: str, + is_published: bool, + is_testing: bool, + language: Language, + severity: CustomRuleRevisionAttributesSeverity, + short_description: str, + should_use_ai_fix: bool, + tags: Union[List[str], none_type], + tests: Union[List[CustomRuleRevisionTest], none_type], + tree_sitter_query: str, + version_id: int, + cve: Union[str, UnsetType] = unset, + cwe: Union[str, UnsetType] = unset, + documentation_url: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A revision of a custom static analysis rule as embedded in a rule or ruleset response. + + :param arguments: Rule arguments + :type arguments: [Argument], none_type + + :param category: Rule category + :type category: CustomRuleRevisionAttributesCategory + + :param checksum: Code checksum + :type checksum: str + + :param code: Rule code + :type code: str + + :param created_at: Creation timestamp + :type created_at: datetime + + :param created_by: Creator identifier + :type created_by: str + + :param creation_message: Revision creation message + :type creation_message: str + + :param cve: Associated CVE. Omitted when the revision has no associated CVE. + :type cve: str, optional + + :param cwe: Associated CWE. Omitted when the revision has no associated CWE. + :type cwe: str, optional + + :param description: Full description + :type description: str + + :param documentation_url: Documentation URL. Omitted when the revision has no documentation URL. + :type documentation_url: str, optional + + :param id: Revision identifier + :type id: str + + :param is_published: Whether the revision is published + :type is_published: bool + + :param is_testing: Whether this is a testing revision + :type is_testing: bool + + :param language: Programming language + :type language: Language + + :param severity: Rule severity + :type severity: CustomRuleRevisionAttributesSeverity + + :param short_description: Short description + :type short_description: str + + :param should_use_ai_fix: Whether to use AI for fixes + :type should_use_ai_fix: bool + + :param tags: Rule tags + :type tags: [str], none_type + + :param tests: Rule tests + :type tests: [CustomRuleRevisionTest], none_type + + :param tree_sitter_query: Tree-sitter query + :type tree_sitter_query: str + + :param version_id: Monotonically increasing version number of the revision. + :type version_id: int + """ + if cve is not unset: + kwargs["cve"] = cve + if cwe is not unset: + kwargs["cwe"] = cwe + if documentation_url is not unset: + kwargs["documentation_url"] = documentation_url + super().__init__(kwargs) + + self_.arguments = arguments + self_.category = category + self_.checksum = checksum + self_.code = code + self_.created_at = created_at + self_.created_by = created_by + self_.creation_message = creation_message + self_.description = description + self_.id = id + self_.is_published = is_published + self_.is_testing = is_testing + self_.language = language + self_.severity = severity + self_.short_description = short_description + self_.should_use_ai_fix = should_use_ai_fix + self_.tags = tags + self_.tests = tests + self_.tree_sitter_query = tree_sitter_query + self_.version_id = version_id diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_input.py b/src/datadog_api_client/v2/model/custom_rule_revision_input.py new file mode 100644 index 0000000000..f6cfa0a72a --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision_input.py @@ -0,0 +1,247 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.argument import Argument + from datadog_api_client.v2.model.custom_rule_revision_attributes_category import ( + CustomRuleRevisionAttributesCategory, + ) + from datadog_api_client.v2.model.language import Language + from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import ( + CustomRuleRevisionAttributesSeverity, + ) + from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest + + +class CustomRuleRevisionInput(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.argument import Argument + from datadog_api_client.v2.model.custom_rule_revision_attributes_category import ( + CustomRuleRevisionAttributesCategory, + ) + from datadog_api_client.v2.model.language import Language + from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import ( + CustomRuleRevisionAttributesSeverity, + ) + from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest + + return { + "arguments": ([Argument], none_type), + "category": (CustomRuleRevisionAttributesCategory,), + "checksum": (str,), + "code": (str,), + "created_at": (datetime,), + "created_by": (str,), + "creation_message": (str,), + "cve": (str, none_type), + "cwe": (str, none_type), + "description": (str,), + "documentation_url": (str, none_type), + "id": (str,), + "is_published": (bool,), + "is_testing": (bool,), + "language": (Language,), + "severity": (CustomRuleRevisionAttributesSeverity,), + "short_description": (str,), + "should_use_ai_fix": (bool,), + "tags": ([str], none_type), + "tests": ([CustomRuleRevisionTest], none_type), + "tree_sitter_query": (str,), + "version_id": (int,), + } + + attribute_map = { + "arguments": "arguments", + "category": "category", + "checksum": "checksum", + "code": "code", + "created_at": "created_at", + "created_by": "created_by", + "creation_message": "creation_message", + "cve": "cve", + "cwe": "cwe", + "description": "description", + "documentation_url": "documentation_url", + "id": "id", + "is_published": "is_published", + "is_testing": "is_testing", + "language": "language", + "severity": "severity", + "short_description": "short_description", + "should_use_ai_fix": "should_use_ai_fix", + "tags": "tags", + "tests": "tests", + "tree_sitter_query": "tree_sitter_query", + "version_id": "version_id", + } + read_only_vars = { + "checksum", + "created_at", + "created_by", + "id", + "version_id", + } + + def __init__( + self_, + arguments: Union[List[Argument], none_type, UnsetType] = unset, + category: Union[CustomRuleRevisionAttributesCategory, UnsetType] = unset, + checksum: Union[str, UnsetType] = unset, + code: Union[str, UnsetType] = unset, + created_at: Union[datetime, UnsetType] = unset, + created_by: Union[str, UnsetType] = unset, + creation_message: Union[str, UnsetType] = unset, + cve: Union[str, none_type, UnsetType] = unset, + cwe: Union[str, none_type, UnsetType] = unset, + description: Union[str, UnsetType] = unset, + documentation_url: Union[str, none_type, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + is_published: Union[bool, UnsetType] = unset, + is_testing: Union[bool, UnsetType] = unset, + language: Union[Language, UnsetType] = unset, + severity: Union[CustomRuleRevisionAttributesSeverity, UnsetType] = unset, + short_description: Union[str, UnsetType] = unset, + should_use_ai_fix: Union[bool, UnsetType] = unset, + tags: Union[List[str], none_type, UnsetType] = unset, + tests: Union[List[CustomRuleRevisionTest], none_type, UnsetType] = unset, + tree_sitter_query: Union[str, UnsetType] = unset, + version_id: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + A revision of a custom static analysis rule as embedded in a rule supplied by a create + or update request. Nested revisions are sent flat, without a ``data`` / ``type`` / ``attributes`` + envelope. ``id`` , ``version_id`` , ``checksum`` , ``created_at`` and ``created_by`` are server-assigned + and read-only; they are declared so that a ruleset previously read back can be supplied + unchanged. + + :param arguments: Rule arguments + :type arguments: [Argument], none_type, optional + + :param category: Rule category + :type category: CustomRuleRevisionAttributesCategory, optional + + :param checksum: Code checksum + :type checksum: str, optional + + :param code: Rule code + :type code: str, optional + + :param created_at: Creation timestamp + :type created_at: datetime, optional + + :param created_by: Creator identifier + :type created_by: str, optional + + :param creation_message: Revision creation message + :type creation_message: str, optional + + :param cve: Associated CVE + :type cve: str, none_type, optional + + :param cwe: Associated CWE + :type cwe: str, none_type, optional + + :param description: Base64-encoded full description + :type description: str, optional + + :param documentation_url: Documentation URL + :type documentation_url: str, none_type, optional + + :param id: Revision identifier + :type id: str, optional + + :param is_published: Whether the revision should be published + :type is_published: bool, optional + + :param is_testing: Whether this is a testing revision + :type is_testing: bool, optional + + :param language: Programming language + :type language: Language, optional + + :param severity: Rule severity + :type severity: CustomRuleRevisionAttributesSeverity, optional + + :param short_description: Base64-encoded short description + :type short_description: str, optional + + :param should_use_ai_fix: Whether to use AI for fixes + :type should_use_ai_fix: bool, optional + + :param tags: Rule tags + :type tags: [str], none_type, optional + + :param tests: Rule tests + :type tests: [CustomRuleRevisionTest], none_type, optional + + :param tree_sitter_query: Tree-sitter query + :type tree_sitter_query: str, optional + + :param version_id: Monotonically increasing version number of the revision. + :type version_id: int, optional + """ + if arguments is not unset: + kwargs["arguments"] = arguments + if category is not unset: + kwargs["category"] = category + if checksum is not unset: + kwargs["checksum"] = checksum + if code is not unset: + kwargs["code"] = code + 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: + kwargs["cwe"] = cwe + if description is not unset: + kwargs["description"] = description + if documentation_url is not unset: + kwargs["documentation_url"] = documentation_url + if id is not unset: + kwargs["id"] = id + if is_published is not unset: + kwargs["is_published"] = is_published + if is_testing is not unset: + kwargs["is_testing"] = is_testing + if language is not unset: + kwargs["language"] = language + if severity is not unset: + kwargs["severity"] = severity + if short_description is not unset: + 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 tree_sitter_query is not unset: + kwargs["tree_sitter_query"] = tree_sitter_query + if version_id is not unset: + kwargs["version_id"] = version_id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_input_attributes.py b/src/datadog_api_client/v2/model/custom_rule_revision_input_attributes.py index 395484173e..7760ec4de5 100644 --- a/src/datadog_api_client/v2/model/custom_rule_revision_input_attributes.py +++ b/src/datadog_api_client/v2/model/custom_rule_revision_input_attributes.py @@ -8,7 +8,10 @@ from datadog_api_client.model_utils import ( ModelNormal, cached_property, + datetime, none_type, + unset, + UnsetType, ) @@ -38,9 +41,12 @@ def openapi_types(_): from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest return { - "arguments": ([Argument],), + "arguments": ([Argument], none_type), "category": (CustomRuleRevisionAttributesCategory,), + "checksum": (str,), "code": (str,), + "created_at": (datetime,), + "created_by": (str,), "creation_message": (str,), "cve": (str, none_type), "cwe": (str, none_type), @@ -52,15 +58,19 @@ def openapi_types(_): "severity": (CustomRuleRevisionAttributesSeverity,), "short_description": (str,), "should_use_ai_fix": (bool,), - "tags": ([str],), - "tests": ([CustomRuleRevisionTest],), + "tags": ([str], none_type), + "tests": ([CustomRuleRevisionTest], none_type), "tree_sitter_query": (str,), + "version_id": (int,), } attribute_map = { "arguments": "arguments", "category": "category", + "checksum": "checksum", "code": "code", + "created_at": "created_at", + "created_by": "created_by", "creation_message": "creation_message", "cve": "cve", "cwe": "cwe", @@ -75,55 +85,75 @@ def openapi_types(_): "tags": "tags", "tests": "tests", "tree_sitter_query": "tree_sitter_query", + "version_id": "version_id", + } + read_only_vars = { + "checksum", + "created_at", + "created_by", + "version_id", } def __init__( self_, - arguments: List[Argument], + arguments: Union[List[Argument], none_type], category: CustomRuleRevisionAttributesCategory, code: str, creation_message: str, - cve: Union[str, none_type], - cwe: Union[str, none_type], description: str, - documentation_url: Union[str, none_type], is_published: bool, is_testing: bool, language: Language, severity: CustomRuleRevisionAttributesSeverity, short_description: str, should_use_ai_fix: bool, - tags: List[str], - tests: List[CustomRuleRevisionTest], + tags: Union[List[str], none_type], + tests: Union[List[CustomRuleRevisionTest], none_type], tree_sitter_query: str, + checksum: Union[str, UnsetType] = unset, + created_at: Union[datetime, UnsetType] = unset, + created_by: Union[str, UnsetType] = unset, + cve: Union[str, none_type, UnsetType] = unset, + cwe: Union[str, none_type, UnsetType] = unset, + documentation_url: Union[str, none_type, UnsetType] = unset, + version_id: Union[int, UnsetType] = unset, **kwargs, ): """ Input attributes for creating or updating a custom rule revision. :param arguments: Rule arguments - :type arguments: [Argument] + :type arguments: [Argument], none_type :param category: Rule category :type category: CustomRuleRevisionAttributesCategory + :param checksum: Code checksum. Derived by the API from ``code`` ; ignored on write. + :type checksum: str, optional + :param code: Rule code :type code: str + :param created_at: Creation timestamp. Set by the API; ignored on write. + :type created_at: datetime, optional + + :param created_by: Creator identifier. Set by the API from the caller; ignored on write. + :type created_by: str, optional + :param creation_message: Revision creation message :type creation_message: str :param cve: Associated CVE - :type cve: str, none_type + :type cve: str, none_type, optional :param cwe: Associated CWE - :type cwe: str, none_type + :type cwe: str, none_type, optional :param description: Full description :type description: str :param documentation_url: Documentation URL - :type documentation_url: str, none_type + :type documentation_url: str, none_type, optional :param is_published: Whether the revision is published :type is_published: bool @@ -144,24 +174,38 @@ def __init__( :type should_use_ai_fix: bool :param tags: Rule tags - :type tags: [str] + :type tags: [str], none_type :param tests: Rule tests - :type tests: [CustomRuleRevisionTest] + :type tests: [CustomRuleRevisionTest], none_type :param tree_sitter_query: Tree-sitter query :type tree_sitter_query: str + + :param version_id: Monotonically increasing version number of the revision. Assigned by the API; ignored on write. + :type version_id: int, optional """ + if checksum is not unset: + kwargs["checksum"] = checksum + if created_at is not unset: + kwargs["created_at"] = created_at + if created_by is not unset: + kwargs["created_by"] = created_by + if cve is not unset: + kwargs["cve"] = cve + if cwe is not unset: + kwargs["cwe"] = cwe + if documentation_url is not unset: + kwargs["documentation_url"] = documentation_url + if version_id is not unset: + kwargs["version_id"] = version_id super().__init__(kwargs) self_.arguments = arguments self_.category = category self_.code = code self_.creation_message = creation_message - self_.cve = cve - self_.cwe = cwe self_.description = description - self_.documentation_url = documentation_url self_.is_published = is_published self_.is_testing = is_testing self_.language = language diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_request.py b/src/datadog_api_client/v2/model/custom_rule_revision_request.py index b24ab0a5e6..7269b473b5 100644 --- a/src/datadog_api_client/v2/model/custom_rule_revision_request.py +++ b/src/datadog_api_client/v2/model/custom_rule_revision_request.py @@ -23,20 +23,32 @@ def openapi_types(_): from datadog_api_client.v2.model.custom_rule_revision_request_data import CustomRuleRevisionRequestData return { + "_authentication_token": (str,), "data": (CustomRuleRevisionRequestData,), } attribute_map = { + "_authentication_token": "_authentication_token", "data": "data", } - def __init__(self_, data: Union[CustomRuleRevisionRequestData, UnsetType] = unset, **kwargs): + def __init__( + self_, + _authentication_token: Union[str, UnsetType] = unset, + data: Union[CustomRuleRevisionRequestData, UnsetType] = unset, + **kwargs, + ): """ Request body for creating a new custom rule revision. + :param _authentication_token: CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + :type _authentication_token: str, optional + :param data: Data object for a custom rule revision create request. :type data: CustomRuleRevisionRequestData, optional """ + if _authentication_token is not unset: + kwargs["_authentication_token"] = _authentication_token if data is not unset: kwargs["data"] = data super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_test.py b/src/datadog_api_client/v2/model/custom_rule_revision_test.py index 41058f5c43..7c0ad462ea 100644 --- a/src/datadog_api_client/v2/model/custom_rule_revision_test.py +++ b/src/datadog_api_client/v2/model/custom_rule_revision_test.py @@ -11,6 +11,13 @@ class CustomRuleRevisionTest(ModelNormal): + validations = { + "annotation_count": { + "inclusive_maximum": 65535, + "inclusive_minimum": 0, + }, + } + @cached_property def openapi_types(_): return { diff --git a/src/datadog_api_client/v2/model/custom_ruleset_attributes.py b/src/datadog_api_client/v2/model/custom_ruleset_attributes.py index 13a208022b..ddc0558e55 100644 --- a/src/datadog_api_client/v2/model/custom_ruleset_attributes.py +++ b/src/datadog_api_client/v2/model/custom_ruleset_attributes.py @@ -14,20 +14,20 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.custom_rule import CustomRule + from datadog_api_client.v2.model.custom_ruleset_rule_embedded import CustomRulesetRuleEmbedded class CustomRulesetAttributes(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.custom_rule import CustomRule + from datadog_api_client.v2.model.custom_ruleset_rule_embedded import CustomRulesetRuleEmbedded return { "created_at": (datetime,), "created_by": (str,), "description": (str,), "name": (str,), - "rules": ([CustomRule], none_type), + "rules": ([CustomRulesetRuleEmbedded], none_type), "short_description": (str,), } @@ -46,7 +46,7 @@ def __init__( created_by: str, description: str, name: str, - rules: Union[List[CustomRule], none_type], + rules: Union[List[CustomRulesetRuleEmbedded], none_type], short_description: str, **kwargs, ): @@ -66,7 +66,7 @@ def __init__( :type name: str :param rules: Rules in the ruleset - :type rules: [CustomRule], none_type + :type rules: [CustomRulesetRuleEmbedded], none_type :param short_description: Base64-encoded short description :type short_description: str diff --git a/src/datadog_api_client/v2/model/custom_ruleset_request.py b/src/datadog_api_client/v2/model/custom_ruleset_request.py index 515173bff3..baf56e11de 100644 --- a/src/datadog_api_client/v2/model/custom_ruleset_request.py +++ b/src/datadog_api_client/v2/model/custom_ruleset_request.py @@ -34,7 +34,10 @@ def __init__(self_, data: Union[CustomRulesetRequestData, UnsetType] = unset, ** """ Request body for creating or updating a custom ruleset. - :param data: Data object for a custom ruleset create or update request. + :param data: Data object for a custom ruleset create or update request. The resource ``id`` is + required and must equal both ``attributes.name`` and, on update, the ``ruleset_name`` + path parameter; a request that omits it or supplies a different value is rejected + with a 412 response. :type data: CustomRulesetRequestData, optional """ if data is not unset: diff --git a/src/datadog_api_client/v2/model/custom_ruleset_request_data.py b/src/datadog_api_client/v2/model/custom_ruleset_request_data.py index 49803b80cf..69d5b58363 100644 --- a/src/datadog_api_client/v2/model/custom_ruleset_request_data.py +++ b/src/datadog_api_client/v2/model/custom_ruleset_request_data.py @@ -3,13 +3,11 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, - unset, - UnsetType, ) @@ -38,29 +36,25 @@ def openapi_types(_): "type": "type", } - def __init__( - self_, - attributes: Union[CustomRulesetRequestDataAttributes, UnsetType] = unset, - id: Union[str, UnsetType] = unset, - type: Union[CustomRulesetDataType, UnsetType] = unset, - **kwargs, - ): + def __init__(self_, attributes: CustomRulesetRequestDataAttributes, id: str, type: CustomRulesetDataType, **kwargs): """ - Data object for a custom ruleset create or update request. + Data object for a custom ruleset create or update request. The resource ``id`` is + required and must equal both ``attributes.name`` and, on update, the ``ruleset_name`` + path parameter; a request that omits it or supplies a different value is rejected + with a 412 response. - :param attributes: Attributes for creating or updating a custom ruleset. - :type attributes: CustomRulesetRequestDataAttributes, optional + :param attributes: Attributes for creating or updating a custom ruleset. ``name`` is required and must + equal the resource ``id`` ; the server rejects a mismatch with a 412 response. + :type attributes: CustomRulesetRequestDataAttributes - :param id: Ruleset identifier - :type id: str, optional + :param id: Ruleset identifier, which is the same as the ruleset name. + :type id: str :param type: Resource type - :type type: CustomRulesetDataType, optional + :type type: CustomRulesetDataType """ - if attributes is not unset: - kwargs["attributes"] = attributes - if id is not unset: - kwargs["id"] = id - if type is not unset: - kwargs["type"] = type super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_ruleset_request_data_attributes.py b/src/datadog_api_client/v2/model/custom_ruleset_request_data_attributes.py index ec64f0d2d9..3fdda1d2e2 100644 --- a/src/datadog_api_client/v2/model/custom_ruleset_request_data_attributes.py +++ b/src/datadog_api_client/v2/model/custom_ruleset_request_data_attributes.py @@ -39,20 +39,21 @@ def openapi_types(_): def __init__( self_, + name: str, description: Union[str, UnsetType] = unset, - name: Union[str, UnsetType] = unset, rules: Union[List[CustomRule], none_type, UnsetType] = unset, short_description: Union[str, UnsetType] = unset, **kwargs, ): """ - Attributes for creating or updating a custom ruleset. + Attributes for creating or updating a custom ruleset. ``name`` is required and must + equal the resource ``id`` ; the server rejects a mismatch with a 412 response. :param description: Base64-encoded full description :type description: str, optional - :param name: Ruleset name - :type name: str, optional + :param name: Ruleset name, which must be the same as the resource identifier. + :type name: str :param rules: Rules in the ruleset :type rules: [CustomRule], none_type, optional @@ -62,10 +63,10 @@ def __init__( """ if description is not unset: kwargs["description"] = description - if name is not unset: - kwargs["name"] = name if rules is not unset: kwargs["rules"] = rules if short_description is not unset: kwargs["short_description"] = short_description super().__init__(kwargs) + + self_.name = name diff --git a/src/datadog_api_client/v2/model/custom_ruleset_rule_embedded.py b/src/datadog_api_client/v2/model/custom_ruleset_rule_embedded.py new file mode 100644 index 0000000000..c68c9472e4 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_ruleset_rule_embedded.py @@ -0,0 +1,81 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_revision_embedded import CustomRuleRevisionEmbedded + + +class CustomRulesetRuleEmbedded(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_revision_embedded import CustomRuleRevisionEmbedded + + return { + "created_at": (datetime,), + "created_by": (str,), + "id": (str,), + "last_revision": (CustomRuleRevisionEmbedded,), + "name": (str,), + "revisions": ([CustomRuleRevisionEmbedded], none_type), + } + + attribute_map = { + "created_at": "created_at", + "created_by": "created_by", + "id": "id", + "last_revision": "last_revision", + "name": "name", + "revisions": "revisions", + } + + def __init__( + self_, + created_at: datetime, + created_by: str, + id: str, + last_revision: CustomRuleRevisionEmbedded, + name: str, + revisions: Union[List[CustomRuleRevisionEmbedded], none_type], + **kwargs, + ): + """ + A custom static analysis rule as embedded in the rules list of a ruleset response. + + :param created_at: Creation timestamp + :type created_at: datetime + + :param created_by: Creator identifier + :type created_by: str + + :param id: Rule identifier, which is the same as the rule name. + :type id: str + + :param last_revision: A revision of a custom static analysis rule as embedded in a rule or ruleset response. + :type last_revision: CustomRuleRevisionEmbedded + + :param name: Rule name + :type name: str + + :param revisions: Revision history of the rule. + :type revisions: [CustomRuleRevisionEmbedded], none_type + """ + super().__init__(kwargs) + + self_.created_at = created_at + self_.created_by = created_by + self_.id = id + self_.last_revision = last_revision + self_.name = name + self_.revisions = revisions diff --git a/src/datadog_api_client/v2/model/get_ast_request.py b/src/datadog_api_client/v2/model/get_ast_request.py index 5722a79c94..74237e4507 100644 --- a/src/datadog_api_client/v2/model/get_ast_request.py +++ b/src/datadog_api_client/v2/model/get_ast_request.py @@ -3,11 +3,13 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import TYPE_CHECKING +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, + unset, + UnsetType, ) @@ -21,20 +23,27 @@ def openapi_types(_): from datadog_api_client.v2.model.get_ast_request_data import GetAstRequestData return { + "_authentication_token": (str,), "data": (GetAstRequestData,), } attribute_map = { + "_authentication_token": "_authentication_token", "data": "data", } - def __init__(self_, data: GetAstRequestData, **kwargs): + def __init__(self_, data: GetAstRequestData, _authentication_token: Union[str, UnsetType] = unset, **kwargs): """ The request payload for parsing source code into an abstract syntax tree. + :param _authentication_token: CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + :type _authentication_token: str, optional + :param data: The primary data object in the get-AST request. :type data: GetAstRequestData """ + if _authentication_token is not unset: + kwargs["_authentication_token"] = _authentication_token super().__init__(kwargs) self_.data = data diff --git a/src/datadog_api_client/v2/model/get_ast_response_data.py b/src/datadog_api_client/v2/model/get_ast_response_data.py index 757ad2ac7d..6f34d330cc 100644 --- a/src/datadog_api_client/v2/model/get_ast_response_data.py +++ b/src/datadog_api_client/v2/model/get_ast_response_data.py @@ -3,13 +3,11 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, - unset, - UnsetType, ) @@ -36,28 +34,21 @@ def openapi_types(_): "type": "type", } - def __init__( - self_, - attributes: GetAstResponseDataAttributes, - type: GetAstResponseDataType, - id: Union[str, UnsetType] = unset, - **kwargs, - ): + def __init__(self_, attributes: GetAstResponseDataAttributes, id: str, type: GetAstResponseDataType, **kwargs): """ The primary data object in the get-AST response. :param attributes: The attributes of the get-AST response, containing the parsed abstract syntax tree. :type attributes: GetAstResponseDataAttributes - :param id: The identifier of the get-AST response resource. - :type id: str, optional + :param id: The identifier of the get-AST response resource, echoed from the request. + :type id: str :param type: Get AST response resource type. :type type: GetAstResponseDataType """ - if id is not unset: - kwargs["id"] = id super().__init__(kwargs) self_.attributes = attributes + self_.id = id self_.type = type diff --git a/src/datadog_api_client/v2/model/get_ast_response_data_attributes.py b/src/datadog_api_client/v2/model/get_ast_response_data_attributes.py index 95773d345f..ae0c88ed36 100644 --- a/src/datadog_api_client/v2/model/get_ast_response_data_attributes.py +++ b/src/datadog_api_client/v2/model/get_ast_response_data_attributes.py @@ -3,51 +3,38 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Any, Dict +from typing import TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, - date, - datetime, - none_type, - UUID, ) +if TYPE_CHECKING: + from datadog_api_client.v2.model.ast_node import AstNode + + class GetAstResponseDataAttributes(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.ast_node import AstNode + return { - "ast": ( - { - str: ( - bool, - date, - datetime, - dict, - float, - int, - list, - str, - UUID, - none_type, - ) - }, - ), + "result": (AstNode,), } attribute_map = { - "ast": "ast", + "result": "result", } - def __init__(self_, ast: Dict[str, Any], **kwargs): + def __init__(self_, result: AstNode, **kwargs): """ The attributes of the get-AST response, containing the parsed abstract syntax tree. - :param ast: The parsed abstract syntax tree as a JSON object. - :type ast: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)} + :param result: A node in the abstract syntax tree of the parsed source code. + :type result: AstNode """ super().__init__(kwargs) - self_.ast = ast + self_.result = result diff --git a/src/datadog_api_client/v2/model/get_multiple_rulesets_request.py b/src/datadog_api_client/v2/model/get_multiple_rulesets_request.py index 63831a237d..4e924ac1ce 100644 --- a/src/datadog_api_client/v2/model/get_multiple_rulesets_request.py +++ b/src/datadog_api_client/v2/model/get_multiple_rulesets_request.py @@ -23,20 +23,32 @@ def openapi_types(_): from datadog_api_client.v2.model.get_multiple_rulesets_request_data import GetMultipleRulesetsRequestData return { + "_authentication_token": (str,), "data": (GetMultipleRulesetsRequestData,), } attribute_map = { + "_authentication_token": "_authentication_token", "data": "data", } - def __init__(self_, data: Union[GetMultipleRulesetsRequestData, UnsetType] = unset, **kwargs): + def __init__( + self_, + _authentication_token: Union[str, UnsetType] = unset, + data: Union[GetMultipleRulesetsRequestData, UnsetType] = unset, + **kwargs, + ): """ The request payload for retrieving rules for multiple rulesets in a single batch call. + :param _authentication_token: CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + :type _authentication_token: str, optional + :param data: The primary data object in the get-multiple-rulesets request, containing request attributes and resource type. :type data: GetMultipleRulesetsRequestData, optional """ + if _authentication_token is not unset: + kwargs["_authentication_token"] = _authentication_token if data is not unset: kwargs["data"] = data super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/get_multiple_rulesets_response.py b/src/datadog_api_client/v2/model/get_multiple_rulesets_response.py index 91ea450473..ed58416518 100644 --- a/src/datadog_api_client/v2/model/get_multiple_rulesets_response.py +++ b/src/datadog_api_client/v2/model/get_multiple_rulesets_response.py @@ -3,13 +3,11 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, - unset, - UnsetType, ) @@ -30,13 +28,13 @@ def openapi_types(_): "data": "data", } - def __init__(self_, data: Union[GetMultipleRulesetsResponseData, UnsetType] = unset, **kwargs): + def __init__(self_, data: GetMultipleRulesetsResponseData, **kwargs): """ The response payload for the get-multiple-rulesets endpoint, containing the requested rulesets and their rules. :param data: The primary data object in the get-multiple-rulesets response, containing the response attributes and resource type. - :type data: GetMultipleRulesetsResponseData, optional + :type data: GetMultipleRulesetsResponseData """ - if data is not unset: - kwargs["data"] = data super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data.py b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data.py index 9a553abb5d..b0d2993a67 100644 --- a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data.py +++ b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data.py @@ -3,13 +3,11 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, - unset, - UnsetType, ) @@ -44,27 +42,25 @@ def openapi_types(_): def __init__( self_, + attributes: GetMultipleRulesetsResponseDataAttributes, + id: str, type: GetMultipleRulesetsResponseDataType, - attributes: Union[GetMultipleRulesetsResponseDataAttributes, UnsetType] = unset, - id: Union[str, UnsetType] = unset, **kwargs, ): """ The primary data object in the get-multiple-rulesets response, containing the response attributes and resource type. :param attributes: The attributes of the get-multiple-rulesets response, containing the list of requested rulesets. - :type attributes: GetMultipleRulesetsResponseDataAttributes, optional + :type attributes: GetMultipleRulesetsResponseDataAttributes - :param id: The unique identifier of the get-multiple-rulesets response resource. - :type id: str, optional + :param id: The unique identifier of the get-multiple-rulesets response resource, echoed from the request. + :type id: str :param type: Get multiple rulesets response resource type. :type type: GetMultipleRulesetsResponseDataType """ - if attributes is not unset: - kwargs["attributes"] = attributes - if id is not unset: - kwargs["id"] = id super().__init__(kwargs) + self_.attributes = attributes + self_.id = id self_.type = type diff --git a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes.py b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes.py index da844379a5..392af3481b 100644 --- a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes.py +++ b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes.py @@ -3,13 +3,11 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import List, Union, TYPE_CHECKING +from typing import List, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, - unset, - UnsetType, ) @@ -34,17 +32,13 @@ def openapi_types(_): "rulesets": "rulesets", } - def __init__( - self_, - rulesets: Union[List[GetMultipleRulesetsResponseDataAttributesRulesetsItems], UnsetType] = unset, - **kwargs, - ): + def __init__(self_, rulesets: List[GetMultipleRulesetsResponseDataAttributesRulesetsItems], **kwargs): """ The attributes of the get-multiple-rulesets response, containing the list of requested rulesets. :param rulesets: The list of rulesets returned in response to the batch request. - :type rulesets: [GetMultipleRulesetsResponseDataAttributesRulesetsItems], optional + :type rulesets: [GetMultipleRulesetsResponseDataAttributesRulesetsItems] """ - if rulesets is not unset: - kwargs["rulesets"] = rulesets super().__init__(kwargs) + + self_.rulesets = rulesets diff --git a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items.py b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items.py index fc3a10881f..5f4c2e3a43 100644 --- a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items.py +++ b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items.py @@ -3,20 +3,15 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import List, Union, TYPE_CHECKING +from typing import List, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, - unset, - UnsetType, ) if TYPE_CHECKING: - from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_data import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsData, - ) from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items import ( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems, ) @@ -25,24 +20,21 @@ class GetMultipleRulesetsResponseDataAttributesRulesetsItems(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_data import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsData, - ) from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items import ( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems, ) return { - "data": (GetMultipleRulesetsResponseDataAttributesRulesetsItemsData,), "description": (str,), + "id": (str,), "name": (str,), "rules": ([GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems],), "short_description": (str,), } attribute_map = { - "data": "data", "description": "description", + "id": "id", "name": "name", "rules": "rules", "short_description": "short_description", @@ -50,39 +42,35 @@ def openapi_types(_): def __init__( self_, - data: GetMultipleRulesetsResponseDataAttributesRulesetsItemsData, - description: Union[str, UnsetType] = unset, - name: Union[str, UnsetType] = unset, - rules: Union[List[GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems], UnsetType] = unset, - short_description: Union[str, UnsetType] = unset, + description: str, + id: str, + name: str, + rules: List[GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems], + short_description: str, **kwargs, ): """ A ruleset returned in the response, containing its metadata and associated rules. - :param data: The resource identifier and type for a ruleset. - :type data: GetMultipleRulesetsResponseDataAttributesRulesetsItemsData - :param description: A detailed description of the ruleset's purpose and the types of issues it targets. - :type description: str, optional + :type description: str + + :param id: The unique identifier of the ruleset, which is the same as its name. + :type id: str :param name: The unique name of the ruleset. - :type name: str, optional + :type name: str :param rules: The list of static analysis rules included in this ruleset. - :type rules: [GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems], optional + :type rules: [GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems] :param short_description: A brief summary of the ruleset, suitable for display in listings. - :type short_description: str, optional + :type short_description: str """ - if description is not unset: - kwargs["description"] = description - if name is not unset: - kwargs["name"] = name - if rules is not unset: - kwargs["rules"] = rules - if short_description is not unset: - kwargs["short_description"] = short_description super().__init__(kwargs) - self_.data = data + self_.description = description + self_.id = id + self_.name = name + self_.rules = rules + self_.short_description = short_description diff --git a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_data.py b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_data.py deleted file mode 100644 index 8710b6bdeb..0000000000 --- a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_data.py +++ /dev/null @@ -1,58 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import Union, TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, - unset, - UnsetType, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_data_type import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType, - ) - - -class GetMultipleRulesetsResponseDataAttributesRulesetsItemsData(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_data_type import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType, - ) - - return { - "id": (str,), - "type": (GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType,), - } - - attribute_map = { - "id": "id", - "type": "type", - } - - def __init__( - self_, - type: GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType, - id: Union[str, UnsetType] = unset, - **kwargs, - ): - """ - The resource identifier and type for a ruleset. - - :param id: The unique identifier of the ruleset resource. - :type id: str, optional - - :param type: Rulesets resource type. - :type type: GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType - """ - if id is not unset: - kwargs["id"] = id - super().__init__(kwargs) - - self_.type = type diff --git a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items.py b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items.py index 53a105719d..127e91a6b9 100644 --- a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items.py +++ b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items.py @@ -18,9 +18,6 @@ from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_arguments_items import ( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems, ) - from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData, - ) from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_tests_items import ( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems, ) @@ -32,9 +29,6 @@ def openapi_types(_): from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_arguments_items import ( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems, ) - from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData, - ) from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_tests_items import ( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems, ) @@ -48,10 +42,10 @@ def openapi_types(_): "created_by": (str,), "cve": (str,), "cwe": (str,), - "data": (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData,), "description": (str,), "documentation_url": (str,), "entity_checked": (str,), + "id": (str,), "is_published": (bool,), "is_testing": (bool,), "language": (str,), @@ -76,10 +70,10 @@ def openapi_types(_): "created_by": "created_by", "cve": "cve", "cwe": "cwe", - "data": "data", "description": "description", "documentation_url": "documentation_url", "entity_checked": "entity_checked", + "id": "id", "is_published": "is_published", "is_testing": "is_testing", "language": "language", @@ -97,57 +91,53 @@ def openapi_types(_): def __init__( self_, - data: GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData, - arguments: Union[ - List[GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems], UnsetType - ] = unset, - category: Union[str, UnsetType] = unset, - checksum: Union[str, UnsetType] = unset, - code: Union[str, UnsetType] = unset, - created_at: Union[datetime, UnsetType] = unset, - created_by: Union[str, UnsetType] = unset, + arguments: List[GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems], + category: str, + checksum: str, + code: str, + created_at: datetime, + created_by: str, + description: str, + id: str, + is_published: bool, + is_testing: bool, + language: str, + last_updated_at: datetime, + last_updated_by: str, + name: str, + severity: str, + short_description: str, + should_use_ai_fix: bool, + tests: List[GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems], + type: str, cve: Union[str, UnsetType] = unset, cwe: Union[str, UnsetType] = unset, - description: Union[str, UnsetType] = unset, documentation_url: Union[str, UnsetType] = unset, entity_checked: Union[str, UnsetType] = unset, - is_published: Union[bool, UnsetType] = unset, - is_testing: Union[bool, UnsetType] = unset, - language: Union[str, UnsetType] = unset, - last_updated_at: Union[datetime, UnsetType] = unset, - last_updated_by: Union[str, UnsetType] = unset, - name: Union[str, UnsetType] = unset, regex: Union[str, UnsetType] = unset, - severity: Union[str, UnsetType] = unset, - short_description: Union[str, UnsetType] = unset, - should_use_ai_fix: Union[bool, UnsetType] = unset, - tests: Union[ - List[GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems], UnsetType - ] = unset, tree_sitter_query: Union[str, UnsetType] = unset, - type: Union[str, UnsetType] = unset, **kwargs, ): """ A static analysis rule within a ruleset, including its definition, metadata, and associated test cases. :param arguments: The list of configurable arguments accepted by this rule. - :type arguments: [GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems], optional + :type arguments: [GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems] :param category: The category classifying the type of issue this rule detects (e.g., security, style, performance). - :type category: str, optional + :type category: str :param checksum: A checksum of the rule definition used to detect changes. - :type checksum: str, optional + :type checksum: str :param code: The rule implementation code used by the static analysis engine. - :type code: str, optional + :type code: str :param created_at: The date and time when the rule was created. - :type created_at: datetime, optional + :type created_at: datetime :param created_by: The identifier of the user or system that created the rule. - :type created_by: str, optional + :type created_by: str :param cve: The CVE identifier associated with the vulnerability this rule detects, if applicable. :type cve: str, optional @@ -155,11 +145,8 @@ def __init__( :param cwe: The CWE identifier associated with the weakness category this rule detects, if applicable. :type cwe: str, optional - :param data: The resource identifier and type for a static analysis rule. - :type data: GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData - :param description: A detailed explanation of what the rule detects and why it matters. - :type description: str, optional + :type description: str :param documentation_url: A URL pointing to additional documentation for this rule. :type documentation_url: str, optional @@ -167,93 +154,78 @@ def __init__( :param entity_checked: The code entity type (e.g., function, class, variable) that this rule inspects. :type entity_checked: str, optional + :param id: The unique identifier of the rule, which is the same as its name. + :type id: str + :param is_published: Indicates whether the rule is publicly published and available to all users. - :type is_published: bool, optional + :type is_published: bool :param is_testing: Indicates whether the rule is in testing mode and not yet promoted to production. - :type is_testing: bool, optional + :type is_testing: bool :param language: The programming language this rule applies to. - :type language: str, optional + :type language: str :param last_updated_at: The date and time when the rule was last modified. - :type last_updated_at: datetime, optional + :type last_updated_at: datetime :param last_updated_by: The identifier of the user or system that last updated the rule. - :type last_updated_by: str, optional + :type last_updated_by: str :param name: The unique name identifying this rule within its ruleset. - :type name: str, optional + :type name: str :param regex: A regular expression pattern used by the rule for pattern-based detection. :type regex: str, optional :param severity: The severity level of findings produced by this rule (e.g., ERROR, WARNING, NOTICE). - :type severity: str, optional + :type severity: str :param short_description: A brief summary of what the rule detects, suitable for display in listings. - :type short_description: str, optional + :type short_description: str :param should_use_ai_fix: Indicates whether an AI-generated fix suggestion should be offered for findings from this rule. - :type should_use_ai_fix: bool, optional + :type should_use_ai_fix: bool :param tests: The list of test cases used to validate the rule's behavior. - :type tests: [GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems], optional + :type tests: [GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems] :param tree_sitter_query: The Tree-sitter query expression used by the rule to match code patterns in the AST. :type tree_sitter_query: str, optional :param type: The rule type indicating the detection mechanism used (e.g., tree_sitter, regex). - :type type: str, optional + :type type: str """ - if arguments is not unset: - kwargs["arguments"] = arguments - if category is not unset: - kwargs["category"] = category - if checksum is not unset: - kwargs["checksum"] = checksum - if code is not unset: - kwargs["code"] = code - if created_at is not unset: - kwargs["created_at"] = created_at - if created_by is not unset: - kwargs["created_by"] = created_by if cve is not unset: kwargs["cve"] = cve if cwe is not unset: kwargs["cwe"] = cwe - if description is not unset: - kwargs["description"] = description if documentation_url is not unset: kwargs["documentation_url"] = documentation_url if entity_checked is not unset: kwargs["entity_checked"] = entity_checked - if is_published is not unset: - kwargs["is_published"] = is_published - if is_testing is not unset: - kwargs["is_testing"] = is_testing - if language is not unset: - kwargs["language"] = language - if last_updated_at is not unset: - kwargs["last_updated_at"] = last_updated_at - if last_updated_by is not unset: - kwargs["last_updated_by"] = last_updated_by - if name is not unset: - kwargs["name"] = name if regex is not unset: kwargs["regex"] = regex - if severity is not unset: - kwargs["severity"] = severity - if short_description is not unset: - kwargs["short_description"] = short_description - if should_use_ai_fix is not unset: - kwargs["should_use_ai_fix"] = should_use_ai_fix - if tests is not unset: - kwargs["tests"] = tests if tree_sitter_query is not unset: kwargs["tree_sitter_query"] = tree_sitter_query - if type is not unset: - kwargs["type"] = type super().__init__(kwargs) - self_.data = data + self_.arguments = arguments + self_.category = category + self_.checksum = checksum + self_.code = code + self_.created_at = created_at + self_.created_by = created_by + self_.description = description + self_.id = id + self_.is_published = is_published + self_.is_testing = is_testing + self_.language = language + self_.last_updated_at = last_updated_at + self_.last_updated_by = last_updated_by + self_.name = name + self_.severity = severity + self_.short_description = short_description + self_.should_use_ai_fix = should_use_ai_fix + self_.tests = tests + self_.type = type diff --git a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data.py b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data.py deleted file mode 100644 index f6828d0547..0000000000 --- a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data.py +++ /dev/null @@ -1,58 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import Union, TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, - unset, - UnsetType, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType, - ) - - -class GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType, - ) - - return { - "id": (str,), - "type": (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType,), - } - - attribute_map = { - "id": "id", - "type": "type", - } - - def __init__( - self_, - type: GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType, - id: Union[str, UnsetType] = unset, - **kwargs, - ): - """ - The resource identifier and type for a static analysis rule. - - :param id: The unique identifier of the rule resource. - :type id: str, optional - - :param type: Rules resource type. - :type type: GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType - """ - if id is not unset: - kwargs["id"] = id - super().__init__(kwargs) - - self_.type = type diff --git a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type.py b/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type.py deleted file mode 100644 index 7860b64cb7..0000000000 --- a/src/datadog_api_client/v2/model/get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type.py +++ /dev/null @@ -1,37 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - - -from datadog_api_client.model_utils import ( - ModelSimple, - cached_property, -) - -from typing import ClassVar - - -class GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType(ModelSimple): - """ - Rules resource type. - - :param value: If omitted defaults to "rules". Must be one of ["rules"]. - :type value: str - """ - - allowed_values = { - "rules", - } - RULES: ClassVar["GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType"] - - @cached_property - def openapi_types(_): - return { - "value": (str,), - } - - -GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType.RULES = ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType("rules") -) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index fd3f75e287..3d0eca5f9e 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -326,6 +326,8 @@ from datadog_api_client.v2.model.analysis_request_data_attributes import AnalysisRequestDataAttributes from datadog_api_client.v2.model.analysis_request_data_type import AnalysisRequestDataType from datadog_api_client.v2.model.analysis_request_rule import AnalysisRequestRule +from datadog_api_client.v2.model.analysis_request_rule_argument import AnalysisRequestRuleArgument +from datadog_api_client.v2.model.analysis_request_rule_test import AnalysisRequestRuleTest from datadog_api_client.v2.model.analysis_response import AnalysisResponse from datadog_api_client.v2.model.analysis_response_data import AnalysisResponseData from datadog_api_client.v2.model.analysis_response_data_attributes import AnalysisResponseDataAttributes @@ -651,6 +653,7 @@ from datadog_api_client.v2.model.assignee_response_data_attributes import AssigneeResponseDataAttributes from datadog_api_client.v2.model.assignee_response_meta import AssigneeResponseMeta from datadog_api_client.v2.model.assignment_result import AssignmentResult +from datadog_api_client.v2.model.ast_node import AstNode from datadog_api_client.v2.model.attach_case_request import AttachCaseRequest from datadog_api_client.v2.model.attach_case_request_data import AttachCaseRequestData from datadog_api_client.v2.model.attach_case_request_data_relationships import AttachCaseRequestDataRelationships @@ -2195,6 +2198,7 @@ from datadog_api_client.v2.model.custom_framework_type import CustomFrameworkType from datadog_api_client.v2.model.custom_framework_without_requirements import CustomFrameworkWithoutRequirements from datadog_api_client.v2.model.custom_rule import CustomRule +from datadog_api_client.v2.model.custom_rule_attributes import CustomRuleAttributes from datadog_api_client.v2.model.custom_rule_data_type import CustomRuleDataType from datadog_api_client.v2.model.custom_rule_request import CustomRuleRequest from datadog_api_client.v2.model.custom_rule_request_data import CustomRuleRequestData @@ -2206,6 +2210,8 @@ from datadog_api_client.v2.model.custom_rule_revision_attributes_category import CustomRuleRevisionAttributesCategory from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import CustomRuleRevisionAttributesSeverity from datadog_api_client.v2.model.custom_rule_revision_data_type import CustomRuleRevisionDataType +from datadog_api_client.v2.model.custom_rule_revision_embedded import CustomRuleRevisionEmbedded +from datadog_api_client.v2.model.custom_rule_revision_input import CustomRuleRevisionInput from datadog_api_client.v2.model.custom_rule_revision_input_attributes import CustomRuleRevisionInputAttributes from datadog_api_client.v2.model.custom_rule_revision_request import CustomRuleRevisionRequest from datadog_api_client.v2.model.custom_rule_revision_request_data import CustomRuleRevisionRequestData @@ -2220,6 +2226,7 @@ from datadog_api_client.v2.model.custom_ruleset_request_data import CustomRulesetRequestData from datadog_api_client.v2.model.custom_ruleset_request_data_attributes import CustomRulesetRequestDataAttributes from datadog_api_client.v2.model.custom_ruleset_response import CustomRulesetResponse +from datadog_api_client.v2.model.custom_ruleset_rule_embedded import CustomRulesetRuleEmbedded from datadog_api_client.v2.model.customer_org_disable_request import CustomerOrgDisableRequest from datadog_api_client.v2.model.customer_org_disable_request_attributes import CustomerOrgDisableRequestAttributes from datadog_api_client.v2.model.customer_org_disable_request_data import CustomerOrgDisableRequestData @@ -3491,9 +3498,6 @@ from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items import ( GetMultipleRulesetsResponseDataAttributesRulesetsItems, ) -from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_data import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsData, -) from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_data_type import ( GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType, ) @@ -3503,12 +3507,6 @@ from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_arguments_items import ( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems, ) -from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData, -) -from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type import ( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType, -) from datadog_api_client.v2.model.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_tests_items import ( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems, ) @@ -11761,6 +11759,8 @@ "AnalysisRequestDataAttributes", "AnalysisRequestDataType", "AnalysisRequestRule", + "AnalysisRequestRuleArgument", + "AnalysisRequestRuleTest", "AnalysisResponse", "AnalysisResponseData", "AnalysisResponseDataAttributes", @@ -11970,6 +11970,7 @@ "AssigneeResponseDataAttributes", "AssigneeResponseMeta", "AssignmentResult", + "AstNode", "AttachCaseRequest", "AttachCaseRequestData", "AttachCaseRequestDataRelationships", @@ -13098,6 +13099,7 @@ "CustomFrameworkType", "CustomFrameworkWithoutRequirements", "CustomRule", + "CustomRuleAttributes", "CustomRuleDataType", "CustomRuleRequest", "CustomRuleRequestData", @@ -13109,6 +13111,8 @@ "CustomRuleRevisionAttributesCategory", "CustomRuleRevisionAttributesSeverity", "CustomRuleRevisionDataType", + "CustomRuleRevisionEmbedded", + "CustomRuleRevisionInput", "CustomRuleRevisionInputAttributes", "CustomRuleRevisionRequest", "CustomRuleRevisionRequestData", @@ -13123,6 +13127,7 @@ "CustomRulesetRequestData", "CustomRulesetRequestDataAttributes", "CustomRulesetResponse", + "CustomRulesetRuleEmbedded", "CustomerOrgDisableRequest", "CustomerOrgDisableRequestAttributes", "CustomerOrgDisableRequestData", @@ -14096,12 +14101,9 @@ "GetMultipleRulesetsResponseData", "GetMultipleRulesetsResponseDataAttributes", "GetMultipleRulesetsResponseDataAttributesRulesetsItems", - "GetMultipleRulesetsResponseDataAttributesRulesetsItemsData", "GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType", "GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems", "GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems", - "GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData", - "GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType", "GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems", "GetMultipleRulesetsResponseDataType", "GetResourceEvaluationFiltersResponse", diff --git a/tests/v2/features/security_monitoring.feature b/tests/v2/features/security_monitoring.feature index 12b40ab104..8eab51db49 100644 --- a/tests/v2/features/security_monitoring.feature +++ b/tests/v2/features/security_monitoring.feature @@ -56,7 +56,7 @@ 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": [{"category": "BEST_PRACTICES", "checksum": "abc123def456", "code": "ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=", "entity_checked": null, "id": "python-best-practices/no-exit", "language": "python", "regex": null, "severity": "WARNING", "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", "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 @@ -64,7 +64,7 @@ Feature: Security Monitoring 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": [{"category": "BEST_PRACTICES", "checksum": "abc123def456", "code": "ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=", "entity_checked": null, "id": "python-best-practices/no-exit", "language": "python", "regex": null, "severity": "WARNING", "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", "tests": [{}], "tree_sitter_query": "KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==", "type": "TREE_SITTER_QUERY"}]}, "type": "analysis_request"}} When the request is sent Then the response status is 200 OK diff --git a/tests/v2/features/static_analysis.feature b/tests/v2/features/static_analysis.feature index 2ecb0c9668..8a7dc3489a 100644 --- a/tests/v2/features/static_analysis.feature +++ b/tests/v2/features/static_analysis.feature @@ -77,7 +77,7 @@ Feature: Static Analysis Scenario: Create Custom Ruleset returns "Bad Request" response Given operation "CreateCustomRuleset" enabled And new "CreateCustomRuleset" request - And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + And body with value {"data": {"attributes": {"description": "bG9uZyBkZXNjcmlwdGlvbg==", "name": "my-ruleset", "rules": [{"id": "my-rule", "last_revision": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "name": "my-rule", "revisions": [{"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}]}], "short_description": "c2hvcnQgZGVzY3JpcHRpb24="}, "id": "my-ruleset", "type": "custom_ruleset"}} When the request is sent Then the response status is 400 Bad Request @@ -85,7 +85,7 @@ Feature: Static Analysis Scenario: Create Custom Ruleset returns "Conflict" response Given operation "CreateCustomRuleset" enabled And new "CreateCustomRuleset" request - And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + And body with value {"data": {"attributes": {"description": "bG9uZyBkZXNjcmlwdGlvbg==", "name": "my-ruleset", "rules": [{"id": "my-rule", "last_revision": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "name": "my-rule", "revisions": [{"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}]}], "short_description": "c2hvcnQgZGVzY3JpcHRpb24="}, "id": "my-ruleset", "type": "custom_ruleset"}} When the request is sent Then the response status is 409 Conflict @@ -93,7 +93,7 @@ Feature: Static Analysis Scenario: Create Custom Ruleset returns "OK" response Given operation "CreateCustomRuleset" enabled And new "CreateCustomRuleset" request - And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + And body with value {"data": {"attributes": {"description": "bG9uZyBkZXNjcmlwdGlvbg==", "name": "my-ruleset", "rules": [{"id": "my-rule", "last_revision": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "name": "my-rule", "revisions": [{"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}]}], "short_description": "c2hvcnQgZGVzY3JpcHRpb24="}, "id": "my-ruleset", "type": "custom_ruleset"}} When the request is sent Then the response status is 200 OK @@ -101,7 +101,7 @@ Feature: Static Analysis Scenario: Create Custom Ruleset returns "Precondition Failed" response Given operation "CreateCustomRuleset" enabled And new "CreateCustomRuleset" request - And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + And body with value {"data": {"attributes": {"description": "bG9uZyBkZXNjcmlwdGlvbg==", "name": "my-ruleset", "rules": [{"id": "my-rule", "last_revision": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "name": "my-rule", "revisions": [{"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}]}], "short_description": "c2hvcnQgZGVzY3JpcHRpb24="}, "id": "my-ruleset", "type": "custom_ruleset"}} When the request is sent Then the response status is 412 Precondition Failed @@ -723,7 +723,7 @@ Feature: Static Analysis Given operation "UpdateCustomRuleset" enabled And new "UpdateCustomRuleset" request And request contains "ruleset_name" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + And body with value {"data": {"attributes": {"description": "bG9uZyBkZXNjcmlwdGlvbg==", "name": "my-ruleset", "rules": [{"id": "my-rule", "last_revision": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "name": "my-rule", "revisions": [{"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}]}], "short_description": "c2hvcnQgZGVzY3JpcHRpb24="}, "id": "my-ruleset", "type": "custom_ruleset"}} When the request is sent Then the response status is 400 Bad request @@ -732,7 +732,7 @@ Feature: Static Analysis Given operation "UpdateCustomRuleset" enabled And new "UpdateCustomRuleset" request And request contains "ruleset_name" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + And body with value {"data": {"attributes": {"description": "bG9uZyBkZXNjcmlwdGlvbg==", "name": "my-ruleset", "rules": [{"id": "my-rule", "last_revision": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "name": "my-rule", "revisions": [{"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}]}], "short_description": "c2hvcnQgZGVzY3JpcHRpb24="}, "id": "my-ruleset", "type": "custom_ruleset"}} When the request is sent Then the response status is 412 Precondition failed - validation error or ruleset not found @@ -741,7 +741,7 @@ Feature: Static Analysis Given operation "UpdateCustomRuleset" enabled And new "UpdateCustomRuleset" request And request contains "ruleset_name" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + And body with value {"data": {"attributes": {"description": "bG9uZyBkZXNjcmlwdGlvbg==", "name": "my-ruleset", "rules": [{"id": "my-rule", "last_revision": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "name": "my-rule", "revisions": [{"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}]}], "short_description": "c2hvcnQgZGVzY3JpcHRpb24="}, "id": "my-ruleset", "type": "custom_ruleset"}} When the request is sent Then the response status is 200 Successfully updated