diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e6df2f158a6..b7341779fb6 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -5057,6 +5057,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: @@ -15872,6 +15886,482 @@ 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 + CustomRuleRevisionInputAttributes: + properties: + arguments: + description: Rule arguments + items: + $ref: '#/components/schemas/Argument' + type: array + category: + $ref: '#/components/schemas/CustomRuleRevisionAttributesCategory' + code: + description: Rule code + example: Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ== + 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 + - language + - tree_sitter_query + - severity + - category + - cve + - cwe + - arguments + - tests + - tags + - is_published + - should_use_ai_fix + - documentation_url + - is_testing + type: object + CustomRuleRevisionRequest: + properties: + data: + $ref: '#/components/schemas/CustomRuleRevisionRequestData' + type: object + CustomRuleRevisionRequestData: + properties: + attributes: + $ref: '#/components/schemas/CustomRuleRevisionInputAttributes' + 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: + 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. @@ -30051,6 +30541,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: @@ -45473,6 +45991,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: + currentRevision: + description: Current revision ID + type: string + revertToRevision: + description: Target revision ID to revert to + type: string + type: object Role: description: Role object returned by the API. properties: @@ -87967,6 +88516,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/examples/v2/static-analysis/CreateCustomRule.java b/examples/v2/static-analysis/CreateCustomRule.java new file mode 100644 index 00000000000..2b0d1be34d2 --- /dev/null +++ b/examples/v2/static-analysis/CreateCustomRule.java @@ -0,0 +1,36 @@ +// Create Custom Rule returns "Successfully created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.CustomRuleDataType; +import com.datadog.api.client.v2.model.CustomRuleRequest; +import com.datadog.api.client.v2.model.CustomRuleRequestData; +import com.datadog.api.client.v2.model.CustomRuleRequestDataAttributes; +import com.datadog.api.client.v2.model.CustomRuleResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createCustomRule", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + CustomRuleRequest body = + new CustomRuleRequest() + .data( + new CustomRuleRequestData() + .attributes(new CustomRuleRequestDataAttributes()) + .type(CustomRuleDataType.CUSTOM_RULE)); + + try { + CustomRuleResponse result = apiInstance.createCustomRule("ruleset_name", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#createCustomRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/static-analysis/CreateCustomRuleRevision.java b/examples/v2/static-analysis/CreateCustomRuleRevision.java new file mode 100644 index 00000000000..158d1b18374 --- /dev/null +++ b/examples/v2/static-analysis/CreateCustomRuleRevision.java @@ -0,0 +1,68 @@ +// Create Custom Rule Revision returns "Successfully created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.Argument; +import com.datadog.api.client.v2.model.CustomRuleRevisionAttributesCategory; +import com.datadog.api.client.v2.model.CustomRuleRevisionAttributesSeverity; +import com.datadog.api.client.v2.model.CustomRuleRevisionDataType; +import com.datadog.api.client.v2.model.CustomRuleRevisionInputAttributes; +import com.datadog.api.client.v2.model.CustomRuleRevisionRequest; +import com.datadog.api.client.v2.model.CustomRuleRevisionRequestData; +import com.datadog.api.client.v2.model.CustomRuleRevisionTest; +import com.datadog.api.client.v2.model.Language; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createCustomRuleRevision", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + CustomRuleRevisionRequest body = + new CustomRuleRevisionRequest() + .data( + new CustomRuleRevisionRequestData() + .attributes( + new CustomRuleRevisionInputAttributes() + .arguments( + Collections.singletonList( + new Argument() + .description("YXJndW1lbnQgZGVzY3JpcHRpb24=") + .name("YXJndW1lbnRfbmFtZQ=="))) + .category(CustomRuleRevisionAttributesCategory.SECURITY) + .code("Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .creationMessage("Initial revision") + .cve("CVE-2024-1234") + .cwe("CWE-79") + .description("bG9uZyBkZXNjcmlwdGlvbg==") + .documentationUrl("https://docs.example.com/rules/my-rule") + .isPublished(false) + .isTesting(false) + .language(Language.PYTHON) + .severity(CustomRuleRevisionAttributesSeverity.ERROR) + .shortDescription("c2hvcnQgZGVzY3JpcHRpb24=") + .shouldUseAiFix(false) + .tags(Arrays.asList("security", "custom")) + .tests( + Collections.singletonList( + new CustomRuleRevisionTest() + .annotationCount(1L) + .code("Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .filename("test.yaml"))) + .treeSitterQuery("Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==")) + .type(CustomRuleRevisionDataType.CUSTOM_RULE_REVISION)); + + try { + apiInstance.createCustomRuleRevision("ruleset_name", "rule_name", body); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#createCustomRuleRevision"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/static-analysis/DeleteCustomRule.java b/examples/v2/static-analysis/DeleteCustomRule.java new file mode 100644 index 00000000000..b1db1dc6a83 --- /dev/null +++ b/examples/v2/static-analysis/DeleteCustomRule.java @@ -0,0 +1,23 @@ +// Delete Custom Rule returns "Successfully deleted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteCustomRule", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + apiInstance.deleteCustomRule("ruleset_name", "rule_name"); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#deleteCustomRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/static-analysis/DeleteCustomRuleset.java b/examples/v2/static-analysis/DeleteCustomRuleset.java new file mode 100644 index 00000000000..92a8d39e959 --- /dev/null +++ b/examples/v2/static-analysis/DeleteCustomRuleset.java @@ -0,0 +1,23 @@ +// Delete Custom Ruleset returns "Successfully deleted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteCustomRuleset", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + apiInstance.deleteCustomRuleset("ruleset_name"); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#deleteCustomRuleset"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/static-analysis/ListCustomRuleRevisions.java b/examples/v2/static-analysis/ListCustomRuleRevisions.java new file mode 100644 index 00000000000..4e1fc532b68 --- /dev/null +++ b/examples/v2/static-analysis/ListCustomRuleRevisions.java @@ -0,0 +1,26 @@ +// List Custom Rule Revisions returns "Successful response" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.CustomRuleRevisionsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listCustomRuleRevisions", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + CustomRuleRevisionsResponse result = + apiInstance.listCustomRuleRevisions("ruleset_name", "rule_name"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#listCustomRuleRevisions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/static-analysis/RevertCustomRuleRevision.java b/examples/v2/static-analysis/RevertCustomRuleRevision.java new file mode 100644 index 00000000000..d61f4edf805 --- /dev/null +++ b/examples/v2/static-analysis/RevertCustomRuleRevision.java @@ -0,0 +1,34 @@ +// Revert Custom Rule Revision returns "Successfully reverted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.RevertCustomRuleRevisionDataType; +import com.datadog.api.client.v2.model.RevertCustomRuleRevisionRequest; +import com.datadog.api.client.v2.model.RevertCustomRuleRevisionRequestData; +import com.datadog.api.client.v2.model.RevertCustomRuleRevisionRequestDataAttributes; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.revertCustomRuleRevision", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + RevertCustomRuleRevisionRequest body = + new RevertCustomRuleRevisionRequest() + .data( + new RevertCustomRuleRevisionRequestData() + .attributes(new RevertCustomRuleRevisionRequestDataAttributes()) + .type(RevertCustomRuleRevisionDataType.REVERT_CUSTOM_RULE_REVISION_REQUEST)); + + try { + apiInstance.revertCustomRuleRevision("ruleset_name", "rule_name", body); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#revertCustomRuleRevision"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/static-analysis/ShowCustomRule.java b/examples/v2/static-analysis/ShowCustomRule.java new file mode 100644 index 00000000000..ec353a092d2 --- /dev/null +++ b/examples/v2/static-analysis/ShowCustomRule.java @@ -0,0 +1,25 @@ +// Show Custom Rule returns "Successful response" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.CustomRuleResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.showCustomRule", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + CustomRuleResponse result = apiInstance.showCustomRule("ruleset_name", "rule_name"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#showCustomRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/static-analysis/ShowCustomRuleRevision.java b/examples/v2/static-analysis/ShowCustomRuleRevision.java new file mode 100644 index 00000000000..1401452e02b --- /dev/null +++ b/examples/v2/static-analysis/ShowCustomRuleRevision.java @@ -0,0 +1,26 @@ +// Show Custom Rule Revision returns "Successful response" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.CustomRuleRevisionResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.showCustomRuleRevision", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + CustomRuleRevisionResponse result = + apiInstance.showCustomRuleRevision("ruleset_name", "rule_name", "id"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#showCustomRuleRevision"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/static-analysis/ShowCustomRuleset.java b/examples/v2/static-analysis/ShowCustomRuleset.java new file mode 100644 index 00000000000..b897c301951 --- /dev/null +++ b/examples/v2/static-analysis/ShowCustomRuleset.java @@ -0,0 +1,25 @@ +// Show Custom Ruleset returns "Successful response" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.CustomRulesetResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.showCustomRuleset", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + CustomRulesetResponse result = apiInstance.showCustomRuleset("ruleset_name"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#showCustomRuleset"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/static-analysis/UpdateCustomRuleset.java b/examples/v2/static-analysis/UpdateCustomRuleset.java new file mode 100644 index 00000000000..a7274fa946b --- /dev/null +++ b/examples/v2/static-analysis/UpdateCustomRuleset.java @@ -0,0 +1,106 @@ +// Update Custom Ruleset returns "Successfully updated" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.Argument; +import com.datadog.api.client.v2.model.CustomRule; +import com.datadog.api.client.v2.model.CustomRuleRevision; +import com.datadog.api.client.v2.model.CustomRuleRevisionAttributes; +import com.datadog.api.client.v2.model.CustomRuleRevisionAttributesCategory; +import com.datadog.api.client.v2.model.CustomRuleRevisionAttributesSeverity; +import com.datadog.api.client.v2.model.CustomRuleRevisionDataType; +import com.datadog.api.client.v2.model.CustomRuleRevisionTest; +import com.datadog.api.client.v2.model.CustomRulesetDataType; +import com.datadog.api.client.v2.model.CustomRulesetRequest; +import com.datadog.api.client.v2.model.CustomRulesetRequestData; +import com.datadog.api.client.v2.model.CustomRulesetRequestDataAttributes; +import com.datadog.api.client.v2.model.CustomRulesetResponse; +import com.datadog.api.client.v2.model.Language; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateCustomRuleset", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + CustomRulesetRequest body = + new CustomRulesetRequest() + .data( + new CustomRulesetRequestData() + .attributes( + new CustomRulesetRequestDataAttributes() + .rules( + Collections.singletonList( + new CustomRule() + .createdAt( + OffsetDateTime.parse("2026-01-09T13:00:57.473141Z")) + .createdBy("foobarbaz") + .lastRevision( + new CustomRuleRevision() + .attributes( + new CustomRuleRevisionAttributes() + .arguments( + Collections.singletonList( + new Argument() + .description( + "YXJndW1lbnQgZGVzY3JpcHRpb24=") + .name("YXJndW1lbnRfbmFtZQ=="))) + .category( + CustomRuleRevisionAttributesCategory + .SECURITY) + .checksum( + "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99") + .code( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .createdAt( + OffsetDateTime.parse( + "2026-01-09T13:00:57.473141Z")) + .createdBy("foobarbaz") + .creationMessage("Initial revision") + .cve("CVE-2024-1234") + .cwe("CWE-79") + .description("bG9uZyBkZXNjcmlwdGlvbg==") + .documentationUrl( + "https://docs.example.com/rules/my-rule") + .isPublished(false) + .isTesting(false) + .language(Language.PYTHON) + .severity( + CustomRuleRevisionAttributesSeverity + .ERROR) + .shortDescription( + "c2hvcnQgZGVzY3JpcHRpb24=") + .shouldUseAiFix(false) + .tags(Arrays.asList("security", "custom")) + .tests( + Collections.singletonList( + new CustomRuleRevisionTest() + .annotationCount(1L) + .code( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==") + .filename("test.yaml"))) + .treeSitterQuery( + "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==")) + .id("revision-123") + .type( + CustomRuleRevisionDataType + .CUSTOM_RULE_REVISION)) + .name("my-rule")))) + .type(CustomRulesetDataType.CUSTOM_RULESET)); + + try { + CustomRulesetResponse result = apiInstance.updateCustomRuleset("ruleset_name", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#updateCustomRuleset"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 013c656b24d..89d5ebc545f 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -902,8 +902,18 @@ public class ApiClient { put("v2.getSLOReportJobStatus", false); put("v2.getSPARecommendations", false); put("v2.getSPARecommendationsWithShard", false); + put("v2.createCustomRule", false); + put("v2.createCustomRuleRevision", false); put("v2.createSCAResolveVulnerableSymbols", false); put("v2.createSCAResult", false); + put("v2.deleteCustomRule", false); + put("v2.deleteCustomRuleset", false); + put("v2.listCustomRuleRevisions", false); + put("v2.revertCustomRuleRevision", false); + put("v2.showCustomRule", false); + put("v2.showCustomRuleRevision", false); + put("v2.showCustomRuleset", false); + put("v2.updateCustomRuleset", false); put("v2.addMemberTeam", false); put("v2.listMemberTeams", false); put("v2.removeMemberTeam", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/StaticAnalysisApi.java b/src/main/java/com/datadog/api/client/v2/api/StaticAnalysisApi.java index aab0103c376..a40613d4d03 100644 --- a/src/main/java/com/datadog/api/client/v2/api/StaticAnalysisApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/StaticAnalysisApi.java @@ -4,13 +4,22 @@ import com.datadog.api.client.ApiException; import com.datadog.api.client.ApiResponse; import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.CustomRuleRequest; +import com.datadog.api.client.v2.model.CustomRuleResponse; +import com.datadog.api.client.v2.model.CustomRuleRevisionRequest; +import com.datadog.api.client.v2.model.CustomRuleRevisionResponse; +import com.datadog.api.client.v2.model.CustomRuleRevisionsResponse; +import com.datadog.api.client.v2.model.CustomRulesetRequest; +import com.datadog.api.client.v2.model.CustomRulesetResponse; import com.datadog.api.client.v2.model.ResolveVulnerableSymbolsRequest; import com.datadog.api.client.v2.model.ResolveVulnerableSymbolsResponse; +import com.datadog.api.client.v2.model.RevertCustomRuleRevisionRequest; import com.datadog.api.client.v2.model.ScaRequest; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -45,6 +54,383 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Create Custom Rule. + * + *

