diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3bd4dc4902d..5ee8d544efd 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3603,6 +3603,729 @@ components: - id - base_severity type: object + AiCustomRuleDataType: + description: AI custom rule resource type. + enum: [ai_rule] + example: ai_rule + type: string + x-enum-varnames: + - AI_RULE + AiCustomRuleItem: + description: An AI custom rule embedded within a ruleset response. + properties: + created_at: + description: The creation timestamp. + example: "2024-01-01T00:00:00+00:00" + format: date-time + type: string + created_by: + description: The identifier of the user who created the rule. + example: example-handle + type: string + last_revision: + $ref: "#/components/schemas/AiCustomRuleRevisionResponseAttributes" + description: The most recent revision of the rule. + nullable: true + name: + description: The rule name. + example: my-ai-rule + type: string + required: + - name + - created_at + - created_by + - last_revision + type: object + AiCustomRuleRequest: + description: Request body for creating an AI custom rule. + properties: + data: + $ref: "#/components/schemas/AiCustomRuleRequestData" + type: object + AiCustomRuleRequestAttributes: + description: Attributes for creating an AI custom rule. + properties: + name: + description: The rule name. + example: my-ai-rule + type: string + type: object + AiCustomRuleRequestData: + description: Request data for creating an AI custom rule. + properties: + attributes: + $ref: "#/components/schemas/AiCustomRuleRequestAttributes" + id: + description: The rule identifier, which must match the name. + example: my-ai-rule + type: string + type: + $ref: "#/components/schemas/AiCustomRuleDataType" + type: object + AiCustomRuleResponse: + description: Response containing a single AI custom rule. + properties: + data: + $ref: "#/components/schemas/AiCustomRuleResponseData" + required: + - data + type: object + AiCustomRuleResponseData: + description: Response data for an AI custom rule. + properties: + attributes: + $ref: "#/components/schemas/AiCustomRuleItem" + id: + description: The rule identifier. + example: my-ai-rule + type: string + type: + $ref: "#/components/schemas/AiCustomRuleDataType" + required: + - id + - type + - attributes + type: object + AiCustomRuleRevisionDataType: + description: AI custom rule revision resource type. + enum: [ai_rule_revision] + example: ai_rule_revision + type: string + x-enum-varnames: + - AI_RULE_REVISION + AiCustomRuleRevisionExecutionMode: + description: The execution mode for an AI rule revision. + enum: [auto, manual, always] + example: auto + type: string + x-enum-varnames: + - AUTO + - MANUAL + - ALWAYS + AiCustomRuleRevisionRequest: + description: Request body for creating an AI custom rule revision. + properties: + data: + $ref: "#/components/schemas/AiCustomRuleRevisionRequestData" + type: object + AiCustomRuleRevisionRequestAttributes: + description: Attributes for creating an AI custom rule revision. + properties: + category: + $ref: "#/components/schemas/CustomRuleRevisionAttributesCategory" + content: + description: Base64-encoded AI model content for this revision. + example: Content + type: string + cwe: + description: The associated CWE identifier. + example: "79" + nullable: true + type: string + description: + description: Base64-encoded full description. + example: Ruleset description + type: string + directories: + description: Directory patterns this rule applies to. + example: [] + items: + type: string + type: array + execution_mode: + $ref: "#/components/schemas/AiCustomRuleRevisionExecutionMode" + globs: + description: File glob patterns this rule applies to. + example: + - "**/*.py" + items: + type: string + type: array + is_published: + description: Whether this revision is published. + example: false + type: boolean + is_testing: + description: Whether this revision is for testing only. + example: false + type: boolean + severity: + $ref: "#/components/schemas/CustomRuleRevisionAttributesSeverity" + short_description: + description: Base64-encoded short description. + example: Ruleset short description + type: string + version_id: + description: The version identifier for this revision. + example: 1 + format: int64 + type: integer + required: + - short_description + - description + - content + - globs + - directories + - execution_mode + - severity + - category + - is_published + - is_testing + type: object + AiCustomRuleRevisionRequestData: + description: Request data for creating an AI custom rule revision. + properties: + attributes: + $ref: "#/components/schemas/AiCustomRuleRevisionRequestAttributes" + id: + description: The revision identifier. + example: revision-abc-123 + type: string + type: + $ref: "#/components/schemas/AiCustomRuleRevisionDataType" + type: object + AiCustomRuleRevisionResponse: + description: Response containing a single AI custom rule revision. + properties: + data: + $ref: "#/components/schemas/AiCustomRuleRevisionResponseData" + required: + - data + type: object + AiCustomRuleRevisionResponseAttributes: + description: Response attributes of an AI custom rule revision. + properties: + category: + $ref: "#/components/schemas/CustomRuleRevisionAttributesCategory" + checksum: + description: Checksum of the revision content. + example: abc123def456 + type: string + content: + description: Base64-encoded AI model content for this revision. + example: Content + type: string + created_at: + description: The creation timestamp. + example: "2024-01-01T00:00:00+00:00" + format: date-time + type: string + created_by: + description: The identifier of the user who created the revision. + example: example-handle + type: string + cwe: + description: The associated CWE identifier. + example: "79" + nullable: true + type: string + description: + description: Base64-encoded full description. + example: Ruleset description + type: string + directories: + description: Directory patterns this rule applies to. + example: [] + items: + type: string + type: array + execution_mode: + $ref: "#/components/schemas/AiCustomRuleRevisionExecutionMode" + globs: + description: File glob patterns this rule applies to. + example: + - "**/*.py" + items: + type: string + type: array + is_default: + description: Whether this is a default Datadog rule. + example: false + type: boolean + is_published: + description: Whether this revision is published. + example: false + type: boolean + is_testing: + description: Whether this revision is for testing only. + example: false + type: boolean + severity: + $ref: "#/components/schemas/CustomRuleRevisionAttributesSeverity" + short_description: + description: Base64-encoded short description. + example: Ruleset short description + type: string + version_id: + description: The version identifier for this revision. + example: 1 + format: int64 + type: integer + required: + - version_id + - short_description + - description + - content + - globs + - directories + - execution_mode + - cwe + - checksum + - created_at + - created_by + - severity + - category + - is_published + - is_testing + - is_default + type: object + AiCustomRuleRevisionResponseData: + description: Response data for an AI custom rule revision. + properties: + attributes: + $ref: "#/components/schemas/AiCustomRuleRevisionResponseAttributes" + id: + description: The revision identifier. + example: revision-abc-123 + type: string + type: + $ref: "#/components/schemas/AiCustomRuleRevisionDataType" + required: + - id + - type + - attributes + type: object + AiCustomRuleRevisionsResponse: + description: Response containing a list of AI custom rule revisions. + properties: + data: + description: The list of AI custom rule revisions. + items: + $ref: "#/components/schemas/AiCustomRuleRevisionResponseData" + type: array + required: + - data + type: object + AiCustomRulesetDataType: + description: AI custom ruleset resource type. + enum: [ai_ruleset] + example: ai_ruleset + type: string + x-enum-varnames: + - AI_RULESET + AiCustomRulesetRequest: + description: Request body for creating an AI custom ruleset. + properties: + data: + $ref: "#/components/schemas/AiCustomRulesetRequestData" + type: object + AiCustomRulesetRequestAttributes: + description: Attributes for creating an AI custom ruleset. + properties: + description: + description: Base64-encoded full description of the ruleset. + example: Ruleset description + type: string + name: + description: The ruleset name. + example: my-ai-ruleset + type: string + short_description: + description: Base64-encoded short description of the ruleset. + example: Ruleset short description + type: string + required: + - name + - short_description + - description + type: object + AiCustomRulesetRequestData: + description: Request data for creating an AI custom ruleset. + properties: + attributes: + $ref: "#/components/schemas/AiCustomRulesetRequestAttributes" + id: + description: The ruleset identifier, which must match the name. + example: my-ai-ruleset + type: string + type: + $ref: "#/components/schemas/AiCustomRulesetDataType" + type: object + AiCustomRulesetResponse: + description: Response containing a single AI custom ruleset. + properties: + data: + $ref: "#/components/schemas/AiCustomRulesetResponseData" + required: + - data + type: object + AiCustomRulesetResponseAttributes: + description: Response attributes of an AI custom ruleset. + properties: + created_at: + description: The creation timestamp. + example: "2024-01-01T00:00:00+00:00" + format: date-time + type: string + created_by: + description: The identifier of the user who created the ruleset. + example: example-handle + type: string + description: + description: Base64-encoded full description of the ruleset. + example: Ruleset description + type: string + name: + description: The ruleset name. + example: my-ai-ruleset + type: string + rules: + description: The rules contained in the ruleset. + items: + $ref: "#/components/schemas/AiCustomRuleItem" + nullable: true + type: array + short_description: + description: Base64-encoded short description of the ruleset. + example: Ruleset short description + type: string + required: + - name + - short_description + - description + - created_at + - created_by + - rules + type: object + AiCustomRulesetResponseData: + description: Response data for an AI custom ruleset. + properties: + attributes: + $ref: "#/components/schemas/AiCustomRulesetResponseAttributes" + id: + description: The ruleset identifier. + example: my-ai-ruleset + type: string + type: + $ref: "#/components/schemas/AiCustomRulesetDataType" + required: + - id + - type + - attributes + type: object + AiCustomRulesetUpdateAttributes: + description: Attributes for updating an AI custom ruleset. + properties: + description: + description: Base64-encoded full description of the ruleset. + example: Ruleset description + type: string + name: + description: The ruleset name. + example: my-ai-ruleset + type: string + short_description: + description: Base64-encoded short description of the ruleset. + example: Ruleset short description + type: string + type: object + AiCustomRulesetUpdateData: + description: Request data for updating an AI custom ruleset. + properties: + attributes: + $ref: "#/components/schemas/AiCustomRulesetUpdateAttributes" + id: + description: The ruleset identifier. + example: my-ai-ruleset + type: string + type: + $ref: "#/components/schemas/AiCustomRulesetDataType" + type: object + AiCustomRulesetUpdateRequest: + description: Request body for updating an AI custom ruleset. + properties: + data: + $ref: "#/components/schemas/AiCustomRulesetUpdateData" + type: object + AiCustomRulesetsResponse: + description: Response containing a list of AI custom rulesets. + properties: + data: + description: The list of AI custom rulesets. + items: + $ref: "#/components/schemas/AiCustomRulesetResponseData" + type: array + required: + - data + type: object + AiMemoryViolationResultDataType: + description: AI memory violation result resource type. + enum: [ai_memory_violation_result] + example: ai_memory_violation_result + type: string + x-enum-varnames: + - AI_MEMORY_VIOLATION_RESULT + AiMemoryViolationResultRequest: + description: Request body for creating an AI memory violation result. + properties: + data: + $ref: "#/components/schemas/AiMemoryViolationResultRequestData" + type: object + AiMemoryViolationResultRequestAttributes: + description: Attributes for creating an AI memory violation result. + properties: + line: + description: The line number where the violation was found. + example: 10 + format: int64 + type: integer + message: + description: A message explaining the violation result. + example: This is a false positive because the input is sanitized. + type: string + name: + description: The file path where the violation was found. + example: src/main.py + type: string + repository_id: + description: The repository identifier. + example: my-repo + type: string + rule: + description: The rule identifier in the format ruleset/rule. + example: my-ai-ruleset/my-ai-rule + type: string + sha: + description: The git commit SHA where the violation was found. + example: abc123def456789012345678901234567890abcd + type: string + type: + $ref: "#/components/schemas/AiMemoryViolationType" + required: + - rule + - repository_id + - sha + - name + - line + - type + - message + type: object + AiMemoryViolationResultRequestData: + description: Request data for creating an AI memory violation result. + properties: + attributes: + $ref: "#/components/schemas/AiMemoryViolationResultRequestAttributes" + id: + description: The violation result identifier. + example: violation-abc + type: string + type: + $ref: "#/components/schemas/AiMemoryViolationResultDataType" + type: object + AiMemoryViolationResultResponseAttributes: + description: Response attributes of an AI memory violation result. + properties: + created_at: + description: The creation timestamp. + example: "2024-01-01T00:00:00+00:00" + format: date-time + type: string + created_by: + description: The identifier of the user who created the result. + example: example-handle + type: string + line: + description: The line number where the violation was found. + example: 10 + format: int64 + type: integer + message: + description: A message explaining the violation result. + example: This is a false positive because the input is sanitized. + type: string + name: + description: The file path where the violation was found. + example: src/main.py + type: string + repository_id: + description: The repository identifier. + example: my-repo + type: string + rule: + description: The rule identifier in the format ruleset/rule. + example: my-ai-ruleset/my-ai-rule + type: string + sha: + description: The git commit SHA where the violation was found. + example: abc123def456789012345678901234567890abcd + type: string + type: + $ref: "#/components/schemas/AiMemoryViolationType" + required: + - rule + - repository_id + - sha + - name + - line + - created_at + - created_by + - type + - message + type: object + AiMemoryViolationResultResponseData: + description: Response data for an AI memory violation result. + properties: + attributes: + $ref: "#/components/schemas/AiMemoryViolationResultResponseAttributes" + id: + description: The numeric identifier of the violation result. + example: "42" + type: string + type: + $ref: "#/components/schemas/AiMemoryViolationResultDataType" + required: + - id + - type + - attributes + type: object + AiMemoryViolationResultsResponse: + description: Response containing a list of AI memory violation results. + properties: + data: + description: The list of AI memory violation results. + items: + $ref: "#/components/schemas/AiMemoryViolationResultResponseData" + type: array + required: + - data + type: object + AiMemoryViolationType: + description: The type of AI memory violation result indicating whether it is a true positive or false positive. + enum: [TP, FP] + example: FP + type: string + x-enum-varnames: + - TP + - FP + AiPromptDataType: + description: AI prompt resource type. + enum: [ai_prompt] + example: ai_prompt + type: string + x-enum-varnames: + - AI_PROMPT + AiPromptResponseAttributes: + description: Response attributes of an AI prompt. + properties: + category: + $ref: "#/components/schemas/CustomRuleRevisionAttributesCategory" + checksum: + description: Checksum of the prompt content. + example: abc123 + type: string + content: + description: Base64-encoded AI prompt content. + example: Content + type: string + cwe: + description: The CWE identifier associated with this prompt. + example: "79" + type: string + description: + description: Base64-encoded full description. + example: Ruleset description + type: string + directories: + description: Directory patterns this prompt applies to. + example: [] + items: + type: string + type: array + execution_mode: + $ref: "#/components/schemas/AiCustomRuleRevisionExecutionMode" + file_search_keywords: + description: Keywords used to search for relevant files. + example: + - import + items: + type: string + type: array + globs: + description: File glob patterns this prompt applies to. + example: + - "**/*.py" + items: + type: string + type: array + is_default: + description: Whether this is a default Datadog prompt. + example: false + type: boolean + is_testing: + description: Whether this prompt is for testing only. + example: false + type: boolean + language: + $ref: "#/components/schemas/Language" + result_keywords_exclude: + description: Keywords to exclude from results. + example: [] + items: + type: string + type: array + rule_version: + description: The version of the rule this prompt is associated with. + example: "1" + type: string + severity: + $ref: "#/components/schemas/CustomRuleRevisionAttributesSeverity" + short_description: + description: Base64-encoded short description. + example: Ruleset short description + type: string + required: + - rule_version + - globs + - short_description + - description + - severity + - category + - file_search_keywords + - result_keywords_exclude + - content + - checksum + - execution_mode + - directories + - is_testing + - is_default + type: object + AiPromptResponseData: + description: Response data for an AI prompt. + properties: + attributes: + $ref: "#/components/schemas/AiPromptResponseAttributes" + id: + description: The prompt identifier. + example: my-ai-ruleset/my-ai-rule + type: string + type: + $ref: "#/components/schemas/AiPromptDataType" + required: + - id + - type + - attributes + type: object + AiPromptsResponse: + description: Response containing a list of AI prompts. + properties: + data: + description: The list of AI prompts. + items: + $ref: "#/components/schemas/AiPromptResponseData" + type: array + required: + - data + type: object AlertEventAttributes: description: Alert event attributes. properties: @@ -4114,6 +4837,312 @@ components: x-enum-varnames: - FEATURE_GATE - CANARY + AnalysisEdit: + description: A single edit operation within a fix suggestion for a rule violation. + properties: + content: + description: The content to insert or replace at the specified position, if applicable. + example: "safe_alternative()" + nullable: true + type: string + edit_type: + $ref: "#/components/schemas/AnalysisEditType" + end: + $ref: "#/components/schemas/AnalysisPosition" + description: The end position of the edit, or null for pure insertions. + nullable: true + start: + $ref: "#/components/schemas/AnalysisPosition" + required: + - start + - end + - edit_type + - content + type: object + AnalysisEditType: + default: ADD + description: The type of code edit to apply when fixing a violation. + enum: + - ADD + - UPDATE + - REMOVE + example: ADD + type: string + x-enum-varnames: + - ADD + - UPDATE + - REMOVE + AnalysisFix: + description: A fix suggestion for a rule violation, consisting of one or more edit operations. + properties: + description: + description: A human-readable description of what the fix does. + example: Replace with a safe alternative. + type: string + edits: + description: The list of edit operations that constitute the fix. + items: + $ref: "#/components/schemas/AnalysisEdit" + type: array + required: + - description + - edits + type: object + AnalysisPosition: + description: A position in source code, identified by line and column numbers. + properties: + col: + description: The column number in the source file (1-based). + example: 5 + format: int64 + type: integer + line: + description: The line number in the source file (1-based). + example: 10 + format: int64 + type: integer + required: + - line + - col + type: object + AnalysisRequest: + description: The request payload for running static analysis on source code. + properties: + data: + $ref: "#/components/schemas/AnalysisRequestData" + required: + - data + type: object + AnalysisRequestData: + description: The primary data object in the analysis request. + properties: + attributes: + $ref: "#/components/schemas/AnalysisRequestDataAttributes" + id: + description: An optional identifier for the analysis request resource. + type: string + type: + $ref: "#/components/schemas/AnalysisRequestDataType" + required: + - type + - attributes + type: object + AnalysisRequestDataAttributes: + description: The attributes of the analysis request, containing the source code and rules to apply. + properties: + code: + description: The base64-encoded source code to analyze. + example: aW1wb3J0IHN5cw== + type: string + file_encoding: + description: The encoding of the source code file (must be `utf-8`). + example: utf-8 + type: string + filename: + description: The name of the file being analyzed. + example: test.py + type: string + language: + description: The programming language of the source code. + example: python + type: string + rules: + description: The list of static analysis rules to apply during analysis. + items: + $ref: "#/components/schemas/AnalysisRequestRule" + type: array + required: + - code + - file_encoding + - filename + - language + - rules + type: object + AnalysisRequestDataType: + default: analysis_request + description: Analysis request resource type. + enum: + - analysis_request + example: analysis_request + type: string + x-enum-varnames: + - ANALYSIS_REQUEST + AnalysisRequestRule: + description: A static analysis rule to apply during code analysis. + properties: + category: + description: The category of the rule (for example, `BEST_PRACTICES`, `SECURITY`). + example: BEST_PRACTICES + type: string + checksum: + description: A checksum of the rule definition. + example: abc123def456 + type: string + code: + description: The base64-encoded rule implementation code. + example: ZnVuY3Rpb24gdmlzaXQobm9kZSkge30= + type: string + entity_checked: + description: The code entity type checked by the rule, applicable when rule type is `AST_CHECK`. + nullable: true + type: string + id: + description: The unique identifier of the rule. + example: python-best-practices/no-exit + type: string + language: + description: The programming language this rule targets. + example: python + type: string + regex: + description: A base64-encoded regex pattern used by the rule, applicable when rule type is `REGEX`. + nullable: true + type: string + severity: + description: The severity of findings from this rule (for example, `ERROR`, `WARNING`). + example: WARNING + type: string + tree_sitter_query: + description: The base64-encoded tree-sitter query used by the rule. + example: KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA== + type: string + type: + description: The rule type indicating the detection mechanism (for example, `TREE_SITTER_QUERY`). + example: TREE_SITTER_QUERY + type: string + required: + - id + - category + - checksum + - language + - severity + - tree_sitter_query + - type + - code + type: object + AnalysisResponse: + description: The response payload from running static analysis on source code. + properties: + data: + $ref: "#/components/schemas/AnalysisResponseData" + required: + - data + type: object + AnalysisResponseData: + description: The primary data object in the analysis response. + properties: + attributes: + $ref: "#/components/schemas/AnalysisResponseDataAttributes" + id: + description: The unique identifier of the analysis response resource. + example: abc-123 + type: string + type: + $ref: "#/components/schemas/AnalysisResponseDataType" + required: + - id + - type + - attributes + type: object + AnalysisResponseDataAttributes: + description: The attributes of the analysis response, containing rule results and any top-level errors. + properties: + errors: + description: Top-level error messages encountered during the analysis operation. + example: [] + items: + type: string + type: array + rule_responses: + description: The list of results for each static analysis rule applied during analysis. + items: + $ref: "#/components/schemas/AnalysisRuleResponse" + type: array + required: + - rule_responses + - errors + type: object + AnalysisResponseDataType: + default: server_request + description: Analysis response resource type. + enum: + - server_request + example: server_request + type: string + x-enum-varnames: + - SERVER_REQUEST + AnalysisRuleResponse: + description: The result of applying a single static analysis rule to the analyzed source code. + properties: + errors: + description: A list of error messages encountered while executing the rule. + example: [] + items: + type: string + type: array + execution_error: + description: An error message if the rule execution failed, or null if execution succeeded. + example: + nullable: true + type: string + execution_time_ms: + description: The time taken to execute the rule, in milliseconds. + example: 42 + format: int64 + type: integer + identifier: + description: The identifier of the rule that produced this response. + example: python-best-practices/no-exit + type: string + output: + description: The raw output produced by the rule engine during execution. + example: "" + type: string + violations: + description: The list of violations found by this rule. + items: + $ref: "#/components/schemas/AnalysisViolation" + type: array + required: + - errors + - execution_error + - execution_time_ms + - identifier + - output + - violations + type: object + AnalysisViolation: + description: A rule violation found in the analyzed source code. + properties: + category: + description: The category of the violation. + example: BEST_PRACTICES + type: string + end: + $ref: "#/components/schemas/AnalysisPosition" + fixes: + description: The list of suggested fixes for this violation. + items: + $ref: "#/components/schemas/AnalysisFix" + type: array + message: + description: A human-readable description of the violation. + example: Use of sys.exit() is discouraged. + type: string + severity: + description: The severity level of the violation. + example: WARNING + type: string + start: + $ref: "#/components/schemas/AnalysisPosition" + required: + - category + - severity + - message + - start + - end + - fixes + type: object Annotation: description: "A list of annotations used in the workflow. These are like sticky notes for your workflow!" properties: @@ -23312,6 +24341,17 @@ components: type: string x-enum-varnames: - CUSTOM_RULESET + CustomRulesetListResponse: + description: Response containing a list of custom rulesets for the authenticated organization. + properties: + data: + description: The list of custom rulesets. + items: + $ref: "#/components/schemas/CustomRuleset" + type: array + required: + - data + type: object CustomRulesetRequest: description: Request body for creating or updating a custom ruleset. properties: @@ -25030,6 +26070,52 @@ components: example: 1722439510282 format: int64 type: integer + DefaultRulesetsPerLanguageData: + description: The primary data object in the default rulesets per language response. + properties: + attributes: + $ref: "#/components/schemas/DefaultRulesetsPerLanguageDataAttributes" + id: + description: The language identifier used as the resource identifier. + example: python + type: string + type: + $ref: "#/components/schemas/DefaultRulesetsPerLanguageDataType" + required: + - id + - type + - attributes + type: object + DefaultRulesetsPerLanguageDataAttributes: + description: The attributes of the default rulesets per language response, containing the list of default ruleset names. + properties: + rulesets: + description: The list of default ruleset names for the specified programming language. + example: + - python-best-practices + items: + type: string + type: array + required: + - rulesets + type: object + DefaultRulesetsPerLanguageDataType: + default: defaultRulesetsPerLanguage + description: Default rulesets per language resource type. + enum: + - defaultRulesetsPerLanguage + example: defaultRulesetsPerLanguage + type: string + x-enum-varnames: + - DEFAULT_RULESETS_PER_LANGUAGE + DefaultRulesetsPerLanguageResponse: + description: The response payload containing the default ruleset names for a programming language. + properties: + data: + $ref: "#/components/schemas/DefaultRulesetsPerLanguageData" + required: + - data + type: object Degradation: description: Response object for a single degradation. properties: @@ -34198,6 +35284,98 @@ components: type: string type: array type: object + GetAstRequest: + description: The request payload for parsing source code into an abstract syntax tree. + properties: + data: + $ref: "#/components/schemas/GetAstRequestData" + required: + - data + type: object + GetAstRequestData: + description: The primary data object in the get-AST request. + properties: + attributes: + $ref: "#/components/schemas/GetAstRequestDataAttributes" + id: + description: An optional identifier for the get-AST request resource. + type: string + type: + $ref: "#/components/schemas/GetAstRequestDataType" + required: + - type + - attributes + type: object + GetAstRequestDataAttributes: + description: The attributes of the get-AST request, containing the source code to parse. + properties: + code: + description: The base64-encoded source code to parse into an abstract syntax tree. + example: aW1wb3J0IHN5cw== + type: string + file_encoding: + description: The encoding of the source code file (must be utf-8). + example: utf-8 + type: string + language: + description: The programming language of the source code to parse. + example: python + type: string + required: + - code + - file_encoding + - language + type: object + GetAstRequestDataType: + default: get_ast_request + description: Get AST request resource type. + enum: + - get_ast_request + example: get_ast_request + type: string + x-enum-varnames: + - GET_AST_REQUEST + GetAstResponse: + description: The response payload containing the parsed abstract syntax tree. + properties: + data: + $ref: "#/components/schemas/GetAstResponseData" + required: + - data + type: object + GetAstResponseData: + description: The primary data object in the get-AST response. + properties: + attributes: + $ref: "#/components/schemas/GetAstResponseDataAttributes" + id: + description: The identifier of the get-AST response resource. + type: string + type: + $ref: "#/components/schemas/GetAstResponseDataType" + required: + - type + - attributes + type: object + GetAstResponseDataAttributes: + description: The attributes of the get-AST response, containing the parsed abstract syntax tree. + properties: + ast: + additionalProperties: {} + description: The parsed abstract syntax tree as a JSON object. + type: object + required: + - ast + type: object + GetAstResponseDataType: + default: get_ast_response + description: Get AST response resource type. + enum: + - get_ast_response + example: get_ast_response + type: string + x-enum-varnames: + - GET_AST_RESPONSE GetBlueprintResponse: description: The response for retrieving a single blueprint. properties: @@ -52644,6 +53822,54 @@ components: - type - id type: object + NodeType: + additionalProperties: {} + description: A tree-sitter node type definition for a given language, describing the node's structure, subtypes, and fields. + type: object + NodeTypesResponse: + description: The response payload containing tree-sitter node type definitions for a programming language. + properties: + data: + $ref: "#/components/schemas/NodeTypesResponseData" + required: + - data + type: object + NodeTypesResponseData: + description: The primary data object in the node types response. + properties: + attributes: + $ref: "#/components/schemas/NodeTypesResponseDataAttributes" + id: + description: The unique identifier of the node types response resource. + example: python + type: string + type: + $ref: "#/components/schemas/NodeTypesResponseDataType" + required: + - id + - type + - attributes + type: object + NodeTypesResponseDataAttributes: + description: The attributes of the node types response, containing the list of node type definitions for the requested language. + properties: + node_types: + description: The list of tree-sitter node type definitions for the language. + items: + $ref: "#/components/schemas/NodeType" + type: array + required: + - node_types + type: object + NodeTypesResponseDataType: + default: get_node_types_response + description: Get node types response resource type. + enum: + - get_node_types_response + example: get_node_types_response + type: string + x-enum-varnames: + - GET_NODE_TYPES_RESPONSE NotebookCreateData: description: Notebook creation data properties: @@ -69362,6 +70588,67 @@ components: x-enum-varnames: - ACTIVE - ALL + SastRulesetData: + description: The primary data object representing a SAST ruleset. + properties: + attributes: + $ref: "#/components/schemas/SastRulesetDataAttributes" + id: + description: The unique identifier of the ruleset resource. + example: python-best-practices + type: string + type: + $ref: "#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType" + required: + - id + - type + - attributes + type: object + SastRulesetDataAttributes: + description: The attributes of a SAST ruleset, including its name, description, and rules. + properties: + description: + description: A detailed description of the ruleset's purpose and the types of issues it targets. + example: A collection of Python best practice rules. + type: string + name: + description: The unique name of the ruleset. + example: python-best-practices + type: string + rules: + description: The list of static analysis rules included in this ruleset. + items: + $ref: "#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems" + type: array + short_description: + description: A brief summary of the ruleset, suitable for display in listings. + example: Python best practices ruleset. + type: string + required: + - name + - short_description + - description + - rules + type: object + SastRulesetResponse: + description: The response payload containing a single SAST ruleset and its rules. + properties: + data: + $ref: "#/components/schemas/SastRulesetData" + required: + - data + type: object + SastRulesetsResponse: + description: The response payload containing a list of SAST rulesets and their rules. + properties: + data: + description: The list of SAST rulesets returned in the response. + items: + $ref: "#/components/schemas/SastRulesetData" + type: array + required: + - data + type: object ScaRequest: description: The top-level request object for submitting a Software Composition Analysis (SCA) scan result. properties: @@ -152934,6 +154221,1162 @@ paths: tags: - Static Analysis x-unstable: "**Note**: This endpoint may be subject to changes." + /api/v2/static-analysis/ai/memory: + get: + description: Get all AI memory violation results for the authenticated organization. + operationId: ListAiMemoryViolationResults + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + line: 10 + message: This is a false positive. + name: src/main.py + repository_id: my-repo + rule: my-ai-ruleset/my-ai-rule + sha: abc123def456789012345678901234567890abcd + type: FP + id: "42" + type: ai_memory_violation_result + schema: + $ref: "#/components/schemas/AiMemoryViolationResultsResponse" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: List AI memory violation results + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Add a new AI memory violation result for the authenticated organization. + operationId: CreateAiMemoryViolationResult + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + line: 10 + message: This is a false positive. + name: src/main.py + repository_id: my-repo + rule: my-ai-ruleset/my-ai-rule + sha: abc123def456789012345678901234567890abcd + type: FP + id: violation-abc + type: ai_memory_violation_result + schema: + $ref: "#/components/schemas/AiMemoryViolationResultRequest" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Create an AI memory violation result + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/ai/memory/{id}: + delete: + description: Delete an AI memory violation result by its numeric identifier. + operationId: DeleteAiMemoryViolationResult + parameters: + - description: The numeric identifier of the memory violation result. + in: path + name: id + required: true + schema: + example: "42" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Memory violation result not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Delete an AI memory violation result + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/ai/prompts: + get: + description: Get all AI prompts, including default prompts and custom AI rule prompts for the authenticated organization. + operationId: ListAiPrompts + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + category: SECURITY + checksum: abc123 + content: Ruleset content + cwe: "79" + description: Ruleset description + directories: [] + execution_mode: auto + file_search_keywords: [] + globs: + - "**/*.py" + is_default: false + is_testing: false + language: PYTHON + result_keywords_exclude: [] + rule_version: "1" + severity: ERROR + short_description: Ruleset short description + id: my-ai-ruleset/my-ai-rule + type: ai_prompt + schema: + $ref: "#/components/schemas/AiPromptsResponse" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: List AI prompts + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/ai/rulesets: + get: + description: Get all AI custom rulesets for the authenticated organization. + operationId: ListAiCustomRulesets + parameters: + - description: The offset for pagination. + in: query + name: page[offset] + required: false + schema: + default: 0 + format: int64 + type: integer + - description: The maximum number of rulesets to return. + in: query + name: page[limit] + required: false + schema: + default: 100 + format: int64 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + description: Ruleset description + name: my-ai-ruleset + rules: [] + short_description: Ruleset short description + id: my-ai-ruleset + type: ai_ruleset + schema: + $ref: "#/components/schemas/AiCustomRulesetsResponse" + description: Successful response + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: List AI custom rulesets + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create a new AI custom ruleset for the authenticated organization. + operationId: CreateAiCustomRuleset + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: Ruleset description + name: my-ai-ruleset + short_description: Ruleset short description + id: my-ai-ruleset + type: ai_ruleset + schema: + $ref: "#/components/schemas/AiCustomRulesetRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + description: Ruleset description + name: my-ai-ruleset + rules: [] + short_description: Ruleset short description + id: my-ai-ruleset + type: ai_ruleset + schema: + $ref: "#/components/schemas/AiCustomRulesetResponse" + 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 + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict - ruleset already exists + "412": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Precondition Failed - validation error + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Create an AI custom ruleset + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/ai/rulesets/{ruleset_name}: + delete: + description: Delete an AI custom ruleset by name. + operationId: DeleteAiCustomRuleset + parameters: + - description: The ruleset name. + in: path + name: ruleset_name + required: true + schema: + example: my-ai-ruleset + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Ruleset not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Delete an AI custom ruleset + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get an AI custom ruleset by name. + operationId: GetAiCustomRuleset + parameters: + - description: The ruleset name. + in: path + name: ruleset_name + required: true + schema: + example: my-ai-ruleset + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + description: Ruleset description + name: my-ai-ruleset + rules: [] + short_description: Ruleset short description + id: my-ai-ruleset + type: ai_ruleset + schema: + $ref: "#/components/schemas/AiCustomRulesetResponse" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Ruleset not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Get an AI custom ruleset + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: Update the description of an existing AI custom ruleset. + operationId: UpdateAiCustomRuleset + parameters: + - description: The ruleset name. + in: path + name: ruleset_name + required: true + schema: + example: my-ai-ruleset + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: Ruleset description + name: my-ai-ruleset + short_description: Ruleset short description + id: my-ai-ruleset + type: ai_ruleset + schema: + $ref: "#/components/schemas/AiCustomRulesetUpdateRequest" + required: true + responses: + "200": + 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 + "412": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Precondition Failed - validation error or ruleset not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Update an AI custom ruleset + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/ai/rulesets/{ruleset_name}/rules: + post: + description: Create a new AI custom rule within a ruleset. + operationId: CreateAiCustomRule + parameters: + - description: The ruleset name. + in: path + name: ruleset_name + required: true + schema: + example: my-ai-ruleset + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: my-ai-rule + type: ai_rule + schema: + $ref: "#/components/schemas/AiCustomRuleRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + last_revision: + name: my-ai-rule + id: my-ai-rule + type: ai_rule + schema: + $ref: "#/components/schemas/AiCustomRuleResponse" + 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 + "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" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Create an AI custom rule + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/ai/rulesets/{ruleset_name}/rules/{rule_name}: + delete: + description: Delete an AI custom rule by name within a ruleset. + operationId: DeleteAiCustomRule + parameters: + - description: The ruleset name. + in: path + name: ruleset_name + required: true + schema: + example: my-ai-ruleset + type: string + - description: The rule name. + in: path + name: rule_name + required: true + schema: + example: my-ai-rule + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Rule not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Delete an AI custom rule + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get an AI custom rule by name within a ruleset. + operationId: GetAiCustomRule + parameters: + - description: The ruleset name. + in: path + name: ruleset_name + required: true + schema: + example: my-ai-ruleset + type: string + - description: The rule name. + in: path + name: rule_name + required: true + schema: + example: my-ai-rule + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + last_revision: + name: my-ai-rule + id: my-ai-rule + type: ai_rule + schema: + $ref: "#/components/schemas/AiCustomRuleResponse" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Rule not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Get an AI custom rule + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/ai/rulesets/{ruleset_name}/rules/{rule_name}/revisions: + get: + description: Get all revisions for an AI custom rule. + operationId: ListAiCustomRuleRevisions + parameters: + - description: The ruleset name. + in: path + name: ruleset_name + required: true + schema: + example: my-ai-ruleset + type: string + - description: The rule name. + in: path + name: rule_name + required: true + schema: + example: my-ai-rule + type: string + - description: The offset for pagination. + in: query + name: page[offset] + required: false + schema: + default: 0 + format: int64 + type: integer + - description: The maximum number of revisions to return. + in: query + name: page[limit] + required: false + schema: + default: 100 + format: int64 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + category: SECURITY + checksum: abc123 + content: Content + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + cwe: + description: Ruleset description + directories: [] + execution_mode: auto + globs: + - "**/*.py" + is_default: false + is_published: false + is_testing: false + severity: ERROR + short_description: Ruleset short description + version_id: 1 + id: revision-abc-123 + type: ai_rule_revision + schema: + $ref: "#/components/schemas/AiCustomRuleRevisionsResponse" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Rule not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: List AI custom rule revisions + tags: + - Static Analysis + x-pagination: + limitParam: page[limit] + pageOffsetParam: page[offset] + resultsPath: data + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create a new revision for an AI custom rule. + operationId: CreateAiCustomRuleRevision + parameters: + - description: The ruleset name. + in: path + name: ruleset_name + required: true + schema: + example: my-ai-ruleset + type: string + - description: The rule name. + in: path + name: rule_name + required: true + schema: + example: my-ai-rule + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + category: SECURITY + content: Content + description: Ruleset description + directories: [] + execution_mode: auto + globs: + - "**/*.py" + is_published: false + is_testing: false + severity: ERROR + short_description: Ruleset short description + version_id: 1 + id: revision-abc-123 + type: ai_rule_revision + schema: + $ref: "#/components/schemas/AiCustomRuleRevisionRequest" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Rule not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Create an AI custom rule revision + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/ai/rulesets/{ruleset_name}/rules/{rule_name}/revisions/{id}: + get: + description: Get a specific revision of an AI custom rule. + operationId: GetAiCustomRuleRevision + parameters: + - description: The ruleset name. + in: path + name: ruleset_name + required: true + schema: + example: my-ai-ruleset + type: string + - description: The rule name. + in: path + name: rule_name + required: true + schema: + example: my-ai-rule + type: string + - description: The revision identifier. + in: path + name: id + required: true + schema: + example: revision-abc-123 + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + category: SECURITY + checksum: abc123 + content: Content + created_at: "2024-01-01T00:00:00+00:00" + created_by: example-handle + cwe: + description: Ruleset description + directories: [] + execution_mode: auto + globs: + - "**/*.py" + is_default: false + is_published: false + is_testing: false + severity: ERROR + short_description: Ruleset short description + version_id: 1 + id: revision-abc-123 + type: ai_rule_revision + schema: + $ref: "#/components/schemas/AiCustomRuleRevisionResponse" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Revision not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Get an AI custom rule revision + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/codegen/rulesets: + get: + description: Get the rulesets relevant for code generation for the authenticated user. + operationId: ListStaticAnalysisCodegenRulesets + responses: + "200": + content: + application/json: + examples: + default: + value: + data: [] + schema: + $ref: "#/components/schemas/SastRulesetsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: List codegen rulesets + tags: + - "Security Monitoring" + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/custom/rulesets: + get: + description: Get all custom rulesets for the authenticated organization. + operationId: ListCustomRulesets + responses: + "200": + content: + application/json: + examples: + default: + value: + data: [] + schema: + $ref: "#/components/schemas/CustomRulesetListResponse" + description: OK + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: List Custom Rulesets + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + put: + description: Create a new custom ruleset for the authenticated organization. + operationId: CreateCustomRuleset + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: My custom ruleset. + name: my-custom-ruleset + type: custom_ruleset + schema: + $ref: "#/components/schemas/CustomRulesetRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + name: my-custom-ruleset + id: my-custom-ruleset + type: custom_ruleset + schema: + $ref: "#/components/schemas/CustomRulesetResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "412": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Precondition Failed + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Create Custom Ruleset + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/static-analysis/custom/rulesets/{ruleset_name}: delete: description: Delete a custom ruleset @@ -153582,6 +156025,53 @@ paths: tags: - Static Analysis x-unstable: "This endpoint is in Preview and may introduce breaking changes.\nIf you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/)." + /api/v2/static-analysis/default-rulesets/{language}: + get: + description: Get the default SAST ruleset names for a given programming language. + operationId: GetStaticAnalysisDefaultRulesets + parameters: + - description: The programming language for which to retrieve the default rulesets. + in: path + name: language + required: true + schema: + example: python + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + rulesets: + - python-best-practices + id: python + type: defaultRulesetsPerLanguage + schema: + $ref: "#/components/schemas/DefaultRulesetsPerLanguageResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Get default rulesets for a language + tags: + - "Security Monitoring" + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + 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. @@ -153623,6 +156113,73 @@ paths: tags: - "Security Monitoring" x-unstable: "**Note**: This endpoint may be subject to changes." + /api/v2/static-analysis/rulesets/{ruleset_name}: + get: + description: Get a SAST ruleset by name, including all its rules. + operationId: GetStaticAnalysisRuleset + parameters: + - description: The name of the ruleset to retrieve. + in: path + name: ruleset_name + required: true + schema: + example: python-best-practices + type: string + - description: When true, test cases for each rule are included in the response. + in: query + name: include_tests + required: false + schema: + type: boolean + - description: When true, rules that are in testing mode are included in the response. + in: query + name: include_testing_rules + required: false + schema: + type: boolean + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + description: A collection of Python best practice rules. + name: python-best-practices + rules: [] + short_description: Python best practices. + id: python-best-practices + type: rulesets + schema: + $ref: "#/components/schemas/SastRulesetResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Get a SAST ruleset + tags: + - "Security Monitoring" + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/static-analysis/secrets/rules: get: description: |- @@ -153657,6 +156214,226 @@ paths: tags: - "Security Monitoring" x-unstable: "**Note**: This endpoint may be subject to changes." + /api/v2/static-analysis/static-analysis-server/analyze: + post: + description: Run static analysis rules against a source code file and return violations found. + operationId: CreateStaticAnalysisServerAnalysis + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + code: aW1wb3J0IHN5cw== + file_encoding: utf-8 + filename: test.py + language: python + rules: [] + type: analysis_request + schema: + $ref: "#/components/schemas/AnalysisRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + errors: [] + rule_responses: [] + id: abc-123 + type: server_request + schema: + $ref: "#/components/schemas/AnalysisResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Analyze code + tags: + - Security Monitoring + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/static-analysis-server/get-ast: + post: + description: Parse source code into an abstract syntax tree (AST) for the specified language. + operationId: CreateStaticAnalysisAst + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + code: aW1wb3J0IHN5cw== + file_encoding: utf-8 + language: python + type: get_ast_request + schema: + $ref: "#/components/schemas/GetAstRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + ast: {} + type: get_ast_response + schema: + $ref: "#/components/schemas/GetAstResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Get AST for source code + tags: + - Security Monitoring + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/static-analysis-server/node-types/{language}: + get: + description: Retrieve tree-sitter node type definitions for a given programming language. + operationId: GetStaticAnalysisNodeTypes + parameters: + - description: The programming language for which to retrieve node type definitions. + in: path + name: language + required: true + schema: + example: python + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + node_types: [] + id: python + type: get_node_types_response + schema: + $ref: "#/components/schemas/NodeTypesResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Get node types for a language + tags: + - Security Monitoring + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis/static-analysis-server/tree-sitter-wasm/{file}: + get: + description: Download the WebAssembly binary for a tree-sitter grammar by file name. + operationId: GetStaticAnalysisTreeSitterWasm + parameters: + - description: The name of the WASM file to download. + in: path + name: file + required: true + schema: + example: tree-sitter-python.wasm + type: string + responses: + "200": + content: + application/octet-stream: + examples: + default: + value: "" + schema: + format: binary + type: string + description: BLOB with the content of the WASM file + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Get tree-sitter WASM file + tags: + - Security Monitoring + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/statuspages: get: description: Lists all status pages for the organization. diff --git a/examples/v2/security-monitoring/CreateStaticAnalysisAst.java b/examples/v2/security-monitoring/CreateStaticAnalysisAst.java new file mode 100644 index 00000000000..3a26d2ed60c --- /dev/null +++ b/examples/v2/security-monitoring/CreateStaticAnalysisAst.java @@ -0,0 +1,40 @@ +// Get AST for source code returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.GetAstRequest; +import com.datadog.api.client.v2.model.GetAstRequestData; +import com.datadog.api.client.v2.model.GetAstRequestDataAttributes; +import com.datadog.api.client.v2.model.GetAstRequestDataType; +import com.datadog.api.client.v2.model.GetAstResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createStaticAnalysisAst", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + GetAstRequest body = + new GetAstRequest() + .data( + new GetAstRequestData() + .attributes( + new GetAstRequestDataAttributes() + .code("aW1wb3J0IHN5cw==") + .fileEncoding("utf-8") + .language("python")) + .type(GetAstRequestDataType.GET_AST_REQUEST)); + + try { + GetAstResponse result = apiInstance.createStaticAnalysisAst(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#createStaticAnalysisAst"); + 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/security-monitoring/CreateStaticAnalysisServerAnalysis.java b/examples/v2/security-monitoring/CreateStaticAnalysisServerAnalysis.java new file mode 100644 index 00000000000..e3926302b6c --- /dev/null +++ b/examples/v2/security-monitoring/CreateStaticAnalysisServerAnalysis.java @@ -0,0 +1,57 @@ +// Analyze code returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.AnalysisRequest; +import com.datadog.api.client.v2.model.AnalysisRequestData; +import com.datadog.api.client.v2.model.AnalysisRequestDataAttributes; +import com.datadog.api.client.v2.model.AnalysisRequestDataType; +import com.datadog.api.client.v2.model.AnalysisRequestRule; +import com.datadog.api.client.v2.model.AnalysisResponse; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createStaticAnalysisServerAnalysis", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + AnalysisRequest body = + new AnalysisRequest() + .data( + new AnalysisRequestData() + .attributes( + new AnalysisRequestDataAttributes() + .code("aW1wb3J0IHN5cw==") + .fileEncoding("utf-8") + .filename("test.py") + .language("python") + .rules( + Collections.singletonList( + new AnalysisRequestRule() + .category("BEST_PRACTICES") + .checksum("abc123def456") + .code("ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=") + .entityChecked(null) + .id("python-best-practices/no-exit") + .language("python") + .regex(null) + .severity("WARNING") + .treeSitterQuery("KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==") + .type("TREE_SITTER_QUERY")))) + .type(AnalysisRequestDataType.ANALYSIS_REQUEST)); + + try { + AnalysisResponse result = apiInstance.createStaticAnalysisServerAnalysis(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#createStaticAnalysisServerAnalysis"); + 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/security-monitoring/GetStaticAnalysisDefaultRulesets.java b/examples/v2/security-monitoring/GetStaticAnalysisDefaultRulesets.java new file mode 100644 index 00000000000..7a917dc2425 --- /dev/null +++ b/examples/v2/security-monitoring/GetStaticAnalysisDefaultRulesets.java @@ -0,0 +1,27 @@ +// Get default rulesets for a language returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.DefaultRulesetsPerLanguageResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getStaticAnalysisDefaultRulesets", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + DefaultRulesetsPerLanguageResponse result = + apiInstance.getStaticAnalysisDefaultRulesets("python"); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#getStaticAnalysisDefaultRulesets"); + 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/security-monitoring/GetStaticAnalysisNodeTypes.java b/examples/v2/security-monitoring/GetStaticAnalysisNodeTypes.java new file mode 100644 index 00000000000..13e094362cb --- /dev/null +++ b/examples/v2/security-monitoring/GetStaticAnalysisNodeTypes.java @@ -0,0 +1,25 @@ +// Get node types for a language returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.NodeTypesResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getStaticAnalysisNodeTypes", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + NodeTypesResponse result = apiInstance.getStaticAnalysisNodeTypes("python"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#getStaticAnalysisNodeTypes"); + 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/security-monitoring/GetStaticAnalysisRuleset.java b/examples/v2/security-monitoring/GetStaticAnalysisRuleset.java new file mode 100644 index 00000000000..f2683d33acd --- /dev/null +++ b/examples/v2/security-monitoring/GetStaticAnalysisRuleset.java @@ -0,0 +1,25 @@ +// Get a SAST ruleset returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.SastRulesetResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getStaticAnalysisRuleset", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + SastRulesetResponse result = apiInstance.getStaticAnalysisRuleset("python-best-practices"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#getStaticAnalysisRuleset"); + 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/security-monitoring/GetStaticAnalysisTreeSitterWasm.java b/examples/v2/security-monitoring/GetStaticAnalysisTreeSitterWasm.java new file mode 100644 index 00000000000..394c015de2b --- /dev/null +++ b/examples/v2/security-monitoring/GetStaticAnalysisTreeSitterWasm.java @@ -0,0 +1,26 @@ +// Get tree-sitter WASM file returns "BLOB with the content of the WASM file" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import java.io.File; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getStaticAnalysisTreeSitterWasm", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + File result = apiInstance.getStaticAnalysisTreeSitterWasm("tree-sitter-python.wasm"); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#getStaticAnalysisTreeSitterWasm"); + 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/security-monitoring/ListStaticAnalysisCodegenRulesets.java b/examples/v2/security-monitoring/ListStaticAnalysisCodegenRulesets.java new file mode 100644 index 00000000000..b1038489441 --- /dev/null +++ b/examples/v2/security-monitoring/ListStaticAnalysisCodegenRulesets.java @@ -0,0 +1,26 @@ +// List codegen rulesets returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.SastRulesetsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listStaticAnalysisCodegenRulesets", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + SastRulesetsResponse result = apiInstance.listStaticAnalysisCodegenRulesets(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#listStaticAnalysisCodegenRulesets"); + 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/CreateAiCustomRule.java b/examples/v2/static-analysis/CreateAiCustomRule.java new file mode 100644 index 00000000000..569aaed7dba --- /dev/null +++ b/examples/v2/static-analysis/CreateAiCustomRule.java @@ -0,0 +1,37 @@ +// Create an AI 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.AiCustomRuleDataType; +import com.datadog.api.client.v2.model.AiCustomRuleRequest; +import com.datadog.api.client.v2.model.AiCustomRuleRequestAttributes; +import com.datadog.api.client.v2.model.AiCustomRuleRequestData; +import com.datadog.api.client.v2.model.AiCustomRuleResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createAiCustomRule", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + AiCustomRuleRequest body = + new AiCustomRuleRequest() + .data( + new AiCustomRuleRequestData() + .attributes(new AiCustomRuleRequestAttributes().name("my-ai-rule")) + .id("my-ai-rule") + .type(AiCustomRuleDataType.AI_RULE)); + + try { + AiCustomRuleResponse result = apiInstance.createAiCustomRule("my-ai-ruleset", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#createAiCustomRule"); + 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/CreateAiCustomRuleRevision.java b/examples/v2/static-analysis/CreateAiCustomRuleRevision.java new file mode 100644 index 00000000000..ebc064d823f --- /dev/null +++ b/examples/v2/static-analysis/CreateAiCustomRuleRevision.java @@ -0,0 +1,51 @@ +// Create an AI 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.AiCustomRuleRevisionDataType; +import com.datadog.api.client.v2.model.AiCustomRuleRevisionExecutionMode; +import com.datadog.api.client.v2.model.AiCustomRuleRevisionRequest; +import com.datadog.api.client.v2.model.AiCustomRuleRevisionRequestAttributes; +import com.datadog.api.client.v2.model.AiCustomRuleRevisionRequestData; +import com.datadog.api.client.v2.model.CustomRuleRevisionAttributesCategory; +import com.datadog.api.client.v2.model.CustomRuleRevisionAttributesSeverity; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createAiCustomRuleRevision", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + AiCustomRuleRevisionRequest body = + new AiCustomRuleRevisionRequest() + .data( + new AiCustomRuleRevisionRequestData() + .attributes( + new AiCustomRuleRevisionRequestAttributes() + .category(CustomRuleRevisionAttributesCategory.SECURITY) + .content("Content") + .cwe("79") + .description("Ruleset description") + .executionMode(AiCustomRuleRevisionExecutionMode.AUTO) + .globs(Collections.singletonList("**/*.py")) + .isPublished(false) + .isTesting(false) + .severity(CustomRuleRevisionAttributesSeverity.ERROR) + .shortDescription("Ruleset short description") + .versionId(1L)) + .id("revision-abc-123") + .type(AiCustomRuleRevisionDataType.AI_RULE_REVISION)); + + try { + apiInstance.createAiCustomRuleRevision("my-ai-ruleset", "my-ai-rule", body); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#createAiCustomRuleRevision"); + 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/CreateAiCustomRuleset.java b/examples/v2/static-analysis/CreateAiCustomRuleset.java new file mode 100644 index 00000000000..1999b4c8754 --- /dev/null +++ b/examples/v2/static-analysis/CreateAiCustomRuleset.java @@ -0,0 +1,41 @@ +// Create an AI custom ruleset 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.AiCustomRulesetDataType; +import com.datadog.api.client.v2.model.AiCustomRulesetRequest; +import com.datadog.api.client.v2.model.AiCustomRulesetRequestAttributes; +import com.datadog.api.client.v2.model.AiCustomRulesetRequestData; +import com.datadog.api.client.v2.model.AiCustomRulesetResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createAiCustomRuleset", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + AiCustomRulesetRequest body = + new AiCustomRulesetRequest() + .data( + new AiCustomRulesetRequestData() + .attributes( + new AiCustomRulesetRequestAttributes() + .description("Ruleset description") + .name("my-ai-ruleset") + .shortDescription("Ruleset short description")) + .id("my-ai-ruleset") + .type(AiCustomRulesetDataType.AI_RULESET)); + + try { + AiCustomRulesetResponse result = apiInstance.createAiCustomRuleset(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#createAiCustomRuleset"); + 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/CreateAiMemoryViolationResult.java b/examples/v2/static-analysis/CreateAiMemoryViolationResult.java new file mode 100644 index 00000000000..21a0d4ab009 --- /dev/null +++ b/examples/v2/static-analysis/CreateAiMemoryViolationResult.java @@ -0,0 +1,44 @@ +// Create an AI memory violation result 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.AiMemoryViolationResultDataType; +import com.datadog.api.client.v2.model.AiMemoryViolationResultRequest; +import com.datadog.api.client.v2.model.AiMemoryViolationResultRequestAttributes; +import com.datadog.api.client.v2.model.AiMemoryViolationResultRequestData; +import com.datadog.api.client.v2.model.AiMemoryViolationType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createAiMemoryViolationResult", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + AiMemoryViolationResultRequest body = + new AiMemoryViolationResultRequest() + .data( + new AiMemoryViolationResultRequestData() + .attributes( + new AiMemoryViolationResultRequestAttributes() + .line(10L) + .message("This is a false positive because the input is sanitized.") + .name("src/main.py") + .repositoryId("my-repo") + .rule("my-ai-ruleset/my-ai-rule") + .sha("abc123def456789012345678901234567890abcd") + .type(AiMemoryViolationType.FP)) + .id("violation-abc") + .type(AiMemoryViolationResultDataType.AI_MEMORY_VIOLATION_RESULT)); + + try { + apiInstance.createAiMemoryViolationResult(body); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#createAiMemoryViolationResult"); + 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/CreateCustomRuleset.java b/examples/v2/static-analysis/CreateCustomRuleset.java new file mode 100644 index 00000000000..ba746ba4269 --- /dev/null +++ b/examples/v2/static-analysis/CreateCustomRuleset.java @@ -0,0 +1,106 @@ +// Create Custom Ruleset returns "OK" 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.createCustomRuleset", 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.createCustomRuleset(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#createCustomRuleset"); + 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/DeleteAiCustomRule.java b/examples/v2/static-analysis/DeleteAiCustomRule.java new file mode 100644 index 00000000000..914714fc701 --- /dev/null +++ b/examples/v2/static-analysis/DeleteAiCustomRule.java @@ -0,0 +1,23 @@ +// Delete an AI 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.deleteAiCustomRule", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + apiInstance.deleteAiCustomRule("my-ai-ruleset", "my-ai-rule"); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#deleteAiCustomRule"); + 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/DeleteAiCustomRuleset.java b/examples/v2/static-analysis/DeleteAiCustomRuleset.java new file mode 100644 index 00000000000..c77f4378c8f --- /dev/null +++ b/examples/v2/static-analysis/DeleteAiCustomRuleset.java @@ -0,0 +1,23 @@ +// Delete an AI 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.deleteAiCustomRuleset", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + apiInstance.deleteAiCustomRuleset("my-ai-ruleset"); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#deleteAiCustomRuleset"); + 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/DeleteAiMemoryViolationResult.java b/examples/v2/static-analysis/DeleteAiMemoryViolationResult.java new file mode 100644 index 00000000000..64bdf0127cf --- /dev/null +++ b/examples/v2/static-analysis/DeleteAiMemoryViolationResult.java @@ -0,0 +1,23 @@ +// Delete an AI memory violation result 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.deleteAiMemoryViolationResult", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + apiInstance.deleteAiMemoryViolationResult("42"); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#deleteAiMemoryViolationResult"); + 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/GetAiCustomRule.java b/examples/v2/static-analysis/GetAiCustomRule.java new file mode 100644 index 00000000000..000c827ddda --- /dev/null +++ b/examples/v2/static-analysis/GetAiCustomRule.java @@ -0,0 +1,25 @@ +// Get an AI 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.AiCustomRuleResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getAiCustomRule", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + AiCustomRuleResponse result = apiInstance.getAiCustomRule("my-ai-ruleset", "my-ai-rule"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#getAiCustomRule"); + 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/GetAiCustomRuleRevision.java b/examples/v2/static-analysis/GetAiCustomRuleRevision.java new file mode 100644 index 00000000000..3815c014d54 --- /dev/null +++ b/examples/v2/static-analysis/GetAiCustomRuleRevision.java @@ -0,0 +1,26 @@ +// Get an AI 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.AiCustomRuleRevisionResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getAiCustomRuleRevision", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + AiCustomRuleRevisionResponse result = + apiInstance.getAiCustomRuleRevision("my-ai-ruleset", "my-ai-rule", "revision-abc-123"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#getAiCustomRuleRevision"); + 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/GetAiCustomRuleset.java b/examples/v2/static-analysis/GetAiCustomRuleset.java new file mode 100644 index 00000000000..a037cecc971 --- /dev/null +++ b/examples/v2/static-analysis/GetAiCustomRuleset.java @@ -0,0 +1,25 @@ +// Get an AI 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.AiCustomRulesetResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getAiCustomRuleset", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + AiCustomRulesetResponse result = apiInstance.getAiCustomRuleset("my-ai-ruleset"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#getAiCustomRuleset"); + 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/ListAiCustomRuleRevisions.java b/examples/v2/static-analysis/ListAiCustomRuleRevisions.java new file mode 100644 index 00000000000..5cde8ab4142 --- /dev/null +++ b/examples/v2/static-analysis/ListAiCustomRuleRevisions.java @@ -0,0 +1,26 @@ +// List AI 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.AiCustomRuleRevisionsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listAiCustomRuleRevisions", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + AiCustomRuleRevisionsResponse result = + apiInstance.listAiCustomRuleRevisions("my-ai-ruleset", "my-ai-rule"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#listAiCustomRuleRevisions"); + 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/ListAiCustomRuleRevisions_842014679.java b/examples/v2/static-analysis/ListAiCustomRuleRevisions_842014679.java new file mode 100644 index 00000000000..839108f3a66 --- /dev/null +++ b/examples/v2/static-analysis/ListAiCustomRuleRevisions_842014679.java @@ -0,0 +1,28 @@ +// List AI custom rule revisions returns "Successful response" response with pagination + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.PaginationIterable; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.AiCustomRuleRevisionResponseData; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listAiCustomRuleRevisions", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + PaginationIterable iterable = + apiInstance.listAiCustomRuleRevisionsWithPagination("my-ai-ruleset", "my-ai-rule"); + + for (AiCustomRuleRevisionResponseData item : iterable) { + System.out.println(item); + } + } catch (RuntimeException e) { + System.err.println( + "Exception when calling StaticAnalysisApi#listAiCustomRuleRevisionsWithPagination"); + System.err.println("Reason: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/static-analysis/ListAiCustomRulesets.java b/examples/v2/static-analysis/ListAiCustomRulesets.java new file mode 100644 index 00000000000..7941147e201 --- /dev/null +++ b/examples/v2/static-analysis/ListAiCustomRulesets.java @@ -0,0 +1,25 @@ +// List AI custom rulesets 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.AiCustomRulesetsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listAiCustomRulesets", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + AiCustomRulesetsResponse result = apiInstance.listAiCustomRulesets(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#listAiCustomRulesets"); + 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/ListAiMemoryViolationResults.java b/examples/v2/static-analysis/ListAiMemoryViolationResults.java new file mode 100644 index 00000000000..98b8fcebb56 --- /dev/null +++ b/examples/v2/static-analysis/ListAiMemoryViolationResults.java @@ -0,0 +1,25 @@ +// List AI memory violation results 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.AiMemoryViolationResultsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listAiMemoryViolationResults", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + AiMemoryViolationResultsResponse result = apiInstance.listAiMemoryViolationResults(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#listAiMemoryViolationResults"); + 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/ListAiPrompts.java b/examples/v2/static-analysis/ListAiPrompts.java new file mode 100644 index 00000000000..dade9d1f42e --- /dev/null +++ b/examples/v2/static-analysis/ListAiPrompts.java @@ -0,0 +1,25 @@ +// List AI prompts 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.AiPromptsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listAiPrompts", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + AiPromptsResponse result = apiInstance.listAiPrompts(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#listAiPrompts"); + 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/ListCustomRulesets.java b/examples/v2/static-analysis/ListCustomRulesets.java new file mode 100644 index 00000000000..51a8387f42f --- /dev/null +++ b/examples/v2/static-analysis/ListCustomRulesets.java @@ -0,0 +1,25 @@ +// List Custom Rulesets returns "OK" 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.CustomRulesetListResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listCustomRulesets", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + CustomRulesetListResponse result = apiInstance.listCustomRulesets(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#listCustomRulesets"); + 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/UpdateAiCustomRuleset.java b/examples/v2/static-analysis/UpdateAiCustomRuleset.java new file mode 100644 index 00000000000..1d74d235ea9 --- /dev/null +++ b/examples/v2/static-analysis/UpdateAiCustomRuleset.java @@ -0,0 +1,39 @@ +// Update an AI 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.AiCustomRulesetDataType; +import com.datadog.api.client.v2.model.AiCustomRulesetUpdateAttributes; +import com.datadog.api.client.v2.model.AiCustomRulesetUpdateData; +import com.datadog.api.client.v2.model.AiCustomRulesetUpdateRequest; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateAiCustomRuleset", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + AiCustomRulesetUpdateRequest body = + new AiCustomRulesetUpdateRequest() + .data( + new AiCustomRulesetUpdateData() + .attributes( + new AiCustomRulesetUpdateAttributes() + .description("Ruleset description") + .name("my-ai-ruleset") + .shortDescription("Ruleset short description")) + .id("my-ai-ruleset") + .type(AiCustomRulesetDataType.AI_RULESET)); + + try { + apiInstance.updateAiCustomRuleset("my-ai-ruleset", body); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#updateAiCustomRuleset"); + 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 52d15a022e6..f46b090fe53 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -888,6 +888,8 @@ public class ApiClient { put("v2.convertSecurityMonitoringTerraformResource", false); put("v2.createSampleLogGenerationSubscription", false); put("v2.createSecurityMonitoringIntegrationConfig", false); + put("v2.createStaticAnalysisAst", false); + put("v2.createStaticAnalysisServerAnalysis", false); put("v2.deactivateContentPack", false); put("v2.deleteHistoricalJob", false); put("v2.deleteSampleLogGenerationSubscription", false); @@ -904,6 +906,10 @@ public class ApiClient { put("v2.getSecurityMonitoringHistsignalsByJobId", false); put("v2.getSecurityMonitoringIntegrationConfig", false); put("v2.getSignalEntities", false); + put("v2.getStaticAnalysisDefaultRulesets", false); + put("v2.getStaticAnalysisNodeTypes", false); + put("v2.getStaticAnalysisRuleset", false); + put("v2.getStaticAnalysisTreeSitterWasm", false); put("v2.listFindings", false); put("v2.listHistoricalJobs", false); put("v2.listIndicatorsOfCompromise", false); @@ -912,6 +918,7 @@ public class ApiClient { put("v2.listScannedAssetsMetadata", false); put("v2.listSecurityMonitoringHistsignals", false); put("v2.listSecurityMonitoringIntegrationConfigs", false); + put("v2.listStaticAnalysisCodegenRulesets", false); put("v2.listVulnerabilities", false); put("v2.listVulnerableAssets", false); put("v2.muteFindings", false); @@ -1115,17 +1122,34 @@ public class ApiClient { put("v2.getSloStatus", false); put("v2.getSPARecommendations", false); put("v2.getSPARecommendationsWithShard", false); + put("v2.createAiCustomRule", false); + put("v2.createAiCustomRuleRevision", false); + put("v2.createAiCustomRuleset", false); + put("v2.createAiMemoryViolationResult", false); put("v2.createCustomRule", false); put("v2.createCustomRuleRevision", false); + put("v2.createCustomRuleset", false); put("v2.createSCAResolveVulnerableSymbols", false); put("v2.createSCAResult", false); + put("v2.deleteAiCustomRule", false); + put("v2.deleteAiCustomRuleset", false); + put("v2.deleteAiMemoryViolationResult", false); put("v2.deleteCustomRule", false); put("v2.deleteCustomRuleset", false); + put("v2.getAiCustomRule", false); + put("v2.getAiCustomRuleRevision", false); + put("v2.getAiCustomRuleset", false); put("v2.getCustomRule", false); put("v2.getCustomRuleRevision", false); put("v2.getCustomRuleset", false); + put("v2.listAiCustomRuleRevisions", false); + put("v2.listAiCustomRulesets", false); + put("v2.listAiMemoryViolationResults", false); + put("v2.listAiPrompts", false); put("v2.listCustomRuleRevisions", false); + put("v2.listCustomRulesets", false); put("v2.revertCustomRuleRevision", false); + put("v2.updateAiCustomRuleset", false); put("v2.updateCustomRuleset", false); put("v2.addMemberTeam", false); put("v2.listMemberTeams", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java index 4a91c444f27..76c02b96bdd 100644 --- a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java @@ -5,6 +5,8 @@ import com.datadog.api.client.ApiResponse; import com.datadog.api.client.PaginationIterable; import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.AnalysisRequest; +import com.datadog.api.client.v2.model.AnalysisResponse; import com.datadog.api.client.v2.model.AssetType; import com.datadog.api.client.v2.model.AttachCaseRequest; import com.datadog.api.client.v2.model.AttachJiraIssueRequest; @@ -17,6 +19,7 @@ import com.datadog.api.client.v2.model.CreateCustomFrameworkResponse; import com.datadog.api.client.v2.model.CreateJiraIssueRequestArray; import com.datadog.api.client.v2.model.CreateNotificationRuleParameters; +import com.datadog.api.client.v2.model.DefaultRulesetsPerLanguageResponse; import com.datadog.api.client.v2.model.DeleteCustomFrameworkResponse; import com.datadog.api.client.v2.model.DetachCaseRequest; import com.datadog.api.client.v2.model.EntityContextResponse; @@ -26,6 +29,8 @@ import com.datadog.api.client.v2.model.FindingEvaluation; import com.datadog.api.client.v2.model.FindingStatus; import com.datadog.api.client.v2.model.FindingVulnerabilityType; +import com.datadog.api.client.v2.model.GetAstRequest; +import com.datadog.api.client.v2.model.GetAstResponse; import com.datadog.api.client.v2.model.GetCustomFrameworkResponse; import com.datadog.api.client.v2.model.GetFindingResponse; import com.datadog.api.client.v2.model.GetIoCIndicatorResponse; @@ -46,6 +51,7 @@ import com.datadog.api.client.v2.model.ListVulnerableAssetsResponse; import com.datadog.api.client.v2.model.MuteFindingsRequest; import com.datadog.api.client.v2.model.MuteFindingsResponse; +import com.datadog.api.client.v2.model.NodeTypesResponse; import com.datadog.api.client.v2.model.NotificationRuleResponse; import com.datadog.api.client.v2.model.PatchNotificationRuleParameters; import com.datadog.api.client.v2.model.RunHistoricalJobRequest; @@ -57,6 +63,8 @@ import com.datadog.api.client.v2.model.SampleLogGenerationSubscriptionResponse; import com.datadog.api.client.v2.model.SampleLogGenerationSubscriptionsResponse; import com.datadog.api.client.v2.model.SampleLogGenerationSubscriptionsStatusFilter; +import com.datadog.api.client.v2.model.SastRulesetResponse; +import com.datadog.api.client.v2.model.SastRulesetsResponse; import com.datadog.api.client.v2.model.ScannedAssetsMetadata; import com.datadog.api.client.v2.model.SecretRuleArray; import com.datadog.api.client.v2.model.SecurityFilterCreateRequest; @@ -3941,6 +3949,307 @@ public ApiResponse createSignalNotificationRuleWithHtt new GenericType() {}); } + /** + * Get AST for source code. + * + *

See {@link #createStaticAnalysisAstWithHttpInfo}. + * + * @param body (required) + * @return GetAstResponse + * @throws ApiException if fails to make API call + */ + public GetAstResponse createStaticAnalysisAst(GetAstRequest body) throws ApiException { + return createStaticAnalysisAstWithHttpInfo(body).getData(); + } + + /** + * Get AST for source code. + * + *

See {@link #createStaticAnalysisAstWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<GetAstResponse> + */ + public CompletableFuture createStaticAnalysisAstAsync(GetAstRequest body) { + return createStaticAnalysisAstWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Parse source code into an abstract syntax tree (AST) for the specified language. + * + * @param body (required) + * @return ApiResponse<GetAstResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse createStaticAnalysisAstWithHttpInfo(GetAstRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createStaticAnalysisAst"; + 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 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createStaticAnalysisAst"); + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis/static-analysis-server/get-ast"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.createStaticAnalysisAst", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get AST for source code. + * + *

See {@link #createStaticAnalysisAstWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<GetAstResponse>> + */ + public CompletableFuture> createStaticAnalysisAstWithHttpInfoAsync( + GetAstRequest body) { + // Check if unstable operation is enabled + String operationId = "createStaticAnalysisAst"; + 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 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createStaticAnalysisAst")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis/static-analysis-server/get-ast"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.createStaticAnalysisAst", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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, + new GenericType() {}); + } + + /** + * Analyze code. + * + *

See {@link #createStaticAnalysisServerAnalysisWithHttpInfo}. + * + * @param body (required) + * @return AnalysisResponse + * @throws ApiException if fails to make API call + */ + public AnalysisResponse createStaticAnalysisServerAnalysis(AnalysisRequest body) + throws ApiException { + return createStaticAnalysisServerAnalysisWithHttpInfo(body).getData(); + } + + /** + * Analyze code. + * + *

See {@link #createStaticAnalysisServerAnalysisWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<AnalysisResponse> + */ + public CompletableFuture createStaticAnalysisServerAnalysisAsync( + AnalysisRequest body) { + return createStaticAnalysisServerAnalysisWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Run static analysis rules against a source code file and return violations found. + * + * @param body (required) + * @return ApiResponse<AnalysisResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse createStaticAnalysisServerAnalysisWithHttpInfo( + AnalysisRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createStaticAnalysisServerAnalysis"; + 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 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling createStaticAnalysisServerAnalysis"); + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis/static-analysis-server/analyze"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.createStaticAnalysisServerAnalysis", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Analyze code. + * + *

See {@link #createStaticAnalysisServerAnalysisWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<AnalysisResponse>> + */ + public CompletableFuture> + createStaticAnalysisServerAnalysisWithHttpInfoAsync(AnalysisRequest body) { + // Check if unstable operation is enabled + String operationId = "createStaticAnalysisServerAnalysis"; + 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 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " createStaticAnalysisServerAnalysis")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis/static-analysis-server/analyze"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.createStaticAnalysisServerAnalysis", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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, + new GenericType() {}); + } + /** * Create a new vulnerability-based notification rule. * @@ -10754,30 +11063,30 @@ public CompletableFuture> getSignalNotificationRulesWithHttp } /** - * Get suggested actions for a signal. + * Get default rulesets for a language. * - *

See {@link #getSuggestedActionsMatchingSignalWithHttpInfo}. + *

See {@link #getStaticAnalysisDefaultRulesetsWithHttpInfo}. * - * @param signalId The ID of the signal. (required) - * @return SecurityMonitoringSignalSuggestedActionsResponse + * @param language The programming language for which to retrieve the default rulesets. (required) + * @return DefaultRulesetsPerLanguageResponse * @throws ApiException if fails to make API call */ - public SecurityMonitoringSignalSuggestedActionsResponse getSuggestedActionsMatchingSignal( - String signalId) throws ApiException { - return getSuggestedActionsMatchingSignalWithHttpInfo(signalId).getData(); + public DefaultRulesetsPerLanguageResponse getStaticAnalysisDefaultRulesets(String language) + throws ApiException { + return getStaticAnalysisDefaultRulesetsWithHttpInfo(language).getData(); } /** - * Get suggested actions for a signal. + * Get default rulesets for a language. * - *

See {@link #getSuggestedActionsMatchingSignalWithHttpInfoAsync}. + *

See {@link #getStaticAnalysisDefaultRulesetsWithHttpInfoAsync}. * - * @param signalId The ID of the signal. (required) - * @return CompletableFuture<SecurityMonitoringSignalSuggestedActionsResponse> + * @param language The programming language for which to retrieve the default rulesets. (required) + * @return CompletableFuture<DefaultRulesetsPerLanguageResponse> */ - public CompletableFuture - getSuggestedActionsMatchingSignalAsync(String signalId) { - return getSuggestedActionsMatchingSignalWithHttpInfoAsync(signalId) + public CompletableFuture + getStaticAnalysisDefaultRulesetsAsync(String language) { + return getStaticAnalysisDefaultRulesetsWithHttpInfoAsync(language) .thenApply( response -> { return response.getData(); @@ -10785,17 +11094,732 @@ public SecurityMonitoringSignalSuggestedActionsResponse getSuggestedActionsMatch } /** - * Get the list of suggested actions for a given security signal. + * Get the default SAST ruleset names for a given programming language. * - * @param signalId The ID of the signal. (required) - * @return ApiResponse<SecurityMonitoringSignalSuggestedActionsResponse> + * @param language The programming language for which to retrieve the default rulesets. (required) + * @return ApiResponse<DefaultRulesetsPerLanguageResponse> * @throws ApiException if fails to make API call * @http.response.details * * * * - * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Not Authorized -
400 Bad Request -
429 Too many requests -
+ */ + public ApiResponse + getStaticAnalysisDefaultRulesetsWithHttpInfo(String language) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getStaticAnalysisDefaultRulesets"; + 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 'language' is set + if (language == null) { + throw new ApiException( + 400, + "Missing the required parameter 'language' when calling" + + " getStaticAnalysisDefaultRulesets"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/default-rulesets/{language}" + .replaceAll("\\{" + "language" + "\\}", apiClient.escapeString(language.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getStaticAnalysisDefaultRulesets", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get default rulesets for a language. + * + *

See {@link #getStaticAnalysisDefaultRulesetsWithHttpInfo}. + * + * @param language The programming language for which to retrieve the default rulesets. (required) + * @return CompletableFuture<ApiResponse<DefaultRulesetsPerLanguageResponse>> + */ + public CompletableFuture> + getStaticAnalysisDefaultRulesetsWithHttpInfoAsync(String language) { + // Check if unstable operation is enabled + String operationId = "getStaticAnalysisDefaultRulesets"; + 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 'language' is set + if (language == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'language' when calling" + + " getStaticAnalysisDefaultRulesets")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/default-rulesets/{language}" + .replaceAll("\\{" + "language" + "\\}", apiClient.escapeString(language.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getStaticAnalysisDefaultRulesets", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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() {}); + } + + /** + * Get node types for a language. + * + *

See {@link #getStaticAnalysisNodeTypesWithHttpInfo}. + * + * @param language The programming language for which to retrieve node type definitions. + * (required) + * @return NodeTypesResponse + * @throws ApiException if fails to make API call + */ + public NodeTypesResponse getStaticAnalysisNodeTypes(String language) throws ApiException { + return getStaticAnalysisNodeTypesWithHttpInfo(language).getData(); + } + + /** + * Get node types for a language. + * + *

See {@link #getStaticAnalysisNodeTypesWithHttpInfoAsync}. + * + * @param language The programming language for which to retrieve node type definitions. + * (required) + * @return CompletableFuture<NodeTypesResponse> + */ + public CompletableFuture getStaticAnalysisNodeTypesAsync(String language) { + return getStaticAnalysisNodeTypesWithHttpInfoAsync(language) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve tree-sitter node type definitions for a given programming language. + * + * @param language The programming language for which to retrieve node type definitions. + * (required) + * @return ApiResponse<NodeTypesResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse getStaticAnalysisNodeTypesWithHttpInfo(String language) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getStaticAnalysisNodeTypes"; + 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 'language' is set + if (language == null) { + throw new ApiException( + 400, "Missing the required parameter 'language' when calling getStaticAnalysisNodeTypes"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/static-analysis-server/node-types/{language}" + .replaceAll("\\{" + "language" + "\\}", apiClient.escapeString(language.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getStaticAnalysisNodeTypes", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get node types for a language. + * + *

See {@link #getStaticAnalysisNodeTypesWithHttpInfo}. + * + * @param language The programming language for which to retrieve node type definitions. + * (required) + * @return CompletableFuture<ApiResponse<NodeTypesResponse>> + */ + public CompletableFuture> + getStaticAnalysisNodeTypesWithHttpInfoAsync(String language) { + // Check if unstable operation is enabled + String operationId = "getStaticAnalysisNodeTypes"; + 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 'language' is set + if (language == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'language' when calling getStaticAnalysisNodeTypes")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/static-analysis-server/node-types/{language}" + .replaceAll("\\{" + "language" + "\\}", apiClient.escapeString(language.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getStaticAnalysisNodeTypes", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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() {}); + } + + /** Manage optional parameters to getStaticAnalysisRuleset. */ + public static class GetStaticAnalysisRulesetOptionalParameters { + private Boolean includeTests; + private Boolean includeTestingRules; + + /** + * Set includeTests. + * + * @param includeTests When true, test cases for each rule are included in the response. + * (optional) + * @return GetStaticAnalysisRulesetOptionalParameters + */ + public GetStaticAnalysisRulesetOptionalParameters includeTests(Boolean includeTests) { + this.includeTests = includeTests; + return this; + } + + /** + * Set includeTestingRules. + * + * @param includeTestingRules When true, rules that are in testing mode are included in the + * response. (optional) + * @return GetStaticAnalysisRulesetOptionalParameters + */ + public GetStaticAnalysisRulesetOptionalParameters includeTestingRules( + Boolean includeTestingRules) { + this.includeTestingRules = includeTestingRules; + return this; + } + } + + /** + * Get a SAST ruleset. + * + *

See {@link #getStaticAnalysisRulesetWithHttpInfo}. + * + * @param rulesetName The name of the ruleset to retrieve. (required) + * @return SastRulesetResponse + * @throws ApiException if fails to make API call + */ + public SastRulesetResponse getStaticAnalysisRuleset(String rulesetName) throws ApiException { + return getStaticAnalysisRulesetWithHttpInfo( + rulesetName, new GetStaticAnalysisRulesetOptionalParameters()) + .getData(); + } + + /** + * Get a SAST ruleset. + * + *

See {@link #getStaticAnalysisRulesetWithHttpInfoAsync}. + * + * @param rulesetName The name of the ruleset to retrieve. (required) + * @return CompletableFuture<SastRulesetResponse> + */ + public CompletableFuture getStaticAnalysisRulesetAsync(String rulesetName) { + return getStaticAnalysisRulesetWithHttpInfoAsync( + rulesetName, new GetStaticAnalysisRulesetOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a SAST ruleset. + * + *

See {@link #getStaticAnalysisRulesetWithHttpInfo}. + * + * @param rulesetName The name of the ruleset to retrieve. (required) + * @param parameters Optional parameters for the request. + * @return SastRulesetResponse + * @throws ApiException if fails to make API call + */ + public SastRulesetResponse getStaticAnalysisRuleset( + String rulesetName, GetStaticAnalysisRulesetOptionalParameters parameters) + throws ApiException { + return getStaticAnalysisRulesetWithHttpInfo(rulesetName, parameters).getData(); + } + + /** + * Get a SAST ruleset. + * + *

See {@link #getStaticAnalysisRulesetWithHttpInfoAsync}. + * + * @param rulesetName The name of the ruleset to retrieve. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<SastRulesetResponse> + */ + public CompletableFuture getStaticAnalysisRulesetAsync( + String rulesetName, GetStaticAnalysisRulesetOptionalParameters parameters) { + return getStaticAnalysisRulesetWithHttpInfoAsync(rulesetName, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a SAST ruleset by name, including all its rules. + * + * @param rulesetName The name of the ruleset to retrieve. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<SastRulesetResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getStaticAnalysisRulesetWithHttpInfo( + String rulesetName, GetStaticAnalysisRulesetOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getStaticAnalysisRuleset"; + 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 getStaticAnalysisRuleset"); + } + Boolean includeTests = parameters.includeTests; + Boolean includeTestingRules = parameters.includeTestingRules; + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_tests", includeTests)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "include_testing_rules", includeTestingRules)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getStaticAnalysisRuleset", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a SAST ruleset. + * + *

See {@link #getStaticAnalysisRulesetWithHttpInfo}. + * + * @param rulesetName The name of the ruleset to retrieve. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<SastRulesetResponse>> + */ + public CompletableFuture> + getStaticAnalysisRulesetWithHttpInfoAsync( + String rulesetName, GetStaticAnalysisRulesetOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getStaticAnalysisRuleset"; + 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" + + " getStaticAnalysisRuleset")); + return result; + } + Boolean includeTests = parameters.includeTests; + Boolean includeTestingRules = parameters.includeTestingRules; + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_tests", includeTests)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "include_testing_rules", includeTestingRules)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getStaticAnalysisRuleset", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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() {}); + } + + /** + * Get tree-sitter WASM file. + * + *

See {@link #getStaticAnalysisTreeSitterWasmWithHttpInfo}. + * + * @param file The name of the WASM file to download. (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getStaticAnalysisTreeSitterWasm(String file) throws ApiException { + return getStaticAnalysisTreeSitterWasmWithHttpInfo(file).getData(); + } + + /** + * Get tree-sitter WASM file. + * + *

See {@link #getStaticAnalysisTreeSitterWasmWithHttpInfoAsync}. + * + * @param file The name of the WASM file to download. (required) + * @return CompletableFuture<File> + */ + public CompletableFuture getStaticAnalysisTreeSitterWasmAsync(String file) { + return getStaticAnalysisTreeSitterWasmWithHttpInfoAsync(file) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Download the WebAssembly binary for a tree-sitter grammar by file name. + * + * @param file The name of the WASM file to download. (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 BLOB with the content of the WASM file -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse getStaticAnalysisTreeSitterWasmWithHttpInfo(String file) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getStaticAnalysisTreeSitterWasm"; + 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 'file' is set + if (file == null) { + throw new ApiException( + 400, + "Missing the required parameter 'file' when calling getStaticAnalysisTreeSitterWasm"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/static-analysis-server/tree-sitter-wasm/{file}" + .replaceAll("\\{" + "file" + "\\}", apiClient.escapeString(file.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getStaticAnalysisTreeSitterWasm", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/octet-stream", "application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get tree-sitter WASM file. + * + *

See {@link #getStaticAnalysisTreeSitterWasmWithHttpInfo}. + * + * @param file The name of the WASM file to download. (required) + * @return CompletableFuture<ApiResponse<File>> + */ + public CompletableFuture> getStaticAnalysisTreeSitterWasmWithHttpInfoAsync( + String file) { + // Check if unstable operation is enabled + String operationId = "getStaticAnalysisTreeSitterWasm"; + 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 'file' is set + if (file == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'file' when calling" + + " getStaticAnalysisTreeSitterWasm")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/static-analysis-server/tree-sitter-wasm/{file}" + .replaceAll("\\{" + "file" + "\\}", apiClient.escapeString(file.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getStaticAnalysisTreeSitterWasm", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/octet-stream", "application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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() {}); + } + + /** + * Get suggested actions for a signal. + * + *

See {@link #getSuggestedActionsMatchingSignalWithHttpInfo}. + * + * @param signalId The ID of the signal. (required) + * @return SecurityMonitoringSignalSuggestedActionsResponse + * @throws ApiException if fails to make API call + */ + public SecurityMonitoringSignalSuggestedActionsResponse getSuggestedActionsMatchingSignal( + String signalId) throws ApiException { + return getSuggestedActionsMatchingSignalWithHttpInfo(signalId).getData(); + } + + /** + * Get suggested actions for a signal. + * + *

See {@link #getSuggestedActionsMatchingSignalWithHttpInfoAsync}. + * + * @param signalId The ID of the signal. (required) + * @return CompletableFuture<SecurityMonitoringSignalSuggestedActionsResponse> + */ + public CompletableFuture + getSuggestedActionsMatchingSignalAsync(String signalId) { + return getSuggestedActionsMatchingSignalWithHttpInfoAsync(signalId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the list of suggested actions for a given security signal. + * + * @param signalId The ID of the signal. (required) + * @return ApiResponse<SecurityMonitoringSignalSuggestedActionsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * * * *
Response details
Status Code Description Response Headers
200 OK -
403 Not Authorized -
404 Not Found -
429 Too many requests -
@@ -15622,6 +16646,135 @@ public SecurityMonitoringPaginatedSuppressionsResponse listSecurityMonitoringSup new GenericType() {}); } + /** + * List codegen rulesets. + * + *

See {@link #listStaticAnalysisCodegenRulesetsWithHttpInfo}. + * + * @return SastRulesetsResponse + * @throws ApiException if fails to make API call + */ + public SastRulesetsResponse listStaticAnalysisCodegenRulesets() throws ApiException { + return listStaticAnalysisCodegenRulesetsWithHttpInfo().getData(); + } + + /** + * List codegen rulesets. + * + *

See {@link #listStaticAnalysisCodegenRulesetsWithHttpInfoAsync}. + * + * @return CompletableFuture<SastRulesetsResponse> + */ + public CompletableFuture listStaticAnalysisCodegenRulesetsAsync() { + return listStaticAnalysisCodegenRulesetsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the rulesets relevant for code generation for the authenticated user. + * + * @return ApiResponse<SastRulesetsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse listStaticAnalysisCodegenRulesetsWithHttpInfo() + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listStaticAnalysisCodegenRulesets"; + 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; + // create path and map variables + String localVarPath = "/api/v2/static-analysis/codegen/rulesets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.listStaticAnalysisCodegenRulesets", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List codegen rulesets. + * + *

See {@link #listStaticAnalysisCodegenRulesetsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<SastRulesetsResponse>> + */ + public CompletableFuture> + listStaticAnalysisCodegenRulesetsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listStaticAnalysisCodegenRulesets"; + 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; + // create path and map variables + String localVarPath = "/api/v2/static-analysis/codegen/rulesets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.listStaticAnalysisCodegenRulesets", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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() {}); + } + /** Manage optional parameters to listVulnerabilities. */ public static class ListVulnerabilitiesOptionalParameters { private String pageToken; 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 1f141175f50..6eab587186d 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 @@ -5,12 +5,26 @@ import com.datadog.api.client.ApiResponse; import com.datadog.api.client.PaginationIterable; import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.AiCustomRuleRequest; +import com.datadog.api.client.v2.model.AiCustomRuleResponse; +import com.datadog.api.client.v2.model.AiCustomRuleRevisionRequest; +import com.datadog.api.client.v2.model.AiCustomRuleRevisionResponse; +import com.datadog.api.client.v2.model.AiCustomRuleRevisionResponseData; +import com.datadog.api.client.v2.model.AiCustomRuleRevisionsResponse; +import com.datadog.api.client.v2.model.AiCustomRulesetRequest; +import com.datadog.api.client.v2.model.AiCustomRulesetResponse; +import com.datadog.api.client.v2.model.AiCustomRulesetUpdateRequest; +import com.datadog.api.client.v2.model.AiCustomRulesetsResponse; +import com.datadog.api.client.v2.model.AiMemoryViolationResultRequest; +import com.datadog.api.client.v2.model.AiMemoryViolationResultsResponse; +import com.datadog.api.client.v2.model.AiPromptsResponse; import com.datadog.api.client.v2.model.CustomRuleRequest; import com.datadog.api.client.v2.model.CustomRuleResponse; import com.datadog.api.client.v2.model.CustomRuleRevision; 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.CustomRulesetListResponse; import com.datadog.api.client.v2.model.CustomRulesetRequest; import com.datadog.api.client.v2.model.CustomRulesetResponse; import com.datadog.api.client.v2.model.ResolveVulnerableSymbolsRequest; @@ -58,32 +72,32 @@ public void setApiClient(ApiClient apiClient) { } /** - * Create Custom Rule. + * Create an AI custom rule. * - *

See {@link #createCustomRuleWithHttpInfo}. + *

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

See {@link #createCustomRuleWithHttpInfoAsync}. + *

See {@link #createAiCustomRuleWithHttpInfoAsync}. * - * @param rulesetName The ruleset name (required) + * @param rulesetName The ruleset name. (required) * @param body (required) - * @return CompletableFuture<CustomRuleResponse> + * @return CompletableFuture<AiCustomRuleResponse> */ - public CompletableFuture createCustomRuleAsync( - String rulesetName, CustomRuleRequest body) { - return createCustomRuleWithHttpInfoAsync(rulesetName, body) + public CompletableFuture createAiCustomRuleAsync( + String rulesetName, AiCustomRuleRequest body) { + return createAiCustomRuleWithHttpInfoAsync(rulesetName, body) .thenApply( response -> { return response.getData(); @@ -91,28 +105,29 @@ public CompletableFuture createCustomRuleAsync( } /** - * Create a new custom rule within a ruleset + * Create a new AI custom rule within a ruleset. * - * @param rulesetName The ruleset name (required) + * @param rulesetName The ruleset name. (required) * @param body (required) - * @return ApiResponse<CustomRuleResponse> + * @return ApiResponse<AiCustomRuleResponse> * @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 -
400 Bad Request -
401 Unauthorized -
409 Conflict - rule already exists -
412 Precondition failed - validation error or ruleset not found -
412 Precondition Failed - validation error or ruleset not found -
429 Too many requests -
500 Internal Server Error -
*/ - public ApiResponse createCustomRuleWithHttpInfo( - String rulesetName, CustomRuleRequest body) throws ApiException { + public ApiResponse createAiCustomRuleWithHttpInfo( + String rulesetName, AiCustomRuleRequest body) throws ApiException { // Check if unstable operation is enabled - String operationId = "createCustomRule"; + String operationId = "createAiCustomRule"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -123,17 +138,17 @@ public ApiResponse createCustomRuleWithHttpInfo( // verify the required parameter 'rulesetName' is set if (rulesetName == null) { throw new ApiException( - 400, "Missing the required parameter 'rulesetName' when calling createCustomRule"); + 400, "Missing the required parameter 'rulesetName' when calling createAiCustomRule"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( - 400, "Missing the required parameter 'body' when calling createCustomRule"); + 400, "Missing the required parameter 'body' when calling createAiCustomRule"); } // create path and map variables String localVarPath = - "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules" + "/api/v2/static-analysis/ai/rulesets/{ruleset_name}/rules" .replaceAll( "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); @@ -141,7 +156,7 @@ public ApiResponse createCustomRuleWithHttpInfo( Invocation.Builder builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.createCustomRule", + "v2.StaticAnalysisApi.createAiCustomRule", localVarPath, new ArrayList(), localVarHeaderParams, @@ -149,33 +164,33 @@ public ApiResponse createCustomRuleWithHttpInfo( new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( - "PUT", + "POST", builder, localVarHeaderParams, new String[] {"application/json"}, localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Create Custom Rule. + * Create an AI custom rule. * - *

See {@link #createCustomRuleWithHttpInfo}. + *

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

See {@link #createCustomRuleRevisionWithHttpInfo}. + *

See {@link #createAiCustomRuleRevisionWithHttpInfo}. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) + * @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); + public void createAiCustomRuleRevision( + String rulesetName, String ruleName, AiCustomRuleRevisionRequest body) throws ApiException { + createAiCustomRuleRevisionWithHttpInfo(rulesetName, ruleName, body); } /** - * Create Custom Rule Revision. + * Create an AI custom rule revision. * - *

See {@link #createCustomRuleRevisionWithHttpInfoAsync}. + *

See {@link #createAiCustomRuleRevisionWithHttpInfoAsync}. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) + * @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) + public CompletableFuture createAiCustomRuleRevisionAsync( + String rulesetName, String ruleName, AiCustomRuleRevisionRequest body) { + return createAiCustomRuleRevisionWithHttpInfoAsync(rulesetName, ruleName, body) .thenApply( response -> { return response.getData(); @@ -269,10 +284,10 @@ public CompletableFuture createCustomRuleRevisionAsync( } /** - * Create a new revision for a custom rule + * Create a new revision for an AI custom rule. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) + * @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 @@ -281,16 +296,17 @@ public CompletableFuture createCustomRuleRevisionAsync( * Response details * Status Code Description Response Headers * 200 Successfully created - - * 400 Bad request - - * 401 Unauthorized - custom rules not enabled - + * 400 Bad Request - + * 401 Unauthorized - * 404 Rule not found - * 429 Too many requests - + * 500 Internal Server Error - * */ - public ApiResponse createCustomRuleRevisionWithHttpInfo( - String rulesetName, String ruleName, CustomRuleRevisionRequest body) throws ApiException { + public ApiResponse createAiCustomRuleRevisionWithHttpInfo( + String rulesetName, String ruleName, AiCustomRuleRevisionRequest body) throws ApiException { // Check if unstable operation is enabled - String operationId = "createCustomRuleRevision"; + String operationId = "createAiCustomRuleRevision"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -302,23 +318,23 @@ public ApiResponse createCustomRuleRevisionWithHttpInfo( if (rulesetName == null) { throw new ApiException( 400, - "Missing the required parameter 'rulesetName' when calling createCustomRuleRevision"); + "Missing the required parameter 'rulesetName' when calling createAiCustomRuleRevision"); } // verify the required parameter 'ruleName' is set if (ruleName == null) { throw new ApiException( - 400, "Missing the required parameter 'ruleName' when calling createCustomRuleRevision"); + 400, "Missing the required parameter 'ruleName' when calling createAiCustomRuleRevision"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( - 400, "Missing the required parameter 'body' when calling createCustomRuleRevision"); + 400, "Missing the required parameter 'body' when calling createAiCustomRuleRevision"); } // create path and map variables String localVarPath = - "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions" + "/api/v2/static-analysis/ai/rulesets/{ruleset_name}/rules/{rule_name}/revisions" .replaceAll( "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); @@ -327,7 +343,7 @@ public ApiResponse createCustomRuleRevisionWithHttpInfo( Invocation.Builder builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.createCustomRuleRevision", + "v2.StaticAnalysisApi.createAiCustomRuleRevision", localVarPath, new ArrayList(), localVarHeaderParams, @@ -335,7 +351,7 @@ public ApiResponse createCustomRuleRevisionWithHttpInfo( new String[] {"*/*"}, new String[] {"apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( - "PUT", + "POST", builder, localVarHeaderParams, new String[] {"application/json"}, @@ -346,19 +362,19 @@ public ApiResponse createCustomRuleRevisionWithHttpInfo( } /** - * Create Custom Rule Revision. + * Create an AI custom rule revision. * - *

See {@link #createCustomRuleRevisionWithHttpInfo}. + *

See {@link #createAiCustomRuleRevisionWithHttpInfo}. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) + * @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) { + public CompletableFuture> createAiCustomRuleRevisionWithHttpInfoAsync( + String rulesetName, String ruleName, AiCustomRuleRevisionRequest body) { // Check if unstable operation is enabled - String operationId = "createCustomRuleRevision"; + String operationId = "createAiCustomRuleRevision"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -376,7 +392,7 @@ public CompletableFuture> createCustomRuleRevisionWithHttpInfo new ApiException( 400, "Missing the required parameter 'rulesetName' when calling" - + " createCustomRuleRevision")); + + " createAiCustomRuleRevision")); return result; } @@ -386,7 +402,7 @@ public CompletableFuture> createCustomRuleRevisionWithHttpInfo result.completeExceptionally( new ApiException( 400, - "Missing the required parameter 'ruleName' when calling createCustomRuleRevision")); + "Missing the required parameter 'ruleName' when calling createAiCustomRuleRevision")); return result; } @@ -395,12 +411,13 @@ public CompletableFuture> createCustomRuleRevisionWithHttpInfo CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( - 400, "Missing the required parameter 'body' when calling createCustomRuleRevision")); + 400, + "Missing the required parameter 'body' when calling createAiCustomRuleRevision")); return result; } // create path and map variables String localVarPath = - "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions" + "/api/v2/static-analysis/ai/rulesets/{ruleset_name}/rules/{rule_name}/revisions" .replaceAll( "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); @@ -411,7 +428,7 @@ public CompletableFuture> createCustomRuleRevisionWithHttpInfo try { builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.createCustomRuleRevision", + "v2.StaticAnalysisApi.createAiCustomRuleRevision", localVarPath, new ArrayList(), localVarHeaderParams, @@ -424,7 +441,7 @@ public CompletableFuture> createCustomRuleRevisionWithHttpInfo return result; } return apiClient.invokeAPIAsync( - "PUT", + "POST", builder, localVarHeaderParams, new String[] {"application/json"}, @@ -435,30 +452,30 @@ public CompletableFuture> createCustomRuleRevisionWithHttpInfo } /** - * POST request to resolve vulnerable symbols. + * Create an AI custom ruleset. * - *

See {@link #createSCAResolveVulnerableSymbolsWithHttpInfo}. + *

See {@link #createAiCustomRulesetWithHttpInfo}. * * @param body (required) - * @return ResolveVulnerableSymbolsResponse + * @return AiCustomRulesetResponse * @throws ApiException if fails to make API call */ - public ResolveVulnerableSymbolsResponse createSCAResolveVulnerableSymbols( - ResolveVulnerableSymbolsRequest body) throws ApiException { - return createSCAResolveVulnerableSymbolsWithHttpInfo(body).getData(); + public AiCustomRulesetResponse createAiCustomRuleset(AiCustomRulesetRequest body) + throws ApiException { + return createAiCustomRulesetWithHttpInfo(body).getData(); } /** - * POST request to resolve vulnerable symbols. + * Create an AI custom ruleset. * - *

See {@link #createSCAResolveVulnerableSymbolsWithHttpInfoAsync}. + *

See {@link #createAiCustomRulesetWithHttpInfoAsync}. * * @param body (required) - * @return CompletableFuture<ResolveVulnerableSymbolsResponse> + * @return CompletableFuture<AiCustomRulesetResponse> */ - public CompletableFuture createSCAResolveVulnerableSymbolsAsync( - ResolveVulnerableSymbolsRequest body) { - return createSCAResolveVulnerableSymbolsWithHttpInfoAsync(body) + public CompletableFuture createAiCustomRulesetAsync( + AiCustomRulesetRequest body) { + return createAiCustomRulesetWithHttpInfoAsync(body) .thenApply( response -> { return response.getData(); @@ -466,22 +483,28 @@ public CompletableFuture createSCAResolveVulne } /** + * Create a new AI custom ruleset for the authenticated organization. + * * @param body (required) - * @return ApiResponse<ResolveVulnerableSymbolsResponse> + * @return ApiResponse<AiCustomRulesetResponse> * @throws ApiException if fails to make API call * @http.response.details * * * - * + * + * + * + * + * * + * *
Response details
Status Code Description Response Headers
200 OK -
200 Successfully created -
400 Bad Request -
401 Unauthorized -
409 Conflict - ruleset already exists -
412 Precondition Failed - validation error -
429 Too many requests -
500 Internal Server Error -
*/ - public ApiResponse - createSCAResolveVulnerableSymbolsWithHttpInfo(ResolveVulnerableSymbolsRequest body) - throws ApiException { + public ApiResponse createAiCustomRulesetWithHttpInfo( + AiCustomRulesetRequest body) throws ApiException { // Check if unstable operation is enabled - String operationId = "createSCAResolveVulnerableSymbols"; + String operationId = "createAiCustomRuleset"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -492,23 +515,22 @@ public CompletableFuture createSCAResolveVulne // verify the required parameter 'body' is set if (body == null) { throw new ApiException( - 400, - "Missing the required parameter 'body' when calling createSCAResolveVulnerableSymbols"); + 400, "Missing the required parameter 'body' when calling createAiCustomRuleset"); } // create path and map variables - String localVarPath = "/api/v2/static-analysis-sca/vulnerabilities/resolve-vulnerable-symbols"; + String localVarPath = "/api/v2/static-analysis/ai/rulesets"; Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.createSCAResolveVulnerableSymbols", + "v2.StaticAnalysisApi.createAiCustomRuleset", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + new String[] {"apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( "POST", builder, @@ -517,26 +539,25 @@ public CompletableFuture createSCAResolveVulne localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * POST request to resolve vulnerable symbols. + * Create an AI custom ruleset. * - *

See {@link #createSCAResolveVulnerableSymbolsWithHttpInfo}. + *

See {@link #createAiCustomRulesetWithHttpInfo}. * * @param body (required) - * @return CompletableFuture<ApiResponse<ResolveVulnerableSymbolsResponse>> + * @return CompletableFuture<ApiResponse<AiCustomRulesetResponse>> */ - public CompletableFuture> - createSCAResolveVulnerableSymbolsWithHttpInfoAsync(ResolveVulnerableSymbolsRequest body) { + public CompletableFuture> + createAiCustomRulesetWithHttpInfoAsync(AiCustomRulesetRequest body) { // Check if unstable operation is enabled - String operationId = "createSCAResolveVulnerableSymbols"; + String operationId = "createAiCustomRuleset"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; @@ -545,17 +566,14 @@ public CompletableFuture createSCAResolveVulne // verify the required parameter 'body' is set if (body == null) { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( - 400, - "Missing the required parameter 'body' when calling" - + " createSCAResolveVulnerableSymbols")); + 400, "Missing the required parameter 'body' when calling createAiCustomRuleset")); return result; } // create path and map variables - String localVarPath = "/api/v2/static-analysis-sca/vulnerabilities/resolve-vulnerable-symbols"; + String localVarPath = "/api/v2/static-analysis/ai/rulesets"; Map localVarHeaderParams = new HashMap(); @@ -563,16 +581,15 @@ public CompletableFuture createSCAResolveVulne try { builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.createSCAResolveVulnerableSymbols", + "v2.StaticAnalysisApi.createAiCustomRuleset", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -584,31 +601,33 @@ public CompletableFuture createSCAResolveVulne localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Post dependencies for analysis. + * Create an AI memory violation result. * - *

See {@link #createSCAResultWithHttpInfo}. + *

See {@link #createAiMemoryViolationResultWithHttpInfo}. * * @param body (required) * @throws ApiException if fails to make API call */ - public void createSCAResult(ScaRequest body) throws ApiException { - createSCAResultWithHttpInfo(body); + public void createAiMemoryViolationResult(AiMemoryViolationResultRequest body) + throws ApiException { + createAiMemoryViolationResultWithHttpInfo(body); } /** - * Post dependencies for analysis. + * Create an AI memory violation result. * - *

See {@link #createSCAResultWithHttpInfoAsync}. + *

See {@link #createAiMemoryViolationResultWithHttpInfoAsync}. * * @param body (required) * @return CompletableFuture */ - public CompletableFuture createSCAResultAsync(ScaRequest body) { - return createSCAResultWithHttpInfoAsync(body) + public CompletableFuture createAiMemoryViolationResultAsync( + AiMemoryViolationResultRequest body) { + return createAiMemoryViolationResultWithHttpInfoAsync(body) .thenApply( response -> { return response.getData(); @@ -616,6 +635,8 @@ public CompletableFuture createSCAResultAsync(ScaRequest body) { } /** + * Add a new AI memory violation result for the authenticated organization. + * * @param body (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call @@ -623,13 +644,18 @@ public CompletableFuture createSCAResultAsync(ScaRequest body) { * * * - * + * + * + * + * * + * *
Response details
Status Code Description Response Headers
200 OK -
200 Successfully created -
400 Bad Request -
401 Unauthorized -
404 Not Found -
429 Too many requests -
500 Internal Server Error -
*/ - public ApiResponse createSCAResultWithHttpInfo(ScaRequest body) throws ApiException { + public ApiResponse createAiMemoryViolationResultWithHttpInfo( + AiMemoryViolationResultRequest body) throws ApiException { // Check if unstable operation is enabled - String operationId = "createSCAResult"; + String operationId = "createAiMemoryViolationResult"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -640,22 +666,22 @@ public ApiResponse createSCAResultWithHttpInfo(ScaRequest body) throws Api // verify the required parameter 'body' is set if (body == null) { throw new ApiException( - 400, "Missing the required parameter 'body' when calling createSCAResult"); + 400, "Missing the required parameter 'body' when calling createAiMemoryViolationResult"); } // create path and map variables - String localVarPath = "/api/v2/static-analysis-sca/dependencies"; + String localVarPath = "/api/v2/static-analysis/ai/memory"; Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.createSCAResult", + "v2.StaticAnalysisApi.createAiMemoryViolationResult", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"*/*"}, - new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + new String[] {"apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( "POST", builder, @@ -668,16 +694,17 @@ public ApiResponse createSCAResultWithHttpInfo(ScaRequest body) throws Api } /** - * Post dependencies for analysis. + * Create an AI memory violation result. * - *

See {@link #createSCAResultWithHttpInfo}. + *

See {@link #createAiMemoryViolationResultWithHttpInfo}. * * @param body (required) * @return CompletableFuture<ApiResponse<Void>> */ - public CompletableFuture> createSCAResultWithHttpInfoAsync(ScaRequest body) { + public CompletableFuture> createAiMemoryViolationResultWithHttpInfoAsync( + AiMemoryViolationResultRequest body) { // Check if unstable operation is enabled - String operationId = "createSCAResult"; + String operationId = "createAiMemoryViolationResult"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -693,11 +720,12 @@ public CompletableFuture> createSCAResultWithHttpInfoAsync(Sca CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( - 400, "Missing the required parameter 'body' when calling createSCAResult")); + 400, + "Missing the required parameter 'body' when calling createAiMemoryViolationResult")); return result; } // create path and map variables - String localVarPath = "/api/v2/static-analysis-sca/dependencies"; + String localVarPath = "/api/v2/static-analysis/ai/memory"; Map localVarHeaderParams = new HashMap(); @@ -705,13 +733,13 @@ public CompletableFuture> createSCAResultWithHttpInfoAsync(Sca try { builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.createSCAResult", + "v2.StaticAnalysisApi.createAiMemoryViolationResult", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"*/*"}, - new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); @@ -729,29 +757,32 @@ public CompletableFuture> createSCAResultWithHttpInfoAsync(Sca } /** - * Delete Custom Rule. + * Create Custom Rule. * - *

See {@link #deleteCustomRuleWithHttpInfo}. + *

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

See {@link #deleteCustomRuleWithHttpInfoAsync}. + *

See {@link #createCustomRuleWithHttpInfoAsync}. * * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) - * @return CompletableFuture + * @param body (required) + * @return CompletableFuture<CustomRuleResponse> */ - public CompletableFuture deleteCustomRuleAsync(String rulesetName, String ruleName) { - return deleteCustomRuleWithHttpInfoAsync(rulesetName, ruleName) + public CompletableFuture createCustomRuleAsync( + String rulesetName, CustomRuleRequest body) { + return createCustomRuleWithHttpInfoAsync(rulesetName, body) .thenApply( response -> { return response.getData(); @@ -759,120 +790,119 @@ public CompletableFuture deleteCustomRuleAsync(String rulesetName, String } /** - * Delete a custom rule + * Create a new custom rule within a ruleset * * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) - * @return ApiResponse<Void> + * @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 deleted -
200 Successfully created -
400 Bad request -
401 Unauthorized - custom rules not enabled -
404 Rule not found -
409 Conflict - rule already exists -
412 Precondition failed - validation error or ruleset not found -
429 Too many requests -
*/ - public ApiResponse deleteCustomRuleWithHttpInfo(String rulesetName, String ruleName) - throws ApiException { + public ApiResponse createCustomRuleWithHttpInfo( + String rulesetName, CustomRuleRequest body) throws ApiException { // Check if unstable operation is enabled - String operationId = "deleteCustomRule"; + 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 = null; + Object localVarPostBody = body; // verify the required parameter 'rulesetName' is set if (rulesetName == null) { throw new ApiException( - 400, "Missing the required parameter 'rulesetName' when calling deleteCustomRule"); + 400, "Missing the required parameter 'rulesetName' when calling createCustomRule"); } - // verify the required parameter 'ruleName' is set - if (ruleName == null) { + // verify the required parameter 'body' is set + if (body == null) { throw new ApiException( - 400, "Missing the required parameter 'ruleName' when calling deleteCustomRule"); + 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/{rule_name}" + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules" .replaceAll( - "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) - .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.deleteCustomRule", + "v2.StaticAnalysisApi.createCustomRule", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), - new String[] {"*/*"}, + new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( - "DELETE", + "PUT", builder, localVarHeaderParams, - new String[] {}, + new String[] {"application/json"}, localVarPostBody, new HashMap(), false, - null); + new GenericType() {}); } /** - * Delete Custom Rule. + * Create Custom Rule. * - *

See {@link #deleteCustomRuleWithHttpInfo}. + *

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

See {@link #deleteCustomRulesetWithHttpInfo}. + *

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 deleteCustomRuleset(String rulesetName) throws ApiException { - deleteCustomRulesetWithHttpInfo(rulesetName); + public void createCustomRuleRevision( + String rulesetName, String ruleName, CustomRuleRevisionRequest body) throws ApiException { + createCustomRuleRevisionWithHttpInfo(rulesetName, ruleName, body); } /** - * Delete Custom Ruleset. + * Create Custom Rule Revision. * - *

See {@link #deleteCustomRulesetWithHttpInfoAsync}. + *

See {@link #createCustomRuleRevisionWithHttpInfoAsync}. * * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param body (required) * @return CompletableFuture */ - public CompletableFuture deleteCustomRulesetAsync(String rulesetName) { - return deleteCustomRulesetWithHttpInfoAsync(rulesetName) + public CompletableFuture createCustomRuleRevisionAsync( + String rulesetName, String ruleName, CustomRuleRevisionRequest body) { + return createCustomRuleRevisionWithHttpInfoAsync(rulesetName, ruleName, body) .thenApply( response -> { return response.getData(); @@ -932,48 +968,65 @@ public CompletableFuture deleteCustomRulesetAsync(String rulesetName) { } /** - * Delete a custom ruleset + * 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 deleted -
200 Successfully created -
400 Bad request -
401 Unauthorized - custom rules not enabled -
404 Ruleset not found -
404 Rule not found -
429 Too many requests -
*/ - public ApiResponse deleteCustomRulesetWithHttpInfo(String rulesetName) throws ApiException { + public ApiResponse createCustomRuleRevisionWithHttpInfo( + String rulesetName, String ruleName, CustomRuleRevisionRequest body) throws ApiException { // Check if unstable operation is enabled - String operationId = "deleteCustomRuleset"; + 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 = null; + Object localVarPostBody = body; // verify the required parameter 'rulesetName' is set if (rulesetName == null) { throw new ApiException( - 400, "Missing the required parameter 'rulesetName' when calling deleteCustomRuleset"); + 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}" + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions" .replaceAll( - "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.deleteCustomRuleset", + "v2.StaticAnalysisApi.createCustomRuleRevision", localVarPath, new ArrayList(), localVarHeaderParams, @@ -981,10 +1034,10 @@ public ApiResponse deleteCustomRulesetWithHttpInfo(String rulesetName) thr new String[] {"*/*"}, new String[] {"apiKeyAuth", "appKeyAuth"}); return apiClient.invokeAPI( - "DELETE", + "PUT", builder, localVarHeaderParams, - new String[] {}, + new String[] {"application/json"}, localVarPostBody, new HashMap(), false, @@ -992,17 +1045,19 @@ public ApiResponse deleteCustomRulesetWithHttpInfo(String rulesetName) thr } /** - * Delete Custom Ruleset. + * Create Custom Rule Revision. * - *

See {@link #deleteCustomRulesetWithHttpInfo}. + *

See {@link #createCustomRuleRevisionWithHttpInfo}. * * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param body (required) * @return CompletableFuture<ApiResponse<Void>> */ - public CompletableFuture> deleteCustomRulesetWithHttpInfoAsync( - String rulesetName) { + public CompletableFuture> createCustomRuleRevisionWithHttpInfoAsync( + String rulesetName, String ruleName, CustomRuleRevisionRequest body) { // Check if unstable operation is enabled - String operationId = "deleteCustomRuleset"; + String operationId = "createCustomRuleRevision"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -1011,7 +1066,7 @@ public CompletableFuture> deleteCustomRulesetWithHttpInfoAsync new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; } - Object localVarPostBody = null; + Object localVarPostBody = body; // verify the required parameter 'rulesetName' is set if (rulesetName == null) { @@ -1019,14 +1074,35 @@ public CompletableFuture> deleteCustomRulesetWithHttpInfoAsync result.completeExceptionally( new ApiException( 400, - "Missing the required parameter 'rulesetName' when calling deleteCustomRuleset")); + "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}" + "/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions" .replaceAll( - "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())) + .replaceAll("\\{" + "rule_name" + "\\}", apiClient.escapeString(ruleName.toString())); Map localVarHeaderParams = new HashMap(); @@ -1034,7 +1110,7 @@ public CompletableFuture> deleteCustomRulesetWithHttpInfoAsync try { builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.deleteCustomRuleset", + "v2.StaticAnalysisApi.createCustomRuleRevision", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1047,10 +1123,10 @@ public CompletableFuture> deleteCustomRulesetWithHttpInfoAsync return result; } return apiClient.invokeAPIAsync( - "DELETE", + "PUT", builder, localVarHeaderParams, - new String[] {}, + new String[] {"application/json"}, localVarPostBody, new HashMap(), false, @@ -1058,31 +1134,2756 @@ public CompletableFuture> deleteCustomRulesetWithHttpInfoAsync } /** - * Show Custom Rule. + * Create Custom Ruleset. + * + *

See {@link #createCustomRulesetWithHttpInfo}. + * + * @param body (required) + * @return CustomRulesetResponse + * @throws ApiException if fails to make API call + */ + public CustomRulesetResponse createCustomRuleset(CustomRulesetRequest body) throws ApiException { + return createCustomRulesetWithHttpInfo(body).getData(); + } + + /** + * Create Custom Ruleset. + * + *

See {@link #createCustomRulesetWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<CustomRulesetResponse> + */ + public CompletableFuture createCustomRulesetAsync( + CustomRulesetRequest body) { + return createCustomRulesetWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new custom ruleset for the authenticated organization. + * + * @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 OK -
400 Bad Request -
401 Unauthorized -
409 Conflict -
412 Precondition Failed -
429 Too many requests -
+ */ + public ApiResponse createCustomRulesetWithHttpInfo( + CustomRulesetRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createCustomRuleset"; + 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 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createCustomRuleset"); + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis/custom/rulesets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createCustomRuleset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create Custom Ruleset. + * + *

See {@link #createCustomRulesetWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<CustomRulesetResponse>> + */ + public CompletableFuture> createCustomRulesetWithHttpInfoAsync( + CustomRulesetRequest body) { + // Check if unstable operation is enabled + String operationId = "createCustomRuleset"; + 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 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createCustomRuleset")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis/custom/rulesets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createCustomRuleset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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() {}); + } + + /** + * POST request to resolve vulnerable symbols. + * + *

See {@link #createSCAResolveVulnerableSymbolsWithHttpInfo}. + * + * @param body (required) + * @return ResolveVulnerableSymbolsResponse + * @throws ApiException if fails to make API call + */ + public ResolveVulnerableSymbolsResponse createSCAResolveVulnerableSymbols( + ResolveVulnerableSymbolsRequest body) throws ApiException { + return createSCAResolveVulnerableSymbolsWithHttpInfo(body).getData(); + } + + /** + * POST request to resolve vulnerable symbols. + * + *

See {@link #createSCAResolveVulnerableSymbolsWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<ResolveVulnerableSymbolsResponse> + */ + public CompletableFuture createSCAResolveVulnerableSymbolsAsync( + ResolveVulnerableSymbolsRequest body) { + return createSCAResolveVulnerableSymbolsWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * @param body (required) + * @return ApiResponse<ResolveVulnerableSymbolsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
429 Too many requests -
+ */ + public ApiResponse + createSCAResolveVulnerableSymbolsWithHttpInfo(ResolveVulnerableSymbolsRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createSCAResolveVulnerableSymbols"; + 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 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling createSCAResolveVulnerableSymbols"); + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis-sca/vulnerabilities/resolve-vulnerable-symbols"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createSCAResolveVulnerableSymbols", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * POST request to resolve vulnerable symbols. + * + *

See {@link #createSCAResolveVulnerableSymbolsWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<ResolveVulnerableSymbolsResponse>> + */ + public CompletableFuture> + createSCAResolveVulnerableSymbolsWithHttpInfoAsync(ResolveVulnerableSymbolsRequest body) { + // Check if unstable operation is enabled + String operationId = "createSCAResolveVulnerableSymbols"; + 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 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " createSCAResolveVulnerableSymbols")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis-sca/vulnerabilities/resolve-vulnerable-symbols"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createSCAResolveVulnerableSymbols", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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, + new GenericType() {}); + } + + /** + * Post dependencies for analysis. + * + *

See {@link #createSCAResultWithHttpInfo}. + * + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void createSCAResult(ScaRequest body) throws ApiException { + createSCAResultWithHttpInfo(body); + } + + /** + * Post dependencies for analysis. + * + *

See {@link #createSCAResultWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture createSCAResultAsync(ScaRequest body) { + return createSCAResultWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * @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 OK -
429 Too many requests -
+ */ + public ApiResponse createSCAResultWithHttpInfo(ScaRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createSCAResult"; + 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 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createSCAResult"); + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis-sca/dependencies"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createSCAResult", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Post dependencies for analysis. + * + *

See {@link #createSCAResultWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> createSCAResultWithHttpInfoAsync(ScaRequest body) { + // Check if unstable operation is enabled + String operationId = "createSCAResult"; + 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 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createSCAResult")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis-sca/dependencies"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createSCAResult", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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); + } + + /** + * Delete an AI custom rule. + * + *

See {@link #deleteAiCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @throws ApiException if fails to make API call + */ + public void deleteAiCustomRule(String rulesetName, String ruleName) throws ApiException { + deleteAiCustomRuleWithHttpInfo(rulesetName, ruleName); + } + + /** + * Delete an AI custom rule. + * + *

See {@link #deleteAiCustomRuleWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteAiCustomRuleAsync(String rulesetName, String ruleName) { + return deleteAiCustomRuleWithHttpInfoAsync(rulesetName, ruleName) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an AI custom rule by name within a ruleset. + * + * @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 -
404 Rule not found -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse deleteAiCustomRuleWithHttpInfo(String rulesetName, String ruleName) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteAiCustomRule"; + 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 deleteAiCustomRule"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling deleteAiCustomRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/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.deleteAiCustomRule", + 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 an AI custom rule. + * + *

See {@link #deleteAiCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteAiCustomRuleWithHttpInfoAsync( + String rulesetName, String ruleName) { + // Check if unstable operation is enabled + String operationId = "deleteAiCustomRule"; + 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 deleteAiCustomRule")); + 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 deleteAiCustomRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/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.deleteAiCustomRule", + 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 an AI custom ruleset. + * + *

See {@link #deleteAiCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @throws ApiException if fails to make API call + */ + public void deleteAiCustomRuleset(String rulesetName) throws ApiException { + deleteAiCustomRulesetWithHttpInfo(rulesetName); + } + + /** + * Delete an AI custom ruleset. + * + *

See {@link #deleteAiCustomRulesetWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteAiCustomRulesetAsync(String rulesetName) { + return deleteAiCustomRulesetWithHttpInfoAsync(rulesetName) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an AI custom ruleset by name. + * + * @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 -
404 Ruleset not found -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse deleteAiCustomRulesetWithHttpInfo(String rulesetName) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteAiCustomRuleset"; + 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 deleteAiCustomRuleset"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.deleteAiCustomRuleset", + 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 an AI custom ruleset. + * + *

See {@link #deleteAiCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteAiCustomRulesetWithHttpInfoAsync( + String rulesetName) { + // Check if unstable operation is enabled + String operationId = "deleteAiCustomRuleset"; + 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 deleteAiCustomRuleset")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.deleteAiCustomRuleset", + 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 an AI memory violation result. + * + *

See {@link #deleteAiMemoryViolationResultWithHttpInfo}. + * + * @param id The numeric identifier of the memory violation result. (required) + * @throws ApiException if fails to make API call + */ + public void deleteAiMemoryViolationResult(String id) throws ApiException { + deleteAiMemoryViolationResultWithHttpInfo(id); + } + + /** + * Delete an AI memory violation result. + * + *

See {@link #deleteAiMemoryViolationResultWithHttpInfoAsync}. + * + * @param id The numeric identifier of the memory violation result. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteAiMemoryViolationResultAsync(String id) { + return deleteAiMemoryViolationResultWithHttpInfoAsync(id) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an AI memory violation result by its numeric identifier. + * + * @param id The numeric identifier of the memory violation result. (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 -
404 Memory violation result not found -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse deleteAiMemoryViolationResultWithHttpInfo(String id) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteAiMemoryViolationResult"; + 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 'id' is set + if (id == null) { + throw new ApiException( + 400, "Missing the required parameter 'id' when calling deleteAiMemoryViolationResult"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/memory/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.deleteAiMemoryViolationResult", + 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 an AI memory violation result. + * + *

See {@link #deleteAiMemoryViolationResultWithHttpInfo}. + * + * @param id The numeric identifier of the memory violation result. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteAiMemoryViolationResultWithHttpInfoAsync( + String id) { + // Check if unstable operation is enabled + String operationId = "deleteAiMemoryViolationResult"; + 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 'id' is set + if (id == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'id' when calling deleteAiMemoryViolationResult")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/memory/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.deleteAiMemoryViolationResult", + 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 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); + } + + /** + * Get an AI custom rule. + * + *

See {@link #getAiCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @return AiCustomRuleResponse + * @throws ApiException if fails to make API call + */ + public AiCustomRuleResponse getAiCustomRule(String rulesetName, String ruleName) + throws ApiException { + return getAiCustomRuleWithHttpInfo(rulesetName, ruleName).getData(); + } + + /** + * Get an AI custom rule. + * + *

See {@link #getAiCustomRuleWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @return CompletableFuture<AiCustomRuleResponse> + */ + public CompletableFuture getAiCustomRuleAsync( + String rulesetName, String ruleName) { + return getAiCustomRuleWithHttpInfoAsync(rulesetName, ruleName) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get an AI custom rule by name within a ruleset. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @return ApiResponse<AiCustomRuleResponse> + * @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 -
404 Rule not found -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse getAiCustomRuleWithHttpInfo( + String rulesetName, String ruleName) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getAiCustomRule"; + 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 getAiCustomRule"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling getAiCustomRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/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.getAiCustomRule", + 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() {}); + } + + /** + * Get an AI custom rule. + * + *

See {@link #getAiCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @return CompletableFuture<ApiResponse<AiCustomRuleResponse>> + */ + public CompletableFuture> getAiCustomRuleWithHttpInfoAsync( + String rulesetName, String ruleName) { + // Check if unstable operation is enabled + String operationId = "getAiCustomRule"; + 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 getAiCustomRule")); + 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 getAiCustomRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/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.getAiCustomRule", + 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() {}); + } + + /** + * Get an AI custom rule revision. + * + *

See {@link #getAiCustomRuleRevisionWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @param id The revision identifier. (required) + * @return AiCustomRuleRevisionResponse + * @throws ApiException if fails to make API call + */ + public AiCustomRuleRevisionResponse getAiCustomRuleRevision( + String rulesetName, String ruleName, String id) throws ApiException { + return getAiCustomRuleRevisionWithHttpInfo(rulesetName, ruleName, id).getData(); + } + + /** + * Get an AI custom rule revision. + * + *

See {@link #getAiCustomRuleRevisionWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @param id The revision identifier. (required) + * @return CompletableFuture<AiCustomRuleRevisionResponse> + */ + public CompletableFuture getAiCustomRuleRevisionAsync( + String rulesetName, String ruleName, String id) { + return getAiCustomRuleRevisionWithHttpInfoAsync(rulesetName, ruleName, id) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a specific revision of an AI custom rule. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @param id The revision identifier. (required) + * @return ApiResponse<AiCustomRuleRevisionResponse> + * @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 -
404 Revision not found -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse getAiCustomRuleRevisionWithHttpInfo( + String rulesetName, String ruleName, String id) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getAiCustomRuleRevision"; + 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 getAiCustomRuleRevision"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling getAiCustomRuleRevision"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + 400, "Missing the required parameter 'id' when calling getAiCustomRuleRevision"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/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.getAiCustomRuleRevision", + 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() {}); + } + + /** + * Get an AI custom rule revision. + * + *

See {@link #getAiCustomRuleRevisionWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @param id The revision identifier. (required) + * @return CompletableFuture<ApiResponse<AiCustomRuleRevisionResponse>> + */ + public CompletableFuture> + getAiCustomRuleRevisionWithHttpInfoAsync(String rulesetName, String ruleName, String id) { + // Check if unstable operation is enabled + String operationId = "getAiCustomRuleRevision"; + 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 getAiCustomRuleRevision")); + 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 getAiCustomRuleRevision")); + 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 getAiCustomRuleRevision")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/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.getAiCustomRuleRevision", + 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() {}); + } + + /** + * Get an AI custom ruleset. + * + *

See {@link #getAiCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @return AiCustomRulesetResponse + * @throws ApiException if fails to make API call + */ + public AiCustomRulesetResponse getAiCustomRuleset(String rulesetName) throws ApiException { + return getAiCustomRulesetWithHttpInfo(rulesetName).getData(); + } + + /** + * Get an AI custom ruleset. + * + *

See {@link #getAiCustomRulesetWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name. (required) + * @return CompletableFuture<AiCustomRulesetResponse> + */ + public CompletableFuture getAiCustomRulesetAsync(String rulesetName) { + return getAiCustomRulesetWithHttpInfoAsync(rulesetName) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get an AI custom ruleset by name. + * + * @param rulesetName The ruleset name. (required) + * @return ApiResponse<AiCustomRulesetResponse> + * @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 -
404 Ruleset not found -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse getAiCustomRulesetWithHttpInfo(String rulesetName) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getAiCustomRuleset"; + 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 getAiCustomRuleset"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.getAiCustomRuleset", + 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() {}); + } + + /** + * Get an AI custom ruleset. + * + *

See {@link #getAiCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @return CompletableFuture<ApiResponse<AiCustomRulesetResponse>> + */ + public CompletableFuture> + getAiCustomRulesetWithHttpInfoAsync(String rulesetName) { + // Check if unstable operation is enabled + String operationId = "getAiCustomRuleset"; + 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 getAiCustomRuleset")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.getAiCustomRuleset", + 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. + * + *

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

See {@link #getCustomRuleWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return CompletableFuture<CustomRuleResponse> + */ + public CompletableFuture getCustomRuleAsync( + String rulesetName, String ruleName) { + return getCustomRuleWithHttpInfoAsync(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 getCustomRuleWithHttpInfo( + String rulesetName, String ruleName) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getCustomRule"; + 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 getCustomRule"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling getCustomRule"); + } + // 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.getCustomRule", + 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 #getCustomRuleWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @return CompletableFuture<ApiResponse<CustomRuleResponse>> + */ + public CompletableFuture> getCustomRuleWithHttpInfoAsync( + String rulesetName, String ruleName) { + // Check if unstable operation is enabled + String operationId = "getCustomRule"; + 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 getCustomRule")); + 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 getCustomRule")); + 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.getCustomRule", + 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 #getCustomRuleRevisionWithHttpInfo}. + * + * @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 getCustomRuleRevision( + String rulesetName, String ruleName, String id) throws ApiException { + return getCustomRuleRevisionWithHttpInfo(rulesetName, ruleName, id).getData(); + } + + /** + * Show Custom Rule Revision. + * + *

See {@link #getCustomRuleRevisionWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param id The revision ID (required) + * @return CompletableFuture<CustomRuleRevisionResponse> + */ + public CompletableFuture getCustomRuleRevisionAsync( + String rulesetName, String ruleName, String id) { + return getCustomRuleRevisionWithHttpInfoAsync(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 getCustomRuleRevisionWithHttpInfo( + String rulesetName, String ruleName, String id) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getCustomRuleRevision"; + 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 getCustomRuleRevision"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling getCustomRuleRevision"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + 400, "Missing the required parameter 'id' when calling getCustomRuleRevision"); + } + // 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.getCustomRuleRevision", + 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 #getCustomRuleRevisionWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @param ruleName The rule name (required) + * @param id The revision ID (required) + * @return CompletableFuture<ApiResponse<CustomRuleRevisionResponse>> + */ + public CompletableFuture> + getCustomRuleRevisionWithHttpInfoAsync(String rulesetName, String ruleName, String id) { + // Check if unstable operation is enabled + String operationId = "getCustomRuleRevision"; + 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 getCustomRuleRevision")); + 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 getCustomRuleRevision")); + 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 getCustomRuleRevision")); + 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.getCustomRuleRevision", + 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 #getCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @return CustomRulesetResponse + * @throws ApiException if fails to make API call + */ + public CustomRulesetResponse getCustomRuleset(String rulesetName) throws ApiException { + return getCustomRulesetWithHttpInfo(rulesetName).getData(); + } + + /** + * Show Custom Ruleset. + * + *

See {@link #getCustomRulesetWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name (required) + * @return CompletableFuture<CustomRulesetResponse> + */ + public CompletableFuture getCustomRulesetAsync(String rulesetName) { + return getCustomRulesetWithHttpInfoAsync(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 getCustomRulesetWithHttpInfo(String rulesetName) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getCustomRuleset"; + 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 getCustomRuleset"); + } + // 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.getCustomRuleset", + 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 #getCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name (required) + * @return CompletableFuture<ApiResponse<CustomRulesetResponse>> + */ + public CompletableFuture> getCustomRulesetWithHttpInfoAsync( + String rulesetName) { + // Check if unstable operation is enabled + String operationId = "getCustomRuleset"; + 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 getCustomRuleset")); + 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.getCustomRuleset", + 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() {}); + } + + /** Manage optional parameters to listAiCustomRuleRevisions. */ + public static class ListAiCustomRuleRevisionsOptionalParameters { + private Long pageOffset; + private Long pageLimit; + + /** + * Set pageOffset. + * + * @param pageOffset The offset for pagination. (optional, default to 0) + * @return ListAiCustomRuleRevisionsOptionalParameters + */ + public ListAiCustomRuleRevisionsOptionalParameters pageOffset(Long pageOffset) { + this.pageOffset = pageOffset; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit The maximum number of revisions to return. (optional, default to 100) + * @return ListAiCustomRuleRevisionsOptionalParameters + */ + public ListAiCustomRuleRevisionsOptionalParameters pageLimit(Long pageLimit) { + this.pageLimit = pageLimit; + return this; + } + } + + /** + * List AI custom rule revisions. + * + *

See {@link #listAiCustomRuleRevisionsWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @return AiCustomRuleRevisionsResponse + * @throws ApiException if fails to make API call + */ + public AiCustomRuleRevisionsResponse listAiCustomRuleRevisions( + String rulesetName, String ruleName) throws ApiException { + return listAiCustomRuleRevisionsWithHttpInfo( + rulesetName, ruleName, new ListAiCustomRuleRevisionsOptionalParameters()) + .getData(); + } + + /** + * List AI custom rule revisions. + * + *

See {@link #listAiCustomRuleRevisionsWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @return CompletableFuture<AiCustomRuleRevisionsResponse> + */ + public CompletableFuture listAiCustomRuleRevisionsAsync( + String rulesetName, String ruleName) { + return listAiCustomRuleRevisionsWithHttpInfoAsync( + rulesetName, ruleName, new ListAiCustomRuleRevisionsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List AI custom rule revisions. + * + *

See {@link #listAiCustomRuleRevisionsWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @param parameters Optional parameters for the request. + * @return AiCustomRuleRevisionsResponse + * @throws ApiException if fails to make API call + */ + public AiCustomRuleRevisionsResponse listAiCustomRuleRevisions( + String rulesetName, String ruleName, ListAiCustomRuleRevisionsOptionalParameters parameters) + throws ApiException { + return listAiCustomRuleRevisionsWithHttpInfo(rulesetName, ruleName, parameters).getData(); + } + + /** + * List AI custom rule revisions. + * + *

See {@link #listAiCustomRuleRevisionsWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<AiCustomRuleRevisionsResponse> + */ + public CompletableFuture listAiCustomRuleRevisionsAsync( + String rulesetName, String ruleName, ListAiCustomRuleRevisionsOptionalParameters parameters) { + return listAiCustomRuleRevisionsWithHttpInfoAsync(rulesetName, ruleName, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List AI custom rule revisions. + * + *

See {@link #listAiCustomRuleRevisionsWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @return PaginationIterable<AiCustomRuleRevisionResponseData> + */ + public PaginationIterable + listAiCustomRuleRevisionsWithPagination(String rulesetName, String ruleName) { + ListAiCustomRuleRevisionsOptionalParameters parameters = + new ListAiCustomRuleRevisionsOptionalParameters(); + return listAiCustomRuleRevisionsWithPagination(rulesetName, ruleName, parameters); + } + + /** + * List AI custom rule revisions. + * + *

See {@link #listAiCustomRuleRevisionsWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @return AiCustomRuleRevisionsResponse + */ + public PaginationIterable + listAiCustomRuleRevisionsWithPagination( + String rulesetName, + String ruleName, + ListAiCustomRuleRevisionsOptionalParameters parameters) { + String resultsPath = "getData"; + String valueGetterPath = ""; + String valueSetterPath = "pageOffset"; + Boolean valueSetterParamOptional = true; + Long limit; + + if (parameters.pageLimit == null) { + limit = 100l; + parameters.pageLimit(limit); + } else { + limit = parameters.pageLimit; + } + + LinkedHashMap args = new LinkedHashMap(); + args.put("rulesetName", rulesetName); + args.put("ruleName", ruleName); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "listAiCustomRuleRevisions", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + true, + false, + limit, + args, + 0); + + return iterator; + } + + /** + * Get all revisions for an AI custom rule. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<AiCustomRuleRevisionsResponse> + * @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 -
404 Rule not found -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse listAiCustomRuleRevisionsWithHttpInfo( + String rulesetName, String ruleName, ListAiCustomRuleRevisionsOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listAiCustomRuleRevisions"; + 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 listAiCustomRuleRevisions"); + } + + // verify the required parameter 'ruleName' is set + if (ruleName == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleName' when calling listAiCustomRuleRevisions"); + } + Long pageOffset = parameters.pageOffset; + Long pageLimit = parameters.pageLimit; + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/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.listAiCustomRuleRevisions", + 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 AI custom rule revisions. + * + *

See {@link #listAiCustomRuleRevisionsWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param ruleName The rule name. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<AiCustomRuleRevisionsResponse>> + */ + public CompletableFuture> + listAiCustomRuleRevisionsWithHttpInfoAsync( + String rulesetName, + String ruleName, + ListAiCustomRuleRevisionsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listAiCustomRuleRevisions"; + 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" + + " listAiCustomRuleRevisions")); + 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 listAiCustomRuleRevisions")); + return result; + } + Long pageOffset = parameters.pageOffset; + Long pageLimit = parameters.pageLimit; + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/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.listAiCustomRuleRevisions", + 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() {}); + } + + /** Manage optional parameters to listAiCustomRulesets. */ + public static class ListAiCustomRulesetsOptionalParameters { + private Long pageOffset; + private Long pageLimit; + + /** + * Set pageOffset. + * + * @param pageOffset The offset for pagination. (optional, default to 0) + * @return ListAiCustomRulesetsOptionalParameters + */ + public ListAiCustomRulesetsOptionalParameters pageOffset(Long pageOffset) { + this.pageOffset = pageOffset; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit The maximum number of rulesets to return. (optional, default to 100) + * @return ListAiCustomRulesetsOptionalParameters + */ + public ListAiCustomRulesetsOptionalParameters pageLimit(Long pageLimit) { + this.pageLimit = pageLimit; + return this; + } + } + + /** + * List AI custom rulesets. + * + *

See {@link #listAiCustomRulesetsWithHttpInfo}. + * + * @return AiCustomRulesetsResponse + * @throws ApiException if fails to make API call + */ + public AiCustomRulesetsResponse listAiCustomRulesets() throws ApiException { + return listAiCustomRulesetsWithHttpInfo(new ListAiCustomRulesetsOptionalParameters()).getData(); + } + + /** + * List AI custom rulesets. + * + *

See {@link #listAiCustomRulesetsWithHttpInfoAsync}. + * + * @return CompletableFuture<AiCustomRulesetsResponse> + */ + public CompletableFuture listAiCustomRulesetsAsync() { + return listAiCustomRulesetsWithHttpInfoAsync(new ListAiCustomRulesetsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List AI custom rulesets. * - *

See {@link #getCustomRuleWithHttpInfo}. + *

See {@link #listAiCustomRulesetsWithHttpInfo}. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) - * @return CustomRuleResponse + * @param parameters Optional parameters for the request. + * @return AiCustomRulesetsResponse * @throws ApiException if fails to make API call */ - public CustomRuleResponse getCustomRule(String rulesetName, String ruleName) throws ApiException { - return getCustomRuleWithHttpInfo(rulesetName, ruleName).getData(); + public AiCustomRulesetsResponse listAiCustomRulesets( + ListAiCustomRulesetsOptionalParameters parameters) throws ApiException { + return listAiCustomRulesetsWithHttpInfo(parameters).getData(); } /** - * Show Custom Rule. + * List AI custom rulesets. * - *

See {@link #getCustomRuleWithHttpInfoAsync}. + *

See {@link #listAiCustomRulesetsWithHttpInfoAsync}. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) - * @return CompletableFuture<CustomRuleResponse> + * @param parameters Optional parameters for the request. + * @return CompletableFuture<AiCustomRulesetsResponse> */ - public CompletableFuture getCustomRuleAsync( - String rulesetName, String ruleName) { - return getCustomRuleWithHttpInfoAsync(rulesetName, ruleName) + public CompletableFuture listAiCustomRulesetsAsync( + ListAiCustomRulesetsOptionalParameters parameters) { + return listAiCustomRulesetsWithHttpInfoAsync(parameters) .thenApply( response -> { return response.getData(); @@ -1090,59 +3891,47 @@ public CompletableFuture getCustomRuleAsync( } /** - * Get a custom rule by name + * Get all AI custom rulesets for the authenticated organization. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) - * @return ApiResponse<CustomRuleResponse> + * @param parameters Optional parameters for the request. + * @return ApiResponse<AiCustomRulesetsResponse> * @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 -
401 Unauthorized -
429 Too many requests -
500 Internal Server Error -
*/ - public ApiResponse getCustomRuleWithHttpInfo( - String rulesetName, String ruleName) throws ApiException { + public ApiResponse listAiCustomRulesetsWithHttpInfo( + ListAiCustomRulesetsOptionalParameters parameters) throws ApiException { // Check if unstable operation is enabled - String operationId = "getCustomRule"; + String operationId = "listAiCustomRulesets"; 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 getCustomRule"); - } - - // verify the required parameter 'ruleName' is set - if (ruleName == null) { - throw new ApiException( - 400, "Missing the required parameter 'ruleName' when calling getCustomRule"); - } + Long pageOffset = parameters.pageOffset; + Long pageLimit = parameters.pageLimit; // 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())); + String localVarPath = "/api/v2/static-analysis/ai/rulesets"; + 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.getCustomRule", + "v2.StaticAnalysisApi.listAiCustomRulesets", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, @@ -1155,71 +3944,54 @@ public ApiResponse getCustomRuleWithHttpInfo( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Show Custom Rule. + * List AI custom rulesets. * - *

See {@link #getCustomRuleWithHttpInfo}. + *

See {@link #listAiCustomRulesetsWithHttpInfo}. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) - * @return CompletableFuture<ApiResponse<CustomRuleResponse>> + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<AiCustomRulesetsResponse>> */ - public CompletableFuture> getCustomRuleWithHttpInfoAsync( - String rulesetName, String ruleName) { + public CompletableFuture> + listAiCustomRulesetsWithHttpInfoAsync(ListAiCustomRulesetsOptionalParameters parameters) { // Check if unstable operation is enabled - String operationId = "getCustomRule"; + String operationId = "listAiCustomRulesets"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = new CompletableFuture<>(); + 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 getCustomRule")); - 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 getCustomRule")); - return result; - } + Long pageOffset = parameters.pageOffset; + Long pageLimit = parameters.pageLimit; // 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())); + String localVarPath = "/api/v2/static-analysis/ai/rulesets"; + 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.getCustomRule", + "v2.StaticAnalysisApi.listAiCustomRulesets", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -1231,38 +4003,30 @@ public CompletableFuture> getCustomRuleWithHttpI localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Show Custom Rule Revision. + * List AI memory violation results. * - *

See {@link #getCustomRuleRevisionWithHttpInfo}. + *

See {@link #listAiMemoryViolationResultsWithHttpInfo}. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) - * @param id The revision ID (required) - * @return CustomRuleRevisionResponse + * @return AiMemoryViolationResultsResponse * @throws ApiException if fails to make API call */ - public CustomRuleRevisionResponse getCustomRuleRevision( - String rulesetName, String ruleName, String id) throws ApiException { - return getCustomRuleRevisionWithHttpInfo(rulesetName, ruleName, id).getData(); + public AiMemoryViolationResultsResponse listAiMemoryViolationResults() throws ApiException { + return listAiMemoryViolationResultsWithHttpInfo().getData(); } /** - * Show Custom Rule Revision. + * List AI memory violation results. * - *

See {@link #getCustomRuleRevisionWithHttpInfoAsync}. + *

See {@link #listAiMemoryViolationResultsWithHttpInfoAsync}. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) - * @param id The revision ID (required) - * @return CompletableFuture<CustomRuleRevisionResponse> + * @return CompletableFuture<AiMemoryViolationResultsResponse> */ - public CompletableFuture getCustomRuleRevisionAsync( - String rulesetName, String ruleName, String id) { - return getCustomRuleRevisionWithHttpInfoAsync(rulesetName, ruleName, id) + public CompletableFuture listAiMemoryViolationResultsAsync() { + return listAiMemoryViolationResultsWithHttpInfoAsync() .thenApply( response -> { return response.getData(); @@ -1270,65 +4034,40 @@ public CompletableFuture getCustomRuleRevisionAsync( } /** - * Get a specific revision of a custom rule + * Get all AI memory violation results for the authenticated organization. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) - * @param id The revision ID (required) - * @return ApiResponse<CustomRuleRevisionResponse> + * @return ApiResponse<AiMemoryViolationResultsResponse> * @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 -
400 Bad Request -
401 Unauthorized -
404 Not Found -
429 Too many requests -
500 Internal Server Error -
*/ - public ApiResponse getCustomRuleRevisionWithHttpInfo( - String rulesetName, String ruleName, String id) throws ApiException { + public ApiResponse listAiMemoryViolationResultsWithHttpInfo() + throws ApiException { // Check if unstable operation is enabled - String operationId = "getCustomRuleRevision"; + String operationId = "listAiMemoryViolationResults"; 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 getCustomRuleRevision"); - } - - // verify the required parameter 'ruleName' is set - if (ruleName == null) { - throw new ApiException( - 400, "Missing the required parameter 'ruleName' when calling getCustomRuleRevision"); - } - - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException( - 400, "Missing the required parameter 'id' when calling getCustomRuleRevision"); - } // 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())); + String localVarPath = "/api/v2/static-analysis/ai/memory"; Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.getCustomRuleRevision", + "v2.StaticAnalysisApi.listAiMemoryViolationResults", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1343,67 +4082,32 @@ public ApiResponse getCustomRuleRevisionWithHttpInfo localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Show Custom Rule Revision. + * List AI memory violation results. * - *

See {@link #getCustomRuleRevisionWithHttpInfo}. + *

See {@link #listAiMemoryViolationResultsWithHttpInfo}. * - * @param rulesetName The ruleset name (required) - * @param ruleName The rule name (required) - * @param id The revision ID (required) - * @return CompletableFuture<ApiResponse<CustomRuleRevisionResponse>> + * @return CompletableFuture<ApiResponse<AiMemoryViolationResultsResponse>> */ - public CompletableFuture> - getCustomRuleRevisionWithHttpInfoAsync(String rulesetName, String ruleName, String id) { + public CompletableFuture> + listAiMemoryViolationResultsWithHttpInfoAsync() { // Check if unstable operation is enabled - String operationId = "getCustomRuleRevision"; + String operationId = "listAiMemoryViolationResults"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = new CompletableFuture<>(); + 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 getCustomRuleRevision")); - 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 getCustomRuleRevision")); - 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 getCustomRuleRevision")); - 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())); + String localVarPath = "/api/v2/static-analysis/ai/memory"; Map localVarHeaderParams = new HashMap(); @@ -1411,7 +4115,7 @@ public ApiResponse getCustomRuleRevisionWithHttpInfo try { builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.getCustomRuleRevision", + "v2.StaticAnalysisApi.listAiMemoryViolationResults", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1419,7 +4123,8 @@ public ApiResponse getCustomRuleRevisionWithHttpInfo new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = + new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -1431,32 +4136,30 @@ public ApiResponse getCustomRuleRevisionWithHttpInfo localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Show Custom Ruleset. + * List AI prompts. * - *

See {@link #getCustomRulesetWithHttpInfo}. + *

See {@link #listAiPromptsWithHttpInfo}. * - * @param rulesetName The ruleset name (required) - * @return CustomRulesetResponse + * @return AiPromptsResponse * @throws ApiException if fails to make API call */ - public CustomRulesetResponse getCustomRuleset(String rulesetName) throws ApiException { - return getCustomRulesetWithHttpInfo(rulesetName).getData(); + public AiPromptsResponse listAiPrompts() throws ApiException { + return listAiPromptsWithHttpInfo().getData(); } /** - * Show Custom Ruleset. + * List AI prompts. * - *

See {@link #getCustomRulesetWithHttpInfoAsync}. + *

See {@link #listAiPromptsWithHttpInfoAsync}. * - * @param rulesetName The ruleset name (required) - * @return CompletableFuture<CustomRulesetResponse> + * @return CompletableFuture<AiPromptsResponse> */ - public CompletableFuture getCustomRulesetAsync(String rulesetName) { - return getCustomRulesetWithHttpInfoAsync(rulesetName) + public CompletableFuture listAiPromptsAsync() { + return listAiPromptsWithHttpInfoAsync() .thenApply( response -> { return response.getData(); @@ -1464,49 +4167,40 @@ public CompletableFuture getCustomRulesetAsync(String rul } /** - * Get a custom ruleset by name + * Get all AI prompts, including default prompts and custom AI rule prompts for the authenticated + * organization. * - * @param rulesetName The ruleset name (required) - * @return ApiResponse<CustomRulesetResponse> + * @return ApiResponse<AiPromptsResponse> * @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 -
400 Bad Request -
401 Unauthorized -
404 Not Found -
429 Too many requests -
500 Internal Server Error -
*/ - public ApiResponse getCustomRulesetWithHttpInfo(String rulesetName) - throws ApiException { + public ApiResponse listAiPromptsWithHttpInfo() throws ApiException { // Check if unstable operation is enabled - String operationId = "getCustomRuleset"; + String operationId = "listAiPrompts"; 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 getCustomRuleset"); - } // create path and map variables - String localVarPath = - "/api/v2/static-analysis/custom/rulesets/{ruleset_name}" - .replaceAll( - "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + String localVarPath = "/api/v2/static-analysis/ai/prompts"; Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.getCustomRuleset", + "v2.StaticAnalysisApi.listAiPrompts", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1521,44 +4215,30 @@ public ApiResponse getCustomRulesetWithHttpInfo(String ru localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Show Custom Ruleset. + * List AI prompts. * - *

See {@link #getCustomRulesetWithHttpInfo}. + *

See {@link #listAiPromptsWithHttpInfo}. * - * @param rulesetName The ruleset name (required) - * @return CompletableFuture<ApiResponse<CustomRulesetResponse>> + * @return CompletableFuture<ApiResponse<AiPromptsResponse>> */ - public CompletableFuture> getCustomRulesetWithHttpInfoAsync( - String rulesetName) { + public CompletableFuture> listAiPromptsWithHttpInfoAsync() { // Check if unstable operation is enabled - String operationId = "getCustomRuleset"; - 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<>(); + String operationId = "listAiPrompts"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( - new ApiException( - 400, "Missing the required parameter 'rulesetName' when calling getCustomRuleset")); + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; } + Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/api/v2/static-analysis/custom/rulesets/{ruleset_name}" - .replaceAll( - "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + String localVarPath = "/api/v2/static-analysis/ai/prompts"; Map localVarHeaderParams = new HashMap(); @@ -1566,7 +4246,7 @@ public CompletableFuture> getCustomRulesetWit try { builder = apiClient.createBuilder( - "v2.StaticAnalysisApi.getCustomRuleset", + "v2.StaticAnalysisApi.listAiPrompts", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1574,7 +4254,7 @@ public CompletableFuture> getCustomRulesetWit new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -1586,7 +4266,7 @@ public CompletableFuture> getCustomRulesetWit localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** Manage optional parameters to listCustomRuleRevisions. */ @@ -1920,6 +4600,134 @@ public ApiResponse listCustomRuleRevisionsWithHttpI new GenericType() {}); } + /** + * List Custom Rulesets. + * + *

See {@link #listCustomRulesetsWithHttpInfo}. + * + * @return CustomRulesetListResponse + * @throws ApiException if fails to make API call + */ + public CustomRulesetListResponse listCustomRulesets() throws ApiException { + return listCustomRulesetsWithHttpInfo().getData(); + } + + /** + * List Custom Rulesets. + * + *

See {@link #listCustomRulesetsWithHttpInfoAsync}. + * + * @return CompletableFuture<CustomRulesetListResponse> + */ + public CompletableFuture listCustomRulesetsAsync() { + return listCustomRulesetsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all custom rulesets for the authenticated organization. + * + * @return ApiResponse<CustomRulesetListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse listCustomRulesetsWithHttpInfo() + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listCustomRulesets"; + 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; + // create path and map variables + String localVarPath = "/api/v2/static-analysis/custom/rulesets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.listCustomRulesets", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List Custom Rulesets. + * + *

See {@link #listCustomRulesetsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<CustomRulesetListResponse>> + */ + public CompletableFuture> + listCustomRulesetsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listCustomRulesets"; + 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; + // create path and map variables + String localVarPath = "/api/v2/static-analysis/custom/rulesets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.listCustomRulesets", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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. * @@ -2121,6 +4929,183 @@ public CompletableFuture> revertCustomRuleRevisionWithHttpInfo null); } + /** + * Update an AI custom ruleset. + * + *

See {@link #updateAiCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void updateAiCustomRuleset(String rulesetName, AiCustomRulesetUpdateRequest body) + throws ApiException { + updateAiCustomRulesetWithHttpInfo(rulesetName, body); + } + + /** + * Update an AI custom ruleset. + * + *

See {@link #updateAiCustomRulesetWithHttpInfoAsync}. + * + * @param rulesetName The ruleset name. (required) + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture updateAiCustomRulesetAsync( + String rulesetName, AiCustomRulesetUpdateRequest body) { + return updateAiCustomRulesetWithHttpInfoAsync(rulesetName, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update the description of an existing AI custom ruleset. + * + * @param rulesetName The ruleset 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 updated -
400 Bad Request -
401 Unauthorized -
412 Precondition Failed - validation error or ruleset not found -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse updateAiCustomRulesetWithHttpInfo( + String rulesetName, AiCustomRulesetUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateAiCustomRuleset"; + 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 updateAiCustomRuleset"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateAiCustomRuleset"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.updateAiCustomRuleset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Update an AI custom ruleset. + * + *

See {@link #updateAiCustomRulesetWithHttpInfo}. + * + * @param rulesetName The ruleset name. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> updateAiCustomRulesetWithHttpInfoAsync( + String rulesetName, AiCustomRulesetUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateAiCustomRuleset"; + 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 updateAiCustomRuleset")); + 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 updateAiCustomRuleset")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis/ai/rulesets/{ruleset_name}" + .replaceAll( + "\\{" + "ruleset_name" + "\\}", apiClient.escapeString(rulesetName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.updateAiCustomRuleset", + 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( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Update Custom Ruleset. * diff --git a/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleDataType.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleDataType.java new file mode 100644 index 00000000000..47107d49878 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleDataType.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; + +/** AI custom rule resource type. */ +@JsonSerialize(using = AiCustomRuleDataType.AiCustomRuleDataTypeSerializer.class) +public class AiCustomRuleDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("ai_rule")); + + public static final AiCustomRuleDataType AI_RULE = new AiCustomRuleDataType("ai_rule"); + + AiCustomRuleDataType(String value) { + super(value, allowedValues); + } + + public static class AiCustomRuleDataTypeSerializer extends StdSerializer { + public AiCustomRuleDataTypeSerializer(Class t) { + super(t); + } + + public AiCustomRuleDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AiCustomRuleDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AiCustomRuleDataType fromValue(String value) { + return new AiCustomRuleDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleItem.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleItem.java new file mode 100644 index 00000000000..a492575d613 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleItem.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; + +/** An AI custom rule embedded within a ruleset response. */ +@JsonPropertyOrder({ + AiCustomRuleItem.JSON_PROPERTY_CREATED_AT, + AiCustomRuleItem.JSON_PROPERTY_CREATED_BY, + AiCustomRuleItem.JSON_PROPERTY_LAST_REVISION, + AiCustomRuleItem.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleItem { + @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 AiCustomRuleRevisionResponseAttributes lastRevision; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public AiCustomRuleItem() {} + + @JsonCreator + public AiCustomRuleItem( + @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) + AiCustomRuleRevisionResponseAttributes 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 AiCustomRuleItem createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The 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 AiCustomRuleItem createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The identifier of the user who created the rule. + * + * @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 AiCustomRuleItem lastRevision(AiCustomRuleRevisionResponseAttributes lastRevision) { + this.lastRevision = lastRevision; + this.unparsed |= lastRevision.unparsed; + return this; + } + + /** + * Response attributes of an AI custom rule revision. + * + * @return lastRevision + */ + @JsonProperty(JSON_PROPERTY_LAST_REVISION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRuleRevisionResponseAttributes getLastRevision() { + return lastRevision; + } + + public void setLastRevision(AiCustomRuleRevisionResponseAttributes lastRevision) { + this.lastRevision = lastRevision; + } + + public AiCustomRuleItem name(String name) { + this.name = name; + return this; + } + + /** + * The 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 AiCustomRuleItem + */ + @JsonAnySetter + public AiCustomRuleItem 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 AiCustomRuleItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleItem aiCustomRuleItem = (AiCustomRuleItem) o; + return Objects.equals(this.createdAt, aiCustomRuleItem.createdAt) + && Objects.equals(this.createdBy, aiCustomRuleItem.createdBy) + && Objects.equals(this.lastRevision, aiCustomRuleItem.lastRevision) + && Objects.equals(this.name, aiCustomRuleItem.name) + && Objects.equals(this.additionalProperties, aiCustomRuleItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, createdBy, lastRevision, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleItem {\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/AiCustomRuleRequest.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRequest.java new file mode 100644 index 00000000000..14e4f4357c3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRequest.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; + +/** Request body for creating an AI custom rule. */ +@JsonPropertyOrder({AiCustomRuleRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AiCustomRuleRequestData data; + + public AiCustomRuleRequest data(AiCustomRuleRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Request data for creating an AI custom rule. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRuleRequestData getData() { + return data; + } + + public void setData(AiCustomRuleRequestData 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 AiCustomRuleRequest + */ + @JsonAnySetter + public AiCustomRuleRequest 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 AiCustomRuleRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleRequest aiCustomRuleRequest = (AiCustomRuleRequest) o; + return Objects.equals(this.data, aiCustomRuleRequest.data) + && Objects.equals(this.additionalProperties, aiCustomRuleRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleRequest {\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/AiCustomRuleRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRequestAttributes.java new file mode 100644 index 00000000000..c3e13603363 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRequestAttributes.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; + +/** Attributes for creating an AI custom rule. */ +@JsonPropertyOrder({AiCustomRuleRequestAttributes.JSON_PROPERTY_NAME}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public AiCustomRuleRequestAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The 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 AiCustomRuleRequestAttributes + */ + @JsonAnySetter + public AiCustomRuleRequestAttributes 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 AiCustomRuleRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleRequestAttributes aiCustomRuleRequestAttributes = (AiCustomRuleRequestAttributes) o; + return Objects.equals(this.name, aiCustomRuleRequestAttributes.name) + && Objects.equals( + this.additionalProperties, aiCustomRuleRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleRequestAttributes {\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/AiCustomRuleRequestData.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRequestData.java new file mode 100644 index 00000000000..f753d58d9e8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRequestData.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; + +/** Request data for creating an AI custom rule. */ +@JsonPropertyOrder({ + AiCustomRuleRequestData.JSON_PROPERTY_ATTRIBUTES, + AiCustomRuleRequestData.JSON_PROPERTY_ID, + AiCustomRuleRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AiCustomRuleRequestAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiCustomRuleDataType type; + + public AiCustomRuleRequestData attributes(AiCustomRuleRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating an AI custom rule. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRuleRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AiCustomRuleRequestAttributes attributes) { + this.attributes = attributes; + } + + public AiCustomRuleRequestData id(String id) { + this.id = id; + return this; + } + + /** + * The rule identifier, which must match the name. + * + * @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 AiCustomRuleRequestData type(AiCustomRuleDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * AI custom rule resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRuleDataType getType() { + return type; + } + + public void setType(AiCustomRuleDataType 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 AiCustomRuleRequestData + */ + @JsonAnySetter + public AiCustomRuleRequestData 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 AiCustomRuleRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleRequestData aiCustomRuleRequestData = (AiCustomRuleRequestData) o; + return Objects.equals(this.attributes, aiCustomRuleRequestData.attributes) + && Objects.equals(this.id, aiCustomRuleRequestData.id) + && Objects.equals(this.type, aiCustomRuleRequestData.type) + && Objects.equals(this.additionalProperties, aiCustomRuleRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleRequestData {\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/AiCustomRuleResponse.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleResponse.java new file mode 100644 index 00000000000..4a6d28574f7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleResponse.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; + +/** Response containing a single AI custom rule. */ +@JsonPropertyOrder({AiCustomRuleResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AiCustomRuleResponseData data; + + public AiCustomRuleResponse() {} + + @JsonCreator + public AiCustomRuleResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AiCustomRuleResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AiCustomRuleResponse data(AiCustomRuleResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Response data for an AI custom rule. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRuleResponseData getData() { + return data; + } + + public void setData(AiCustomRuleResponseData 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 AiCustomRuleResponse + */ + @JsonAnySetter + public AiCustomRuleResponse 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 AiCustomRuleResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleResponse aiCustomRuleResponse = (AiCustomRuleResponse) o; + return Objects.equals(this.data, aiCustomRuleResponse.data) + && Objects.equals(this.additionalProperties, aiCustomRuleResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleResponse {\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/AiCustomRuleResponseData.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleResponseData.java new file mode 100644 index 00000000000..b44dfcc3ac6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleResponseData.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; + +/** Response data for an AI custom rule. */ +@JsonPropertyOrder({ + AiCustomRuleResponseData.JSON_PROPERTY_ATTRIBUTES, + AiCustomRuleResponseData.JSON_PROPERTY_ID, + AiCustomRuleResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AiCustomRuleItem attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiCustomRuleDataType type; + + public AiCustomRuleResponseData() {} + + @JsonCreator + public AiCustomRuleResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) AiCustomRuleItem attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AiCustomRuleDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AiCustomRuleResponseData attributes(AiCustomRuleItem attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * An AI custom rule embedded within a ruleset response. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRuleItem getAttributes() { + return attributes; + } + + public void setAttributes(AiCustomRuleItem attributes) { + this.attributes = attributes; + } + + public AiCustomRuleResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The 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 AiCustomRuleResponseData type(AiCustomRuleDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * AI custom rule resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRuleDataType getType() { + return type; + } + + public void setType(AiCustomRuleDataType 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 AiCustomRuleResponseData + */ + @JsonAnySetter + public AiCustomRuleResponseData 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 AiCustomRuleResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleResponseData aiCustomRuleResponseData = (AiCustomRuleResponseData) o; + return Objects.equals(this.attributes, aiCustomRuleResponseData.attributes) + && Objects.equals(this.id, aiCustomRuleResponseData.id) + && Objects.equals(this.type, aiCustomRuleResponseData.type) + && Objects.equals(this.additionalProperties, aiCustomRuleResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleResponseData {\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/AiCustomRuleRevisionDataType.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionDataType.java new file mode 100644 index 00000000000..d701f178902 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionDataType.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; + +/** AI custom rule revision resource type. */ +@JsonSerialize(using = AiCustomRuleRevisionDataType.AiCustomRuleRevisionDataTypeSerializer.class) +public class AiCustomRuleRevisionDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ai_rule_revision")); + + public static final AiCustomRuleRevisionDataType AI_RULE_REVISION = + new AiCustomRuleRevisionDataType("ai_rule_revision"); + + AiCustomRuleRevisionDataType(String value) { + super(value, allowedValues); + } + + public static class AiCustomRuleRevisionDataTypeSerializer + extends StdSerializer { + public AiCustomRuleRevisionDataTypeSerializer(Class t) { + super(t); + } + + public AiCustomRuleRevisionDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AiCustomRuleRevisionDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AiCustomRuleRevisionDataType fromValue(String value) { + return new AiCustomRuleRevisionDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionExecutionMode.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionExecutionMode.java new file mode 100644 index 00000000000..3f734893516 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionExecutionMode.java @@ -0,0 +1,62 @@ +/* + * 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; + +/** The execution mode for an AI rule revision. */ +@JsonSerialize( + using = AiCustomRuleRevisionExecutionMode.AiCustomRuleRevisionExecutionModeSerializer.class) +public class AiCustomRuleRevisionExecutionMode extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("auto", "manual", "always")); + + public static final AiCustomRuleRevisionExecutionMode AUTO = + new AiCustomRuleRevisionExecutionMode("auto"); + public static final AiCustomRuleRevisionExecutionMode MANUAL = + new AiCustomRuleRevisionExecutionMode("manual"); + public static final AiCustomRuleRevisionExecutionMode ALWAYS = + new AiCustomRuleRevisionExecutionMode("always"); + + AiCustomRuleRevisionExecutionMode(String value) { + super(value, allowedValues); + } + + public static class AiCustomRuleRevisionExecutionModeSerializer + extends StdSerializer { + public AiCustomRuleRevisionExecutionModeSerializer(Class t) { + super(t); + } + + public AiCustomRuleRevisionExecutionModeSerializer() { + this(null); + } + + @Override + public void serialize( + AiCustomRuleRevisionExecutionMode value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AiCustomRuleRevisionExecutionMode fromValue(String value) { + return new AiCustomRuleRevisionExecutionMode(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionRequest.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionRequest.java new file mode 100644 index 00000000000..937a529b4b8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionRequest.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; + +/** Request body for creating an AI custom rule revision. */ +@JsonPropertyOrder({AiCustomRuleRevisionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleRevisionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AiCustomRuleRevisionRequestData data; + + public AiCustomRuleRevisionRequest data(AiCustomRuleRevisionRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Request data for creating an AI custom rule revision. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRuleRevisionRequestData getData() { + return data; + } + + public void setData(AiCustomRuleRevisionRequestData 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 AiCustomRuleRevisionRequest + */ + @JsonAnySetter + public AiCustomRuleRevisionRequest 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 AiCustomRuleRevisionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleRevisionRequest aiCustomRuleRevisionRequest = (AiCustomRuleRevisionRequest) o; + return Objects.equals(this.data, aiCustomRuleRevisionRequest.data) + && Objects.equals( + this.additionalProperties, aiCustomRuleRevisionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleRevisionRequest {\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/AiCustomRuleRevisionRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionRequestAttributes.java new file mode 100644 index 00000000000..fa42a9a2421 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionRequestAttributes.java @@ -0,0 +1,512 @@ +/* + * 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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes for creating an AI custom rule revision. */ +@JsonPropertyOrder({ + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_CATEGORY, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_CONTENT, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_CWE, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_DESCRIPTION, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_DIRECTORIES, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_EXECUTION_MODE, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_GLOBS, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_IS_PUBLISHED, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_IS_TESTING, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_SEVERITY, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_SHORT_DESCRIPTION, + AiCustomRuleRevisionRequestAttributes.JSON_PROPERTY_VERSION_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleRevisionRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CATEGORY = "category"; + private CustomRuleRevisionAttributesCategory category; + + public static final String JSON_PROPERTY_CONTENT = "content"; + private String content; + + public static final String JSON_PROPERTY_CWE = "cwe"; + private JsonNullable cwe = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DIRECTORIES = "directories"; + private List directories = new ArrayList<>(); + + public static final String JSON_PROPERTY_EXECUTION_MODE = "execution_mode"; + private AiCustomRuleRevisionExecutionMode executionMode; + + public static final String JSON_PROPERTY_GLOBS = "globs"; + private List globs = new ArrayList<>(); + + 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_SEVERITY = "severity"; + private CustomRuleRevisionAttributesSeverity severity; + + public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public static final String JSON_PROPERTY_VERSION_ID = "version_id"; + private Long versionId; + + public AiCustomRuleRevisionRequestAttributes() {} + + @JsonCreator + public AiCustomRuleRevisionRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) + CustomRuleRevisionAttributesCategory category, + @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT) String content, + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_DIRECTORIES) List directories, + @JsonProperty(required = true, value = JSON_PROPERTY_EXECUTION_MODE) + AiCustomRuleRevisionExecutionMode executionMode, + @JsonProperty(required = true, value = JSON_PROPERTY_GLOBS) List globs, + @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_SEVERITY) + CustomRuleRevisionAttributesSeverity severity, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) + String shortDescription) { + this.category = category; + this.unparsed |= !category.isValid(); + this.content = content; + this.description = description; + this.directories = directories; + this.executionMode = executionMode; + this.unparsed |= !executionMode.isValid(); + this.globs = globs; + this.isPublished = isPublished; + this.isTesting = isTesting; + this.severity = severity; + this.unparsed |= !severity.isValid(); + this.shortDescription = shortDescription; + } + + public AiCustomRuleRevisionRequestAttributes 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 AiCustomRuleRevisionRequestAttributes content(String content) { + this.content = content; + return this; + } + + /** + * Base64-encoded AI model content for this revision. + * + * @return content + */ + @JsonProperty(JSON_PROPERTY_CONTENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public AiCustomRuleRevisionRequestAttributes cwe(String cwe) { + this.cwe = JsonNullable.of(cwe); + return this; + } + + /** + * The associated CWE identifier. + * + * @return cwe + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getCwe() { + return cwe.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CWE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCwe_JsonNullable() { + return cwe; + } + + @JsonProperty(JSON_PROPERTY_CWE) + public void setCwe_JsonNullable(JsonNullable cwe) { + this.cwe = cwe; + } + + public void setCwe(String cwe) { + this.cwe = JsonNullable.of(cwe); + } + + public AiCustomRuleRevisionRequestAttributes 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 AiCustomRuleRevisionRequestAttributes directories(List directories) { + this.directories = directories; + return this; + } + + public AiCustomRuleRevisionRequestAttributes addDirectoriesItem(String directoriesItem) { + this.directories.add(directoriesItem); + return this; + } + + /** + * Directory patterns this rule applies to. + * + * @return directories + */ + @JsonProperty(JSON_PROPERTY_DIRECTORIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getDirectories() { + return directories; + } + + public void setDirectories(List directories) { + this.directories = directories; + } + + public AiCustomRuleRevisionRequestAttributes executionMode( + AiCustomRuleRevisionExecutionMode executionMode) { + this.executionMode = executionMode; + this.unparsed |= !executionMode.isValid(); + return this; + } + + /** + * The execution mode for an AI rule revision. + * + * @return executionMode + */ + @JsonProperty(JSON_PROPERTY_EXECUTION_MODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRuleRevisionExecutionMode getExecutionMode() { + return executionMode; + } + + public void setExecutionMode(AiCustomRuleRevisionExecutionMode executionMode) { + if (!executionMode.isValid()) { + this.unparsed = true; + } + this.executionMode = executionMode; + } + + public AiCustomRuleRevisionRequestAttributes globs(List globs) { + this.globs = globs; + return this; + } + + public AiCustomRuleRevisionRequestAttributes addGlobsItem(String globsItem) { + this.globs.add(globsItem); + return this; + } + + /** + * File glob patterns this rule applies to. + * + * @return globs + */ + @JsonProperty(JSON_PROPERTY_GLOBS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getGlobs() { + return globs; + } + + public void setGlobs(List globs) { + this.globs = globs; + } + + public AiCustomRuleRevisionRequestAttributes isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Whether this 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 AiCustomRuleRevisionRequestAttributes isTesting(Boolean isTesting) { + this.isTesting = isTesting; + return this; + } + + /** + * Whether this revision is for testing only. + * + * @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 AiCustomRuleRevisionRequestAttributes 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 AiCustomRuleRevisionRequestAttributes 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; + } + + public AiCustomRuleRevisionRequestAttributes versionId(Long versionId) { + this.versionId = versionId; + return this; + } + + /** + * The version identifier for this revision. + * + * @return versionId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VERSION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getVersionId() { + return versionId; + } + + public void setVersionId(Long versionId) { + this.versionId = versionId; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + 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 AiCustomRuleRevisionRequestAttributes + */ + @JsonAnySetter + public AiCustomRuleRevisionRequestAttributes 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 AiCustomRuleRevisionRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleRevisionRequestAttributes aiCustomRuleRevisionRequestAttributes = + (AiCustomRuleRevisionRequestAttributes) o; + return Objects.equals(this.category, aiCustomRuleRevisionRequestAttributes.category) + && Objects.equals(this.content, aiCustomRuleRevisionRequestAttributes.content) + && Objects.equals(this.cwe, aiCustomRuleRevisionRequestAttributes.cwe) + && Objects.equals(this.description, aiCustomRuleRevisionRequestAttributes.description) + && Objects.equals(this.directories, aiCustomRuleRevisionRequestAttributes.directories) + && Objects.equals(this.executionMode, aiCustomRuleRevisionRequestAttributes.executionMode) + && Objects.equals(this.globs, aiCustomRuleRevisionRequestAttributes.globs) + && Objects.equals(this.isPublished, aiCustomRuleRevisionRequestAttributes.isPublished) + && Objects.equals(this.isTesting, aiCustomRuleRevisionRequestAttributes.isTesting) + && Objects.equals(this.severity, aiCustomRuleRevisionRequestAttributes.severity) + && Objects.equals( + this.shortDescription, aiCustomRuleRevisionRequestAttributes.shortDescription) + && Objects.equals(this.versionId, aiCustomRuleRevisionRequestAttributes.versionId) + && Objects.equals( + this.additionalProperties, aiCustomRuleRevisionRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + category, + content, + cwe, + description, + directories, + executionMode, + globs, + isPublished, + isTesting, + severity, + shortDescription, + versionId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleRevisionRequestAttributes {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" directories: ").append(toIndentedString(directories)).append("\n"); + sb.append(" executionMode: ").append(toIndentedString(executionMode)).append("\n"); + sb.append(" globs: ").append(toIndentedString(globs)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); + sb.append(" isTesting: ").append(toIndentedString(isTesting)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n"); + sb.append(" versionId: ").append(toIndentedString(versionId)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionRequestData.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionRequestData.java new file mode 100644 index 00000000000..a76d2693b4f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionRequestData.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; + +/** Request data for creating an AI custom rule revision. */ +@JsonPropertyOrder({ + AiCustomRuleRevisionRequestData.JSON_PROPERTY_ATTRIBUTES, + AiCustomRuleRevisionRequestData.JSON_PROPERTY_ID, + AiCustomRuleRevisionRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleRevisionRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AiCustomRuleRevisionRequestAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiCustomRuleRevisionDataType type; + + public AiCustomRuleRevisionRequestData attributes( + AiCustomRuleRevisionRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating an AI custom rule revision. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRuleRevisionRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AiCustomRuleRevisionRequestAttributes attributes) { + this.attributes = attributes; + } + + public AiCustomRuleRevisionRequestData id(String id) { + this.id = id; + return this; + } + + /** + * The 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 AiCustomRuleRevisionRequestData type(AiCustomRuleRevisionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * AI custom rule revision resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRuleRevisionDataType getType() { + return type; + } + + public void setType(AiCustomRuleRevisionDataType 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 AiCustomRuleRevisionRequestData + */ + @JsonAnySetter + public AiCustomRuleRevisionRequestData 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 AiCustomRuleRevisionRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleRevisionRequestData aiCustomRuleRevisionRequestData = + (AiCustomRuleRevisionRequestData) o; + return Objects.equals(this.attributes, aiCustomRuleRevisionRequestData.attributes) + && Objects.equals(this.id, aiCustomRuleRevisionRequestData.id) + && Objects.equals(this.type, aiCustomRuleRevisionRequestData.type) + && Objects.equals( + this.additionalProperties, aiCustomRuleRevisionRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleRevisionRequestData {\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/AiCustomRuleRevisionResponse.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionResponse.java new file mode 100644 index 00000000000..2798c45595e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionResponse.java @@ -0,0 +1,147 @@ +/* + * 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; + +/** Response containing a single AI custom rule revision. */ +@JsonPropertyOrder({AiCustomRuleRevisionResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleRevisionResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AiCustomRuleRevisionResponseData data; + + public AiCustomRuleRevisionResponse() {} + + @JsonCreator + public AiCustomRuleRevisionResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + AiCustomRuleRevisionResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AiCustomRuleRevisionResponse data(AiCustomRuleRevisionResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Response data for an AI custom rule revision. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRuleRevisionResponseData getData() { + return data; + } + + public void setData(AiCustomRuleRevisionResponseData 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 AiCustomRuleRevisionResponse + */ + @JsonAnySetter + public AiCustomRuleRevisionResponse 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 AiCustomRuleRevisionResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleRevisionResponse aiCustomRuleRevisionResponse = (AiCustomRuleRevisionResponse) o; + return Objects.equals(this.data, aiCustomRuleRevisionResponse.data) + && Objects.equals( + this.additionalProperties, aiCustomRuleRevisionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleRevisionResponse {\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/AiCustomRuleRevisionResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionResponseAttributes.java new file mode 100644 index 00000000000..e935e29a213 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionResponseAttributes.java @@ -0,0 +1,623 @@ +/* + * 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; + +/** Response attributes of an AI custom rule revision. */ +@JsonPropertyOrder({ + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_CATEGORY, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_CHECKSUM, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_CONTENT, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_CREATED_AT, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_CREATED_BY, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_CWE, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_DESCRIPTION, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_DIRECTORIES, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_EXECUTION_MODE, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_GLOBS, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_IS_DEFAULT, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_IS_PUBLISHED, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_IS_TESTING, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_SEVERITY, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_SHORT_DESCRIPTION, + AiCustomRuleRevisionResponseAttributes.JSON_PROPERTY_VERSION_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleRevisionResponseAttributes { + @JsonIgnore public boolean unparsed = false; + 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_CONTENT = "content"; + private String content; + + 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_CWE = "cwe"; + private String cwe; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DIRECTORIES = "directories"; + private List directories = new ArrayList<>(); + + public static final String JSON_PROPERTY_EXECUTION_MODE = "execution_mode"; + private AiCustomRuleRevisionExecutionMode executionMode; + + public static final String JSON_PROPERTY_GLOBS = "globs"; + private List globs = new ArrayList<>(); + + public static final String JSON_PROPERTY_IS_DEFAULT = "is_default"; + private Boolean isDefault; + + 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_SEVERITY = "severity"; + private CustomRuleRevisionAttributesSeverity severity; + + public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public static final String JSON_PROPERTY_VERSION_ID = "version_id"; + private Long versionId; + + public AiCustomRuleRevisionResponseAttributes() {} + + @JsonCreator + public AiCustomRuleRevisionResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) + CustomRuleRevisionAttributesCategory category, + @JsonProperty(required = true, value = JSON_PROPERTY_CHECKSUM) String checksum, + @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT) String content, + @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_CWE) String cwe, + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_DIRECTORIES) List directories, + @JsonProperty(required = true, value = JSON_PROPERTY_EXECUTION_MODE) + AiCustomRuleRevisionExecutionMode executionMode, + @JsonProperty(required = true, value = JSON_PROPERTY_GLOBS) List globs, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_DEFAULT) Boolean isDefault, + @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_SEVERITY) + CustomRuleRevisionAttributesSeverity severity, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) + String shortDescription, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION_ID) Long versionId) { + this.category = category; + this.unparsed |= !category.isValid(); + this.checksum = checksum; + this.content = content; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.cwe = cwe; + if (cwe != null) {} + this.description = description; + this.directories = directories; + this.executionMode = executionMode; + this.unparsed |= !executionMode.isValid(); + this.globs = globs; + this.isDefault = isDefault; + this.isPublished = isPublished; + this.isTesting = isTesting; + this.severity = severity; + this.unparsed |= !severity.isValid(); + this.shortDescription = shortDescription; + this.versionId = versionId; + } + + public AiCustomRuleRevisionResponseAttributes 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 AiCustomRuleRevisionResponseAttributes checksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * Checksum of the revision content. + * + * @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 AiCustomRuleRevisionResponseAttributes content(String content) { + this.content = content; + return this; + } + + /** + * Base64-encoded AI model content for this revision. + * + * @return content + */ + @JsonProperty(JSON_PROPERTY_CONTENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public AiCustomRuleRevisionResponseAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The 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 AiCustomRuleRevisionResponseAttributes createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The identifier of the user who created the revision. + * + * @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 AiCustomRuleRevisionResponseAttributes cwe(String cwe) { + this.cwe = cwe; + if (cwe != null) {} + return this; + } + + /** + * The associated CWE identifier. + * + * @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 AiCustomRuleRevisionResponseAttributes 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 AiCustomRuleRevisionResponseAttributes directories(List directories) { + this.directories = directories; + return this; + } + + public AiCustomRuleRevisionResponseAttributes addDirectoriesItem(String directoriesItem) { + this.directories.add(directoriesItem); + return this; + } + + /** + * Directory patterns this rule applies to. + * + * @return directories + */ + @JsonProperty(JSON_PROPERTY_DIRECTORIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getDirectories() { + return directories; + } + + public void setDirectories(List directories) { + this.directories = directories; + } + + public AiCustomRuleRevisionResponseAttributes executionMode( + AiCustomRuleRevisionExecutionMode executionMode) { + this.executionMode = executionMode; + this.unparsed |= !executionMode.isValid(); + return this; + } + + /** + * The execution mode for an AI rule revision. + * + * @return executionMode + */ + @JsonProperty(JSON_PROPERTY_EXECUTION_MODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRuleRevisionExecutionMode getExecutionMode() { + return executionMode; + } + + public void setExecutionMode(AiCustomRuleRevisionExecutionMode executionMode) { + if (!executionMode.isValid()) { + this.unparsed = true; + } + this.executionMode = executionMode; + } + + public AiCustomRuleRevisionResponseAttributes globs(List globs) { + this.globs = globs; + return this; + } + + public AiCustomRuleRevisionResponseAttributes addGlobsItem(String globsItem) { + this.globs.add(globsItem); + return this; + } + + /** + * File glob patterns this rule applies to. + * + * @return globs + */ + @JsonProperty(JSON_PROPERTY_GLOBS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getGlobs() { + return globs; + } + + public void setGlobs(List globs) { + this.globs = globs; + } + + public AiCustomRuleRevisionResponseAttributes isDefault(Boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + * Whether this is a default Datadog rule. + * + * @return isDefault + */ + @JsonProperty(JSON_PROPERTY_IS_DEFAULT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsDefault() { + return isDefault; + } + + public void setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + } + + public AiCustomRuleRevisionResponseAttributes isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Whether this 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 AiCustomRuleRevisionResponseAttributes isTesting(Boolean isTesting) { + this.isTesting = isTesting; + return this; + } + + /** + * Whether this revision is for testing only. + * + * @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 AiCustomRuleRevisionResponseAttributes 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 AiCustomRuleRevisionResponseAttributes 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; + } + + public AiCustomRuleRevisionResponseAttributes versionId(Long versionId) { + this.versionId = versionId; + return this; + } + + /** + * The version identifier for this revision. + * + * @return versionId + */ + @JsonProperty(JSON_PROPERTY_VERSION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getVersionId() { + return versionId; + } + + public void setVersionId(Long versionId) { + this.versionId = versionId; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AiCustomRuleRevisionResponseAttributes + */ + @JsonAnySetter + public AiCustomRuleRevisionResponseAttributes 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 AiCustomRuleRevisionResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleRevisionResponseAttributes aiCustomRuleRevisionResponseAttributes = + (AiCustomRuleRevisionResponseAttributes) o; + return Objects.equals(this.category, aiCustomRuleRevisionResponseAttributes.category) + && Objects.equals(this.checksum, aiCustomRuleRevisionResponseAttributes.checksum) + && Objects.equals(this.content, aiCustomRuleRevisionResponseAttributes.content) + && Objects.equals(this.createdAt, aiCustomRuleRevisionResponseAttributes.createdAt) + && Objects.equals(this.createdBy, aiCustomRuleRevisionResponseAttributes.createdBy) + && Objects.equals(this.cwe, aiCustomRuleRevisionResponseAttributes.cwe) + && Objects.equals(this.description, aiCustomRuleRevisionResponseAttributes.description) + && Objects.equals(this.directories, aiCustomRuleRevisionResponseAttributes.directories) + && Objects.equals(this.executionMode, aiCustomRuleRevisionResponseAttributes.executionMode) + && Objects.equals(this.globs, aiCustomRuleRevisionResponseAttributes.globs) + && Objects.equals(this.isDefault, aiCustomRuleRevisionResponseAttributes.isDefault) + && Objects.equals(this.isPublished, aiCustomRuleRevisionResponseAttributes.isPublished) + && Objects.equals(this.isTesting, aiCustomRuleRevisionResponseAttributes.isTesting) + && Objects.equals(this.severity, aiCustomRuleRevisionResponseAttributes.severity) + && Objects.equals( + this.shortDescription, aiCustomRuleRevisionResponseAttributes.shortDescription) + && Objects.equals(this.versionId, aiCustomRuleRevisionResponseAttributes.versionId) + && Objects.equals( + this.additionalProperties, aiCustomRuleRevisionResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + category, + checksum, + content, + createdAt, + createdBy, + cwe, + description, + directories, + executionMode, + globs, + isDefault, + isPublished, + isTesting, + severity, + shortDescription, + versionId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleRevisionResponseAttributes {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" directories: ").append(toIndentedString(directories)).append("\n"); + sb.append(" executionMode: ").append(toIndentedString(executionMode)).append("\n"); + sb.append(" globs: ").append(toIndentedString(globs)).append("\n"); + sb.append(" isDefault: ").append(toIndentedString(isDefault)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); + sb.append(" isTesting: ").append(toIndentedString(isTesting)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" shortDescription: ").append(toIndentedString(shortDescription)).append("\n"); + sb.append(" versionId: ").append(toIndentedString(versionId)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionResponseData.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionResponseData.java new file mode 100644 index 00000000000..3b1e313d7d7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionResponseData.java @@ -0,0 +1,213 @@ +/* + * 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; + +/** Response data for an AI custom rule revision. */ +@JsonPropertyOrder({ + AiCustomRuleRevisionResponseData.JSON_PROPERTY_ATTRIBUTES, + AiCustomRuleRevisionResponseData.JSON_PROPERTY_ID, + AiCustomRuleRevisionResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleRevisionResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AiCustomRuleRevisionResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiCustomRuleRevisionDataType type; + + public AiCustomRuleRevisionResponseData() {} + + @JsonCreator + public AiCustomRuleRevisionResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AiCustomRuleRevisionResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + AiCustomRuleRevisionDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AiCustomRuleRevisionResponseData attributes( + AiCustomRuleRevisionResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Response attributes of an AI custom rule revision. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRuleRevisionResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AiCustomRuleRevisionResponseAttributes attributes) { + this.attributes = attributes; + } + + public AiCustomRuleRevisionResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The 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 AiCustomRuleRevisionResponseData type(AiCustomRuleRevisionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * AI custom rule revision resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRuleRevisionDataType getType() { + return type; + } + + public void setType(AiCustomRuleRevisionDataType 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 AiCustomRuleRevisionResponseData + */ + @JsonAnySetter + public AiCustomRuleRevisionResponseData 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 AiCustomRuleRevisionResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleRevisionResponseData aiCustomRuleRevisionResponseData = + (AiCustomRuleRevisionResponseData) o; + return Objects.equals(this.attributes, aiCustomRuleRevisionResponseData.attributes) + && Objects.equals(this.id, aiCustomRuleRevisionResponseData.id) + && Objects.equals(this.type, aiCustomRuleRevisionResponseData.type) + && Objects.equals( + this.additionalProperties, aiCustomRuleRevisionResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleRevisionResponseData {\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/AiCustomRuleRevisionsResponse.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionsResponse.java new file mode 100644 index 00000000000..aafe59974cd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRuleRevisionsResponse.java @@ -0,0 +1,156 @@ +/* + * 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; + +/** Response containing a list of AI custom rule revisions. */ +@JsonPropertyOrder({AiCustomRuleRevisionsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRuleRevisionsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public AiCustomRuleRevisionsResponse() {} + + @JsonCreator + public AiCustomRuleRevisionsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public AiCustomRuleRevisionsResponse data(List data) { + this.data = data; + for (AiCustomRuleRevisionResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AiCustomRuleRevisionsResponse addDataItem(AiCustomRuleRevisionResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of AI custom rule revisions. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 AiCustomRuleRevisionsResponse + */ + @JsonAnySetter + public AiCustomRuleRevisionsResponse 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 AiCustomRuleRevisionsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRuleRevisionsResponse aiCustomRuleRevisionsResponse = (AiCustomRuleRevisionsResponse) o; + return Objects.equals(this.data, aiCustomRuleRevisionsResponse.data) + && Objects.equals( + this.additionalProperties, aiCustomRuleRevisionsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRuleRevisionsResponse {\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/AiCustomRulesetDataType.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetDataType.java new file mode 100644 index 00000000000..cd158221834 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetDataType.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; + +/** AI custom ruleset resource type. */ +@JsonSerialize(using = AiCustomRulesetDataType.AiCustomRulesetDataTypeSerializer.class) +public class AiCustomRulesetDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("ai_ruleset")); + + public static final AiCustomRulesetDataType AI_RULESET = + new AiCustomRulesetDataType("ai_ruleset"); + + AiCustomRulesetDataType(String value) { + super(value, allowedValues); + } + + public static class AiCustomRulesetDataTypeSerializer + extends StdSerializer { + public AiCustomRulesetDataTypeSerializer(Class t) { + super(t); + } + + public AiCustomRulesetDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AiCustomRulesetDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AiCustomRulesetDataType fromValue(String value) { + return new AiCustomRulesetDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetRequest.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetRequest.java new file mode 100644 index 00000000000..82e583d799f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetRequest.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; + +/** Request body for creating an AI custom ruleset. */ +@JsonPropertyOrder({AiCustomRulesetRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRulesetRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AiCustomRulesetRequestData data; + + public AiCustomRulesetRequest data(AiCustomRulesetRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Request data for creating an AI custom ruleset. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRulesetRequestData getData() { + return data; + } + + public void setData(AiCustomRulesetRequestData 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 AiCustomRulesetRequest + */ + @JsonAnySetter + public AiCustomRulesetRequest 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 AiCustomRulesetRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRulesetRequest aiCustomRulesetRequest = (AiCustomRulesetRequest) o; + return Objects.equals(this.data, aiCustomRulesetRequest.data) + && Objects.equals(this.additionalProperties, aiCustomRulesetRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRulesetRequest {\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/AiCustomRulesetRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetRequestAttributes.java new file mode 100644 index 00000000000..d638f0420bb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetRequestAttributes.java @@ -0,0 +1,204 @@ +/* + * 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; + +/** Attributes for creating an AI custom ruleset. */ +@JsonPropertyOrder({ + AiCustomRulesetRequestAttributes.JSON_PROPERTY_DESCRIPTION, + AiCustomRulesetRequestAttributes.JSON_PROPERTY_NAME, + AiCustomRulesetRequestAttributes.JSON_PROPERTY_SHORT_DESCRIPTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRulesetRequestAttributes { + @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_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public AiCustomRulesetRequestAttributes() {} + + @JsonCreator + public AiCustomRulesetRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) + String shortDescription) { + this.description = description; + this.name = name; + this.shortDescription = shortDescription; + } + + public AiCustomRulesetRequestAttributes description(String description) { + this.description = description; + return this; + } + + /** + * Base64-encoded full description of the ruleset. + * + * @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 AiCustomRulesetRequestAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The 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 AiCustomRulesetRequestAttributes shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Base64-encoded short description of the ruleset. + * + * @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 AiCustomRulesetRequestAttributes + */ + @JsonAnySetter + public AiCustomRulesetRequestAttributes 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 AiCustomRulesetRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRulesetRequestAttributes aiCustomRulesetRequestAttributes = + (AiCustomRulesetRequestAttributes) o; + return Objects.equals(this.description, aiCustomRulesetRequestAttributes.description) + && Objects.equals(this.name, aiCustomRulesetRequestAttributes.name) + && Objects.equals(this.shortDescription, aiCustomRulesetRequestAttributes.shortDescription) + && Objects.equals( + this.additionalProperties, aiCustomRulesetRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, name, shortDescription, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRulesetRequestAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/AiCustomRulesetRequestData.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetRequestData.java new file mode 100644 index 00000000000..a8693e486ce --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetRequestData.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; + +/** Request data for creating an AI custom ruleset. */ +@JsonPropertyOrder({ + AiCustomRulesetRequestData.JSON_PROPERTY_ATTRIBUTES, + AiCustomRulesetRequestData.JSON_PROPERTY_ID, + AiCustomRulesetRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRulesetRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AiCustomRulesetRequestAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiCustomRulesetDataType type; + + public AiCustomRulesetRequestData attributes(AiCustomRulesetRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating an AI custom ruleset. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRulesetRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AiCustomRulesetRequestAttributes attributes) { + this.attributes = attributes; + } + + public AiCustomRulesetRequestData id(String id) { + this.id = id; + return this; + } + + /** + * The ruleset identifier, which must match the name. + * + * @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 AiCustomRulesetRequestData type(AiCustomRulesetDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * AI custom ruleset resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRulesetDataType getType() { + return type; + } + + public void setType(AiCustomRulesetDataType 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 AiCustomRulesetRequestData + */ + @JsonAnySetter + public AiCustomRulesetRequestData 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 AiCustomRulesetRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRulesetRequestData aiCustomRulesetRequestData = (AiCustomRulesetRequestData) o; + return Objects.equals(this.attributes, aiCustomRulesetRequestData.attributes) + && Objects.equals(this.id, aiCustomRulesetRequestData.id) + && Objects.equals(this.type, aiCustomRulesetRequestData.type) + && Objects.equals( + this.additionalProperties, aiCustomRulesetRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRulesetRequestData {\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/AiCustomRulesetResponse.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetResponse.java new file mode 100644 index 00000000000..0f10b4e613f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetResponse.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; + +/** Response containing a single AI custom ruleset. */ +@JsonPropertyOrder({AiCustomRulesetResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRulesetResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AiCustomRulesetResponseData data; + + public AiCustomRulesetResponse() {} + + @JsonCreator + public AiCustomRulesetResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AiCustomRulesetResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AiCustomRulesetResponse data(AiCustomRulesetResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Response data for an AI custom ruleset. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRulesetResponseData getData() { + return data; + } + + public void setData(AiCustomRulesetResponseData 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 AiCustomRulesetResponse + */ + @JsonAnySetter + public AiCustomRulesetResponse 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 AiCustomRulesetResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRulesetResponse aiCustomRulesetResponse = (AiCustomRulesetResponse) o; + return Objects.equals(this.data, aiCustomRulesetResponse.data) + && Objects.equals(this.additionalProperties, aiCustomRulesetResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRulesetResponse {\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/AiCustomRulesetResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetResponseAttributes.java new file mode 100644 index 00000000000..ab0769bbfdf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetResponseAttributes.java @@ -0,0 +1,303 @@ +/* + * 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; + +/** Response attributes of an AI custom ruleset. */ +@JsonPropertyOrder({ + AiCustomRulesetResponseAttributes.JSON_PROPERTY_CREATED_AT, + AiCustomRulesetResponseAttributes.JSON_PROPERTY_CREATED_BY, + AiCustomRulesetResponseAttributes.JSON_PROPERTY_DESCRIPTION, + AiCustomRulesetResponseAttributes.JSON_PROPERTY_NAME, + AiCustomRulesetResponseAttributes.JSON_PROPERTY_RULES, + AiCustomRulesetResponseAttributes.JSON_PROPERTY_SHORT_DESCRIPTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRulesetResponseAttributes { + @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 AiCustomRulesetResponseAttributes() {} + + @JsonCreator + public AiCustomRulesetResponseAttributes( + @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 AiCustomRulesetResponseAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The 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 AiCustomRulesetResponseAttributes createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The identifier of the user who created the ruleset. + * + * @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 AiCustomRulesetResponseAttributes description(String description) { + this.description = description; + return this; + } + + /** + * Base64-encoded full description of the ruleset. + * + * @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 AiCustomRulesetResponseAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The 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 AiCustomRulesetResponseAttributes rules(List rules) { + this.rules = rules; + for (AiCustomRuleItem item : rules) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AiCustomRulesetResponseAttributes addRulesItem(AiCustomRuleItem rulesItem) { + this.rules.add(rulesItem); + this.unparsed |= rulesItem.unparsed; + return this; + } + + /** + * The rules contained 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 AiCustomRulesetResponseAttributes shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Base64-encoded short description of the ruleset. + * + * @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 AiCustomRulesetResponseAttributes + */ + @JsonAnySetter + public AiCustomRulesetResponseAttributes 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 AiCustomRulesetResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRulesetResponseAttributes aiCustomRulesetResponseAttributes = + (AiCustomRulesetResponseAttributes) o; + return Objects.equals(this.createdAt, aiCustomRulesetResponseAttributes.createdAt) + && Objects.equals(this.createdBy, aiCustomRulesetResponseAttributes.createdBy) + && Objects.equals(this.description, aiCustomRulesetResponseAttributes.description) + && Objects.equals(this.name, aiCustomRulesetResponseAttributes.name) + && Objects.equals(this.rules, aiCustomRulesetResponseAttributes.rules) + && Objects.equals(this.shortDescription, aiCustomRulesetResponseAttributes.shortDescription) + && Objects.equals( + this.additionalProperties, aiCustomRulesetResponseAttributes.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 AiCustomRulesetResponseAttributes {\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/AiCustomRulesetResponseData.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetResponseData.java new file mode 100644 index 00000000000..d71306943f8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetResponseData.java @@ -0,0 +1,210 @@ +/* + * 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; + +/** Response data for an AI custom ruleset. */ +@JsonPropertyOrder({ + AiCustomRulesetResponseData.JSON_PROPERTY_ATTRIBUTES, + AiCustomRulesetResponseData.JSON_PROPERTY_ID, + AiCustomRulesetResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRulesetResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AiCustomRulesetResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiCustomRulesetDataType type; + + public AiCustomRulesetResponseData() {} + + @JsonCreator + public AiCustomRulesetResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AiCustomRulesetResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AiCustomRulesetDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AiCustomRulesetResponseData attributes(AiCustomRulesetResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Response attributes of an AI custom ruleset. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRulesetResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AiCustomRulesetResponseAttributes attributes) { + this.attributes = attributes; + } + + public AiCustomRulesetResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The 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 AiCustomRulesetResponseData type(AiCustomRulesetDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * AI custom ruleset resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRulesetDataType getType() { + return type; + } + + public void setType(AiCustomRulesetDataType 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 AiCustomRulesetResponseData + */ + @JsonAnySetter + public AiCustomRulesetResponseData 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 AiCustomRulesetResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRulesetResponseData aiCustomRulesetResponseData = (AiCustomRulesetResponseData) o; + return Objects.equals(this.attributes, aiCustomRulesetResponseData.attributes) + && Objects.equals(this.id, aiCustomRulesetResponseData.id) + && Objects.equals(this.type, aiCustomRulesetResponseData.type) + && Objects.equals( + this.additionalProperties, aiCustomRulesetResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRulesetResponseData {\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/AiCustomRulesetUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetUpdateAttributes.java new file mode 100644 index 00000000000..af73f64f298 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetUpdateAttributes.java @@ -0,0 +1,193 @@ +/* + * 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; + +/** Attributes for updating an AI custom ruleset. */ +@JsonPropertyOrder({ + AiCustomRulesetUpdateAttributes.JSON_PROPERTY_DESCRIPTION, + AiCustomRulesetUpdateAttributes.JSON_PROPERTY_NAME, + AiCustomRulesetUpdateAttributes.JSON_PROPERTY_SHORT_DESCRIPTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRulesetUpdateAttributes { + @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_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public AiCustomRulesetUpdateAttributes description(String description) { + this.description = description; + return this; + } + + /** + * Base64-encoded full description of the ruleset. + * + * @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 AiCustomRulesetUpdateAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The 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 AiCustomRulesetUpdateAttributes shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Base64-encoded short description of the ruleset. + * + * @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 AiCustomRulesetUpdateAttributes + */ + @JsonAnySetter + public AiCustomRulesetUpdateAttributes 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 AiCustomRulesetUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRulesetUpdateAttributes aiCustomRulesetUpdateAttributes = + (AiCustomRulesetUpdateAttributes) o; + return Objects.equals(this.description, aiCustomRulesetUpdateAttributes.description) + && Objects.equals(this.name, aiCustomRulesetUpdateAttributes.name) + && Objects.equals(this.shortDescription, aiCustomRulesetUpdateAttributes.shortDescription) + && Objects.equals( + this.additionalProperties, aiCustomRulesetUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, name, shortDescription, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRulesetUpdateAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/AiCustomRulesetUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetUpdateData.java new file mode 100644 index 00000000000..8806b4a7a33 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetUpdateData.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; + +/** Request data for updating an AI custom ruleset. */ +@JsonPropertyOrder({ + AiCustomRulesetUpdateData.JSON_PROPERTY_ATTRIBUTES, + AiCustomRulesetUpdateData.JSON_PROPERTY_ID, + AiCustomRulesetUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRulesetUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AiCustomRulesetUpdateAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiCustomRulesetDataType type; + + public AiCustomRulesetUpdateData attributes(AiCustomRulesetUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for updating an AI custom ruleset. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRulesetUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AiCustomRulesetUpdateAttributes attributes) { + this.attributes = attributes; + } + + public AiCustomRulesetUpdateData id(String id) { + this.id = id; + return this; + } + + /** + * The 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 AiCustomRulesetUpdateData type(AiCustomRulesetDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * AI custom ruleset resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRulesetDataType getType() { + return type; + } + + public void setType(AiCustomRulesetDataType 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 AiCustomRulesetUpdateData + */ + @JsonAnySetter + public AiCustomRulesetUpdateData 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 AiCustomRulesetUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRulesetUpdateData aiCustomRulesetUpdateData = (AiCustomRulesetUpdateData) o; + return Objects.equals(this.attributes, aiCustomRulesetUpdateData.attributes) + && Objects.equals(this.id, aiCustomRulesetUpdateData.id) + && Objects.equals(this.type, aiCustomRulesetUpdateData.type) + && Objects.equals( + this.additionalProperties, aiCustomRulesetUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRulesetUpdateData {\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/AiCustomRulesetUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetUpdateRequest.java new file mode 100644 index 00000000000..e71fd502448 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetUpdateRequest.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; + +/** Request body for updating an AI custom ruleset. */ +@JsonPropertyOrder({AiCustomRulesetUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRulesetUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AiCustomRulesetUpdateData data; + + public AiCustomRulesetUpdateRequest data(AiCustomRulesetUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Request data for updating an AI custom ruleset. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiCustomRulesetUpdateData getData() { + return data; + } + + public void setData(AiCustomRulesetUpdateData 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 AiCustomRulesetUpdateRequest + */ + @JsonAnySetter + public AiCustomRulesetUpdateRequest 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 AiCustomRulesetUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRulesetUpdateRequest aiCustomRulesetUpdateRequest = (AiCustomRulesetUpdateRequest) o; + return Objects.equals(this.data, aiCustomRulesetUpdateRequest.data) + && Objects.equals( + this.additionalProperties, aiCustomRulesetUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRulesetUpdateRequest {\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/AiCustomRulesetsResponse.java b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetsResponse.java new file mode 100644 index 00000000000..36ea898ad66 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiCustomRulesetsResponse.java @@ -0,0 +1,155 @@ +/* + * 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; + +/** Response containing a list of AI custom rulesets. */ +@JsonPropertyOrder({AiCustomRulesetsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiCustomRulesetsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public AiCustomRulesetsResponse() {} + + @JsonCreator + public AiCustomRulesetsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public AiCustomRulesetsResponse data(List data) { + this.data = data; + for (AiCustomRulesetResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AiCustomRulesetsResponse addDataItem(AiCustomRulesetResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of AI custom rulesets. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 AiCustomRulesetsResponse + */ + @JsonAnySetter + public AiCustomRulesetsResponse 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 AiCustomRulesetsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCustomRulesetsResponse aiCustomRulesetsResponse = (AiCustomRulesetsResponse) o; + return Objects.equals(this.data, aiCustomRulesetsResponse.data) + && Objects.equals(this.additionalProperties, aiCustomRulesetsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCustomRulesetsResponse {\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/AiMemoryViolationResultDataType.java b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultDataType.java new file mode 100644 index 00000000000..b7d6d2ec907 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultDataType.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; + +/** AI memory violation result resource type. */ +@JsonSerialize( + using = AiMemoryViolationResultDataType.AiMemoryViolationResultDataTypeSerializer.class) +public class AiMemoryViolationResultDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ai_memory_violation_result")); + + public static final AiMemoryViolationResultDataType AI_MEMORY_VIOLATION_RESULT = + new AiMemoryViolationResultDataType("ai_memory_violation_result"); + + AiMemoryViolationResultDataType(String value) { + super(value, allowedValues); + } + + public static class AiMemoryViolationResultDataTypeSerializer + extends StdSerializer { + public AiMemoryViolationResultDataTypeSerializer(Class t) { + super(t); + } + + public AiMemoryViolationResultDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AiMemoryViolationResultDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AiMemoryViolationResultDataType fromValue(String value) { + return new AiMemoryViolationResultDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultRequest.java b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultRequest.java new file mode 100644 index 00000000000..687ed6ab31a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultRequest.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; + +/** Request body for creating an AI memory violation result. */ +@JsonPropertyOrder({AiMemoryViolationResultRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiMemoryViolationResultRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AiMemoryViolationResultRequestData data; + + public AiMemoryViolationResultRequest data(AiMemoryViolationResultRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Request data for creating an AI memory violation result. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiMemoryViolationResultRequestData getData() { + return data; + } + + public void setData(AiMemoryViolationResultRequestData 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 AiMemoryViolationResultRequest + */ + @JsonAnySetter + public AiMemoryViolationResultRequest 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 AiMemoryViolationResultRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiMemoryViolationResultRequest aiMemoryViolationResultRequest = + (AiMemoryViolationResultRequest) o; + return Objects.equals(this.data, aiMemoryViolationResultRequest.data) + && Objects.equals( + this.additionalProperties, aiMemoryViolationResultRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiMemoryViolationResultRequest {\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/AiMemoryViolationResultRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultRequestAttributes.java new file mode 100644 index 00000000000..bd15ebe5c5a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultRequestAttributes.java @@ -0,0 +1,322 @@ +/* + * 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; + +/** Attributes for creating an AI memory violation result. */ +@JsonPropertyOrder({ + AiMemoryViolationResultRequestAttributes.JSON_PROPERTY_LINE, + AiMemoryViolationResultRequestAttributes.JSON_PROPERTY_MESSAGE, + AiMemoryViolationResultRequestAttributes.JSON_PROPERTY_NAME, + AiMemoryViolationResultRequestAttributes.JSON_PROPERTY_REPOSITORY_ID, + AiMemoryViolationResultRequestAttributes.JSON_PROPERTY_RULE, + AiMemoryViolationResultRequestAttributes.JSON_PROPERTY_SHA, + AiMemoryViolationResultRequestAttributes.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiMemoryViolationResultRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_LINE = "line"; + private Long line; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_REPOSITORY_ID = "repository_id"; + private String repositoryId; + + public static final String JSON_PROPERTY_RULE = "rule"; + private String rule; + + public static final String JSON_PROPERTY_SHA = "sha"; + private String sha; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiMemoryViolationType type; + + public AiMemoryViolationResultRequestAttributes() {} + + @JsonCreator + public AiMemoryViolationResultRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_LINE) Long line, + @JsonProperty(required = true, value = JSON_PROPERTY_MESSAGE) String message, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_REPOSITORY_ID) String repositoryId, + @JsonProperty(required = true, value = JSON_PROPERTY_RULE) String rule, + @JsonProperty(required = true, value = JSON_PROPERTY_SHA) String sha, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AiMemoryViolationType type) { + this.line = line; + this.message = message; + this.name = name; + this.repositoryId = repositoryId; + this.rule = rule; + this.sha = sha; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AiMemoryViolationResultRequestAttributes line(Long line) { + this.line = line; + return this; + } + + /** + * The line number where the violation was found. + * + * @return line + */ + @JsonProperty(JSON_PROPERTY_LINE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLine() { + return line; + } + + public void setLine(Long line) { + this.line = line; + } + + public AiMemoryViolationResultRequestAttributes message(String message) { + this.message = message; + return this; + } + + /** + * A message explaining the violation result. + * + * @return message + */ + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public AiMemoryViolationResultRequestAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The file path where the violation was found. + * + * @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 AiMemoryViolationResultRequestAttributes repositoryId(String repositoryId) { + this.repositoryId = repositoryId; + return this; + } + + /** + * The repository identifier. + * + * @return repositoryId + */ + @JsonProperty(JSON_PROPERTY_REPOSITORY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRepositoryId() { + return repositoryId; + } + + public void setRepositoryId(String repositoryId) { + this.repositoryId = repositoryId; + } + + public AiMemoryViolationResultRequestAttributes rule(String rule) { + this.rule = rule; + return this; + } + + /** + * The rule identifier in the format ruleset/rule. + * + * @return rule + */ + @JsonProperty(JSON_PROPERTY_RULE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRule() { + return rule; + } + + public void setRule(String rule) { + this.rule = rule; + } + + public AiMemoryViolationResultRequestAttributes sha(String sha) { + this.sha = sha; + return this; + } + + /** + * The git commit SHA where the violation was found. + * + * @return sha + */ + @JsonProperty(JSON_PROPERTY_SHA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSha() { + return sha; + } + + public void setSha(String sha) { + this.sha = sha; + } + + public AiMemoryViolationResultRequestAttributes type(AiMemoryViolationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of AI memory violation result indicating whether it is a true positive or false + * positive. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiMemoryViolationType getType() { + return type; + } + + public void setType(AiMemoryViolationType 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 AiMemoryViolationResultRequestAttributes + */ + @JsonAnySetter + public AiMemoryViolationResultRequestAttributes 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 AiMemoryViolationResultRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiMemoryViolationResultRequestAttributes aiMemoryViolationResultRequestAttributes = + (AiMemoryViolationResultRequestAttributes) o; + return Objects.equals(this.line, aiMemoryViolationResultRequestAttributes.line) + && Objects.equals(this.message, aiMemoryViolationResultRequestAttributes.message) + && Objects.equals(this.name, aiMemoryViolationResultRequestAttributes.name) + && Objects.equals(this.repositoryId, aiMemoryViolationResultRequestAttributes.repositoryId) + && Objects.equals(this.rule, aiMemoryViolationResultRequestAttributes.rule) + && Objects.equals(this.sha, aiMemoryViolationResultRequestAttributes.sha) + && Objects.equals(this.type, aiMemoryViolationResultRequestAttributes.type) + && Objects.equals( + this.additionalProperties, + aiMemoryViolationResultRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(line, message, name, repositoryId, rule, sha, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiMemoryViolationResultRequestAttributes {\n"); + sb.append(" line: ").append(toIndentedString(line)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" repositoryId: ").append(toIndentedString(repositoryId)).append("\n"); + sb.append(" rule: ").append(toIndentedString(rule)).append("\n"); + sb.append(" sha: ").append(toIndentedString(sha)).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/AiMemoryViolationResultRequestData.java b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultRequestData.java new file mode 100644 index 00000000000..8c7cfbe2731 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultRequestData.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; + +/** Request data for creating an AI memory violation result. */ +@JsonPropertyOrder({ + AiMemoryViolationResultRequestData.JSON_PROPERTY_ATTRIBUTES, + AiMemoryViolationResultRequestData.JSON_PROPERTY_ID, + AiMemoryViolationResultRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiMemoryViolationResultRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AiMemoryViolationResultRequestAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiMemoryViolationResultDataType type; + + public AiMemoryViolationResultRequestData attributes( + AiMemoryViolationResultRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating an AI memory violation result. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiMemoryViolationResultRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AiMemoryViolationResultRequestAttributes attributes) { + this.attributes = attributes; + } + + public AiMemoryViolationResultRequestData id(String id) { + this.id = id; + return this; + } + + /** + * The violation result 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 AiMemoryViolationResultRequestData type(AiMemoryViolationResultDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * AI memory violation result resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AiMemoryViolationResultDataType getType() { + return type; + } + + public void setType(AiMemoryViolationResultDataType 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 AiMemoryViolationResultRequestData + */ + @JsonAnySetter + public AiMemoryViolationResultRequestData 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 AiMemoryViolationResultRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiMemoryViolationResultRequestData aiMemoryViolationResultRequestData = + (AiMemoryViolationResultRequestData) o; + return Objects.equals(this.attributes, aiMemoryViolationResultRequestData.attributes) + && Objects.equals(this.id, aiMemoryViolationResultRequestData.id) + && Objects.equals(this.type, aiMemoryViolationResultRequestData.type) + && Objects.equals( + this.additionalProperties, aiMemoryViolationResultRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiMemoryViolationResultRequestData {\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/AiMemoryViolationResultResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultResponseAttributes.java new file mode 100644 index 00000000000..91e30fac064 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultResponseAttributes.java @@ -0,0 +1,389 @@ +/* + * 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; + +/** Response attributes of an AI memory violation result. */ +@JsonPropertyOrder({ + AiMemoryViolationResultResponseAttributes.JSON_PROPERTY_CREATED_AT, + AiMemoryViolationResultResponseAttributes.JSON_PROPERTY_CREATED_BY, + AiMemoryViolationResultResponseAttributes.JSON_PROPERTY_LINE, + AiMemoryViolationResultResponseAttributes.JSON_PROPERTY_MESSAGE, + AiMemoryViolationResultResponseAttributes.JSON_PROPERTY_NAME, + AiMemoryViolationResultResponseAttributes.JSON_PROPERTY_REPOSITORY_ID, + AiMemoryViolationResultResponseAttributes.JSON_PROPERTY_RULE, + AiMemoryViolationResultResponseAttributes.JSON_PROPERTY_SHA, + AiMemoryViolationResultResponseAttributes.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiMemoryViolationResultResponseAttributes { + @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_LINE = "line"; + private Long line; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_REPOSITORY_ID = "repository_id"; + private String repositoryId; + + public static final String JSON_PROPERTY_RULE = "rule"; + private String rule; + + public static final String JSON_PROPERTY_SHA = "sha"; + private String sha; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiMemoryViolationType type; + + public AiMemoryViolationResultResponseAttributes() {} + + @JsonCreator + public AiMemoryViolationResultResponseAttributes( + @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_LINE) Long line, + @JsonProperty(required = true, value = JSON_PROPERTY_MESSAGE) String message, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_REPOSITORY_ID) String repositoryId, + @JsonProperty(required = true, value = JSON_PROPERTY_RULE) String rule, + @JsonProperty(required = true, value = JSON_PROPERTY_SHA) String sha, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AiMemoryViolationType type) { + this.createdAt = createdAt; + this.createdBy = createdBy; + this.line = line; + this.message = message; + this.name = name; + this.repositoryId = repositoryId; + this.rule = rule; + this.sha = sha; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AiMemoryViolationResultResponseAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The 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 AiMemoryViolationResultResponseAttributes createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The identifier of the user who created the result. + * + * @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 AiMemoryViolationResultResponseAttributes line(Long line) { + this.line = line; + return this; + } + + /** + * The line number where the violation was found. + * + * @return line + */ + @JsonProperty(JSON_PROPERTY_LINE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLine() { + return line; + } + + public void setLine(Long line) { + this.line = line; + } + + public AiMemoryViolationResultResponseAttributes message(String message) { + this.message = message; + return this; + } + + /** + * A message explaining the violation result. + * + * @return message + */ + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public AiMemoryViolationResultResponseAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The file path where the violation was found. + * + * @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 AiMemoryViolationResultResponseAttributes repositoryId(String repositoryId) { + this.repositoryId = repositoryId; + return this; + } + + /** + * The repository identifier. + * + * @return repositoryId + */ + @JsonProperty(JSON_PROPERTY_REPOSITORY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRepositoryId() { + return repositoryId; + } + + public void setRepositoryId(String repositoryId) { + this.repositoryId = repositoryId; + } + + public AiMemoryViolationResultResponseAttributes rule(String rule) { + this.rule = rule; + return this; + } + + /** + * The rule identifier in the format ruleset/rule. + * + * @return rule + */ + @JsonProperty(JSON_PROPERTY_RULE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRule() { + return rule; + } + + public void setRule(String rule) { + this.rule = rule; + } + + public AiMemoryViolationResultResponseAttributes sha(String sha) { + this.sha = sha; + return this; + } + + /** + * The git commit SHA where the violation was found. + * + * @return sha + */ + @JsonProperty(JSON_PROPERTY_SHA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSha() { + return sha; + } + + public void setSha(String sha) { + this.sha = sha; + } + + public AiMemoryViolationResultResponseAttributes type(AiMemoryViolationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of AI memory violation result indicating whether it is a true positive or false + * positive. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiMemoryViolationType getType() { + return type; + } + + public void setType(AiMemoryViolationType 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 AiMemoryViolationResultResponseAttributes + */ + @JsonAnySetter + public AiMemoryViolationResultResponseAttributes 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 AiMemoryViolationResultResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiMemoryViolationResultResponseAttributes aiMemoryViolationResultResponseAttributes = + (AiMemoryViolationResultResponseAttributes) o; + return Objects.equals(this.createdAt, aiMemoryViolationResultResponseAttributes.createdAt) + && Objects.equals(this.createdBy, aiMemoryViolationResultResponseAttributes.createdBy) + && Objects.equals(this.line, aiMemoryViolationResultResponseAttributes.line) + && Objects.equals(this.message, aiMemoryViolationResultResponseAttributes.message) + && Objects.equals(this.name, aiMemoryViolationResultResponseAttributes.name) + && Objects.equals(this.repositoryId, aiMemoryViolationResultResponseAttributes.repositoryId) + && Objects.equals(this.rule, aiMemoryViolationResultResponseAttributes.rule) + && Objects.equals(this.sha, aiMemoryViolationResultResponseAttributes.sha) + && Objects.equals(this.type, aiMemoryViolationResultResponseAttributes.type) + && Objects.equals( + this.additionalProperties, + aiMemoryViolationResultResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + createdBy, + line, + message, + name, + repositoryId, + rule, + sha, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiMemoryViolationResultResponseAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" line: ").append(toIndentedString(line)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" repositoryId: ").append(toIndentedString(repositoryId)).append("\n"); + sb.append(" rule: ").append(toIndentedString(rule)).append("\n"); + sb.append(" sha: ").append(toIndentedString(sha)).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/AiMemoryViolationResultResponseData.java b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultResponseData.java new file mode 100644 index 00000000000..261581db2a3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultResponseData.java @@ -0,0 +1,213 @@ +/* + * 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; + +/** Response data for an AI memory violation result. */ +@JsonPropertyOrder({ + AiMemoryViolationResultResponseData.JSON_PROPERTY_ATTRIBUTES, + AiMemoryViolationResultResponseData.JSON_PROPERTY_ID, + AiMemoryViolationResultResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiMemoryViolationResultResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AiMemoryViolationResultResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiMemoryViolationResultDataType type; + + public AiMemoryViolationResultResponseData() {} + + @JsonCreator + public AiMemoryViolationResultResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AiMemoryViolationResultResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + AiMemoryViolationResultDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AiMemoryViolationResultResponseData attributes( + AiMemoryViolationResultResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Response attributes of an AI memory violation result. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiMemoryViolationResultResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AiMemoryViolationResultResponseAttributes attributes) { + this.attributes = attributes; + } + + public AiMemoryViolationResultResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The numeric identifier of the violation result. + * + * @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 AiMemoryViolationResultResponseData type(AiMemoryViolationResultDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * AI memory violation result resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiMemoryViolationResultDataType getType() { + return type; + } + + public void setType(AiMemoryViolationResultDataType 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 AiMemoryViolationResultResponseData + */ + @JsonAnySetter + public AiMemoryViolationResultResponseData 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 AiMemoryViolationResultResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiMemoryViolationResultResponseData aiMemoryViolationResultResponseData = + (AiMemoryViolationResultResponseData) o; + return Objects.equals(this.attributes, aiMemoryViolationResultResponseData.attributes) + && Objects.equals(this.id, aiMemoryViolationResultResponseData.id) + && Objects.equals(this.type, aiMemoryViolationResultResponseData.type) + && Objects.equals( + this.additionalProperties, aiMemoryViolationResultResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiMemoryViolationResultResponseData {\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/AiMemoryViolationResultsResponse.java b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultsResponse.java new file mode 100644 index 00000000000..dd88b3e285c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationResultsResponse.java @@ -0,0 +1,158 @@ +/* + * 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; + +/** Response containing a list of AI memory violation results. */ +@JsonPropertyOrder({AiMemoryViolationResultsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiMemoryViolationResultsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public AiMemoryViolationResultsResponse() {} + + @JsonCreator + public AiMemoryViolationResultsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public AiMemoryViolationResultsResponse data(List data) { + this.data = data; + for (AiMemoryViolationResultResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AiMemoryViolationResultsResponse addDataItem( + AiMemoryViolationResultResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of AI memory violation results. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 AiMemoryViolationResultsResponse + */ + @JsonAnySetter + public AiMemoryViolationResultsResponse 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 AiMemoryViolationResultsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiMemoryViolationResultsResponse aiMemoryViolationResultsResponse = + (AiMemoryViolationResultsResponse) o; + return Objects.equals(this.data, aiMemoryViolationResultsResponse.data) + && Objects.equals( + this.additionalProperties, aiMemoryViolationResultsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiMemoryViolationResultsResponse {\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/AiMemoryViolationType.java b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationType.java new file mode 100644 index 00000000000..a5f5b086b13 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiMemoryViolationType.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; + +/** + * The type of AI memory violation result indicating whether it is a true positive or false + * positive. + */ +@JsonSerialize(using = AiMemoryViolationType.AiMemoryViolationTypeSerializer.class) +public class AiMemoryViolationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("TP", "FP")); + + public static final AiMemoryViolationType TP = new AiMemoryViolationType("TP"); + public static final AiMemoryViolationType FP = new AiMemoryViolationType("FP"); + + AiMemoryViolationType(String value) { + super(value, allowedValues); + } + + public static class AiMemoryViolationTypeSerializer extends StdSerializer { + public AiMemoryViolationTypeSerializer(Class t) { + super(t); + } + + public AiMemoryViolationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AiMemoryViolationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AiMemoryViolationType fromValue(String value) { + return new AiMemoryViolationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AiPromptDataType.java b/src/main/java/com/datadog/api/client/v2/model/AiPromptDataType.java new file mode 100644 index 00000000000..221ff3d7abf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiPromptDataType.java @@ -0,0 +1,53 @@ +/* + * 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; + +/** AI prompt resource type. */ +@JsonSerialize(using = AiPromptDataType.AiPromptDataTypeSerializer.class) +public class AiPromptDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("ai_prompt")); + + public static final AiPromptDataType AI_PROMPT = new AiPromptDataType("ai_prompt"); + + AiPromptDataType(String value) { + super(value, allowedValues); + } + + public static class AiPromptDataTypeSerializer extends StdSerializer { + public AiPromptDataTypeSerializer(Class t) { + super(t); + } + + public AiPromptDataTypeSerializer() { + this(null); + } + + @Override + public void serialize(AiPromptDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AiPromptDataType fromValue(String value) { + return new AiPromptDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AiPromptResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AiPromptResponseAttributes.java new file mode 100644 index 00000000000..e1af8b3fdd0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiPromptResponseAttributes.java @@ -0,0 +1,631 @@ +/* + * 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; + +/** Response attributes of an AI prompt. */ +@JsonPropertyOrder({ + AiPromptResponseAttributes.JSON_PROPERTY_CATEGORY, + AiPromptResponseAttributes.JSON_PROPERTY_CHECKSUM, + AiPromptResponseAttributes.JSON_PROPERTY_CONTENT, + AiPromptResponseAttributes.JSON_PROPERTY_CWE, + AiPromptResponseAttributes.JSON_PROPERTY_DESCRIPTION, + AiPromptResponseAttributes.JSON_PROPERTY_DIRECTORIES, + AiPromptResponseAttributes.JSON_PROPERTY_EXECUTION_MODE, + AiPromptResponseAttributes.JSON_PROPERTY_FILE_SEARCH_KEYWORDS, + AiPromptResponseAttributes.JSON_PROPERTY_GLOBS, + AiPromptResponseAttributes.JSON_PROPERTY_IS_DEFAULT, + AiPromptResponseAttributes.JSON_PROPERTY_IS_TESTING, + AiPromptResponseAttributes.JSON_PROPERTY_LANGUAGE, + AiPromptResponseAttributes.JSON_PROPERTY_RESULT_KEYWORDS_EXCLUDE, + AiPromptResponseAttributes.JSON_PROPERTY_RULE_VERSION, + AiPromptResponseAttributes.JSON_PROPERTY_SEVERITY, + AiPromptResponseAttributes.JSON_PROPERTY_SHORT_DESCRIPTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiPromptResponseAttributes { + @JsonIgnore public boolean unparsed = false; + 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_CONTENT = "content"; + private String content; + + 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_DIRECTORIES = "directories"; + private List directories = new ArrayList<>(); + + public static final String JSON_PROPERTY_EXECUTION_MODE = "execution_mode"; + private AiCustomRuleRevisionExecutionMode executionMode; + + public static final String JSON_PROPERTY_FILE_SEARCH_KEYWORDS = "file_search_keywords"; + private List fileSearchKeywords = new ArrayList<>(); + + public static final String JSON_PROPERTY_GLOBS = "globs"; + private List globs = new ArrayList<>(); + + public static final String JSON_PROPERTY_IS_DEFAULT = "is_default"; + private Boolean isDefault; + + 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_RESULT_KEYWORDS_EXCLUDE = "result_keywords_exclude"; + private List resultKeywordsExclude = new ArrayList<>(); + + public static final String JSON_PROPERTY_RULE_VERSION = "rule_version"; + private String ruleVersion; + + 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 AiPromptResponseAttributes() {} + + @JsonCreator + public AiPromptResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) + CustomRuleRevisionAttributesCategory category, + @JsonProperty(required = true, value = JSON_PROPERTY_CHECKSUM) String checksum, + @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT) String content, + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_DIRECTORIES) List directories, + @JsonProperty(required = true, value = JSON_PROPERTY_EXECUTION_MODE) + AiCustomRuleRevisionExecutionMode executionMode, + @JsonProperty(required = true, value = JSON_PROPERTY_FILE_SEARCH_KEYWORDS) + List fileSearchKeywords, + @JsonProperty(required = true, value = JSON_PROPERTY_GLOBS) List globs, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_DEFAULT) Boolean isDefault, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_TESTING) Boolean isTesting, + @JsonProperty(required = true, value = JSON_PROPERTY_RESULT_KEYWORDS_EXCLUDE) + List resultKeywordsExclude, + @JsonProperty(required = true, value = JSON_PROPERTY_RULE_VERSION) String ruleVersion, + @JsonProperty(required = true, value = JSON_PROPERTY_SEVERITY) + CustomRuleRevisionAttributesSeverity severity, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_DESCRIPTION) + String shortDescription) { + this.category = category; + this.unparsed |= !category.isValid(); + this.checksum = checksum; + this.content = content; + this.description = description; + this.directories = directories; + this.executionMode = executionMode; + this.unparsed |= !executionMode.isValid(); + this.fileSearchKeywords = fileSearchKeywords; + this.globs = globs; + this.isDefault = isDefault; + this.isTesting = isTesting; + this.resultKeywordsExclude = resultKeywordsExclude; + this.ruleVersion = ruleVersion; + this.severity = severity; + this.unparsed |= !severity.isValid(); + this.shortDescription = shortDescription; + } + + public AiPromptResponseAttributes 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 AiPromptResponseAttributes checksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * Checksum of the prompt content. + * + * @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 AiPromptResponseAttributes content(String content) { + this.content = content; + return this; + } + + /** + * Base64-encoded AI prompt content. + * + * @return content + */ + @JsonProperty(JSON_PROPERTY_CONTENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public AiPromptResponseAttributes cwe(String cwe) { + this.cwe = cwe; + return this; + } + + /** + * The CWE identifier associated with this prompt. + * + * @return cwe + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CWE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCwe() { + return cwe; + } + + public void setCwe(String cwe) { + this.cwe = cwe; + } + + public AiPromptResponseAttributes 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 AiPromptResponseAttributes directories(List directories) { + this.directories = directories; + return this; + } + + public AiPromptResponseAttributes addDirectoriesItem(String directoriesItem) { + this.directories.add(directoriesItem); + return this; + } + + /** + * Directory patterns this prompt applies to. + * + * @return directories + */ + @JsonProperty(JSON_PROPERTY_DIRECTORIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getDirectories() { + return directories; + } + + public void setDirectories(List directories) { + this.directories = directories; + } + + public AiPromptResponseAttributes executionMode(AiCustomRuleRevisionExecutionMode executionMode) { + this.executionMode = executionMode; + this.unparsed |= !executionMode.isValid(); + return this; + } + + /** + * The execution mode for an AI rule revision. + * + * @return executionMode + */ + @JsonProperty(JSON_PROPERTY_EXECUTION_MODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiCustomRuleRevisionExecutionMode getExecutionMode() { + return executionMode; + } + + public void setExecutionMode(AiCustomRuleRevisionExecutionMode executionMode) { + if (!executionMode.isValid()) { + this.unparsed = true; + } + this.executionMode = executionMode; + } + + public AiPromptResponseAttributes fileSearchKeywords(List fileSearchKeywords) { + this.fileSearchKeywords = fileSearchKeywords; + return this; + } + + public AiPromptResponseAttributes addFileSearchKeywordsItem(String fileSearchKeywordsItem) { + this.fileSearchKeywords.add(fileSearchKeywordsItem); + return this; + } + + /** + * Keywords used to search for relevant files. + * + * @return fileSearchKeywords + */ + @JsonProperty(JSON_PROPERTY_FILE_SEARCH_KEYWORDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getFileSearchKeywords() { + return fileSearchKeywords; + } + + public void setFileSearchKeywords(List fileSearchKeywords) { + this.fileSearchKeywords = fileSearchKeywords; + } + + public AiPromptResponseAttributes globs(List globs) { + this.globs = globs; + return this; + } + + public AiPromptResponseAttributes addGlobsItem(String globsItem) { + this.globs.add(globsItem); + return this; + } + + /** + * File glob patterns this prompt applies to. + * + * @return globs + */ + @JsonProperty(JSON_PROPERTY_GLOBS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getGlobs() { + return globs; + } + + public void setGlobs(List globs) { + this.globs = globs; + } + + public AiPromptResponseAttributes isDefault(Boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + * Whether this is a default Datadog prompt. + * + * @return isDefault + */ + @JsonProperty(JSON_PROPERTY_IS_DEFAULT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsDefault() { + return isDefault; + } + + public void setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + } + + public AiPromptResponseAttributes isTesting(Boolean isTesting) { + this.isTesting = isTesting; + return this; + } + + /** + * Whether this prompt is for testing only. + * + * @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 AiPromptResponseAttributes language(Language language) { + this.language = language; + this.unparsed |= !language.isValid(); + return this; + } + + /** + * Programming language + * + * @return language + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Language getLanguage() { + return language; + } + + public void setLanguage(Language language) { + if (!language.isValid()) { + this.unparsed = true; + } + this.language = language; + } + + public AiPromptResponseAttributes resultKeywordsExclude(List resultKeywordsExclude) { + this.resultKeywordsExclude = resultKeywordsExclude; + return this; + } + + public AiPromptResponseAttributes addResultKeywordsExcludeItem(String resultKeywordsExcludeItem) { + this.resultKeywordsExclude.add(resultKeywordsExcludeItem); + return this; + } + + /** + * Keywords to exclude from results. + * + * @return resultKeywordsExclude + */ + @JsonProperty(JSON_PROPERTY_RESULT_KEYWORDS_EXCLUDE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getResultKeywordsExclude() { + return resultKeywordsExclude; + } + + public void setResultKeywordsExclude(List resultKeywordsExclude) { + this.resultKeywordsExclude = resultKeywordsExclude; + } + + public AiPromptResponseAttributes ruleVersion(String ruleVersion) { + this.ruleVersion = ruleVersion; + return this; + } + + /** + * The version of the rule this prompt is associated with. + * + * @return ruleVersion + */ + @JsonProperty(JSON_PROPERTY_RULE_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRuleVersion() { + return ruleVersion; + } + + public void setRuleVersion(String ruleVersion) { + this.ruleVersion = ruleVersion; + } + + public AiPromptResponseAttributes 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 AiPromptResponseAttributes 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 AiPromptResponseAttributes + */ + @JsonAnySetter + public AiPromptResponseAttributes 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 AiPromptResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiPromptResponseAttributes aiPromptResponseAttributes = (AiPromptResponseAttributes) o; + return Objects.equals(this.category, aiPromptResponseAttributes.category) + && Objects.equals(this.checksum, aiPromptResponseAttributes.checksum) + && Objects.equals(this.content, aiPromptResponseAttributes.content) + && Objects.equals(this.cwe, aiPromptResponseAttributes.cwe) + && Objects.equals(this.description, aiPromptResponseAttributes.description) + && Objects.equals(this.directories, aiPromptResponseAttributes.directories) + && Objects.equals(this.executionMode, aiPromptResponseAttributes.executionMode) + && Objects.equals(this.fileSearchKeywords, aiPromptResponseAttributes.fileSearchKeywords) + && Objects.equals(this.globs, aiPromptResponseAttributes.globs) + && Objects.equals(this.isDefault, aiPromptResponseAttributes.isDefault) + && Objects.equals(this.isTesting, aiPromptResponseAttributes.isTesting) + && Objects.equals(this.language, aiPromptResponseAttributes.language) + && Objects.equals( + this.resultKeywordsExclude, aiPromptResponseAttributes.resultKeywordsExclude) + && Objects.equals(this.ruleVersion, aiPromptResponseAttributes.ruleVersion) + && Objects.equals(this.severity, aiPromptResponseAttributes.severity) + && Objects.equals(this.shortDescription, aiPromptResponseAttributes.shortDescription) + && Objects.equals( + this.additionalProperties, aiPromptResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + category, + checksum, + content, + cwe, + description, + directories, + executionMode, + fileSearchKeywords, + globs, + isDefault, + isTesting, + language, + resultKeywordsExclude, + ruleVersion, + severity, + shortDescription, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiPromptResponseAttributes {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" cwe: ").append(toIndentedString(cwe)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" directories: ").append(toIndentedString(directories)).append("\n"); + sb.append(" executionMode: ").append(toIndentedString(executionMode)).append("\n"); + sb.append(" fileSearchKeywords: ").append(toIndentedString(fileSearchKeywords)).append("\n"); + sb.append(" globs: ").append(toIndentedString(globs)).append("\n"); + sb.append(" isDefault: ").append(toIndentedString(isDefault)).append("\n"); + sb.append(" isTesting: ").append(toIndentedString(isTesting)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" resultKeywordsExclude: ") + .append(toIndentedString(resultKeywordsExclude)) + .append("\n"); + sb.append(" ruleVersion: ").append(toIndentedString(ruleVersion)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).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/AiPromptResponseData.java b/src/main/java/com/datadog/api/client/v2/model/AiPromptResponseData.java new file mode 100644 index 00000000000..4ac2a6d6840 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiPromptResponseData.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; + +/** Response data for an AI prompt. */ +@JsonPropertyOrder({ + AiPromptResponseData.JSON_PROPERTY_ATTRIBUTES, + AiPromptResponseData.JSON_PROPERTY_ID, + AiPromptResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiPromptResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AiPromptResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AiPromptDataType type; + + public AiPromptResponseData() {} + + @JsonCreator + public AiPromptResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AiPromptResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AiPromptDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AiPromptResponseData attributes(AiPromptResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Response attributes of an AI prompt. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiPromptResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AiPromptResponseAttributes attributes) { + this.attributes = attributes; + } + + public AiPromptResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The prompt 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 AiPromptResponseData type(AiPromptDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * AI prompt resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AiPromptDataType getType() { + return type; + } + + public void setType(AiPromptDataType 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 AiPromptResponseData + */ + @JsonAnySetter + public AiPromptResponseData 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 AiPromptResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiPromptResponseData aiPromptResponseData = (AiPromptResponseData) o; + return Objects.equals(this.attributes, aiPromptResponseData.attributes) + && Objects.equals(this.id, aiPromptResponseData.id) + && Objects.equals(this.type, aiPromptResponseData.type) + && Objects.equals(this.additionalProperties, aiPromptResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiPromptResponseData {\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/AiPromptsResponse.java b/src/main/java/com/datadog/api/client/v2/model/AiPromptsResponse.java new file mode 100644 index 00000000000..97ca3bfaef3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AiPromptsResponse.java @@ -0,0 +1,154 @@ +/* + * 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; + +/** Response containing a list of AI prompts. */ +@JsonPropertyOrder({AiPromptsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AiPromptsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public AiPromptsResponse() {} + + @JsonCreator + public AiPromptsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public AiPromptsResponse data(List data) { + this.data = data; + for (AiPromptResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AiPromptsResponse addDataItem(AiPromptResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of AI prompts. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 AiPromptsResponse + */ + @JsonAnySetter + public AiPromptsResponse 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 AiPromptsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiPromptsResponse aiPromptsResponse = (AiPromptsResponse) o; + return Objects.equals(this.data, aiPromptsResponse.data) + && Objects.equals(this.additionalProperties, aiPromptsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiPromptsResponse {\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/AnalysisEdit.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisEdit.java new file mode 100644 index 00000000000..cb3321562b8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisEdit.java @@ -0,0 +1,241 @@ +/* + * 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; + +/** A single edit operation within a fix suggestion for a rule violation. */ +@JsonPropertyOrder({ + AnalysisEdit.JSON_PROPERTY_CONTENT, + AnalysisEdit.JSON_PROPERTY_EDIT_TYPE, + AnalysisEdit.JSON_PROPERTY_END, + AnalysisEdit.JSON_PROPERTY_START +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisEdit { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONTENT = "content"; + private String content; + + public static final String JSON_PROPERTY_EDIT_TYPE = "edit_type"; + private AnalysisEditType editType = AnalysisEditType.ADD; + + public static final String JSON_PROPERTY_END = "end"; + private AnalysisPosition end; + + public static final String JSON_PROPERTY_START = "start"; + private AnalysisPosition start; + + public AnalysisEdit() {} + + @JsonCreator + public AnalysisEdit( + @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT) String content, + @JsonProperty(required = true, value = JSON_PROPERTY_EDIT_TYPE) AnalysisEditType editType, + @JsonProperty(required = true, value = JSON_PROPERTY_END) AnalysisPosition end, + @JsonProperty(required = true, value = JSON_PROPERTY_START) AnalysisPosition start) { + this.content = content; + if (content != null) {} + this.editType = editType; + this.unparsed |= !editType.isValid(); + this.end = end; + this.unparsed |= end.unparsed; + this.start = start; + this.unparsed |= start.unparsed; + } + + public AnalysisEdit content(String content) { + this.content = content; + if (content != null) {} + return this; + } + + /** + * The content to insert or replace at the specified position, if applicable. + * + * @return content + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public AnalysisEdit editType(AnalysisEditType editType) { + this.editType = editType; + this.unparsed |= !editType.isValid(); + return this; + } + + /** + * The type of code edit to apply when fixing a violation. + * + * @return editType + */ + @JsonProperty(JSON_PROPERTY_EDIT_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisEditType getEditType() { + return editType; + } + + public void setEditType(AnalysisEditType editType) { + if (!editType.isValid()) { + this.unparsed = true; + } + this.editType = editType; + } + + public AnalysisEdit end(AnalysisPosition end) { + this.end = end; + this.unparsed |= end.unparsed; + return this; + } + + /** + * A position in source code, identified by line and column numbers. + * + * @return end + */ + @JsonProperty(JSON_PROPERTY_END) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisPosition getEnd() { + return end; + } + + public void setEnd(AnalysisPosition end) { + this.end = end; + } + + public AnalysisEdit start(AnalysisPosition start) { + this.start = start; + this.unparsed |= start.unparsed; + return this; + } + + /** + * A position in source code, identified by line and column numbers. + * + * @return start + */ + @JsonProperty(JSON_PROPERTY_START) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisPosition getStart() { + return start; + } + + public void setStart(AnalysisPosition start) { + this.start = start; + } + + /** + * 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 AnalysisEdit + */ + @JsonAnySetter + public AnalysisEdit 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 AnalysisEdit object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisEdit analysisEdit = (AnalysisEdit) o; + return Objects.equals(this.content, analysisEdit.content) + && Objects.equals(this.editType, analysisEdit.editType) + && Objects.equals(this.end, analysisEdit.end) + && Objects.equals(this.start, analysisEdit.start) + && Objects.equals(this.additionalProperties, analysisEdit.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(content, editType, end, start, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisEdit {\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" editType: ").append(toIndentedString(editType)).append("\n"); + sb.append(" end: ").append(toIndentedString(end)).append("\n"); + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnalysisEditType.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisEditType.java new file mode 100644 index 00000000000..228505ccf0d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisEditType.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; + +/** The type of code edit to apply when fixing a violation. */ +@JsonSerialize(using = AnalysisEditType.AnalysisEditTypeSerializer.class) +public class AnalysisEditType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ADD", "UPDATE", "REMOVE")); + + public static final AnalysisEditType ADD = new AnalysisEditType("ADD"); + public static final AnalysisEditType UPDATE = new AnalysisEditType("UPDATE"); + public static final AnalysisEditType REMOVE = new AnalysisEditType("REMOVE"); + + AnalysisEditType(String value) { + super(value, allowedValues); + } + + public static class AnalysisEditTypeSerializer extends StdSerializer { + public AnalysisEditTypeSerializer(Class t) { + super(t); + } + + public AnalysisEditTypeSerializer() { + this(null); + } + + @Override + public void serialize(AnalysisEditType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AnalysisEditType fromValue(String value) { + return new AnalysisEditType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnalysisFix.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisFix.java new file mode 100644 index 00000000000..0f281b1a71c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisFix.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A fix suggestion for a rule violation, consisting of one or more edit operations. */ +@JsonPropertyOrder({AnalysisFix.JSON_PROPERTY_DESCRIPTION, AnalysisFix.JSON_PROPERTY_EDITS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisFix { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_EDITS = "edits"; + private List edits = new ArrayList<>(); + + public AnalysisFix() {} + + @JsonCreator + public AnalysisFix( + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_EDITS) List edits) { + this.description = description; + this.edits = edits; + } + + public AnalysisFix description(String description) { + this.description = description; + return this; + } + + /** + * A human-readable description of what the fix does. + * + * @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 AnalysisFix edits(List edits) { + this.edits = edits; + for (AnalysisEdit item : edits) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AnalysisFix addEditsItem(AnalysisEdit editsItem) { + this.edits.add(editsItem); + this.unparsed |= editsItem.unparsed; + return this; + } + + /** + * The list of edit operations that constitute the fix. + * + * @return edits + */ + @JsonProperty(JSON_PROPERTY_EDITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEdits() { + return edits; + } + + public void setEdits(List edits) { + this.edits = edits; + } + + /** + * 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 AnalysisFix + */ + @JsonAnySetter + public AnalysisFix 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 AnalysisFix object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisFix analysisFix = (AnalysisFix) o; + return Objects.equals(this.description, analysisFix.description) + && Objects.equals(this.edits, analysisFix.edits) + && Objects.equals(this.additionalProperties, analysisFix.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, edits, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisFix {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" edits: ").append(toIndentedString(edits)).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/AnalysisPosition.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisPosition.java new file mode 100644 index 00000000000..471ecf13cea --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisPosition.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; + +/** A position in source code, identified by line and column numbers. */ +@JsonPropertyOrder({AnalysisPosition.JSON_PROPERTY_COL, AnalysisPosition.JSON_PROPERTY_LINE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisPosition { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COL = "col"; + private Long col; + + public static final String JSON_PROPERTY_LINE = "line"; + private Long line; + + public AnalysisPosition() {} + + @JsonCreator + public AnalysisPosition( + @JsonProperty(required = true, value = JSON_PROPERTY_COL) Long col, + @JsonProperty(required = true, value = JSON_PROPERTY_LINE) Long line) { + this.col = col; + this.line = line; + } + + public AnalysisPosition col(Long col) { + this.col = col; + return this; + } + + /** + * The column number in the source file (1-based). + * + * @return col + */ + @JsonProperty(JSON_PROPERTY_COL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getCol() { + return col; + } + + public void setCol(Long col) { + this.col = col; + } + + public AnalysisPosition line(Long line) { + this.line = line; + return this; + } + + /** + * The line number in the source file (1-based). + * + * @return line + */ + @JsonProperty(JSON_PROPERTY_LINE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLine() { + return line; + } + + public void setLine(Long line) { + this.line = line; + } + + /** + * 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 AnalysisPosition + */ + @JsonAnySetter + public AnalysisPosition 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 AnalysisPosition object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisPosition analysisPosition = (AnalysisPosition) o; + return Objects.equals(this.col, analysisPosition.col) + && Objects.equals(this.line, analysisPosition.line) + && Objects.equals(this.additionalProperties, analysisPosition.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(col, line, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisPosition {\n"); + sb.append(" col: ").append(toIndentedString(col)).append("\n"); + sb.append(" line: ").append(toIndentedString(line)).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/AnalysisRequest.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequest.java new file mode 100644 index 00000000000..2e37246c475 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequest.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; + +/** The request payload for running static analysis on source code. */ +@JsonPropertyOrder({AnalysisRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AnalysisRequestData data; + + public AnalysisRequest() {} + + @JsonCreator + public AnalysisRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AnalysisRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AnalysisRequest data(AnalysisRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The primary data object in the analysis request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisRequestData getData() { + return data; + } + + public void setData(AnalysisRequestData 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 AnalysisRequest + */ + @JsonAnySetter + public AnalysisRequest 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 AnalysisRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisRequest analysisRequest = (AnalysisRequest) o; + return Objects.equals(this.data, analysisRequest.data) + && Objects.equals(this.additionalProperties, analysisRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisRequest {\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/AnalysisRequestData.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestData.java new file mode 100644 index 00000000000..5a668a33c34 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestData.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; + +/** The primary data object in the analysis request. */ +@JsonPropertyOrder({ + AnalysisRequestData.JSON_PROPERTY_ATTRIBUTES, + AnalysisRequestData.JSON_PROPERTY_ID, + AnalysisRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AnalysisRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AnalysisRequestDataType type = AnalysisRequestDataType.ANALYSIS_REQUEST; + + public AnalysisRequestData() {} + + @JsonCreator + public AnalysisRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AnalysisRequestDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AnalysisRequestDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AnalysisRequestData attributes(AnalysisRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the analysis request, containing the source code and rules to apply. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AnalysisRequestDataAttributes attributes) { + this.attributes = attributes; + } + + public AnalysisRequestData id(String id) { + this.id = id; + return this; + } + + /** + * An optional identifier for the analysis request resource. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AnalysisRequestData type(AnalysisRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Analysis request resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisRequestDataType getType() { + return type; + } + + public void setType(AnalysisRequestDataType 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 AnalysisRequestData + */ + @JsonAnySetter + public AnalysisRequestData 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 AnalysisRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisRequestData analysisRequestData = (AnalysisRequestData) o; + return Objects.equals(this.attributes, analysisRequestData.attributes) + && Objects.equals(this.id, analysisRequestData.id) + && Objects.equals(this.type, analysisRequestData.type) + && Objects.equals(this.additionalProperties, analysisRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisRequestData {\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/AnalysisRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestDataAttributes.java new file mode 100644 index 00000000000..5f74b64b101 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestDataAttributes.java @@ -0,0 +1,269 @@ +/* + * 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; + +/** The attributes of the analysis request, containing the source code and rules to apply. */ +@JsonPropertyOrder({ + AnalysisRequestDataAttributes.JSON_PROPERTY_CODE, + AnalysisRequestDataAttributes.JSON_PROPERTY_FILE_ENCODING, + AnalysisRequestDataAttributes.JSON_PROPERTY_FILENAME, + AnalysisRequestDataAttributes.JSON_PROPERTY_LANGUAGE, + AnalysisRequestDataAttributes.JSON_PROPERTY_RULES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_FILE_ENCODING = "file_encoding"; + private String fileEncoding; + + public static final String JSON_PROPERTY_FILENAME = "filename"; + private String filename; + + public static final String JSON_PROPERTY_LANGUAGE = "language"; + private String language; + + public static final String JSON_PROPERTY_RULES = "rules"; + private List rules = new ArrayList<>(); + + public AnalysisRequestDataAttributes() {} + + @JsonCreator + public AnalysisRequestDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CODE) String code, + @JsonProperty(required = true, value = JSON_PROPERTY_FILE_ENCODING) String fileEncoding, + @JsonProperty(required = true, value = JSON_PROPERTY_FILENAME) String filename, + @JsonProperty(required = true, value = JSON_PROPERTY_LANGUAGE) String language, + @JsonProperty(required = true, value = JSON_PROPERTY_RULES) List rules) { + this.code = code; + this.fileEncoding = fileEncoding; + this.filename = filename; + this.language = language; + this.rules = rules; + } + + public AnalysisRequestDataAttributes code(String code) { + this.code = code; + return this; + } + + /** + * The base64-encoded source code to analyze. + * + * @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 AnalysisRequestDataAttributes fileEncoding(String fileEncoding) { + this.fileEncoding = fileEncoding; + return this; + } + + /** + * The encoding of the source code file (must be utf-8). + * + * @return fileEncoding + */ + @JsonProperty(JSON_PROPERTY_FILE_ENCODING) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getFileEncoding() { + return fileEncoding; + } + + public void setFileEncoding(String fileEncoding) { + this.fileEncoding = fileEncoding; + } + + public AnalysisRequestDataAttributes filename(String filename) { + this.filename = filename; + return this; + } + + /** + * The name of the file being analyzed. + * + * @return filename + */ + @JsonProperty(JSON_PROPERTY_FILENAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + public AnalysisRequestDataAttributes language(String language) { + this.language = language; + return this; + } + + /** + * The programming language of the source code. + * + * @return language + */ + @JsonProperty(JSON_PROPERTY_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public AnalysisRequestDataAttributes rules(List rules) { + this.rules = rules; + for (AnalysisRequestRule item : rules) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AnalysisRequestDataAttributes addRulesItem(AnalysisRequestRule rulesItem) { + this.rules.add(rulesItem); + this.unparsed |= rulesItem.unparsed; + return this; + } + + /** + * The list of static analysis rules to apply during analysis. + * + * @return rules + */ + @JsonProperty(JSON_PROPERTY_RULES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRules() { + return rules; + } + + public void setRules(List rules) { + this.rules = rules; + } + + /** + * 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 AnalysisRequestDataAttributes + */ + @JsonAnySetter + public AnalysisRequestDataAttributes 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 AnalysisRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisRequestDataAttributes analysisRequestDataAttributes = (AnalysisRequestDataAttributes) o; + return Objects.equals(this.code, analysisRequestDataAttributes.code) + && Objects.equals(this.fileEncoding, analysisRequestDataAttributes.fileEncoding) + && Objects.equals(this.filename, analysisRequestDataAttributes.filename) + && Objects.equals(this.language, analysisRequestDataAttributes.language) + && Objects.equals(this.rules, analysisRequestDataAttributes.rules) + && Objects.equals( + this.additionalProperties, analysisRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, fileEncoding, filename, language, rules, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisRequestDataAttributes {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" fileEncoding: ").append(toIndentedString(fileEncoding)).append("\n"); + sb.append(" filename: ").append(toIndentedString(filename)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).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/AnalysisRequestDataType.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestDataType.java new file mode 100644 index 00000000000..88de9c075af --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestDataType.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; + +/** Analysis request resource type. */ +@JsonSerialize(using = AnalysisRequestDataType.AnalysisRequestDataTypeSerializer.class) +public class AnalysisRequestDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("analysis_request")); + + public static final AnalysisRequestDataType ANALYSIS_REQUEST = + new AnalysisRequestDataType("analysis_request"); + + AnalysisRequestDataType(String value) { + super(value, allowedValues); + } + + public static class AnalysisRequestDataTypeSerializer + extends StdSerializer { + public AnalysisRequestDataTypeSerializer(Class t) { + super(t); + } + + public AnalysisRequestDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AnalysisRequestDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AnalysisRequestDataType fromValue(String value) { + return new AnalysisRequestDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRule.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRule.java new file mode 100644 index 00000000000..e699ac28e18 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisRequestRule.java @@ -0,0 +1,430 @@ +/* + * 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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A static analysis rule to apply during code analysis. */ +@JsonPropertyOrder({ + AnalysisRequestRule.JSON_PROPERTY_CATEGORY, + AnalysisRequestRule.JSON_PROPERTY_CHECKSUM, + AnalysisRequestRule.JSON_PROPERTY_CODE, + AnalysisRequestRule.JSON_PROPERTY_ENTITY_CHECKED, + AnalysisRequestRule.JSON_PROPERTY_ID, + AnalysisRequestRule.JSON_PROPERTY_LANGUAGE, + AnalysisRequestRule.JSON_PROPERTY_REGEX, + AnalysisRequestRule.JSON_PROPERTY_SEVERITY, + AnalysisRequestRule.JSON_PROPERTY_TREE_SITTER_QUERY, + AnalysisRequestRule.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisRequestRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CATEGORY = "category"; + private String 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_ENTITY_CHECKED = "entity_checked"; + private JsonNullable entityChecked = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_LANGUAGE = "language"; + private String language; + + public static final String JSON_PROPERTY_REGEX = "regex"; + private JsonNullable regex = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SEVERITY = "severity"; + private String severity; + + public static final String JSON_PROPERTY_TREE_SITTER_QUERY = "tree_sitter_query"; + private String treeSitterQuery; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public AnalysisRequestRule() {} + + @JsonCreator + public AnalysisRequestRule( + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) String category, + @JsonProperty(required = true, value = JSON_PROPERTY_CHECKSUM) String checksum, + @JsonProperty(required = true, value = JSON_PROPERTY_CODE) String code, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_LANGUAGE) String language, + @JsonProperty(required = true, value = JSON_PROPERTY_SEVERITY) String severity, + @JsonProperty(required = true, value = JSON_PROPERTY_TREE_SITTER_QUERY) + String treeSitterQuery, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.category = category; + this.checksum = checksum; + this.code = code; + this.id = id; + this.language = language; + this.severity = severity; + this.treeSitterQuery = treeSitterQuery; + this.type = type; + } + + public AnalysisRequestRule category(String category) { + this.category = category; + return this; + } + + /** + * The category of the rule (for example, BEST_PRACTICES, SECURITY). + * + * @return category + */ + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public AnalysisRequestRule checksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * A checksum of the rule definition. + * + * @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 AnalysisRequestRule code(String code) { + this.code = code; + return this; + } + + /** + * The base64-encoded rule implementation 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 AnalysisRequestRule entityChecked(String entityChecked) { + this.entityChecked = JsonNullable.of(entityChecked); + return this; + } + + /** + * The code entity type checked by the rule, applicable when rule type is AST_CHECK. + * + * @return entityChecked + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getEntityChecked() { + return entityChecked.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENTITY_CHECKED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getEntityChecked_JsonNullable() { + return entityChecked; + } + + @JsonProperty(JSON_PROPERTY_ENTITY_CHECKED) + public void setEntityChecked_JsonNullable(JsonNullable entityChecked) { + this.entityChecked = entityChecked; + } + + public void setEntityChecked(String entityChecked) { + this.entityChecked = JsonNullable.of(entityChecked); + } + + public AnalysisRequestRule id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the rule. + * + * @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 AnalysisRequestRule language(String language) { + this.language = language; + return this; + } + + /** + * The programming language this rule targets. + * + * @return language + */ + @JsonProperty(JSON_PROPERTY_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public AnalysisRequestRule regex(String regex) { + this.regex = JsonNullable.of(regex); + return this; + } + + /** + * A base64-encoded regex pattern used by the rule, applicable when rule type is REGEX + * . + * + * @return regex + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getRegex() { + return regex.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REGEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getRegex_JsonNullable() { + return regex; + } + + @JsonProperty(JSON_PROPERTY_REGEX) + public void setRegex_JsonNullable(JsonNullable regex) { + this.regex = regex; + } + + public void setRegex(String regex) { + this.regex = JsonNullable.of(regex); + } + + public AnalysisRequestRule severity(String severity) { + this.severity = severity; + return this; + } + + /** + * The severity of findings from this rule (for example, ERROR, WARNING + * ). + * + * @return severity + */ + @JsonProperty(JSON_PROPERTY_SEVERITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSeverity() { + return severity; + } + + public void setSeverity(String severity) { + this.severity = severity; + } + + public AnalysisRequestRule treeSitterQuery(String treeSitterQuery) { + this.treeSitterQuery = treeSitterQuery; + return this; + } + + /** + * The base64-encoded tree-sitter query used by the rule. + * + * @return treeSitterQuery + */ + @JsonProperty(JSON_PROPERTY_TREE_SITTER_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTreeSitterQuery() { + return treeSitterQuery; + } + + public void setTreeSitterQuery(String treeSitterQuery) { + this.treeSitterQuery = treeSitterQuery; + } + + public AnalysisRequestRule type(String type) { + this.type = type; + return this; + } + + /** + * The rule type indicating the detection mechanism (for example, TREE_SITTER_QUERY). + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + public void setType(String type) { + 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 AnalysisRequestRule + */ + @JsonAnySetter + public AnalysisRequestRule 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 AnalysisRequestRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisRequestRule analysisRequestRule = (AnalysisRequestRule) o; + return Objects.equals(this.category, analysisRequestRule.category) + && Objects.equals(this.checksum, analysisRequestRule.checksum) + && Objects.equals(this.code, analysisRequestRule.code) + && Objects.equals(this.entityChecked, analysisRequestRule.entityChecked) + && Objects.equals(this.id, analysisRequestRule.id) + && Objects.equals(this.language, analysisRequestRule.language) + && Objects.equals(this.regex, analysisRequestRule.regex) + && Objects.equals(this.severity, analysisRequestRule.severity) + && Objects.equals(this.treeSitterQuery, analysisRequestRule.treeSitterQuery) + && Objects.equals(this.type, analysisRequestRule.type) + && Objects.equals(this.additionalProperties, analysisRequestRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + category, + checksum, + code, + entityChecked, + id, + language, + regex, + severity, + treeSitterQuery, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisRequestRule {\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(" entityChecked: ").append(toIndentedString(entityChecked)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" regex: ").append(toIndentedString(regex)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" treeSitterQuery: ").append(toIndentedString(treeSitterQuery)).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/AnalysisResponse.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisResponse.java new file mode 100644 index 00000000000..399aec61a17 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisResponse.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; + +/** The response payload from running static analysis on source code. */ +@JsonPropertyOrder({AnalysisResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AnalysisResponseData data; + + public AnalysisResponse() {} + + @JsonCreator + public AnalysisResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AnalysisResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AnalysisResponse data(AnalysisResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The primary data object in the analysis response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisResponseData getData() { + return data; + } + + public void setData(AnalysisResponseData 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 AnalysisResponse + */ + @JsonAnySetter + public AnalysisResponse 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 AnalysisResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisResponse analysisResponse = (AnalysisResponse) o; + return Objects.equals(this.data, analysisResponse.data) + && Objects.equals(this.additionalProperties, analysisResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisResponse {\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/AnalysisResponseData.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisResponseData.java new file mode 100644 index 00000000000..e45c36d55e7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisResponseData.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; + +/** The primary data object in the analysis response. */ +@JsonPropertyOrder({ + AnalysisResponseData.JSON_PROPERTY_ATTRIBUTES, + AnalysisResponseData.JSON_PROPERTY_ID, + AnalysisResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AnalysisResponseDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AnalysisResponseDataType type = AnalysisResponseDataType.SERVER_REQUEST; + + public AnalysisResponseData() {} + + @JsonCreator + public AnalysisResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AnalysisResponseDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AnalysisResponseDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AnalysisResponseData attributes(AnalysisResponseDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the analysis response, containing rule results and any top-level errors. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisResponseDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AnalysisResponseDataAttributes attributes) { + this.attributes = attributes; + } + + public AnalysisResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the analysis response resource. + * + * @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 AnalysisResponseData type(AnalysisResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Analysis response resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisResponseDataType getType() { + return type; + } + + public void setType(AnalysisResponseDataType 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 AnalysisResponseData + */ + @JsonAnySetter + public AnalysisResponseData 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 AnalysisResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisResponseData analysisResponseData = (AnalysisResponseData) o; + return Objects.equals(this.attributes, analysisResponseData.attributes) + && Objects.equals(this.id, analysisResponseData.id) + && Objects.equals(this.type, analysisResponseData.type) + && Objects.equals(this.additionalProperties, analysisResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisResponseData {\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/AnalysisResponseDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisResponseDataAttributes.java new file mode 100644 index 00000000000..a91b959704f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisResponseDataAttributes.java @@ -0,0 +1,193 @@ +/* + * 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; + +/** The attributes of the analysis response, containing rule results and any top-level errors. */ +@JsonPropertyOrder({ + AnalysisResponseDataAttributes.JSON_PROPERTY_ERRORS, + AnalysisResponseDataAttributes.JSON_PROPERTY_RULE_RESPONSES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisResponseDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ERRORS = "errors"; + private List errors = new ArrayList<>(); + + public static final String JSON_PROPERTY_RULE_RESPONSES = "rule_responses"; + private List ruleResponses = new ArrayList<>(); + + public AnalysisResponseDataAttributes() {} + + @JsonCreator + public AnalysisResponseDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ERRORS) List errors, + @JsonProperty(required = true, value = JSON_PROPERTY_RULE_RESPONSES) + List ruleResponses) { + this.errors = errors; + this.ruleResponses = ruleResponses; + } + + public AnalysisResponseDataAttributes errors(List errors) { + this.errors = errors; + return this; + } + + public AnalysisResponseDataAttributes addErrorsItem(String errorsItem) { + this.errors.add(errorsItem); + return this; + } + + /** + * Top-level error messages encountered during the analysis operation. + * + * @return errors + */ + @JsonProperty(JSON_PROPERTY_ERRORS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getErrors() { + return errors; + } + + public void setErrors(List errors) { + this.errors = errors; + } + + public AnalysisResponseDataAttributes ruleResponses(List ruleResponses) { + this.ruleResponses = ruleResponses; + for (AnalysisRuleResponse item : ruleResponses) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AnalysisResponseDataAttributes addRuleResponsesItem( + AnalysisRuleResponse ruleResponsesItem) { + this.ruleResponses.add(ruleResponsesItem); + this.unparsed |= ruleResponsesItem.unparsed; + return this; + } + + /** + * The list of results for each static analysis rule applied during analysis. + * + * @return ruleResponses + */ + @JsonProperty(JSON_PROPERTY_RULE_RESPONSES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRuleResponses() { + return ruleResponses; + } + + public void setRuleResponses(List ruleResponses) { + this.ruleResponses = ruleResponses; + } + + /** + * 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 AnalysisResponseDataAttributes + */ + @JsonAnySetter + public AnalysisResponseDataAttributes 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 AnalysisResponseDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisResponseDataAttributes analysisResponseDataAttributes = + (AnalysisResponseDataAttributes) o; + return Objects.equals(this.errors, analysisResponseDataAttributes.errors) + && Objects.equals(this.ruleResponses, analysisResponseDataAttributes.ruleResponses) + && Objects.equals( + this.additionalProperties, analysisResponseDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(errors, ruleResponses, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisResponseDataAttributes {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" ruleResponses: ").append(toIndentedString(ruleResponses)).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/AnalysisResponseDataType.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisResponseDataType.java new file mode 100644 index 00000000000..a683858e1f7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisResponseDataType.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; + +/** Analysis response resource type. */ +@JsonSerialize(using = AnalysisResponseDataType.AnalysisResponseDataTypeSerializer.class) +public class AnalysisResponseDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("server_request")); + + public static final AnalysisResponseDataType SERVER_REQUEST = + new AnalysisResponseDataType("server_request"); + + AnalysisResponseDataType(String value) { + super(value, allowedValues); + } + + public static class AnalysisResponseDataTypeSerializer + extends StdSerializer { + public AnalysisResponseDataTypeSerializer(Class t) { + super(t); + } + + public AnalysisResponseDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AnalysisResponseDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AnalysisResponseDataType fromValue(String value) { + return new AnalysisResponseDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnalysisRuleResponse.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisRuleResponse.java new file mode 100644 index 00000000000..9226307e064 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisRuleResponse.java @@ -0,0 +1,312 @@ +/* + * 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; + +/** The result of applying a single static analysis rule to the analyzed source code. */ +@JsonPropertyOrder({ + AnalysisRuleResponse.JSON_PROPERTY_ERRORS, + AnalysisRuleResponse.JSON_PROPERTY_EXECUTION_ERROR, + AnalysisRuleResponse.JSON_PROPERTY_EXECUTION_TIME_MS, + AnalysisRuleResponse.JSON_PROPERTY_IDENTIFIER, + AnalysisRuleResponse.JSON_PROPERTY_OUTPUT, + AnalysisRuleResponse.JSON_PROPERTY_VIOLATIONS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisRuleResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ERRORS = "errors"; + private List errors = new ArrayList<>(); + + public static final String JSON_PROPERTY_EXECUTION_ERROR = "execution_error"; + private String executionError; + + public static final String JSON_PROPERTY_EXECUTION_TIME_MS = "execution_time_ms"; + private Long executionTimeMs; + + public static final String JSON_PROPERTY_IDENTIFIER = "identifier"; + private String identifier; + + public static final String JSON_PROPERTY_OUTPUT = "output"; + private String output; + + public static final String JSON_PROPERTY_VIOLATIONS = "violations"; + private List violations = new ArrayList<>(); + + public AnalysisRuleResponse() {} + + @JsonCreator + public AnalysisRuleResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ERRORS) List errors, + @JsonProperty(required = true, value = JSON_PROPERTY_EXECUTION_ERROR) String executionError, + @JsonProperty(required = true, value = JSON_PROPERTY_EXECUTION_TIME_MS) Long executionTimeMs, + @JsonProperty(required = true, value = JSON_PROPERTY_IDENTIFIER) String identifier, + @JsonProperty(required = true, value = JSON_PROPERTY_OUTPUT) String output, + @JsonProperty(required = true, value = JSON_PROPERTY_VIOLATIONS) + List violations) { + this.errors = errors; + this.executionError = executionError; + if (executionError != null) {} + this.executionTimeMs = executionTimeMs; + this.identifier = identifier; + this.output = output; + this.violations = violations; + } + + public AnalysisRuleResponse errors(List errors) { + this.errors = errors; + return this; + } + + public AnalysisRuleResponse addErrorsItem(String errorsItem) { + this.errors.add(errorsItem); + return this; + } + + /** + * A list of error messages encountered while executing the rule. + * + * @return errors + */ + @JsonProperty(JSON_PROPERTY_ERRORS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getErrors() { + return errors; + } + + public void setErrors(List errors) { + this.errors = errors; + } + + public AnalysisRuleResponse executionError(String executionError) { + this.executionError = executionError; + if (executionError != null) {} + return this; + } + + /** + * An error message if the rule execution failed, or null if execution succeeded. + * + * @return executionError + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXECUTION_ERROR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getExecutionError() { + return executionError; + } + + public void setExecutionError(String executionError) { + this.executionError = executionError; + } + + public AnalysisRuleResponse executionTimeMs(Long executionTimeMs) { + this.executionTimeMs = executionTimeMs; + return this; + } + + /** + * The time taken to execute the rule, in milliseconds. + * + * @return executionTimeMs + */ + @JsonProperty(JSON_PROPERTY_EXECUTION_TIME_MS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getExecutionTimeMs() { + return executionTimeMs; + } + + public void setExecutionTimeMs(Long executionTimeMs) { + this.executionTimeMs = executionTimeMs; + } + + public AnalysisRuleResponse identifier(String identifier) { + this.identifier = identifier; + return this; + } + + /** + * The identifier of the rule that produced this response. + * + * @return identifier + */ + @JsonProperty(JSON_PROPERTY_IDENTIFIER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public AnalysisRuleResponse output(String output) { + this.output = output; + return this; + } + + /** + * The raw output produced by the rule engine during execution. + * + * @return output + */ + @JsonProperty(JSON_PROPERTY_OUTPUT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getOutput() { + return output; + } + + public void setOutput(String output) { + this.output = output; + } + + public AnalysisRuleResponse violations(List violations) { + this.violations = violations; + for (AnalysisViolation item : violations) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AnalysisRuleResponse addViolationsItem(AnalysisViolation violationsItem) { + this.violations.add(violationsItem); + this.unparsed |= violationsItem.unparsed; + return this; + } + + /** + * The list of violations found by this rule. + * + * @return violations + */ + @JsonProperty(JSON_PROPERTY_VIOLATIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getViolations() { + return violations; + } + + public void setViolations(List violations) { + this.violations = violations; + } + + /** + * 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 AnalysisRuleResponse + */ + @JsonAnySetter + public AnalysisRuleResponse 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 AnalysisRuleResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisRuleResponse analysisRuleResponse = (AnalysisRuleResponse) o; + return Objects.equals(this.errors, analysisRuleResponse.errors) + && Objects.equals(this.executionError, analysisRuleResponse.executionError) + && Objects.equals(this.executionTimeMs, analysisRuleResponse.executionTimeMs) + && Objects.equals(this.identifier, analysisRuleResponse.identifier) + && Objects.equals(this.output, analysisRuleResponse.output) + && Objects.equals(this.violations, analysisRuleResponse.violations) + && Objects.equals(this.additionalProperties, analysisRuleResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + errors, + executionError, + executionTimeMs, + identifier, + output, + violations, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisRuleResponse {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" executionError: ").append(toIndentedString(executionError)).append("\n"); + sb.append(" executionTimeMs: ").append(toIndentedString(executionTimeMs)).append("\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + sb.append(" violations: ").append(toIndentedString(violations)).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/AnalysisViolation.java b/src/main/java/com/datadog/api/client/v2/model/AnalysisViolation.java new file mode 100644 index 00000000000..fbe4ea326f7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnalysisViolation.java @@ -0,0 +1,300 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A rule violation found in the analyzed source code. */ +@JsonPropertyOrder({ + AnalysisViolation.JSON_PROPERTY_CATEGORY, + AnalysisViolation.JSON_PROPERTY_END, + AnalysisViolation.JSON_PROPERTY_FIXES, + AnalysisViolation.JSON_PROPERTY_MESSAGE, + AnalysisViolation.JSON_PROPERTY_SEVERITY, + AnalysisViolation.JSON_PROPERTY_START +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnalysisViolation { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CATEGORY = "category"; + private String category; + + public static final String JSON_PROPERTY_END = "end"; + private AnalysisPosition end; + + public static final String JSON_PROPERTY_FIXES = "fixes"; + private List fixes = new ArrayList<>(); + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_SEVERITY = "severity"; + private String severity; + + public static final String JSON_PROPERTY_START = "start"; + private AnalysisPosition start; + + public AnalysisViolation() {} + + @JsonCreator + public AnalysisViolation( + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) String category, + @JsonProperty(required = true, value = JSON_PROPERTY_END) AnalysisPosition end, + @JsonProperty(required = true, value = JSON_PROPERTY_FIXES) List fixes, + @JsonProperty(required = true, value = JSON_PROPERTY_MESSAGE) String message, + @JsonProperty(required = true, value = JSON_PROPERTY_SEVERITY) String severity, + @JsonProperty(required = true, value = JSON_PROPERTY_START) AnalysisPosition start) { + this.category = category; + this.end = end; + this.unparsed |= end.unparsed; + this.fixes = fixes; + this.message = message; + this.severity = severity; + this.start = start; + this.unparsed |= start.unparsed; + } + + public AnalysisViolation category(String category) { + this.category = category; + return this; + } + + /** + * The category of the violation. + * + * @return category + */ + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public AnalysisViolation end(AnalysisPosition end) { + this.end = end; + this.unparsed |= end.unparsed; + return this; + } + + /** + * A position in source code, identified by line and column numbers. + * + * @return end + */ + @JsonProperty(JSON_PROPERTY_END) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisPosition getEnd() { + return end; + } + + public void setEnd(AnalysisPosition end) { + this.end = end; + } + + public AnalysisViolation fixes(List fixes) { + this.fixes = fixes; + for (AnalysisFix item : fixes) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AnalysisViolation addFixesItem(AnalysisFix fixesItem) { + this.fixes.add(fixesItem); + this.unparsed |= fixesItem.unparsed; + return this; + } + + /** + * The list of suggested fixes for this violation. + * + * @return fixes + */ + @JsonProperty(JSON_PROPERTY_FIXES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getFixes() { + return fixes; + } + + public void setFixes(List fixes) { + this.fixes = fixes; + } + + public AnalysisViolation message(String message) { + this.message = message; + return this; + } + + /** + * A human-readable description of the violation. + * + * @return message + */ + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public AnalysisViolation severity(String severity) { + this.severity = severity; + return this; + } + + /** + * The severity level of the violation. + * + * @return severity + */ + @JsonProperty(JSON_PROPERTY_SEVERITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSeverity() { + return severity; + } + + public void setSeverity(String severity) { + this.severity = severity; + } + + public AnalysisViolation start(AnalysisPosition start) { + this.start = start; + this.unparsed |= start.unparsed; + return this; + } + + /** + * A position in source code, identified by line and column numbers. + * + * @return start + */ + @JsonProperty(JSON_PROPERTY_START) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnalysisPosition getStart() { + return start; + } + + public void setStart(AnalysisPosition start) { + this.start = start; + } + + /** + * 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 AnalysisViolation + */ + @JsonAnySetter + public AnalysisViolation 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 AnalysisViolation object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisViolation analysisViolation = (AnalysisViolation) o; + return Objects.equals(this.category, analysisViolation.category) + && Objects.equals(this.end, analysisViolation.end) + && Objects.equals(this.fixes, analysisViolation.fixes) + && Objects.equals(this.message, analysisViolation.message) + && Objects.equals(this.severity, analysisViolation.severity) + && Objects.equals(this.start, analysisViolation.start) + && Objects.equals(this.additionalProperties, analysisViolation.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(category, end, fixes, message, severity, start, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisViolation {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" end: ").append(toIndentedString(end)).append("\n"); + sb.append(" fixes: ").append(toIndentedString(fixes)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomRulesetListResponse.java b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetListResponse.java new file mode 100644 index 00000000000..68a77643ba8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomRulesetListResponse.java @@ -0,0 +1,155 @@ +/* + * 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; + +/** Response containing a list of custom rulesets for the authenticated organization. */ +@JsonPropertyOrder({CustomRulesetListResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomRulesetListResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public CustomRulesetListResponse() {} + + @JsonCreator + public CustomRulesetListResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public CustomRulesetListResponse data(List data) { + this.data = data; + for (CustomRuleset item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CustomRulesetListResponse addDataItem(CustomRuleset dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of custom rulesets. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 CustomRulesetListResponse + */ + @JsonAnySetter + public CustomRulesetListResponse 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 CustomRulesetListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomRulesetListResponse customRulesetListResponse = (CustomRulesetListResponse) o; + return Objects.equals(this.data, customRulesetListResponse.data) + && Objects.equals( + this.additionalProperties, customRulesetListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomRulesetListResponse {\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/DefaultRulesetsPerLanguageData.java b/src/main/java/com/datadog/api/client/v2/model/DefaultRulesetsPerLanguageData.java new file mode 100644 index 00000000000..63fc90332c0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DefaultRulesetsPerLanguageData.java @@ -0,0 +1,215 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The primary data object in the default rulesets per language response. */ +@JsonPropertyOrder({ + DefaultRulesetsPerLanguageData.JSON_PROPERTY_ATTRIBUTES, + DefaultRulesetsPerLanguageData.JSON_PROPERTY_ID, + DefaultRulesetsPerLanguageData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DefaultRulesetsPerLanguageData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private DefaultRulesetsPerLanguageDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private DefaultRulesetsPerLanguageDataType type = + DefaultRulesetsPerLanguageDataType.DEFAULT_RULESETS_PER_LANGUAGE; + + public DefaultRulesetsPerLanguageData() {} + + @JsonCreator + public DefaultRulesetsPerLanguageData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + DefaultRulesetsPerLanguageDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + DefaultRulesetsPerLanguageDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DefaultRulesetsPerLanguageData attributes( + DefaultRulesetsPerLanguageDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the default rulesets per language response, containing the list of default + * ruleset names. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DefaultRulesetsPerLanguageDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(DefaultRulesetsPerLanguageDataAttributes attributes) { + this.attributes = attributes; + } + + public DefaultRulesetsPerLanguageData id(String id) { + this.id = id; + return this; + } + + /** + * The language identifier used as the resource 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 DefaultRulesetsPerLanguageData type(DefaultRulesetsPerLanguageDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Default rulesets per language resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DefaultRulesetsPerLanguageDataType getType() { + return type; + } + + public void setType(DefaultRulesetsPerLanguageDataType 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 DefaultRulesetsPerLanguageData + */ + @JsonAnySetter + public DefaultRulesetsPerLanguageData 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 DefaultRulesetsPerLanguageData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefaultRulesetsPerLanguageData defaultRulesetsPerLanguageData = + (DefaultRulesetsPerLanguageData) o; + return Objects.equals(this.attributes, defaultRulesetsPerLanguageData.attributes) + && Objects.equals(this.id, defaultRulesetsPerLanguageData.id) + && Objects.equals(this.type, defaultRulesetsPerLanguageData.type) + && Objects.equals( + this.additionalProperties, defaultRulesetsPerLanguageData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefaultRulesetsPerLanguageData {\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/DefaultRulesetsPerLanguageDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/DefaultRulesetsPerLanguageDataAttributes.java new file mode 100644 index 00000000000..19752857764 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DefaultRulesetsPerLanguageDataAttributes.java @@ -0,0 +1,156 @@ +/* + * 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; + +/** + * The attributes of the default rulesets per language response, containing the list of default + * ruleset names. + */ +@JsonPropertyOrder({DefaultRulesetsPerLanguageDataAttributes.JSON_PROPERTY_RULESETS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DefaultRulesetsPerLanguageDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_RULESETS = "rulesets"; + private List rulesets = new ArrayList<>(); + + public DefaultRulesetsPerLanguageDataAttributes() {} + + @JsonCreator + public DefaultRulesetsPerLanguageDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_RULESETS) List rulesets) { + this.rulesets = rulesets; + } + + public DefaultRulesetsPerLanguageDataAttributes rulesets(List rulesets) { + this.rulesets = rulesets; + return this; + } + + public DefaultRulesetsPerLanguageDataAttributes addRulesetsItem(String rulesetsItem) { + this.rulesets.add(rulesetsItem); + return this; + } + + /** + * The list of default ruleset names for the specified programming language. + * + * @return rulesets + */ + @JsonProperty(JSON_PROPERTY_RULESETS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRulesets() { + return rulesets; + } + + public void setRulesets(List rulesets) { + this.rulesets = rulesets; + } + + /** + * 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 DefaultRulesetsPerLanguageDataAttributes + */ + @JsonAnySetter + public DefaultRulesetsPerLanguageDataAttributes 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 DefaultRulesetsPerLanguageDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefaultRulesetsPerLanguageDataAttributes defaultRulesetsPerLanguageDataAttributes = + (DefaultRulesetsPerLanguageDataAttributes) o; + return Objects.equals(this.rulesets, defaultRulesetsPerLanguageDataAttributes.rulesets) + && Objects.equals( + this.additionalProperties, + defaultRulesetsPerLanguageDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(rulesets, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefaultRulesetsPerLanguageDataAttributes {\n"); + sb.append(" rulesets: ").append(toIndentedString(rulesets)).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/DefaultRulesetsPerLanguageDataType.java b/src/main/java/com/datadog/api/client/v2/model/DefaultRulesetsPerLanguageDataType.java new file mode 100644 index 00000000000..a61496975dd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DefaultRulesetsPerLanguageDataType.java @@ -0,0 +1,59 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +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; + +/** Default rulesets per language resource type. */ +@JsonSerialize( + using = DefaultRulesetsPerLanguageDataType.DefaultRulesetsPerLanguageDataTypeSerializer.class) +public class DefaultRulesetsPerLanguageDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("defaultRulesetsPerLanguage")); + + public static final DefaultRulesetsPerLanguageDataType DEFAULT_RULESETS_PER_LANGUAGE = + new DefaultRulesetsPerLanguageDataType("defaultRulesetsPerLanguage"); + + DefaultRulesetsPerLanguageDataType(String value) { + super(value, allowedValues); + } + + public static class DefaultRulesetsPerLanguageDataTypeSerializer + extends StdSerializer { + public DefaultRulesetsPerLanguageDataTypeSerializer( + Class t) { + super(t); + } + + public DefaultRulesetsPerLanguageDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + DefaultRulesetsPerLanguageDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static DefaultRulesetsPerLanguageDataType fromValue(String value) { + return new DefaultRulesetsPerLanguageDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DefaultRulesetsPerLanguageResponse.java b/src/main/java/com/datadog/api/client/v2/model/DefaultRulesetsPerLanguageResponse.java new file mode 100644 index 00000000000..241beae15a4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DefaultRulesetsPerLanguageResponse.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The response payload containing the default ruleset names for a programming language. */ +@JsonPropertyOrder({DefaultRulesetsPerLanguageResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DefaultRulesetsPerLanguageResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private DefaultRulesetsPerLanguageData data; + + public DefaultRulesetsPerLanguageResponse() {} + + @JsonCreator + public DefaultRulesetsPerLanguageResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + DefaultRulesetsPerLanguageData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public DefaultRulesetsPerLanguageResponse data(DefaultRulesetsPerLanguageData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The primary data object in the default rulesets per language response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DefaultRulesetsPerLanguageData getData() { + return data; + } + + public void setData(DefaultRulesetsPerLanguageData 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 DefaultRulesetsPerLanguageResponse + */ + @JsonAnySetter + public DefaultRulesetsPerLanguageResponse 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 DefaultRulesetsPerLanguageResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefaultRulesetsPerLanguageResponse defaultRulesetsPerLanguageResponse = + (DefaultRulesetsPerLanguageResponse) o; + return Objects.equals(this.data, defaultRulesetsPerLanguageResponse.data) + && Objects.equals( + this.additionalProperties, defaultRulesetsPerLanguageResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefaultRulesetsPerLanguageResponse {\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/GetAstRequest.java b/src/main/java/com/datadog/api/client/v2/model/GetAstRequest.java new file mode 100644 index 00000000000..b7975774f3b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstRequest.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; + +/** The request payload for parsing source code into an abstract syntax tree. */ +@JsonPropertyOrder({GetAstRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GetAstRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GetAstRequestData data; + + public GetAstRequest() {} + + @JsonCreator + public GetAstRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) GetAstRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GetAstRequest data(GetAstRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The primary data object in the get-AST request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GetAstRequestData getData() { + return data; + } + + public void setData(GetAstRequestData 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 GetAstRequest + */ + @JsonAnySetter + public GetAstRequest 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 GetAstRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAstRequest getAstRequest = (GetAstRequest) o; + return Objects.equals(this.data, getAstRequest.data) + && Objects.equals(this.additionalProperties, getAstRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAstRequest {\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/GetAstRequestData.java b/src/main/java/com/datadog/api/client/v2/model/GetAstRequestData.java new file mode 100644 index 00000000000..3380c835071 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstRequestData.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; + +/** The primary data object in the get-AST request. */ +@JsonPropertyOrder({ + GetAstRequestData.JSON_PROPERTY_ATTRIBUTES, + GetAstRequestData.JSON_PROPERTY_ID, + GetAstRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GetAstRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GetAstRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GetAstRequestDataType type = GetAstRequestDataType.GET_AST_REQUEST; + + public GetAstRequestData() {} + + @JsonCreator + public GetAstRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GetAstRequestDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GetAstRequestDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GetAstRequestData attributes(GetAstRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the get-AST request, containing the source code to parse. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GetAstRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GetAstRequestDataAttributes attributes) { + this.attributes = attributes; + } + + public GetAstRequestData id(String id) { + this.id = id; + return this; + } + + /** + * An optional identifier for the get-AST request resource. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GetAstRequestData type(GetAstRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Get AST request resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GetAstRequestDataType getType() { + return type; + } + + public void setType(GetAstRequestDataType 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 GetAstRequestData + */ + @JsonAnySetter + public GetAstRequestData 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 GetAstRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAstRequestData getAstRequestData = (GetAstRequestData) o; + return Objects.equals(this.attributes, getAstRequestData.attributes) + && Objects.equals(this.id, getAstRequestData.id) + && Objects.equals(this.type, getAstRequestData.type) + && Objects.equals(this.additionalProperties, getAstRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAstRequestData {\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/GetAstRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GetAstRequestDataAttributes.java new file mode 100644 index 00000000000..8872c2c1936 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstRequestDataAttributes.java @@ -0,0 +1,202 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The attributes of the get-AST request, containing the source code to parse. */ +@JsonPropertyOrder({ + GetAstRequestDataAttributes.JSON_PROPERTY_CODE, + GetAstRequestDataAttributes.JSON_PROPERTY_FILE_ENCODING, + GetAstRequestDataAttributes.JSON_PROPERTY_LANGUAGE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GetAstRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_FILE_ENCODING = "file_encoding"; + private String fileEncoding; + + public static final String JSON_PROPERTY_LANGUAGE = "language"; + private String language; + + public GetAstRequestDataAttributes() {} + + @JsonCreator + public GetAstRequestDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CODE) String code, + @JsonProperty(required = true, value = JSON_PROPERTY_FILE_ENCODING) String fileEncoding, + @JsonProperty(required = true, value = JSON_PROPERTY_LANGUAGE) String language) { + this.code = code; + this.fileEncoding = fileEncoding; + this.language = language; + } + + public GetAstRequestDataAttributes code(String code) { + this.code = code; + return this; + } + + /** + * The base64-encoded source code to parse into an abstract syntax tree. + * + * @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 GetAstRequestDataAttributes fileEncoding(String fileEncoding) { + this.fileEncoding = fileEncoding; + return this; + } + + /** + * The encoding of the source code file (must be utf-8). + * + * @return fileEncoding + */ + @JsonProperty(JSON_PROPERTY_FILE_ENCODING) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getFileEncoding() { + return fileEncoding; + } + + public void setFileEncoding(String fileEncoding) { + this.fileEncoding = fileEncoding; + } + + public GetAstRequestDataAttributes language(String language) { + this.language = language; + return this; + } + + /** + * The programming language of the source code to parse. + * + * @return language + */ + @JsonProperty(JSON_PROPERTY_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + /** + * 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 GetAstRequestDataAttributes + */ + @JsonAnySetter + public GetAstRequestDataAttributes 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 GetAstRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAstRequestDataAttributes getAstRequestDataAttributes = (GetAstRequestDataAttributes) o; + return Objects.equals(this.code, getAstRequestDataAttributes.code) + && Objects.equals(this.fileEncoding, getAstRequestDataAttributes.fileEncoding) + && Objects.equals(this.language, getAstRequestDataAttributes.language) + && Objects.equals( + this.additionalProperties, getAstRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, fileEncoding, language, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAstRequestDataAttributes {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" fileEncoding: ").append(toIndentedString(fileEncoding)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).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/GetAstRequestDataType.java b/src/main/java/com/datadog/api/client/v2/model/GetAstRequestDataType.java new file mode 100644 index 00000000000..ee1a330b619 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstRequestDataType.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; + +/** Get AST request resource type. */ +@JsonSerialize(using = GetAstRequestDataType.GetAstRequestDataTypeSerializer.class) +public class GetAstRequestDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("get_ast_request")); + + public static final GetAstRequestDataType GET_AST_REQUEST = + new GetAstRequestDataType("get_ast_request"); + + GetAstRequestDataType(String value) { + super(value, allowedValues); + } + + public static class GetAstRequestDataTypeSerializer extends StdSerializer { + public GetAstRequestDataTypeSerializer(Class t) { + super(t); + } + + public GetAstRequestDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GetAstRequestDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GetAstRequestDataType fromValue(String value) { + return new GetAstRequestDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GetAstResponse.java b/src/main/java/com/datadog/api/client/v2/model/GetAstResponse.java new file mode 100644 index 00000000000..4d49632bff8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstResponse.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; + +/** The response payload containing the parsed abstract syntax tree. */ +@JsonPropertyOrder({GetAstResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GetAstResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GetAstResponseData data; + + public GetAstResponse() {} + + @JsonCreator + public GetAstResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) GetAstResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GetAstResponse data(GetAstResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The primary data object in the get-AST response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GetAstResponseData getData() { + return data; + } + + public void setData(GetAstResponseData 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 GetAstResponse + */ + @JsonAnySetter + public GetAstResponse 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 GetAstResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAstResponse getAstResponse = (GetAstResponse) o; + return Objects.equals(this.data, getAstResponse.data) + && Objects.equals(this.additionalProperties, getAstResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAstResponse {\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/GetAstResponseData.java b/src/main/java/com/datadog/api/client/v2/model/GetAstResponseData.java new file mode 100644 index 00000000000..40742da249d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstResponseData.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; + +/** The primary data object in the get-AST response. */ +@JsonPropertyOrder({ + GetAstResponseData.JSON_PROPERTY_ATTRIBUTES, + GetAstResponseData.JSON_PROPERTY_ID, + GetAstResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GetAstResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GetAstResponseDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GetAstResponseDataType type = GetAstResponseDataType.GET_AST_RESPONSE; + + public GetAstResponseData() {} + + @JsonCreator + public GetAstResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GetAstResponseDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GetAstResponseDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GetAstResponseData attributes(GetAstResponseDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the get-AST response, containing the parsed abstract syntax tree. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GetAstResponseDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GetAstResponseDataAttributes attributes) { + this.attributes = attributes; + } + + public GetAstResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the get-AST response resource. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GetAstResponseData type(GetAstResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Get AST response resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GetAstResponseDataType getType() { + return type; + } + + public void setType(GetAstResponseDataType 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 GetAstResponseData + */ + @JsonAnySetter + public GetAstResponseData 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 GetAstResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAstResponseData getAstResponseData = (GetAstResponseData) o; + return Objects.equals(this.attributes, getAstResponseData.attributes) + && Objects.equals(this.id, getAstResponseData.id) + && Objects.equals(this.type, getAstResponseData.type) + && Objects.equals(this.additionalProperties, getAstResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAstResponseData {\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/GetAstResponseDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GetAstResponseDataAttributes.java new file mode 100644 index 00000000000..8033d479a24 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstResponseDataAttributes.java @@ -0,0 +1,149 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The attributes of the get-AST response, containing the parsed abstract syntax tree. */ +@JsonPropertyOrder({GetAstResponseDataAttributes.JSON_PROPERTY_AST}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GetAstResponseDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AST = "ast"; + private Map ast = new HashMap(); + + public GetAstResponseDataAttributes() {} + + @JsonCreator + public GetAstResponseDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_AST) Map ast) { + this.ast = ast; + } + + public GetAstResponseDataAttributes ast(Map ast) { + this.ast = ast; + return this; + } + + public GetAstResponseDataAttributes putAstItem(String key, Object astItem) { + this.ast.put(key, astItem); + return this; + } + + /** + * The parsed abstract syntax tree as a JSON object. + * + * @return ast + */ + @JsonProperty(JSON_PROPERTY_AST) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getAst() { + return ast; + } + + public void setAst(Map ast) { + this.ast = ast; + } + + /** + * 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 GetAstResponseDataAttributes + */ + @JsonAnySetter + public GetAstResponseDataAttributes 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 GetAstResponseDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAstResponseDataAttributes getAstResponseDataAttributes = (GetAstResponseDataAttributes) o; + return Objects.equals(this.ast, getAstResponseDataAttributes.ast) + && Objects.equals( + this.additionalProperties, getAstResponseDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ast, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAstResponseDataAttributes {\n"); + sb.append(" ast: ").append(toIndentedString(ast)).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/GetAstResponseDataType.java b/src/main/java/com/datadog/api/client/v2/model/GetAstResponseDataType.java new file mode 100644 index 00000000000..646aac6e53c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetAstResponseDataType.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; + +/** Get AST response resource type. */ +@JsonSerialize(using = GetAstResponseDataType.GetAstResponseDataTypeSerializer.class) +public class GetAstResponseDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("get_ast_response")); + + public static final GetAstResponseDataType GET_AST_RESPONSE = + new GetAstResponseDataType("get_ast_response"); + + GetAstResponseDataType(String value) { + super(value, allowedValues); + } + + public static class GetAstResponseDataTypeSerializer + extends StdSerializer { + public GetAstResponseDataTypeSerializer(Class t) { + super(t); + } + + public GetAstResponseDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GetAstResponseDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GetAstResponseDataType fromValue(String value) { + return new GetAstResponseDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NodeTypesResponse.java b/src/main/java/com/datadog/api/client/v2/model/NodeTypesResponse.java new file mode 100644 index 00000000000..fb73f3daa8a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NodeTypesResponse.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; + +/** The response payload containing tree-sitter node type definitions for a programming language. */ +@JsonPropertyOrder({NodeTypesResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NodeTypesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private NodeTypesResponseData data; + + public NodeTypesResponse() {} + + @JsonCreator + public NodeTypesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) NodeTypesResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public NodeTypesResponse data(NodeTypesResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The primary data object in the node types response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NodeTypesResponseData getData() { + return data; + } + + public void setData(NodeTypesResponseData 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 NodeTypesResponse + */ + @JsonAnySetter + public NodeTypesResponse 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 NodeTypesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NodeTypesResponse nodeTypesResponse = (NodeTypesResponse) o; + return Objects.equals(this.data, nodeTypesResponse.data) + && Objects.equals(this.additionalProperties, nodeTypesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NodeTypesResponse {\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/NodeTypesResponseData.java b/src/main/java/com/datadog/api/client/v2/model/NodeTypesResponseData.java new file mode 100644 index 00000000000..b4a82e63acc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NodeTypesResponseData.java @@ -0,0 +1,210 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The primary data object in the node types response. */ +@JsonPropertyOrder({ + NodeTypesResponseData.JSON_PROPERTY_ATTRIBUTES, + NodeTypesResponseData.JSON_PROPERTY_ID, + NodeTypesResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NodeTypesResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private NodeTypesResponseDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private NodeTypesResponseDataType type = NodeTypesResponseDataType.GET_NODE_TYPES_RESPONSE; + + public NodeTypesResponseData() {} + + @JsonCreator + public NodeTypesResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + NodeTypesResponseDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) NodeTypesResponseDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public NodeTypesResponseData attributes(NodeTypesResponseDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the node types response, containing the list of node type definitions for the + * requested language. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NodeTypesResponseDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(NodeTypesResponseDataAttributes attributes) { + this.attributes = attributes; + } + + public NodeTypesResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the node types response resource. + * + * @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 NodeTypesResponseData type(NodeTypesResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Get node types response resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NodeTypesResponseDataType getType() { + return type; + } + + public void setType(NodeTypesResponseDataType 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 NodeTypesResponseData + */ + @JsonAnySetter + public NodeTypesResponseData 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 NodeTypesResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NodeTypesResponseData nodeTypesResponseData = (NodeTypesResponseData) o; + return Objects.equals(this.attributes, nodeTypesResponseData.attributes) + && Objects.equals(this.id, nodeTypesResponseData.id) + && Objects.equals(this.type, nodeTypesResponseData.type) + && Objects.equals(this.additionalProperties, nodeTypesResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NodeTypesResponseData {\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/NodeTypesResponseDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/NodeTypesResponseDataAttributes.java new file mode 100644 index 00000000000..6a23b559489 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NodeTypesResponseDataAttributes.java @@ -0,0 +1,156 @@ +/* + * 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; + +/** + * The attributes of the node types response, containing the list of node type definitions for the + * requested language. + */ +@JsonPropertyOrder({NodeTypesResponseDataAttributes.JSON_PROPERTY_NODE_TYPES}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NodeTypesResponseDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NODE_TYPES = "node_types"; + private List> nodeTypes = new ArrayList<>(); + + public NodeTypesResponseDataAttributes() {} + + @JsonCreator + public NodeTypesResponseDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_NODE_TYPES) + List> nodeTypes) { + this.nodeTypes = nodeTypes; + } + + public NodeTypesResponseDataAttributes nodeTypes(List> nodeTypes) { + this.nodeTypes = nodeTypes; + return this; + } + + public NodeTypesResponseDataAttributes addNodeTypesItem(Map nodeTypesItem) { + this.nodeTypes.add(nodeTypesItem); + return this; + } + + /** + * The list of tree-sitter node type definitions for the language. + * + * @return nodeTypes + */ + @JsonProperty(JSON_PROPERTY_NODE_TYPES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List> getNodeTypes() { + return nodeTypes; + } + + public void setNodeTypes(List> nodeTypes) { + this.nodeTypes = nodeTypes; + } + + /** + * 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 NodeTypesResponseDataAttributes + */ + @JsonAnySetter + public NodeTypesResponseDataAttributes 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 NodeTypesResponseDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NodeTypesResponseDataAttributes nodeTypesResponseDataAttributes = + (NodeTypesResponseDataAttributes) o; + return Objects.equals(this.nodeTypes, nodeTypesResponseDataAttributes.nodeTypes) + && Objects.equals( + this.additionalProperties, nodeTypesResponseDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(nodeTypes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NodeTypesResponseDataAttributes {\n"); + sb.append(" nodeTypes: ").append(toIndentedString(nodeTypes)).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/NodeTypesResponseDataType.java b/src/main/java/com/datadog/api/client/v2/model/NodeTypesResponseDataType.java new file mode 100644 index 00000000000..c72168f2cfb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NodeTypesResponseDataType.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; + +/** Get node types response resource type. */ +@JsonSerialize(using = NodeTypesResponseDataType.NodeTypesResponseDataTypeSerializer.class) +public class NodeTypesResponseDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("get_node_types_response")); + + public static final NodeTypesResponseDataType GET_NODE_TYPES_RESPONSE = + new NodeTypesResponseDataType("get_node_types_response"); + + NodeTypesResponseDataType(String value) { + super(value, allowedValues); + } + + public static class NodeTypesResponseDataTypeSerializer + extends StdSerializer { + public NodeTypesResponseDataTypeSerializer(Class t) { + super(t); + } + + public NodeTypesResponseDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + NodeTypesResponseDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static NodeTypesResponseDataType fromValue(String value) { + return new NodeTypesResponseDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SastRulesetData.java b/src/main/java/com/datadog/api/client/v2/model/SastRulesetData.java new file mode 100644 index 00000000000..6e5fd98fce3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SastRulesetData.java @@ -0,0 +1,211 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The primary data object representing a SAST ruleset. */ +@JsonPropertyOrder({ + SastRulesetData.JSON_PROPERTY_ATTRIBUTES, + SastRulesetData.JSON_PROPERTY_ID, + SastRulesetData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SastRulesetData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private SastRulesetDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType type = + GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType.RULESETS; + + public SastRulesetData() {} + + @JsonCreator + public SastRulesetData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + SastRulesetDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SastRulesetData attributes(SastRulesetDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a SAST ruleset, including its name, description, and rules. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SastRulesetDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(SastRulesetDataAttributes attributes) { + this.attributes = attributes; + } + + public SastRulesetData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the ruleset resource. + * + * @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 SastRulesetData type(GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Rulesets resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType getType() { + return type; + } + + public void setType(GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType 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 SastRulesetData + */ + @JsonAnySetter + public SastRulesetData 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 SastRulesetData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SastRulesetData sastRulesetData = (SastRulesetData) o; + return Objects.equals(this.attributes, sastRulesetData.attributes) + && Objects.equals(this.id, sastRulesetData.id) + && Objects.equals(this.type, sastRulesetData.type) + && Objects.equals(this.additionalProperties, sastRulesetData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SastRulesetData {\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/SastRulesetDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SastRulesetDataAttributes.java new file mode 100644 index 00000000000..fca5dc53563 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SastRulesetDataAttributes.java @@ -0,0 +1,247 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +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; + +/** The attributes of a SAST ruleset, including its name, description, and rules. */ +@JsonPropertyOrder({ + SastRulesetDataAttributes.JSON_PROPERTY_DESCRIPTION, + SastRulesetDataAttributes.JSON_PROPERTY_NAME, + SastRulesetDataAttributes.JSON_PROPERTY_RULES, + SastRulesetDataAttributes.JSON_PROPERTY_SHORT_DESCRIPTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SastRulesetDataAttributes { + @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 List rules = + new ArrayList<>(); + + public static final String JSON_PROPERTY_SHORT_DESCRIPTION = "short_description"; + private String shortDescription; + + public SastRulesetDataAttributes() {} + + @JsonCreator + public SastRulesetDataAttributes( + @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.description = description; + this.name = name; + this.rules = rules; + this.shortDescription = shortDescription; + } + + public SastRulesetDataAttributes description(String description) { + this.description = description; + return this; + } + + /** + * A detailed description of the ruleset's purpose and the types of issues it targets. + * + * @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 SastRulesetDataAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The unique name of the ruleset. + * + * @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 SastRulesetDataAttributes rules( + List rules) { + this.rules = rules; + for (GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems item : rules) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SastRulesetDataAttributes addRulesItem( + GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems rulesItem) { + this.rules.add(rulesItem); + this.unparsed |= rulesItem.unparsed; + return this; + } + + /** + * The list of static analysis rules included in this ruleset. + * + * @return rules + */ + @JsonProperty(JSON_PROPERTY_RULES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRules() { + return rules; + } + + public void setRules( + List rules) { + this.rules = rules; + } + + public SastRulesetDataAttributes shortDescription(String shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * A brief summary of the ruleset, suitable for display in listings. + * + * @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 SastRulesetDataAttributes + */ + @JsonAnySetter + public SastRulesetDataAttributes 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 SastRulesetDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SastRulesetDataAttributes sastRulesetDataAttributes = (SastRulesetDataAttributes) o; + return Objects.equals(this.description, sastRulesetDataAttributes.description) + && Objects.equals(this.name, sastRulesetDataAttributes.name) + && Objects.equals(this.rules, sastRulesetDataAttributes.rules) + && Objects.equals(this.shortDescription, sastRulesetDataAttributes.shortDescription) + && Objects.equals( + this.additionalProperties, sastRulesetDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, name, rules, shortDescription, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SastRulesetDataAttributes {\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/SastRulesetResponse.java b/src/main/java/com/datadog/api/client/v2/model/SastRulesetResponse.java new file mode 100644 index 00000000000..dd0399715dc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SastRulesetResponse.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; + +/** The response payload containing a single SAST ruleset and its rules. */ +@JsonPropertyOrder({SastRulesetResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SastRulesetResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private SastRulesetData data; + + public SastRulesetResponse() {} + + @JsonCreator + public SastRulesetResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) SastRulesetData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public SastRulesetResponse data(SastRulesetData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The primary data object representing a SAST ruleset. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SastRulesetData getData() { + return data; + } + + public void setData(SastRulesetData 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 SastRulesetResponse + */ + @JsonAnySetter + public SastRulesetResponse 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 SastRulesetResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SastRulesetResponse sastRulesetResponse = (SastRulesetResponse) o; + return Objects.equals(this.data, sastRulesetResponse.data) + && Objects.equals(this.additionalProperties, sastRulesetResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SastRulesetResponse {\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/SastRulesetsResponse.java b/src/main/java/com/datadog/api/client/v2/model/SastRulesetsResponse.java new file mode 100644 index 00000000000..a56d566074f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SastRulesetsResponse.java @@ -0,0 +1,154 @@ +/* + * 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; + +/** The response payload containing a list of SAST rulesets and their rules. */ +@JsonPropertyOrder({SastRulesetsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SastRulesetsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public SastRulesetsResponse() {} + + @JsonCreator + public SastRulesetsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public SastRulesetsResponse data(List data) { + this.data = data; + for (SastRulesetData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SastRulesetsResponse addDataItem(SastRulesetData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of SAST rulesets returned in the response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 SastRulesetsResponse + */ + @JsonAnySetter + public SastRulesetsResponse 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 SastRulesetsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SastRulesetsResponse sastRulesetsResponse = (SastRulesetsResponse) o; + return Objects.equals(this.data, sastRulesetsResponse.data) + && Objects.equals(this.additionalProperties, sastRulesetsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SastRulesetsResponse {\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/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature index 485a947631d..5e6f325a43a 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature @@ -25,6 +25,22 @@ Feature: Security Monitoring When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Analyze code returns "Bad Request" response + Given operation "CreateStaticAnalysisServerAnalysis" enabled + And new "CreateStaticAnalysisServerAnalysis" request + And body with value {"data": {"attributes": {"code": "aW1wb3J0IHN5cw==", "file_encoding": "utf-8", "filename": "test.py", "language": "python", "rules": [{"category": "BEST_PRACTICES", "checksum": "abc123def456", "code": "ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=", "entity_checked": null, "id": "python-best-practices/no-exit", "language": "python", "regex": null, "severity": "WARNING", "tree_sitter_query": "KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==", "type": "TREE_SITTER_QUERY"}]}, "type": "analysis_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Analyze code returns "OK" response + Given operation "CreateStaticAnalysisServerAnalysis" enabled + And new "CreateStaticAnalysisServerAnalysis" request + And body with value {"data": {"attributes": {"code": "aW1wb3J0IHN5cw==", "file_encoding": "utf-8", "filename": "test.py", "language": "python", "rules": [{"category": "BEST_PRACTICES", "checksum": "abc123def456", "code": "ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=", "entity_checked": null, "id": "python-best-practices/no-exit", "language": "python", "regex": null, "severity": "WARNING", "tree_sitter_query": "KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==", "type": "TREE_SITTER_QUERY"}]}, "type": "analysis_request"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/k9-investigation Scenario: Attach security finding to a Jira issue returns "OK" response Given new "AttachJiraIssue" request @@ -1076,6 +1092,22 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Get AST for source code returns "Bad Request" response + Given operation "CreateStaticAnalysisAst" enabled + And new "CreateStaticAnalysisAst" request + And body with value {"data": {"attributes": {"code": "aW1wb3J0IHN5cw==", "file_encoding": "utf-8", "language": "python"}, "type": "get_ast_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Get AST for source code returns "OK" response + Given operation "CreateStaticAnalysisAst" enabled + And new "CreateStaticAnalysisAst" request + And body with value {"data": {"attributes": {"code": "aW1wb3J0IHN5cw==", "file_encoding": "utf-8", "language": "python"}, "type": "get_ast_request"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-vm Scenario: Get SBOM returns "Bad request: The server cannot process the request due to invalid syntax in the request." response Given new "GetSBOM" request @@ -1100,6 +1132,30 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Get a SAST ruleset returns "Bad Request" response + Given operation "GetStaticAnalysisRuleset" enabled + And new "GetStaticAnalysisRuleset" 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: Get a SAST ruleset returns "Not Found" response + Given operation "GetStaticAnalysisRuleset" enabled + And new "GetStaticAnalysisRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Get a SAST ruleset returns "OK" response + Given operation "GetStaticAnalysisRuleset" enabled + And new "GetStaticAnalysisRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip-validation @team:DataDog/k9-cloud-siem Scenario: Get a cloud configuration rule's details returns "OK" response Given there is a valid "cloud_configuration_rule" in the system @@ -1515,6 +1571,22 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Get default rulesets for a language returns "Bad Request" response + Given operation "GetStaticAnalysisDefaultRulesets" enabled + And new "GetStaticAnalysisDefaultRulesets" request + And request contains "language" 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: Get default rulesets for a language returns "OK" response + Given operation "GetStaticAnalysisDefaultRulesets" enabled + And new "GetStaticAnalysisDefaultRulesets" request + And request contains "language" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-security-posture-management Scenario: Get details of a signal-based notification rule returns "Bad Request" response Given new "GetSignalNotificationRule" request @@ -1616,6 +1688,22 @@ Feature: Security Monitoring And the response "data[0].attributes" has field "query_filter" And the response "data[0].attributes" has field "url" + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Get node types for a language returns "Bad Request" response + Given operation "GetStaticAnalysisNodeTypes" enabled + And new "GetStaticAnalysisNodeTypes" request + And request contains "language" 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: Get node types for a language returns "OK" response + Given operation "GetStaticAnalysisNodeTypes" enabled + And new "GetStaticAnalysisNodeTypes" request + And request contains "language" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip-go @skip-java @skip-ruby @team:DataDog/k9-cloud-siem Scenario: Get rule version history returns "OK" response Given operation "GetRuleVersionHistory" enabled @@ -1715,6 +1803,22 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Get tree-sitter WASM file returns "BLOB with the content of the WASM file" response + Given operation "GetStaticAnalysisTreeSitterWasm" enabled + And new "GetStaticAnalysisTreeSitterWasm" request + And request contains "file" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 BLOB with the content of the WASM file + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Get tree-sitter WASM file returns "Bad Request" response + Given operation "GetStaticAnalysisTreeSitterWasm" enabled + And new "GetStaticAnalysisTreeSitterWasm" request + And request contains "file" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + @generated @skip @team:DataDog/k9-cloud-vm Scenario: List assets SBOMs returns "Bad request: The server cannot process the request due to invalid syntax in the request." response Given new "ListAssetsSBOMs" request @@ -1743,6 +1847,20 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List codegen rulesets returns "Bad Request" response + Given operation "ListStaticAnalysisCodegenRulesets" enabled + And new "ListStaticAnalysisCodegenRulesets" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List codegen rulesets returns "OK" response + Given operation "ListStaticAnalysisCodegenRulesets" enabled + And new "ListStaticAnalysisCodegenRulesets" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-siem Scenario: List entity context sync configurations returns "OK" response Given operation "ListSecurityMonitoringIntegrationConfigs" enabled 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 879e8dca94f..3d690035c18 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 @@ -73,6 +73,160 @@ Feature: Static Analysis When the request is sent Then the response status is 200 Successfully created + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Ruleset returns "Bad Request" response + Given operation "CreateCustomRuleset" enabled + And new "CreateCustomRuleset" request + And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Ruleset returns "Conflict" response + Given operation "CreateCustomRuleset" enabled + And new "CreateCustomRuleset" request + And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Ruleset returns "OK" response + Given operation "CreateCustomRuleset" enabled + And new "CreateCustomRuleset" request + And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create Custom Ruleset returns "Precondition Failed" response + Given operation "CreateCustomRuleset" enabled + And new "CreateCustomRuleset" request + And body with value {"data": {"attributes": {"rules": [{"created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "last_revision": {"attributes": {"arguments": [{"description": "YXJndW1lbnQgZGVzY3JpcHRpb24=", "name": "YXJndW1lbnRfbmFtZQ=="}], "category": "SECURITY", "checksum": "8a66c4e4e631099ad71be3c1ea3ea8fc2d57193e56db2c296e2dd8a508b26b99", "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "created_at": "2026-01-09T13:00:57.473141Z", "created_by": "foobarbaz", "creation_message": "Initial revision", "cve": "CVE-2024-1234", "cwe": "CWE-79", "description": "bG9uZyBkZXNjcmlwdGlvbg==", "documentation_url": "https://docs.example.com/rules/my-rule", "is_published": false, "is_testing": false, "language": "PYTHON", "severity": "ERROR", "short_description": "c2hvcnQgZGVzY3JpcHRpb24=", "should_use_ai_fix": false, "tags": ["security", "custom"], "tests": [{"annotation_count": 1, "code": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ==", "filename": "test.yaml"}], "tree_sitter_query": "Y29uZHVjdG9yOgogICAgLSBkZXBsb3lfb25seTogdHJ1ZQ=="}, "id": "revision-123", "type": "custom_rule_revision"}, "name": "my-rule"}]}, "type": "custom_ruleset"}} + When the request is sent + Then the response status is 412 Precondition Failed + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI custom rule returns "Bad Request" response + Given operation "CreateAiCustomRule" enabled + And new "CreateAiCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "my-ai-rule"}, "id": "my-ai-rule", "type": "ai_rule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI custom rule returns "Conflict - rule already exists" response + Given operation "CreateAiCustomRule" enabled + And new "CreateAiCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "my-ai-rule"}, "id": "my-ai-rule", "type": "ai_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 an AI custom rule returns "Precondition Failed - validation error or ruleset not found" response + Given operation "CreateAiCustomRule" enabled + And new "CreateAiCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "my-ai-rule"}, "id": "my-ai-rule", "type": "ai_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 an AI custom rule returns "Successfully created" response + Given operation "CreateAiCustomRule" enabled + And new "CreateAiCustomRule" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "my-ai-rule"}, "id": "my-ai-rule", "type": "ai_rule"}} + When the request is sent + Then the response status is 200 Successfully created + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI custom rule revision returns "Bad Request" response + Given operation "CreateAiCustomRuleRevision" enabled + And new "CreateAiCustomRuleRevision" 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": {"category": "SECURITY", "content": "Content", "cwe": "79", "description": "Ruleset description", "directories": [], "execution_mode": "auto", "globs": ["**/*.py"], "is_published": false, "is_testing": false, "severity": "ERROR", "short_description": "Ruleset short description", "version_id": 1}, "id": "revision-abc-123", "type": "ai_rule_revision"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI custom rule revision returns "Rule not found" response + Given operation "CreateAiCustomRuleRevision" enabled + And new "CreateAiCustomRuleRevision" 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": {"category": "SECURITY", "content": "Content", "cwe": "79", "description": "Ruleset description", "directories": [], "execution_mode": "auto", "globs": ["**/*.py"], "is_published": false, "is_testing": false, "severity": "ERROR", "short_description": "Ruleset short description", "version_id": 1}, "id": "revision-abc-123", "type": "ai_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 an AI custom rule revision returns "Successfully created" response + Given operation "CreateAiCustomRuleRevision" enabled + And new "CreateAiCustomRuleRevision" 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": {"category": "SECURITY", "content": "Content", "cwe": "79", "description": "Ruleset description", "directories": [], "execution_mode": "auto", "globs": ["**/*.py"], "is_published": false, "is_testing": false, "severity": "ERROR", "short_description": "Ruleset short description", "version_id": 1}, "id": "revision-abc-123", "type": "ai_rule_revision"}} + When the request is sent + Then the response status is 200 Successfully created + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI custom ruleset returns "Bad Request" response + Given operation "CreateAiCustomRuleset" enabled + And new "CreateAiCustomRuleset" request + And body with value {"data": {"attributes": {"description": "Ruleset description", "name": "my-ai-ruleset", "short_description": "Ruleset short description"}, "id": "my-ai-ruleset", "type": "ai_ruleset"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI custom ruleset returns "Conflict - ruleset already exists" response + Given operation "CreateAiCustomRuleset" enabled + And new "CreateAiCustomRuleset" request + And body with value {"data": {"attributes": {"description": "Ruleset description", "name": "my-ai-ruleset", "short_description": "Ruleset short description"}, "id": "my-ai-ruleset", "type": "ai_ruleset"}} + When the request is sent + Then the response status is 409 Conflict - ruleset already exists + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI custom ruleset returns "Precondition Failed - validation error" response + Given operation "CreateAiCustomRuleset" enabled + And new "CreateAiCustomRuleset" request + And body with value {"data": {"attributes": {"description": "Ruleset description", "name": "my-ai-ruleset", "short_description": "Ruleset short description"}, "id": "my-ai-ruleset", "type": "ai_ruleset"}} + When the request is sent + Then the response status is 412 Precondition Failed - validation error + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI custom ruleset returns "Successfully created" response + Given operation "CreateAiCustomRuleset" enabled + And new "CreateAiCustomRuleset" request + And body with value {"data": {"attributes": {"description": "Ruleset description", "name": "my-ai-ruleset", "short_description": "Ruleset short description"}, "id": "my-ai-ruleset", "type": "ai_ruleset"}} + When the request is sent + Then the response status is 200 Successfully created + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI memory violation result returns "Bad Request" response + Given operation "CreateAiMemoryViolationResult" enabled + And new "CreateAiMemoryViolationResult" request + And body with value {"data": {"attributes": {"line": 10, "message": "This is a false positive because the input is sanitized.", "name": "src/main.py", "repository_id": "my-repo", "rule": "my-ai-ruleset/my-ai-rule", "sha": "abc123def456789012345678901234567890abcd", "type": "FP"}, "id": "violation-abc", "type": "ai_memory_violation_result"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI memory violation result returns "Not Found" response + Given operation "CreateAiMemoryViolationResult" enabled + And new "CreateAiMemoryViolationResult" request + And body with value {"data": {"attributes": {"line": 10, "message": "This is a false positive because the input is sanitized.", "name": "src/main.py", "repository_id": "my-repo", "rule": "my-ai-ruleset/my-ai-rule", "sha": "abc123def456789012345678901234567890abcd", "type": "FP"}, "id": "violation-abc", "type": "ai_memory_violation_result"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Create an AI memory violation result returns "Successfully created" response + Given operation "CreateAiMemoryViolationResult" enabled + And new "CreateAiMemoryViolationResult" request + And body with value {"data": {"attributes": {"line": 10, "message": "This is a false positive because the input is sanitized.", "name": "src/main.py", "repository_id": "my-repo", "rule": "my-ai-ruleset/my-ai-rule", "sha": "abc123def456789012345678901234567890abcd", "type": "FP"}, "id": "violation-abc", "type": "ai_memory_violation_result"}} + 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 @@ -124,6 +278,247 @@ Feature: Static Analysis When the request is sent Then the response status is 200 Successfully deleted + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Delete an AI custom rule returns "Bad Request" response + Given operation "DeleteAiCustomRule" enabled + And new "DeleteAiCustomRule" 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 an AI custom rule returns "Rule not found" response + Given operation "DeleteAiCustomRule" enabled + And new "DeleteAiCustomRule" 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 an AI custom rule returns "Successfully deleted" response + Given operation "DeleteAiCustomRule" enabled + And new "DeleteAiCustomRule" 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 an AI custom ruleset returns "Bad Request" response + Given operation "DeleteAiCustomRuleset" enabled + And new "DeleteAiCustomRuleset" 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 an AI custom ruleset returns "Ruleset not found" response + Given operation "DeleteAiCustomRuleset" enabled + And new "DeleteAiCustomRuleset" 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 an AI custom ruleset returns "Successfully deleted" response + Given operation "DeleteAiCustomRuleset" enabled + And new "DeleteAiCustomRuleset" 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: Delete an AI memory violation result returns "Bad Request" response + Given operation "DeleteAiMemoryViolationResult" enabled + And new "DeleteAiMemoryViolationResult" request + 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: Delete an AI memory violation result returns "Memory violation result not found" response + Given operation "DeleteAiMemoryViolationResult" enabled + And new "DeleteAiMemoryViolationResult" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Memory violation result not found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Delete an AI memory violation result returns "Successfully deleted" response + Given operation "DeleteAiMemoryViolationResult" enabled + And new "DeleteAiMemoryViolationResult" request + And request contains "id" 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: Get an AI custom rule returns "Bad Request" response + Given operation "GetAiCustomRule" enabled + And new "GetAiCustomRule" 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: Get an AI custom rule returns "Rule not found" response + Given operation "GetAiCustomRule" enabled + And new "GetAiCustomRule" 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: Get an AI custom rule returns "Successful response" response + Given operation "GetAiCustomRule" enabled + And new "GetAiCustomRule" 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: Get an AI custom rule revision returns "Bad Request" response + Given operation "GetAiCustomRuleRevision" enabled + And new "GetAiCustomRuleRevision" 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: Get an AI custom rule revision returns "Revision not found" response + Given operation "GetAiCustomRuleRevision" enabled + And new "GetAiCustomRuleRevision" 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: Get an AI custom rule revision returns "Successful response" response + Given operation "GetAiCustomRuleRevision" enabled + And new "GetAiCustomRuleRevision" 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: Get an AI custom ruleset returns "Bad Request" response + Given operation "GetAiCustomRuleset" enabled + And new "GetAiCustomRuleset" 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: Get an AI custom ruleset returns "Ruleset not found" response + Given operation "GetAiCustomRuleset" enabled + And new "GetAiCustomRuleset" 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: Get an AI custom ruleset returns "Successful response" response + Given operation "GetAiCustomRuleset" enabled + And new "GetAiCustomRuleset" 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: List AI custom rule revisions returns "Bad Request" response + Given operation "ListAiCustomRuleRevisions" enabled + And new "ListAiCustomRuleRevisions" 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 AI custom rule revisions returns "Rule not found" response + Given operation "ListAiCustomRuleRevisions" enabled + And new "ListAiCustomRuleRevisions" 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 AI custom rule revisions returns "Successful response" response + Given operation "ListAiCustomRuleRevisions" enabled + And new "ListAiCustomRuleRevisions" 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 @with-pagination + Scenario: List AI custom rule revisions returns "Successful response" response with pagination + Given operation "ListAiCustomRuleRevisions" enabled + And new "ListAiCustomRuleRevisions" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And request contains "rule_name" parameter from "REPLACE.ME" + When the request with pagination is sent + Then the response status is 200 Successful response + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List AI custom rulesets returns "Successful response" response + Given operation "ListAiCustomRulesets" enabled + And new "ListAiCustomRulesets" request + When the request is sent + Then the response status is 200 Successful response + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List AI memory violation results returns "Bad Request" response + Given operation "ListAiMemoryViolationResults" enabled + And new "ListAiMemoryViolationResults" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List AI memory violation results returns "Not Found" response + Given operation "ListAiMemoryViolationResults" enabled + And new "ListAiMemoryViolationResults" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List AI memory violation results returns "Successful response" response + Given operation "ListAiMemoryViolationResults" enabled + And new "ListAiMemoryViolationResults" request + When the request is sent + Then the response status is 200 Successful response + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List AI prompts returns "Bad Request" response + Given operation "ListAiPrompts" enabled + And new "ListAiPrompts" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List AI prompts returns "Not Found" response + Given operation "ListAiPrompts" enabled + And new "ListAiPrompts" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List AI prompts returns "Successful response" response + Given operation "ListAiPrompts" enabled + And new "ListAiPrompts" request + When the request is sent + Then the response status is 200 Successful response + @generated @skip @team:DataDog/k9-vm-ast Scenario: List Custom Rule Revisions returns "Bad request" response Given operation "ListCustomRuleRevisions" enabled @@ -160,6 +555,13 @@ Feature: Static Analysis When the request with pagination is sent Then the response status is 200 Successful response + @generated @skip @team:DataDog/k9-vm-ast + Scenario: List Custom Rulesets returns "OK" response + Given operation "ListCustomRulesets" enabled + And new "ListCustomRulesets" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-vm-sca Scenario: POST request to resolve vulnerable symbols returns "OK" response Given operation "CreateSCAResolveVulnerableSymbols" enabled @@ -303,3 +705,30 @@ Feature: Static Analysis 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 + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Update an AI custom ruleset returns "Bad Request" response + Given operation "UpdateAiCustomRuleset" enabled + And new "UpdateAiCustomRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Ruleset description", "name": "my-ai-ruleset", "short_description": "Ruleset short description"}, "id": "my-ai-ruleset", "type": "ai_ruleset"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-vm-ast + Scenario: Update an AI custom ruleset returns "Precondition Failed - validation error or ruleset not found" response + Given operation "UpdateAiCustomRuleset" enabled + And new "UpdateAiCustomRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Ruleset description", "name": "my-ai-ruleset", "short_description": "Ruleset short description"}, "id": "my-ai-ruleset", "type": "ai_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 an AI custom ruleset returns "Successfully updated" response + Given operation "UpdateAiCustomRuleset" enabled + And new "UpdateAiCustomRuleset" request + And request contains "ruleset_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Ruleset description", "name": "my-ai-ruleset", "short_description": "Ruleset short description"}, "id": "my-ai-ruleset", "type": "ai_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 c22b1472981..1a4572405f1 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 @@ -7040,6 +7040,121 @@ "type": "safe" } }, + "ListAiMemoryViolationResults": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "CreateAiMemoryViolationResult": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "DeleteAiMemoryViolationResult": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "ListAiPrompts": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "ListAiCustomRulesets": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "CreateAiCustomRuleset": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "DeleteAiCustomRuleset": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "GetAiCustomRuleset": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "UpdateAiCustomRuleset": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "CreateAiCustomRule": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "DeleteAiCustomRule": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "GetAiCustomRule": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "ListAiCustomRuleRevisions": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "CreateAiCustomRuleRevision": { + "tag": "Static Analysis", + "undo": { + "type": "idempotent" + } + }, + "GetAiCustomRuleRevision": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "ListStaticAnalysisCodegenRulesets": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "ListCustomRulesets": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "CreateCustomRuleset": { + "tag": "Static Analysis", + "undo": { + "operationId": "DeleteCustomRuleset", + "parameters": [ + { + "name": "ruleset_name", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, "DeleteCustomRuleset": { "tag": "Static Analysis", "undo": { @@ -7102,6 +7217,12 @@ "type": "safe" } }, + "GetStaticAnalysisDefaultRulesets": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "ListMultipleRulesets": { "tag": "Security Monitoring", "undo": { @@ -7110,12 +7231,42 @@ "type": "unsafe" } }, + "GetStaticAnalysisRuleset": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "GetSecretsRules": { "tag": "Security Monitoring", "undo": { "type": "safe" } }, + "CreateStaticAnalysisServerAnalysis": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "CreateStaticAnalysisAst": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "GetStaticAnalysisNodeTypes": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "GetStaticAnalysisTreeSitterWasm": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "ListStatusPages": { "tag": "Status Pages", "undo": {