diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 52c13bf6e5..c4a0bb4c2f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -5072,6 +5072,20 @@ components: type: string x-enum-varnames: - ARBITRARY_RULE + Argument: + properties: + description: + description: Base64-encoded argument description + example: YXJndW1lbnQgZGVzY3JpcHRpb24= + type: string + name: + description: Base64-encoded argument name + example: YXJndW1lbnRfbmFtZQ== + type: string + required: + - name + - description + type: object AsanaAccessToken: description: The definition of the `AsanaAccessToken` object. properties: @@ -15882,6 +15896,397 @@ components: - version - name type: object + CustomRule: + 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/CustomRuleRevision' + description: Most recent revision + nullable: true + name: + description: Rule name + example: my-rule + type: string + required: + - name + - created_at + - created_by + - last_revision + type: object + CustomRuleDataType: + description: Resource type + enum: + - custom_rule + example: custom_rule + type: string + x-enum-varnames: + - CUSTOM_RULE + CustomRuleRequest: + properties: + data: + $ref: '#/components/schemas/CustomRuleRequestData' + type: object + CustomRuleRequestData: + properties: + attributes: + $ref: '#/components/schemas/CustomRuleRequestDataAttributes' + id: + description: Rule identifier + type: string + type: + $ref: '#/components/schemas/CustomRuleDataType' + type: object + CustomRuleRequestDataAttributes: + properties: + name: + description: Rule name + type: string + type: object + CustomRuleResponse: + properties: + data: + $ref: '#/components/schemas/CustomRuleResponseData' + required: + - data + type: object + CustomRuleResponseData: + properties: + attributes: + $ref: '#/components/schemas/CustomRule' + id: + description: Rule identifier + example: my-rule + type: string + type: + $ref: '#/components/schemas/CustomRuleDataType' + required: + - id + - type + - attributes + type: object + CustomRuleRevision: + properties: + attributes: + $ref: '#/components/schemas/CustomRuleRevisionAttributes' + id: + description: Revision identifier + example: revision-123 + type: string + type: + $ref: '#/components/schemas/CustomRuleRevisionDataType' + required: + - id + - type + - attributes + type: object + CustomRuleRevisionAttributes: + properties: + arguments: + description: Rule arguments + items: + $ref: '#/components/schemas/Argument' + 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 + example: CVE-2024-1234 + nullable: true + type: string + cwe: + description: Associated CWE + example: CWE-79 + nullable: true + type: string + description: + description: Full description + example: bG9uZyBkZXNjcmlwdGlvbg== + type: string + documentation_url: + description: Documentation URL + example: https://docs.example.com/rules/my-rule + nullable: true + 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: + type: string + type: array + tests: + description: Rule tests + items: + $ref: '#/components/schemas/CustomRuleRevisionTest' + type: array + tree_sitter_query: + description: Tree-sitter query + example: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + type: string + required: + - creation_message + - short_description + - description + - code + - checksum + - language + - tree_sitter_query + - created_at + - created_by + - severity + - category + - cve + - cwe + - arguments + - tests + - tags + - is_published + - should_use_ai_fix + - documentation_url + - is_testing + type: object + CustomRuleRevisionAttributesCategory: + description: Rule category + enum: + - SECURITY + - BEST_PRACTICES + - CODE_STYLE + - ERROR_PRONE + - PERFORMANCE + example: SECURITY + type: string + x-enum-varnames: + - SECURITY + - BEST_PRACTICES + - CODE_STYLE + - ERROR_PRONE + - PERFORMANCE + CustomRuleRevisionAttributesSeverity: + description: Rule severity + enum: + - ERROR + - WARNING + - NOTICE + example: ERROR + type: string + x-enum-varnames: + - ERROR + - WARNING + - NOTICE + CustomRuleRevisionDataType: + description: Resource type + enum: + - custom_rule_revision + example: custom_rule_revision + type: string + x-enum-varnames: + - CUSTOM_RULE_REVISION + CustomRuleRevisionRequest: + properties: + data: + $ref: '#/components/schemas/CustomRuleRevisionRequestData' + type: object + CustomRuleRevisionRequestData: + properties: + attributes: + $ref: '#/components/schemas/CustomRuleRevisionAttributes' + id: + description: Revision identifier + type: string + type: + $ref: '#/components/schemas/CustomRuleRevisionDataType' + type: object + CustomRuleRevisionResponse: + properties: + data: + $ref: '#/components/schemas/CustomRuleRevision' + required: + - data + type: object + CustomRuleRevisionTest: + properties: + annotation_count: + description: Expected violation count + example: 1 + format: int64 + type: integer + code: + description: Test code + example: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + type: string + filename: + description: Test filename + example: test.yaml + type: string + required: + - filename + - code + - annotation_count + type: object + CustomRuleRevisionsResponse: + properties: + data: + items: + $ref: '#/components/schemas/CustomRuleRevision' + type: array + type: object + CustomRuleset: + properties: + attributes: + $ref: '#/components/schemas/CustomRulesetAttributes' + id: + description: Ruleset identifier + example: my-ruleset + type: string + type: + $ref: '#/components/schemas/CustomRulesetDataType' + required: + - id + - type + - attributes + type: object + CustomRulesetAttributes: + 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 + description: + description: Base64-encoded full description + example: bG9uZyBkZXNjcmlwdGlvbg== + type: string + name: + description: Ruleset name + example: my-ruleset + type: string + rules: + description: Rules in the ruleset + items: + $ref: '#/components/schemas/CustomRule' + nullable: true + type: array + short_description: + description: Base64-encoded short description + example: c2hvcnQgZGVzY3JpcHRpb24= + type: string + required: + - name + - short_description + - description + - created_at + - created_by + - rules + type: object + CustomRulesetDataType: + description: Resource type + enum: + - custom_ruleset + example: custom_ruleset + type: string + x-enum-varnames: + - CUSTOM_RULESET + CustomRulesetRequest: + properties: + data: + $ref: '#/components/schemas/CustomRulesetRequestData' + type: object + CustomRulesetRequestData: + properties: + attributes: + $ref: '#/components/schemas/CustomRulesetRequestDataAttributes' + id: + description: Ruleset identifier + type: string + type: + $ref: '#/components/schemas/CustomRulesetDataType' + type: object + CustomRulesetRequestDataAttributes: + properties: + created_at: + description: Creation timestamp (auto-generated on server) + format: date-time + type: string + created_by: + description: Creator identifier (auto-generated on server) + type: string + description: + description: Base64-encoded full description + type: string + name: + description: Ruleset name + type: string + rules: + description: Rules in the ruleset + items: + $ref: '#/components/schemas/CustomRule' + nullable: true + type: array + short_description: + description: Base64-encoded short description + type: string + type: object + CustomRulesetResponse: + properties: + data: + $ref: '#/components/schemas/CustomRuleset' + required: + - data + type: object DORACustomTags: description: A list of user-defined tags. The tags must follow the `key:value` pattern. Up to 100 may be added per event. @@ -30066,6 +30471,34 @@ components: format: int64 type: integer type: object + Language: + description: Programming language + enum: + - PYTHON + - JAVASCRIPT + - TYPESCRIPT + - JAVA + - GO + - YAML + - RUBY + - CSHARP + - PHP + - KOTLIN + - SWIFT + example: PYTHON + type: string + x-enum-varnames: + - PYTHON + - JAVASCRIPT + - TYPESCRIPT + - JAVA + - GO + - YAML + - RUBY + - CSHARP + - PHP + - KOTLIN + - SWIFT LaunchDarklyAPIKey: description: The definition of the `LaunchDarklyAPIKey` object. properties: @@ -44535,6 +44968,37 @@ components: - interval - maxRetries type: object + RevertCustomRuleRevisionDataType: + description: Request type + enum: + - revert_custom_rule_revision_request + type: string + x-enum-varnames: + - REVERT_CUSTOM_RULE_REVISION_REQUEST + RevertCustomRuleRevisionRequest: + properties: + data: + $ref: '#/components/schemas/RevertCustomRuleRevisionRequestData' + type: object + RevertCustomRuleRevisionRequestData: + properties: + attributes: + $ref: '#/components/schemas/RevertCustomRuleRevisionRequestDataAttributes' + id: + description: Request identifier + type: string + type: + $ref: '#/components/schemas/RevertCustomRuleRevisionDataType' + type: object + RevertCustomRuleRevisionRequestDataAttributes: + properties: + current_revision_id: + description: Current revision ID + type: string + revert_to_revision_id: + description: Target revision ID to revert to + type: string + type: object Role: description: Role object returned by the API. properties: @@ -86941,6 +87405,510 @@ paths: tags: - Static Analysis x-unstable: '**Note**: This endpoint may be subject to changes.' + /api/v2/static-analysis/custom/rulesets/{ruleset_name}: + delete: + description: Delete a custom ruleset + operationId: DeleteCustomRuleset + parameters: + - description: The ruleset name + in: path + name: ruleset_name + required: true + schema: + type: string + responses: + '200': + description: Successfully deleted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized - custom rules not enabled + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Ruleset not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete Custom Ruleset + tags: + - Static Analysis + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Get a custom ruleset by name + operationId: ShowCustomRuleset + parameters: + - description: The ruleset name + in: path + name: ruleset_name + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomRulesetResponse' + description: Successful response + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized - custom rules not enabled + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Ruleset not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Show Custom Ruleset + tags: + - Static Analysis + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: Update an existing custom ruleset + operationId: UpdateCustomRuleset + parameters: + - description: The ruleset name + in: path + name: ruleset_name + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CustomRulesetRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomRulesetResponse' + description: Successfully updated + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized - custom rules not enabled + '412': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Precondition failed - validation error or ruleset not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update Custom Ruleset + tags: + - Static Analysis + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules: + put: + description: Create a new custom rule within a ruleset + operationId: CreateCustomRule + parameters: + - description: The ruleset name + in: path + name: ruleset_name + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CustomRuleRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomRuleResponse' + description: Successfully created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized - custom rules not enabled + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Conflict - rule already exists + '412': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Precondition failed - validation error or ruleset not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create Custom Rule + tags: + - Static Analysis + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}: + delete: + description: Delete a custom rule + operationId: DeleteCustomRule + parameters: + - description: The ruleset name + in: path + name: ruleset_name + required: true + schema: + type: string + - description: The rule name + in: path + name: rule_name + required: true + schema: + type: string + responses: + '200': + description: Successfully deleted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized - custom rules not enabled + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Rule not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete Custom Rule + tags: + - Static Analysis + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Get a custom rule by name + operationId: ShowCustomRule + parameters: + - description: The ruleset name + in: path + name: ruleset_name + required: true + schema: + type: string + - description: The rule name + in: path + name: rule_name + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomRuleResponse' + description: Successful response + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized - custom rules not enabled + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Rule not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Show Custom Rule + tags: + - Static Analysis + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions: + get: + description: Get all revisions for a custom rule + operationId: ListCustomRuleRevisions + parameters: + - description: The ruleset name + in: path + name: ruleset_name + required: true + schema: + type: string + - description: The rule name + in: path + name: rule_name + required: true + schema: + type: string + - description: Pagination offset + in: query + name: page[offset] + required: false + schema: + default: 0 + type: integer + - description: Pagination limit + in: query + name: page[limit] + required: false + schema: + default: 10 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomRuleRevisionsResponse' + description: Successful response + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized - custom rules not enabled + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Rule not found + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Too many requests + summary: List Custom Rule Revisions + tags: + - Static Analysis + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + put: + description: Create a new revision for a custom rule + operationId: CreateCustomRuleRevision + parameters: + - description: The ruleset name + in: path + name: ruleset_name + required: true + schema: + type: string + - description: The rule name + in: path + name: rule_name + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CustomRuleRevisionRequest' + required: true + responses: + '200': + description: Successfully created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized - custom rules not enabled + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Rule not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create Custom Rule Revision + tags: + - Static Analysis + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions/revert: + post: + description: Revert a custom rule to a previous revision + operationId: RevertCustomRuleRevision + parameters: + - description: The ruleset name + in: path + name: ruleset_name + required: true + schema: + type: string + - description: The rule name + in: path + name: rule_name + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RevertCustomRuleRevisionRequest' + required: true + responses: + '200': + description: Successfully reverted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized - custom rules not enabled + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Revert Custom Rule Revision + tags: + - Static Analysis + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions/{id}: + get: + description: Get a specific revision of a custom rule + operationId: ShowCustomRuleRevision + parameters: + - description: The ruleset name + in: path + name: ruleset_name + required: true + schema: + type: string + - description: The rule name + in: path + name: rule_name + required: true + schema: + type: string + - description: The revision ID + in: path + name: id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomRuleRevisionResponse' + description: Successful response + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized - custom rules not enabled + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Revision not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Show Custom Rule Revision + tags: + - Static Analysis + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/static-analysis/rulesets: post: description: Get rules for multiple rulesets in batch. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index d697650e88..dcb0d8d6b2 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -1124,6 +1124,13 @@ datadog\_api\_client.v2.model.arbitrary\_rule\_response\_data\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.argument module +--------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.argument + :members: + :show-inheritance: + datadog\_api\_client.v2.model.asana\_access\_token module --------------------------------------------------------- @@ -6486,6 +6493,174 @@ datadog\_api\_client.v2.model.custom\_framework\_without\_requirements module :members: :show-inheritance: +datadog\_api\_client.v2.model.custom\_rule module +------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_data\_type module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_request module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_request\_data module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_request\_data\_attributes module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_request_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_response module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_response\_data module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_revision module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_revision + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_revision\_attributes module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_revision_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_revision\_attributes\_category module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_revision_attributes_category + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_revision\_attributes\_severity module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_revision_attributes_severity + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_revision\_data\_type module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_revision_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_revision\_request module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_revision_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_revision\_request\_data module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_revision_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_revision\_response module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_revision_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_revision\_test module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_revision_test + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_rule\_revisions\_response module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_rule_revisions_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_ruleset module +---------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_ruleset + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_ruleset\_attributes module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_ruleset_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_ruleset\_data\_type module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_ruleset_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_ruleset\_request module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_ruleset_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_ruleset\_request\_data module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_ruleset_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_ruleset\_request\_data\_attributes module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_ruleset_request_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.custom\_ruleset\_response module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_ruleset_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.cvss module ----------------------------------------- @@ -12800,6 +12975,13 @@ datadog\_api\_client.v2.model.kind\_response\_meta module :members: :show-inheritance: +datadog\_api\_client.v2.model.language module +--------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.language + :members: + :show-inheritance: + datadog\_api\_client.v2.model.launch\_darkly\_api\_key module ------------------------------------------------------------- @@ -19408,6 +19590,34 @@ datadog\_api\_client.v2.model.retry\_strategy\_linear module :members: :show-inheritance: +datadog\_api\_client.v2.model.revert\_custom\_rule\_revision\_data\_type module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.revert_custom_rule_revision_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.revert\_custom\_rule\_revision\_request module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.revert_custom_rule_revision_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.revert\_custom\_rule\_revision\_request\_data module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.revert_custom_rule_revision_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.revert\_custom\_rule\_revision\_request\_data\_attributes module +---------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.revert_custom_rule_revision_request_data_attributes + :members: + :show-inheritance: + datadog\_api\_client.v2.model.role module ----------------------------------------- diff --git a/examples/v2/static-analysis/CreateCustomRule.py b/examples/v2/static-analysis/CreateCustomRule.py new file mode 100644 index 0000000000..41511e6d89 --- /dev/null +++ b/examples/v2/static-analysis/CreateCustomRule.py @@ -0,0 +1,25 @@ +""" +Create Custom Rule returns "Successfully created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi +from datadog_api_client.v2.model.custom_rule_data_type import CustomRuleDataType +from datadog_api_client.v2.model.custom_rule_request import CustomRuleRequest +from datadog_api_client.v2.model.custom_rule_request_data import CustomRuleRequestData +from datadog_api_client.v2.model.custom_rule_request_data_attributes import CustomRuleRequestDataAttributes + +body = CustomRuleRequest( + data=CustomRuleRequestData( + attributes=CustomRuleRequestDataAttributes(), + type=CustomRuleDataType.CUSTOM_RULE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_custom_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = StaticAnalysisApi(api_client) + response = api_instance.create_custom_rule(ruleset_name="ruleset_name", body=body) + + print(response) diff --git a/examples/v2/static-analysis/CreateCustomRuleRevision.py b/examples/v2/static-analysis/CreateCustomRuleRevision.py new file mode 100644 index 0000000000..cff84974af --- /dev/null +++ b/examples/v2/static-analysis/CreateCustomRuleRevision.py @@ -0,0 +1,65 @@ +""" +Create Custom Rule Revision returns "Successfully created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi +from datadog_api_client.v2.model.argument import Argument +from datadog_api_client.v2.model.custom_rule_revision_attributes import CustomRuleRevisionAttributes +from datadog_api_client.v2.model.custom_rule_revision_attributes_category import CustomRuleRevisionAttributesCategory +from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import CustomRuleRevisionAttributesSeverity +from datadog_api_client.v2.model.custom_rule_revision_data_type import CustomRuleRevisionDataType +from datadog_api_client.v2.model.custom_rule_revision_request import CustomRuleRevisionRequest +from datadog_api_client.v2.model.custom_rule_revision_request_data import CustomRuleRevisionRequestData +from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest +from datadog_api_client.v2.model.language import Language +from datetime import datetime +from dateutil.tz import tzutc + +body = CustomRuleRevisionRequest( + data=CustomRuleRevisionRequestData( + attributes=CustomRuleRevisionAttributes( + arguments=[ + Argument( + description="YXJndW1lbnQgZGVzY3JpcHRpb24=", + name="YXJndW1lbnRfbmFtZQ==", + ), + ], + category=CustomRuleRevisionAttributesCategory.SECURITY, + checksum="8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", + code="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + created_at=datetime(2026, 1, 9, 13, 0, 57, 473141, tzinfo=tzutc()), + created_by="foobarbaz", + creation_message="Initial revision", + cve="CVE-2024-1234", + cwe="CWE-79", + description="bG9uZyBkZXNjcmlwdGlvbg==", + documentation_url="https://docs.example.com/rules/my-rule", + is_published=False, + is_testing=False, + language=Language.PYTHON, + severity=CustomRuleRevisionAttributesSeverity.ERROR, + short_description="c2hvcnQgZGVzY3JpcHRpb24=", + should_use_ai_fix=False, + tags=[ + "security", + "custom", + ], + tests=[ + CustomRuleRevisionTest( + annotation_count=1, + code="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + filename="test.yaml", + ), + ], + tree_sitter_query="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + ), + type=CustomRuleRevisionDataType.CUSTOM_RULE_REVISION, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_custom_rule_revision"] = True +with ApiClient(configuration) as api_client: + api_instance = StaticAnalysisApi(api_client) + api_instance.create_custom_rule_revision(ruleset_name="ruleset_name", rule_name="rule_name", body=body) diff --git a/examples/v2/static-analysis/DeleteCustomRule.py b/examples/v2/static-analysis/DeleteCustomRule.py new file mode 100644 index 0000000000..18cc4a8160 --- /dev/null +++ b/examples/v2/static-analysis/DeleteCustomRule.py @@ -0,0 +1,15 @@ +""" +Delete Custom Rule returns "Successfully deleted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi + +configuration = Configuration() +configuration.unstable_operations["delete_custom_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = StaticAnalysisApi(api_client) + api_instance.delete_custom_rule( + ruleset_name="ruleset_name", + rule_name="rule_name", + ) diff --git a/examples/v2/static-analysis/DeleteCustomRuleset.py b/examples/v2/static-analysis/DeleteCustomRuleset.py new file mode 100644 index 0000000000..cfe5b41860 --- /dev/null +++ b/examples/v2/static-analysis/DeleteCustomRuleset.py @@ -0,0 +1,14 @@ +""" +Delete Custom Ruleset returns "Successfully deleted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi + +configuration = Configuration() +configuration.unstable_operations["delete_custom_ruleset"] = True +with ApiClient(configuration) as api_client: + api_instance = StaticAnalysisApi(api_client) + api_instance.delete_custom_ruleset( + ruleset_name="ruleset_name", + ) diff --git a/examples/v2/static-analysis/ListCustomRuleRevisions.py b/examples/v2/static-analysis/ListCustomRuleRevisions.py new file mode 100644 index 0000000000..8182d49ae1 --- /dev/null +++ b/examples/v2/static-analysis/ListCustomRuleRevisions.py @@ -0,0 +1,17 @@ +""" +List Custom Rule Revisions returns "Successful response" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi + +configuration = Configuration() +configuration.unstable_operations["list_custom_rule_revisions"] = True +with ApiClient(configuration) as api_client: + api_instance = StaticAnalysisApi(api_client) + response = api_instance.list_custom_rule_revisions( + ruleset_name="ruleset_name", + rule_name="rule_name", + ) + + print(response) diff --git a/examples/v2/static-analysis/RevertCustomRuleRevision.py b/examples/v2/static-analysis/RevertCustomRuleRevision.py new file mode 100644 index 0000000000..3a80a9317e --- /dev/null +++ b/examples/v2/static-analysis/RevertCustomRuleRevision.py @@ -0,0 +1,25 @@ +""" +Revert Custom Rule Revision returns "Successfully reverted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi +from datadog_api_client.v2.model.revert_custom_rule_revision_data_type import RevertCustomRuleRevisionDataType +from datadog_api_client.v2.model.revert_custom_rule_revision_request import RevertCustomRuleRevisionRequest +from datadog_api_client.v2.model.revert_custom_rule_revision_request_data import RevertCustomRuleRevisionRequestData +from datadog_api_client.v2.model.revert_custom_rule_revision_request_data_attributes import ( + RevertCustomRuleRevisionRequestDataAttributes, +) + +body = RevertCustomRuleRevisionRequest( + data=RevertCustomRuleRevisionRequestData( + attributes=RevertCustomRuleRevisionRequestDataAttributes(), + type=RevertCustomRuleRevisionDataType.REVERT_CUSTOM_RULE_REVISION_REQUEST, + ), +) + +configuration = Configuration() +configuration.unstable_operations["revert_custom_rule_revision"] = True +with ApiClient(configuration) as api_client: + api_instance = StaticAnalysisApi(api_client) + api_instance.revert_custom_rule_revision(ruleset_name="ruleset_name", rule_name="rule_name", body=body) diff --git a/examples/v2/static-analysis/ShowCustomRule.py b/examples/v2/static-analysis/ShowCustomRule.py new file mode 100644 index 0000000000..a24c99cdd4 --- /dev/null +++ b/examples/v2/static-analysis/ShowCustomRule.py @@ -0,0 +1,17 @@ +""" +Show Custom Rule returns "Successful response" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi + +configuration = Configuration() +configuration.unstable_operations["show_custom_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = StaticAnalysisApi(api_client) + response = api_instance.show_custom_rule( + ruleset_name="ruleset_name", + rule_name="rule_name", + ) + + print(response) diff --git a/examples/v2/static-analysis/ShowCustomRuleRevision.py b/examples/v2/static-analysis/ShowCustomRuleRevision.py new file mode 100644 index 0000000000..72595b054c --- /dev/null +++ b/examples/v2/static-analysis/ShowCustomRuleRevision.py @@ -0,0 +1,18 @@ +""" +Show Custom Rule Revision returns "Successful response" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi + +configuration = Configuration() +configuration.unstable_operations["show_custom_rule_revision"] = True +with ApiClient(configuration) as api_client: + api_instance = StaticAnalysisApi(api_client) + response = api_instance.show_custom_rule_revision( + ruleset_name="ruleset_name", + rule_name="rule_name", + id="id", + ) + + print(response) diff --git a/examples/v2/static-analysis/ShowCustomRuleset.py b/examples/v2/static-analysis/ShowCustomRuleset.py new file mode 100644 index 0000000000..9d07545b84 --- /dev/null +++ b/examples/v2/static-analysis/ShowCustomRuleset.py @@ -0,0 +1,16 @@ +""" +Show Custom Ruleset returns "Successful response" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi + +configuration = Configuration() +configuration.unstable_operations["show_custom_ruleset"] = True +with ApiClient(configuration) as api_client: + api_instance = StaticAnalysisApi(api_client) + response = api_instance.show_custom_ruleset( + ruleset_name="ruleset_name", + ) + + print(response) diff --git a/examples/v2/static-analysis/UpdateCustomRuleset.py b/examples/v2/static-analysis/UpdateCustomRuleset.py new file mode 100644 index 0000000000..3ef788254e --- /dev/null +++ b/examples/v2/static-analysis/UpdateCustomRuleset.py @@ -0,0 +1,84 @@ +""" +Update Custom Ruleset returns "Successfully updated" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi +from datadog_api_client.v2.model.argument import Argument +from datadog_api_client.v2.model.custom_rule import CustomRule +from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision +from datadog_api_client.v2.model.custom_rule_revision_attributes import CustomRuleRevisionAttributes +from datadog_api_client.v2.model.custom_rule_revision_attributes_category import CustomRuleRevisionAttributesCategory +from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import CustomRuleRevisionAttributesSeverity +from datadog_api_client.v2.model.custom_rule_revision_data_type import CustomRuleRevisionDataType +from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest +from datadog_api_client.v2.model.custom_ruleset_data_type import CustomRulesetDataType +from datadog_api_client.v2.model.custom_ruleset_request import CustomRulesetRequest +from datadog_api_client.v2.model.custom_ruleset_request_data import CustomRulesetRequestData +from datadog_api_client.v2.model.custom_ruleset_request_data_attributes import CustomRulesetRequestDataAttributes +from datadog_api_client.v2.model.language import Language +from datetime import datetime +from dateutil.tz import tzutc + +body = CustomRulesetRequest( + data=CustomRulesetRequestData( + attributes=CustomRulesetRequestDataAttributes( + rules=[ + CustomRule( + created_at=datetime(2026, 1, 9, 13, 0, 57, 473141, tzinfo=tzutc()), + created_by="foobarbaz", + last_revision=CustomRuleRevision( + attributes=CustomRuleRevisionAttributes( + arguments=[ + Argument( + description="YXJndW1lbnQgZGVzY3JpcHRpb24=", + name="YXJndW1lbnRfbmFtZQ==", + ), + ], + category=CustomRuleRevisionAttributesCategory.SECURITY, + checksum="8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", + code="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + created_at=datetime(2026, 1, 9, 13, 0, 57, 473141, tzinfo=tzutc()), + created_by="foobarbaz", + creation_message="Initial revision", + cve="CVE-2024-1234", + cwe="CWE-79", + description="bG9uZyBkZXNjcmlwdGlvbg==", + documentation_url="https://docs.example.com/rules/my-rule", + is_published=False, + is_testing=False, + language=Language.PYTHON, + severity=CustomRuleRevisionAttributesSeverity.ERROR, + short_description="c2hvcnQgZGVzY3JpcHRpb24=", + should_use_ai_fix=False, + tags=[ + "security", + "custom", + ], + tests=[ + CustomRuleRevisionTest( + annotation_count=1, + code="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + filename="test.yaml", + ), + ], + tree_sitter_query="Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", + ), + id="revision-123", + type=CustomRuleRevisionDataType.CUSTOM_RULE_REVISION, + ), + name="my-rule", + ), + ], + ), + type=CustomRulesetDataType.CUSTOM_RULESET, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_custom_ruleset"] = True +with ApiClient(configuration) as api_client: + api_instance = StaticAnalysisApi(api_client) + response = api_instance.update_custom_ruleset(ruleset_name="ruleset_name", body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 5f29613298..5bdcebf08b 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -392,8 +392,18 @@ def __init__( "v2.get_slo_report": False, "v2.get_slo_report_job_status": False, "v2.get_spa_recommendations": False, + "v2.create_custom_rule": False, + "v2.create_custom_rule_revision": False, "v2.create_sca_resolve_vulnerable_symbols": False, "v2.create_sca_result": False, + "v2.delete_custom_rule": False, + "v2.delete_custom_ruleset": False, + "v2.list_custom_rule_revisions": False, + "v2.revert_custom_rule_revision": False, + "v2.show_custom_rule": False, + "v2.show_custom_rule_revision": False, + "v2.show_custom_ruleset": False, + "v2.update_custom_ruleset": False, "v2.add_member_team": False, "v2.list_member_teams": False, "v2.remove_member_team": False, diff --git a/src/datadog_api_client/v2/api/static_analysis_api.py b/src/datadog_api_client/v2/api/static_analysis_api.py index 6b8289a9dc..c3fa311625 100644 --- a/src/datadog_api_client/v2/api/static_analysis_api.py +++ b/src/datadog_api_client/v2/api/static_analysis_api.py @@ -3,13 +3,25 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Any, Dict +from typing import Any, Dict, Union from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, +) from datadog_api_client.v2.model.sca_request import ScaRequest from datadog_api_client.v2.model.resolve_vulnerable_symbols_response import ResolveVulnerableSymbolsResponse from datadog_api_client.v2.model.resolve_vulnerable_symbols_request import ResolveVulnerableSymbolsRequest +from datadog_api_client.v2.model.custom_ruleset_response import CustomRulesetResponse +from datadog_api_client.v2.model.custom_ruleset_request import CustomRulesetRequest +from datadog_api_client.v2.model.custom_rule_response import CustomRuleResponse +from datadog_api_client.v2.model.custom_rule_request import CustomRuleRequest +from datadog_api_client.v2.model.custom_rule_revisions_response import CustomRuleRevisionsResponse +from datadog_api_client.v2.model.custom_rule_revision_request import CustomRuleRevisionRequest +from datadog_api_client.v2.model.revert_custom_rule_revision_request import RevertCustomRuleRevisionRequest +from datadog_api_client.v2.model.custom_rule_revision_response import CustomRuleRevisionResponse class StaticAnalysisApi: @@ -22,6 +34,64 @@ def __init__(self, api_client=None): api_client = ApiClient(Configuration()) self.api_client = api_client + self._create_custom_rule_endpoint = _Endpoint( + settings={ + "response_type": (CustomRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules", + "operation_id": "create_custom_rule", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "ruleset_name": { + "required": True, + "openapi_types": (str,), + "attribute": "ruleset_name", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CustomRuleRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._create_custom_rule_revision_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions", + "operation_id": "create_custom_rule_revision", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "ruleset_name": { + "required": True, + "openapi_types": (str,), + "attribute": "ruleset_name", + "location": "path", + }, + "rule_name": { + "required": True, + "openapi_types": (str,), + "attribute": "rule_name", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CustomRuleRevisionRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._create_sca_resolve_vulnerable_symbols_endpoint = _Endpoint( settings={ "response_type": (ResolveVulnerableSymbolsResponse,), @@ -62,6 +132,289 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_custom_rule_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}", + "operation_id": "delete_custom_rule", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "ruleset_name": { + "required": True, + "openapi_types": (str,), + "attribute": "ruleset_name", + "location": "path", + }, + "rule_name": { + "required": True, + "openapi_types": (str,), + "attribute": "rule_name", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._delete_custom_ruleset_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/static-analysis/custom/rulesets/{ruleset_name}", + "operation_id": "delete_custom_ruleset", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "ruleset_name": { + "required": True, + "openapi_types": (str,), + "attribute": "ruleset_name", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._list_custom_rule_revisions_endpoint = _Endpoint( + settings={ + "response_type": (CustomRuleRevisionsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions", + "operation_id": "list_custom_rule_revisions", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "ruleset_name": { + "required": True, + "openapi_types": (str,), + "attribute": "ruleset_name", + "location": "path", + }, + "rule_name": { + "required": True, + "openapi_types": (str,), + "attribute": "rule_name", + "location": "path", + }, + "page_offset": { + "openapi_types": (int,), + "attribute": "page[offset]", + "location": "query", + }, + "page_limit": { + "openapi_types": (int,), + "attribute": "page[limit]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._revert_custom_rule_revision_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions/revert", + "operation_id": "revert_custom_rule_revision", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "ruleset_name": { + "required": True, + "openapi_types": (str,), + "attribute": "ruleset_name", + "location": "path", + }, + "rule_name": { + "required": True, + "openapi_types": (str,), + "attribute": "rule_name", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (RevertCustomRuleRevisionRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._show_custom_rule_endpoint = _Endpoint( + settings={ + "response_type": (CustomRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}", + "operation_id": "show_custom_rule", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "ruleset_name": { + "required": True, + "openapi_types": (str,), + "attribute": "ruleset_name", + "location": "path", + }, + "rule_name": { + "required": True, + "openapi_types": (str,), + "attribute": "rule_name", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._show_custom_rule_revision_endpoint = _Endpoint( + settings={ + "response_type": (CustomRuleRevisionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions/{id}", + "operation_id": "show_custom_rule_revision", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "ruleset_name": { + "required": True, + "openapi_types": (str,), + "attribute": "ruleset_name", + "location": "path", + }, + "rule_name": { + "required": True, + "openapi_types": (str,), + "attribute": "rule_name", + "location": "path", + }, + "id": { + "required": True, + "openapi_types": (str,), + "attribute": "id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._show_custom_ruleset_endpoint = _Endpoint( + settings={ + "response_type": (CustomRulesetResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/static-analysis/custom/rulesets/{ruleset_name}", + "operation_id": "show_custom_ruleset", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "ruleset_name": { + "required": True, + "openapi_types": (str,), + "attribute": "ruleset_name", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_custom_ruleset_endpoint = _Endpoint( + settings={ + "response_type": (CustomRulesetResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/static-analysis/custom/rulesets/{ruleset_name}", + "operation_id": "update_custom_ruleset", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "ruleset_name": { + "required": True, + "openapi_types": (str,), + "attribute": "ruleset_name", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CustomRulesetRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_custom_rule( + self, + ruleset_name: str, + body: CustomRuleRequest, + ) -> CustomRuleResponse: + """Create Custom Rule. + + Create a new custom rule within a ruleset + + :param ruleset_name: The ruleset name + :type ruleset_name: str + :type body: CustomRuleRequest + :rtype: CustomRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["ruleset_name"] = ruleset_name + + kwargs["body"] = body + + return self._create_custom_rule_endpoint.call_with_http_info(**kwargs) + + def create_custom_rule_revision( + self, + ruleset_name: str, + rule_name: str, + body: CustomRuleRevisionRequest, + ) -> None: + """Create Custom Rule Revision. + + Create a new revision for a custom rule + + :param ruleset_name: The ruleset name + :type ruleset_name: str + :param rule_name: The rule name + :type rule_name: str + :type body: CustomRuleRevisionRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["ruleset_name"] = ruleset_name + + kwargs["rule_name"] = rule_name + + kwargs["body"] = body + + return self._create_custom_rule_revision_endpoint.call_with_http_info(**kwargs) + def create_sca_resolve_vulnerable_symbols( self, body: ResolveVulnerableSymbolsRequest, @@ -89,3 +442,190 @@ def create_sca_result( kwargs["body"] = body return self._create_sca_result_endpoint.call_with_http_info(**kwargs) + + def delete_custom_rule( + self, + ruleset_name: str, + rule_name: str, + ) -> None: + """Delete Custom Rule. + + Delete a custom rule + + :param ruleset_name: The ruleset name + :type ruleset_name: str + :param rule_name: The rule name + :type rule_name: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["ruleset_name"] = ruleset_name + + kwargs["rule_name"] = rule_name + + return self._delete_custom_rule_endpoint.call_with_http_info(**kwargs) + + def delete_custom_ruleset( + self, + ruleset_name: str, + ) -> None: + """Delete Custom Ruleset. + + Delete a custom ruleset + + :param ruleset_name: The ruleset name + :type ruleset_name: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["ruleset_name"] = ruleset_name + + return self._delete_custom_ruleset_endpoint.call_with_http_info(**kwargs) + + def list_custom_rule_revisions( + self, + ruleset_name: str, + rule_name: str, + *, + page_offset: Union[int, UnsetType] = unset, + page_limit: Union[int, UnsetType] = unset, + ) -> CustomRuleRevisionsResponse: + """List Custom Rule Revisions. + + Get all revisions for a custom rule + + :param ruleset_name: The ruleset name + :type ruleset_name: str + :param rule_name: The rule name + :type rule_name: str + :param page_offset: Pagination offset + :type page_offset: int, optional + :param page_limit: Pagination limit + :type page_limit: int, optional + :rtype: CustomRuleRevisionsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["ruleset_name"] = ruleset_name + + kwargs["rule_name"] = rule_name + + if page_offset is not unset: + kwargs["page_offset"] = page_offset + + if page_limit is not unset: + kwargs["page_limit"] = page_limit + + return self._list_custom_rule_revisions_endpoint.call_with_http_info(**kwargs) + + def revert_custom_rule_revision( + self, + ruleset_name: str, + rule_name: str, + body: RevertCustomRuleRevisionRequest, + ) -> None: + """Revert Custom Rule Revision. + + Revert a custom rule to a previous revision + + :param ruleset_name: The ruleset name + :type ruleset_name: str + :param rule_name: The rule name + :type rule_name: str + :type body: RevertCustomRuleRevisionRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["ruleset_name"] = ruleset_name + + kwargs["rule_name"] = rule_name + + kwargs["body"] = body + + return self._revert_custom_rule_revision_endpoint.call_with_http_info(**kwargs) + + def show_custom_rule( + self, + ruleset_name: str, + rule_name: str, + ) -> CustomRuleResponse: + """Show Custom Rule. + + Get a custom rule by name + + :param ruleset_name: The ruleset name + :type ruleset_name: str + :param rule_name: The rule name + :type rule_name: str + :rtype: CustomRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["ruleset_name"] = ruleset_name + + kwargs["rule_name"] = rule_name + + return self._show_custom_rule_endpoint.call_with_http_info(**kwargs) + + def show_custom_rule_revision( + self, + ruleset_name: str, + rule_name: str, + id: str, + ) -> CustomRuleRevisionResponse: + """Show Custom Rule Revision. + + Get a specific revision of a custom rule + + :param ruleset_name: The ruleset name + :type ruleset_name: str + :param rule_name: The rule name + :type rule_name: str + :param id: The revision ID + :type id: str + :rtype: CustomRuleRevisionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["ruleset_name"] = ruleset_name + + kwargs["rule_name"] = rule_name + + kwargs["id"] = id + + return self._show_custom_rule_revision_endpoint.call_with_http_info(**kwargs) + + def show_custom_ruleset( + self, + ruleset_name: str, + ) -> CustomRulesetResponse: + """Show Custom Ruleset. + + Get a custom ruleset by name + + :param ruleset_name: The ruleset name + :type ruleset_name: str + :rtype: CustomRulesetResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["ruleset_name"] = ruleset_name + + return self._show_custom_ruleset_endpoint.call_with_http_info(**kwargs) + + def update_custom_ruleset( + self, + ruleset_name: str, + body: CustomRulesetRequest, + ) -> CustomRulesetResponse: + """Update Custom Ruleset. + + Update an existing custom ruleset + + :param ruleset_name: The ruleset name + :type ruleset_name: str + :type body: CustomRulesetRequest + :rtype: CustomRulesetResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["ruleset_name"] = ruleset_name + + kwargs["body"] = body + + return self._update_custom_ruleset_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/argument.py b/src/datadog_api_client/v2/model/argument.py new file mode 100644 index 0000000000..6a2dae8ffd --- /dev/null +++ b/src/datadog_api_client/v2/model/argument.py @@ -0,0 +1,39 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class Argument(ModelNormal): + @cached_property + def openapi_types(_): + return { + "description": (str,), + "name": (str,), + } + + attribute_map = { + "description": "description", + "name": "name", + } + + def __init__(self_, description: str, name: str, **kwargs): + """ + + + :param description: Base64-encoded argument description + :type description: str + + :param name: Base64-encoded argument name + :type name: str + """ + super().__init__(kwargs) + + self_.description = description + self_.name = name diff --git a/src/datadog_api_client/v2/model/custom_rule.py b/src/datadog_api_client/v2/model/custom_rule.py new file mode 100644 index 0000000000..80abe78467 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule.py @@ -0,0 +1,59 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision + + +class CustomRule(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision + + return { + "created_at": (datetime,), + "created_by": (str,), + "last_revision": (CustomRuleRevision,), + "name": (str,), + } + + attribute_map = { + "created_at": "created_at", + "created_by": "created_by", + "last_revision": "last_revision", + "name": "name", + } + + def __init__(self_, created_at: datetime, created_by: str, last_revision: CustomRuleRevision, name: str, **kwargs): + """ + + + :param created_at: Creation timestamp + :type created_at: datetime + + :param created_by: Creator identifier + :type created_by: str + + :param last_revision: + :type last_revision: CustomRuleRevision + + :param name: Rule name + :type name: str + """ + super().__init__(kwargs) + + self_.created_at = created_at + self_.created_by = created_by + self_.last_revision = last_revision + self_.name = name diff --git a/src/datadog_api_client/v2/model/custom_rule_data_type.py b/src/datadog_api_client/v2/model/custom_rule_data_type.py new file mode 100644 index 0000000000..77f8ba0946 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_data_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CustomRuleDataType(ModelSimple): + """ + Resource type + + :param value: If omitted defaults to "custom_rule". Must be one of ["custom_rule"]. + :type value: str + """ + + allowed_values = { + "custom_rule", + } + CUSTOM_RULE: ClassVar["CustomRuleDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomRuleDataType.CUSTOM_RULE = CustomRuleDataType("custom_rule") diff --git a/src/datadog_api_client/v2/model/custom_rule_request.py b/src/datadog_api_client/v2/model/custom_rule_request.py new file mode 100644 index 0000000000..8b3c4a5057 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_request.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_request_data import CustomRuleRequestData + + +class CustomRuleRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_request_data import CustomRuleRequestData + + return { + "data": (CustomRuleRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[CustomRuleRequestData, UnsetType] = unset, **kwargs): + """ + + + :param data: + :type data: CustomRuleRequestData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_rule_request_data.py b/src/datadog_api_client/v2/model/custom_rule_request_data.py new file mode 100644 index 0000000000..88b24b7ec9 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_request_data.py @@ -0,0 +1,64 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_request_data_attributes import CustomRuleRequestDataAttributes + from datadog_api_client.v2.model.custom_rule_data_type import CustomRuleDataType + + +class CustomRuleRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_request_data_attributes import CustomRuleRequestDataAttributes + from datadog_api_client.v2.model.custom_rule_data_type import CustomRuleDataType + + return { + "attributes": (CustomRuleRequestDataAttributes,), + "id": (str,), + "type": (CustomRuleDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[CustomRuleRequestDataAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[CustomRuleDataType, UnsetType] = unset, + **kwargs, + ): + """ + + + :param attributes: + :type attributes: CustomRuleRequestDataAttributes, optional + + :param id: Rule identifier + :type id: str, optional + + :param type: Resource type + :type type: CustomRuleDataType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_rule_request_data_attributes.py b/src/datadog_api_client/v2/model/custom_rule_request_data_attributes.py new file mode 100644 index 0000000000..514334ebb1 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_request_data_attributes.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CustomRuleRequestDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + } + + attribute_map = { + "name": "name", + } + + def __init__(self_, name: Union[str, UnsetType] = unset, **kwargs): + """ + + + :param name: Rule name + :type name: str, optional + """ + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_rule_response.py b/src/datadog_api_client/v2/model/custom_rule_response.py new file mode 100644 index 0000000000..54cdd3a577 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_response_data import CustomRuleResponseData + + +class CustomRuleResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_response_data import CustomRuleResponseData + + return { + "data": (CustomRuleResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CustomRuleResponseData, **kwargs): + """ + + + :param data: + :type data: CustomRuleResponseData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/custom_rule_response_data.py b/src/datadog_api_client/v2/model/custom_rule_response_data.py new file mode 100644 index 0000000000..a1246c52a8 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_response_data.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule import CustomRule + from datadog_api_client.v2.model.custom_rule_data_type import CustomRuleDataType + + +class CustomRuleResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule import CustomRule + from datadog_api_client.v2.model.custom_rule_data_type import CustomRuleDataType + + return { + "attributes": (CustomRule,), + "id": (str,), + "type": (CustomRuleDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: CustomRule, id: str, type: CustomRuleDataType, **kwargs): + """ + + + :param attributes: + :type attributes: CustomRule + + :param id: Rule identifier + :type id: str + + :param type: Resource type + :type type: CustomRuleDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_rule_revision.py b/src/datadog_api_client/v2/model/custom_rule_revision.py new file mode 100644 index 0000000000..e72951feac --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_revision_attributes import CustomRuleRevisionAttributes + from datadog_api_client.v2.model.custom_rule_revision_data_type import CustomRuleRevisionDataType + + +class CustomRuleRevision(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_revision_attributes import CustomRuleRevisionAttributes + from datadog_api_client.v2.model.custom_rule_revision_data_type import CustomRuleRevisionDataType + + return { + "attributes": (CustomRuleRevisionAttributes,), + "id": (str,), + "type": (CustomRuleRevisionDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: CustomRuleRevisionAttributes, id: str, type: CustomRuleRevisionDataType, **kwargs): + """ + + + :param attributes: + :type attributes: CustomRuleRevisionAttributes + + :param id: Revision identifier + :type id: str + + :param type: Resource type + :type type: CustomRuleRevisionDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_attributes.py b/src/datadog_api_client/v2/model/custom_rule_revision_attributes.py new file mode 100644 index 0000000000..f362cbff54 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision_attributes.py @@ -0,0 +1,195 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.argument import Argument + from datadog_api_client.v2.model.custom_rule_revision_attributes_category import ( + CustomRuleRevisionAttributesCategory, + ) + from datadog_api_client.v2.model.language import Language + from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import ( + CustomRuleRevisionAttributesSeverity, + ) + from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest + + +class CustomRuleRevisionAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.argument import Argument + from datadog_api_client.v2.model.custom_rule_revision_attributes_category import ( + CustomRuleRevisionAttributesCategory, + ) + from datadog_api_client.v2.model.language import Language + from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import ( + CustomRuleRevisionAttributesSeverity, + ) + from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest + + return { + "arguments": ([Argument],), + "category": (CustomRuleRevisionAttributesCategory,), + "checksum": (str,), + "code": (str,), + "created_at": (datetime,), + "created_by": (str,), + "creation_message": (str,), + "cve": (str, none_type), + "cwe": (str, none_type), + "description": (str,), + "documentation_url": (str, none_type), + "is_published": (bool,), + "is_testing": (bool,), + "language": (Language,), + "severity": (CustomRuleRevisionAttributesSeverity,), + "short_description": (str,), + "should_use_ai_fix": (bool,), + "tags": ([str],), + "tests": ([CustomRuleRevisionTest],), + "tree_sitter_query": (str,), + } + + attribute_map = { + "arguments": "arguments", + "category": "category", + "checksum": "checksum", + "code": "code", + "created_at": "created_at", + "created_by": "created_by", + "creation_message": "creation_message", + "cve": "cve", + "cwe": "cwe", + "description": "description", + "documentation_url": "documentation_url", + "is_published": "is_published", + "is_testing": "is_testing", + "language": "language", + "severity": "severity", + "short_description": "short_description", + "should_use_ai_fix": "should_use_ai_fix", + "tags": "tags", + "tests": "tests", + "tree_sitter_query": "tree_sitter_query", + } + + def __init__( + self_, + arguments: List[Argument], + category: CustomRuleRevisionAttributesCategory, + checksum: str, + code: str, + created_at: datetime, + created_by: str, + creation_message: str, + cve: Union[str, none_type], + cwe: Union[str, none_type], + description: str, + documentation_url: Union[str, none_type], + is_published: bool, + is_testing: bool, + language: Language, + severity: CustomRuleRevisionAttributesSeverity, + short_description: str, + should_use_ai_fix: bool, + tags: List[str], + tests: List[CustomRuleRevisionTest], + tree_sitter_query: str, + **kwargs, + ): + """ + + + :param arguments: Rule arguments + :type arguments: [Argument] + + :param category: Rule category + :type category: CustomRuleRevisionAttributesCategory + + :param checksum: Code checksum + :type checksum: str + + :param code: Rule code + :type code: str + + :param created_at: Creation timestamp + :type created_at: datetime + + :param created_by: Creator identifier + :type created_by: str + + :param creation_message: Revision creation message + :type creation_message: str + + :param cve: Associated CVE + :type cve: str, none_type + + :param cwe: Associated CWE + :type cwe: str, none_type + + :param description: Full description + :type description: str + + :param documentation_url: Documentation URL + :type documentation_url: str, none_type + + :param is_published: Whether the revision is published + :type is_published: bool + + :param is_testing: Whether this is a testing revision + :type is_testing: bool + + :param language: Programming language + :type language: Language + + :param severity: Rule severity + :type severity: CustomRuleRevisionAttributesSeverity + + :param short_description: Short description + :type short_description: str + + :param should_use_ai_fix: Whether to use AI for fixes + :type should_use_ai_fix: bool + + :param tags: Rule tags + :type tags: [str] + + :param tests: Rule tests + :type tests: [CustomRuleRevisionTest] + + :param tree_sitter_query: Tree-sitter query + :type tree_sitter_query: str + """ + super().__init__(kwargs) + + self_.arguments = arguments + self_.category = category + self_.checksum = checksum + self_.code = code + self_.created_at = created_at + self_.created_by = created_by + self_.creation_message = creation_message + self_.cve = cve + self_.cwe = cwe + self_.description = description + self_.documentation_url = documentation_url + self_.is_published = is_published + self_.is_testing = is_testing + self_.language = language + self_.severity = severity + self_.short_description = short_description + self_.should_use_ai_fix = should_use_ai_fix + self_.tags = tags + self_.tests = tests + self_.tree_sitter_query = tree_sitter_query diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_attributes_category.py b/src/datadog_api_client/v2/model/custom_rule_revision_attributes_category.py new file mode 100644 index 0000000000..4c3eb8cda9 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision_attributes_category.py @@ -0,0 +1,47 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CustomRuleRevisionAttributesCategory(ModelSimple): + """ + Rule category + + :param value: Must be one of ["SECURITY", "BEST_PRACTICES", "CODE_STYLE", "ERROR_PRONE", "PERFORMANCE"]. + :type value: str + """ + + allowed_values = { + "SECURITY", + "BEST_PRACTICES", + "CODE_STYLE", + "ERROR_PRONE", + "PERFORMANCE", + } + SECURITY: ClassVar["CustomRuleRevisionAttributesCategory"] + BEST_PRACTICES: ClassVar["CustomRuleRevisionAttributesCategory"] + CODE_STYLE: ClassVar["CustomRuleRevisionAttributesCategory"] + ERROR_PRONE: ClassVar["CustomRuleRevisionAttributesCategory"] + PERFORMANCE: ClassVar["CustomRuleRevisionAttributesCategory"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomRuleRevisionAttributesCategory.SECURITY = CustomRuleRevisionAttributesCategory("SECURITY") +CustomRuleRevisionAttributesCategory.BEST_PRACTICES = CustomRuleRevisionAttributesCategory("BEST_PRACTICES") +CustomRuleRevisionAttributesCategory.CODE_STYLE = CustomRuleRevisionAttributesCategory("CODE_STYLE") +CustomRuleRevisionAttributesCategory.ERROR_PRONE = CustomRuleRevisionAttributesCategory("ERROR_PRONE") +CustomRuleRevisionAttributesCategory.PERFORMANCE = CustomRuleRevisionAttributesCategory("PERFORMANCE") diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_attributes_severity.py b/src/datadog_api_client/v2/model/custom_rule_revision_attributes_severity.py new file mode 100644 index 0000000000..04fa171176 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision_attributes_severity.py @@ -0,0 +1,41 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CustomRuleRevisionAttributesSeverity(ModelSimple): + """ + Rule severity + + :param value: Must be one of ["ERROR", "WARNING", "NOTICE"]. + :type value: str + """ + + allowed_values = { + "ERROR", + "WARNING", + "NOTICE", + } + ERROR: ClassVar["CustomRuleRevisionAttributesSeverity"] + WARNING: ClassVar["CustomRuleRevisionAttributesSeverity"] + NOTICE: ClassVar["CustomRuleRevisionAttributesSeverity"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomRuleRevisionAttributesSeverity.ERROR = CustomRuleRevisionAttributesSeverity("ERROR") +CustomRuleRevisionAttributesSeverity.WARNING = CustomRuleRevisionAttributesSeverity("WARNING") +CustomRuleRevisionAttributesSeverity.NOTICE = CustomRuleRevisionAttributesSeverity("NOTICE") diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_data_type.py b/src/datadog_api_client/v2/model/custom_rule_revision_data_type.py new file mode 100644 index 0000000000..47deacb50e --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision_data_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CustomRuleRevisionDataType(ModelSimple): + """ + Resource type + + :param value: If omitted defaults to "custom_rule_revision". Must be one of ["custom_rule_revision"]. + :type value: str + """ + + allowed_values = { + "custom_rule_revision", + } + CUSTOM_RULE_REVISION: ClassVar["CustomRuleRevisionDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomRuleRevisionDataType.CUSTOM_RULE_REVISION = CustomRuleRevisionDataType("custom_rule_revision") diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_request.py b/src/datadog_api_client/v2/model/custom_rule_revision_request.py new file mode 100644 index 0000000000..e93edd0579 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision_request.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_revision_request_data import CustomRuleRevisionRequestData + + +class CustomRuleRevisionRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_revision_request_data import CustomRuleRevisionRequestData + + return { + "data": (CustomRuleRevisionRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[CustomRuleRevisionRequestData, UnsetType] = unset, **kwargs): + """ + + + :param data: + :type data: CustomRuleRevisionRequestData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_request_data.py b/src/datadog_api_client/v2/model/custom_rule_revision_request_data.py new file mode 100644 index 0000000000..6d055e2105 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision_request_data.py @@ -0,0 +1,64 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_revision_attributes import CustomRuleRevisionAttributes + from datadog_api_client.v2.model.custom_rule_revision_data_type import CustomRuleRevisionDataType + + +class CustomRuleRevisionRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_revision_attributes import CustomRuleRevisionAttributes + from datadog_api_client.v2.model.custom_rule_revision_data_type import CustomRuleRevisionDataType + + return { + "attributes": (CustomRuleRevisionAttributes,), + "id": (str,), + "type": (CustomRuleRevisionDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[CustomRuleRevisionAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[CustomRuleRevisionDataType, UnsetType] = unset, + **kwargs, + ): + """ + + + :param attributes: + :type attributes: CustomRuleRevisionAttributes, optional + + :param id: Revision identifier + :type id: str, optional + + :param type: Resource type + :type type: CustomRuleRevisionDataType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_response.py b/src/datadog_api_client/v2/model/custom_rule_revision_response.py new file mode 100644 index 0000000000..23ae664f11 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision + + +class CustomRuleRevisionResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision + + return { + "data": (CustomRuleRevision,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CustomRuleRevision, **kwargs): + """ + + + :param data: + :type data: CustomRuleRevision + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/custom_rule_revision_test.py b/src/datadog_api_client/v2/model/custom_rule_revision_test.py new file mode 100644 index 0000000000..ad2c17a0c6 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revision_test.py @@ -0,0 +1,45 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class CustomRuleRevisionTest(ModelNormal): + @cached_property + def openapi_types(_): + return { + "annotation_count": (int,), + "code": (str,), + "filename": (str,), + } + + attribute_map = { + "annotation_count": "annotation_count", + "code": "code", + "filename": "filename", + } + + def __init__(self_, annotation_count: int, code: str, filename: str, **kwargs): + """ + + + :param annotation_count: Expected violation count + :type annotation_count: int + + :param code: Test code + :type code: str + + :param filename: Test filename + :type filename: str + """ + super().__init__(kwargs) + + self_.annotation_count = annotation_count + self_.code = code + self_.filename = filename diff --git a/src/datadog_api_client/v2/model/custom_rule_revisions_response.py b/src/datadog_api_client/v2/model/custom_rule_revisions_response.py new file mode 100644 index 0000000000..cebf0799db --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_rule_revisions_response.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision + + +class CustomRuleRevisionsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision + + return { + "data": ([CustomRuleRevision],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[CustomRuleRevision], UnsetType] = unset, **kwargs): + """ + + + :param data: + :type data: [CustomRuleRevision], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_ruleset.py b/src/datadog_api_client/v2/model/custom_ruleset.py new file mode 100644 index 0000000000..10c64c7b7f --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_ruleset.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_ruleset_attributes import CustomRulesetAttributes + from datadog_api_client.v2.model.custom_ruleset_data_type import CustomRulesetDataType + + +class CustomRuleset(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_ruleset_attributes import CustomRulesetAttributes + from datadog_api_client.v2.model.custom_ruleset_data_type import CustomRulesetDataType + + return { + "attributes": (CustomRulesetAttributes,), + "id": (str,), + "type": (CustomRulesetDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: CustomRulesetAttributes, id: str, type: CustomRulesetDataType, **kwargs): + """ + + + :param attributes: + :type attributes: CustomRulesetAttributes + + :param id: Ruleset identifier + :type id: str + + :param type: Resource type + :type type: CustomRulesetDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_ruleset_attributes.py b/src/datadog_api_client/v2/model/custom_ruleset_attributes.py new file mode 100644 index 0000000000..893fe78c96 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_ruleset_attributes.py @@ -0,0 +1,81 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule import CustomRule + + +class CustomRulesetAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule import CustomRule + + return { + "created_at": (datetime,), + "created_by": (str,), + "description": (str,), + "name": (str,), + "rules": ([CustomRule], none_type), + "short_description": (str,), + } + + attribute_map = { + "created_at": "created_at", + "created_by": "created_by", + "description": "description", + "name": "name", + "rules": "rules", + "short_description": "short_description", + } + + def __init__( + self_, + created_at: datetime, + created_by: str, + description: str, + name: str, + rules: Union[List[CustomRule], none_type], + short_description: str, + **kwargs, + ): + """ + + + :param created_at: Creation timestamp + :type created_at: datetime + + :param created_by: Creator identifier + :type created_by: str + + :param description: Base64-encoded full description + :type description: str + + :param name: Ruleset name + :type name: str + + :param rules: Rules in the ruleset + :type rules: [CustomRule], none_type + + :param short_description: Base64-encoded short description + :type short_description: str + """ + super().__init__(kwargs) + + self_.created_at = created_at + self_.created_by = created_by + self_.description = description + self_.name = name + self_.rules = rules + self_.short_description = short_description diff --git a/src/datadog_api_client/v2/model/custom_ruleset_data_type.py b/src/datadog_api_client/v2/model/custom_ruleset_data_type.py new file mode 100644 index 0000000000..f02d8e5102 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_ruleset_data_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CustomRulesetDataType(ModelSimple): + """ + Resource type + + :param value: If omitted defaults to "custom_ruleset". Must be one of ["custom_ruleset"]. + :type value: str + """ + + allowed_values = { + "custom_ruleset", + } + CUSTOM_RULESET: ClassVar["CustomRulesetDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomRulesetDataType.CUSTOM_RULESET = CustomRulesetDataType("custom_ruleset") diff --git a/src/datadog_api_client/v2/model/custom_ruleset_request.py b/src/datadog_api_client/v2/model/custom_ruleset_request.py new file mode 100644 index 0000000000..1a5f2cf4b0 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_ruleset_request.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_ruleset_request_data import CustomRulesetRequestData + + +class CustomRulesetRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_ruleset_request_data import CustomRulesetRequestData + + return { + "data": (CustomRulesetRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[CustomRulesetRequestData, UnsetType] = unset, **kwargs): + """ + + + :param data: + :type data: CustomRulesetRequestData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_ruleset_request_data.py b/src/datadog_api_client/v2/model/custom_ruleset_request_data.py new file mode 100644 index 0000000000..93a96c75cc --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_ruleset_request_data.py @@ -0,0 +1,66 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_ruleset_request_data_attributes import CustomRulesetRequestDataAttributes + from datadog_api_client.v2.model.custom_ruleset_data_type import CustomRulesetDataType + + +class CustomRulesetRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_ruleset_request_data_attributes import ( + CustomRulesetRequestDataAttributes, + ) + from datadog_api_client.v2.model.custom_ruleset_data_type import CustomRulesetDataType + + return { + "attributes": (CustomRulesetRequestDataAttributes,), + "id": (str,), + "type": (CustomRulesetDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[CustomRulesetRequestDataAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[CustomRulesetDataType, UnsetType] = unset, + **kwargs, + ): + """ + + + :param attributes: + :type attributes: CustomRulesetRequestDataAttributes, optional + + :param id: Ruleset identifier + :type id: str, optional + + :param type: Resource type + :type type: CustomRulesetDataType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_ruleset_request_data_attributes.py b/src/datadog_api_client/v2/model/custom_ruleset_request_data_attributes.py new file mode 100644 index 0000000000..1de85ff050 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_ruleset_request_data_attributes.py @@ -0,0 +1,88 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_rule import CustomRule + + +class CustomRulesetRequestDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_rule import CustomRule + + return { + "created_at": (datetime,), + "created_by": (str,), + "description": (str,), + "name": (str,), + "rules": ([CustomRule], none_type), + "short_description": (str,), + } + + attribute_map = { + "created_at": "created_at", + "created_by": "created_by", + "description": "description", + "name": "name", + "rules": "rules", + "short_description": "short_description", + } + + def __init__( + self_, + created_at: Union[datetime, UnsetType] = unset, + created_by: Union[str, UnsetType] = unset, + description: Union[str, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + rules: Union[List[CustomRule], none_type, UnsetType] = unset, + short_description: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + + + :param created_at: Creation timestamp (auto-generated on server) + :type created_at: datetime, optional + + :param created_by: Creator identifier (auto-generated on server) + :type created_by: str, optional + + :param description: Base64-encoded full description + :type description: str, optional + + :param name: Ruleset name + :type name: str, optional + + :param rules: Rules in the ruleset + :type rules: [CustomRule], none_type, optional + + :param short_description: Base64-encoded short description + :type short_description: str, optional + """ + if created_at is not unset: + kwargs["created_at"] = created_at + if created_by is not unset: + kwargs["created_by"] = created_by + if description is not unset: + kwargs["description"] = description + if name is not unset: + kwargs["name"] = name + if rules is not unset: + kwargs["rules"] = rules + if short_description is not unset: + kwargs["short_description"] = short_description + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_ruleset_response.py b/src/datadog_api_client/v2/model/custom_ruleset_response.py new file mode 100644 index 0000000000..2a738ef868 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_ruleset_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_ruleset import CustomRuleset + + +class CustomRulesetResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_ruleset import CustomRuleset + + return { + "data": (CustomRuleset,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CustomRuleset, **kwargs): + """ + + + :param data: + :type data: CustomRuleset + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/language.py b/src/datadog_api_client/v2/model/language.py new file mode 100644 index 0000000000..fd5d5a068f --- /dev/null +++ b/src/datadog_api_client/v2/model/language.py @@ -0,0 +1,65 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class Language(ModelSimple): + """ + Programming language + + :param value: Must be one of ["PYTHON", "JAVASCRIPT", "TYPESCRIPT", "JAVA", "GO", "YAML", "RUBY", "CSHARP", "PHP", "KOTLIN", "SWIFT"]. + :type value: str + """ + + allowed_values = { + "PYTHON", + "JAVASCRIPT", + "TYPESCRIPT", + "JAVA", + "GO", + "YAML", + "RUBY", + "CSHARP", + "PHP", + "KOTLIN", + "SWIFT", + } + PYTHON: ClassVar["Language"] + JAVASCRIPT: ClassVar["Language"] + TYPESCRIPT: ClassVar["Language"] + JAVA: ClassVar["Language"] + GO: ClassVar["Language"] + YAML: ClassVar["Language"] + RUBY: ClassVar["Language"] + CSHARP: ClassVar["Language"] + PHP: ClassVar["Language"] + KOTLIN: ClassVar["Language"] + SWIFT: ClassVar["Language"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +Language.PYTHON = Language("PYTHON") +Language.JAVASCRIPT = Language("JAVASCRIPT") +Language.TYPESCRIPT = Language("TYPESCRIPT") +Language.JAVA = Language("JAVA") +Language.GO = Language("GO") +Language.YAML = Language("YAML") +Language.RUBY = Language("RUBY") +Language.CSHARP = Language("CSHARP") +Language.PHP = Language("PHP") +Language.KOTLIN = Language("KOTLIN") +Language.SWIFT = Language("SWIFT") diff --git a/src/datadog_api_client/v2/model/revert_custom_rule_revision_data_type.py b/src/datadog_api_client/v2/model/revert_custom_rule_revision_data_type.py new file mode 100644 index 0000000000..8c1c7b88b9 --- /dev/null +++ b/src/datadog_api_client/v2/model/revert_custom_rule_revision_data_type.py @@ -0,0 +1,37 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class RevertCustomRuleRevisionDataType(ModelSimple): + """ + Request type + + :param value: If omitted defaults to "revert_custom_rule_revision_request". Must be one of ["revert_custom_rule_revision_request"]. + :type value: str + """ + + allowed_values = { + "revert_custom_rule_revision_request", + } + REVERT_CUSTOM_RULE_REVISION_REQUEST: ClassVar["RevertCustomRuleRevisionDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +RevertCustomRuleRevisionDataType.REVERT_CUSTOM_RULE_REVISION_REQUEST = RevertCustomRuleRevisionDataType( + "revert_custom_rule_revision_request" +) diff --git a/src/datadog_api_client/v2/model/revert_custom_rule_revision_request.py b/src/datadog_api_client/v2/model/revert_custom_rule_revision_request.py new file mode 100644 index 0000000000..31c2c8ccc4 --- /dev/null +++ b/src/datadog_api_client/v2/model/revert_custom_rule_revision_request.py @@ -0,0 +1,44 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.revert_custom_rule_revision_request_data import RevertCustomRuleRevisionRequestData + + +class RevertCustomRuleRevisionRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.revert_custom_rule_revision_request_data import ( + RevertCustomRuleRevisionRequestData, + ) + + return { + "data": (RevertCustomRuleRevisionRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[RevertCustomRuleRevisionRequestData, UnsetType] = unset, **kwargs): + """ + + + :param data: + :type data: RevertCustomRuleRevisionRequestData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/revert_custom_rule_revision_request_data.py b/src/datadog_api_client/v2/model/revert_custom_rule_revision_request_data.py new file mode 100644 index 0000000000..af9f268d88 --- /dev/null +++ b/src/datadog_api_client/v2/model/revert_custom_rule_revision_request_data.py @@ -0,0 +1,68 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.revert_custom_rule_revision_request_data_attributes import ( + RevertCustomRuleRevisionRequestDataAttributes, + ) + from datadog_api_client.v2.model.revert_custom_rule_revision_data_type import RevertCustomRuleRevisionDataType + + +class RevertCustomRuleRevisionRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.revert_custom_rule_revision_request_data_attributes import ( + RevertCustomRuleRevisionRequestDataAttributes, + ) + from datadog_api_client.v2.model.revert_custom_rule_revision_data_type import RevertCustomRuleRevisionDataType + + return { + "attributes": (RevertCustomRuleRevisionRequestDataAttributes,), + "id": (str,), + "type": (RevertCustomRuleRevisionDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[RevertCustomRuleRevisionRequestDataAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[RevertCustomRuleRevisionDataType, UnsetType] = unset, + **kwargs, + ): + """ + + + :param attributes: + :type attributes: RevertCustomRuleRevisionRequestDataAttributes, optional + + :param id: Request identifier + :type id: str, optional + + :param type: Request type + :type type: RevertCustomRuleRevisionDataType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/revert_custom_rule_revision_request_data_attributes.py b/src/datadog_api_client/v2/model/revert_custom_rule_revision_request_data_attributes.py new file mode 100644 index 0000000000..0280cd57bc --- /dev/null +++ b/src/datadog_api_client/v2/model/revert_custom_rule_revision_request_data_attributes.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class RevertCustomRuleRevisionRequestDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "current_revision_id": (str,), + "revert_to_revision_id": (str,), + } + + attribute_map = { + "current_revision_id": "current_revision_id", + "revert_to_revision_id": "revert_to_revision_id", + } + + def __init__( + self_, + current_revision_id: Union[str, UnsetType] = unset, + revert_to_revision_id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + + + :param current_revision_id: Current revision ID + :type current_revision_id: str, optional + + :param revert_to_revision_id: Target revision ID to revert to + :type revert_to_revision_id: str, optional + """ + if current_revision_id is not unset: + kwargs["current_revision_id"] = current_revision_id + if revert_to_revision_id is not unset: + kwargs["revert_to_revision_id"] = revert_to_revision_id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index ea611ffe86..89daf4cb89 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -348,6 +348,7 @@ ArbitraryRuleResponseDataAttributesStrategyEvaluateGroupedByFiltersItems, ) from datadog_api_client.v2.model.arbitrary_rule_response_data_type import ArbitraryRuleResponseDataType +from datadog_api_client.v2.model.argument import Argument from datadog_api_client.v2.model.asana_access_token import AsanaAccessToken from datadog_api_client.v2.model.asana_access_token_type import AsanaAccessTokenType from datadog_api_client.v2.model.asana_access_token_update import AsanaAccessTokenUpdate @@ -1308,6 +1309,30 @@ from datadog_api_client.v2.model.custom_framework_requirement import CustomFrameworkRequirement from datadog_api_client.v2.model.custom_framework_type import CustomFrameworkType from datadog_api_client.v2.model.custom_framework_without_requirements import CustomFrameworkWithoutRequirements +from datadog_api_client.v2.model.custom_rule import CustomRule +from datadog_api_client.v2.model.custom_rule_data_type import CustomRuleDataType +from datadog_api_client.v2.model.custom_rule_request import CustomRuleRequest +from datadog_api_client.v2.model.custom_rule_request_data import CustomRuleRequestData +from datadog_api_client.v2.model.custom_rule_request_data_attributes import CustomRuleRequestDataAttributes +from datadog_api_client.v2.model.custom_rule_response import CustomRuleResponse +from datadog_api_client.v2.model.custom_rule_response_data import CustomRuleResponseData +from datadog_api_client.v2.model.custom_rule_revision import CustomRuleRevision +from datadog_api_client.v2.model.custom_rule_revision_attributes import CustomRuleRevisionAttributes +from datadog_api_client.v2.model.custom_rule_revision_attributes_category import CustomRuleRevisionAttributesCategory +from datadog_api_client.v2.model.custom_rule_revision_attributes_severity import CustomRuleRevisionAttributesSeverity +from datadog_api_client.v2.model.custom_rule_revision_data_type import CustomRuleRevisionDataType +from datadog_api_client.v2.model.custom_rule_revision_request import CustomRuleRevisionRequest +from datadog_api_client.v2.model.custom_rule_revision_request_data import CustomRuleRevisionRequestData +from datadog_api_client.v2.model.custom_rule_revision_response import CustomRuleRevisionResponse +from datadog_api_client.v2.model.custom_rule_revision_test import CustomRuleRevisionTest +from datadog_api_client.v2.model.custom_rule_revisions_response import CustomRuleRevisionsResponse +from datadog_api_client.v2.model.custom_ruleset import CustomRuleset +from datadog_api_client.v2.model.custom_ruleset_attributes import CustomRulesetAttributes +from datadog_api_client.v2.model.custom_ruleset_data_type import CustomRulesetDataType +from datadog_api_client.v2.model.custom_ruleset_request import CustomRulesetRequest +from datadog_api_client.v2.model.custom_ruleset_request_data import CustomRulesetRequestData +from datadog_api_client.v2.model.custom_ruleset_request_data_attributes import CustomRulesetRequestDataAttributes +from datadog_api_client.v2.model.custom_ruleset_response import CustomRulesetResponse from datadog_api_client.v2.model.dora_deployment_fetch_response import DORADeploymentFetchResponse from datadog_api_client.v2.model.dora_deployment_object import DORADeploymentObject from datadog_api_client.v2.model.dora_deployment_object_attributes import DORADeploymentObjectAttributes @@ -2409,6 +2434,7 @@ from datadog_api_client.v2.model.kind_metadata import KindMetadata from datadog_api_client.v2.model.kind_obj import KindObj from datadog_api_client.v2.model.kind_response_meta import KindResponseMeta +from datadog_api_client.v2.model.language import Language from datadog_api_client.v2.model.launch_darkly_api_key import LaunchDarklyAPIKey from datadog_api_client.v2.model.launch_darkly_api_key_type import LaunchDarklyAPIKeyType from datadog_api_client.v2.model.launch_darkly_api_key_update import LaunchDarklyAPIKeyUpdate @@ -3954,6 +3980,12 @@ from datadog_api_client.v2.model.retry_strategy import RetryStrategy from datadog_api_client.v2.model.retry_strategy_kind import RetryStrategyKind from datadog_api_client.v2.model.retry_strategy_linear import RetryStrategyLinear +from datadog_api_client.v2.model.revert_custom_rule_revision_data_type import RevertCustomRuleRevisionDataType +from datadog_api_client.v2.model.revert_custom_rule_revision_request import RevertCustomRuleRevisionRequest +from datadog_api_client.v2.model.revert_custom_rule_revision_request_data import RevertCustomRuleRevisionRequestData +from datadog_api_client.v2.model.revert_custom_rule_revision_request_data_attributes import ( + RevertCustomRuleRevisionRequestDataAttributes, +) from datadog_api_client.v2.model.role import Role from datadog_api_client.v2.model.role_attributes import RoleAttributes from datadog_api_client.v2.model.role_clone import RoleClone @@ -5470,6 +5502,7 @@ "ArbitraryRuleResponseDataAttributesStrategyBasedOnCostsItems", "ArbitraryRuleResponseDataAttributesStrategyEvaluateGroupedByFiltersItems", "ArbitraryRuleResponseDataType", + "Argument", "AsanaAccessToken", "AsanaAccessTokenType", "AsanaAccessTokenUpdate", @@ -6166,6 +6199,30 @@ "CustomFrameworkRequirement", "CustomFrameworkType", "CustomFrameworkWithoutRequirements", + "CustomRule", + "CustomRuleDataType", + "CustomRuleRequest", + "CustomRuleRequestData", + "CustomRuleRequestDataAttributes", + "CustomRuleResponse", + "CustomRuleResponseData", + "CustomRuleRevision", + "CustomRuleRevisionAttributes", + "CustomRuleRevisionAttributesCategory", + "CustomRuleRevisionAttributesSeverity", + "CustomRuleRevisionDataType", + "CustomRuleRevisionRequest", + "CustomRuleRevisionRequestData", + "CustomRuleRevisionResponse", + "CustomRuleRevisionTest", + "CustomRuleRevisionsResponse", + "CustomRuleset", + "CustomRulesetAttributes", + "CustomRulesetDataType", + "CustomRulesetRequest", + "CustomRulesetRequestData", + "CustomRulesetRequestDataAttributes", + "CustomRulesetResponse", "DORADeploymentFetchResponse", "DORADeploymentObject", "DORADeploymentObjectAttributes", @@ -7069,6 +7126,7 @@ "KindMetadata", "KindObj", "KindResponseMeta", + "Language", "LaunchDarklyAPIKey", "LaunchDarklyAPIKeyType", "LaunchDarklyAPIKeyUpdate", @@ -8066,6 +8124,10 @@ "RetryStrategy", "RetryStrategyKind", "RetryStrategyLinear", + "RevertCustomRuleRevisionDataType", + "RevertCustomRuleRevisionRequest", + "RevertCustomRuleRevisionRequestData", + "RevertCustomRuleRevisionRequestDataAttributes", "Role", "RoleAttributes", "RoleClone", diff --git a/tests/v2/features/static_analysis.feature b/tests/v2/features/static_analysis.feature index 85bf4d83ae..f4ffb65c30 100644 --- a/tests/v2/features/static_analysis.feature +++ b/tests/v2/features/static_analysis.feature @@ -7,6 +7,150 @@ Feature: Static Analysis And a valid "appKeyAuth" key in the system And an instance of "StaticAnalysis" API + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Rule Revision returns "Bad request" response + Given operation "CreateCustomRuleRevision" enabled + And new "CreateCustomRuleRevision" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + And body with value {"data": {"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=="}, "type": "custom_rule_revision"}} + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Rule Revision returns "Rule not found" response + Given operation "CreateCustomRuleRevision" enabled + And new "CreateCustomRuleRevision" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + And body with value {"data": {"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=="}, "type": "custom_rule_revision"}} + When the request is sent + Then the response status is 404 Rule not found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Rule Revision returns "Successfully created" response + Given operation "CreateCustomRuleRevision" enabled + And new "CreateCustomRuleRevision" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + And body with value {"data": {"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=="}, "type": "custom_rule_revision"}} + When the request is sent + Then the response status is 200 Successfully created + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Rule returns "Bad request" response + Given operation "CreateCustomRule" enabled + And new "CreateCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {}, "type": "custom_rule"}} + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Rule returns "Conflict - rule already exists" response + Given operation "CreateCustomRule" enabled + And new "CreateCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {}, "type": "custom_rule"}} + When the request is sent + Then the response status is 409 Conflict - rule already exists + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Rule returns "Precondition failed - validation error or ruleset not found" response + Given operation "CreateCustomRule" enabled + And new "CreateCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {}, "type": "custom_rule"}} + When the request is sent + Then the response status is 412 Precondition failed - validation error or ruleset not found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Rule returns "Successfully created" response + Given operation "CreateCustomRule" enabled + And new "CreateCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {}, "type": "custom_rule"}} + When the request is sent + Then the response status is 200 Successfully created + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Delete Custom Rule returns "Bad request" response + Given operation "DeleteCustomRule" enabled + And new "DeleteCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Delete Custom Rule returns "Rule not found" response + Given operation "DeleteCustomRule" enabled + And new "DeleteCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Rule not found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Delete Custom Rule returns "Successfully deleted" response + Given operation "DeleteCustomRule" enabled + And new "DeleteCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 Successfully deleted + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Delete Custom Ruleset returns "Bad request" response + Given operation "DeleteCustomRuleset" enabled + And new "DeleteCustomRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Delete Custom Ruleset returns "Ruleset not found" response + Given operation "DeleteCustomRuleset" enabled + And new "DeleteCustomRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Ruleset not found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Delete Custom Ruleset returns "Successfully deleted" response + Given operation "DeleteCustomRuleset" enabled + And new "DeleteCustomRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 Successfully deleted + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List Custom Rule Revisions returns "Bad request" response + Given operation "ListCustomRuleRevisions" enabled + And new "ListCustomRuleRevisions" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List Custom Rule Revisions returns "Rule not found" response + Given operation "ListCustomRuleRevisions" enabled + And new "ListCustomRuleRevisions" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Rule not found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List Custom Rule Revisions returns "Successful response" response + Given operation "ListCustomRuleRevisions" enabled + And new "ListCustomRuleRevisions" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 Successful response + @generated @skip @team:DataDog/k9-vm-sca Scenario: POST request to resolve vulnerable symbols returns "OK" response Given operation "CreateSCAResolveVulnerableSymbols" enabled @@ -22,3 +166,131 @@ Feature: Static Analysis And body with value {"data": {"attributes": {"commit": {}, "dependencies": [{"exclusions": [], "locations": [{"block": {"end": {}, "start": {}}, "name": {"end": {}, "start": {}}, "namespace": {"end": {}, "start": {}}, "version": {"end": {}, "start": {}}}], "reachable_symbol_properties": [{}]}], "files": [{}], "relations": [{"depends_on": []}], "repository": {}, "vulnerabilities": [{"affects": [{}]}]}, "type": "scarequests"}} When the request is sent Then the response status is 200 OK + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Revert Custom Rule Revision returns "Bad request" response + Given operation "RevertCustomRuleRevision" enabled + And new "RevertCustomRuleRevision" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {}, "type": "revert_custom_rule_revision_request"}} + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Revert Custom Rule Revision returns "Successfully reverted" response + Given operation "RevertCustomRuleRevision" enabled + And new "RevertCustomRuleRevision" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {}, "type": "revert_custom_rule_revision_request"}} + When the request is sent + Then the response status is 200 Successfully reverted + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Show Custom Rule Revision returns "Bad request" response + Given operation "ShowCustomRuleRevision" enabled + And new "ShowCustomRuleRevision" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Show Custom Rule Revision returns "Revision not found" response + Given operation "ShowCustomRuleRevision" enabled + And new "ShowCustomRuleRevision" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Revision not found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Show Custom Rule Revision returns "Successful response" response + Given operation "ShowCustomRuleRevision" enabled + And new "ShowCustomRuleRevision" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 Successful response + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Show Custom Rule returns "Bad request" response + Given operation "ShowCustomRule" enabled + And new "ShowCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Show Custom Rule returns "Rule not found" response + Given operation "ShowCustomRule" enabled + And new "ShowCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Rule not found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Show Custom Rule returns "Successful response" response + Given operation "ShowCustomRule" enabled + And new "ShowCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 Successful response + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Show Custom Ruleset returns "Bad request" response + Given operation "ShowCustomRuleset" enabled + And new "ShowCustomRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Show Custom Ruleset returns "Ruleset not found" response + Given operation "ShowCustomRuleset" enabled + And new "ShowCustomRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Ruleset not found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Show Custom Ruleset returns "Successful response" response + Given operation "ShowCustomRuleset" enabled + And new "ShowCustomRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 Successful response + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Update Custom Ruleset returns "Bad request" response + 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"}} + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Update Custom Ruleset returns "Precondition failed - validation error or ruleset not found" response + 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"}} + When the request is sent + Then the response status is 412 Precondition failed - validation error or ruleset not found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Update Custom Ruleset returns "Successfully updated" response + 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"}} + When the request is sent + Then the response status is 200 Successfully updated diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index b54378e93b..b8d80be801 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -4514,6 +4514,68 @@ "type": "safe" } }, + "DeleteCustomRuleset": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "ShowCustomRuleset": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "UpdateCustomRuleset": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "CreateCustomRule": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "DeleteCustomRule": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "ShowCustomRule": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "ListCustomRuleRevisions": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "CreateCustomRuleRevision": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "RevertCustomRuleRevision": { + "tag": "Static Analysis", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, + "ShowCustomRuleRevision": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, "ListMultipleRulesets": { "tag": "Security Monitoring", "undo": {