See {@link #createCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param body (required) + * @return CustomRuleResponse + * @throws ApiException if fails to make API call + */ + public CustomRuleResponse createCustomRule(String rulesetName, CustomRuleRequest body) + throws ApiException { + return createCustomRuleWithHttpInfo(rulesetName, body).getData(); + } + + /** + * Create Custom Rule. + * + *

See {@link #createCustomRuleWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param body (required) + * @return CompletableFuture<CustomRuleResponse> + */ + public CompletableFuture createCustomRuleAsync( + String rulesetName, CustomRuleRequest body) { + return createCustomRuleWithHttpInfoAsync(rulesetName, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new custom rule within a ruleset + * + * @param rulesetName The ruleset name (required) + * @param body (required) + * @return ApiResponse<CustomRuleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successfully created -
400 Bad request -
401 Unauthorized - custom rules not enabled -
409 Conflict - rule already exists -
412 Precondition failed - validation error or ruleset not found -
429 Too many requests -
+ */ + public ApiResponse createCustomRuleWithHttpInfo( + String rulesetName, CustomRuleRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createCustomRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + throw new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling createCustomRule"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createCustomRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createCustomRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create Custom Rule. + * + *

See {@link #createCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<CustomRuleResponse>> + */ + public CompletableFuture> createCustomRuleWithHttpInfoAsync( + String rulesetName, CustomRuleRequest body) { + // Check if unstable operation is enabled + String operationId = "createCustomRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling createCustomRule")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createCustomRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createCustomRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create Custom Rule Revision. + * + *

See {@link #createCustomRuleRevisionWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void createCustomRuleRevision( + String rulesetName, String ruleName, CustomRuleRevisionRequest body) throws ApiException { + createCustomRuleRevisionWithHttpInfo(rulesetName, ruleName, body); + } + + /** + * Create Custom Rule Revision. + * + *

See {@link #createCustomRuleRevisionWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture createCustomRuleRevisionAsync( + String rulesetName, String ruleName, CustomRuleRevisionRequest body) { + return createCustomRuleRevisionWithHttpInfoAsync(rulesetName, ruleName, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new revision for a custom rule + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successfully created -
400 Bad request -
401 Unauthorized - custom rules not enabled -
404 Rule not found -
429 Too many requests -
+ */ + public ApiResponse createCustomRuleRevisionWithHttpInfo( + String rulesetName, String ruleName, CustomRuleRevisionRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createCustomRuleRevision"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + throw new ApiException( + 400, + "Missing the required parameter 'rulesetName' when calling createCustomRuleRevision"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling createCustomRuleRevision"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createCustomRuleRevision"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createCustomRuleRevision", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Create Custom Rule Revision. + * + *

See {@link #createCustomRuleRevisionWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> createCustomRuleRevisionWithHttpInfoAsync( + String rulesetName, String ruleName, CustomRuleRevisionRequest body) { + // Check if unstable operation is enabled + String operationId = "createCustomRuleRevision"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'rulesetName' when calling" + + " createCustomRuleRevision")); + return result; + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ruleName' when calling createCustomRuleRevision")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createCustomRuleRevision")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createCustomRuleRevision", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * POST request to resolve vulnerable symbols. * @@ -338,4 +724,1514 @@ public CompletableFuture> createSCAResultWithHttpInfoAsync(Sca false, null); } + + /** + * Delete Custom Rule. + * + *

See {@link #deleteCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @throws ApiException if fails to make API call + */ + public void deleteCustomRule(String rulesetName, String ruleName) throws ApiException { + deleteCustomRuleWithHttpInfo(rulesetName, ruleName); + } + + /** + * Delete Custom Rule. + * + *

See {@link #deleteCustomRuleWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return CompletableFuture + */ + public CompletableFuture deleteCustomRuleAsync(String rulesetName, String ruleName) { + return deleteCustomRuleWithHttpInfoAsync(rulesetName, ruleName) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete a custom rule + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successfully deleted -
400 Bad request -
401 Unauthorized - custom rules not enabled -
404 Rule not found -
429 Too many requests -
+ */ + public ApiResponse deleteCustomRuleWithHttpInfo(String rulesetName, String ruleName) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteCustomRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + throw new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling deleteCustomRule"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling deleteCustomRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.deleteCustomRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete Custom Rule. + * + *

See {@link #deleteCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteCustomRuleWithHttpInfoAsync( + String rulesetName, String ruleName) { + // Check if unstable operation is enabled + String operationId = "deleteCustomRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling deleteCustomRule")); + return result; + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'ruleName' when calling deleteCustomRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.deleteCustomRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete Custom Ruleset. + * + *

See {@link #deleteCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @throws ApiException if fails to make API call + */ + public void deleteCustomRuleset(String rulesetName) throws ApiException { + deleteCustomRulesetWithHttpInfo(rulesetName); + } + + /** + * Delete Custom Ruleset. + * + *

See {@link #deleteCustomRulesetWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @return CompletableFuture + */ + public CompletableFuture deleteCustomRulesetAsync(String rulesetName) { + return deleteCustomRulesetWithHttpInfoAsync(rulesetName) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete a custom ruleset + * + * @param rulesetName The ruleset name (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successfully deleted -
400 Bad request -
401 Unauthorized - custom rules not enabled -
404 Ruleset not found -
429 Too many requests -
+ */ + public ApiResponse deleteCustomRulesetWithHttpInfo(String rulesetName) throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteCustomRuleset"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + throw new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling deleteCustomRuleset"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.deleteCustomRuleset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete Custom Ruleset. + * + *

See {@link #deleteCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteCustomRulesetWithHttpInfoAsync( + String rulesetName) { + // Check if unstable operation is enabled + String operationId = "deleteCustomRuleset"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'rulesetName' when calling deleteCustomRuleset")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.deleteCustomRuleset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** Manage optional parameters to listCustomRuleRevisions. */ + public static class ListCustomRuleRevisionsOptionalParameters { + private Integer pageOffset; + private Integer pageLimit; + + /** + * Set pageOffset. + * + * @param pageOffset Pagination offset (optional, default to 0) + * @return ListCustomRuleRevisionsOptionalParameters + */ + public ListCustomRuleRevisionsOptionalParameters pageOffset(Integer pageOffset) { + this.pageOffset = pageOffset; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit Pagination limit (optional, default to 10) + * @return ListCustomRuleRevisionsOptionalParameters + */ + public ListCustomRuleRevisionsOptionalParameters pageLimit(Integer pageLimit) { + this.pageLimit = pageLimit; + return this; + } + } + + /** + * List Custom Rule Revisions. + * + *

See {@link #listCustomRuleRevisionsWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return CustomRuleRevisionsResponse + * @throws ApiException if fails to make API call + */ + public CustomRuleRevisionsResponse listCustomRuleRevisions(String rulesetName, String ruleName) + throws ApiException { + return listCustomRuleRevisionsWithHttpInfo( + rulesetName, ruleName, new ListCustomRuleRevisionsOptionalParameters()) + .getData(); + } + + /** + * List Custom Rule Revisions. + * + *

See {@link #listCustomRuleRevisionsWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return CompletableFuture<CustomRuleRevisionsResponse> + */ + public CompletableFuture listCustomRuleRevisionsAsync( + String rulesetName, String ruleName) { + return listCustomRuleRevisionsWithHttpInfoAsync( + rulesetName, ruleName, new ListCustomRuleRevisionsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List Custom Rule Revisions. + * + *

See {@link #listCustomRuleRevisionsWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param parameters Optional parameters for the request. + * @return CustomRuleRevisionsResponse + * @throws ApiException if fails to make API call + */ + public CustomRuleRevisionsResponse listCustomRuleRevisions( + String rulesetName, String ruleName, ListCustomRuleRevisionsOptionalParameters parameters) + throws ApiException { + return listCustomRuleRevisionsWithHttpInfo(rulesetName, ruleName, parameters).getData(); + } + + /** + * List Custom Rule Revisions. + * + *

See {@link #listCustomRuleRevisionsWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<CustomRuleRevisionsResponse> + */ + public CompletableFuture listCustomRuleRevisionsAsync( + String rulesetName, String ruleName, ListCustomRuleRevisionsOptionalParameters parameters) { + return listCustomRuleRevisionsWithHttpInfoAsync(rulesetName, ruleName, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all revisions for a custom rule + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<CustomRuleRevisionsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successful response -
400 Bad request -
401 Unauthorized - custom rules not enabled -
404 Rule not found -
429 Too many requests -
+ */ + public ApiResponse listCustomRuleRevisionsWithHttpInfo( + String rulesetName, String ruleName, ListCustomRuleRevisionsOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listCustomRuleRevisions"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + throw new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling listCustomRuleRevisions"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling listCustomRuleRevisions"); + } + Integer pageOffset = parameters.pageOffset; + Integer pageLimit = parameters.pageLimit; + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.listCustomRuleRevisions", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List Custom Rule Revisions. + * + *

See {@link #listCustomRuleRevisionsWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<CustomRuleRevisionsResponse>> + */ + public CompletableFuture> + listCustomRuleRevisionsWithHttpInfoAsync( + String rulesetName, + String ruleName, + ListCustomRuleRevisionsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listCustomRuleRevisions"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'rulesetName' when calling listCustomRuleRevisions")); + return result; + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ruleName' when calling listCustomRuleRevisions")); + return result; + } + Integer pageOffset = parameters.pageOffset; + Integer pageLimit = parameters.pageLimit; + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.listCustomRuleRevisions", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Revert Custom Rule Revision. + * + *

See {@link #revertCustomRuleRevisionWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void revertCustomRuleRevision( + String rulesetName, String ruleName, RevertCustomRuleRevisionRequest body) + throws ApiException { + revertCustomRuleRevisionWithHttpInfo(rulesetName, ruleName, body); + } + + /** + * Revert Custom Rule Revision. + * + *

See {@link #revertCustomRuleRevisionWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture revertCustomRuleRevisionAsync( + String rulesetName, String ruleName, RevertCustomRuleRevisionRequest body) { + return revertCustomRuleRevisionWithHttpInfoAsync(rulesetName, ruleName, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Revert a custom rule to a previous revision + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successfully reverted -
400 Bad request -
401 Unauthorized - custom rules not enabled -
429 Too many requests -
+ */ + public ApiResponse revertCustomRuleRevisionWithHttpInfo( + String rulesetName, String ruleName, RevertCustomRuleRevisionRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "revertCustomRuleRevision"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + throw new ApiException( + 400, + "Missing the required parameter 'rulesetName' when calling revertCustomRuleRevision"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling revertCustomRuleRevision"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling revertCustomRuleRevision"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions/revert" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.revertCustomRuleRevision", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Revert Custom Rule Revision. + * + *

See {@link #revertCustomRuleRevisionWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> revertCustomRuleRevisionWithHttpInfoAsync( + String rulesetName, String ruleName, RevertCustomRuleRevisionRequest body) { + // Check if unstable operation is enabled + String operationId = "revertCustomRuleRevision"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'rulesetName' when calling" + + " revertCustomRuleRevision")); + return result; + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ruleName' when calling revertCustomRuleRevision")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling revertCustomRuleRevision")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions/revert" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.revertCustomRuleRevision", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Show Custom Rule. + * + *

See {@link #showCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return CustomRuleResponse + * @throws ApiException if fails to make API call + */ + public CustomRuleResponse showCustomRule(String rulesetName, String ruleName) + throws ApiException { + return showCustomRuleWithHttpInfo(rulesetName, ruleName).getData(); + } + + /** + * Show Custom Rule. + * + *

See {@link #showCustomRuleWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return CompletableFuture<CustomRuleResponse> + */ + public CompletableFuture showCustomRuleAsync( + String rulesetName, String ruleName) { + return showCustomRuleWithHttpInfoAsync(rulesetName, ruleName) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a custom rule by name + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return ApiResponse<CustomRuleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successful response -
400 Bad request -
401 Unauthorized - custom rules not enabled -
404 Rule not found -
429 Too many requests -
+ */ + public ApiResponse showCustomRuleWithHttpInfo( + String rulesetName, String ruleName) throws ApiException { + // Check if unstable operation is enabled + String operationId = "showCustomRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + throw new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling showCustomRule"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling showCustomRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.showCustomRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Show Custom Rule. + * + *

See {@link #showCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return CompletableFuture<ApiResponse<CustomRuleResponse>> + */ + public CompletableFuture> showCustomRuleWithHttpInfoAsync( + String rulesetName, String ruleName) { + // Check if unstable operation is enabled + String operationId = "showCustomRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling showCustomRule")); + return result; + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'ruleName' when calling showCustomRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.showCustomRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Show Custom Rule Revision. + * + *

See {@link #showCustomRuleRevisionWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param id The revision ID (required) + * @return CustomRuleRevisionResponse + * @throws ApiException if fails to make API call + */ + public CustomRuleRevisionResponse showCustomRuleRevision( + String rulesetName, String ruleName, String id) throws ApiException { + return showCustomRuleRevisionWithHttpInfo(rulesetName, ruleName, id).getData(); + } + + /** + * Show Custom Rule Revision. + * + *

See {@link #showCustomRuleRevisionWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param id The revision ID (required) + * @return CompletableFuture<CustomRuleRevisionResponse> + */ + public CompletableFuture showCustomRuleRevisionAsync( + String rulesetName, String ruleName, String id) { + return showCustomRuleRevisionWithHttpInfoAsync(rulesetName, ruleName, id) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a specific revision of a custom rule + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param id The revision ID (required) + * @return ApiResponse<CustomRuleRevisionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successful response -
400 Bad request -
401 Unauthorized - custom rules not enabled -
404 Revision not found -
429 Too many requests -
+ */ + public ApiResponse showCustomRuleRevisionWithHttpInfo( + String rulesetName, String ruleName, String id) throws ApiException { + // Check if unstable operation is enabled + String operationId = "showCustomRuleRevision"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + throw new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling showCustomRuleRevision"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling showCustomRuleRevision"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + 400, "Missing the required parameter 'id' when calling showCustomRuleRevision"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions/{id}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())) + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.showCustomRuleRevision", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Show Custom Rule Revision. + * + *

See {@link #showCustomRuleRevisionWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param id The revision ID (required) + * @return CompletableFuture<ApiResponse<CustomRuleRevisionResponse>> + */ + public CompletableFuture> + showCustomRuleRevisionWithHttpInfoAsync(String rulesetName, String ruleName, String id) { + // Check if unstable operation is enabled + String operationId = "showCustomRuleRevision"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'rulesetName' when calling showCustomRuleRevision")); + return result; + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ruleName' when calling showCustomRuleRevision")); + return result; + } + + // verify the required parameter 'id' is set + if (id == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'id' when calling showCustomRuleRevision")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions/{id}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())) + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.showCustomRuleRevision", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Show Custom Ruleset. + * + *

See {@link #showCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @return CustomRulesetResponse + * @throws ApiException if fails to make API call + */ + public CustomRulesetResponse showCustomRuleset(String rulesetName) throws ApiException { + return showCustomRulesetWithHttpInfo(rulesetName).getData(); + } + + /** + * Show Custom Ruleset. + * + *

See {@link #showCustomRulesetWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @return CompletableFuture<CustomRulesetResponse> + */ + public CompletableFuture showCustomRulesetAsync(String rulesetName) { + return showCustomRulesetWithHttpInfoAsync(rulesetName) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a custom ruleset by name + * + * @param rulesetName The ruleset name (required) + * @return ApiResponse<CustomRulesetResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successful response -
400 Bad request -
401 Unauthorized - custom rules not enabled -
404 Ruleset not found -
429 Too many requests -
+ */ + public ApiResponse showCustomRulesetWithHttpInfo(String rulesetName) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "showCustomRuleset"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + throw new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling showCustomRuleset"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.showCustomRuleset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Show Custom Ruleset. + * + *

See {@link #showCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @return CompletableFuture<ApiResponse<CustomRulesetResponse>> + */ + public CompletableFuture> showCustomRulesetWithHttpInfoAsync( + String rulesetName) { + // Check if unstable operation is enabled + String operationId = "showCustomRuleset"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling showCustomRuleset")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.showCustomRuleset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update Custom Ruleset. + * + *

See {@link #updateCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param body (required) + * @return CustomRulesetResponse + * @throws ApiException if fails to make API call + */ + public CustomRulesetResponse updateCustomRuleset(String rulesetName, CustomRulesetRequest body) + throws ApiException { + return updateCustomRulesetWithHttpInfo(rulesetName, body).getData(); + } + + /** + * Update Custom Ruleset. + * + *

See {@link #updateCustomRulesetWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param body (required) + * @return CompletableFuture<CustomRulesetResponse> + */ + public CompletableFuture updateCustomRulesetAsync( + String rulesetName, CustomRulesetRequest body) { + return updateCustomRulesetWithHttpInfoAsync(rulesetName, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an existing custom ruleset + * + * @param rulesetName The ruleset name (required) + * @param body (required) + * @return ApiResponse<CustomRulesetResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successfully updated -
400 Bad request -
401 Unauthorized - custom rules not enabled -
412 Precondition failed - validation error or ruleset not found -
429 Too many requests -
+ */ + public ApiResponse updateCustomRulesetWithHttpInfo( + String rulesetName, CustomRulesetRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateCustomRuleset"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + throw new ApiException( + 400, "Missing the required parameter 'rulesetName' when calling updateCustomRuleset"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateCustomRuleset"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.updateCustomRuleset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update Custom Ruleset. + * + *

See {@link #updateCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<CustomRulesetResponse>> + */ + public CompletableFuture> updateCustomRulesetWithHttpInfoAsync( + String rulesetName, CustomRulesetRequest body) { + // Check if unstable operation is enabled + String operationId = "updateCustomRuleset"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'rulesetName' is set + if (rulesetName == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'rulesetName' when calling updateCustomRuleset")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateCustomRuleset")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.updateCustomRuleset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/Argument.java b/src/main/java/com/datadog/api/client/v2/model/Argument.java new file mode 100644 index 00000000000..a43bc969b3d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/Argument.java @@ -0,0 +1,170 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({Argument.JSON_PROPERTY_DESCRIPTION, Argument.JSON_PROPERTY_NAME}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class Argument { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public Argument() {} + + @JsonCreator + public Argument( + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.description = description; + this.name = name; + } + + public Argument description(String description) { + this.description = description; + return this; + } + + /** + * Base64-encoded argument description + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Argument name(String name) { + this.name = name; + return this; + } + + /** + * Base64-encoded argument name + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return Argument + */ + @JsonAnySetter + public Argument putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this Argument object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Argument argument = (Argument) o; + return Objects.equals(this.description, argument.description) + && Objects.equals(this.name, argument.name) + && Objects.equals(this.additionalProperties, argument.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Argument {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRule.java b/src/main/java/com/datadog/api/client/v2/model/CustomRule.java new file mode 100644 index 00000000000..9587df95d4f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRule.java @@ -0,0 +1,233 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRule.JSON_PROPERTY_CREATED_AT, + CustomRule.JSON_PROPERTY_CREATED_BY, + CustomRule.JSON_PROPERTY_LAST_REVISION, + CustomRule.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + + public static final String JSON_PROPERTY_LAST_REVISION = "last_revision"; + private CustomRuleRevision lastRevision; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public CustomRule() {} + + @JsonCreator + public CustomRule( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_REVISION) + CustomRuleRevision lastRevision, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.createdAt = createdAt; + this.createdBy = createdBy; + this.lastRevision = lastRevision; + this.unparsed |= lastRevision.unparsed; + this.name = name; + } + + public CustomRule createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation timestamp + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public CustomRule createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Creator identifier + * + * @return createdBy + */ + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public CustomRule lastRevision(CustomRuleRevision lastRevision) { + this.lastRevision = lastRevision; + this.unparsed |= lastRevision.unparsed; + return this; + } + + /** + * GetlastRevision + * + * @return lastRevision + */ + @JsonProperty(JSON_PROPERTY_LAST_REVISION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevision getLastRevision() { + return lastRevision; + } + + public void setLastRevision(CustomRuleRevision lastRevision) { + this.lastRevision = lastRevision; + } + + public CustomRule name(String name) { + this.name = name; + return this; + } + + /** + * Rule name + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRule + */ + @JsonAnySetter + public CustomRule putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRule customRule = (CustomRule) o; + return Objects.equals(this.createdAt, customRule.createdAt) + && Objects.equals(this.createdBy, customRule.createdBy) + && Objects.equals(this.lastRevision, customRule.lastRevision) + && Objects.equals(this.name, customRule.name) + && Objects.equals(this.additionalProperties, customRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, createdBy, lastRevision, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRule {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" lastRevision: ").append(toIndentedString(lastRevision)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleDataType.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleDataType.java new file mode 100644 index 00000000000..257c056cc04 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleDataType.java @@ -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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Resource type */ +@JsonSerialize(using = CustomRuleDataType.CustomRuleDataTypeSerializer.class) +public class CustomRuleDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("custom_rule")); + + public static final CustomRuleDataType CUSTOM_RULE = new CustomRuleDataType("custom_rule"); + + CustomRuleDataType(String value) { + super(value, allowedValues); + } + + public static class CustomRuleDataTypeSerializer extends StdSerializer { + public CustomRuleDataTypeSerializer(Class t) { + super(t); + } + + public CustomRuleDataTypeSerializer() { + this(null); + } + + @Override + public void serialize(CustomRuleDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomRuleDataType fromValue(String value) { + return new CustomRuleDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequest.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequest.java new file mode 100644 index 00000000000..fc576f2e075 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequest.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({CustomRuleRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CustomRuleRequestData data; + + public CustomRuleRequest data(CustomRuleRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRuleRequestData getData() { + return data; + } + + public void setData(CustomRuleRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRequest + */ + @JsonAnySetter + public CustomRuleRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRequest customRuleRequest = (CustomRuleRequest) o; + return Objects.equals(this.data, customRuleRequest.data) + && Objects.equals(this.additionalProperties, customRuleRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequestData.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequestData.java new file mode 100644 index 00000000000..d541ad59825 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequestData.java @@ -0,0 +1,196 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRuleRequestData.JSON_PROPERTY_ATTRIBUTES, + CustomRuleRequestData.JSON_PROPERTY_ID, + CustomRuleRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CustomRuleRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomRuleDataType type; + + public CustomRuleRequestData attributes(CustomRuleRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Getattributes + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRuleRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CustomRuleRequestDataAttributes attributes) { + this.attributes = attributes; + } + + public CustomRuleRequestData id(String id) { + this.id = id; + return this; + } + + /** + * Rule identifier + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CustomRuleRequestData type(CustomRuleDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Resource type + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRuleDataType getType() { + return type; + } + + public void setType(CustomRuleDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRequestData + */ + @JsonAnySetter + public CustomRuleRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRequestData customRuleRequestData = (CustomRuleRequestData) o; + return Objects.equals(this.attributes, customRuleRequestData.attributes) + && Objects.equals(this.id, customRuleRequestData.id) + && Objects.equals(this.type, customRuleRequestData.type) + && Objects.equals(this.additionalProperties, customRuleRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequestDataAttributes.java new file mode 100644 index 00000000000..cccd3f26129 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRequestDataAttributes.java @@ -0,0 +1,137 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({CustomRuleRequestDataAttributes.JSON_PROPERTY_NAME}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public CustomRuleRequestDataAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Rule name + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRequestDataAttributes + */ + @JsonAnySetter + public CustomRuleRequestDataAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRequestDataAttributes customRuleRequestDataAttributes = + (CustomRuleRequestDataAttributes) o; + return Objects.equals(this.name, customRuleRequestDataAttributes.name) + && Objects.equals( + this.additionalProperties, customRuleRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRequestDataAttributes {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleResponse.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleResponse.java new file mode 100644 index 00000000000..bf409655053 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleResponse.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({CustomRuleResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CustomRuleResponseData data; + + public CustomRuleResponse() {} + + @JsonCreator + public CustomRuleResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CustomRuleResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CustomRuleResponse data(CustomRuleResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleResponseData getData() { + return data; + } + + public void setData(CustomRuleResponseData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleResponse + */ + @JsonAnySetter + public CustomRuleResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleResponse customRuleResponse = (CustomRuleResponse) o; + return Objects.equals(this.data, customRuleResponse.data) + && Objects.equals(this.additionalProperties, customRuleResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleResponseData.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleResponseData.java new file mode 100644 index 00000000000..6f6c6f59d83 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleResponseData.java @@ -0,0 +1,208 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRuleResponseData.JSON_PROPERTY_ATTRIBUTES, + CustomRuleResponseData.JSON_PROPERTY_ID, + CustomRuleResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CustomRule attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomRuleDataType type; + + public CustomRuleResponseData() {} + + @JsonCreator + public CustomRuleResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) CustomRule attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CustomRuleDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CustomRuleResponseData attributes(CustomRule attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Getattributes + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRule getAttributes() { + return attributes; + } + + public void setAttributes(CustomRule attributes) { + this.attributes = attributes; + } + + public CustomRuleResponseData id(String id) { + this.id = id; + return this; + } + + /** + * Rule identifier + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CustomRuleResponseData type(CustomRuleDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Resource type + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleDataType getType() { + return type; + } + + public void setType(CustomRuleDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleResponseData + */ + @JsonAnySetter + public CustomRuleResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleResponseData customRuleResponseData = (CustomRuleResponseData) o; + return Objects.equals(this.attributes, customRuleResponseData.attributes) + && Objects.equals(this.id, customRuleResponseData.id) + && Objects.equals(this.type, customRuleResponseData.type) + && Objects.equals(this.additionalProperties, customRuleResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevision.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevision.java new file mode 100644 index 00000000000..37782822512 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevision.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRuleRevision.JSON_PROPERTY_ATTRIBUTES, + CustomRuleRevision.JSON_PROPERTY_ID, + CustomRuleRevision.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRevision { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CustomRuleRevisionAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomRuleRevisionDataType type; + + public CustomRuleRevision() {} + + @JsonCreator + public CustomRuleRevision( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CustomRuleRevisionAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CustomRuleRevisionDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CustomRuleRevision attributes(CustomRuleRevisionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Getattributes + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevisionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CustomRuleRevisionAttributes attributes) { + this.attributes = attributes; + } + + public CustomRuleRevision id(String id) { + this.id = id; + return this; + } + + /** + * Revision identifier + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CustomRuleRevision type(CustomRuleRevisionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Resource type + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevisionDataType getType() { + return type; + } + + public void setType(CustomRuleRevisionDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRevision + */ + @JsonAnySetter + public CustomRuleRevision putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRevision object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRevision customRuleRevision = (CustomRuleRevision) o; + return Objects.equals(this.attributes, customRuleRevision.attributes) + && Objects.equals(this.id, customRuleRevision.id) + && Objects.equals(this.type, customRuleRevision.type) + && Objects.equals(this.additionalProperties, customRuleRevision.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRevision {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributes.java new file mode 100644 index 00000000000..8fd0e2660b7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributes.java @@ -0,0 +1,756 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRuleRevisionAttributes.JSON_PROPERTY_ARGUMENTS, + CustomRuleRevisionAttributes.JSON_PROPERTY_CATEGORY, + CustomRuleRevisionAttributes.JSON_PROPERTY_CHECKSUM, + CustomRuleRevisionAttributes.JSON_PROPERTY_CODE, + CustomRuleRevisionAttributes.JSON_PROPERTY_CREATED_AT, + CustomRuleRevisionAttributes.JSON_PROPERTY_CREATED_BY, + CustomRuleRevisionAttributes.JSON_PROPERTY_CREATION_MESSAGE, + CustomRuleRevisionAttributes.JSON_PROPERTY_CVE, + CustomRuleRevisionAttributes.JSON_PROPERTY_CWE, + CustomRuleRevisionAttributes.JSON_PROPERTY_DESCRIPTION, + CustomRuleRevisionAttributes.JSON_PROPERTY_DOCUMENTATION_URL, + CustomRuleRevisionAttributes.JSON_PROPERTY_IS_PUBLISHED, + CustomRuleRevisionAttributes.JSON_PROPERTY_IS_TESTING, + CustomRuleRevisionAttributes.JSON_PROPERTY_LANGUAGE, + CustomRuleRevisionAttributes.JSON_PROPERTY_SEVERITY, + CustomRuleRevisionAttributes.JSON_PROPERTY_SHORT_DESCRIPTION, + CustomRuleRevisionAttributes.JSON_PROPERTY_SHOULD_USE_AI_FIX, + CustomRuleRevisionAttributes.JSON_PROPERTY_TAGS, + CustomRuleRevisionAttributes.JSON_PROPERTY_TESTS, + CustomRuleRevisionAttributes.JSON_PROPERTY_TREE_SITTER_QUERY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRevisionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ARGUMENTS = "arguments"; + private List arguments = new ArrayList<>(); + + public static final String JSON_PROPERTY_CATEGORY = "category"; + private CustomRuleRevisionAttributesCategory category; + + public static final String JSON_PROPERTY_CHECKSUM = "checksum"; + private String checksum; + + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + + public static final String JSON_PROPERTY_CREATION_MESSAGE = "creation_message"; + private String creationMessage; + + public static final String JSON_PROPERTY_CVE = "cve"; + private String cve; + + public static final String JSON_PROPERTY_CWE = "cwe"; + private String cwe; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DOCUMENTATION_URL = "documentation_url"; + private String documentationUrl; + + public static final String JSON_PROPERTY_IS_PUBLISHED = "is_published"; + private Boolean isPublished; + + public static final String JSON_PROPERTY_IS_TESTING = "is_testing"; + private Boolean isTesting; + + public static final String JSON_PROPERTY_LANGUAGE = "language"; + private Language language; + + public static final String JSON_PROPERTY_SEVERITY = "severity"; + private CustomRuleRevisionAttributesSeverity severity; + + public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public static final String JSON_PROPERTY_SHOULD_USE_AI_FIX = "should_use_ai_fix"; + private Boolean shouldUseAiFix; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = new ArrayList<>(); + + public static final String JSON_PROPERTY_TESTS = "tests"; + private List tests = new ArrayList<>(); + + public static final String JSON_PROPERTY_TREE_SITTER_QUERY = "tree_sitter_query"; + private String treeSitterQuery; + + public CustomRuleRevisionAttributes() {} + + @JsonCreator + public CustomRuleRevisionAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ARGUMENTS) List arguments, + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) + CustomRuleRevisionAttributesCategory category, + @JsonProperty(required = true, value = JSON_PROPERTY_CHECKSUM) String checksum, + @JsonProperty(required = true, value = JSON_PROPERTY_CODE) String code, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATION_MESSAGE) String creationMessage, + @JsonProperty(required = true, value = JSON_PROPERTY_CVE) String cve, + @JsonProperty(required = true, value = JSON_PROPERTY_CWE) String cwe, + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_DOCUMENTATION_URL) + String documentationUrl, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_PUBLISHED) Boolean isPublished, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_TESTING) Boolean isTesting, + @JsonProperty(required = true, value = JSON_PROPERTY_LANGUAGE) Language language, + @JsonProperty(required = true, value = JSON_PROPERTY_SEVERITY) + CustomRuleRevisionAttributesSeverity severity, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) + String shortDescription, + @JsonProperty(required = true, value = JSON_PROPERTY_SHOULD_USE_AI_FIX) + Boolean shouldUseAiFix, + @JsonProperty(required = true, value = JSON_PROPERTY_TAGS) List tags, + @JsonProperty(required = true, value = JSON_PROPERTY_TESTS) + List tests, + @JsonProperty(required = true, value = JSON_PROPERTY_TREE_SITTER_QUERY) + String treeSitterQuery) { + this.arguments = arguments; + this.category = category; + this.unparsed |= !category.isValid(); + this.checksum = checksum; + this.code = code; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.creationMessage = creationMessage; + this.cve = cve; + if (cve != null) {} + this.cwe = cwe; + if (cwe != null) {} + this.description = description; + this.documentationUrl = documentationUrl; + if (documentationUrl != null) {} + this.isPublished = isPublished; + this.isTesting = isTesting; + this.language = language; + this.unparsed |= !language.isValid(); + this.severity = severity; + this.unparsed |= !severity.isValid(); + this.shortDescription = shortDescription; + this.shouldUseAiFix = shouldUseAiFix; + this.tags = tags; + this.tests = tests; + this.treeSitterQuery = treeSitterQuery; + } + + public CustomRuleRevisionAttributes arguments(List arguments) { + this.arguments = arguments; + for (Argument item : arguments) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRuleRevisionAttributes addArgumentsItem(Argument argumentsItem) { + this.arguments.add(argumentsItem); + this.unparsed |= argumentsItem.unparsed; + return this; + } + + /** + * Rule arguments + * + * @return arguments + */ + @JsonProperty(JSON_PROPERTY_ARGUMENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getArguments() { + return arguments; + } + + public void setArguments(List arguments) { + this.arguments = arguments; + } + + public CustomRuleRevisionAttributes category(CustomRuleRevisionAttributesCategory category) { + this.category = category; + this.unparsed |= !category.isValid(); + return this; + } + + /** + * Rule category + * + * @return category + */ + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevisionAttributesCategory getCategory() { + return category; + } + + public void setCategory(CustomRuleRevisionAttributesCategory category) { + if (!category.isValid()) { + this.unparsed = true; + } + this.category = category; + } + + public CustomRuleRevisionAttributes checksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * Code checksum + * + * @return checksum + */ + @JsonProperty(JSON_PROPERTY_CHECKSUM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getChecksum() { + return checksum; + } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + public CustomRuleRevisionAttributes code(String code) { + this.code = code; + return this; + } + + /** + * Rule code + * + * @return code + */ + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public CustomRuleRevisionAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation timestamp + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public CustomRuleRevisionAttributes createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Creator identifier + * + * @return createdBy + */ + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public CustomRuleRevisionAttributes creationMessage(String creationMessage) { + this.creationMessage = creationMessage; + return this; + } + + /** + * Revision creation message + * + * @return creationMessage + */ + @JsonProperty(JSON_PROPERTY_CREATION_MESSAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreationMessage() { + return creationMessage; + } + + public void setCreationMessage(String creationMessage) { + this.creationMessage = creationMessage; + } + + public CustomRuleRevisionAttributes cve(String cve) { + this.cve = cve; + if (cve != null) {} + return this; + } + + /** + * Associated CVE + * + * @return cve + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CVE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCve() { + return cve; + } + + public void setCve(String cve) { + this.cve = cve; + } + + public CustomRuleRevisionAttributes cwe(String cwe) { + this.cwe = cwe; + if (cwe != null) {} + return this; + } + + /** + * Associated CWE + * + * @return cwe + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CWE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCwe() { + return cwe; + } + + public void setCwe(String cwe) { + this.cwe = cwe; + } + + public CustomRuleRevisionAttributes description(String description) { + this.description = description; + return this; + } + + /** + * Full description + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CustomRuleRevisionAttributes documentationUrl(String documentationUrl) { + this.documentationUrl = documentationUrl; + if (documentationUrl != null) {} + return this; + } + + /** + * Documentation URL + * + * @return documentationUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDocumentationUrl() { + return documentationUrl; + } + + public void setDocumentationUrl(String documentationUrl) { + this.documentationUrl = documentationUrl; + } + + public CustomRuleRevisionAttributes isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Whether the revision is published + * + * @return isPublished + */ + @JsonProperty(JSON_PROPERTY_IS_PUBLISHED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsPublished() { + return isPublished; + } + + public void setIsPublished(Boolean isPublished) { + this.isPublished = isPublished; + } + + public CustomRuleRevisionAttributes isTesting(Boolean isTesting) { + this.isTesting = isTesting; + return this; + } + + /** + * Whether this is a testing revision + * + * @return isTesting + */ + @JsonProperty(JSON_PROPERTY_IS_TESTING) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsTesting() { + return isTesting; + } + + public void setIsTesting(Boolean isTesting) { + this.isTesting = isTesting; + } + + public CustomRuleRevisionAttributes language(Language language) { + this.language = language; + this.unparsed |= !language.isValid(); + return this; + } + + /** + * Programming language + * + * @return language + */ + @JsonProperty(JSON_PROPERTY_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Language getLanguage() { + return language; + } + + public void setLanguage(Language language) { + if (!language.isValid()) { + this.unparsed = true; + } + this.language = language; + } + + public CustomRuleRevisionAttributes severity(CustomRuleRevisionAttributesSeverity severity) { + this.severity = severity; + this.unparsed |= !severity.isValid(); + return this; + } + + /** + * Rule severity + * + * @return severity + */ + @JsonProperty(JSON_PROPERTY_SEVERITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevisionAttributesSeverity getSeverity() { + return severity; + } + + public void setSeverity(CustomRuleRevisionAttributesSeverity severity) { + if (!severity.isValid()) { + this.unparsed = true; + } + this.severity = severity; + } + + public CustomRuleRevisionAttributes shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Short description + * + * @return shortDescription + */ + @JsonProperty(JSON_PROPERTY_SHORT_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getShortDescription() { + return shortDescription; + } + + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + public CustomRuleRevisionAttributes shouldUseAiFix(Boolean shouldUseAiFix) { + this.shouldUseAiFix = shouldUseAiFix; + return this; + } + + /** + * Whether to use AI for fixes + * + * @return shouldUseAiFix + */ + @JsonProperty(JSON_PROPERTY_SHOULD_USE_AI_FIX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getShouldUseAiFix() { + return shouldUseAiFix; + } + + public void setShouldUseAiFix(Boolean shouldUseAiFix) { + this.shouldUseAiFix = shouldUseAiFix; + } + + public CustomRuleRevisionAttributes tags(List tags) { + this.tags = tags; + return this; + } + + public CustomRuleRevisionAttributes addTagsItem(String tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * Rule tags + * + * @return tags + */ + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public CustomRuleRevisionAttributes tests(List tests) { + this.tests = tests; + for (CustomRuleRevisionTest item : tests) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRuleRevisionAttributes addTestsItem(CustomRuleRevisionTest testsItem) { + this.tests.add(testsItem); + this.unparsed |= testsItem.unparsed; + return this; + } + + /** + * Rule tests + * + * @return tests + */ + @JsonProperty(JSON_PROPERTY_TESTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTests() { + return tests; + } + + public void setTests(List tests) { + this.tests = tests; + } + + public CustomRuleRevisionAttributes treeSitterQuery(String treeSitterQuery) { + this.treeSitterQuery = treeSitterQuery; + return this; + } + + /** + * Tree-sitter query + * + * @return treeSitterQuery + */ + @JsonProperty(JSON_PROPERTY_TREE_SITTER_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTreeSitterQuery() { + return treeSitterQuery; + } + + public void setTreeSitterQuery(String treeSitterQuery) { + this.treeSitterQuery = treeSitterQuery; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRevisionAttributes + */ + @JsonAnySetter + public CustomRuleRevisionAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRevisionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRevisionAttributes customRuleRevisionAttributes = (CustomRuleRevisionAttributes) o; + return Objects.equals(this.arguments, customRuleRevisionAttributes.arguments) + && Objects.equals(this.category, customRuleRevisionAttributes.category) + && Objects.equals(this.checksum, customRuleRevisionAttributes.checksum) + && Objects.equals(this.code, customRuleRevisionAttributes.code) + && Objects.equals(this.createdAt, customRuleRevisionAttributes.createdAt) + && Objects.equals(this.createdBy, customRuleRevisionAttributes.createdBy) + && Objects.equals(this.creationMessage, customRuleRevisionAttributes.creationMessage) + && Objects.equals(this.cve, customRuleRevisionAttributes.cve) + && Objects.equals(this.cwe, customRuleRevisionAttributes.cwe) + && Objects.equals(this.description, customRuleRevisionAttributes.description) + && Objects.equals(this.documentationUrl, customRuleRevisionAttributes.documentationUrl) + && Objects.equals(this.isPublished, customRuleRevisionAttributes.isPublished) + && Objects.equals(this.isTesting, customRuleRevisionAttributes.isTesting) + && Objects.equals(this.language, customRuleRevisionAttributes.language) + && Objects.equals(this.severity, customRuleRevisionAttributes.severity) + && Objects.equals(this.shortDescription, customRuleRevisionAttributes.shortDescription) + && Objects.equals(this.shouldUseAiFix, customRuleRevisionAttributes.shouldUseAiFix) + && Objects.equals(this.tags, customRuleRevisionAttributes.tags) + && Objects.equals(this.tests, customRuleRevisionAttributes.tests) + && Objects.equals(this.treeSitterQuery, customRuleRevisionAttributes.treeSitterQuery) + && Objects.equals( + this.additionalProperties, customRuleRevisionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + arguments, + category, + checksum, + code, + createdAt, + createdBy, + creationMessage, + cve, + cwe, + description, + documentationUrl, + isPublished, + isTesting, + language, + severity, + shortDescription, + shouldUseAiFix, + tags, + tests, + treeSitterQuery, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRevisionAttributes {\n"); + sb.append(" arguments: ").append(toIndentedString(arguments)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" creationMessage: ").append(toIndentedString(creationMessage)).append("\n"); + sb.append(" cve: ").append(toIndentedString(cve)).append("\n"); + sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" documentationUrl: ").append(toIndentedString(documentationUrl)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); + sb.append(" isTesting: ").append(toIndentedString(isTesting)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n"); + sb.append(" shouldUseAiFix: ").append(toIndentedString(shouldUseAiFix)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" tests: ").append(toIndentedString(tests)).append("\n"); + sb.append(" treeSitterQuery: ").append(toIndentedString(treeSitterQuery)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributesCategory.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributesCategory.java new file mode 100644 index 00000000000..c2b4bfcc3e3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributesCategory.java @@ -0,0 +1,69 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Rule category */ +@JsonSerialize( + using = + CustomRuleRevisionAttributesCategory.CustomRuleRevisionAttributesCategorySerializer.class) +public class CustomRuleRevisionAttributesCategory extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("SECURITY", "BEST_PRACTICES", "CODE_STYLE", "ERROR_PRONE", "PERFORMANCE")); + + public static final CustomRuleRevisionAttributesCategory SECURITY = + new CustomRuleRevisionAttributesCategory("SECURITY"); + public static final CustomRuleRevisionAttributesCategory BEST_PRACTICES = + new CustomRuleRevisionAttributesCategory("BEST_PRACTICES"); + public static final CustomRuleRevisionAttributesCategory CODE_STYLE = + new CustomRuleRevisionAttributesCategory("CODE_STYLE"); + public static final CustomRuleRevisionAttributesCategory ERROR_PRONE = + new CustomRuleRevisionAttributesCategory("ERROR_PRONE"); + public static final CustomRuleRevisionAttributesCategory PERFORMANCE = + new CustomRuleRevisionAttributesCategory("PERFORMANCE"); + + CustomRuleRevisionAttributesCategory(String value) { + super(value, allowedValues); + } + + public static class CustomRuleRevisionAttributesCategorySerializer + extends StdSerializer { + public CustomRuleRevisionAttributesCategorySerializer( + Class t) { + super(t); + } + + public CustomRuleRevisionAttributesCategorySerializer() { + this(null); + } + + @Override + public void serialize( + CustomRuleRevisionAttributesCategory value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomRuleRevisionAttributesCategory fromValue(String value) { + return new CustomRuleRevisionAttributesCategory(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributesSeverity.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributesSeverity.java new file mode 100644 index 00000000000..aa433cc3728 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionAttributesSeverity.java @@ -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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Rule severity */ +@JsonSerialize( + using = + CustomRuleRevisionAttributesSeverity.CustomRuleRevisionAttributesSeveritySerializer.class) +public class CustomRuleRevisionAttributesSeverity extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ERROR", "WARNING", "NOTICE")); + + public static final CustomRuleRevisionAttributesSeverity ERROR = + new CustomRuleRevisionAttributesSeverity("ERROR"); + public static final CustomRuleRevisionAttributesSeverity WARNING = + new CustomRuleRevisionAttributesSeverity("WARNING"); + public static final CustomRuleRevisionAttributesSeverity NOTICE = + new CustomRuleRevisionAttributesSeverity("NOTICE"); + + CustomRuleRevisionAttributesSeverity(String value) { + super(value, allowedValues); + } + + public static class CustomRuleRevisionAttributesSeveritySerializer + extends StdSerializer { + public CustomRuleRevisionAttributesSeveritySerializer( + Class t) { + super(t); + } + + public CustomRuleRevisionAttributesSeveritySerializer() { + this(null); + } + + @Override + public void serialize( + CustomRuleRevisionAttributesSeverity value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomRuleRevisionAttributesSeverity fromValue(String value) { + return new CustomRuleRevisionAttributesSeverity(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionDataType.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionDataType.java new file mode 100644 index 00000000000..6b5b29dde4b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionDataType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Resource type */ +@JsonSerialize(using = CustomRuleRevisionDataType.CustomRuleRevisionDataTypeSerializer.class) +public class CustomRuleRevisionDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("custom_rule_revision")); + + public static final CustomRuleRevisionDataType CUSTOM_RULE_REVISION = + new CustomRuleRevisionDataType("custom_rule_revision"); + + CustomRuleRevisionDataType(String value) { + super(value, allowedValues); + } + + public static class CustomRuleRevisionDataTypeSerializer + extends StdSerializer { + public CustomRuleRevisionDataTypeSerializer(Class t) { + super(t); + } + + public CustomRuleRevisionDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CustomRuleRevisionDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomRuleRevisionDataType fromValue(String value) { + return new CustomRuleRevisionDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionInputAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionInputAttributes.java new file mode 100644 index 00000000000..9c0eddcdb73 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionInputAttributes.java @@ -0,0 +1,669 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRuleRevisionInputAttributes.JSON_PROPERTY_ARGUMENTS, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_CATEGORY, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_CODE, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_CREATION_MESSAGE, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_CVE, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_CWE, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_DESCRIPTION, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_DOCUMENTATION_URL, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_IS_PUBLISHED, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_IS_TESTING, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_LANGUAGE, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_SEVERITY, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_SHORT_DESCRIPTION, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_SHOULD_USE_AI_FIX, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_TAGS, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_TESTS, + CustomRuleRevisionInputAttributes.JSON_PROPERTY_TREE_SITTER_QUERY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRevisionInputAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ARGUMENTS = "arguments"; + private List arguments = new ArrayList<>(); + + public static final String JSON_PROPERTY_CATEGORY = "category"; + private CustomRuleRevisionAttributesCategory category; + + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_CREATION_MESSAGE = "creation_message"; + private String creationMessage; + + public static final String JSON_PROPERTY_CVE = "cve"; + private String cve; + + public static final String JSON_PROPERTY_CWE = "cwe"; + private String cwe; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DOCUMENTATION_URL = "documentation_url"; + private String documentationUrl; + + public static final String JSON_PROPERTY_IS_PUBLISHED = "is_published"; + private Boolean isPublished; + + public static final String JSON_PROPERTY_IS_TESTING = "is_testing"; + private Boolean isTesting; + + public static final String JSON_PROPERTY_LANGUAGE = "language"; + private Language language; + + public static final String JSON_PROPERTY_SEVERITY = "severity"; + private CustomRuleRevisionAttributesSeverity severity; + + public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public static final String JSON_PROPERTY_SHOULD_USE_AI_FIX = "should_use_ai_fix"; + private Boolean shouldUseAiFix; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = new ArrayList<>(); + + public static final String JSON_PROPERTY_TESTS = "tests"; + private List tests = new ArrayList<>(); + + public static final String JSON_PROPERTY_TREE_SITTER_QUERY = "tree_sitter_query"; + private String treeSitterQuery; + + public CustomRuleRevisionInputAttributes() {} + + @JsonCreator + public CustomRuleRevisionInputAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ARGUMENTS) List arguments, + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) + CustomRuleRevisionAttributesCategory category, + @JsonProperty(required = true, value = JSON_PROPERTY_CODE) String code, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATION_MESSAGE) String creationMessage, + @JsonProperty(required = true, value = JSON_PROPERTY_CVE) String cve, + @JsonProperty(required = true, value = JSON_PROPERTY_CWE) String cwe, + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_DOCUMENTATION_URL) + String documentationUrl, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_PUBLISHED) Boolean isPublished, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_TESTING) Boolean isTesting, + @JsonProperty(required = true, value = JSON_PROPERTY_LANGUAGE) Language language, + @JsonProperty(required = true, value = JSON_PROPERTY_SEVERITY) + CustomRuleRevisionAttributesSeverity severity, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) + String shortDescription, + @JsonProperty(required = true, value = JSON_PROPERTY_SHOULD_USE_AI_FIX) + Boolean shouldUseAiFix, + @JsonProperty(required = true, value = JSON_PROPERTY_TAGS) List tags, + @JsonProperty(required = true, value = JSON_PROPERTY_TESTS) + List tests, + @JsonProperty(required = true, value = JSON_PROPERTY_TREE_SITTER_QUERY) + String treeSitterQuery) { + this.arguments = arguments; + this.category = category; + this.unparsed |= !category.isValid(); + this.code = code; + this.creationMessage = creationMessage; + this.cve = cve; + if (cve != null) {} + this.cwe = cwe; + if (cwe != null) {} + this.description = description; + this.documentationUrl = documentationUrl; + if (documentationUrl != null) {} + this.isPublished = isPublished; + this.isTesting = isTesting; + this.language = language; + this.unparsed |= !language.isValid(); + this.severity = severity; + this.unparsed |= !severity.isValid(); + this.shortDescription = shortDescription; + this.shouldUseAiFix = shouldUseAiFix; + this.tags = tags; + this.tests = tests; + this.treeSitterQuery = treeSitterQuery; + } + + public CustomRuleRevisionInputAttributes arguments(List arguments) { + this.arguments = arguments; + for (Argument item : arguments) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRuleRevisionInputAttributes addArgumentsItem(Argument argumentsItem) { + this.arguments.add(argumentsItem); + this.unparsed |= argumentsItem.unparsed; + return this; + } + + /** + * Rule arguments + * + * @return arguments + */ + @JsonProperty(JSON_PROPERTY_ARGUMENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getArguments() { + return arguments; + } + + public void setArguments(List arguments) { + this.arguments = arguments; + } + + public CustomRuleRevisionInputAttributes category(CustomRuleRevisionAttributesCategory category) { + this.category = category; + this.unparsed |= !category.isValid(); + return this; + } + + /** + * Rule category + * + * @return category + */ + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevisionAttributesCategory getCategory() { + return category; + } + + public void setCategory(CustomRuleRevisionAttributesCategory category) { + if (!category.isValid()) { + this.unparsed = true; + } + this.category = category; + } + + public CustomRuleRevisionInputAttributes code(String code) { + this.code = code; + return this; + } + + /** + * Rule code + * + * @return code + */ + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public CustomRuleRevisionInputAttributes creationMessage(String creationMessage) { + this.creationMessage = creationMessage; + return this; + } + + /** + * Revision creation message + * + * @return creationMessage + */ + @JsonProperty(JSON_PROPERTY_CREATION_MESSAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreationMessage() { + return creationMessage; + } + + public void setCreationMessage(String creationMessage) { + this.creationMessage = creationMessage; + } + + public CustomRuleRevisionInputAttributes cve(String cve) { + this.cve = cve; + if (cve != null) {} + return this; + } + + /** + * Associated CVE + * + * @return cve + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CVE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCve() { + return cve; + } + + public void setCve(String cve) { + this.cve = cve; + } + + public CustomRuleRevisionInputAttributes cwe(String cwe) { + this.cwe = cwe; + if (cwe != null) {} + return this; + } + + /** + * Associated CWE + * + * @return cwe + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CWE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCwe() { + return cwe; + } + + public void setCwe(String cwe) { + this.cwe = cwe; + } + + public CustomRuleRevisionInputAttributes description(String description) { + this.description = description; + return this; + } + + /** + * Full description + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CustomRuleRevisionInputAttributes documentationUrl(String documentationUrl) { + this.documentationUrl = documentationUrl; + if (documentationUrl != null) {} + return this; + } + + /** + * Documentation URL + * + * @return documentationUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DOCUMENTATION_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDocumentationUrl() { + return documentationUrl; + } + + public void setDocumentationUrl(String documentationUrl) { + this.documentationUrl = documentationUrl; + } + + public CustomRuleRevisionInputAttributes isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Whether the revision is published + * + * @return isPublished + */ + @JsonProperty(JSON_PROPERTY_IS_PUBLISHED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsPublished() { + return isPublished; + } + + public void setIsPublished(Boolean isPublished) { + this.isPublished = isPublished; + } + + public CustomRuleRevisionInputAttributes isTesting(Boolean isTesting) { + this.isTesting = isTesting; + return this; + } + + /** + * Whether this is a testing revision + * + * @return isTesting + */ + @JsonProperty(JSON_PROPERTY_IS_TESTING) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsTesting() { + return isTesting; + } + + public void setIsTesting(Boolean isTesting) { + this.isTesting = isTesting; + } + + public CustomRuleRevisionInputAttributes language(Language language) { + this.language = language; + this.unparsed |= !language.isValid(); + return this; + } + + /** + * Programming language + * + * @return language + */ + @JsonProperty(JSON_PROPERTY_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Language getLanguage() { + return language; + } + + public void setLanguage(Language language) { + if (!language.isValid()) { + this.unparsed = true; + } + this.language = language; + } + + public CustomRuleRevisionInputAttributes severity(CustomRuleRevisionAttributesSeverity severity) { + this.severity = severity; + this.unparsed |= !severity.isValid(); + return this; + } + + /** + * Rule severity + * + * @return severity + */ + @JsonProperty(JSON_PROPERTY_SEVERITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevisionAttributesSeverity getSeverity() { + return severity; + } + + public void setSeverity(CustomRuleRevisionAttributesSeverity severity) { + if (!severity.isValid()) { + this.unparsed = true; + } + this.severity = severity; + } + + public CustomRuleRevisionInputAttributes shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Short description + * + * @return shortDescription + */ + @JsonProperty(JSON_PROPERTY_SHORT_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getShortDescription() { + return shortDescription; + } + + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + public CustomRuleRevisionInputAttributes shouldUseAiFix(Boolean shouldUseAiFix) { + this.shouldUseAiFix = shouldUseAiFix; + return this; + } + + /** + * Whether to use AI for fixes + * + * @return shouldUseAiFix + */ + @JsonProperty(JSON_PROPERTY_SHOULD_USE_AI_FIX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getShouldUseAiFix() { + return shouldUseAiFix; + } + + public void setShouldUseAiFix(Boolean shouldUseAiFix) { + this.shouldUseAiFix = shouldUseAiFix; + } + + public CustomRuleRevisionInputAttributes tags(List tags) { + this.tags = tags; + return this; + } + + public CustomRuleRevisionInputAttributes addTagsItem(String tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * Rule tags + * + * @return tags + */ + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public CustomRuleRevisionInputAttributes tests(List tests) { + this.tests = tests; + for (CustomRuleRevisionTest item : tests) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRuleRevisionInputAttributes addTestsItem(CustomRuleRevisionTest testsItem) { + this.tests.add(testsItem); + this.unparsed |= testsItem.unparsed; + return this; + } + + /** + * Rule tests + * + * @return tests + */ + @JsonProperty(JSON_PROPERTY_TESTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTests() { + return tests; + } + + public void setTests(List tests) { + this.tests = tests; + } + + public CustomRuleRevisionInputAttributes treeSitterQuery(String treeSitterQuery) { + this.treeSitterQuery = treeSitterQuery; + return this; + } + + /** + * Tree-sitter query + * + * @return treeSitterQuery + */ + @JsonProperty(JSON_PROPERTY_TREE_SITTER_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTreeSitterQuery() { + return treeSitterQuery; + } + + public void setTreeSitterQuery(String treeSitterQuery) { + this.treeSitterQuery = treeSitterQuery; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRevisionInputAttributes + */ + @JsonAnySetter + public CustomRuleRevisionInputAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRevisionInputAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRevisionInputAttributes customRuleRevisionInputAttributes = + (CustomRuleRevisionInputAttributes) o; + return Objects.equals(this.arguments, customRuleRevisionInputAttributes.arguments) + && Objects.equals(this.category, customRuleRevisionInputAttributes.category) + && Objects.equals(this.code, customRuleRevisionInputAttributes.code) + && Objects.equals(this.creationMessage, customRuleRevisionInputAttributes.creationMessage) + && Objects.equals(this.cve, customRuleRevisionInputAttributes.cve) + && Objects.equals(this.cwe, customRuleRevisionInputAttributes.cwe) + && Objects.equals(this.description, customRuleRevisionInputAttributes.description) + && Objects.equals(this.documentationUrl, customRuleRevisionInputAttributes.documentationUrl) + && Objects.equals(this.isPublished, customRuleRevisionInputAttributes.isPublished) + && Objects.equals(this.isTesting, customRuleRevisionInputAttributes.isTesting) + && Objects.equals(this.language, customRuleRevisionInputAttributes.language) + && Objects.equals(this.severity, customRuleRevisionInputAttributes.severity) + && Objects.equals(this.shortDescription, customRuleRevisionInputAttributes.shortDescription) + && Objects.equals(this.shouldUseAiFix, customRuleRevisionInputAttributes.shouldUseAiFix) + && Objects.equals(this.tags, customRuleRevisionInputAttributes.tags) + && Objects.equals(this.tests, customRuleRevisionInputAttributes.tests) + && Objects.equals(this.treeSitterQuery, customRuleRevisionInputAttributes.treeSitterQuery) + && Objects.equals( + this.additionalProperties, customRuleRevisionInputAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + arguments, + category, + code, + creationMessage, + cve, + cwe, + description, + documentationUrl, + isPublished, + isTesting, + language, + severity, + shortDescription, + shouldUseAiFix, + tags, + tests, + treeSitterQuery, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRevisionInputAttributes {\n"); + sb.append(" arguments: ").append(toIndentedString(arguments)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" creationMessage: ").append(toIndentedString(creationMessage)).append("\n"); + sb.append(" cve: ").append(toIndentedString(cve)).append("\n"); + sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" documentationUrl: ").append(toIndentedString(documentationUrl)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); + sb.append(" isTesting: ").append(toIndentedString(isTesting)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n"); + sb.append(" shouldUseAiFix: ").append(toIndentedString(shouldUseAiFix)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" tests: ").append(toIndentedString(tests)).append("\n"); + sb.append(" treeSitterQuery: ").append(toIndentedString(treeSitterQuery)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionRequest.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionRequest.java new file mode 100644 index 00000000000..5725c7d6570 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionRequest.java @@ -0,0 +1,137 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({CustomRuleRevisionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRevisionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CustomRuleRevisionRequestData data; + + public CustomRuleRevisionRequest data(CustomRuleRevisionRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRuleRevisionRequestData getData() { + return data; + } + + public void setData(CustomRuleRevisionRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRevisionRequest + */ + @JsonAnySetter + public CustomRuleRevisionRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRevisionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRevisionRequest customRuleRevisionRequest = (CustomRuleRevisionRequest) o; + return Objects.equals(this.data, customRuleRevisionRequest.data) + && Objects.equals( + this.additionalProperties, customRuleRevisionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRevisionRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionRequestData.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionRequestData.java new file mode 100644 index 00000000000..3038d497614 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionRequestData.java @@ -0,0 +1,197 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRuleRevisionRequestData.JSON_PROPERTY_ATTRIBUTES, + CustomRuleRevisionRequestData.JSON_PROPERTY_ID, + CustomRuleRevisionRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRevisionRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CustomRuleRevisionInputAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomRuleRevisionDataType type; + + public CustomRuleRevisionRequestData attributes(CustomRuleRevisionInputAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Getattributes + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRuleRevisionInputAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CustomRuleRevisionInputAttributes attributes) { + this.attributes = attributes; + } + + public CustomRuleRevisionRequestData id(String id) { + this.id = id; + return this; + } + + /** + * Revision identifier + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CustomRuleRevisionRequestData type(CustomRuleRevisionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Resource type + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRuleRevisionDataType getType() { + return type; + } + + public void setType(CustomRuleRevisionDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRevisionRequestData + */ + @JsonAnySetter + public CustomRuleRevisionRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRevisionRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRevisionRequestData customRuleRevisionRequestData = (CustomRuleRevisionRequestData) o; + return Objects.equals(this.attributes, customRuleRevisionRequestData.attributes) + && Objects.equals(this.id, customRuleRevisionRequestData.id) + && Objects.equals(this.type, customRuleRevisionRequestData.type) + && Objects.equals( + this.additionalProperties, customRuleRevisionRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRevisionRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionResponse.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionResponse.java new file mode 100644 index 00000000000..509bc78a87e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionResponse.java @@ -0,0 +1,146 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({CustomRuleRevisionResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRevisionResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CustomRuleRevision data; + + public CustomRuleRevisionResponse() {} + + @JsonCreator + public CustomRuleRevisionResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CustomRuleRevision data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CustomRuleRevisionResponse data(CustomRuleRevision data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleRevision getData() { + return data; + } + + public void setData(CustomRuleRevision data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRevisionResponse + */ + @JsonAnySetter + public CustomRuleRevisionResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRevisionResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRevisionResponse customRuleRevisionResponse = (CustomRuleRevisionResponse) o; + return Objects.equals(this.data, customRuleRevisionResponse.data) + && Objects.equals( + this.additionalProperties, customRuleRevisionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRevisionResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionTest.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionTest.java new file mode 100644 index 00000000000..ac4c733e03b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionTest.java @@ -0,0 +1,201 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRuleRevisionTest.JSON_PROPERTY_ANNOTATION_COUNT, + CustomRuleRevisionTest.JSON_PROPERTY_CODE, + CustomRuleRevisionTest.JSON_PROPERTY_FILENAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRevisionTest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ANNOTATION_COUNT = "annotation_count"; + private Long annotationCount; + + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_FILENAME = "filename"; + private String filename; + + public CustomRuleRevisionTest() {} + + @JsonCreator + public CustomRuleRevisionTest( + @JsonProperty(required = true, value = JSON_PROPERTY_ANNOTATION_COUNT) Long annotationCount, + @JsonProperty(required = true, value = JSON_PROPERTY_CODE) String code, + @JsonProperty(required = true, value = JSON_PROPERTY_FILENAME) String filename) { + this.annotationCount = annotationCount; + this.code = code; + this.filename = filename; + } + + public CustomRuleRevisionTest annotationCount(Long annotationCount) { + this.annotationCount = annotationCount; + return this; + } + + /** + * Expected violation count + * + * @return annotationCount + */ + @JsonProperty(JSON_PROPERTY_ANNOTATION_COUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getAnnotationCount() { + return annotationCount; + } + + public void setAnnotationCount(Long annotationCount) { + this.annotationCount = annotationCount; + } + + public CustomRuleRevisionTest code(String code) { + this.code = code; + return this; + } + + /** + * Test code + * + * @return code + */ + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public CustomRuleRevisionTest filename(String filename) { + this.filename = filename; + return this; + } + + /** + * Test filename + * + * @return filename + */ + @JsonProperty(JSON_PROPERTY_FILENAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRevisionTest + */ + @JsonAnySetter + public CustomRuleRevisionTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRevisionTest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRevisionTest customRuleRevisionTest = (CustomRuleRevisionTest) o; + return Objects.equals(this.annotationCount, customRuleRevisionTest.annotationCount) + && Objects.equals(this.code, customRuleRevisionTest.code) + && Objects.equals(this.filename, customRuleRevisionTest.filename) + && Objects.equals(this.additionalProperties, customRuleRevisionTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(annotationCount, code, filename, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRevisionTest {\n"); + sb.append(" annotationCount: ").append(toIndentedString(annotationCount)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" filename: ").append(toIndentedString(filename)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionsResponse.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionsResponse.java new file mode 100644 index 00000000000..13b0968df59 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleRevisionsResponse.java @@ -0,0 +1,150 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({CustomRuleRevisionsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleRevisionsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public CustomRuleRevisionsResponse data(List data) { + this.data = data; + for (CustomRuleRevision item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRuleRevisionsResponse addDataItem(CustomRuleRevision dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleRevisionsResponse + */ + @JsonAnySetter + public CustomRuleRevisionsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleRevisionsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleRevisionsResponse customRuleRevisionsResponse = (CustomRuleRevisionsResponse) o; + return Objects.equals(this.data, customRuleRevisionsResponse.data) + && Objects.equals( + this.additionalProperties, customRuleRevisionsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleRevisionsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRuleset.java b/src/main/java/com/datadog/api/client/v2/model/CustomRuleset.java new file mode 100644 index 00000000000..c73a4ddb398 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRuleset.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRuleset.JSON_PROPERTY_ATTRIBUTES, + CustomRuleset.JSON_PROPERTY_ID, + CustomRuleset.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRuleset { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CustomRulesetAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomRulesetDataType type; + + public CustomRuleset() {} + + @JsonCreator + public CustomRuleset( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CustomRulesetAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CustomRulesetDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CustomRuleset attributes(CustomRulesetAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Getattributes + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRulesetAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CustomRulesetAttributes attributes) { + this.attributes = attributes; + } + + public CustomRuleset id(String id) { + this.id = id; + return this; + } + + /** + * Ruleset identifier + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CustomRuleset type(CustomRulesetDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Resource type + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRulesetDataType getType() { + return type; + } + + public void setType(CustomRulesetDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRuleset + */ + @JsonAnySetter + public CustomRuleset putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRuleset object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRuleset customRuleset = (CustomRuleset) o; + return Objects.equals(this.attributes, customRuleset.attributes) + && Objects.equals(this.id, customRuleset.id) + && Objects.equals(this.type, customRuleset.type) + && Objects.equals(this.additionalProperties, customRuleset.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRuleset {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetAttributes.java new file mode 100644 index 00000000000..2ca52ebf3fd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetAttributes.java @@ -0,0 +1,301 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRulesetAttributes.JSON_PROPERTY_CREATED_AT, + CustomRulesetAttributes.JSON_PROPERTY_CREATED_BY, + CustomRulesetAttributes.JSON_PROPERTY_DESCRIPTION, + CustomRulesetAttributes.JSON_PROPERTY_NAME, + CustomRulesetAttributes.JSON_PROPERTY_RULES, + CustomRulesetAttributes.JSON_PROPERTY_SHORT_DESCRIPTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRulesetAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_RULES = "rules"; + private List rules = new ArrayList<>(); + + public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public CustomRulesetAttributes() {} + + @JsonCreator + public CustomRulesetAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_RULES) List rules, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) + String shortDescription) { + this.createdAt = createdAt; + this.createdBy = createdBy; + this.description = description; + this.name = name; + this.rules = rules; + if (rules != null) {} + this.shortDescription = shortDescription; + } + + public CustomRulesetAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation timestamp + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public CustomRulesetAttributes createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Creator identifier + * + * @return createdBy + */ + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public CustomRulesetAttributes description(String description) { + this.description = description; + return this; + } + + /** + * Base64-encoded full description + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CustomRulesetAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Ruleset name + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CustomRulesetAttributes rules(List rules) { + this.rules = rules; + for (CustomRule item : rules) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRulesetAttributes addRulesItem(CustomRule rulesItem) { + this.rules.add(rulesItem); + this.unparsed |= rulesItem.unparsed; + return this; + } + + /** + * Rules in the ruleset + * + * @return rules + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RULES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRules() { + return rules; + } + + public void setRules(List rules) { + this.rules = rules; + } + + public CustomRulesetAttributes shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Base64-encoded short description + * + * @return shortDescription + */ + @JsonProperty(JSON_PROPERTY_SHORT_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getShortDescription() { + return shortDescription; + } + + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRulesetAttributes + */ + @JsonAnySetter + public CustomRulesetAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRulesetAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRulesetAttributes customRulesetAttributes = (CustomRulesetAttributes) o; + return Objects.equals(this.createdAt, customRulesetAttributes.createdAt) + && Objects.equals(this.createdBy, customRulesetAttributes.createdBy) + && Objects.equals(this.description, customRulesetAttributes.description) + && Objects.equals(this.name, customRulesetAttributes.name) + && Objects.equals(this.rules, customRulesetAttributes.rules) + && Objects.equals(this.shortDescription, customRulesetAttributes.shortDescription) + && Objects.equals(this.additionalProperties, customRulesetAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, createdBy, description, name, rules, shortDescription, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRulesetAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetDataType.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetDataType.java new file mode 100644 index 00000000000..84af8d78191 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetDataType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Resource type */ +@JsonSerialize(using = CustomRulesetDataType.CustomRulesetDataTypeSerializer.class) +public class CustomRulesetDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("custom_ruleset")); + + public static final CustomRulesetDataType CUSTOM_RULESET = + new CustomRulesetDataType("custom_ruleset"); + + CustomRulesetDataType(String value) { + super(value, allowedValues); + } + + public static class CustomRulesetDataTypeSerializer extends StdSerializer { + public CustomRulesetDataTypeSerializer(Class t) { + super(t); + } + + public CustomRulesetDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CustomRulesetDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomRulesetDataType fromValue(String value) { + return new CustomRulesetDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequest.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequest.java new file mode 100644 index 00000000000..e822fb852ef --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequest.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({CustomRulesetRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRulesetRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CustomRulesetRequestData data; + + public CustomRulesetRequest data(CustomRulesetRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRulesetRequestData getData() { + return data; + } + + public void setData(CustomRulesetRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRulesetRequest + */ + @JsonAnySetter + public CustomRulesetRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRulesetRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRulesetRequest customRulesetRequest = (CustomRulesetRequest) o; + return Objects.equals(this.data, customRulesetRequest.data) + && Objects.equals(this.additionalProperties, customRulesetRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRulesetRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestData.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestData.java new file mode 100644 index 00000000000..ade9c5a3e6b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestData.java @@ -0,0 +1,196 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + CustomRulesetRequestData.JSON_PROPERTY_ATTRIBUTES, + CustomRulesetRequestData.JSON_PROPERTY_ID, + CustomRulesetRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRulesetRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CustomRulesetRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomRulesetDataType type; + + public CustomRulesetRequestData attributes(CustomRulesetRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Getattributes + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRulesetRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CustomRulesetRequestDataAttributes attributes) { + this.attributes = attributes; + } + + public CustomRulesetRequestData id(String id) { + this.id = id; + return this; + } + + /** + * Ruleset identifier + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CustomRulesetRequestData type(CustomRulesetDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Resource type + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CustomRulesetDataType getType() { + return type; + } + + public void setType(CustomRulesetDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRulesetRequestData + */ + @JsonAnySetter + public CustomRulesetRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRulesetRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRulesetRequestData customRulesetRequestData = (CustomRulesetRequestData) o; + return Objects.equals(this.attributes, customRulesetRequestData.attributes) + && Objects.equals(this.id, customRulesetRequestData.id) + && Objects.equals(this.type, customRulesetRequestData.type) + && Objects.equals(this.additionalProperties, customRulesetRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRulesetRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestDataAttributes.java new file mode 100644 index 00000000000..8094cc49e09 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetRequestDataAttributes.java @@ -0,0 +1,246 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** */ +@JsonPropertyOrder({ + CustomRulesetRequestDataAttributes.JSON_PROPERTY_DESCRIPTION, + CustomRulesetRequestDataAttributes.JSON_PROPERTY_NAME, + CustomRulesetRequestDataAttributes.JSON_PROPERTY_RULES, + CustomRulesetRequestDataAttributes.JSON_PROPERTY_SHORT_DESCRIPTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRulesetRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_RULES = "rules"; + private JsonNullable> rules = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public CustomRulesetRequestDataAttributes description(String description) { + this.description = description; + return this; + } + + /** + * Base64-encoded full description + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CustomRulesetRequestDataAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Ruleset name + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CustomRulesetRequestDataAttributes rules(List rules) { + this.rules = JsonNullable.>of(rules); + return this; + } + + public CustomRulesetRequestDataAttributes addRulesItem(CustomRule rulesItem) { + if (this.rules == null || !this.rules.isPresent()) { + this.rules = JsonNullable.>of(new ArrayList<>()); + } + try { + this.rules.get().add(rulesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Rules in the ruleset + * + * @return rules + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getRules() { + return rules.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_RULES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getRules_JsonNullable() { + return rules; + } + + @JsonProperty(JSON_PROPERTY_RULES) + public void setRules_JsonNullable(JsonNullable> rules) { + this.rules = rules; + } + + public void setRules(List rules) { + this.rules = JsonNullable.>of(rules); + } + + public CustomRulesetRequestDataAttributes shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Base64-encoded short description + * + * @return shortDescription + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHORT_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getShortDescription() { + return shortDescription; + } + + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRulesetRequestDataAttributes + */ + @JsonAnySetter + public CustomRulesetRequestDataAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRulesetRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRulesetRequestDataAttributes customRulesetRequestDataAttributes = + (CustomRulesetRequestDataAttributes) o; + return Objects.equals(this.description, customRulesetRequestDataAttributes.description) + && Objects.equals(this.name, customRulesetRequestDataAttributes.name) + && Objects.equals(this.rules, customRulesetRequestDataAttributes.rules) + && Objects.equals( + this.shortDescription, customRulesetRequestDataAttributes.shortDescription) + && Objects.equals( + this.additionalProperties, customRulesetRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, name, rules, shortDescription, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRulesetRequestDataAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetResponse.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetResponse.java new file mode 100644 index 00000000000..763a6b1c5ef --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetResponse.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({CustomRulesetResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRulesetResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CustomRuleset data; + + public CustomRulesetResponse() {} + + @JsonCreator + public CustomRulesetResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CustomRuleset data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CustomRulesetResponse data(CustomRuleset data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomRuleset getData() { + return data; + } + + public void setData(CustomRuleset data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CustomRulesetResponse + */ + @JsonAnySetter + public CustomRulesetResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CustomRulesetResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRulesetResponse customRulesetResponse = (CustomRulesetResponse) o; + return Objects.equals(this.data, customRulesetResponse.data) + && Objects.equals(this.additionalProperties, customRulesetResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRulesetResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/Language.java b/src/main/java/com/datadog/api/client/v2/model/Language.java new file mode 100644 index 00000000000..9bc4cf22973 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/Language.java @@ -0,0 +1,76 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Programming language */ +@JsonSerialize(using = Language.LanguageSerializer.class) +public class Language extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "PYTHON", + "JAVASCRIPT", + "TYPESCRIPT", + "JAVA", + "GO", + "YAML", + "RUBY", + "CSHARP", + "PHP", + "KOTLIN", + "SWIFT")); + + public static final Language PYTHON = new Language("PYTHON"); + public static final Language JAVASCRIPT = new Language("JAVASCRIPT"); + public static final Language TYPESCRIPT = new Language("TYPESCRIPT"); + public static final Language JAVA = new Language("JAVA"); + public static final Language GO = new Language("GO"); + public static final Language YAML = new Language("YAML"); + public static final Language RUBY = new Language("RUBY"); + public static final Language CSHARP = new Language("CSHARP"); + public static final Language PHP = new Language("PHP"); + public static final Language KOTLIN = new Language("KOTLIN"); + public static final Language SWIFT = new Language("SWIFT"); + + Language(String value) { + super(value, allowedValues); + } + + public static class LanguageSerializer extends StdSerializer { + public LanguageSerializer(Class t) { + super(t); + } + + public LanguageSerializer() { + this(null); + } + + @Override + public void serialize(Language value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static Language fromValue(String value) { + return new Language(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionDataType.java b/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionDataType.java new file mode 100644 index 00000000000..e220beced9a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionDataType.java @@ -0,0 +1,58 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Request type */ +@JsonSerialize( + using = RevertCustomRuleRevisionDataType.RevertCustomRuleRevisionDataTypeSerializer.class) +public class RevertCustomRuleRevisionDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("revert_custom_rule_revision_request")); + + public static final RevertCustomRuleRevisionDataType REVERT_CUSTOM_RULE_REVISION_REQUEST = + new RevertCustomRuleRevisionDataType("revert_custom_rule_revision_request"); + + RevertCustomRuleRevisionDataType(String value) { + super(value, allowedValues); + } + + public static class RevertCustomRuleRevisionDataTypeSerializer + extends StdSerializer { + public RevertCustomRuleRevisionDataTypeSerializer(Class t) { + super(t); + } + + public RevertCustomRuleRevisionDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + RevertCustomRuleRevisionDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RevertCustomRuleRevisionDataType fromValue(String value) { + return new RevertCustomRuleRevisionDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionRequest.java b/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionRequest.java new file mode 100644 index 00000000000..773473cbaaa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionRequest.java @@ -0,0 +1,138 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({RevertCustomRuleRevisionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RevertCustomRuleRevisionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RevertCustomRuleRevisionRequestData data; + + public RevertCustomRuleRevisionRequest data(RevertCustomRuleRevisionRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RevertCustomRuleRevisionRequestData getData() { + return data; + } + + public void setData(RevertCustomRuleRevisionRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RevertCustomRuleRevisionRequest + */ + @JsonAnySetter + public RevertCustomRuleRevisionRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RevertCustomRuleRevisionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RevertCustomRuleRevisionRequest revertCustomRuleRevisionRequest = + (RevertCustomRuleRevisionRequest) o; + return Objects.equals(this.data, revertCustomRuleRevisionRequest.data) + && Objects.equals( + this.additionalProperties, revertCustomRuleRevisionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RevertCustomRuleRevisionRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionRequestData.java b/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionRequestData.java new file mode 100644 index 00000000000..9797a665500 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionRequestData.java @@ -0,0 +1,199 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + RevertCustomRuleRevisionRequestData.JSON_PROPERTY_ATTRIBUTES, + RevertCustomRuleRevisionRequestData.JSON_PROPERTY_ID, + RevertCustomRuleRevisionRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RevertCustomRuleRevisionRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RevertCustomRuleRevisionRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private RevertCustomRuleRevisionDataType type; + + public RevertCustomRuleRevisionRequestData attributes( + RevertCustomRuleRevisionRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Getattributes + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RevertCustomRuleRevisionRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RevertCustomRuleRevisionRequestDataAttributes attributes) { + this.attributes = attributes; + } + + public RevertCustomRuleRevisionRequestData id(String id) { + this.id = id; + return this; + } + + /** + * Request identifier + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public RevertCustomRuleRevisionRequestData type(RevertCustomRuleRevisionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Request type + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RevertCustomRuleRevisionDataType getType() { + return type; + } + + public void setType(RevertCustomRuleRevisionDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RevertCustomRuleRevisionRequestData + */ + @JsonAnySetter + public RevertCustomRuleRevisionRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RevertCustomRuleRevisionRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RevertCustomRuleRevisionRequestData revertCustomRuleRevisionRequestData = + (RevertCustomRuleRevisionRequestData) o; + return Objects.equals(this.attributes, revertCustomRuleRevisionRequestData.attributes) + && Objects.equals(this.id, revertCustomRuleRevisionRequestData.id) + && Objects.equals(this.type, revertCustomRuleRevisionRequestData.type) + && Objects.equals( + this.additionalProperties, revertCustomRuleRevisionRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RevertCustomRuleRevisionRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionRequestDataAttributes.java new file mode 100644 index 00000000000..86d8756681d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RevertCustomRuleRevisionRequestDataAttributes.java @@ -0,0 +1,170 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + RevertCustomRuleRevisionRequestDataAttributes.JSON_PROPERTY_CURRENT_REVISION, + RevertCustomRuleRevisionRequestDataAttributes.JSON_PROPERTY_REVERT_TO_REVISION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RevertCustomRuleRevisionRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CURRENT_REVISION = "currentRevision"; + private String currentRevision; + + public static final String JSON_PROPERTY_REVERT_TO_REVISION = "revertToRevision"; + private String revertToRevision; + + public RevertCustomRuleRevisionRequestDataAttributes currentRevision(String currentRevision) { + this.currentRevision = currentRevision; + return this; + } + + /** + * Current revision ID + * + * @return currentRevision + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CURRENT_REVISION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCurrentRevision() { + return currentRevision; + } + + public void setCurrentRevision(String currentRevision) { + this.currentRevision = currentRevision; + } + + public RevertCustomRuleRevisionRequestDataAttributes revertToRevision(String revertToRevision) { + this.revertToRevision = revertToRevision; + return this; + } + + /** + * Target revision ID to revert to + * + * @return revertToRevision + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REVERT_TO_REVISION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRevertToRevision() { + return revertToRevision; + } + + public void setRevertToRevision(String revertToRevision) { + this.revertToRevision = revertToRevision; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RevertCustomRuleRevisionRequestDataAttributes + */ + @JsonAnySetter + public RevertCustomRuleRevisionRequestDataAttributes putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RevertCustomRuleRevisionRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RevertCustomRuleRevisionRequestDataAttributes revertCustomRuleRevisionRequestDataAttributes = + (RevertCustomRuleRevisionRequestDataAttributes) o; + return Objects.equals( + this.currentRevision, revertCustomRuleRevisionRequestDataAttributes.currentRevision) + && Objects.equals( + this.revertToRevision, revertCustomRuleRevisionRequestDataAttributes.revertToRevision) + && Objects.equals( + this.additionalProperties, + revertCustomRuleRevisionRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(currentRevision, revertToRevision, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RevertCustomRuleRevisionRequestDataAttributes {\n"); + sb.append(" currentRevision: ").append(toIndentedString(currentRevision)).append("\n"); + sb.append(" revertToRevision: ").append(toIndentedString(revertToRevision)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature b/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature index 85bf4d83ae1..1e82ab45b2e 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature @@ -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", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "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", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "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", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 661482db869..0e8c10237db 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -4520,6 +4520,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": {