diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 1a0972d5a21..bdd215f4a9c 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.java b/examples/v2/security-monitoring/CreateStaticAnalysisServerAnalysis.java index e3926302b6c..9151d464412 100644 --- a/examples/v2/security-monitoring/CreateStaticAnalysisServerAnalysis.java +++ b/examples/v2/security-monitoring/CreateStaticAnalysisServerAnalysis.java @@ -8,6 +8,8 @@ import com.datadog.api.client.v2.model.AnalysisRequestDataAttributes; import com.datadog.api.client.v2.model.AnalysisRequestDataType; import com.datadog.api.client.v2.model.AnalysisRequestRule; +import com.datadog.api.client.v2.model.AnalysisRequestRuleArgument; +import com.datadog.api.client.v2.model.AnalysisRequestRuleTest; import com.datadog.api.client.v2.model.AnalysisResponse; import java.util.Collections; @@ -30,14 +32,21 @@ public static void main(String[] args) { .rules( Collections.singletonList( new AnalysisRequestRule() + .arguments( + Collections.singletonList( + new AnalysisRequestRuleArgument())) .category("BEST_PRACTICES") .checksum("abc123def456") .code("ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=") .entityChecked(null) .id("python-best-practices/no-exit") .language("python") + .name("no-exit") .regex(null) .severity("WARNING") + .tests( + Collections.singletonList( + new AnalysisRequestRuleTest())) .treeSitterQuery("KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==") .type("TREE_SITTER_QUERY")))) .type(AnalysisRequestDataType.ANALYSIS_REQUEST)); diff --git a/examples/v2/static-analysis/CreateCustomRuleset.java b/examples/v2/static-analysis/CreateCustomRuleset.java index ba746ba4269..b8bd9f9b986 100644 --- a/examples/v2/static-analysis/CreateCustomRuleset.java +++ b/examples/v2/static-analysis/CreateCustomRuleset.java @@ -5,11 +5,9 @@ import com.datadog.api.client.v2.api.StaticAnalysisApi; import com.datadog.api.client.v2.model.Argument; import com.datadog.api.client.v2.model.CustomRule; -import com.datadog.api.client.v2.model.CustomRuleRevision; -import com.datadog.api.client.v2.model.CustomRuleRevisionAttributes; import com.datadog.api.client.v2.model.CustomRuleRevisionAttributesCategory; import com.datadog.api.client.v2.model.CustomRuleRevisionAttributesSeverity; -import com.datadog.api.client.v2.model.CustomRuleRevisionDataType; +import com.datadog.api.client.v2.model.CustomRuleRevisionInput; import com.datadog.api.client.v2.model.CustomRuleRevisionTest; import com.datadog.api.client.v2.model.CustomRulesetDataType; import com.datadog.api.client.v2.model.CustomRulesetRequest; @@ -17,7 +15,6 @@ import com.datadog.api.client.v2.model.CustomRulesetRequestDataAttributes; import com.datadog.api.client.v2.model.CustomRulesetResponse; import com.datadog.api.client.v2.model.Language; -import java.time.OffsetDateTime; import java.util.Arrays; import java.util.Collections; @@ -33,63 +30,87 @@ public static void main(String[] args) { new CustomRulesetRequestData() .attributes( new CustomRulesetRequestDataAttributes() + .description("bG9uZyBkZXNjcmlwdGlvbg==") + .name("my-ruleset") .rules( Collections.singletonList( new CustomRule() - .createdAt( - OffsetDateTime.parse("2026-01-09T13:00:57.473141Z")) - .createdBy("foobarbaz") + .id("my-rule") .lastRevision( - new CustomRuleRevision() - .attributes( - new CustomRuleRevisionAttributes() - .arguments( - Collections.singletonList( - new Argument() - .description( - "YXJndW1lbnQgZGVzY3JpcHRpb24=") - .name("YXJndW1lbnRfbmFtZQ=="))) - .category( - CustomRuleRevisionAttributesCategory - .SECURITY) - .checksum( - "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99") - .code( - "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") - .createdAt( - OffsetDateTime.parse( - "2026-01-09T13:00:57.473141Z")) - .createdBy("foobarbaz") - .creationMessage("Initial revision") - .cve("CVE-2024-1234") - .cwe("CWE-79") - .description("bG9uZyBkZXNjcmlwdGlvbg==") - .documentationUrl( - "https://docs.example.com/rules/my-rule") - .isPublished(false) - .isTesting(false) - .language(Language.PYTHON) - .severity( - CustomRuleRevisionAttributesSeverity - .ERROR) - .shortDescription( - "c2hvcnQgZGVzY3JpcHRpb24=") - .shouldUseAiFix(false) - .tags(Arrays.asList("security", "custom")) - .tests( - Collections.singletonList( - new CustomRuleRevisionTest() - .annotationCount(1L) - .code( - "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") - .filename("test.yaml"))) - .treeSitterQuery( - "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==")) - .id("revision-123") - .type( - CustomRuleRevisionDataType - .CUSTOM_RULE_REVISION)) - .name("my-rule")))) + new CustomRuleRevisionInput() + .arguments( + Collections.singletonList( + new Argument() + .description( + "YXJndW1lbnQgZGVzY3JpcHRpb24=") + .name("YXJndW1lbnRfbmFtZQ=="))) + .category( + CustomRuleRevisionAttributesCategory.SECURITY) + .code( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .creationMessage("Initial revision") + .cve("CVE-2024-1234") + .cwe("CWE-79") + .description("bG9uZyBkZXNjcmlwdGlvbg==") + .documentationUrl( + "https://docs.example.com/rules/my-rule") + .isPublished(false) + .isTesting(false) + .language(Language.PYTHON) + .severity( + CustomRuleRevisionAttributesSeverity.ERROR) + .shortDescription("c2hvcnQgZGVzY3JpcHRpb24=") + .shouldUseAiFix(false) + .tags(Arrays.asList("security", "custom")) + .tests( + Collections.singletonList( + new CustomRuleRevisionTest() + .annotationCount(1L) + .code( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .filename("test.yaml"))) + .treeSitterQuery( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==")) + .name("my-rule") + .revisions( + Collections.singletonList( + new CustomRuleRevisionInput() + .arguments( + Collections.singletonList( + new Argument() + .description( + "YXJndW1lbnQgZGVzY3JpcHRpb24=") + .name("YXJndW1lbnRfbmFtZQ=="))) + .category( + CustomRuleRevisionAttributesCategory + .SECURITY) + .code( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .creationMessage("Initial revision") + .cve("CVE-2024-1234") + .cwe("CWE-79") + .description("bG9uZyBkZXNjcmlwdGlvbg==") + .documentationUrl( + "https://docs.example.com/rules/my-rule") + .isPublished(false) + .isTesting(false) + .language(Language.PYTHON) + .severity( + CustomRuleRevisionAttributesSeverity.ERROR) + .shortDescription("c2hvcnQgZGVzY3JpcHRpb24=") + .shouldUseAiFix(false) + .tags(Arrays.asList("security", "custom")) + .tests( + Collections.singletonList( + new CustomRuleRevisionTest() + .annotationCount(1L) + .code( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .filename("test.yaml"))) + .treeSitterQuery( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="))))) + .shortDescription("c2hvcnQgZGVzY3JpcHRpb24=")) + .id("my-ruleset") .type(CustomRulesetDataType.CUSTOM_RULESET)); try { diff --git a/examples/v2/static-analysis/UpdateCustomRuleset.java b/examples/v2/static-analysis/UpdateCustomRuleset.java index a7274fa946b..daf1e5bbc44 100644 --- a/examples/v2/static-analysis/UpdateCustomRuleset.java +++ b/examples/v2/static-analysis/UpdateCustomRuleset.java @@ -5,11 +5,9 @@ import com.datadog.api.client.v2.api.StaticAnalysisApi; import com.datadog.api.client.v2.model.Argument; import com.datadog.api.client.v2.model.CustomRule; -import com.datadog.api.client.v2.model.CustomRuleRevision; -import com.datadog.api.client.v2.model.CustomRuleRevisionAttributes; import com.datadog.api.client.v2.model.CustomRuleRevisionAttributesCategory; import com.datadog.api.client.v2.model.CustomRuleRevisionAttributesSeverity; -import com.datadog.api.client.v2.model.CustomRuleRevisionDataType; +import com.datadog.api.client.v2.model.CustomRuleRevisionInput; import com.datadog.api.client.v2.model.CustomRuleRevisionTest; import com.datadog.api.client.v2.model.CustomRulesetDataType; import com.datadog.api.client.v2.model.CustomRulesetRequest; @@ -17,7 +15,6 @@ import com.datadog.api.client.v2.model.CustomRulesetRequestDataAttributes; import com.datadog.api.client.v2.model.CustomRulesetResponse; import com.datadog.api.client.v2.model.Language; -import java.time.OffsetDateTime; import java.util.Arrays; import java.util.Collections; @@ -33,63 +30,87 @@ public static void main(String[] args) { new CustomRulesetRequestData() .attributes( new CustomRulesetRequestDataAttributes() + .description("bG9uZyBkZXNjcmlwdGlvbg==") + .name("my-ruleset") .rules( Collections.singletonList( new CustomRule() - .createdAt( - OffsetDateTime.parse("2026-01-09T13:00:57.473141Z")) - .createdBy("foobarbaz") + .id("my-rule") .lastRevision( - new CustomRuleRevision() - .attributes( - new CustomRuleRevisionAttributes() - .arguments( - Collections.singletonList( - new Argument() - .description( - "YXJndW1lbnQgZGVzY3JpcHRpb24=") - .name("YXJndW1lbnRfbmFtZQ=="))) - .category( - CustomRuleRevisionAttributesCategory - .SECURITY) - .checksum( - "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99") - .code( - "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") - .createdAt( - OffsetDateTime.parse( - "2026-01-09T13:00:57.473141Z")) - .createdBy("foobarbaz") - .creationMessage("Initial revision") - .cve("CVE-2024-1234") - .cwe("CWE-79") - .description("bG9uZyBkZXNjcmlwdGlvbg==") - .documentationUrl( - "https://docs.example.com/rules/my-rule") - .isPublished(false) - .isTesting(false) - .language(Language.PYTHON) - .severity( - CustomRuleRevisionAttributesSeverity - .ERROR) - .shortDescription( - "c2hvcnQgZGVzY3JpcHRpb24=") - .shouldUseAiFix(false) - .tags(Arrays.asList("security", "custom")) - .tests( - Collections.singletonList( - new CustomRuleRevisionTest() - .annotationCount(1L) - .code( - "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") - .filename("test.yaml"))) - .treeSitterQuery( - "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==")) - .id("revision-123") - .type( - CustomRuleRevisionDataType - .CUSTOM_RULE_REVISION)) - .name("my-rule")))) + new CustomRuleRevisionInput() + .arguments( + Collections.singletonList( + new Argument() + .description( + "YXJndW1lbnQgZGVzY3JpcHRpb24=") + .name("YXJndW1lbnRfbmFtZQ=="))) + .category( + CustomRuleRevisionAttributesCategory.SECURITY) + .code( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .creationMessage("Initial revision") + .cve("CVE-2024-1234") + .cwe("CWE-79") + .description("bG9uZyBkZXNjcmlwdGlvbg==") + .documentationUrl( + "https://docs.example.com/rules/my-rule") + .isPublished(false) + .isTesting(false) + .language(Language.PYTHON) + .severity( + CustomRuleRevisionAttributesSeverity.ERROR) + .shortDescription("c2hvcnQgZGVzY3JpcHRpb24=") + .shouldUseAiFix(false) + .tags(Arrays.asList("security", "custom")) + .tests( + Collections.singletonList( + new CustomRuleRevisionTest() + .annotationCount(1L) + .code( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .filename("test.yaml"))) + .treeSitterQuery( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==")) + .name("my-rule") + .revisions( + Collections.singletonList( + new CustomRuleRevisionInput() + .arguments( + Collections.singletonList( + new Argument() + .description( + "YXJndW1lbnQgZGVzY3JpcHRpb24=") + .name("YXJndW1lbnRfbmFtZQ=="))) + .category( + CustomRuleRevisionAttributesCategory + .SECURITY) + .code( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .creationMessage("Initial revision") + .cve("CVE-2024-1234") + .cwe("CWE-79") + .description("bG9uZyBkZXNjcmlwdGlvbg==") + .documentationUrl( + "https://docs.example.com/rules/my-rule") + .isPublished(false) + .isTesting(false) + .language(Language.PYTHON) + .severity( + CustomRuleRevisionAttributesSeverity.ERROR) + .shortDescription("c2hvcnQgZGVzY3JpcHRpb24=") + .shouldUseAiFix(false) + .tags(Arrays.asList("security", "custom")) + .tests( + Collections.singletonList( + new CustomRuleRevisionTest() + .annotationCount(1L) + .code( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .filename("test.yaml"))) + .treeSitterQuery( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="))))) + .shortDescription("c2hvcnQgZGVzY3JpcHRpb24=")) + .id("my-ruleset") .type(CustomRulesetDataType.CUSTOM_RULESET)); try { diff --git a/src/main/java/com/datadog/api/client/v2/model/AnalysisRequest.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequest.java index 92d4e2a6763..0be50d2db03 100644 --- a/src/main/java/com/datadog/api/client/v2/model/AnalysisRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequest.java @@ -18,11 +18,17 @@ import java.util.Objects; /** The request payload for running static analysis on source code. */ -@JsonPropertyOrder({AnalysisRequest.JSON_PROPERTY_DATA}) +@JsonPropertyOrder({ + AnalysisRequest.JSON_PROPERTY__AUTHENTICATION_TOKEN, + AnalysisRequest.JSON_PROPERTY_DATA +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class AnalysisRequest { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY__AUTHENTICATION_TOKEN = "_authentication_token"; + private String AuthenticationToken; + public static final String JSON_PROPERTY_DATA = "data"; private AnalysisRequestData data; @@ -35,6 +41,27 @@ public AnalysisRequest( this.unparsed |= data.unparsed; } + public AnalysisRequest AuthenticationToken(String AuthenticationToken) { + this.AuthenticationToken = AuthenticationToken; + return this; + } + + /** + * CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + * + * @return AuthenticationToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY__AUTHENTICATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthenticationToken() { + return AuthenticationToken; + } + + public void setAuthenticationToken(String AuthenticationToken) { + this.AuthenticationToken = AuthenticationToken; + } + public AnalysisRequest data(AnalysisRequestData data) { this.data = data; this.unparsed |= data.unparsed; @@ -115,19 +142,23 @@ public boolean equals(Object o) { return false; } AnalysisRequest analysisRequest = (AnalysisRequest) o; - return Objects.equals(this.data, analysisRequest.data) + return Objects.equals(this.AuthenticationToken, analysisRequest.AuthenticationToken) + && Objects.equals(this.data, analysisRequest.data) && Objects.equals(this.additionalProperties, analysisRequest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(data, additionalProperties); + return Objects.hash(AuthenticationToken, data, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AnalysisRequest {\n"); + sb.append(" AuthenticationToken: ") + .append(toIndentedString(AuthenticationToken)) + .append("\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRule.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRule.java index e699ac28e18..d99695c96d1 100644 --- a/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRule.java +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRule.java @@ -13,21 +13,48 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; -/** 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. + */ @JsonPropertyOrder({ + AnalysisRequestRule.JSON_PROPERTY_ARGUMENTS, AnalysisRequestRule.JSON_PROPERTY_CATEGORY, AnalysisRequestRule.JSON_PROPERTY_CHECKSUM, AnalysisRequestRule.JSON_PROPERTY_CODE, + AnalysisRequestRule.JSON_PROPERTY_CREATED_AT, + AnalysisRequestRule.JSON_PROPERTY_CREATED_BY, + AnalysisRequestRule.JSON_PROPERTY_CVE, + AnalysisRequestRule.JSON_PROPERTY_CWE, + AnalysisRequestRule.JSON_PROPERTY_DESCRIPTION, + AnalysisRequestRule.JSON_PROPERTY_DOCUMENTATION_URL, AnalysisRequestRule.JSON_PROPERTY_ENTITY_CHECKED, AnalysisRequestRule.JSON_PROPERTY_ID, + AnalysisRequestRule.JSON_PROPERTY_IS_PUBLISHED, + AnalysisRequestRule.JSON_PROPERTY_IS_TESTING, AnalysisRequestRule.JSON_PROPERTY_LANGUAGE, + AnalysisRequestRule.JSON_PROPERTY_LAST_UPDATED_AT, + AnalysisRequestRule.JSON_PROPERTY_LAST_UPDATED_BY, + AnalysisRequestRule.JSON_PROPERTY_NAME, AnalysisRequestRule.JSON_PROPERTY_REGEX, AnalysisRequestRule.JSON_PROPERTY_SEVERITY, + AnalysisRequestRule.JSON_PROPERTY_SHORT_DESCRIPTION, + AnalysisRequestRule.JSON_PROPERTY_SHOULD_USE_AI_FIX, + AnalysisRequestRule.JSON_PROPERTY_TESTS, AnalysisRequestRule.JSON_PROPERTY_TREE_SITTER_QUERY, AnalysisRequestRule.JSON_PROPERTY_TYPE }) @@ -35,6 +62,9 @@ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class AnalysisRequestRule { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ARGUMENTS = "arguments"; + private List arguments = null; + public static final String JSON_PROPERTY_CATEGORY = "category"; private String category; @@ -44,21 +74,63 @@ public class AnalysisRequestRule { public static final String JSON_PROPERTY_CODE = "code"; private String code; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + + public static final String JSON_PROPERTY_CVE = "cve"; + private String cve; + + public static final String JSON_PROPERTY_CWE = "cwe"; + private String cwe; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DOCUMENTATION_URL = "documentation_url"; + private String documentationUrl; + public static final String JSON_PROPERTY_ENTITY_CHECKED = "entity_checked"; private JsonNullable entityChecked = JsonNullable.undefined(); public static final String JSON_PROPERTY_ID = "id"; private String id; + public static final String JSON_PROPERTY_IS_PUBLISHED = "is_published"; + private Boolean isPublished; + + public static final String JSON_PROPERTY_IS_TESTING = "is_testing"; + private Boolean isTesting; + public static final String JSON_PROPERTY_LANGUAGE = "language"; private String language; + public static final String JSON_PROPERTY_LAST_UPDATED_AT = "last_updated_at"; + private OffsetDateTime lastUpdatedAt; + + public static final String JSON_PROPERTY_LAST_UPDATED_BY = "last_updated_by"; + private String lastUpdatedBy; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + public static final String JSON_PROPERTY_REGEX = "regex"; private JsonNullable regex = JsonNullable.undefined(); public static final String JSON_PROPERTY_SEVERITY = "severity"; private String severity; + public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public static final String JSON_PROPERTY_SHOULD_USE_AI_FIX = "should_use_ai_fix"; + private Boolean shouldUseAiFix; + + public static final String JSON_PROPERTY_TESTS = "tests"; + private List tests = null; + public static final String JSON_PROPERTY_TREE_SITTER_QUERY = "tree_sitter_query"; private String treeSitterQuery; @@ -88,6 +160,47 @@ public AnalysisRequestRule( this.type = type; } + public AnalysisRequestRule arguments(List arguments) { + this.arguments = arguments; + if (arguments != null) { + for (AnalysisRequestRuleArgument item : arguments) { + this.unparsed |= item.unparsed; + } + } + return this; + } + + public AnalysisRequestRule addArgumentsItem(AnalysisRequestRuleArgument argumentsItem) { + if (this.arguments == null) { + this.arguments = new ArrayList<>(); + } + this.arguments.add(argumentsItem); + this.unparsed |= argumentsItem.unparsed; + return this; + } + + /** + * The configurable arguments accepted by the rule. Forwarded from the rulesets endpoints; ignored + * by this operation. + * + * @return arguments + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ARGUMENTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getArguments() { + return arguments; + } + + public void setArguments(List arguments) { + this.arguments = arguments; + if (arguments != null) { + for (AnalysisRequestRuleArgument item : arguments) { + this.unparsed |= item.unparsed; + } + } + } + public AnalysisRequestRule category(String category) { this.category = category; return this; @@ -148,6 +261,120 @@ public void setCode(String code) { this.code = code; } + /** + * The date and time when the rule was created. Server-assigned by the rulesets endpoints; ignored + * by this operation. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * The identifier of the user or system that created the rule. Server-assigned by the rulesets + * endpoints; ignored by this operation. + * + * @return createdBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedBy() { + return createdBy; + } + + public AnalysisRequestRule cve(String cve) { + this.cve = cve; + return this; + } + + /** + * The CVE identifier associated with the rule. Forwarded from the rulesets endpoints; ignored by + * this operation. + * + * @return cve + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCve() { + return cve; + } + + public void setCve(String cve) { + this.cve = cve; + } + + public AnalysisRequestRule cwe(String cwe) { + this.cwe = cwe; + return this; + } + + /** + * The CWE identifier associated with the rule. Forwarded from the rulesets endpoints; ignored by + * this operation. + * + * @return cwe + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CWE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCwe() { + return cwe; + } + + public void setCwe(String cwe) { + this.cwe = cwe; + } + + public AnalysisRequestRule description(String description) { + this.description = description; + return this; + } + + /** + * A detailed explanation of what the rule detects. Forwarded from the rulesets endpoints; ignored + * by this operation. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public AnalysisRequestRule documentationUrl(String documentationUrl) { + this.documentationUrl = documentationUrl; + return this; + } + + /** + * A URL pointing to the rule documentation. Forwarded from the rulesets endpoints; ignored by + * this operation. + * + * @return documentationUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDocumentationUrl() { + return documentationUrl; + } + + public void setDocumentationUrl(String documentationUrl) { + this.documentationUrl = documentationUrl; + } + public AnalysisRequestRule entityChecked(String entityChecked) { this.entityChecked = JsonNullable.of(entityChecked); return this; @@ -199,6 +426,50 @@ public void setId(String id) { this.id = id; } + public AnalysisRequestRule isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Whether the rule is published. Forwarded from the rulesets endpoints; ignored by this + * operation. + * + * @return isPublished + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_PUBLISHED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsPublished() { + return isPublished; + } + + public void setIsPublished(Boolean isPublished) { + this.isPublished = isPublished; + } + + public AnalysisRequestRule isTesting(Boolean isTesting) { + this.isTesting = isTesting; + return this; + } + + /** + * Whether the rule is in testing mode. Forwarded from the rulesets endpoints; ignored by this + * operation. + * + * @return isTesting + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_TESTING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsTesting() { + return isTesting; + } + + public void setIsTesting(Boolean isTesting) { + this.isTesting = isTesting; + } + public AnalysisRequestRule language(String language) { this.language = language; return this; @@ -219,6 +490,53 @@ public void setLanguage(String language) { this.language = language; } + /** + * The date and time when the rule was last modified. Server-assigned by the rulesets endpoints; + * ignored by this operation. + * + * @return lastUpdatedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getLastUpdatedAt() { + return lastUpdatedAt; + } + + /** + * The identifier of the user or system that last updated the rule. Server-assigned by the + * rulesets endpoints; ignored by this operation. + * + * @return lastUpdatedBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLastUpdatedBy() { + return lastUpdatedBy; + } + + public AnalysisRequestRule name(String name) { + this.name = name; + return this; + } + + /** + * The name of the rule. Forwarded from the rulesets endpoints; ignored by this operation. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public AnalysisRequestRule regex(String regex) { this.regex = JsonNullable.of(regex); return this; @@ -272,6 +590,91 @@ public void setSeverity(String severity) { this.severity = severity; } + public AnalysisRequestRule shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * A brief summary of what the rule detects. Forwarded from the rulesets endpoints; ignored by + * this operation. + * + * @return shortDescription + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHORT_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getShortDescription() { + return shortDescription; + } + + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + public AnalysisRequestRule shouldUseAiFix(Boolean shouldUseAiFix) { + this.shouldUseAiFix = shouldUseAiFix; + return this; + } + + /** + * Whether an AI-generated fix should be offered. Forwarded from the rulesets endpoints; ignored + * by this operation. + * + * @return shouldUseAiFix + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHOULD_USE_AI_FIX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getShouldUseAiFix() { + return shouldUseAiFix; + } + + public void setShouldUseAiFix(Boolean shouldUseAiFix) { + this.shouldUseAiFix = shouldUseAiFix; + } + + public AnalysisRequestRule tests(List tests) { + this.tests = tests; + if (tests != null) { + for (AnalysisRequestRuleTest item : tests) { + this.unparsed |= item.unparsed; + } + } + return this; + } + + public AnalysisRequestRule addTestsItem(AnalysisRequestRuleTest testsItem) { + if (this.tests == null) { + this.tests = new ArrayList<>(); + } + this.tests.add(testsItem); + this.unparsed |= testsItem.unparsed; + return this; + } + + /** + * The test cases associated with the rule. Forwarded from the rulesets endpoints; ignored by this + * operation. + * + * @return tests + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TESTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTests() { + return tests; + } + + public void setTests(List tests) { + this.tests = tests; + if (tests != null) { + for (AnalysisRequestRuleTest item : tests) { + this.unparsed |= item.unparsed; + } + } + } + public AnalysisRequestRule treeSitterQuery(String treeSitterQuery) { this.treeSitterQuery = treeSitterQuery; return this; @@ -368,14 +771,29 @@ public boolean equals(Object o) { return false; } AnalysisRequestRule analysisRequestRule = (AnalysisRequestRule) o; - return Objects.equals(this.category, analysisRequestRule.category) + return Objects.equals(this.arguments, analysisRequestRule.arguments) + && Objects.equals(this.category, analysisRequestRule.category) && Objects.equals(this.checksum, analysisRequestRule.checksum) && Objects.equals(this.code, analysisRequestRule.code) + && Objects.equals(this.createdAt, analysisRequestRule.createdAt) + && Objects.equals(this.createdBy, analysisRequestRule.createdBy) + && Objects.equals(this.cve, analysisRequestRule.cve) + && Objects.equals(this.cwe, analysisRequestRule.cwe) + && Objects.equals(this.description, analysisRequestRule.description) + && Objects.equals(this.documentationUrl, analysisRequestRule.documentationUrl) && Objects.equals(this.entityChecked, analysisRequestRule.entityChecked) && Objects.equals(this.id, analysisRequestRule.id) + && Objects.equals(this.isPublished, analysisRequestRule.isPublished) + && Objects.equals(this.isTesting, analysisRequestRule.isTesting) && Objects.equals(this.language, analysisRequestRule.language) + && Objects.equals(this.lastUpdatedAt, analysisRequestRule.lastUpdatedAt) + && Objects.equals(this.lastUpdatedBy, analysisRequestRule.lastUpdatedBy) + && Objects.equals(this.name, analysisRequestRule.name) && Objects.equals(this.regex, analysisRequestRule.regex) && Objects.equals(this.severity, analysisRequestRule.severity) + && Objects.equals(this.shortDescription, analysisRequestRule.shortDescription) + && Objects.equals(this.shouldUseAiFix, analysisRequestRule.shouldUseAiFix) + && Objects.equals(this.tests, analysisRequestRule.tests) && Objects.equals(this.treeSitterQuery, analysisRequestRule.treeSitterQuery) && Objects.equals(this.type, analysisRequestRule.type) && Objects.equals(this.additionalProperties, analysisRequestRule.additionalProperties); @@ -384,14 +802,29 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( + arguments, category, checksum, code, + createdAt, + createdBy, + cve, + cwe, + description, + documentationUrl, entityChecked, id, + isPublished, + isTesting, language, + lastUpdatedAt, + lastUpdatedBy, + name, regex, severity, + shortDescription, + shouldUseAiFix, + tests, treeSitterQuery, type, additionalProperties); @@ -401,14 +834,29 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AnalysisRequestRule {\n"); + sb.append(" arguments: ").append(toIndentedString(arguments)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" cve: ").append(toIndentedString(cve)).append("\n"); + sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" documentationUrl: ").append(toIndentedString(documentationUrl)).append("\n"); sb.append(" entityChecked: ").append(toIndentedString(entityChecked)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); + sb.append(" isTesting: ").append(toIndentedString(isTesting)).append("\n"); sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" lastUpdatedAt: ").append(toIndentedString(lastUpdatedAt)).append("\n"); + sb.append(" lastUpdatedBy: ").append(toIndentedString(lastUpdatedBy)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" regex: ").append(toIndentedString(regex)).append("\n"); sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n"); + sb.append(" shouldUseAiFix: ").append(toIndentedString(shouldUseAiFix)).append("\n"); + sb.append(" tests: ").append(toIndentedString(tests)).append("\n"); sb.append(" treeSitterQuery: ").append(toIndentedString(treeSitterQuery)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsData.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRuleArgument.java similarity index 50% rename from src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsData.java rename to src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRuleArgument.java index 4dbbf2b064c..7b310e28394 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsData.java +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRuleArgument.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -17,76 +16,61 @@ import java.util.Map; import java.util.Objects; -/** The resource identifier and type for a ruleset. */ +/** A configurable argument of a forwarded static analysis rule. */ @JsonPropertyOrder({ - GetMultipleRulesetsResponseDataAttributesRulesetsItemsData.JSON_PROPERTY_ID, - GetMultipleRulesetsResponseDataAttributesRulesetsItemsData.JSON_PROPERTY_TYPE + AnalysisRequestRuleArgument.JSON_PROPERTY_DESCRIPTION, + AnalysisRequestRuleArgument.JSON_PROPERTY_NAME }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class GetMultipleRulesetsResponseDataAttributesRulesetsItemsData { +public class AnalysisRequestRuleArgument { @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_ID = "id"; - private String id; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; - public static final String JSON_PROPERTY_TYPE = "type"; - private GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType type = - GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType.RULESETS; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsData() {} - - @JsonCreator - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsData( - @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) - GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType type) { - this.type = type; - this.unparsed |= !type.isValid(); - } - - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsData id(String id) { - this.id = id; + public AnalysisRequestRuleArgument description(String description) { + this.description = description; return this; } /** - * The unique identifier of the ruleset resource. + * An explanation of the argument's purpose and accepted values. * - * @return id + * @return description */ @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_ID) + @JsonProperty(JSON_PROPERTY_DESCRIPTION) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getId() { - return id; + public String getDescription() { + return description; } - public void setId(String id) { - this.id = id; + public void setDescription(String description) { + this.description = description; } - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsData type( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType type) { - this.type = type; - this.unparsed |= !type.isValid(); + public AnalysisRequestRuleArgument name(String name) { + this.name = name; return this; } /** - * Rulesets resource type. + * The name of the rule argument. * - * @return type + * @return name */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType getType() { - return type; + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; } - public void setType(GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType type) { - if (!type.isValid()) { - this.unparsed = true; - } - this.type = type; + public void setName(String name) { + this.name = name; } /** @@ -101,11 +85,10 @@ public void setType(GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataTy * * @param key The arbitrary key to set * @param value The associated value - * @return GetMultipleRulesetsResponseDataAttributesRulesetsItemsData + * @return AnalysisRequestRuleArgument */ @JsonAnySetter - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsData putAdditionalProperty( - String key, Object value) { + public AnalysisRequestRuleArgument putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -136,10 +119,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** - * Return true if this GetMultipleRulesetsResponseDataAttributesRulesetsItemsData object is equal - * to o. - */ + /** Return true if this AnalysisRequestRuleArgument object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -148,28 +128,24 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - GetMultipleRulesetsResponseDataAttributesRulesetsItemsData - getMultipleRulesetsResponseDataAttributesRulesetsItemsData = - (GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) o; - return Objects.equals(this.id, getMultipleRulesetsResponseDataAttributesRulesetsItemsData.id) - && Objects.equals( - this.type, getMultipleRulesetsResponseDataAttributesRulesetsItemsData.type) + AnalysisRequestRuleArgument analysisRequestRuleArgument = (AnalysisRequestRuleArgument) o; + return Objects.equals(this.description, analysisRequestRuleArgument.description) + && Objects.equals(this.name, analysisRequestRuleArgument.name) && Objects.equals( - this.additionalProperties, - getMultipleRulesetsResponseDataAttributesRulesetsItemsData.additionalProperties); + this.additionalProperties, analysisRequestRuleArgument.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, type, additionalProperties); + return Objects.hash(description, name, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class GetMultipleRulesetsResponseDataAttributesRulesetsItemsData {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("class AnalysisRequestRuleArgument {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRuleTest.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRuleTest.java new file mode 100644 index 00000000000..4e2dfefdd15 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRuleTest.java @@ -0,0 +1,192 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A test case of a forwarded static analysis rule. */ +@JsonPropertyOrder({ + AnalysisRequestRuleTest.JSON_PROPERTY_ANNOTATION_COUNT, + AnalysisRequestRuleTest.JSON_PROPERTY_CODE, + AnalysisRequestRuleTest.JSON_PROPERTY_FILENAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisRequestRuleTest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ANNOTATION_COUNT = "annotation_count"; + private Long annotationCount; + + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_FILENAME = "filename"; + private String filename; + + public AnalysisRequestRuleTest annotationCount(Long annotationCount) { + this.annotationCount = annotationCount; + return this; + } + + /** + * The expected number of findings the rule should produce against the test code. minimum: 0 + * maximum: 65535 + * + * @return annotationCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ANNOTATION_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getAnnotationCount() { + return annotationCount; + } + + public void setAnnotationCount(Long annotationCount) { + this.annotationCount = annotationCount; + } + + public AnalysisRequestRuleTest code(String code) { + this.code = code; + return this; + } + + /** + * The source code snippet used as input for the rule test. + * + * @return code + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public AnalysisRequestRuleTest filename(String filename) { + this.filename = filename; + return this; + } + + /** + * The filename associated with the test code snippet. + * + * @return filename + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FILENAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AnalysisRequestRuleTest + */ + @JsonAnySetter + public AnalysisRequestRuleTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AnalysisRequestRuleTest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisRequestRuleTest analysisRequestRuleTest = (AnalysisRequestRuleTest) o; + return Objects.equals(this.annotationCount, analysisRequestRuleTest.annotationCount) + && Objects.equals(this.code, analysisRequestRuleTest.code) + && Objects.equals(this.filename, analysisRequestRuleTest.filename) + && Objects.equals(this.additionalProperties, analysisRequestRuleTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(annotationCount, code, filename, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisRequestRuleTest {\n"); + sb.append(" annotationCount: ").append(toIndentedString(annotationCount)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" filename: ").append(toIndentedString(filename)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AstNode.java b/src/main/java/com/datadog/api/client/v2/model/AstNode.java new file mode 100644 index 00000000000..4ee3ed31d7e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AstNode.java @@ -0,0 +1,289 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A node in the abstract syntax tree of the parsed source code. */ +@JsonPropertyOrder({ + AstNode.JSON_PROPERTY_AST_TYPE, + AstNode.JSON_PROPERTY_CHILDREN, + AstNode.JSON_PROPERTY_END, + AstNode.JSON_PROPERTY_FIELD_NAME, + AstNode.JSON_PROPERTY_START +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AstNode { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AST_TYPE = "ast_type"; + private String astType; + + public static final String JSON_PROPERTY_CHILDREN = "children"; + private List children = new ArrayList<>(); + + public static final String JSON_PROPERTY_END = "end"; + private AnalysisPosition end; + + public static final String JSON_PROPERTY_FIELD_NAME = "field_name"; + private String fieldName; + + public static final String JSON_PROPERTY_START = "start"; + private AnalysisPosition start; + + public AstNode() {} + + @JsonCreator + public AstNode( + @JsonProperty(required = true, value = JSON_PROPERTY_AST_TYPE) String astType, + @JsonProperty(required = true, value = JSON_PROPERTY_CHILDREN) List children, + @JsonProperty(required = true, value = JSON_PROPERTY_END) AnalysisPosition end, + @JsonProperty(required = true, value = JSON_PROPERTY_START) AnalysisPosition start) { + this.astType = astType; + this.children = children; + if (children != null) { + for (AstNode item : children) { + this.unparsed |= item.unparsed; + } + } + this.end = end; + this.unparsed |= end.unparsed; + this.start = start; + this.unparsed |= start.unparsed; + } + + public AstNode astType(String astType) { + this.astType = astType; + return this; + } + + /** + * The tree-sitter node type of this AST node. + * + * @return astType + */ + @JsonProperty(JSON_PROPERTY_AST_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAstType() { + return astType; + } + + public void setAstType(String astType) { + this.astType = astType; + } + + public AstNode children(List children) { + this.children = children; + for (AstNode item : children) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AstNode addChildrenItem(AstNode childrenItem) { + this.children.add(childrenItem); + this.unparsed |= childrenItem.unparsed; + return this; + } + + /** + * The child nodes of this AST node, or null for a leaf node. + * + * @return children + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHILDREN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + if (children != null) { + for (AstNode item : children) { + this.unparsed |= item.unparsed; + } + } + } + + public AstNode end(AnalysisPosition end) { + this.end = end; + this.unparsed |= end.unparsed; + return this; + } + + /** + * A position in source code, identified by line and column numbers. + * + * @return end + */ + @JsonProperty(JSON_PROPERTY_END) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisPosition getEnd() { + return end; + } + + public void setEnd(AnalysisPosition end) { + this.end = end; + if (end != null) { + this.unparsed |= end.unparsed; + } + } + + public AstNode fieldName(String fieldName) { + this.fieldName = fieldName; + return this; + } + + /** + * The name of the field this node occupies within its parent node, when the parent addresses it + * by name. + * + * @return fieldName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FIELD_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public AstNode start(AnalysisPosition start) { + this.start = start; + this.unparsed |= start.unparsed; + return this; + } + + /** + * A position in source code, identified by line and column numbers. + * + * @return start + */ + @JsonProperty(JSON_PROPERTY_START) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisPosition getStart() { + return start; + } + + public void setStart(AnalysisPosition start) { + this.start = start; + if (start != null) { + this.unparsed |= start.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AstNode + */ + @JsonAnySetter + public AstNode putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AstNode object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AstNode astNode = (AstNode) o; + return Objects.equals(this.astType, astNode.astType) + && Objects.equals(this.children, astNode.children) + && Objects.equals(this.end, astNode.end) + && Objects.equals(this.fieldName, astNode.fieldName) + && Objects.equals(this.start, astNode.start) + && Objects.equals(this.additionalProperties, astNode.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(astType, children, end, fieldName, start, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AstNode {\n"); + sb.append(" astType: ").append(toIndentedString(astType)).append("\n"); + sb.append(" children: ").append(toIndentedString(children)).append("\n"); + sb.append(" end: ").append(toIndentedString(end)).append("\n"); + sb.append(" fieldName: ").append(toIndentedString(fieldName)).append("\n"); + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRule.java b/src/main/java/com/datadog/api/client/v2/model/CustomRule.java index 4e9203e6d34..c2a7875340e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRule.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRule.java @@ -6,24 +6,31 @@ package com.datadog.api.client.v2.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; - -/** A custom static analysis rule within a ruleset. */ +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * 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. + */ @JsonPropertyOrder({ CustomRule.JSON_PROPERTY_CREATED_AT, CustomRule.JSON_PROPERTY_CREATED_BY, + CustomRule.JSON_PROPERTY_ID, CustomRule.JSON_PROPERTY_LAST_REVISION, - CustomRule.JSON_PROPERTY_NAME + CustomRule.JSON_PROPERTY_NAME, + CustomRule.JSON_PROPERTY_REVISIONS }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -35,86 +42,96 @@ public class CustomRule { public static final String JSON_PROPERTY_CREATED_BY = "created_by"; private String createdBy; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + public static final String JSON_PROPERTY_LAST_REVISION = "last_revision"; - private CustomRuleRevision lastRevision; + private CustomRuleRevisionInput lastRevision; public static final String JSON_PROPERTY_NAME = "name"; private String name; + public static final String JSON_PROPERTY_REVISIONS = "revisions"; + private JsonNullable> revisions = + JsonNullable.>undefined(); + public CustomRule() {} @JsonCreator public CustomRule( - @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, - @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, - @JsonProperty(required = true, value = JSON_PROPERTY_LAST_REVISION) - CustomRuleRevision lastRevision, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { - this.createdAt = createdAt; - this.createdBy = createdBy; - this.lastRevision = lastRevision; - this.unparsed |= lastRevision.unparsed; + this.id = id; this.name = name; } - public CustomRule createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - /** * Creation timestamp * * @return createdAt */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OffsetDateTime getCreatedAt() { return createdAt; } - public void setCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; + /** + * Creator identifier + * + * @return createdBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedBy() { + return createdBy; } - public CustomRule createdBy(String createdBy) { - this.createdBy = createdBy; + public CustomRule id(String id) { + this.id = id; return this; } /** - * Creator identifier + * Rule identifier, which is the same as the rule name. * - * @return createdBy + * @return id */ - @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getCreatedBy() { - return createdBy; + public String getId() { + return id; } - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; + public void setId(String id) { + this.id = id; } - public CustomRule lastRevision(CustomRuleRevision lastRevision) { + public CustomRule lastRevision(CustomRuleRevisionInput lastRevision) { this.lastRevision = lastRevision; this.unparsed |= lastRevision.unparsed; return this; } /** - * A specific revision of a custom static analysis rule. + * 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. * * @return lastRevision */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_LAST_REVISION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public CustomRuleRevision getLastRevision() { + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRuleRevisionInput getLastRevision() { return lastRevision; } - public void setLastRevision(CustomRuleRevision lastRevision) { + public void setLastRevision(CustomRuleRevisionInput lastRevision) { this.lastRevision = lastRevision; if (lastRevision != null) { this.unparsed |= lastRevision.unparsed; @@ -141,50 +158,47 @@ public void setName(String name) { this.name = name; } - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; + public CustomRule revisions(List revisions) { + this.revisions = JsonNullable.>of(revisions); + return this; + } - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key The arbitrary key to set - * @param value The associated value - * @return CustomRule - */ - @JsonAnySetter - public CustomRule putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); + public CustomRule addRevisionsItem(CustomRuleRevisionInput revisionsItem) { + if (this.revisions == null || !this.revisions.isPresent()) { + this.revisions = JsonNullable.>of(new ArrayList<>()); + } + try { + this.revisions.get().add(revisionsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present } - this.additionalProperties.put(key, value); return this; } /** - * Return the additional (undeclared) property. + * Revision history of the rule. * - * @return The additional properties + * @return revisions */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; + @jakarta.annotation.Nullable + @JsonIgnore + public List getRevisions() { + return revisions.orElse(null); } - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key The arbitrary key to get - * @return The specific additional property for the given key - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); + @JsonProperty(JSON_PROPERTY_REVISIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getRevisions_JsonNullable() { + return revisions; + } + + @JsonProperty(JSON_PROPERTY_REVISIONS) + public void setRevisions_JsonNullable(JsonNullable> revisions) { + this.revisions = revisions; + } + + public void setRevisions(List revisions) { + this.revisions = JsonNullable.>of(revisions); } /** Return true if this CustomRule object is equal to o. */ @@ -199,14 +213,15 @@ public boolean equals(Object o) { CustomRule customRule = (CustomRule) o; return Objects.equals(this.createdAt, customRule.createdAt) && Objects.equals(this.createdBy, customRule.createdBy) + && Objects.equals(this.id, customRule.id) && Objects.equals(this.lastRevision, customRule.lastRevision) && Objects.equals(this.name, customRule.name) - && Objects.equals(this.additionalProperties, customRule.additionalProperties); + && Objects.equals(this.revisions, customRule.revisions); } @Override public int hashCode() { - return Objects.hash(createdAt, createdBy, lastRevision, name, additionalProperties); + return Objects.hash(createdAt, createdBy, id, lastRevision, name, revisions); } @Override @@ -215,11 +230,10 @@ public String toString() { sb.append("class CustomRule {\n"); sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" lastRevision: ").append(toIndentedString(lastRevision)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); + sb.append(" revisions: ").append(toIndentedString(revisions)).append("\n"); sb.append('}'); return sb.toString(); } diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleAttributes.java new file mode 100644 index 00000000000..c188f608dad --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleAttributes.java @@ -0,0 +1,290 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * Attributes of a custom static analysis rule, including its most recent revision and revision + * history. + */ +@JsonPropertyOrder({ + CustomRuleAttributes.JSON_PROPERTY_CREATED_AT, + CustomRuleAttributes.JSON_PROPERTY_CREATED_BY, + CustomRuleAttributes.JSON_PROPERTY_LAST_REVISION, + CustomRuleAttributes.JSON_PROPERTY_NAME, + CustomRuleAttributes.JSON_PROPERTY_REVISIONS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + + public static final String JSON_PROPERTY_LAST_REVISION = "last_revision"; + private CustomRuleRevisionEmbedded lastRevision; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_REVISIONS = "revisions"; + private List revisions = new ArrayList<>(); + + public CustomRuleAttributes() {} + + @JsonCreator + public CustomRuleAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_REVISION) + CustomRuleRevisionEmbedded lastRevision, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_REVISIONS) + List revisions) { + this.createdAt = createdAt; + this.createdBy = createdBy; + this.lastRevision = lastRevision; + this.unparsed |= lastRevision.unparsed; + this.name = name; + this.revisions = revisions; + if (revisions != null) { + for (CustomRuleRevisionEmbedded item : revisions) { + this.unparsed |= item.unparsed; + } + } + } + + public CustomRuleAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation timestamp + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public CustomRuleAttributes createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Creator identifier + * + * @return createdBy + */ + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public CustomRuleAttributes lastRevision(CustomRuleRevisionEmbedded lastRevision) { + this.lastRevision = lastRevision; + this.unparsed |= lastRevision.unparsed; + return this; + } + + /** + * A revision of a custom static analysis rule as embedded in a rule or ruleset response. + * + * @return lastRevision + */ + @JsonProperty(JSON_PROPERTY_LAST_REVISION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevisionEmbedded getLastRevision() { + return lastRevision; + } + + public void setLastRevision(CustomRuleRevisionEmbedded lastRevision) { + this.lastRevision = lastRevision; + if (lastRevision != null) { + this.unparsed |= lastRevision.unparsed; + } + } + + public CustomRuleAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Rule name + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CustomRuleAttributes revisions(List revisions) { + this.revisions = revisions; + for (CustomRuleRevisionEmbedded item : revisions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRuleAttributes addRevisionsItem(CustomRuleRevisionEmbedded revisionsItem) { + this.revisions.add(revisionsItem); + this.unparsed |= revisionsItem.unparsed; + return this; + } + + /** + * Revision history of the rule. + * + * @return revisions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REVISIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRevisions() { + return revisions; + } + + public void setRevisions(List revisions) { + this.revisions = revisions; + if (revisions != null) { + for (CustomRuleRevisionEmbedded item : revisions) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleAttributes + */ + @JsonAnySetter + public CustomRuleAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleAttributes customRuleAttributes = (CustomRuleAttributes) o; + return Objects.equals(this.createdAt, customRuleAttributes.createdAt) + && Objects.equals(this.createdBy, customRuleAttributes.createdBy) + && Objects.equals(this.lastRevision, customRuleAttributes.lastRevision) + && Objects.equals(this.name, customRuleAttributes.name) + && Objects.equals(this.revisions, customRuleAttributes.revisions) + && Objects.equals(this.additionalProperties, customRuleAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, createdBy, lastRevision, name, revisions, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" lastRevision: ").append(toIndentedString(lastRevision)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" revisions: ").append(toIndentedString(revisions)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequest.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequest.java index 6de215c4892..be77d7a1f02 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequest.java @@ -17,14 +17,41 @@ import java.util.Objects; /** Request body for creating or updating a custom rule. */ -@JsonPropertyOrder({CustomRuleRequest.JSON_PROPERTY_DATA}) +@JsonPropertyOrder({ + CustomRuleRequest.JSON_PROPERTY__AUTHENTICATION_TOKEN, + CustomRuleRequest.JSON_PROPERTY_DATA +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class CustomRuleRequest { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY__AUTHENTICATION_TOKEN = "_authentication_token"; + private String AuthenticationToken; + public static final String JSON_PROPERTY_DATA = "data"; private CustomRuleRequestData data; + public CustomRuleRequest AuthenticationToken(String AuthenticationToken) { + this.AuthenticationToken = AuthenticationToken; + return this; + } + + /** + * CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + * + * @return AuthenticationToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY__AUTHENTICATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthenticationToken() { + return AuthenticationToken; + } + + public void setAuthenticationToken(String AuthenticationToken) { + this.AuthenticationToken = AuthenticationToken; + } + public CustomRuleRequest data(CustomRuleRequestData data) { this.data = data; this.unparsed |= data.unparsed; @@ -106,19 +133,23 @@ public boolean equals(Object o) { return false; } CustomRuleRequest customRuleRequest = (CustomRuleRequest) o; - return Objects.equals(this.data, customRuleRequest.data) + return Objects.equals(this.AuthenticationToken, customRuleRequest.AuthenticationToken) + && Objects.equals(this.data, customRuleRequest.data) && Objects.equals(this.additionalProperties, customRuleRequest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(data, additionalProperties); + return Objects.hash(AuthenticationToken, data, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CustomRuleRequest {\n"); + sb.append(" AuthenticationToken: ") + .append(toIndentedString(AuthenticationToken)) + .append("\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleResponseData.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleResponseData.java index 6a115def23b..debaab31712 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRuleResponseData.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleResponseData.java @@ -28,7 +28,7 @@ public class CustomRuleResponseData { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; - private CustomRule attributes; + private CustomRuleAttributes attributes; public static final String JSON_PROPERTY_ID = "id"; private String id; @@ -40,7 +40,8 @@ public CustomRuleResponseData() {} @JsonCreator public CustomRuleResponseData( - @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) CustomRule attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CustomRuleAttributes attributes, @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CustomRuleDataType type) { this.attributes = attributes; @@ -50,24 +51,25 @@ public CustomRuleResponseData( this.unparsed |= !type.isValid(); } - public CustomRuleResponseData attributes(CustomRule attributes) { + public CustomRuleResponseData attributes(CustomRuleAttributes attributes) { this.attributes = attributes; this.unparsed |= attributes.unparsed; return this; } /** - * A custom static analysis rule within a ruleset. + * Attributes of a custom static analysis rule, including its most recent revision and revision + * history. * * @return attributes */ @JsonProperty(JSON_PROPERTY_ATTRIBUTES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public CustomRule getAttributes() { + public CustomRuleAttributes getAttributes() { return attributes; } - public void setAttributes(CustomRule attributes) { + public void setAttributes(CustomRuleAttributes attributes) { this.attributes = attributes; if (attributes != null) { this.unparsed |= attributes.unparsed; diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributes.java index b12fc58031e..837f00a3610 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributes.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; /** Attributes of a custom rule revision, including code, metadata, and test cases. */ @JsonPropertyOrder({ @@ -41,7 +42,8 @@ CustomRuleRevisionAttributes.JSON_PROPERTY_SHOULD_USE_AI_FIX, CustomRuleRevisionAttributes.JSON_PROPERTY_TAGS, CustomRuleRevisionAttributes.JSON_PROPERTY_TESTS, - CustomRuleRevisionAttributes.JSON_PROPERTY_TREE_SITTER_QUERY + CustomRuleRevisionAttributes.JSON_PROPERTY_TREE_SITTER_QUERY, + CustomRuleRevisionAttributes.JSON_PROPERTY_VERSION_ID }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -69,16 +71,16 @@ public class CustomRuleRevisionAttributes { private String creationMessage; public static final String JSON_PROPERTY_CVE = "cve"; - private String cve; + private JsonNullable cve = JsonNullable.undefined(); public static final String JSON_PROPERTY_CWE = "cwe"; - private String cwe; + private JsonNullable cwe = JsonNullable.undefined(); public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; public static final String JSON_PROPERTY_DOCUMENTATION_URL = "documentation_url"; - private String documentationUrl; + private JsonNullable documentationUrl = JsonNullable.undefined(); public static final String JSON_PROPERTY_IS_PUBLISHED = "is_published"; private Boolean isPublished; @@ -107,6 +109,9 @@ public class CustomRuleRevisionAttributes { public static final String JSON_PROPERTY_TREE_SITTER_QUERY = "tree_sitter_query"; private String treeSitterQuery; + public static final String JSON_PROPERTY_VERSION_ID = "version_id"; + private Long versionId; + public CustomRuleRevisionAttributes() {} @JsonCreator @@ -119,11 +124,7 @@ public CustomRuleRevisionAttributes( @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, @JsonProperty(required = true, value = JSON_PROPERTY_CREATION_MESSAGE) String creationMessage, - @JsonProperty(required = true, value = JSON_PROPERTY_CVE) String cve, - @JsonProperty(required = true, value = JSON_PROPERTY_CWE) String cwe, @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, - @JsonProperty(required = true, value = JSON_PROPERTY_DOCUMENTATION_URL) - String documentationUrl, @JsonProperty(required = true, value = JSON_PROPERTY_IS_PUBLISHED) Boolean isPublished, @JsonProperty(required = true, value = JSON_PROPERTY_IS_TESTING) Boolean isTesting, @JsonProperty(required = true, value = JSON_PROPERTY_LANGUAGE) Language language, @@ -137,10 +138,13 @@ public CustomRuleRevisionAttributes( @JsonProperty(required = true, value = JSON_PROPERTY_TESTS) List tests, @JsonProperty(required = true, value = JSON_PROPERTY_TREE_SITTER_QUERY) - String treeSitterQuery) { + String treeSitterQuery, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION_ID) Long versionId) { this.arguments = arguments; - for (Argument item : arguments) { - this.unparsed |= item.unparsed; + if (arguments != null) { + for (Argument item : arguments) { + this.unparsed |= item.unparsed; + } } this.category = category; this.unparsed |= !category.isValid(); @@ -149,13 +153,7 @@ public CustomRuleRevisionAttributes( this.createdAt = createdAt; this.createdBy = createdBy; this.creationMessage = creationMessage; - this.cve = cve; - if (cve != null) {} - this.cwe = cwe; - if (cwe != null) {} this.description = description; - this.documentationUrl = documentationUrl; - if (documentationUrl != null) {} this.isPublished = isPublished; this.isTesting = isTesting; this.language = language; @@ -165,11 +163,15 @@ public CustomRuleRevisionAttributes( this.shortDescription = shortDescription; this.shouldUseAiFix = shouldUseAiFix; this.tags = tags; + if (tags != null) {} this.tests = tests; - for (CustomRuleRevisionTest item : tests) { - this.unparsed |= item.unparsed; + if (tests != null) { + for (CustomRuleRevisionTest item : tests) { + this.unparsed |= item.unparsed; + } } this.treeSitterQuery = treeSitterQuery; + this.versionId = versionId; } public CustomRuleRevisionAttributes arguments(List arguments) { @@ -191,6 +193,7 @@ public CustomRuleRevisionAttributes addArgumentsItem(Argument argumentsItem) { * * @return arguments */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ARGUMENTS) @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getArguments() { @@ -331,8 +334,7 @@ public void setCreationMessage(String creationMessage) { } public CustomRuleRevisionAttributes cve(String cve) { - this.cve = cve; - if (cve != null) {} + this.cve = JsonNullable.of(cve); return this; } @@ -342,19 +344,28 @@ public CustomRuleRevisionAttributes cve(String cve) { * @return cve */ @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_CVE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonIgnore public String getCve() { + return cve.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCve_JsonNullable() { return cve; } - public void setCve(String cve) { + @JsonProperty(JSON_PROPERTY_CVE) + public void setCve_JsonNullable(JsonNullable cve) { this.cve = cve; } + public void setCve(String cve) { + this.cve = JsonNullable.of(cve); + } + public CustomRuleRevisionAttributes cwe(String cwe) { - this.cwe = cwe; - if (cwe != null) {} + this.cwe = JsonNullable.of(cwe); return this; } @@ -364,16 +375,26 @@ public CustomRuleRevisionAttributes cwe(String cwe) { * @return cwe */ @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_CWE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonIgnore public String getCwe() { + return cwe.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CWE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCwe_JsonNullable() { return cwe; } - public void setCwe(String cwe) { + @JsonProperty(JSON_PROPERTY_CWE) + public void setCwe_JsonNullable(JsonNullable cwe) { this.cwe = cwe; } + public void setCwe(String cwe) { + this.cwe = JsonNullable.of(cwe); + } + public CustomRuleRevisionAttributes description(String description) { this.description = description; return this; @@ -395,8 +416,7 @@ public void setDescription(String description) { } public CustomRuleRevisionAttributes documentationUrl(String documentationUrl) { - this.documentationUrl = documentationUrl; - if (documentationUrl != null) {} + this.documentationUrl = JsonNullable.of(documentationUrl); return this; } @@ -406,16 +426,26 @@ public CustomRuleRevisionAttributes documentationUrl(String documentationUrl) { * @return documentationUrl */ @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonIgnore public String getDocumentationUrl() { + return documentationUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDocumentationUrl_JsonNullable() { return documentationUrl; } - public void setDocumentationUrl(String documentationUrl) { + @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) + public void setDocumentationUrl_JsonNullable(JsonNullable documentationUrl) { this.documentationUrl = documentationUrl; } + public void setDocumentationUrl(String documentationUrl) { + this.documentationUrl = JsonNullable.of(documentationUrl); + } + public CustomRuleRevisionAttributes isPublished(Boolean isPublished) { this.isPublished = isPublished; return this; @@ -559,6 +589,7 @@ public CustomRuleRevisionAttributes addTagsItem(String tagsItem) { * * @return tags */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getTags() { @@ -588,6 +619,7 @@ public CustomRuleRevisionAttributes addTestsItem(CustomRuleRevisionTest testsIte * * @return tests */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TESTS) @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getTests() { @@ -623,6 +655,26 @@ public void setTreeSitterQuery(String treeSitterQuery) { this.treeSitterQuery = treeSitterQuery; } + public CustomRuleRevisionAttributes versionId(Long versionId) { + this.versionId = versionId; + return this; + } + + /** + * Monotonically increasing version number of the revision. + * + * @return versionId + */ + @JsonProperty(JSON_PROPERTY_VERSION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getVersionId() { + return versionId; + } + + public void setVersionId(Long versionId) { + this.versionId = versionId; + } + /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -699,6 +751,7 @@ public boolean equals(Object o) { && Objects.equals(this.tags, customRuleRevisionAttributes.tags) && Objects.equals(this.tests, customRuleRevisionAttributes.tests) && Objects.equals(this.treeSitterQuery, customRuleRevisionAttributes.treeSitterQuery) + && Objects.equals(this.versionId, customRuleRevisionAttributes.versionId) && Objects.equals( this.additionalProperties, customRuleRevisionAttributes.additionalProperties); } @@ -726,6 +779,7 @@ public int hashCode() { tags, tests, treeSitterQuery, + versionId, additionalProperties); } @@ -753,6 +807,7 @@ public String toString() { sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" tests: ").append(toIndentedString(tests)).append("\n"); sb.append(" treeSitterQuery: ").append(toIndentedString(treeSitterQuery)).append("\n"); + sb.append(" versionId: ").append(toIndentedString(versionId)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionEmbedded.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionEmbedded.java new file mode 100644 index 00000000000..18bc8146751 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionEmbedded.java @@ -0,0 +1,825 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A revision of a custom static analysis rule as embedded in a rule or ruleset response. */ +@JsonPropertyOrder({ + CustomRuleRevisionEmbedded.JSON_PROPERTY_ARGUMENTS, + CustomRuleRevisionEmbedded.JSON_PROPERTY_CATEGORY, + CustomRuleRevisionEmbedded.JSON_PROPERTY_CHECKSUM, + CustomRuleRevisionEmbedded.JSON_PROPERTY_CODE, + CustomRuleRevisionEmbedded.JSON_PROPERTY_CREATED_AT, + CustomRuleRevisionEmbedded.JSON_PROPERTY_CREATED_BY, + CustomRuleRevisionEmbedded.JSON_PROPERTY_CREATION_MESSAGE, + CustomRuleRevisionEmbedded.JSON_PROPERTY_CVE, + CustomRuleRevisionEmbedded.JSON_PROPERTY_CWE, + CustomRuleRevisionEmbedded.JSON_PROPERTY_DESCRIPTION, + CustomRuleRevisionEmbedded.JSON_PROPERTY_DOCUMENTATION_URL, + CustomRuleRevisionEmbedded.JSON_PROPERTY_ID, + CustomRuleRevisionEmbedded.JSON_PROPERTY_IS_PUBLISHED, + CustomRuleRevisionEmbedded.JSON_PROPERTY_IS_TESTING, + CustomRuleRevisionEmbedded.JSON_PROPERTY_LANGUAGE, + CustomRuleRevisionEmbedded.JSON_PROPERTY_SEVERITY, + CustomRuleRevisionEmbedded.JSON_PROPERTY_SHORT_DESCRIPTION, + CustomRuleRevisionEmbedded.JSON_PROPERTY_SHOULD_USE_AI_FIX, + CustomRuleRevisionEmbedded.JSON_PROPERTY_TAGS, + CustomRuleRevisionEmbedded.JSON_PROPERTY_TESTS, + CustomRuleRevisionEmbedded.JSON_PROPERTY_TREE_SITTER_QUERY, + CustomRuleRevisionEmbedded.JSON_PROPERTY_VERSION_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRevisionEmbedded { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ARGUMENTS = "arguments"; + private List arguments = new ArrayList<>(); + + public static final String JSON_PROPERTY_CATEGORY = "category"; + private CustomRuleRevisionAttributesCategory category; + + public static final String JSON_PROPERTY_CHECKSUM = "checksum"; + private String checksum; + + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + + public static final String JSON_PROPERTY_CREATION_MESSAGE = "creation_message"; + private String creationMessage; + + public static final String JSON_PROPERTY_CVE = "cve"; + private String cve; + + public static final String JSON_PROPERTY_CWE = "cwe"; + private String cwe; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DOCUMENTATION_URL = "documentation_url"; + private String documentationUrl; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_IS_PUBLISHED = "is_published"; + private Boolean isPublished; + + public static final String JSON_PROPERTY_IS_TESTING = "is_testing"; + private Boolean isTesting; + + public static final String JSON_PROPERTY_LANGUAGE = "language"; + private Language language; + + public static final String JSON_PROPERTY_SEVERITY = "severity"; + private CustomRuleRevisionAttributesSeverity severity; + + public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public static final String JSON_PROPERTY_SHOULD_USE_AI_FIX = "should_use_ai_fix"; + private Boolean shouldUseAiFix; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = new ArrayList<>(); + + public static final String JSON_PROPERTY_TESTS = "tests"; + private List tests = new ArrayList<>(); + + public static final String JSON_PROPERTY_TREE_SITTER_QUERY = "tree_sitter_query"; + private String treeSitterQuery; + + public static final String JSON_PROPERTY_VERSION_ID = "version_id"; + private Long versionId; + + public CustomRuleRevisionEmbedded() {} + + @JsonCreator + public CustomRuleRevisionEmbedded( + @JsonProperty(required = true, value = JSON_PROPERTY_ARGUMENTS) List arguments, + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) + CustomRuleRevisionAttributesCategory category, + @JsonProperty(required = true, value = JSON_PROPERTY_CHECKSUM) String checksum, + @JsonProperty(required = true, value = JSON_PROPERTY_CODE) String code, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATION_MESSAGE) String creationMessage, + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_PUBLISHED) Boolean isPublished, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_TESTING) Boolean isTesting, + @JsonProperty(required = true, value = JSON_PROPERTY_LANGUAGE) Language language, + @JsonProperty(required = true, value = JSON_PROPERTY_SEVERITY) + CustomRuleRevisionAttributesSeverity severity, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) + String shortDescription, + @JsonProperty(required = true, value = JSON_PROPERTY_SHOULD_USE_AI_FIX) + Boolean shouldUseAiFix, + @JsonProperty(required = true, value = JSON_PROPERTY_TAGS) List tags, + @JsonProperty(required = true, value = JSON_PROPERTY_TESTS) + List tests, + @JsonProperty(required = true, value = JSON_PROPERTY_TREE_SITTER_QUERY) + String treeSitterQuery, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION_ID) Long versionId) { + this.arguments = arguments; + if (arguments != null) { + for (Argument item : arguments) { + this.unparsed |= item.unparsed; + } + } + this.category = category; + this.unparsed |= !category.isValid(); + this.checksum = checksum; + this.code = code; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.creationMessage = creationMessage; + this.description = description; + this.id = id; + this.isPublished = isPublished; + this.isTesting = isTesting; + this.language = language; + this.unparsed |= !language.isValid(); + this.severity = severity; + this.unparsed |= !severity.isValid(); + this.shortDescription = shortDescription; + this.shouldUseAiFix = shouldUseAiFix; + this.tags = tags; + if (tags != null) {} + this.tests = tests; + if (tests != null) { + for (CustomRuleRevisionTest item : tests) { + this.unparsed |= item.unparsed; + } + } + this.treeSitterQuery = treeSitterQuery; + this.versionId = versionId; + } + + public CustomRuleRevisionEmbedded arguments(List arguments) { + this.arguments = arguments; + for (Argument item : arguments) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRuleRevisionEmbedded addArgumentsItem(Argument argumentsItem) { + this.arguments.add(argumentsItem); + this.unparsed |= argumentsItem.unparsed; + return this; + } + + /** + * Rule arguments + * + * @return arguments + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ARGUMENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getArguments() { + return arguments; + } + + public void setArguments(List arguments) { + this.arguments = arguments; + if (arguments != null) { + for (Argument item : arguments) { + this.unparsed |= item.unparsed; + } + } + } + + public CustomRuleRevisionEmbedded category(CustomRuleRevisionAttributesCategory category) { + this.category = category; + this.unparsed |= !category.isValid(); + return this; + } + + /** + * Rule category + * + * @return category + */ + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevisionAttributesCategory getCategory() { + return category; + } + + public void setCategory(CustomRuleRevisionAttributesCategory category) { + if (!category.isValid()) { + this.unparsed = true; + } + this.category = category; + } + + public CustomRuleRevisionEmbedded checksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * Code checksum + * + * @return checksum + */ + @JsonProperty(JSON_PROPERTY_CHECKSUM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getChecksum() { + return checksum; + } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + public CustomRuleRevisionEmbedded code(String code) { + this.code = code; + return this; + } + + /** + * Rule code + * + * @return code + */ + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public CustomRuleRevisionEmbedded createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation timestamp + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public CustomRuleRevisionEmbedded createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Creator identifier + * + * @return createdBy + */ + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public CustomRuleRevisionEmbedded creationMessage(String creationMessage) { + this.creationMessage = creationMessage; + return this; + } + + /** + * Revision creation message + * + * @return creationMessage + */ + @JsonProperty(JSON_PROPERTY_CREATION_MESSAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreationMessage() { + return creationMessage; + } + + public void setCreationMessage(String creationMessage) { + this.creationMessage = creationMessage; + } + + public CustomRuleRevisionEmbedded cve(String cve) { + this.cve = cve; + return this; + } + + /** + * Associated CVE. Omitted when the revision has no associated CVE. + * + * @return cve + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCve() { + return cve; + } + + public void setCve(String cve) { + this.cve = cve; + } + + public CustomRuleRevisionEmbedded cwe(String cwe) { + this.cwe = cwe; + return this; + } + + /** + * Associated CWE. Omitted when the revision has no associated CWE. + * + * @return cwe + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CWE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCwe() { + return cwe; + } + + public void setCwe(String cwe) { + this.cwe = cwe; + } + + public CustomRuleRevisionEmbedded description(String description) { + this.description = description; + return this; + } + + /** + * Full description + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CustomRuleRevisionEmbedded documentationUrl(String documentationUrl) { + this.documentationUrl = documentationUrl; + return this; + } + + /** + * Documentation URL. Omitted when the revision has no documentation URL. + * + * @return documentationUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDocumentationUrl() { + return documentationUrl; + } + + public void setDocumentationUrl(String documentationUrl) { + this.documentationUrl = documentationUrl; + } + + public CustomRuleRevisionEmbedded id(String id) { + this.id = id; + return this; + } + + /** + * Revision identifier + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CustomRuleRevisionEmbedded isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Whether the revision is published + * + * @return isPublished + */ + @JsonProperty(JSON_PROPERTY_IS_PUBLISHED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsPublished() { + return isPublished; + } + + public void setIsPublished(Boolean isPublished) { + this.isPublished = isPublished; + } + + public CustomRuleRevisionEmbedded isTesting(Boolean isTesting) { + this.isTesting = isTesting; + return this; + } + + /** + * Whether this is a testing revision + * + * @return isTesting + */ + @JsonProperty(JSON_PROPERTY_IS_TESTING) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsTesting() { + return isTesting; + } + + public void setIsTesting(Boolean isTesting) { + this.isTesting = isTesting; + } + + public CustomRuleRevisionEmbedded language(Language language) { + this.language = language; + this.unparsed |= !language.isValid(); + return this; + } + + /** + * Programming language + * + * @return language + */ + @JsonProperty(JSON_PROPERTY_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Language getLanguage() { + return language; + } + + public void setLanguage(Language language) { + if (!language.isValid()) { + this.unparsed = true; + } + this.language = language; + } + + public CustomRuleRevisionEmbedded severity(CustomRuleRevisionAttributesSeverity severity) { + this.severity = severity; + this.unparsed |= !severity.isValid(); + return this; + } + + /** + * Rule severity + * + * @return severity + */ + @JsonProperty(JSON_PROPERTY_SEVERITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevisionAttributesSeverity getSeverity() { + return severity; + } + + public void setSeverity(CustomRuleRevisionAttributesSeverity severity) { + if (!severity.isValid()) { + this.unparsed = true; + } + this.severity = severity; + } + + public CustomRuleRevisionEmbedded shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Short description + * + * @return shortDescription + */ + @JsonProperty(JSON_PROPERTY_SHORT_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getShortDescription() { + return shortDescription; + } + + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + public CustomRuleRevisionEmbedded shouldUseAiFix(Boolean shouldUseAiFix) { + this.shouldUseAiFix = shouldUseAiFix; + return this; + } + + /** + * Whether to use AI for fixes + * + * @return shouldUseAiFix + */ + @JsonProperty(JSON_PROPERTY_SHOULD_USE_AI_FIX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getShouldUseAiFix() { + return shouldUseAiFix; + } + + public void setShouldUseAiFix(Boolean shouldUseAiFix) { + this.shouldUseAiFix = shouldUseAiFix; + } + + public CustomRuleRevisionEmbedded tags(List tags) { + this.tags = tags; + return this; + } + + public CustomRuleRevisionEmbedded addTagsItem(String tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * Rule tags + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public CustomRuleRevisionEmbedded tests(List tests) { + this.tests = tests; + for (CustomRuleRevisionTest item : tests) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRuleRevisionEmbedded addTestsItem(CustomRuleRevisionTest testsItem) { + this.tests.add(testsItem); + this.unparsed |= testsItem.unparsed; + return this; + } + + /** + * Rule tests + * + * @return tests + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TESTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTests() { + return tests; + } + + public void setTests(List tests) { + this.tests = tests; + if (tests != null) { + for (CustomRuleRevisionTest item : tests) { + this.unparsed |= item.unparsed; + } + } + } + + public CustomRuleRevisionEmbedded treeSitterQuery(String treeSitterQuery) { + this.treeSitterQuery = treeSitterQuery; + return this; + } + + /** + * Tree-sitter query + * + * @return treeSitterQuery + */ + @JsonProperty(JSON_PROPERTY_TREE_SITTER_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTreeSitterQuery() { + return treeSitterQuery; + } + + public void setTreeSitterQuery(String treeSitterQuery) { + this.treeSitterQuery = treeSitterQuery; + } + + public CustomRuleRevisionEmbedded versionId(Long versionId) { + this.versionId = versionId; + return this; + } + + /** + * Monotonically increasing version number of the revision. + * + * @return versionId + */ + @JsonProperty(JSON_PROPERTY_VERSION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getVersionId() { + return versionId; + } + + public void setVersionId(Long versionId) { + this.versionId = versionId; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRevisionEmbedded + */ + @JsonAnySetter + public CustomRuleRevisionEmbedded putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRevisionEmbedded object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRevisionEmbedded customRuleRevisionEmbedded = (CustomRuleRevisionEmbedded) o; + return Objects.equals(this.arguments, customRuleRevisionEmbedded.arguments) + && Objects.equals(this.category, customRuleRevisionEmbedded.category) + && Objects.equals(this.checksum, customRuleRevisionEmbedded.checksum) + && Objects.equals(this.code, customRuleRevisionEmbedded.code) + && Objects.equals(this.createdAt, customRuleRevisionEmbedded.createdAt) + && Objects.equals(this.createdBy, customRuleRevisionEmbedded.createdBy) + && Objects.equals(this.creationMessage, customRuleRevisionEmbedded.creationMessage) + && Objects.equals(this.cve, customRuleRevisionEmbedded.cve) + && Objects.equals(this.cwe, customRuleRevisionEmbedded.cwe) + && Objects.equals(this.description, customRuleRevisionEmbedded.description) + && Objects.equals(this.documentationUrl, customRuleRevisionEmbedded.documentationUrl) + && Objects.equals(this.id, customRuleRevisionEmbedded.id) + && Objects.equals(this.isPublished, customRuleRevisionEmbedded.isPublished) + && Objects.equals(this.isTesting, customRuleRevisionEmbedded.isTesting) + && Objects.equals(this.language, customRuleRevisionEmbedded.language) + && Objects.equals(this.severity, customRuleRevisionEmbedded.severity) + && Objects.equals(this.shortDescription, customRuleRevisionEmbedded.shortDescription) + && Objects.equals(this.shouldUseAiFix, customRuleRevisionEmbedded.shouldUseAiFix) + && Objects.equals(this.tags, customRuleRevisionEmbedded.tags) + && Objects.equals(this.tests, customRuleRevisionEmbedded.tests) + && Objects.equals(this.treeSitterQuery, customRuleRevisionEmbedded.treeSitterQuery) + && Objects.equals(this.versionId, customRuleRevisionEmbedded.versionId) + && Objects.equals( + this.additionalProperties, customRuleRevisionEmbedded.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + arguments, + category, + checksum, + code, + createdAt, + createdBy, + creationMessage, + cve, + cwe, + description, + documentationUrl, + id, + isPublished, + isTesting, + language, + severity, + shortDescription, + shouldUseAiFix, + tags, + tests, + treeSitterQuery, + versionId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRevisionEmbedded {\n"); + sb.append(" arguments: ").append(toIndentedString(arguments)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" creationMessage: ").append(toIndentedString(creationMessage)).append("\n"); + sb.append(" cve: ").append(toIndentedString(cve)).append("\n"); + sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" documentationUrl: ").append(toIndentedString(documentationUrl)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); + sb.append(" isTesting: ").append(toIndentedString(isTesting)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n"); + sb.append(" shouldUseAiFix: ").append(toIndentedString(shouldUseAiFix)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" tests: ").append(toIndentedString(tests)).append("\n"); + sb.append(" treeSitterQuery: ").append(toIndentedString(treeSitterQuery)).append("\n"); + sb.append(" versionId: ").append(toIndentedString(versionId)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionInput.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionInput.java new file mode 100644 index 00000000000..044abea7ac2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionInput.java @@ -0,0 +1,746 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * 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. + */ +@JsonPropertyOrder({ + CustomRuleRevisionInput.JSON_PROPERTY_ARGUMENTS, + CustomRuleRevisionInput.JSON_PROPERTY_CATEGORY, + CustomRuleRevisionInput.JSON_PROPERTY_CHECKSUM, + CustomRuleRevisionInput.JSON_PROPERTY_CODE, + CustomRuleRevisionInput.JSON_PROPERTY_CREATED_AT, + CustomRuleRevisionInput.JSON_PROPERTY_CREATED_BY, + CustomRuleRevisionInput.JSON_PROPERTY_CREATION_MESSAGE, + CustomRuleRevisionInput.JSON_PROPERTY_CVE, + CustomRuleRevisionInput.JSON_PROPERTY_CWE, + CustomRuleRevisionInput.JSON_PROPERTY_DESCRIPTION, + CustomRuleRevisionInput.JSON_PROPERTY_DOCUMENTATION_URL, + CustomRuleRevisionInput.JSON_PROPERTY_ID, + CustomRuleRevisionInput.JSON_PROPERTY_IS_PUBLISHED, + CustomRuleRevisionInput.JSON_PROPERTY_IS_TESTING, + CustomRuleRevisionInput.JSON_PROPERTY_LANGUAGE, + CustomRuleRevisionInput.JSON_PROPERTY_SEVERITY, + CustomRuleRevisionInput.JSON_PROPERTY_SHORT_DESCRIPTION, + CustomRuleRevisionInput.JSON_PROPERTY_SHOULD_USE_AI_FIX, + CustomRuleRevisionInput.JSON_PROPERTY_TAGS, + CustomRuleRevisionInput.JSON_PROPERTY_TESTS, + CustomRuleRevisionInput.JSON_PROPERTY_TREE_SITTER_QUERY, + CustomRuleRevisionInput.JSON_PROPERTY_VERSION_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRevisionInput { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ARGUMENTS = "arguments"; + private JsonNullable> arguments = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_CATEGORY = "category"; + private CustomRuleRevisionAttributesCategory category; + + public static final String JSON_PROPERTY_CHECKSUM = "checksum"; + private String checksum; + + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + + public static final String JSON_PROPERTY_CREATION_MESSAGE = "creation_message"; + private String creationMessage; + + public static final String JSON_PROPERTY_CVE = "cve"; + private JsonNullable cve = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CWE = "cwe"; + private JsonNullable cwe = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DOCUMENTATION_URL = "documentation_url"; + private JsonNullable documentationUrl = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_IS_PUBLISHED = "is_published"; + private Boolean isPublished; + + public static final String JSON_PROPERTY_IS_TESTING = "is_testing"; + private Boolean isTesting; + + public static final String JSON_PROPERTY_LANGUAGE = "language"; + private Language language; + + public static final String JSON_PROPERTY_SEVERITY = "severity"; + private CustomRuleRevisionAttributesSeverity severity; + + public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public static final String JSON_PROPERTY_SHOULD_USE_AI_FIX = "should_use_ai_fix"; + private Boolean shouldUseAiFix; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private JsonNullable> tags = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_TESTS = "tests"; + private JsonNullable> tests = + JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_TREE_SITTER_QUERY = "tree_sitter_query"; + private String treeSitterQuery; + + public static final String JSON_PROPERTY_VERSION_ID = "version_id"; + private Long versionId; + + public CustomRuleRevisionInput arguments(List arguments) { + this.arguments = JsonNullable.>of(arguments); + return this; + } + + public CustomRuleRevisionInput addArgumentsItem(Argument argumentsItem) { + if (this.arguments == null || !this.arguments.isPresent()) { + this.arguments = JsonNullable.>of(new ArrayList<>()); + } + try { + this.arguments.get().add(argumentsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Rule arguments + * + * @return arguments + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getArguments() { + return arguments.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARGUMENTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getArguments_JsonNullable() { + return arguments; + } + + @JsonProperty(JSON_PROPERTY_ARGUMENTS) + public void setArguments_JsonNullable(JsonNullable> arguments) { + this.arguments = arguments; + } + + public void setArguments(List arguments) { + this.arguments = JsonNullable.>of(arguments); + } + + public CustomRuleRevisionInput category(CustomRuleRevisionAttributesCategory category) { + this.category = category; + this.unparsed |= !category.isValid(); + return this; + } + + /** + * Rule category + * + * @return category + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRuleRevisionAttributesCategory getCategory() { + return category; + } + + public void setCategory(CustomRuleRevisionAttributesCategory category) { + if (!category.isValid()) { + this.unparsed = true; + } + this.category = category; + } + + /** + * Code checksum + * + * @return checksum + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHECKSUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getChecksum() { + return checksum; + } + + public CustomRuleRevisionInput code(String code) { + this.code = code; + return this; + } + + /** + * Rule code + * + * @return code + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + /** + * Creation timestamp + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Creator identifier + * + * @return createdBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedBy() { + return createdBy; + } + + public CustomRuleRevisionInput creationMessage(String creationMessage) { + this.creationMessage = creationMessage; + return this; + } + + /** + * Revision creation message + * + * @return creationMessage + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATION_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreationMessage() { + return creationMessage; + } + + public void setCreationMessage(String creationMessage) { + this.creationMessage = creationMessage; + } + + public CustomRuleRevisionInput cve(String cve) { + this.cve = JsonNullable.of(cve); + return this; + } + + /** + * Associated CVE + * + * @return cve + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getCve() { + return cve.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCve_JsonNullable() { + return cve; + } + + @JsonProperty(JSON_PROPERTY_CVE) + public void setCve_JsonNullable(JsonNullable cve) { + this.cve = cve; + } + + public void setCve(String cve) { + this.cve = JsonNullable.of(cve); + } + + public CustomRuleRevisionInput cwe(String cwe) { + this.cwe = JsonNullable.of(cwe); + return this; + } + + /** + * Associated CWE + * + * @return cwe + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getCwe() { + return cwe.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CWE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCwe_JsonNullable() { + return cwe; + } + + @JsonProperty(JSON_PROPERTY_CWE) + public void setCwe_JsonNullable(JsonNullable cwe) { + this.cwe = cwe; + } + + public void setCwe(String cwe) { + this.cwe = JsonNullable.of(cwe); + } + + public CustomRuleRevisionInput description(String description) { + this.description = description; + return this; + } + + /** + * Base64-encoded full description + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CustomRuleRevisionInput documentationUrl(String documentationUrl) { + this.documentationUrl = JsonNullable.of(documentationUrl); + return this; + } + + /** + * Documentation URL + * + * @return documentationUrl + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDocumentationUrl() { + return documentationUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDocumentationUrl_JsonNullable() { + return documentationUrl; + } + + @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) + public void setDocumentationUrl_JsonNullable(JsonNullable documentationUrl) { + this.documentationUrl = documentationUrl; + } + + public void setDocumentationUrl(String documentationUrl) { + this.documentationUrl = JsonNullable.of(documentationUrl); + } + + /** + * Revision identifier + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public CustomRuleRevisionInput isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Whether the revision should be published + * + * @return isPublished + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_PUBLISHED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsPublished() { + return isPublished; + } + + public void setIsPublished(Boolean isPublished) { + this.isPublished = isPublished; + } + + public CustomRuleRevisionInput isTesting(Boolean isTesting) { + this.isTesting = isTesting; + return this; + } + + /** + * Whether this is a testing revision + * + * @return isTesting + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_TESTING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsTesting() { + return isTesting; + } + + public void setIsTesting(Boolean isTesting) { + this.isTesting = isTesting; + } + + public CustomRuleRevisionInput language(Language language) { + this.language = language; + this.unparsed |= !language.isValid(); + return this; + } + + /** + * Programming language + * + * @return language + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Language getLanguage() { + return language; + } + + public void setLanguage(Language language) { + if (!language.isValid()) { + this.unparsed = true; + } + this.language = language; + } + + public CustomRuleRevisionInput severity(CustomRuleRevisionAttributesSeverity severity) { + this.severity = severity; + this.unparsed |= !severity.isValid(); + return this; + } + + /** + * Rule severity + * + * @return severity + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SEVERITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRuleRevisionAttributesSeverity getSeverity() { + return severity; + } + + public void setSeverity(CustomRuleRevisionAttributesSeverity severity) { + if (!severity.isValid()) { + this.unparsed = true; + } + this.severity = severity; + } + + public CustomRuleRevisionInput shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Base64-encoded short description + * + * @return shortDescription + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHORT_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getShortDescription() { + return shortDescription; + } + + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + public CustomRuleRevisionInput shouldUseAiFix(Boolean shouldUseAiFix) { + this.shouldUseAiFix = shouldUseAiFix; + return this; + } + + /** + * Whether to use AI for fixes + * + * @return shouldUseAiFix + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHOULD_USE_AI_FIX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getShouldUseAiFix() { + return shouldUseAiFix; + } + + public void setShouldUseAiFix(Boolean shouldUseAiFix) { + this.shouldUseAiFix = shouldUseAiFix; + } + + public CustomRuleRevisionInput tags(List tags) { + this.tags = JsonNullable.>of(tags); + return this; + } + + public CustomRuleRevisionInput addTagsItem(String tagsItem) { + if (this.tags == null || !this.tags.isPresent()) { + this.tags = JsonNullable.>of(new ArrayList<>()); + } + try { + this.tags.get().add(tagsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Rule tags + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getTags() { + return tags.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getTags_JsonNullable() { + return tags; + } + + @JsonProperty(JSON_PROPERTY_TAGS) + public void setTags_JsonNullable(JsonNullable> tags) { + this.tags = tags; + } + + public void setTags(List tags) { + this.tags = JsonNullable.>of(tags); + } + + public CustomRuleRevisionInput tests(List tests) { + this.tests = JsonNullable.>of(tests); + return this; + } + + public CustomRuleRevisionInput addTestsItem(CustomRuleRevisionTest testsItem) { + if (this.tests == null || !this.tests.isPresent()) { + this.tests = JsonNullable.>of(new ArrayList<>()); + } + try { + this.tests.get().add(testsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Rule tests + * + * @return tests + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getTests() { + return tests.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TESTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getTests_JsonNullable() { + return tests; + } + + @JsonProperty(JSON_PROPERTY_TESTS) + public void setTests_JsonNullable(JsonNullable> tests) { + this.tests = tests; + } + + public void setTests(List tests) { + this.tests = JsonNullable.>of(tests); + } + + public CustomRuleRevisionInput treeSitterQuery(String treeSitterQuery) { + this.treeSitterQuery = treeSitterQuery; + return this; + } + + /** + * Tree-sitter query + * + * @return treeSitterQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TREE_SITTER_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTreeSitterQuery() { + return treeSitterQuery; + } + + public void setTreeSitterQuery(String treeSitterQuery) { + this.treeSitterQuery = treeSitterQuery; + } + + /** + * Monotonically increasing version number of the revision. + * + * @return versionId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VERSION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getVersionId() { + return versionId; + } + + /** Return true if this CustomRuleRevisionInput object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRevisionInput customRuleRevisionInput = (CustomRuleRevisionInput) o; + return Objects.equals(this.arguments, customRuleRevisionInput.arguments) + && Objects.equals(this.category, customRuleRevisionInput.category) + && Objects.equals(this.checksum, customRuleRevisionInput.checksum) + && Objects.equals(this.code, customRuleRevisionInput.code) + && Objects.equals(this.createdAt, customRuleRevisionInput.createdAt) + && Objects.equals(this.createdBy, customRuleRevisionInput.createdBy) + && Objects.equals(this.creationMessage, customRuleRevisionInput.creationMessage) + && Objects.equals(this.cve, customRuleRevisionInput.cve) + && Objects.equals(this.cwe, customRuleRevisionInput.cwe) + && Objects.equals(this.description, customRuleRevisionInput.description) + && Objects.equals(this.documentationUrl, customRuleRevisionInput.documentationUrl) + && Objects.equals(this.id, customRuleRevisionInput.id) + && Objects.equals(this.isPublished, customRuleRevisionInput.isPublished) + && Objects.equals(this.isTesting, customRuleRevisionInput.isTesting) + && Objects.equals(this.language, customRuleRevisionInput.language) + && Objects.equals(this.severity, customRuleRevisionInput.severity) + && Objects.equals(this.shortDescription, customRuleRevisionInput.shortDescription) + && Objects.equals(this.shouldUseAiFix, customRuleRevisionInput.shouldUseAiFix) + && Objects.equals(this.tags, customRuleRevisionInput.tags) + && Objects.equals(this.tests, customRuleRevisionInput.tests) + && Objects.equals(this.treeSitterQuery, customRuleRevisionInput.treeSitterQuery) + && Objects.equals(this.versionId, customRuleRevisionInput.versionId); + } + + @Override + public int hashCode() { + return Objects.hash( + arguments, + category, + checksum, + code, + createdAt, + createdBy, + creationMessage, + cve, + cwe, + description, + documentationUrl, + id, + isPublished, + isTesting, + language, + severity, + shortDescription, + shouldUseAiFix, + tags, + tests, + treeSitterQuery, + versionId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRevisionInput {\n"); + sb.append(" arguments: ").append(toIndentedString(arguments)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" creationMessage: ").append(toIndentedString(creationMessage)).append("\n"); + sb.append(" cve: ").append(toIndentedString(cve)).append("\n"); + sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" documentationUrl: ").append(toIndentedString(documentationUrl)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); + sb.append(" isTesting: ").append(toIndentedString(isTesting)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n"); + sb.append(" shouldUseAiFix: ").append(toIndentedString(shouldUseAiFix)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" tests: ").append(toIndentedString(tests)).append("\n"); + sb.append(" treeSitterQuery: ").append(toIndentedString(treeSitterQuery)).append("\n"); + sb.append(" versionId: ").append(toIndentedString(versionId)).append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionInputAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionInputAttributes.java index 5a1be8138c6..8afcd997c5d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionInputAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionInputAttributes.java @@ -13,17 +13,22 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; /** Input attributes for creating or updating a custom rule revision. */ @JsonPropertyOrder({ CustomRuleRevisionInputAttributes.JSON_PROPERTY_ARGUMENTS, CustomRuleRevisionInputAttributes.JSON_PROPERTY_CATEGORY, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_CHECKSUM, CustomRuleRevisionInputAttributes.JSON_PROPERTY_CODE, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_CREATED_AT, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_CREATED_BY, CustomRuleRevisionInputAttributes.JSON_PROPERTY_CREATION_MESSAGE, CustomRuleRevisionInputAttributes.JSON_PROPERTY_CVE, CustomRuleRevisionInputAttributes.JSON_PROPERTY_CWE, @@ -37,7 +42,8 @@ CustomRuleRevisionInputAttributes.JSON_PROPERTY_SHOULD_USE_AI_FIX, CustomRuleRevisionInputAttributes.JSON_PROPERTY_TAGS, CustomRuleRevisionInputAttributes.JSON_PROPERTY_TESTS, - CustomRuleRevisionInputAttributes.JSON_PROPERTY_TREE_SITTER_QUERY + CustomRuleRevisionInputAttributes.JSON_PROPERTY_TREE_SITTER_QUERY, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_VERSION_ID }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -49,23 +55,32 @@ public class CustomRuleRevisionInputAttributes { public static final String JSON_PROPERTY_CATEGORY = "category"; private CustomRuleRevisionAttributesCategory category; + public static final String JSON_PROPERTY_CHECKSUM = "checksum"; + private String checksum; + public static final String JSON_PROPERTY_CODE = "code"; private String code; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + public static final String JSON_PROPERTY_CREATION_MESSAGE = "creation_message"; private String creationMessage; public static final String JSON_PROPERTY_CVE = "cve"; - private String cve; + private JsonNullable cve = JsonNullable.undefined(); public static final String JSON_PROPERTY_CWE = "cwe"; - private String cwe; + private JsonNullable cwe = JsonNullable.undefined(); public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; public static final String JSON_PROPERTY_DOCUMENTATION_URL = "documentation_url"; - private String documentationUrl; + private JsonNullable documentationUrl = JsonNullable.undefined(); public static final String JSON_PROPERTY_IS_PUBLISHED = "is_published"; private Boolean isPublished; @@ -94,6 +109,9 @@ public class CustomRuleRevisionInputAttributes { public static final String JSON_PROPERTY_TREE_SITTER_QUERY = "tree_sitter_query"; private String treeSitterQuery; + public static final String JSON_PROPERTY_VERSION_ID = "version_id"; + private Long versionId; + public CustomRuleRevisionInputAttributes() {} @JsonCreator @@ -103,11 +121,7 @@ public CustomRuleRevisionInputAttributes( CustomRuleRevisionAttributesCategory category, @JsonProperty(required = true, value = JSON_PROPERTY_CODE) String code, @JsonProperty(required = true, value = JSON_PROPERTY_CREATION_MESSAGE) String creationMessage, - @JsonProperty(required = true, value = JSON_PROPERTY_CVE) String cve, - @JsonProperty(required = true, value = JSON_PROPERTY_CWE) String cwe, @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, - @JsonProperty(required = true, value = JSON_PROPERTY_DOCUMENTATION_URL) - String documentationUrl, @JsonProperty(required = true, value = JSON_PROPERTY_IS_PUBLISHED) Boolean isPublished, @JsonProperty(required = true, value = JSON_PROPERTY_IS_TESTING) Boolean isTesting, @JsonProperty(required = true, value = JSON_PROPERTY_LANGUAGE) Language language, @@ -123,20 +137,16 @@ public CustomRuleRevisionInputAttributes( @JsonProperty(required = true, value = JSON_PROPERTY_TREE_SITTER_QUERY) String treeSitterQuery) { this.arguments = arguments; - for (Argument item : arguments) { - this.unparsed |= item.unparsed; + if (arguments != null) { + for (Argument item : arguments) { + this.unparsed |= item.unparsed; + } } this.category = category; this.unparsed |= !category.isValid(); this.code = code; this.creationMessage = creationMessage; - this.cve = cve; - if (cve != null) {} - this.cwe = cwe; - if (cwe != null) {} this.description = description; - this.documentationUrl = documentationUrl; - if (documentationUrl != null) {} this.isPublished = isPublished; this.isTesting = isTesting; this.language = language; @@ -146,9 +156,12 @@ public CustomRuleRevisionInputAttributes( this.shortDescription = shortDescription; this.shouldUseAiFix = shouldUseAiFix; this.tags = tags; + if (tags != null) {} this.tests = tests; - for (CustomRuleRevisionTest item : tests) { - this.unparsed |= item.unparsed; + if (tests != null) { + for (CustomRuleRevisionTest item : tests) { + this.unparsed |= item.unparsed; + } } this.treeSitterQuery = treeSitterQuery; } @@ -172,6 +185,7 @@ public CustomRuleRevisionInputAttributes addArgumentsItem(Argument argumentsItem * * @return arguments */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ARGUMENTS) @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getArguments() { @@ -211,6 +225,18 @@ public void setCategory(CustomRuleRevisionAttributesCategory category) { this.category = category; } + /** + * Code checksum. Derived by the API from code; ignored on write. + * + * @return checksum + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHECKSUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getChecksum() { + return checksum; + } + public CustomRuleRevisionInputAttributes code(String code) { this.code = code; return this; @@ -231,6 +257,30 @@ public void setCode(String code) { this.code = code; } + /** + * Creation timestamp. Set by the API; ignored on write. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Creator identifier. Set by the API from the caller; ignored on write. + * + * @return createdBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedBy() { + return createdBy; + } + public CustomRuleRevisionInputAttributes creationMessage(String creationMessage) { this.creationMessage = creationMessage; return this; @@ -252,8 +302,7 @@ public void setCreationMessage(String creationMessage) { } public CustomRuleRevisionInputAttributes cve(String cve) { - this.cve = cve; - if (cve != null) {} + this.cve = JsonNullable.of(cve); return this; } @@ -263,19 +312,28 @@ public CustomRuleRevisionInputAttributes cve(String cve) { * @return cve */ @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_CVE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonIgnore public String getCve() { + return cve.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCve_JsonNullable() { return cve; } - public void setCve(String cve) { + @JsonProperty(JSON_PROPERTY_CVE) + public void setCve_JsonNullable(JsonNullable cve) { this.cve = cve; } + public void setCve(String cve) { + this.cve = JsonNullable.of(cve); + } + public CustomRuleRevisionInputAttributes cwe(String cwe) { - this.cwe = cwe; - if (cwe != null) {} + this.cwe = JsonNullable.of(cwe); return this; } @@ -285,16 +343,26 @@ public CustomRuleRevisionInputAttributes cwe(String cwe) { * @return cwe */ @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_CWE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonIgnore public String getCwe() { + return cwe.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CWE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCwe_JsonNullable() { return cwe; } - public void setCwe(String cwe) { + @JsonProperty(JSON_PROPERTY_CWE) + public void setCwe_JsonNullable(JsonNullable cwe) { this.cwe = cwe; } + public void setCwe(String cwe) { + this.cwe = JsonNullable.of(cwe); + } + public CustomRuleRevisionInputAttributes description(String description) { this.description = description; return this; @@ -316,8 +384,7 @@ public void setDescription(String description) { } public CustomRuleRevisionInputAttributes documentationUrl(String documentationUrl) { - this.documentationUrl = documentationUrl; - if (documentationUrl != null) {} + this.documentationUrl = JsonNullable.of(documentationUrl); return this; } @@ -327,16 +394,26 @@ public CustomRuleRevisionInputAttributes documentationUrl(String documentationUr * @return documentationUrl */ @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonIgnore public String getDocumentationUrl() { + return documentationUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDocumentationUrl_JsonNullable() { return documentationUrl; } - public void setDocumentationUrl(String documentationUrl) { + @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) + public void setDocumentationUrl_JsonNullable(JsonNullable documentationUrl) { this.documentationUrl = documentationUrl; } + public void setDocumentationUrl(String documentationUrl) { + this.documentationUrl = JsonNullable.of(documentationUrl); + } + public CustomRuleRevisionInputAttributes isPublished(Boolean isPublished) { this.isPublished = isPublished; return this; @@ -480,6 +557,7 @@ public CustomRuleRevisionInputAttributes addTagsItem(String tagsItem) { * * @return tags */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getTags() { @@ -509,6 +587,7 @@ public CustomRuleRevisionInputAttributes addTestsItem(CustomRuleRevisionTest tes * * @return tests */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TESTS) @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getTests() { @@ -544,6 +623,18 @@ public void setTreeSitterQuery(String treeSitterQuery) { this.treeSitterQuery = treeSitterQuery; } + /** + * Monotonically increasing version number of the revision. Assigned by the API; ignored on write. + * + * @return versionId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VERSION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getVersionId() { + return versionId; + } + /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -603,7 +694,10 @@ public boolean equals(Object o) { (CustomRuleRevisionInputAttributes) o; return Objects.equals(this.arguments, customRuleRevisionInputAttributes.arguments) && Objects.equals(this.category, customRuleRevisionInputAttributes.category) + && Objects.equals(this.checksum, customRuleRevisionInputAttributes.checksum) && Objects.equals(this.code, customRuleRevisionInputAttributes.code) + && Objects.equals(this.createdAt, customRuleRevisionInputAttributes.createdAt) + && Objects.equals(this.createdBy, customRuleRevisionInputAttributes.createdBy) && Objects.equals(this.creationMessage, customRuleRevisionInputAttributes.creationMessage) && Objects.equals(this.cve, customRuleRevisionInputAttributes.cve) && Objects.equals(this.cwe, customRuleRevisionInputAttributes.cwe) @@ -618,6 +712,7 @@ public boolean equals(Object o) { && Objects.equals(this.tags, customRuleRevisionInputAttributes.tags) && Objects.equals(this.tests, customRuleRevisionInputAttributes.tests) && Objects.equals(this.treeSitterQuery, customRuleRevisionInputAttributes.treeSitterQuery) + && Objects.equals(this.versionId, customRuleRevisionInputAttributes.versionId) && Objects.equals( this.additionalProperties, customRuleRevisionInputAttributes.additionalProperties); } @@ -627,7 +722,10 @@ public int hashCode() { return Objects.hash( arguments, category, + checksum, code, + createdAt, + createdBy, creationMessage, cve, cwe, @@ -642,6 +740,7 @@ public int hashCode() { tags, tests, treeSitterQuery, + versionId, additionalProperties); } @@ -651,7 +750,10 @@ public String toString() { sb.append("class CustomRuleRevisionInputAttributes {\n"); sb.append(" arguments: ").append(toIndentedString(arguments)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); sb.append(" creationMessage: ").append(toIndentedString(creationMessage)).append("\n"); sb.append(" cve: ").append(toIndentedString(cve)).append("\n"); sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n"); @@ -666,6 +768,7 @@ public String toString() { sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" tests: ").append(toIndentedString(tests)).append("\n"); sb.append(" treeSitterQuery: ").append(toIndentedString(treeSitterQuery)).append("\n"); + sb.append(" versionId: ").append(toIndentedString(versionId)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionRequest.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionRequest.java index bac22a175f1..a2b134fda92 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionRequest.java @@ -17,14 +17,41 @@ import java.util.Objects; /** Request body for creating a new custom rule revision. */ -@JsonPropertyOrder({CustomRuleRevisionRequest.JSON_PROPERTY_DATA}) +@JsonPropertyOrder({ + CustomRuleRevisionRequest.JSON_PROPERTY__AUTHENTICATION_TOKEN, + CustomRuleRevisionRequest.JSON_PROPERTY_DATA +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class CustomRuleRevisionRequest { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY__AUTHENTICATION_TOKEN = "_authentication_token"; + private String AuthenticationToken; + public static final String JSON_PROPERTY_DATA = "data"; private CustomRuleRevisionRequestData data; + public CustomRuleRevisionRequest AuthenticationToken(String AuthenticationToken) { + this.AuthenticationToken = AuthenticationToken; + return this; + } + + /** + * CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + * + * @return AuthenticationToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY__AUTHENTICATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthenticationToken() { + return AuthenticationToken; + } + + public void setAuthenticationToken(String AuthenticationToken) { + this.AuthenticationToken = AuthenticationToken; + } + public CustomRuleRevisionRequest data(CustomRuleRevisionRequestData data) { this.data = data; this.unparsed |= data.unparsed; @@ -106,20 +133,24 @@ public boolean equals(Object o) { return false; } CustomRuleRevisionRequest customRuleRevisionRequest = (CustomRuleRevisionRequest) o; - return Objects.equals(this.data, customRuleRevisionRequest.data) + return Objects.equals(this.AuthenticationToken, customRuleRevisionRequest.AuthenticationToken) + && Objects.equals(this.data, customRuleRevisionRequest.data) && Objects.equals( this.additionalProperties, customRuleRevisionRequest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(data, additionalProperties); + return Objects.hash(AuthenticationToken, data, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CustomRuleRevisionRequest {\n"); + sb.append(" AuthenticationToken: ") + .append(toIndentedString(AuthenticationToken)) + .append("\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionTest.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionTest.java index 462e1fad892..1ced54a82a0 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionTest.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionTest.java @@ -54,7 +54,7 @@ public CustomRuleRevisionTest annotationCount(Long annotationCount) { } /** - * Expected violation count + * Expected violation count minimum: 0 maximum: 65535 * * @return annotationCount */ diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetAttributes.java index 5bac6aae0f5..9d5826fac0e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetAttributes.java @@ -46,7 +46,7 @@ public class CustomRulesetAttributes { private String name; public static final String JSON_PROPERTY_RULES = "rules"; - private List rules = new ArrayList<>(); + private List rules = new ArrayList<>(); public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; private String shortDescription; @@ -59,7 +59,8 @@ public CustomRulesetAttributes( @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, - @JsonProperty(required = true, value = JSON_PROPERTY_RULES) List rules, + @JsonProperty(required = true, value = JSON_PROPERTY_RULES) + List rules, @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) String shortDescription) { this.createdAt = createdAt; @@ -68,7 +69,7 @@ public CustomRulesetAttributes( this.name = name; this.rules = rules; if (rules != null) { - for (CustomRule item : rules) { + for (CustomRulesetRuleEmbedded item : rules) { this.unparsed |= item.unparsed; } } @@ -155,15 +156,15 @@ public void setName(String name) { this.name = name; } - public CustomRulesetAttributes rules(List rules) { + public CustomRulesetAttributes rules(List rules) { this.rules = rules; - for (CustomRule item : rules) { + for (CustomRulesetRuleEmbedded item : rules) { this.unparsed |= item.unparsed; } return this; } - public CustomRulesetAttributes addRulesItem(CustomRule rulesItem) { + public CustomRulesetAttributes addRulesItem(CustomRulesetRuleEmbedded rulesItem) { this.rules.add(rulesItem); this.unparsed |= rulesItem.unparsed; return this; @@ -177,14 +178,14 @@ public CustomRulesetAttributes addRulesItem(CustomRule rulesItem) { @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_RULES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getRules() { + public List getRules() { return rules; } - public void setRules(List rules) { + public void setRules(List rules) { this.rules = rules; if (rules != null) { - for (CustomRule item : rules) { + for (CustomRulesetRuleEmbedded item : rules) { this.unparsed |= item.unparsed; } } diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequest.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequest.java index 838c341b25e..e6894c7ab9d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequest.java @@ -32,7 +32,10 @@ public CustomRulesetRequest data(CustomRulesetRequestData data) { } /** - * 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. * * @return data */ diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestData.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestData.java index be94c6c64be..86cbfb4086d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestData.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestData.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -16,7 +17,12 @@ import java.util.Map; import java.util.Objects; -/** 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. + */ @JsonPropertyOrder({ CustomRulesetRequestData.JSON_PROPERTY_ATTRIBUTES, CustomRulesetRequestData.JSON_PROPERTY_ID, @@ -35,6 +41,21 @@ public class CustomRulesetRequestData { public static final String JSON_PROPERTY_TYPE = "type"; private CustomRulesetDataType type; + public CustomRulesetRequestData() {} + + @JsonCreator + public CustomRulesetRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CustomRulesetRequestDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CustomRulesetDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + public CustomRulesetRequestData attributes(CustomRulesetRequestDataAttributes attributes) { this.attributes = attributes; this.unparsed |= attributes.unparsed; @@ -42,13 +63,13 @@ public CustomRulesetRequestData attributes(CustomRulesetRequestDataAttributes at } /** - * 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. * * @return attributes */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public CustomRulesetRequestDataAttributes getAttributes() { return attributes; } @@ -66,13 +87,12 @@ public CustomRulesetRequestData id(String id) { } /** - * Ruleset identifier + * Ruleset identifier, which is the same as the ruleset name. * * @return id */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getId() { return id; } @@ -92,9 +112,8 @@ public CustomRulesetRequestData type(CustomRulesetDataType type) { * * @return type */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public CustomRulesetDataType getType() { return type; } diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestDataAttributes.java index 59c5ee53c49..70d816f58af 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestDataAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestDataAttributes.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -19,7 +20,10 @@ import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; -/** 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. + */ @JsonPropertyOrder({ CustomRulesetRequestDataAttributes.JSON_PROPERTY_DESCRIPTION, CustomRulesetRequestDataAttributes.JSON_PROPERTY_NAME, @@ -42,6 +46,14 @@ public class CustomRulesetRequestDataAttributes { public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; private String shortDescription; + public CustomRulesetRequestDataAttributes() {} + + @JsonCreator + public CustomRulesetRequestDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.name = name; + } + public CustomRulesetRequestDataAttributes description(String description) { this.description = description; return this; @@ -69,13 +81,12 @@ public CustomRulesetRequestDataAttributes name(String name) { } /** - * Ruleset name + * Ruleset name, which must be the same as the resource identifier. * * @return name */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getName() { return name; } diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRuleEmbedded.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRuleEmbedded.java new file mode 100644 index 00000000000..725d6b12f19 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRuleEmbedded.java @@ -0,0 +1,317 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A custom static analysis rule as embedded in the rules list of a ruleset response. */ +@JsonPropertyOrder({ + CustomRulesetRuleEmbedded.JSON_PROPERTY_CREATED_AT, + CustomRulesetRuleEmbedded.JSON_PROPERTY_CREATED_BY, + CustomRulesetRuleEmbedded.JSON_PROPERTY_ID, + CustomRulesetRuleEmbedded.JSON_PROPERTY_LAST_REVISION, + CustomRulesetRuleEmbedded.JSON_PROPERTY_NAME, + CustomRulesetRuleEmbedded.JSON_PROPERTY_REVISIONS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRulesetRuleEmbedded { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_LAST_REVISION = "last_revision"; + private CustomRuleRevisionEmbedded lastRevision; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_REVISIONS = "revisions"; + private List revisions = new ArrayList<>(); + + public CustomRulesetRuleEmbedded() {} + + @JsonCreator + public CustomRulesetRuleEmbedded( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_REVISION) + CustomRuleRevisionEmbedded lastRevision, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_REVISIONS) + List revisions) { + this.createdAt = createdAt; + this.createdBy = createdBy; + this.id = id; + this.lastRevision = lastRevision; + this.unparsed |= lastRevision.unparsed; + this.name = name; + this.revisions = revisions; + if (revisions != null) { + for (CustomRuleRevisionEmbedded item : revisions) { + this.unparsed |= item.unparsed; + } + } + } + + public CustomRulesetRuleEmbedded createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation timestamp + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public CustomRulesetRuleEmbedded createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Creator identifier + * + * @return createdBy + */ + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public CustomRulesetRuleEmbedded id(String id) { + this.id = id; + return this; + } + + /** + * Rule identifier, which is the same as the rule name. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CustomRulesetRuleEmbedded lastRevision(CustomRuleRevisionEmbedded lastRevision) { + this.lastRevision = lastRevision; + this.unparsed |= lastRevision.unparsed; + return this; + } + + /** + * A revision of a custom static analysis rule as embedded in a rule or ruleset response. + * + * @return lastRevision + */ + @JsonProperty(JSON_PROPERTY_LAST_REVISION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevisionEmbedded getLastRevision() { + return lastRevision; + } + + public void setLastRevision(CustomRuleRevisionEmbedded lastRevision) { + this.lastRevision = lastRevision; + if (lastRevision != null) { + this.unparsed |= lastRevision.unparsed; + } + } + + public CustomRulesetRuleEmbedded name(String name) { + this.name = name; + return this; + } + + /** + * Rule name + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CustomRulesetRuleEmbedded revisions(List revisions) { + this.revisions = revisions; + for (CustomRuleRevisionEmbedded item : revisions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRulesetRuleEmbedded addRevisionsItem(CustomRuleRevisionEmbedded revisionsItem) { + this.revisions.add(revisionsItem); + this.unparsed |= revisionsItem.unparsed; + return this; + } + + /** + * Revision history of the rule. + * + * @return revisions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REVISIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRevisions() { + return revisions; + } + + public void setRevisions(List revisions) { + this.revisions = revisions; + if (revisions != null) { + for (CustomRuleRevisionEmbedded item : revisions) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRulesetRuleEmbedded + */ + @JsonAnySetter + public CustomRulesetRuleEmbedded putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRulesetRuleEmbedded object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRulesetRuleEmbedded customRulesetRuleEmbedded = (CustomRulesetRuleEmbedded) o; + return Objects.equals(this.createdAt, customRulesetRuleEmbedded.createdAt) + && Objects.equals(this.createdBy, customRulesetRuleEmbedded.createdBy) + && Objects.equals(this.id, customRulesetRuleEmbedded.id) + && Objects.equals(this.lastRevision, customRulesetRuleEmbedded.lastRevision) + && Objects.equals(this.name, customRulesetRuleEmbedded.name) + && Objects.equals(this.revisions, customRulesetRuleEmbedded.revisions) + && Objects.equals( + this.additionalProperties, customRulesetRuleEmbedded.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, createdBy, id, lastRevision, name, revisions, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRulesetRuleEmbedded {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" lastRevision: ").append(toIndentedString(lastRevision)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" revisions: ").append(toIndentedString(revisions)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GetAstRequest.java b/src/main/java/com/datadog/api/client/v2/model/GetAstRequest.java index 5ec965ddf96..f72ced02600 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GetAstRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstRequest.java @@ -18,11 +18,17 @@ import java.util.Objects; /** The request payload for parsing source code into an abstract syntax tree. */ -@JsonPropertyOrder({GetAstRequest.JSON_PROPERTY_DATA}) +@JsonPropertyOrder({ + GetAstRequest.JSON_PROPERTY__AUTHENTICATION_TOKEN, + GetAstRequest.JSON_PROPERTY_DATA +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class GetAstRequest { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY__AUTHENTICATION_TOKEN = "_authentication_token"; + private String AuthenticationToken; + public static final String JSON_PROPERTY_DATA = "data"; private GetAstRequestData data; @@ -35,6 +41,27 @@ public GetAstRequest( this.unparsed |= data.unparsed; } + public GetAstRequest AuthenticationToken(String AuthenticationToken) { + this.AuthenticationToken = AuthenticationToken; + return this; + } + + /** + * CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + * + * @return AuthenticationToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY__AUTHENTICATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthenticationToken() { + return AuthenticationToken; + } + + public void setAuthenticationToken(String AuthenticationToken) { + this.AuthenticationToken = AuthenticationToken; + } + public GetAstRequest data(GetAstRequestData data) { this.data = data; this.unparsed |= data.unparsed; @@ -115,19 +142,23 @@ public boolean equals(Object o) { return false; } GetAstRequest getAstRequest = (GetAstRequest) o; - return Objects.equals(this.data, getAstRequest.data) + return Objects.equals(this.AuthenticationToken, getAstRequest.AuthenticationToken) + && Objects.equals(this.data, getAstRequest.data) && Objects.equals(this.additionalProperties, getAstRequest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(data, additionalProperties); + return Objects.hash(AuthenticationToken, data, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GetAstRequest {\n"); + sb.append(" AuthenticationToken: ") + .append(toIndentedString(AuthenticationToken)) + .append("\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/GetAstResponseData.java b/src/main/java/com/datadog/api/client/v2/model/GetAstResponseData.java index 9e5bdd6812b..d98c50da815 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GetAstResponseData.java +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstResponseData.java @@ -42,9 +42,11 @@ public GetAstResponseData() {} public GetAstResponseData( @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) GetAstResponseDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GetAstResponseDataType type) { this.attributes = attributes; this.unparsed |= attributes.unparsed; + this.id = id; this.type = type; this.unparsed |= !type.isValid(); } @@ -79,13 +81,12 @@ public GetAstResponseData id(String id) { } /** - * The identifier of the get-AST response resource. + * The identifier of the get-AST response resource, echoed from the request. * * @return id */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getId() { return id; } diff --git a/src/main/java/com/datadog/api/client/v2/model/GetAstResponseDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GetAstResponseDataAttributes.java index 8033d479a24..43e174d68aa 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GetAstResponseDataAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstResponseDataAttributes.java @@ -18,45 +18,45 @@ import java.util.Objects; /** The attributes of the get-AST response, containing the parsed abstract syntax tree. */ -@JsonPropertyOrder({GetAstResponseDataAttributes.JSON_PROPERTY_AST}) +@JsonPropertyOrder({GetAstResponseDataAttributes.JSON_PROPERTY_RESULT}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class GetAstResponseDataAttributes { @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_AST = "ast"; - private Map ast = new HashMap(); + public static final String JSON_PROPERTY_RESULT = "result"; + private AstNode result; public GetAstResponseDataAttributes() {} @JsonCreator public GetAstResponseDataAttributes( - @JsonProperty(required = true, value = JSON_PROPERTY_AST) Map ast) { - this.ast = ast; + @JsonProperty(required = true, value = JSON_PROPERTY_RESULT) AstNode result) { + this.result = result; + this.unparsed |= result.unparsed; } - public GetAstResponseDataAttributes ast(Map ast) { - this.ast = ast; - return this; - } - - public GetAstResponseDataAttributes putAstItem(String key, Object astItem) { - this.ast.put(key, astItem); + public GetAstResponseDataAttributes result(AstNode result) { + this.result = result; + this.unparsed |= result.unparsed; return this; } /** - * The parsed abstract syntax tree as a JSON object. + * A node in the abstract syntax tree of the parsed source code. * - * @return ast + * @return result */ - @JsonProperty(JSON_PROPERTY_AST) + @JsonProperty(JSON_PROPERTY_RESULT) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Map getAst() { - return ast; + public AstNode getResult() { + return result; } - public void setAst(Map ast) { - this.ast = ast; + public void setResult(AstNode result) { + this.result = result; + if (result != null) { + this.unparsed |= result.unparsed; + } } /** @@ -115,21 +115,21 @@ public boolean equals(Object o) { return false; } GetAstResponseDataAttributes getAstResponseDataAttributes = (GetAstResponseDataAttributes) o; - return Objects.equals(this.ast, getAstResponseDataAttributes.ast) + return Objects.equals(this.result, getAstResponseDataAttributes.result) && Objects.equals( this.additionalProperties, getAstResponseDataAttributes.additionalProperties); } @Override public int hashCode() { - return Objects.hash(ast, additionalProperties); + return Objects.hash(result, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GetAstResponseDataAttributes {\n"); - sb.append(" ast: ").append(toIndentedString(ast)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsRequest.java b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsRequest.java index 6c12ce7eabb..a8ec7b9fc2e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsRequest.java @@ -17,14 +17,41 @@ import java.util.Objects; /** The request payload for retrieving rules for multiple rulesets in a single batch call. */ -@JsonPropertyOrder({GetMultipleRulesetsRequest.JSON_PROPERTY_DATA}) +@JsonPropertyOrder({ + GetMultipleRulesetsRequest.JSON_PROPERTY__AUTHENTICATION_TOKEN, + GetMultipleRulesetsRequest.JSON_PROPERTY_DATA +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class GetMultipleRulesetsRequest { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY__AUTHENTICATION_TOKEN = "_authentication_token"; + private String AuthenticationToken; + public static final String JSON_PROPERTY_DATA = "data"; private GetMultipleRulesetsRequestData data; + public GetMultipleRulesetsRequest AuthenticationToken(String AuthenticationToken) { + this.AuthenticationToken = AuthenticationToken; + return this; + } + + /** + * CSRF token for security, sent by browser-based clients. Ignored by the API when absent. + * + * @return AuthenticationToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY__AUTHENTICATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthenticationToken() { + return AuthenticationToken; + } + + public void setAuthenticationToken(String AuthenticationToken) { + this.AuthenticationToken = AuthenticationToken; + } + public GetMultipleRulesetsRequest data(GetMultipleRulesetsRequestData data) { this.data = data; this.unparsed |= data.unparsed; @@ -107,20 +134,24 @@ public boolean equals(Object o) { return false; } GetMultipleRulesetsRequest getMultipleRulesetsRequest = (GetMultipleRulesetsRequest) o; - return Objects.equals(this.data, getMultipleRulesetsRequest.data) + return Objects.equals(this.AuthenticationToken, getMultipleRulesetsRequest.AuthenticationToken) + && Objects.equals(this.data, getMultipleRulesetsRequest.data) && Objects.equals( this.additionalProperties, getMultipleRulesetsRequest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(data, additionalProperties); + return Objects.hash(AuthenticationToken, data, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GetMultipleRulesetsRequest {\n"); + sb.append(" AuthenticationToken: ") + .append(toIndentedString(AuthenticationToken)) + .append("\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponse.java b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponse.java index c71d9990767..9ea61c344e6 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponse.java +++ b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponse.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -28,6 +29,16 @@ public class GetMultipleRulesetsResponse { public static final String JSON_PROPERTY_DATA = "data"; private GetMultipleRulesetsResponseData data; + public GetMultipleRulesetsResponse() {} + + @JsonCreator + public GetMultipleRulesetsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + GetMultipleRulesetsResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + public GetMultipleRulesetsResponse data(GetMultipleRulesetsResponseData data) { this.data = data; this.unparsed |= data.unparsed; @@ -40,9 +51,8 @@ public GetMultipleRulesetsResponse data(GetMultipleRulesetsResponseData data) { * * @return data */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DATA) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public GetMultipleRulesetsResponseData getData() { return data; } diff --git a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseData.java b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseData.java index 7cfad7c7100..1db61186988 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseData.java +++ b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseData.java @@ -44,8 +44,14 @@ public GetMultipleRulesetsResponseData() {} @JsonCreator public GetMultipleRulesetsResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GetMultipleRulesetsResponseDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GetMultipleRulesetsResponseDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; this.type = type; this.unparsed |= !type.isValid(); } @@ -63,9 +69,8 @@ public GetMultipleRulesetsResponseData attributes( * * @return attributes */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public GetMultipleRulesetsResponseDataAttributes getAttributes() { return attributes; } @@ -83,13 +88,12 @@ public GetMultipleRulesetsResponseData id(String id) { } /** - * The unique identifier of the get-multiple-rulesets response resource. + * The unique identifier of the get-multiple-rulesets response resource, echoed from the request. * * @return id */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getId() { return id; } diff --git a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributes.java index cfb42456208..2f307bce8ea 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributes.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -27,24 +28,31 @@ public class GetMultipleRulesetsResponseDataAttributes { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_RULESETS = "rulesets"; - private List rulesets = null; + private List rulesets = new ArrayList<>(); + + public GetMultipleRulesetsResponseDataAttributes() {} + + @JsonCreator + public GetMultipleRulesetsResponseDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_RULESETS) + List rulesets) { + this.rulesets = rulesets; + for (GetMultipleRulesetsResponseDataAttributesRulesetsItems item : rulesets) { + this.unparsed |= item.unparsed; + } + } public GetMultipleRulesetsResponseDataAttributes rulesets( List rulesets) { this.rulesets = rulesets; - if (rulesets != null) { - for (GetMultipleRulesetsResponseDataAttributesRulesetsItems item : rulesets) { - this.unparsed |= item.unparsed; - } + for (GetMultipleRulesetsResponseDataAttributesRulesetsItems item : rulesets) { + this.unparsed |= item.unparsed; } return this; } public GetMultipleRulesetsResponseDataAttributes addRulesetsItem( GetMultipleRulesetsResponseDataAttributesRulesetsItems rulesetsItem) { - if (this.rulesets == null) { - this.rulesets = new ArrayList<>(); - } this.rulesets.add(rulesetsItem); this.unparsed |= rulesetsItem.unparsed; return this; @@ -55,9 +63,8 @@ public GetMultipleRulesetsResponseDataAttributes addRulesetsItem( * * @return rulesets */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_RULESETS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getRulesets() { return rulesets; } diff --git a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItems.java b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItems.java index 4dfca2d2bd9..fe93fff0019 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItems.java +++ b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItems.java @@ -21,8 +21,8 @@ /** A ruleset returned in the response, containing its metadata and associated rules. */ @JsonPropertyOrder({ - GetMultipleRulesetsResponseDataAttributesRulesetsItems.JSON_PROPERTY_DATA, GetMultipleRulesetsResponseDataAttributesRulesetsItems.JSON_PROPERTY_DESCRIPTION, + GetMultipleRulesetsResponseDataAttributesRulesetsItems.JSON_PROPERTY_ID, GetMultipleRulesetsResponseDataAttributesRulesetsItems.JSON_PROPERTY_NAME, GetMultipleRulesetsResponseDataAttributesRulesetsItems.JSON_PROPERTY_RULES, GetMultipleRulesetsResponseDataAttributesRulesetsItems.JSON_PROPERTY_SHORT_DESCRIPTION @@ -31,17 +31,18 @@ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class GetMultipleRulesetsResponseDataAttributesRulesetsItems { @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_DATA = "data"; - private GetMultipleRulesetsResponseDataAttributesRulesetsItemsData data; - public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + public static final String JSON_PROPERTY_NAME = "name"; private String name; public static final String JSON_PROPERTY_RULES = "rules"; - private List rules = null; + private List rules = + new ArrayList<>(); public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; private String shortDescription; @@ -50,56 +51,61 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItems() {} @JsonCreator public GetMultipleRulesetsResponseDataAttributesRulesetsItems( - @JsonProperty(required = true, value = JSON_PROPERTY_DATA) - GetMultipleRulesetsResponseDataAttributesRulesetsItemsData data) { - this.data = data; - this.unparsed |= data.unparsed; + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_RULES) + List rules, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) + String shortDescription) { + this.description = description; + this.id = id; + this.name = name; + this.rules = rules; + for (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems item : rules) { + this.unparsed |= item.unparsed; + } + this.shortDescription = shortDescription; } - public GetMultipleRulesetsResponseDataAttributesRulesetsItems data( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsData data) { - this.data = data; - this.unparsed |= data.unparsed; + public GetMultipleRulesetsResponseDataAttributesRulesetsItems description(String description) { + this.description = description; return this; } /** - * The resource identifier and type for a ruleset. + * A detailed description of the ruleset's purpose and the types of issues it targets. * - * @return data + * @return description */ - @JsonProperty(JSON_PROPERTY_DATA) + @JsonProperty(JSON_PROPERTY_DESCRIPTION) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsData getData() { - return data; + public String getDescription() { + return description; } - public void setData(GetMultipleRulesetsResponseDataAttributesRulesetsItemsData data) { - this.data = data; - if (data != null) { - this.unparsed |= data.unparsed; - } + public void setDescription(String description) { + this.description = description; } - public GetMultipleRulesetsResponseDataAttributesRulesetsItems description(String description) { - this.description = description; + public GetMultipleRulesetsResponseDataAttributesRulesetsItems id(String id) { + this.id = id; return this; } /** - * A detailed description of the ruleset's purpose and the types of issues it targets. + * The unique identifier of the ruleset, which is the same as its name. * - * @return description + * @return id */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_DESCRIPTION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDescription() { - return description; + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; } - public void setDescription(String description) { - this.description = description; + public void setId(String id) { + this.id = id; } public GetMultipleRulesetsResponseDataAttributesRulesetsItems name(String name) { @@ -112,9 +118,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItems name(String name) * * @return name */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getName() { return name; } @@ -126,19 +131,14 @@ public void setName(String name) { public GetMultipleRulesetsResponseDataAttributesRulesetsItems rules( List rules) { this.rules = rules; - if (rules != null) { - for (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems item : rules) { - this.unparsed |= item.unparsed; - } + for (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems item : rules) { + this.unparsed |= item.unparsed; } return this; } public GetMultipleRulesetsResponseDataAttributesRulesetsItems addRulesItem( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems rulesItem) { - if (this.rules == null) { - this.rules = new ArrayList<>(); - } this.rules.add(rulesItem); this.unparsed |= rulesItem.unparsed; return this; @@ -149,9 +149,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItems addRulesItem( * * @return rules */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_RULES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getRules() { return rules; } @@ -177,9 +176,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItems shortDescription( * * @return shortDescription */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_SHORT_DESCRIPTION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getShortDescription() { return shortDescription; } @@ -250,9 +248,9 @@ public boolean equals(Object o) { GetMultipleRulesetsResponseDataAttributesRulesetsItems getMultipleRulesetsResponseDataAttributesRulesetsItems = (GetMultipleRulesetsResponseDataAttributesRulesetsItems) o; - return Objects.equals(this.data, getMultipleRulesetsResponseDataAttributesRulesetsItems.data) - && Objects.equals( + return Objects.equals( this.description, getMultipleRulesetsResponseDataAttributesRulesetsItems.description) + && Objects.equals(this.id, getMultipleRulesetsResponseDataAttributesRulesetsItems.id) && Objects.equals(this.name, getMultipleRulesetsResponseDataAttributesRulesetsItems.name) && Objects.equals(this.rules, getMultipleRulesetsResponseDataAttributesRulesetsItems.rules) && Objects.equals( @@ -265,15 +263,15 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(data, description, name, rules, shortDescription, additionalProperties); + return Objects.hash(description, id, name, rules, shortDescription, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GetMultipleRulesetsResponseDataAttributesRulesetsItems {\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.java b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.java index 3226480c2b5..e8ec8dfe05d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.java +++ b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.java @@ -33,10 +33,10 @@ GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_CREATED_BY, GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_CVE, GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_CWE, - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_DATA, GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_DESCRIPTION, GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_DOCUMENTATION_URL, GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_ENTITY_CHECKED, + GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_ID, GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_IS_PUBLISHED, GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_IS_TESTING, GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.JSON_PROPERTY_LANGUAGE, @@ -57,7 +57,7 @@ public class GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ARGUMENTS = "arguments"; private List - arguments = null; + arguments = new ArrayList<>(); public static final String JSON_PROPERTY_CATEGORY = "category"; private String category; @@ -80,9 +80,6 @@ public class GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems { public static final String JSON_PROPERTY_CWE = "cwe"; private String cwe; - public static final String JSON_PROPERTY_DATA = "data"; - private GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData data; - public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; @@ -92,6 +89,9 @@ public class GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems { public static final String JSON_PROPERTY_ENTITY_CHECKED = "entity_checked"; private String entityChecked; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + public static final String JSON_PROPERTY_IS_PUBLISHED = "is_published"; private Boolean isPublished; @@ -124,7 +124,7 @@ public class GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems { public static final String JSON_PROPERTY_TESTS = "tests"; private List tests = - null; + new ArrayList<>(); public static final String JSON_PROPERTY_TREE_SITTER_QUERY = "tree_sitter_query"; private String treeSitterQuery; @@ -136,21 +136,66 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems() {} @JsonCreator public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems( - @JsonProperty(required = true, value = JSON_PROPERTY_DATA) - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData data) { - this.data = data; - this.unparsed |= data.unparsed; + @JsonProperty(required = true, value = JSON_PROPERTY_ARGUMENTS) + List + arguments, + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) String category, + @JsonProperty(required = true, value = JSON_PROPERTY_CHECKSUM) String checksum, + @JsonProperty(required = true, value = JSON_PROPERTY_CODE) String code, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_PUBLISHED) Boolean isPublished, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_TESTING) Boolean isTesting, + @JsonProperty(required = true, value = JSON_PROPERTY_LANGUAGE) String language, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_UPDATED_AT) + OffsetDateTime lastUpdatedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_UPDATED_BY) String lastUpdatedBy, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_SEVERITY) String severity, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) + String shortDescription, + @JsonProperty(required = true, value = JSON_PROPERTY_SHOULD_USE_AI_FIX) + Boolean shouldUseAiFix, + @JsonProperty(required = true, value = JSON_PROPERTY_TESTS) + List tests, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.arguments = arguments; + for (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems item : + arguments) { + this.unparsed |= item.unparsed; + } + this.category = category; + this.checksum = checksum; + this.code = code; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.description = description; + this.id = id; + this.isPublished = isPublished; + this.isTesting = isTesting; + this.language = language; + this.lastUpdatedAt = lastUpdatedAt; + this.lastUpdatedBy = lastUpdatedBy; + this.name = name; + this.severity = severity; + this.shortDescription = shortDescription; + this.shouldUseAiFix = shouldUseAiFix; + this.tests = tests; + for (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems item : tests) { + this.unparsed |= item.unparsed; + } + this.type = type; } public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems arguments( List arguments) { this.arguments = arguments; - if (arguments != null) { - for (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems item : - arguments) { - this.unparsed |= item.unparsed; - } + for (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems item : + arguments) { + this.unparsed |= item.unparsed; } return this; } @@ -158,9 +203,6 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems argument public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems addArgumentsItem( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems argumentsItem) { - if (this.arguments == null) { - this.arguments = new ArrayList<>(); - } this.arguments.add(argumentsItem); this.unparsed |= argumentsItem.unparsed; return this; @@ -171,9 +213,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems addArgum * * @return arguments */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ARGUMENTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getArguments() { return arguments; @@ -203,9 +244,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems category * * @return category */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_CATEGORY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getCategory() { return category; } @@ -225,9 +265,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems checksum * * @return checksum */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_CHECKSUM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getChecksum() { return checksum; } @@ -246,9 +285,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems code(Str * * @return code */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getCode() { return code; } @@ -268,9 +306,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems createdA * * @return createdAt */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public OffsetDateTime getCreatedAt() { return createdAt; } @@ -290,9 +327,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems createdB * * @return createdBy */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_CREATED_BY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getCreatedBy() { return createdBy; } @@ -343,31 +379,6 @@ public void setCwe(String cwe) { this.cwe = cwe; } - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems data( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData data) { - this.data = data; - this.unparsed |= data.unparsed; - return this; - } - - /** - * The resource identifier and type for a static analysis rule. - * - * @return data - */ - @JsonProperty(JSON_PROPERTY_DATA) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData getData() { - return data; - } - - public void setData(GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData data) { - this.data = data; - if (data != null) { - this.unparsed |= data.unparsed; - } - } - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems description( String description) { this.description = description; @@ -379,9 +390,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems descript * * @return description */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DESCRIPTION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getDescription() { return description; } @@ -434,6 +444,26 @@ public void setEntityChecked(String entityChecked) { this.entityChecked = entityChecked; } + public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the rule, which is the same as its name. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems isPublished( Boolean isPublished) { this.isPublished = isPublished; @@ -445,9 +475,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems isPublis * * @return isPublished */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_IS_PUBLISHED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getIsPublished() { return isPublished; } @@ -467,9 +496,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems isTestin * * @return isTesting */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_IS_TESTING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getIsTesting() { return isTesting; } @@ -489,9 +517,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems language * * @return language */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_LANGUAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getLanguage() { return language; } @@ -511,9 +538,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems lastUpda * * @return lastUpdatedAt */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_LAST_UPDATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public OffsetDateTime getLastUpdatedAt() { return lastUpdatedAt; } @@ -533,9 +559,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems lastUpda * * @return lastUpdatedBy */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_LAST_UPDATED_BY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getLastUpdatedBy() { return lastUpdatedBy; } @@ -554,9 +579,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems name(Str * * @return name */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getName() { return name; } @@ -597,9 +621,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems severity * * @return severity */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_SEVERITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getSeverity() { return severity; } @@ -619,9 +642,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems shortDes * * @return shortDescription */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_SHORT_DESCRIPTION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getShortDescription() { return shortDescription; } @@ -641,9 +663,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems shouldUs * * @return shouldUseAiFix */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_SHOULD_USE_AI_FIX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getShouldUseAiFix() { return shouldUseAiFix; } @@ -655,20 +676,14 @@ public void setShouldUseAiFix(Boolean shouldUseAiFix) { public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems tests( List tests) { this.tests = tests; - if (tests != null) { - for (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems item : - tests) { - this.unparsed |= item.unparsed; - } + for (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems item : tests) { + this.unparsed |= item.unparsed; } return this; } public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems addTestsItem( GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems testsItem) { - if (this.tests == null) { - this.tests = new ArrayList<>(); - } this.tests.add(testsItem); this.unparsed |= testsItem.unparsed; return this; @@ -679,9 +694,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems addTests * * @return tests */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TESTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getTests() { return tests; @@ -730,9 +744,8 @@ public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems type(Str * * @return type */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getType() { return type; } @@ -824,8 +837,6 @@ public boolean equals(Object o) { this.cve, getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.cve) && Objects.equals( this.cwe, getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.cwe) - && Objects.equals( - this.data, getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.data) && Objects.equals( this.description, getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.description) @@ -835,6 +846,8 @@ public boolean equals(Object o) { && Objects.equals( this.entityChecked, getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.entityChecked) + && Objects.equals( + this.id, getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.id) && Objects.equals( this.isPublished, getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems.isPublished) @@ -886,10 +899,10 @@ public int hashCode() { createdBy, cve, cwe, - data, description, documentationUrl, entityChecked, + id, isPublished, isTesting, language, @@ -918,10 +931,10 @@ public String toString() { sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); sb.append(" cve: ").append(toIndentedString(cve)).append("\n"); sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" documentationUrl: ").append(toIndentedString(documentationUrl)).append("\n"); sb.append(" entityChecked: ").append(toIndentedString(entityChecked)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); sb.append(" isTesting: ").append(toIndentedString(isTesting)).append("\n"); sb.append(" language: ").append(toIndentedString(language)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData.java b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData.java deleted file mode 100644 index e1b1e5ae215..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData.java +++ /dev/null @@ -1,192 +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. - */ - -package com.datadog.api.client.v2.model; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** The resource identifier and type for a static analysis rule. */ -@JsonPropertyOrder({ - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData.JSON_PROPERTY_ID, - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData.JSON_PROPERTY_TYPE -}) -@jakarta.annotation.Generated( - value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData { - @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_ID = "id"; - private String id; - - public static final String JSON_PROPERTY_TYPE = "type"; - private GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType type = - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType.RULES; - - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData() {} - - @JsonCreator - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData( - @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType type) { - this.type = type; - this.unparsed |= !type.isValid(); - } - - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData id(String id) { - this.id = id; - return this; - } - - /** - * The unique identifier of the rule resource. - * - * @return id - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData type( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType type) { - this.type = type; - this.unparsed |= !type.isValid(); - return this; - } - - /** - * Rules resource type. - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType getType() { - return type; - } - - public void setType( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType type) { - if (!type.isValid()) { - this.unparsed = true; - } - this.type = type; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key The arbitrary key to set - * @param value The associated value - * @return GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData - */ - @JsonAnySetter - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData putAdditionalProperty( - String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return The additional properties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key The arbitrary key to get - * @return The specific additional property for the given key - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - /** - * Return true if this GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData object - * is equal to o. - */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData - getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData = - (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) o; - return Objects.equals( - this.id, getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData.id) - && Objects.equals( - this.type, getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData.type) - && Objects.equals( - this.additionalProperties, - getMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData - .additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(id, type, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append('}'); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType.java b/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType.java deleted file mode 100644 index fba0da317b2..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType.java +++ /dev/null @@ -1,67 +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. - */ - -package com.datadog.api.client.v2.model; - -import com.datadog.api.client.ModelEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** Rules resource type. */ -@JsonSerialize( - using = - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType - .GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataTypeSerializer - .class) -public class GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType - extends ModelEnum { - - private static final Set allowedValues = new HashSet(Arrays.asList("rules")); - - public static final GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType - RULES = new GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType("rules"); - - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType(String value) { - super(value, allowedValues); - } - - public static - class GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataTypeSerializer - extends StdSerializer< - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType> { - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataTypeSerializer( - Class t) { - super(t); - } - - public GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataTypeSerializer() { - this(null); - } - - @Override - public void serialize( - GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType value, - JsonGenerator jgen, - SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.value); - } - } - - @JsonCreator - public static GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType fromValue( - String value) { - return new GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType(value); - } -} diff --git a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature index 12b40ab104a..8eab51db49f 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature b/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature index 2ecb0c9668c..8a7dc3489ae 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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