From 565841f6b0e7c657e9b3621c4e2aebe7529d1959 Mon Sep 17 00:00:00 2001 From: David Tapiador Date: Fri, 13 Feb 2026 12:47:38 +0100 Subject: [PATCH 1/6] add equals to reserved keywords and escape method names --- .generator/src/generator/formatter.py | 14 ++++++++++++++ .generator/src/generator/templates/modelSimple.j2 | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.generator/src/generator/formatter.py b/.generator/src/generator/formatter.py index 58bbfe7784b..e247dad8142 100644 --- a/.generator/src/generator/formatter.py +++ b/.generator/src/generator/formatter.py @@ -23,6 +23,7 @@ "do", "else", "enum", + "equals", "extends", "false", "final", @@ -74,6 +75,11 @@ "\\": "\\\\", } +METHOD_KEYWORDS = { + "getClass", + "setClass", +} + PATTERN_DOUBLE_UNDERSCORE = re.compile(r"__+") PATTERN_LEADING_ALPHA = re.compile(r"(.)([A-Z][a-z0-9]+)") @@ -125,6 +131,14 @@ def untitle_case(value): def upperfirst(value): return value[0].upper() + value[1:] +def escape_method_reserved_names(method_name): + """ + Escape reserved language keywords for method names like getClass, setClass, isClass, etc. + """ + if method_name in METHOD_KEYWORDS: + return f"{method_name}Attribute" + return method_name + def schema_name(schema): if not schema: diff --git a/.generator/src/generator/templates/modelSimple.j2 b/.generator/src/generator/templates/modelSimple.j2 index 3bfd701b44a..dfb64a013c9 100644 --- a/.generator/src/generator/templates/modelSimple.j2 +++ b/.generator/src/generator/templates/modelSimple.j2 @@ -216,7 +216,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends {%- if schema.additionalProperties is defined and schema.additionalProperties is not false %}{%- if schema.additionalProperties.nullable %}content = JsonInclude.Include.ALWAYS,{%- endif %}{%- endif %} value = JsonInclude.Include.{%- if isRequired %}ALWAYS{%- else %}USE_DEFAULTS{%- endif %}) {%- endif %} - public {{ dataType }} get{{ attr|camel_case|upperfirst }}() { + public {{ dataType }} get{{ attr|camel_case|upperfirst|escape_reserved_keyword }}() { {%- if not isRequired and isNullable %} {%- if schema.get("readOnly", False) %} @@ -247,7 +247,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends {%- endif %} {%- if not schema.get("readOnly", False) %} - public void set{{ attr|camel_case|upperfirst }}({{ dataType }} {{ variableName }}) { + public void set{{ attr|camel_case|upperfirst|escape_reserved_keyword }}({{ dataType }} {{ variableName }}) { {%- if schema.enum is defined %} if (!{{ variableName }}.isValid()) { this.unparsed = true; From 41e32bc208a2b9dc0a3e0d7efcc9475c2b3fac1a Mon Sep 17 00:00:00 2001 From: David Tapiador Date: Fri, 13 Feb 2026 13:42:52 +0100 Subject: [PATCH 2/6] add new function to jinja templates --- .generator/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.generator/conftest.py b/.generator/conftest.py index a7953852a0a..bd3f7a0eb9c 100644 --- a/.generator/conftest.py +++ b/.generator/conftest.py @@ -24,6 +24,7 @@ format_data_with_schema, get_response_type, upperfirst, + escape_method_reserved_names, ) @@ -75,6 +76,7 @@ def lookup(value, path): JINJA_ENV.globals["format_parameters"] = format_parameters JINJA_ENV.globals["get_response_type"] = get_response_type JINJA_ENV.globals["get_type_at_path"] = openapi.get_type_at_path +JINJA_ENV.filters["escape_method_reserved_names"] = escape_method_reserved_names JAVA_EXAMPLE_J2 = JINJA_ENV.get_template("example.j2") From d714965f4e01442df49cf935e0747c6bf80b2cc7 Mon Sep 17 00:00:00 2001 From: David Tapiador Date: Fri, 13 Feb 2026 15:03:07 +0100 Subject: [PATCH 3/6] fix names --- .generator/conftest.py | 4 ++-- .generator/src/generator/formatter.py | 2 +- .generator/src/generator/templates/modelSimple.j2 | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.generator/conftest.py b/.generator/conftest.py index bd3f7a0eb9c..98a89ec1223 100644 --- a/.generator/conftest.py +++ b/.generator/conftest.py @@ -24,7 +24,7 @@ format_data_with_schema, get_response_type, upperfirst, - escape_method_reserved_names, + escape_method_reserved_name, ) @@ -76,7 +76,7 @@ def lookup(value, path): JINJA_ENV.globals["format_parameters"] = format_parameters JINJA_ENV.globals["get_response_type"] = get_response_type JINJA_ENV.globals["get_type_at_path"] = openapi.get_type_at_path -JINJA_ENV.filters["escape_method_reserved_names"] = escape_method_reserved_names +JINJA_ENV.filters["escape_method_reserved_name"] = escape_method_reserved_name JAVA_EXAMPLE_J2 = JINJA_ENV.get_template("example.j2") diff --git a/.generator/src/generator/formatter.py b/.generator/src/generator/formatter.py index e247dad8142..72ff52eec58 100644 --- a/.generator/src/generator/formatter.py +++ b/.generator/src/generator/formatter.py @@ -131,7 +131,7 @@ def untitle_case(value): def upperfirst(value): return value[0].upper() + value[1:] -def escape_method_reserved_names(method_name): +def escape_method_reserved_name(method_name): """ Escape reserved language keywords for method names like getClass, setClass, isClass, etc. """ diff --git a/.generator/src/generator/templates/modelSimple.j2 b/.generator/src/generator/templates/modelSimple.j2 index dfb64a013c9..7d8a556535e 100644 --- a/.generator/src/generator/templates/modelSimple.j2 +++ b/.generator/src/generator/templates/modelSimple.j2 @@ -216,7 +216,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends {%- if schema.additionalProperties is defined and schema.additionalProperties is not false %}{%- if schema.additionalProperties.nullable %}content = JsonInclude.Include.ALWAYS,{%- endif %}{%- endif %} value = JsonInclude.Include.{%- if isRequired %}ALWAYS{%- else %}USE_DEFAULTS{%- endif %}) {%- endif %} - public {{ dataType }} get{{ attr|camel_case|upperfirst|escape_reserved_keyword }}() { + public {{ dataType }} get{{ attr|camel_case|upperfirst|escape_method_reserved_name }}() { {%- if not isRequired and isNullable %} {%- if schema.get("readOnly", False) %} @@ -247,7 +247,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends {%- endif %} {%- if not schema.get("readOnly", False) %} - public void set{{ attr|camel_case|upperfirst|escape_reserved_keyword }}({{ dataType }} {{ variableName }}) { + public void set{{ attr|camel_case|upperfirst|escape_method_reserved_name }}({{ dataType }} {{ variableName }}) { {%- if schema.enum is defined %} if (!{{ variableName }}.isValid()) { this.unparsed = true; From 35ec4415080880199ca5810140ad03c6b2a4f7cf Mon Sep 17 00:00:00 2001 From: David Tapiador Date: Fri, 13 Feb 2026 15:14:45 +0100 Subject: [PATCH 4/6] add to missing cli file --- .generator/src/generator/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/.generator/src/generator/cli.py b/.generator/src/generator/cli.py index 6319d5f92e5..f774166ffcf 100644 --- a/.generator/src/generator/cli.py +++ b/.generator/src/generator/cli.py @@ -53,6 +53,7 @@ def cli(specs, output): env.filters["inline_docstring"] = formatter.inline_docstring env.filters["un_parameterize_type"] = formatter.un_parameterize_type env.filters["is_parameterized_type"] = formatter.is_parameterized_type + env.filters["escape_method_reserved_name"] = formatter.escape_method_reserved_name env.globals["enumerate"] = enumerate env.globals["get_name"] = openapi.get_name From 3e4f9e19bf282234a03db8bd5d9a24b9bc4e3cb1 Mon Sep 17 00:00:00 2001 From: David Tapiador Date: Mon, 16 Feb 2026 09:05:59 +0100 Subject: [PATCH 5/6] set proper escape method names --- .generator/src/generator/formatter.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.generator/src/generator/formatter.py b/.generator/src/generator/formatter.py index 72ff52eec58..77bbb658a0e 100644 --- a/.generator/src/generator/formatter.py +++ b/.generator/src/generator/formatter.py @@ -76,8 +76,7 @@ } METHOD_KEYWORDS = { - "getClass", - "setClass", + "Class", } From 45634a159058146fddfe7092863bca83ddaff98b Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 16 Feb 2026 15:24:24 +0000 Subject: [PATCH 6/6] Regenerate client from commit 09513e2 of spec repo --- .generator/schemas/v2/openapi.yaml | 443 ++++++++++++++++++ examples/v2/apm/GetServiceList.java | 2 +- .../GetCodeCoverageBranchSummary.java | 39 ++ ...tCodeCoverageBranchSummary_2532383345.java | 39 ++ .../GetCodeCoverageCommitSummary.java | 39 ++ ...tCodeCoverageCommitSummary_2575243916.java | 39 ++ .../ValidatePipeline_3024756866.java | 151 ++++++ .../ValidatePipeline_3565101276.java | 100 ++++ .../com/datadog/api/client/ApiClient.java | 2 + .../com/datadog/api/client/v2/api/ApmApi.java | 47 +- .../api/client/v2/api/CodeCoverageApi.java | 363 ++++++++++++++ .../model/BranchCoverageSummaryRequest.java | 147 ++++++ ...ranchCoverageSummaryRequestAttributes.java | 175 +++++++ .../BranchCoverageSummaryRequestData.java | 186 ++++++++ .../BranchCoverageSummaryRequestType.java | 61 +++ .../model/CommitCoverageSummaryRequest.java | 147 ++++++ ...ommitCoverageSummaryRequestAttributes.java | 175 +++++++ .../CommitCoverageSummaryRequestData.java | 186 ++++++++ .../CommitCoverageSummaryRequestType.java | 61 +++ .../v2/model/CoverageSummaryAttributes.java | 358 ++++++++++++++ .../model/CoverageSummaryCodeownerStats.java | 251 ++++++++++ .../client/v2/model/CoverageSummaryData.java | 197 ++++++++ .../v2/model/CoverageSummaryResponse.java | 136 ++++++ .../v2/model/CoverageSummaryServiceStats.java | 250 ++++++++++ .../client/v2/model/CoverageSummaryType.java | 59 +++ ...lineOcsfMapperProcessorMappingMapping.java | 89 +++- ...bservabilityPipelineOcsfMappingCustom.java | 221 +++++++++ ...PipelineOcsfMappingCustomFieldMapping.java | 292 ++++++++++++ ...bilityPipelineOcsfMappingCustomLookup.java | 184 ++++++++ ...lineOcsfMappingCustomLookupTableEntry.java | 286 +++++++++++ ...lityPipelineOcsfMappingCustomMetadata.java | 214 +++++++++ ..._custom_mapping_returns_OK_response.freeze | 1 + ...er_custom_mapping_returns_OK_response.json | 32 ++ ...apping_returns_Bad_Request_response.freeze | 1 + ..._mapping_returns_Bad_Request_response.json | 32 ++ ...library_mapping_returns_OK_response.freeze | 1 + ...r_library_mapping_returns_OK_response.json | 32 ++ .../com/datadog/api/client/v2/api/apm.feature | 1 + .../api/client/v2/api/code_coverage.feature | 156 ++++++ .../v2/api/observability_pipelines.feature | 23 + .../com/datadog/api/client/v2/api/undo.json | 12 + 41 files changed, 5217 insertions(+), 13 deletions(-) create mode 100644 examples/v2/code-coverage/GetCodeCoverageBranchSummary.java create mode 100644 examples/v2/code-coverage/GetCodeCoverageBranchSummary_2532383345.java create mode 100644 examples/v2/code-coverage/GetCodeCoverageCommitSummary.java create mode 100644 examples/v2/code-coverage/GetCodeCoverageCommitSummary_2575243916.java create mode 100644 examples/v2/observability-pipelines/ValidatePipeline_3024756866.java create mode 100644 examples/v2/observability-pipelines/ValidatePipeline_3565101276.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/CodeCoverageApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequestType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequestType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CoverageSummaryAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CoverageSummaryCodeownerStats.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CoverageSummaryData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CoverageSummaryResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CoverageSummaryServiceStats.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CoverageSummaryType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustom.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomFieldMapping.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomLookup.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomLookupTableEntry.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomMetadata.java create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_custom_mapping_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_custom_mapping_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_invalid_custom_mapping_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_invalid_custom_mapping_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_library_mapping_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_library_mapping_returns_OK_response.json create mode 100644 src/test/resources/com/datadog/api/client/v2/api/code_coverage.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b8661d93ff7..29ccc1be00b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -7297,6 +7297,51 @@ components: data: $ref: '#/components/schemas/BillingDimensionsMappingBody' type: object + BranchCoverageSummaryRequest: + description: Request object for getting code coverage summary for a branch. + properties: + data: + $ref: '#/components/schemas/BranchCoverageSummaryRequestData' + required: + - data + type: object + BranchCoverageSummaryRequestAttributes: + description: Attributes for requesting code coverage summary for a branch. + properties: + branch: + description: The branch name. + example: prod + minLength: 1 + type: string + repository_id: + description: The repository identifier. + example: github.com/datadog/shopist + minLength: 1 + type: string + required: + - repository_id + - branch + type: object + BranchCoverageSummaryRequestData: + description: Data object for branch summary request. + properties: + attributes: + $ref: '#/components/schemas/BranchCoverageSummaryRequestAttributes' + type: + $ref: '#/components/schemas/BranchCoverageSummaryRequestType' + required: + - type + - attributes + type: object + BranchCoverageSummaryRequestType: + description: JSON:API type for branch coverage summary request. The value must + always be `ci_app_coverage_branch_summary_request`. + enum: + - ci_app_coverage_branch_summary_request + example: ci_app_coverage_branch_summary_request + type: string + x-enum-varnames: + - CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST Budget: description: A budget. properties: @@ -11760,6 +11805,51 @@ components: required: - location type: object + CommitCoverageSummaryRequest: + description: Request object for getting code coverage summary for a commit. + properties: + data: + $ref: '#/components/schemas/CommitCoverageSummaryRequestData' + required: + - data + type: object + CommitCoverageSummaryRequestAttributes: + description: Attributes for requesting code coverage summary for a commit. + properties: + commit_sha: + description: The commit SHA (40-character hexadecimal string). + example: 66adc9350f2cc9b250b69abddab733dd55e1a588 + pattern: ^[a-fA-F0-9]{40}$ + type: string + repository_id: + description: The repository identifier. + example: github.com/datadog/shopist + minLength: 1 + type: string + required: + - repository_id + - commit_sha + type: object + CommitCoverageSummaryRequestData: + description: Data object for commit summary request. + properties: + attributes: + $ref: '#/components/schemas/CommitCoverageSummaryRequestAttributes' + type: + $ref: '#/components/schemas/CommitCoverageSummaryRequestType' + required: + - type + - attributes + type: object + CommitCoverageSummaryRequestType: + description: JSON:API type for commit coverage summary request. The value must + always be `ci_app_coverage_commit_summary_request`. + enum: + - ci_app_coverage_commit_summary_request + example: ci_app_coverage_commit_summary_request + type: string + x-enum-varnames: + - CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST CompletionCondition: description: The definition of `CompletionCondition` object. properties: @@ -13270,6 +13360,123 @@ components: type: string x-enum-varnames: - COST_BY_ORG + CoverageSummaryAttributes: + description: Attributes object for code coverage summary response. + properties: + codeowners: + additionalProperties: + $ref: '#/components/schemas/CoverageSummaryCodeownerStats' + description: Coverage statistics broken down by code owner. + nullable: true + type: object + evaluated_flags_count: + description: Total number of coverage flags evaluated. + example: 8 + format: int64 + type: integer + evaluated_reports_count: + description: Total number of coverage reports evaluated. + example: 12 + format: int64 + type: integer + patch_coverage: + description: Overall patch coverage percentage. + example: 70.1 + format: double + nullable: true + type: number + services: + additionalProperties: + $ref: '#/components/schemas/CoverageSummaryServiceStats' + description: Coverage statistics broken down by service. + nullable: true + type: object + total_coverage: + description: Overall total coverage percentage. + example: 82.4 + format: double + nullable: true + type: number + type: object + CoverageSummaryCodeownerStats: + description: Coverage statistics for a specific code owner. + properties: + evaluated_flags_count: + description: Number of coverage flags evaluated for the code owner. + example: 2 + format: int64 + type: integer + evaluated_reports_count: + description: Number of coverage reports evaluated for the code owner. + example: 4 + format: int64 + type: integer + patch_coverage: + description: Patch coverage percentage for the code owner. + example: 75.2 + format: double + nullable: true + type: number + total_coverage: + description: Total coverage percentage for the code owner. + example: 88.7 + format: double + nullable: true + type: number + type: object + CoverageSummaryData: + description: Data object for coverage summary response. + properties: + attributes: + $ref: '#/components/schemas/CoverageSummaryAttributes' + id: + description: Unique identifier for the coverage summary (base64-hashed). + example: ZGQxMjM0NV9tYWluXzE3MDk1NjQwMDA= + type: string + type: + $ref: '#/components/schemas/CoverageSummaryType' + type: object + CoverageSummaryResponse: + description: Response object containing code coverage summary. + properties: + data: + $ref: '#/components/schemas/CoverageSummaryData' + type: object + CoverageSummaryServiceStats: + description: Coverage statistics for a specific service. + properties: + evaluated_flags_count: + description: Number of coverage flags evaluated for the service. + example: 3 + format: int64 + type: integer + evaluated_reports_count: + description: Number of coverage reports evaluated for the service. + example: 5 + format: int64 + type: integer + patch_coverage: + description: Patch coverage percentage for the service. + example: 72.3 + format: double + nullable: true + type: number + total_coverage: + description: Total coverage percentage for the service. + example: 85.5 + format: double + nullable: true + type: number + type: object + CoverageSummaryType: + description: JSON:API type for coverage summary response. The value must always + be `ci_app_coverage_summary`. + enum: + - ci_app_coverage_summary + example: ci_app_coverage_summary + type: string + x-enum-varnames: + - CI_APP_COVERAGE_SUMMARY Cpu: description: CPU usage statistics derived from historical Spark job metrics. Provides multiple estimates so users can choose between conservative and cost-saving @@ -41139,6 +41346,7 @@ components: example: CloudTrail Account Change oneOf: - $ref: '#/components/schemas/ObservabilityPipelineOcsfMappingLibrary' + - $ref: '#/components/schemas/ObservabilityPipelineOcsfMappingCustom' ObservabilityPipelineOcsfMapperProcessorType: default: ocsf_mapper description: The processor type. The value should always be `ocsf_mapper`. @@ -41148,6 +41356,116 @@ components: type: string x-enum-varnames: - OCSF_MAPPER + ObservabilityPipelineOcsfMappingCustom: + description: Custom OCSF mapping configuration for transforming logs. + properties: + mapping: + description: A list of field mapping rules for transforming log fields to + OCSF schema fields. + items: + $ref: '#/components/schemas/ObservabilityPipelineOcsfMappingCustomFieldMapping' + type: array + metadata: + $ref: '#/components/schemas/ObservabilityPipelineOcsfMappingCustomMetadata' + version: + description: The version of the custom mapping configuration. + example: 1 + format: int64 + type: integer + required: + - mapping + - metadata + - version + type: object + ObservabilityPipelineOcsfMappingCustomFieldMapping: + description: Defines a single field mapping rule for transforming a source field + to an OCSF destination field. + properties: + default: + description: The default value to use if the source field is missing or + empty. + example: '' + dest: + description: The destination OCSF field path. + example: device.type + type: string + lookup: + $ref: '#/components/schemas/ObservabilityPipelineOcsfMappingCustomLookup' + source: + description: The source field path from the log event. + example: host.type + sources: + description: Multiple source field paths for combined mapping. + example: + - field1 + - field2 + value: + description: A static value to use for the destination field. + example: static_value + required: + - dest + type: object + ObservabilityPipelineOcsfMappingCustomLookup: + description: Lookup table configuration for mapping source values to destination + values. + properties: + default: + description: The default value to use if no lookup match is found. + example: unknown + table: + description: A list of lookup table entries for value transformation. + items: + $ref: '#/components/schemas/ObservabilityPipelineOcsfMappingCustomLookupTableEntry' + type: array + type: object + ObservabilityPipelineOcsfMappingCustomLookupTableEntry: + description: A single entry in a lookup table for value transformation. + properties: + contains: + description: The substring to match in the source value. + example: Desktop + type: string + equals: + description: The exact value to match in the source. + example: desktop + equals_source: + description: The source field to match against. + example: device_type + type: string + matches: + description: A regex pattern to match in the source value. + example: ^Desktop.* + type: string + not_matches: + description: A regex pattern that must not match the source value. + example: ^Mobile.* + type: string + value: + description: The value to use when a match is found. + example: desktop + type: object + ObservabilityPipelineOcsfMappingCustomMetadata: + description: Metadata for the custom OCSF mapping. + properties: + class: + description: The OCSF event class name. + example: Device Inventory Info + type: string + profiles: + description: A list of OCSF profiles to apply. + example: + - container + items: + type: string + type: array + version: + description: The OCSF schema version. + example: 1.3.0 + type: string + required: + - class + - version + type: object ObservabilityPipelineOcsfMappingLibrary: description: Predefined library mappings for common log formats. enum: @@ -67602,6 +67920,7 @@ components: cloud_cost_management_write: Configure cloud cost accounts and global customizations. For more details, see the Cloud Cost Management docs. code_analysis_read: View Code Analysis. + code_coverage_read: View Code Coverage. continuous_profiler_pgo_read: Read and query Continuous Profiler data for Profile-Guided Optimization (PGO). coterm_read: Read terminal recordings. @@ -70851,6 +71170,14 @@ paths: /api/v2/apm/services: get: operationId: GetServiceList + parameters: + - description: Filter services by environment. Can be set to `*` to return all + services across all environments. + in: query + name: filter[env] + required: true + schema: + type: string responses: '200': content: @@ -74203,6 +74530,119 @@ paths: operator: OR permissions: - security_monitoring_filters_write + /api/v2/code-coverage/branch/summary: + post: + description: 'Retrieve aggregated code coverage statistics for a specific branch + in a repository. + + This endpoint provides overall coverage metrics as well as breakdowns by service + + and code owner. + + + **Note**: This endpoint requires the `code_coverage_read` permission.' + operationId: GetCodeCoverageBranchSummary + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BranchCoverageSummaryRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CoverageSummaryResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Internal server error + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_coverage_read + summary: Get code coverage summary for a branch + tags: + - Code Coverage + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - code_coverage_read + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/code-coverage/commit/summary: + post: + description: 'Retrieve aggregated code coverage statistics for a specific commit + in a repository. + + This endpoint provides overall coverage metrics as well as breakdowns by service + + and code owner. + + + The commit SHA must be a 40-character hexadecimal string (SHA-1 hash). + + + **Note**: This endpoint requires the `code_coverage_read` permission.' + operationId: GetCodeCoverageCommitSummary + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CommitCoverageSummaryRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CoverageSummaryResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Internal server error + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_coverage_read + summary: Get code coverage summary for a commit + tags: + - Code Coverage + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - code_coverage_read + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/container_images: get: description: 'Get all Container Images for your organization. @@ -103481,6 +103921,9 @@ tags: API. See the [Cloudflare integration page](https://docs.datadoghq.com/integrations/cloudflare/) for more information. name: Cloudflare Integration +- description: Retrieve and analyze code coverage data from Code Coverage. See the + [Code Coverage page](https://docs.datadoghq.com/code_coverage/) for more information. + name: Code Coverage - description: Manage your Datadog Confluent Cloud integration accounts and account resources directly through the Datadog API. See the [Confluent Cloud page](https://docs.datadoghq.com/integrations/confluent_cloud/) for more information. diff --git a/examples/v2/apm/GetServiceList.java b/examples/v2/apm/GetServiceList.java index 025dbd99022..3dc8dc5fad3 100644 --- a/examples/v2/apm/GetServiceList.java +++ b/examples/v2/apm/GetServiceList.java @@ -11,7 +11,7 @@ public static void main(String[] args) { ApmApi apiInstance = new ApmApi(defaultClient); try { - ServiceList result = apiInstance.getServiceList(); + ServiceList result = apiInstance.getServiceList("filter[env]"); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ApmApi#getServiceList"); diff --git a/examples/v2/code-coverage/GetCodeCoverageBranchSummary.java b/examples/v2/code-coverage/GetCodeCoverageBranchSummary.java new file mode 100644 index 00000000000..9c8d00b6666 --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageBranchSummary.java @@ -0,0 +1,39 @@ +// Get code coverage summary for a branch returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CodeCoverageApi; +import com.datadog.api.client.v2.model.BranchCoverageSummaryRequest; +import com.datadog.api.client.v2.model.BranchCoverageSummaryRequestAttributes; +import com.datadog.api.client.v2.model.BranchCoverageSummaryRequestData; +import com.datadog.api.client.v2.model.BranchCoverageSummaryRequestType; +import com.datadog.api.client.v2.model.CoverageSummaryResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getCodeCoverageBranchSummary", true); + CodeCoverageApi apiInstance = new CodeCoverageApi(defaultClient); + + BranchCoverageSummaryRequest body = + new BranchCoverageSummaryRequest() + .data( + new BranchCoverageSummaryRequestData() + .attributes( + new BranchCoverageSummaryRequestAttributes() + .branch("prod") + .repositoryId("github.com/datadog/shopist")) + .type(BranchCoverageSummaryRequestType.CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST)); + + try { + CoverageSummaryResponse result = apiInstance.getCodeCoverageBranchSummary(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CodeCoverageApi#getCodeCoverageBranchSummary"); + 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/code-coverage/GetCodeCoverageBranchSummary_2532383345.java b/examples/v2/code-coverage/GetCodeCoverageBranchSummary_2532383345.java new file mode 100644 index 00000000000..cc50a6cb4bf --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageBranchSummary_2532383345.java @@ -0,0 +1,39 @@ +// Get code coverage summary for an existing branch with valid repository + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CodeCoverageApi; +import com.datadog.api.client.v2.model.BranchCoverageSummaryRequest; +import com.datadog.api.client.v2.model.BranchCoverageSummaryRequestAttributes; +import com.datadog.api.client.v2.model.BranchCoverageSummaryRequestData; +import com.datadog.api.client.v2.model.BranchCoverageSummaryRequestType; +import com.datadog.api.client.v2.model.CoverageSummaryResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getCodeCoverageBranchSummary", true); + CodeCoverageApi apiInstance = new CodeCoverageApi(defaultClient); + + BranchCoverageSummaryRequest body = + new BranchCoverageSummaryRequest() + .data( + new BranchCoverageSummaryRequestData() + .attributes( + new BranchCoverageSummaryRequestAttributes() + .repositoryId("github.com/datadog/shopist") + .branch("prod")) + .type(BranchCoverageSummaryRequestType.CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST)); + + try { + CoverageSummaryResponse result = apiInstance.getCodeCoverageBranchSummary(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CodeCoverageApi#getCodeCoverageBranchSummary"); + 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/code-coverage/GetCodeCoverageCommitSummary.java b/examples/v2/code-coverage/GetCodeCoverageCommitSummary.java new file mode 100644 index 00000000000..2bed679f517 --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageCommitSummary.java @@ -0,0 +1,39 @@ +// Get code coverage summary for a commit returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CodeCoverageApi; +import com.datadog.api.client.v2.model.CommitCoverageSummaryRequest; +import com.datadog.api.client.v2.model.CommitCoverageSummaryRequestAttributes; +import com.datadog.api.client.v2.model.CommitCoverageSummaryRequestData; +import com.datadog.api.client.v2.model.CommitCoverageSummaryRequestType; +import com.datadog.api.client.v2.model.CoverageSummaryResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getCodeCoverageCommitSummary", true); + CodeCoverageApi apiInstance = new CodeCoverageApi(defaultClient); + + CommitCoverageSummaryRequest body = + new CommitCoverageSummaryRequest() + .data( + new CommitCoverageSummaryRequestData() + .attributes( + new CommitCoverageSummaryRequestAttributes() + .commitSha("66adc9350f2cc9b250b69abddab733dd55e1a588") + .repositoryId("github.com/datadog/shopist")) + .type(CommitCoverageSummaryRequestType.CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST)); + + try { + CoverageSummaryResponse result = apiInstance.getCodeCoverageCommitSummary(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CodeCoverageApi#getCodeCoverageCommitSummary"); + 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/code-coverage/GetCodeCoverageCommitSummary_2575243916.java b/examples/v2/code-coverage/GetCodeCoverageCommitSummary_2575243916.java new file mode 100644 index 00000000000..aab6cf5434d --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageCommitSummary_2575243916.java @@ -0,0 +1,39 @@ +// Get code coverage summary for an existing commit with valid repository + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CodeCoverageApi; +import com.datadog.api.client.v2.model.CommitCoverageSummaryRequest; +import com.datadog.api.client.v2.model.CommitCoverageSummaryRequestAttributes; +import com.datadog.api.client.v2.model.CommitCoverageSummaryRequestData; +import com.datadog.api.client.v2.model.CommitCoverageSummaryRequestType; +import com.datadog.api.client.v2.model.CoverageSummaryResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getCodeCoverageCommitSummary", true); + CodeCoverageApi apiInstance = new CodeCoverageApi(defaultClient); + + CommitCoverageSummaryRequest body = + new CommitCoverageSummaryRequest() + .data( + new CommitCoverageSummaryRequestData() + .attributes( + new CommitCoverageSummaryRequestAttributes() + .repositoryId("github.com/datadog/shopist") + .commitSha("c55b0ce584e139bde41a00002ab31bc7d75f791d")) + .type(CommitCoverageSummaryRequestType.CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST)); + + try { + CoverageSummaryResponse result = apiInstance.getCodeCoverageCommitSummary(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CodeCoverageApi#getCodeCoverageCommitSummary"); + 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/observability-pipelines/ValidatePipeline_3024756866.java b/examples/v2/observability-pipelines/ValidatePipeline_3024756866.java new file mode 100644 index 00000000000..243208956ce --- /dev/null +++ b/examples/v2/observability-pipelines/ValidatePipeline_3024756866.java @@ -0,0 +1,151 @@ +// Validate an observability pipeline with OCSF mapper custom mapping returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ObservabilityPipelinesApi; +import com.datadog.api.client.v2.model.ObservabilityPipelineConfig; +import com.datadog.api.client.v2.model.ObservabilityPipelineConfigDestinationItem; +import com.datadog.api.client.v2.model.ObservabilityPipelineConfigProcessorGroup; +import com.datadog.api.client.v2.model.ObservabilityPipelineConfigProcessorItem; +import com.datadog.api.client.v2.model.ObservabilityPipelineConfigSourceItem; +import com.datadog.api.client.v2.model.ObservabilityPipelineDataAttributes; +import com.datadog.api.client.v2.model.ObservabilityPipelineDatadogAgentSource; +import com.datadog.api.client.v2.model.ObservabilityPipelineDatadogAgentSourceType; +import com.datadog.api.client.v2.model.ObservabilityPipelineDatadogLogsDestination; +import com.datadog.api.client.v2.model.ObservabilityPipelineDatadogLogsDestinationType; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMapperProcessor; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMapperProcessorMapping; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMapperProcessorMappingMapping; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMapperProcessorType; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMappingCustom; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMappingCustomFieldMapping; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMappingCustomLookup; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMappingCustomLookupTableEntry; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMappingCustomMetadata; +import com.datadog.api.client.v2.model.ObservabilityPipelineSpec; +import com.datadog.api.client.v2.model.ObservabilityPipelineSpecData; +import com.datadog.api.client.v2.model.ValidationResponse; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ObservabilityPipelinesApi apiInstance = new ObservabilityPipelinesApi(defaultClient); + + ObservabilityPipelineSpec body = + new ObservabilityPipelineSpec() + .data( + new ObservabilityPipelineSpecData() + .attributes( + new ObservabilityPipelineDataAttributes() + .config( + new ObservabilityPipelineConfig() + .destinations( + Collections.singletonList( + new ObservabilityPipelineConfigDestinationItem( + new ObservabilityPipelineDatadogLogsDestination() + .id("datadog-logs-destination") + .inputs( + Collections.singletonList( + "my-processor-group")) + .type( + ObservabilityPipelineDatadogLogsDestinationType + .DATADOG_LOGS)))) + .processorGroups( + Collections.singletonList( + new ObservabilityPipelineConfigProcessorGroup() + .enabled(true) + .id("my-processor-group") + .include("service:my-service") + .inputs( + Collections.singletonList( + "datadog-agent-source")) + .processors( + Collections.singletonList( + new ObservabilityPipelineConfigProcessorItem( + new ObservabilityPipelineOcsfMapperProcessor() + .enabled(true) + .id("ocsf-mapper-processor") + .include("service:my-service") + .type( + ObservabilityPipelineOcsfMapperProcessorType + .OCSF_MAPPER) + .mappings( + Collections.singletonList( + new ObservabilityPipelineOcsfMapperProcessorMapping() + .include( + "source:custom") + .mapping( + new ObservabilityPipelineOcsfMapperProcessorMappingMapping( + new ObservabilityPipelineOcsfMappingCustom() + .version(1L) + .metadata( + new ObservabilityPipelineOcsfMappingCustomMetadata() + ._class( + "Device" + + " Inventory" + + " Info") + .profiles( + Collections + .singletonList( + "container")) + .version( + "1.3.0")) + .mapping( + Arrays + .asList( + new ObservabilityPipelineOcsfMappingCustomFieldMapping() + .dest( + "time") + .source( + "timestamp") + ._default( + ""), + new ObservabilityPipelineOcsfMappingCustomFieldMapping() + .dest( + "severity") + .source( + "level") + ._default( + ""), + new ObservabilityPipelineOcsfMappingCustomFieldMapping() + .dest( + "device.type") + .source( + "host.type") + ._default( + "") + .lookup( + new ObservabilityPipelineOcsfMappingCustomLookup() + .table( + Collections + .singletonList( + new ObservabilityPipelineOcsfMappingCustomLookupTableEntry() + .contains( + "Desktop") + .value( + "desktop"))))))))))))))) + .sources( + Collections.singletonList( + new ObservabilityPipelineConfigSourceItem( + new ObservabilityPipelineDatadogAgentSource() + .id("datadog-agent-source") + .type( + ObservabilityPipelineDatadogAgentSourceType + .DATADOG_AGENT))))) + .name("OCSF Custom Mapper Pipeline")) + .type("pipelines")); + + try { + ValidationResponse result = apiInstance.validatePipeline(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ObservabilityPipelinesApi#validatePipeline"); + 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/observability-pipelines/ValidatePipeline_3565101276.java b/examples/v2/observability-pipelines/ValidatePipeline_3565101276.java new file mode 100644 index 00000000000..02a8bf41d81 --- /dev/null +++ b/examples/v2/observability-pipelines/ValidatePipeline_3565101276.java @@ -0,0 +1,100 @@ +// Validate an observability pipeline with OCSF mapper library mapping returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ObservabilityPipelinesApi; +import com.datadog.api.client.v2.model.ObservabilityPipelineConfig; +import com.datadog.api.client.v2.model.ObservabilityPipelineConfigDestinationItem; +import com.datadog.api.client.v2.model.ObservabilityPipelineConfigProcessorGroup; +import com.datadog.api.client.v2.model.ObservabilityPipelineConfigProcessorItem; +import com.datadog.api.client.v2.model.ObservabilityPipelineConfigSourceItem; +import com.datadog.api.client.v2.model.ObservabilityPipelineDataAttributes; +import com.datadog.api.client.v2.model.ObservabilityPipelineDatadogAgentSource; +import com.datadog.api.client.v2.model.ObservabilityPipelineDatadogAgentSourceType; +import com.datadog.api.client.v2.model.ObservabilityPipelineDatadogLogsDestination; +import com.datadog.api.client.v2.model.ObservabilityPipelineDatadogLogsDestinationType; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMapperProcessor; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMapperProcessorMapping; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMapperProcessorMappingMapping; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMapperProcessorType; +import com.datadog.api.client.v2.model.ObservabilityPipelineOcsfMappingLibrary; +import com.datadog.api.client.v2.model.ObservabilityPipelineSpec; +import com.datadog.api.client.v2.model.ObservabilityPipelineSpecData; +import com.datadog.api.client.v2.model.ValidationResponse; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ObservabilityPipelinesApi apiInstance = new ObservabilityPipelinesApi(defaultClient); + + ObservabilityPipelineSpec body = + new ObservabilityPipelineSpec() + .data( + new ObservabilityPipelineSpecData() + .attributes( + new ObservabilityPipelineDataAttributes() + .config( + new ObservabilityPipelineConfig() + .destinations( + Collections.singletonList( + new ObservabilityPipelineConfigDestinationItem( + new ObservabilityPipelineDatadogLogsDestination() + .id("datadog-logs-destination") + .inputs( + Collections.singletonList( + "my-processor-group")) + .type( + ObservabilityPipelineDatadogLogsDestinationType + .DATADOG_LOGS)))) + .processorGroups( + Collections.singletonList( + new ObservabilityPipelineConfigProcessorGroup() + .enabled(true) + .id("my-processor-group") + .include("service:my-service") + .inputs( + Collections.singletonList( + "datadog-agent-source")) + .processors( + Collections.singletonList( + new ObservabilityPipelineConfigProcessorItem( + new ObservabilityPipelineOcsfMapperProcessor() + .enabled(true) + .id("ocsf-mapper-processor") + .include("service:my-service") + .type( + ObservabilityPipelineOcsfMapperProcessorType + .OCSF_MAPPER) + .mappings( + Collections.singletonList( + new ObservabilityPipelineOcsfMapperProcessorMapping() + .include( + "source:cloudtrail") + .mapping( + new ObservabilityPipelineOcsfMapperProcessorMappingMapping( + ObservabilityPipelineOcsfMappingLibrary + .CLOUDTRAIL_ACCOUNT_CHANGE))))))))) + .sources( + Collections.singletonList( + new ObservabilityPipelineConfigSourceItem( + new ObservabilityPipelineDatadogAgentSource() + .id("datadog-agent-source") + .type( + ObservabilityPipelineDatadogAgentSourceType + .DATADOG_AGENT))))) + .name("OCSF Mapper Pipeline")) + .type("pipelines")); + + try { + ValidationResponse result = apiInstance.validatePipeline(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ObservabilityPipelinesApi#validatePipeline"); + 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 a902fb3b1b8..51e308a256e 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -804,6 +804,8 @@ public class ApiClient { put("v2.muteFindings", false); put("v2.runThreatHuntingJob", false); put("v2.searchSecurityMonitoringHistsignals", false); + put("v2.getCodeCoverageBranchSummary", false); + put("v2.getCodeCoverageCommitSummary", false); put("v2.createDataset", false); put("v2.deleteDataset", false); put("v2.getAllDatasets", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/ApmApi.java b/src/main/java/com/datadog/api/client/v2/api/ApmApi.java index 02920f126f7..852a7f1bc0c 100644 --- a/src/main/java/com/datadog/api/client/v2/api/ApmApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/ApmApi.java @@ -9,6 +9,7 @@ import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -48,11 +49,13 @@ public void setApiClient(ApiClient apiClient) { * *

See {@link #getServiceListWithHttpInfo}. * + * @param filterEnv Filter services by environment. Can be set to * to return all + * services across all environments. (required) * @return ServiceList * @throws ApiException if fails to make API call */ - public ServiceList getServiceList() throws ApiException { - return getServiceListWithHttpInfo().getData(); + public ServiceList getServiceList(String filterEnv) throws ApiException { + return getServiceListWithHttpInfo(filterEnv).getData(); } /** @@ -60,10 +63,12 @@ public ServiceList getServiceList() throws ApiException { * *

See {@link #getServiceListWithHttpInfoAsync}. * + * @param filterEnv Filter services by environment. Can be set to * to return all + * services across all environments. (required) * @return CompletableFuture<ServiceList> */ - public CompletableFuture getServiceListAsync() { - return getServiceListWithHttpInfoAsync() + public CompletableFuture getServiceListAsync(String filterEnv) { + return getServiceListWithHttpInfoAsync(filterEnv) .thenApply( response -> { return response.getData(); @@ -71,6 +76,8 @@ public CompletableFuture getServiceListAsync() { } /** + * @param filterEnv Filter services by environment. Can be set to * to return all + * services across all environments. (required) * @return ApiResponse<ServiceList> * @throws ApiException if fails to make API call * @http.response.details @@ -81,18 +88,27 @@ public CompletableFuture getServiceListAsync() { * 429 Too many requests - * */ - public ApiResponse getServiceListWithHttpInfo() throws ApiException { + public ApiResponse getServiceListWithHttpInfo(String filterEnv) throws ApiException { Object localVarPostBody = null; + + // verify the required parameter 'filterEnv' is set + if (filterEnv == null) { + throw new ApiException( + 400, "Missing the required parameter 'filterEnv' when calling getServiceList"); + } // create path and map variables String localVarPath = "/api/v2/apm/services"; + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[env]", filterEnv)); + Invocation.Builder builder = apiClient.createBuilder( "v2.ApmApi.getServiceList", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, @@ -113,22 +129,37 @@ public ApiResponse getServiceListWithHttpInfo() throws ApiException * *

See {@link #getServiceListWithHttpInfo}. * + * @param filterEnv Filter services by environment. Can be set to * to return all + * services across all environments. (required) * @return CompletableFuture<ApiResponse<ServiceList>> */ - public CompletableFuture> getServiceListWithHttpInfoAsync() { + public CompletableFuture> getServiceListWithHttpInfoAsync( + String filterEnv) { Object localVarPostBody = null; + + // verify the required parameter 'filterEnv' is set + if (filterEnv == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'filterEnv' when calling getServiceList")); + return result; + } // create path and map variables String localVarPath = "/api/v2/apm/services"; + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[env]", filterEnv)); + Invocation.Builder builder; try { builder = apiClient.createBuilder( "v2.ApmApi.getServiceList", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, diff --git a/src/main/java/com/datadog/api/client/v2/api/CodeCoverageApi.java b/src/main/java/com/datadog/api/client/v2/api/CodeCoverageApi.java new file mode 100644 index 00000000000..db92e9b566e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/CodeCoverageApi.java @@ -0,0 +1,363 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.BranchCoverageSummaryRequest; +import com.datadog.api.client.v2.model.CommitCoverageSummaryRequest; +import com.datadog.api.client.v2.model.CoverageSummaryResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CodeCoverageApi { + private ApiClient apiClient; + + public CodeCoverageApi() { + this(ApiClient.getDefaultApiClient()); + } + + public CodeCoverageApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get code coverage summary for a branch. + * + *

See {@link #getCodeCoverageBranchSummaryWithHttpInfo}. + * + * @param body (required) + * @return CoverageSummaryResponse + * @throws ApiException if fails to make API call + */ + public CoverageSummaryResponse getCodeCoverageBranchSummary(BranchCoverageSummaryRequest body) + throws ApiException { + return getCodeCoverageBranchSummaryWithHttpInfo(body).getData(); + } + + /** + * Get code coverage summary for a branch. + * + *

See {@link #getCodeCoverageBranchSummaryWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<CoverageSummaryResponse> + */ + public CompletableFuture getCodeCoverageBranchSummaryAsync( + BranchCoverageSummaryRequest body) { + return getCodeCoverageBranchSummaryWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve aggregated code coverage statistics for a specific branch in a repository. This + * endpoint provides overall coverage metrics as well as breakdowns by service and code owner. + * + *

Note: This endpoint requires the code_coverage_read + * permission. + * + * @param body (required) + * @return ApiResponse<CoverageSummaryResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
500 Internal server error -
+ */ + public ApiResponse getCodeCoverageBranchSummaryWithHttpInfo( + BranchCoverageSummaryRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getCodeCoverageBranchSummary"; + 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 getCodeCoverageBranchSummary"); + } + // create path and map variables + String localVarPath = "/api/v2/code-coverage/branch/summary"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CodeCoverageApi.getCodeCoverageBranchSummary", + 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 code coverage summary for a branch. + * + *

See {@link #getCodeCoverageBranchSummaryWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<CoverageSummaryResponse>> + */ + public CompletableFuture> + getCodeCoverageBranchSummaryWithHttpInfoAsync(BranchCoverageSummaryRequest body) { + // Check if unstable operation is enabled + String operationId = "getCodeCoverageBranchSummary"; + 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 getCodeCoverageBranchSummary")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/code-coverage/branch/summary"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CodeCoverageApi.getCodeCoverageBranchSummary", + 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() {}); + } + + /** + * Get code coverage summary for a commit. + * + *

See {@link #getCodeCoverageCommitSummaryWithHttpInfo}. + * + * @param body (required) + * @return CoverageSummaryResponse + * @throws ApiException if fails to make API call + */ + public CoverageSummaryResponse getCodeCoverageCommitSummary(CommitCoverageSummaryRequest body) + throws ApiException { + return getCodeCoverageCommitSummaryWithHttpInfo(body).getData(); + } + + /** + * Get code coverage summary for a commit. + * + *

See {@link #getCodeCoverageCommitSummaryWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<CoverageSummaryResponse> + */ + public CompletableFuture getCodeCoverageCommitSummaryAsync( + CommitCoverageSummaryRequest body) { + return getCodeCoverageCommitSummaryWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve aggregated code coverage statistics for a specific commit in a repository. This + * endpoint provides overall coverage metrics as well as breakdowns by service and code owner. + * + *

The commit SHA must be a 40-character hexadecimal string (SHA-1 hash). + * + *

Note: This endpoint requires the code_coverage_read + * permission. + * + * @param body (required) + * @return ApiResponse<CoverageSummaryResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
500 Internal server error -
+ */ + public ApiResponse getCodeCoverageCommitSummaryWithHttpInfo( + CommitCoverageSummaryRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getCodeCoverageCommitSummary"; + 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 getCodeCoverageCommitSummary"); + } + // create path and map variables + String localVarPath = "/api/v2/code-coverage/commit/summary"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CodeCoverageApi.getCodeCoverageCommitSummary", + 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 code coverage summary for a commit. + * + *

See {@link #getCodeCoverageCommitSummaryWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<CoverageSummaryResponse>> + */ + public CompletableFuture> + getCodeCoverageCommitSummaryWithHttpInfoAsync(CommitCoverageSummaryRequest body) { + // Check if unstable operation is enabled + String operationId = "getCodeCoverageCommitSummary"; + 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 getCodeCoverageCommitSummary")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/code-coverage/commit/summary"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CodeCoverageApi.getCodeCoverageCommitSummary", + 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() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequest.java b/src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequest.java new file mode 100644 index 00000000000..78985ec7a2d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequest.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; + +/** Request object for getting code coverage summary for a branch. */ +@JsonPropertyOrder({BranchCoverageSummaryRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BranchCoverageSummaryRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private BranchCoverageSummaryRequestData data; + + public BranchCoverageSummaryRequest() {} + + @JsonCreator + public BranchCoverageSummaryRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + BranchCoverageSummaryRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public BranchCoverageSummaryRequest data(BranchCoverageSummaryRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object for branch summary request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BranchCoverageSummaryRequestData getData() { + return data; + } + + public void setData(BranchCoverageSummaryRequestData 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 BranchCoverageSummaryRequest + */ + @JsonAnySetter + public BranchCoverageSummaryRequest 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 BranchCoverageSummaryRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BranchCoverageSummaryRequest branchCoverageSummaryRequest = (BranchCoverageSummaryRequest) o; + return Objects.equals(this.data, branchCoverageSummaryRequest.data) + && Objects.equals( + this.additionalProperties, branchCoverageSummaryRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BranchCoverageSummaryRequest {\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/BranchCoverageSummaryRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequestAttributes.java new file mode 100644 index 00000000000..a590ccea7bd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequestAttributes.java @@ -0,0 +1,175 @@ +/* + * 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 requesting code coverage summary for a branch. */ +@JsonPropertyOrder({ + BranchCoverageSummaryRequestAttributes.JSON_PROPERTY_BRANCH, + BranchCoverageSummaryRequestAttributes.JSON_PROPERTY_REPOSITORY_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BranchCoverageSummaryRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BRANCH = "branch"; + private String branch; + + public static final String JSON_PROPERTY_REPOSITORY_ID = "repository_id"; + private String repositoryId; + + public BranchCoverageSummaryRequestAttributes() {} + + @JsonCreator + public BranchCoverageSummaryRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_BRANCH) String branch, + @JsonProperty(required = true, value = JSON_PROPERTY_REPOSITORY_ID) String repositoryId) { + this.branch = branch; + this.repositoryId = repositoryId; + } + + public BranchCoverageSummaryRequestAttributes branch(String branch) { + this.branch = branch; + return this; + } + + /** + * The branch name. + * + * @return branch + */ + @JsonProperty(JSON_PROPERTY_BRANCH) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getBranch() { + return branch; + } + + public void setBranch(String branch) { + this.branch = branch; + } + + public BranchCoverageSummaryRequestAttributes 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; + } + + /** + * 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 BranchCoverageSummaryRequestAttributes + */ + @JsonAnySetter + public BranchCoverageSummaryRequestAttributes 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 BranchCoverageSummaryRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BranchCoverageSummaryRequestAttributes branchCoverageSummaryRequestAttributes = + (BranchCoverageSummaryRequestAttributes) o; + return Objects.equals(this.branch, branchCoverageSummaryRequestAttributes.branch) + && Objects.equals(this.repositoryId, branchCoverageSummaryRequestAttributes.repositoryId) + && Objects.equals( + this.additionalProperties, branchCoverageSummaryRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(branch, repositoryId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BranchCoverageSummaryRequestAttributes {\n"); + sb.append(" branch: ").append(toIndentedString(branch)).append("\n"); + sb.append(" repositoryId: ").append(toIndentedString(repositoryId)).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/BranchCoverageSummaryRequestData.java b/src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequestData.java new file mode 100644 index 00000000000..4b8f907701e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequestData.java @@ -0,0 +1,186 @@ +/* + * 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; + +/** Data object for branch summary request. */ +@JsonPropertyOrder({ + BranchCoverageSummaryRequestData.JSON_PROPERTY_ATTRIBUTES, + BranchCoverageSummaryRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BranchCoverageSummaryRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private BranchCoverageSummaryRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private BranchCoverageSummaryRequestType type; + + public BranchCoverageSummaryRequestData() {} + + @JsonCreator + public BranchCoverageSummaryRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + BranchCoverageSummaryRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + BranchCoverageSummaryRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public BranchCoverageSummaryRequestData attributes( + BranchCoverageSummaryRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for requesting code coverage summary for a branch. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BranchCoverageSummaryRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(BranchCoverageSummaryRequestAttributes attributes) { + this.attributes = attributes; + } + + public BranchCoverageSummaryRequestData type(BranchCoverageSummaryRequestType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API type for branch coverage summary request. The value must always be + * ci_app_coverage_branch_summary_request. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BranchCoverageSummaryRequestType getType() { + return type; + } + + public void setType(BranchCoverageSummaryRequestType 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 BranchCoverageSummaryRequestData + */ + @JsonAnySetter + public BranchCoverageSummaryRequestData 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 BranchCoverageSummaryRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BranchCoverageSummaryRequestData branchCoverageSummaryRequestData = + (BranchCoverageSummaryRequestData) o; + return Objects.equals(this.attributes, branchCoverageSummaryRequestData.attributes) + && Objects.equals(this.type, branchCoverageSummaryRequestData.type) + && Objects.equals( + this.additionalProperties, branchCoverageSummaryRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BranchCoverageSummaryRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).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/BranchCoverageSummaryRequestType.java b/src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequestType.java new file mode 100644 index 00000000000..edd9625504b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BranchCoverageSummaryRequestType.java @@ -0,0 +1,61 @@ +/* + * 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; + +/** + * JSON:API type for branch coverage summary request. The value must always be + * ci_app_coverage_branch_summary_request. + */ +@JsonSerialize( + using = BranchCoverageSummaryRequestType.BranchCoverageSummaryRequestTypeSerializer.class) +public class BranchCoverageSummaryRequestType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ci_app_coverage_branch_summary_request")); + + public static final BranchCoverageSummaryRequestType CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST = + new BranchCoverageSummaryRequestType("ci_app_coverage_branch_summary_request"); + + BranchCoverageSummaryRequestType(String value) { + super(value, allowedValues); + } + + public static class BranchCoverageSummaryRequestTypeSerializer + extends StdSerializer { + public BranchCoverageSummaryRequestTypeSerializer(Class t) { + super(t); + } + + public BranchCoverageSummaryRequestTypeSerializer() { + this(null); + } + + @Override + public void serialize( + BranchCoverageSummaryRequestType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static BranchCoverageSummaryRequestType fromValue(String value) { + return new BranchCoverageSummaryRequestType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequest.java b/src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequest.java new file mode 100644 index 00000000000..2aa649ea719 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequest.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; + +/** Request object for getting code coverage summary for a commit. */ +@JsonPropertyOrder({CommitCoverageSummaryRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CommitCoverageSummaryRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CommitCoverageSummaryRequestData data; + + public CommitCoverageSummaryRequest() {} + + @JsonCreator + public CommitCoverageSummaryRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + CommitCoverageSummaryRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CommitCoverageSummaryRequest data(CommitCoverageSummaryRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object for commit summary request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CommitCoverageSummaryRequestData getData() { + return data; + } + + public void setData(CommitCoverageSummaryRequestData 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 CommitCoverageSummaryRequest + */ + @JsonAnySetter + public CommitCoverageSummaryRequest 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 CommitCoverageSummaryRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CommitCoverageSummaryRequest commitCoverageSummaryRequest = (CommitCoverageSummaryRequest) o; + return Objects.equals(this.data, commitCoverageSummaryRequest.data) + && Objects.equals( + this.additionalProperties, commitCoverageSummaryRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CommitCoverageSummaryRequest {\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/CommitCoverageSummaryRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequestAttributes.java new file mode 100644 index 00000000000..d91fd81c327 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequestAttributes.java @@ -0,0 +1,175 @@ +/* + * 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 requesting code coverage summary for a commit. */ +@JsonPropertyOrder({ + CommitCoverageSummaryRequestAttributes.JSON_PROPERTY_COMMIT_SHA, + CommitCoverageSummaryRequestAttributes.JSON_PROPERTY_REPOSITORY_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CommitCoverageSummaryRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COMMIT_SHA = "commit_sha"; + private String commitSha; + + public static final String JSON_PROPERTY_REPOSITORY_ID = "repository_id"; + private String repositoryId; + + public CommitCoverageSummaryRequestAttributes() {} + + @JsonCreator + public CommitCoverageSummaryRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_COMMIT_SHA) String commitSha, + @JsonProperty(required = true, value = JSON_PROPERTY_REPOSITORY_ID) String repositoryId) { + this.commitSha = commitSha; + this.repositoryId = repositoryId; + } + + public CommitCoverageSummaryRequestAttributes commitSha(String commitSha) { + this.commitSha = commitSha; + return this; + } + + /** + * The commit SHA (40-character hexadecimal string). + * + * @return commitSha + */ + @JsonProperty(JSON_PROPERTY_COMMIT_SHA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCommitSha() { + return commitSha; + } + + public void setCommitSha(String commitSha) { + this.commitSha = commitSha; + } + + public CommitCoverageSummaryRequestAttributes 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; + } + + /** + * 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 CommitCoverageSummaryRequestAttributes + */ + @JsonAnySetter + public CommitCoverageSummaryRequestAttributes 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 CommitCoverageSummaryRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CommitCoverageSummaryRequestAttributes commitCoverageSummaryRequestAttributes = + (CommitCoverageSummaryRequestAttributes) o; + return Objects.equals(this.commitSha, commitCoverageSummaryRequestAttributes.commitSha) + && Objects.equals(this.repositoryId, commitCoverageSummaryRequestAttributes.repositoryId) + && Objects.equals( + this.additionalProperties, commitCoverageSummaryRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(commitSha, repositoryId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CommitCoverageSummaryRequestAttributes {\n"); + sb.append(" commitSha: ").append(toIndentedString(commitSha)).append("\n"); + sb.append(" repositoryId: ").append(toIndentedString(repositoryId)).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/CommitCoverageSummaryRequestData.java b/src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequestData.java new file mode 100644 index 00000000000..5c49cbe5330 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequestData.java @@ -0,0 +1,186 @@ +/* + * 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; + +/** Data object for commit summary request. */ +@JsonPropertyOrder({ + CommitCoverageSummaryRequestData.JSON_PROPERTY_ATTRIBUTES, + CommitCoverageSummaryRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CommitCoverageSummaryRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CommitCoverageSummaryRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CommitCoverageSummaryRequestType type; + + public CommitCoverageSummaryRequestData() {} + + @JsonCreator + public CommitCoverageSummaryRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CommitCoverageSummaryRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CommitCoverageSummaryRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CommitCoverageSummaryRequestData attributes( + CommitCoverageSummaryRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for requesting code coverage summary for a commit. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CommitCoverageSummaryRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CommitCoverageSummaryRequestAttributes attributes) { + this.attributes = attributes; + } + + public CommitCoverageSummaryRequestData type(CommitCoverageSummaryRequestType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API type for commit coverage summary request. The value must always be + * ci_app_coverage_commit_summary_request. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CommitCoverageSummaryRequestType getType() { + return type; + } + + public void setType(CommitCoverageSummaryRequestType 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 CommitCoverageSummaryRequestData + */ + @JsonAnySetter + public CommitCoverageSummaryRequestData 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 CommitCoverageSummaryRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CommitCoverageSummaryRequestData commitCoverageSummaryRequestData = + (CommitCoverageSummaryRequestData) o; + return Objects.equals(this.attributes, commitCoverageSummaryRequestData.attributes) + && Objects.equals(this.type, commitCoverageSummaryRequestData.type) + && Objects.equals( + this.additionalProperties, commitCoverageSummaryRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CommitCoverageSummaryRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).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/CommitCoverageSummaryRequestType.java b/src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequestType.java new file mode 100644 index 00000000000..df21c9c73f7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CommitCoverageSummaryRequestType.java @@ -0,0 +1,61 @@ +/* + * 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; + +/** + * JSON:API type for commit coverage summary request. The value must always be + * ci_app_coverage_commit_summary_request. + */ +@JsonSerialize( + using = CommitCoverageSummaryRequestType.CommitCoverageSummaryRequestTypeSerializer.class) +public class CommitCoverageSummaryRequestType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ci_app_coverage_commit_summary_request")); + + public static final CommitCoverageSummaryRequestType CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST = + new CommitCoverageSummaryRequestType("ci_app_coverage_commit_summary_request"); + + CommitCoverageSummaryRequestType(String value) { + super(value, allowedValues); + } + + public static class CommitCoverageSummaryRequestTypeSerializer + extends StdSerializer { + public CommitCoverageSummaryRequestTypeSerializer(Class t) { + super(t); + } + + public CommitCoverageSummaryRequestTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CommitCoverageSummaryRequestType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CommitCoverageSummaryRequestType fromValue(String value) { + return new CommitCoverageSummaryRequestType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryAttributes.java new file mode 100644 index 00000000000..1d8a1bb5cf1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryAttributes.java @@ -0,0 +1,358 @@ +/* + * 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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes object for code coverage summary response. */ +@JsonPropertyOrder({ + CoverageSummaryAttributes.JSON_PROPERTY_CODEOWNERS, + CoverageSummaryAttributes.JSON_PROPERTY_EVALUATED_FLAGS_COUNT, + CoverageSummaryAttributes.JSON_PROPERTY_EVALUATED_REPORTS_COUNT, + CoverageSummaryAttributes.JSON_PROPERTY_PATCH_COVERAGE, + CoverageSummaryAttributes.JSON_PROPERTY_SERVICES, + CoverageSummaryAttributes.JSON_PROPERTY_TOTAL_COVERAGE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CoverageSummaryAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CODEOWNERS = "codeowners"; + private JsonNullable> codeowners = + JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_EVALUATED_FLAGS_COUNT = "evaluated_flags_count"; + private Long evaluatedFlagsCount; + + public static final String JSON_PROPERTY_EVALUATED_REPORTS_COUNT = "evaluated_reports_count"; + private Long evaluatedReportsCount; + + public static final String JSON_PROPERTY_PATCH_COVERAGE = "patch_coverage"; + private JsonNullable patchCoverage = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SERVICES = "services"; + private JsonNullable> services = + JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_TOTAL_COVERAGE = "total_coverage"; + private JsonNullable totalCoverage = JsonNullable.undefined(); + + public CoverageSummaryAttributes codeowners( + Map codeowners) { + this.codeowners = JsonNullable.>of(codeowners); + return this; + } + + public CoverageSummaryAttributes putCodeownersItem( + String key, CoverageSummaryCodeownerStats codeownersItem) { + if (this.codeowners == null || !this.codeowners.isPresent()) { + this.codeowners = + JsonNullable.>of(new HashMap<>()); + } + try { + this.codeowners.get().put(key, codeownersItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Coverage statistics broken down by code owner. + * + * @return codeowners + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Map getCodeowners() { + return codeowners.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CODEOWNERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getCodeowners_JsonNullable() { + return codeowners; + } + + @JsonProperty(JSON_PROPERTY_CODEOWNERS) + public void setCodeowners_JsonNullable( + JsonNullable> codeowners) { + this.codeowners = codeowners; + } + + public void setCodeowners(Map codeowners) { + this.codeowners = JsonNullable.>of(codeowners); + } + + public CoverageSummaryAttributes evaluatedFlagsCount(Long evaluatedFlagsCount) { + this.evaluatedFlagsCount = evaluatedFlagsCount; + return this; + } + + /** + * Total number of coverage flags evaluated. + * + * @return evaluatedFlagsCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVALUATED_FLAGS_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEvaluatedFlagsCount() { + return evaluatedFlagsCount; + } + + public void setEvaluatedFlagsCount(Long evaluatedFlagsCount) { + this.evaluatedFlagsCount = evaluatedFlagsCount; + } + + public CoverageSummaryAttributes evaluatedReportsCount(Long evaluatedReportsCount) { + this.evaluatedReportsCount = evaluatedReportsCount; + return this; + } + + /** + * Total number of coverage reports evaluated. + * + * @return evaluatedReportsCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVALUATED_REPORTS_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEvaluatedReportsCount() { + return evaluatedReportsCount; + } + + public void setEvaluatedReportsCount(Long evaluatedReportsCount) { + this.evaluatedReportsCount = evaluatedReportsCount; + } + + public CoverageSummaryAttributes patchCoverage(Double patchCoverage) { + this.patchCoverage = JsonNullable.of(patchCoverage); + return this; + } + + /** + * Overall patch coverage percentage. + * + * @return patchCoverage + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Double getPatchCoverage() { + return patchCoverage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PATCH_COVERAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPatchCoverage_JsonNullable() { + return patchCoverage; + } + + @JsonProperty(JSON_PROPERTY_PATCH_COVERAGE) + public void setPatchCoverage_JsonNullable(JsonNullable patchCoverage) { + this.patchCoverage = patchCoverage; + } + + public void setPatchCoverage(Double patchCoverage) { + this.patchCoverage = JsonNullable.of(patchCoverage); + } + + public CoverageSummaryAttributes services(Map services) { + this.services = JsonNullable.>of(services); + return this; + } + + public CoverageSummaryAttributes putServicesItem( + String key, CoverageSummaryServiceStats servicesItem) { + if (this.services == null || !this.services.isPresent()) { + this.services = JsonNullable.>of(new HashMap<>()); + } + try { + this.services.get().put(key, servicesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Coverage statistics broken down by service. + * + * @return services + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Map getServices() { + return services.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SERVICES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getServices_JsonNullable() { + return services; + } + + @JsonProperty(JSON_PROPERTY_SERVICES) + public void setServices_JsonNullable( + JsonNullable> services) { + this.services = services; + } + + public void setServices(Map services) { + this.services = JsonNullable.>of(services); + } + + public CoverageSummaryAttributes totalCoverage(Double totalCoverage) { + this.totalCoverage = JsonNullable.of(totalCoverage); + return this; + } + + /** + * Overall total coverage percentage. + * + * @return totalCoverage + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Double getTotalCoverage() { + return totalCoverage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TOTAL_COVERAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getTotalCoverage_JsonNullable() { + return totalCoverage; + } + + @JsonProperty(JSON_PROPERTY_TOTAL_COVERAGE) + public void setTotalCoverage_JsonNullable(JsonNullable totalCoverage) { + this.totalCoverage = totalCoverage; + } + + public void setTotalCoverage(Double totalCoverage) { + this.totalCoverage = JsonNullable.of(totalCoverage); + } + + /** + * 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 CoverageSummaryAttributes + */ + @JsonAnySetter + public CoverageSummaryAttributes 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 CoverageSummaryAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CoverageSummaryAttributes coverageSummaryAttributes = (CoverageSummaryAttributes) o; + return Objects.equals(this.codeowners, coverageSummaryAttributes.codeowners) + && Objects.equals(this.evaluatedFlagsCount, coverageSummaryAttributes.evaluatedFlagsCount) + && Objects.equals( + this.evaluatedReportsCount, coverageSummaryAttributes.evaluatedReportsCount) + && Objects.equals(this.patchCoverage, coverageSummaryAttributes.patchCoverage) + && Objects.equals(this.services, coverageSummaryAttributes.services) + && Objects.equals(this.totalCoverage, coverageSummaryAttributes.totalCoverage) + && Objects.equals( + this.additionalProperties, coverageSummaryAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + codeowners, + evaluatedFlagsCount, + evaluatedReportsCount, + patchCoverage, + services, + totalCoverage, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CoverageSummaryAttributes {\n"); + sb.append(" codeowners: ").append(toIndentedString(codeowners)).append("\n"); + sb.append(" evaluatedFlagsCount: ") + .append(toIndentedString(evaluatedFlagsCount)) + .append("\n"); + sb.append(" evaluatedReportsCount: ") + .append(toIndentedString(evaluatedReportsCount)) + .append("\n"); + sb.append(" patchCoverage: ").append(toIndentedString(patchCoverage)).append("\n"); + sb.append(" services: ").append(toIndentedString(services)).append("\n"); + sb.append(" totalCoverage: ").append(toIndentedString(totalCoverage)).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/CoverageSummaryCodeownerStats.java b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryCodeownerStats.java new file mode 100644 index 00000000000..5308c895da3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryCodeownerStats.java @@ -0,0 +1,251 @@ +/* + * 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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Coverage statistics for a specific code owner. */ +@JsonPropertyOrder({ + CoverageSummaryCodeownerStats.JSON_PROPERTY_EVALUATED_FLAGS_COUNT, + CoverageSummaryCodeownerStats.JSON_PROPERTY_EVALUATED_REPORTS_COUNT, + CoverageSummaryCodeownerStats.JSON_PROPERTY_PATCH_COVERAGE, + CoverageSummaryCodeownerStats.JSON_PROPERTY_TOTAL_COVERAGE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CoverageSummaryCodeownerStats { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EVALUATED_FLAGS_COUNT = "evaluated_flags_count"; + private Long evaluatedFlagsCount; + + public static final String JSON_PROPERTY_EVALUATED_REPORTS_COUNT = "evaluated_reports_count"; + private Long evaluatedReportsCount; + + public static final String JSON_PROPERTY_PATCH_COVERAGE = "patch_coverage"; + private JsonNullable patchCoverage = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TOTAL_COVERAGE = "total_coverage"; + private JsonNullable totalCoverage = JsonNullable.undefined(); + + public CoverageSummaryCodeownerStats evaluatedFlagsCount(Long evaluatedFlagsCount) { + this.evaluatedFlagsCount = evaluatedFlagsCount; + return this; + } + + /** + * Number of coverage flags evaluated for the code owner. + * + * @return evaluatedFlagsCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVALUATED_FLAGS_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEvaluatedFlagsCount() { + return evaluatedFlagsCount; + } + + public void setEvaluatedFlagsCount(Long evaluatedFlagsCount) { + this.evaluatedFlagsCount = evaluatedFlagsCount; + } + + public CoverageSummaryCodeownerStats evaluatedReportsCount(Long evaluatedReportsCount) { + this.evaluatedReportsCount = evaluatedReportsCount; + return this; + } + + /** + * Number of coverage reports evaluated for the code owner. + * + * @return evaluatedReportsCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVALUATED_REPORTS_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEvaluatedReportsCount() { + return evaluatedReportsCount; + } + + public void setEvaluatedReportsCount(Long evaluatedReportsCount) { + this.evaluatedReportsCount = evaluatedReportsCount; + } + + public CoverageSummaryCodeownerStats patchCoverage(Double patchCoverage) { + this.patchCoverage = JsonNullable.of(patchCoverage); + return this; + } + + /** + * Patch coverage percentage for the code owner. + * + * @return patchCoverage + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Double getPatchCoverage() { + return patchCoverage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PATCH_COVERAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPatchCoverage_JsonNullable() { + return patchCoverage; + } + + @JsonProperty(JSON_PROPERTY_PATCH_COVERAGE) + public void setPatchCoverage_JsonNullable(JsonNullable patchCoverage) { + this.patchCoverage = patchCoverage; + } + + public void setPatchCoverage(Double patchCoverage) { + this.patchCoverage = JsonNullable.of(patchCoverage); + } + + public CoverageSummaryCodeownerStats totalCoverage(Double totalCoverage) { + this.totalCoverage = JsonNullable.of(totalCoverage); + return this; + } + + /** + * Total coverage percentage for the code owner. + * + * @return totalCoverage + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Double getTotalCoverage() { + return totalCoverage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TOTAL_COVERAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getTotalCoverage_JsonNullable() { + return totalCoverage; + } + + @JsonProperty(JSON_PROPERTY_TOTAL_COVERAGE) + public void setTotalCoverage_JsonNullable(JsonNullable totalCoverage) { + this.totalCoverage = totalCoverage; + } + + public void setTotalCoverage(Double totalCoverage) { + this.totalCoverage = JsonNullable.of(totalCoverage); + } + + /** + * 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 CoverageSummaryCodeownerStats + */ + @JsonAnySetter + public CoverageSummaryCodeownerStats 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 CoverageSummaryCodeownerStats object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CoverageSummaryCodeownerStats coverageSummaryCodeownerStats = (CoverageSummaryCodeownerStats) o; + return Objects.equals( + this.evaluatedFlagsCount, coverageSummaryCodeownerStats.evaluatedFlagsCount) + && Objects.equals( + this.evaluatedReportsCount, coverageSummaryCodeownerStats.evaluatedReportsCount) + && Objects.equals(this.patchCoverage, coverageSummaryCodeownerStats.patchCoverage) + && Objects.equals(this.totalCoverage, coverageSummaryCodeownerStats.totalCoverage) + && Objects.equals( + this.additionalProperties, coverageSummaryCodeownerStats.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + evaluatedFlagsCount, + evaluatedReportsCount, + patchCoverage, + totalCoverage, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CoverageSummaryCodeownerStats {\n"); + sb.append(" evaluatedFlagsCount: ") + .append(toIndentedString(evaluatedFlagsCount)) + .append("\n"); + sb.append(" evaluatedReportsCount: ") + .append(toIndentedString(evaluatedReportsCount)) + .append("\n"); + sb.append(" patchCoverage: ").append(toIndentedString(patchCoverage)).append("\n"); + sb.append(" totalCoverage: ").append(toIndentedString(totalCoverage)).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/CoverageSummaryData.java b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryData.java new file mode 100644 index 00000000000..e6a67a772bd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryData.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; + +/** Data object for coverage summary response. */ +@JsonPropertyOrder({ + CoverageSummaryData.JSON_PROPERTY_ATTRIBUTES, + CoverageSummaryData.JSON_PROPERTY_ID, + CoverageSummaryData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CoverageSummaryData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CoverageSummaryAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CoverageSummaryType type; + + public CoverageSummaryData attributes(CoverageSummaryAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes object for code coverage summary response. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CoverageSummaryAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CoverageSummaryAttributes attributes) { + this.attributes = attributes; + } + + public CoverageSummaryData id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier for the coverage summary (base64-hashed). + * + * @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 CoverageSummaryData type(CoverageSummaryType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API type for coverage summary response. The value must always be + * ci_app_coverage_summary. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CoverageSummaryType getType() { + return type; + } + + public void setType(CoverageSummaryType 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 CoverageSummaryData + */ + @JsonAnySetter + public CoverageSummaryData 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 CoverageSummaryData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CoverageSummaryData coverageSummaryData = (CoverageSummaryData) o; + return Objects.equals(this.attributes, coverageSummaryData.attributes) + && Objects.equals(this.id, coverageSummaryData.id) + && Objects.equals(this.type, coverageSummaryData.type) + && Objects.equals(this.additionalProperties, coverageSummaryData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CoverageSummaryData {\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/CoverageSummaryResponse.java b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryResponse.java new file mode 100644 index 00000000000..7d5605c9ac9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryResponse.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; + +/** Response object containing code coverage summary. */ +@JsonPropertyOrder({CoverageSummaryResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CoverageSummaryResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CoverageSummaryData data; + + public CoverageSummaryResponse data(CoverageSummaryData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object for coverage summary response. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CoverageSummaryData getData() { + return data; + } + + public void setData(CoverageSummaryData 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 CoverageSummaryResponse + */ + @JsonAnySetter + public CoverageSummaryResponse 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 CoverageSummaryResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CoverageSummaryResponse coverageSummaryResponse = (CoverageSummaryResponse) o; + return Objects.equals(this.data, coverageSummaryResponse.data) + && Objects.equals(this.additionalProperties, coverageSummaryResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CoverageSummaryResponse {\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/CoverageSummaryServiceStats.java b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryServiceStats.java new file mode 100644 index 00000000000..d013ab96740 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryServiceStats.java @@ -0,0 +1,250 @@ +/* + * 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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Coverage statistics for a specific service. */ +@JsonPropertyOrder({ + CoverageSummaryServiceStats.JSON_PROPERTY_EVALUATED_FLAGS_COUNT, + CoverageSummaryServiceStats.JSON_PROPERTY_EVALUATED_REPORTS_COUNT, + CoverageSummaryServiceStats.JSON_PROPERTY_PATCH_COVERAGE, + CoverageSummaryServiceStats.JSON_PROPERTY_TOTAL_COVERAGE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CoverageSummaryServiceStats { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EVALUATED_FLAGS_COUNT = "evaluated_flags_count"; + private Long evaluatedFlagsCount; + + public static final String JSON_PROPERTY_EVALUATED_REPORTS_COUNT = "evaluated_reports_count"; + private Long evaluatedReportsCount; + + public static final String JSON_PROPERTY_PATCH_COVERAGE = "patch_coverage"; + private JsonNullable patchCoverage = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TOTAL_COVERAGE = "total_coverage"; + private JsonNullable totalCoverage = JsonNullable.undefined(); + + public CoverageSummaryServiceStats evaluatedFlagsCount(Long evaluatedFlagsCount) { + this.evaluatedFlagsCount = evaluatedFlagsCount; + return this; + } + + /** + * Number of coverage flags evaluated for the service. + * + * @return evaluatedFlagsCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVALUATED_FLAGS_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEvaluatedFlagsCount() { + return evaluatedFlagsCount; + } + + public void setEvaluatedFlagsCount(Long evaluatedFlagsCount) { + this.evaluatedFlagsCount = evaluatedFlagsCount; + } + + public CoverageSummaryServiceStats evaluatedReportsCount(Long evaluatedReportsCount) { + this.evaluatedReportsCount = evaluatedReportsCount; + return this; + } + + /** + * Number of coverage reports evaluated for the service. + * + * @return evaluatedReportsCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVALUATED_REPORTS_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEvaluatedReportsCount() { + return evaluatedReportsCount; + } + + public void setEvaluatedReportsCount(Long evaluatedReportsCount) { + this.evaluatedReportsCount = evaluatedReportsCount; + } + + public CoverageSummaryServiceStats patchCoverage(Double patchCoverage) { + this.patchCoverage = JsonNullable.of(patchCoverage); + return this; + } + + /** + * Patch coverage percentage for the service. + * + * @return patchCoverage + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Double getPatchCoverage() { + return patchCoverage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PATCH_COVERAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPatchCoverage_JsonNullable() { + return patchCoverage; + } + + @JsonProperty(JSON_PROPERTY_PATCH_COVERAGE) + public void setPatchCoverage_JsonNullable(JsonNullable patchCoverage) { + this.patchCoverage = patchCoverage; + } + + public void setPatchCoverage(Double patchCoverage) { + this.patchCoverage = JsonNullable.of(patchCoverage); + } + + public CoverageSummaryServiceStats totalCoverage(Double totalCoverage) { + this.totalCoverage = JsonNullable.of(totalCoverage); + return this; + } + + /** + * Total coverage percentage for the service. + * + * @return totalCoverage + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Double getTotalCoverage() { + return totalCoverage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TOTAL_COVERAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getTotalCoverage_JsonNullable() { + return totalCoverage; + } + + @JsonProperty(JSON_PROPERTY_TOTAL_COVERAGE) + public void setTotalCoverage_JsonNullable(JsonNullable totalCoverage) { + this.totalCoverage = totalCoverage; + } + + public void setTotalCoverage(Double totalCoverage) { + this.totalCoverage = JsonNullable.of(totalCoverage); + } + + /** + * 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 CoverageSummaryServiceStats + */ + @JsonAnySetter + public CoverageSummaryServiceStats 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 CoverageSummaryServiceStats object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CoverageSummaryServiceStats coverageSummaryServiceStats = (CoverageSummaryServiceStats) o; + return Objects.equals(this.evaluatedFlagsCount, coverageSummaryServiceStats.evaluatedFlagsCount) + && Objects.equals( + this.evaluatedReportsCount, coverageSummaryServiceStats.evaluatedReportsCount) + && Objects.equals(this.patchCoverage, coverageSummaryServiceStats.patchCoverage) + && Objects.equals(this.totalCoverage, coverageSummaryServiceStats.totalCoverage) + && Objects.equals( + this.additionalProperties, coverageSummaryServiceStats.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + evaluatedFlagsCount, + evaluatedReportsCount, + patchCoverage, + totalCoverage, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CoverageSummaryServiceStats {\n"); + sb.append(" evaluatedFlagsCount: ") + .append(toIndentedString(evaluatedFlagsCount)) + .append("\n"); + sb.append(" evaluatedReportsCount: ") + .append(toIndentedString(evaluatedReportsCount)) + .append("\n"); + sb.append(" patchCoverage: ").append(toIndentedString(patchCoverage)).append("\n"); + sb.append(" totalCoverage: ").append(toIndentedString(totalCoverage)).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/CoverageSummaryType.java b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryType.java new file mode 100644 index 00000000000..6082377cc22 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CoverageSummaryType.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; + +/** + * JSON:API type for coverage summary response. The value must always be + * ci_app_coverage_summary. + */ +@JsonSerialize(using = CoverageSummaryType.CoverageSummaryTypeSerializer.class) +public class CoverageSummaryType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ci_app_coverage_summary")); + + public static final CoverageSummaryType CI_APP_COVERAGE_SUMMARY = + new CoverageSummaryType("ci_app_coverage_summary"); + + CoverageSummaryType(String value) { + super(value, allowedValues); + } + + public static class CoverageSummaryTypeSerializer extends StdSerializer { + public CoverageSummaryTypeSerializer(Class t) { + super(t); + } + + public CoverageSummaryTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CoverageSummaryType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CoverageSummaryType fromValue(String value) { + return new CoverageSummaryType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMapperProcessorMappingMapping.java b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMapperProcessorMappingMapping.java index 437f7ca48ee..4b7e9947ab1 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMapperProcessorMappingMapping.java +++ b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMapperProcessorMappingMapping.java @@ -140,6 +140,57 @@ public ObservabilityPipelineOcsfMapperProcessorMappingMapping deserialize( e); } + // deserialize ObservabilityPipelineOcsfMappingCustom + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ObservabilityPipelineOcsfMappingCustom.class.equals(Integer.class) + || ObservabilityPipelineOcsfMappingCustom.class.equals(Long.class) + || ObservabilityPipelineOcsfMappingCustom.class.equals(Float.class) + || ObservabilityPipelineOcsfMappingCustom.class.equals(Double.class) + || ObservabilityPipelineOcsfMappingCustom.class.equals(Boolean.class) + || ObservabilityPipelineOcsfMappingCustom.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ObservabilityPipelineOcsfMappingCustom.class.equals(Integer.class) + || ObservabilityPipelineOcsfMappingCustom.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ObservabilityPipelineOcsfMappingCustom.class.equals(Float.class) + || ObservabilityPipelineOcsfMappingCustom.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ObservabilityPipelineOcsfMappingCustom.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ObservabilityPipelineOcsfMappingCustom.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(ObservabilityPipelineOcsfMappingCustom.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ObservabilityPipelineOcsfMappingCustom) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, "Input data matches schema 'ObservabilityPipelineOcsfMappingCustom'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'ObservabilityPipelineOcsfMappingCustom'", + e); + } + ObservabilityPipelineOcsfMapperProcessorMappingMapping ret = new ObservabilityPipelineOcsfMapperProcessorMappingMapping(); if (match == 1) { @@ -178,10 +229,19 @@ public ObservabilityPipelineOcsfMapperProcessorMappingMapping( setActualInstance(o); } + public ObservabilityPipelineOcsfMapperProcessorMappingMapping( + ObservabilityPipelineOcsfMappingCustom o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put( "ObservabilityPipelineOcsfMappingLibrary", new GenericType() {}); + schemas.put( + "ObservabilityPipelineOcsfMappingCustom", + new GenericType() {}); JSON.registerDescendants( ObservabilityPipelineOcsfMapperProcessorMappingMapping.class, Collections.unmodifiableMap(schemas)); @@ -194,7 +254,8 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: ObservabilityPipelineOcsfMappingLibrary + * against the oneOf child schemas: ObservabilityPipelineOcsfMappingLibrary, + * ObservabilityPipelineOcsfMappingCustom * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -206,19 +267,27 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf( + ObservabilityPipelineOcsfMappingCustom.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } throw new RuntimeException( - "Invalid instance type. Must be ObservabilityPipelineOcsfMappingLibrary"); + "Invalid instance type. Must be ObservabilityPipelineOcsfMappingLibrary," + + " ObservabilityPipelineOcsfMappingCustom"); } /** - * Get the actual instance, which can be the following: ObservabilityPipelineOcsfMappingLibrary + * Get the actual instance, which can be the following: ObservabilityPipelineOcsfMappingLibrary, + * ObservabilityPipelineOcsfMappingCustom * - * @return The actual instance (ObservabilityPipelineOcsfMappingLibrary) + * @return The actual instance (ObservabilityPipelineOcsfMappingLibrary, + * ObservabilityPipelineOcsfMappingCustom) */ @Override public Object getActualInstance() { @@ -236,4 +305,16 @@ public ObservabilityPipelineOcsfMappingLibrary getObservabilityPipelineOcsfMappi throws ClassCastException { return (ObservabilityPipelineOcsfMappingLibrary) super.getActualInstance(); } + + /** + * Get the actual instance of `ObservabilityPipelineOcsfMappingCustom`. If the actual instance is + * not `ObservabilityPipelineOcsfMappingCustom`, the ClassCastException will be thrown. + * + * @return The actual instance of `ObservabilityPipelineOcsfMappingCustom` + * @throws ClassCastException if the instance is not `ObservabilityPipelineOcsfMappingCustom` + */ + public ObservabilityPipelineOcsfMappingCustom getObservabilityPipelineOcsfMappingCustom() + throws ClassCastException { + return (ObservabilityPipelineOcsfMappingCustom) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustom.java b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustom.java new file mode 100644 index 00000000000..c6643101861 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustom.java @@ -0,0 +1,221 @@ +/* + * 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; + +/** Custom OCSF mapping configuration for transforming logs. */ +@JsonPropertyOrder({ + ObservabilityPipelineOcsfMappingCustom.JSON_PROPERTY_MAPPING, + ObservabilityPipelineOcsfMappingCustom.JSON_PROPERTY_METADATA, + ObservabilityPipelineOcsfMappingCustom.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ObservabilityPipelineOcsfMappingCustom { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_MAPPING = "mapping"; + private List mapping = new ArrayList<>(); + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private ObservabilityPipelineOcsfMappingCustomMetadata metadata; + + public static final String JSON_PROPERTY_VERSION = "version"; + private Long version; + + public ObservabilityPipelineOcsfMappingCustom() {} + + @JsonCreator + public ObservabilityPipelineOcsfMappingCustom( + @JsonProperty(required = true, value = JSON_PROPERTY_MAPPING) + List mapping, + @JsonProperty(required = true, value = JSON_PROPERTY_METADATA) + ObservabilityPipelineOcsfMappingCustomMetadata metadata, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION) Long version) { + this.mapping = mapping; + this.metadata = metadata; + this.unparsed |= metadata.unparsed; + this.version = version; + } + + public ObservabilityPipelineOcsfMappingCustom mapping( + List mapping) { + this.mapping = mapping; + for (ObservabilityPipelineOcsfMappingCustomFieldMapping item : mapping) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ObservabilityPipelineOcsfMappingCustom addMappingItem( + ObservabilityPipelineOcsfMappingCustomFieldMapping mappingItem) { + this.mapping.add(mappingItem); + this.unparsed |= mappingItem.unparsed; + return this; + } + + /** + * A list of field mapping rules for transforming log fields to OCSF schema fields. + * + * @return mapping + */ + @JsonProperty(JSON_PROPERTY_MAPPING) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getMapping() { + return mapping; + } + + public void setMapping(List mapping) { + this.mapping = mapping; + } + + public ObservabilityPipelineOcsfMappingCustom metadata( + ObservabilityPipelineOcsfMappingCustomMetadata metadata) { + this.metadata = metadata; + this.unparsed |= metadata.unparsed; + return this; + } + + /** + * Metadata for the custom OCSF mapping. + * + * @return metadata + */ + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ObservabilityPipelineOcsfMappingCustomMetadata getMetadata() { + return metadata; + } + + public void setMetadata(ObservabilityPipelineOcsfMappingCustomMetadata metadata) { + this.metadata = metadata; + } + + public ObservabilityPipelineOcsfMappingCustom version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the custom mapping configuration. + * + * @return version + */ + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + /** + * 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 ObservabilityPipelineOcsfMappingCustom + */ + @JsonAnySetter + public ObservabilityPipelineOcsfMappingCustom 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 ObservabilityPipelineOcsfMappingCustom object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObservabilityPipelineOcsfMappingCustom observabilityPipelineOcsfMappingCustom = + (ObservabilityPipelineOcsfMappingCustom) o; + return Objects.equals(this.mapping, observabilityPipelineOcsfMappingCustom.mapping) + && Objects.equals(this.metadata, observabilityPipelineOcsfMappingCustom.metadata) + && Objects.equals(this.version, observabilityPipelineOcsfMappingCustom.version) + && Objects.equals( + this.additionalProperties, observabilityPipelineOcsfMappingCustom.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(mapping, metadata, version, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObservabilityPipelineOcsfMappingCustom {\n"); + sb.append(" mapping: ").append(toIndentedString(mapping)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/ObservabilityPipelineOcsfMappingCustomFieldMapping.java b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomFieldMapping.java new file mode 100644 index 00000000000..75b70575156 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomFieldMapping.java @@ -0,0 +1,292 @@ +/* + * 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; + +/** + * Defines a single field mapping rule for transforming a source field to an OCSF destination field. + */ +@JsonPropertyOrder({ + ObservabilityPipelineOcsfMappingCustomFieldMapping.JSON_PROPERTY_DEFAULT, + ObservabilityPipelineOcsfMappingCustomFieldMapping.JSON_PROPERTY_DEST, + ObservabilityPipelineOcsfMappingCustomFieldMapping.JSON_PROPERTY_LOOKUP, + ObservabilityPipelineOcsfMappingCustomFieldMapping.JSON_PROPERTY_SOURCE, + ObservabilityPipelineOcsfMappingCustomFieldMapping.JSON_PROPERTY_SOURCES, + ObservabilityPipelineOcsfMappingCustomFieldMapping.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ObservabilityPipelineOcsfMappingCustomFieldMapping { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DEFAULT = "default"; + private Object _default = null; + + public static final String JSON_PROPERTY_DEST = "dest"; + private String dest; + + public static final String JSON_PROPERTY_LOOKUP = "lookup"; + private ObservabilityPipelineOcsfMappingCustomLookup lookup; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private Object source = null; + + public static final String JSON_PROPERTY_SOURCES = "sources"; + private Object sources = null; + + public static final String JSON_PROPERTY_VALUE = "value"; + private Object value = null; + + public ObservabilityPipelineOcsfMappingCustomFieldMapping() {} + + @JsonCreator + public ObservabilityPipelineOcsfMappingCustomFieldMapping( + @JsonProperty(required = true, value = JSON_PROPERTY_DEST) String dest) { + this.dest = dest; + } + + public ObservabilityPipelineOcsfMappingCustomFieldMapping _default(Object _default) { + this._default = _default; + return this; + } + + /** + * The default value to use if the source field is missing or empty. + * + * @return _default + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DEFAULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getDefault() { + return _default; + } + + public void setDefault(Object _default) { + this._default = _default; + } + + public ObservabilityPipelineOcsfMappingCustomFieldMapping dest(String dest) { + this.dest = dest; + return this; + } + + /** + * The destination OCSF field path. + * + * @return dest + */ + @JsonProperty(JSON_PROPERTY_DEST) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDest() { + return dest; + } + + public void setDest(String dest) { + this.dest = dest; + } + + public ObservabilityPipelineOcsfMappingCustomFieldMapping lookup( + ObservabilityPipelineOcsfMappingCustomLookup lookup) { + this.lookup = lookup; + this.unparsed |= lookup.unparsed; + return this; + } + + /** + * Lookup table configuration for mapping source values to destination values. + * + * @return lookup + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LOOKUP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ObservabilityPipelineOcsfMappingCustomLookup getLookup() { + return lookup; + } + + public void setLookup(ObservabilityPipelineOcsfMappingCustomLookup lookup) { + this.lookup = lookup; + } + + public ObservabilityPipelineOcsfMappingCustomFieldMapping source(Object source) { + this.source = source; + return this; + } + + /** + * The source field path from the log event. + * + * @return source + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getSource() { + return source; + } + + public void setSource(Object source) { + this.source = source; + } + + public ObservabilityPipelineOcsfMappingCustomFieldMapping sources(Object sources) { + this.sources = sources; + return this; + } + + /** + * Multiple source field paths for combined mapping. + * + * @return sources + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOURCES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getSources() { + return sources; + } + + public void setSources(Object sources) { + this.sources = sources; + } + + public ObservabilityPipelineOcsfMappingCustomFieldMapping value(Object value) { + this.value = value; + return this; + } + + /** + * A static value to use for the destination field. + * + * @return value + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + /** + * 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 ObservabilityPipelineOcsfMappingCustomFieldMapping + */ + @JsonAnySetter + public ObservabilityPipelineOcsfMappingCustomFieldMapping 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 ObservabilityPipelineOcsfMappingCustomFieldMapping object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObservabilityPipelineOcsfMappingCustomFieldMapping + observabilityPipelineOcsfMappingCustomFieldMapping = + (ObservabilityPipelineOcsfMappingCustomFieldMapping) o; + return Objects.equals( + this._default, observabilityPipelineOcsfMappingCustomFieldMapping._default) + && Objects.equals(this.dest, observabilityPipelineOcsfMappingCustomFieldMapping.dest) + && Objects.equals(this.lookup, observabilityPipelineOcsfMappingCustomFieldMapping.lookup) + && Objects.equals(this.source, observabilityPipelineOcsfMappingCustomFieldMapping.source) + && Objects.equals(this.sources, observabilityPipelineOcsfMappingCustomFieldMapping.sources) + && Objects.equals(this.value, observabilityPipelineOcsfMappingCustomFieldMapping.value) + && Objects.equals( + this.additionalProperties, + observabilityPipelineOcsfMappingCustomFieldMapping.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(_default, dest, lookup, source, sources, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObservabilityPipelineOcsfMappingCustomFieldMapping {\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append(" dest: ").append(toIndentedString(dest)).append("\n"); + sb.append(" lookup: ").append(toIndentedString(lookup)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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/ObservabilityPipelineOcsfMappingCustomLookup.java b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomLookup.java new file mode 100644 index 00000000000..be221db4e74 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomLookup.java @@ -0,0 +1,184 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Lookup table configuration for mapping source values to destination values. */ +@JsonPropertyOrder({ + ObservabilityPipelineOcsfMappingCustomLookup.JSON_PROPERTY_DEFAULT, + ObservabilityPipelineOcsfMappingCustomLookup.JSON_PROPERTY_TABLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ObservabilityPipelineOcsfMappingCustomLookup { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DEFAULT = "default"; + private Object _default = null; + + public static final String JSON_PROPERTY_TABLE = "table"; + private List table = null; + + public ObservabilityPipelineOcsfMappingCustomLookup _default(Object _default) { + this._default = _default; + return this; + } + + /** + * The default value to use if no lookup match is found. + * + * @return _default + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DEFAULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getDefault() { + return _default; + } + + public void setDefault(Object _default) { + this._default = _default; + } + + public ObservabilityPipelineOcsfMappingCustomLookup table( + List table) { + this.table = table; + for (ObservabilityPipelineOcsfMappingCustomLookupTableEntry item : table) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ObservabilityPipelineOcsfMappingCustomLookup addTableItem( + ObservabilityPipelineOcsfMappingCustomLookupTableEntry tableItem) { + if (this.table == null) { + this.table = new ArrayList<>(); + } + this.table.add(tableItem); + this.unparsed |= tableItem.unparsed; + return this; + } + + /** + * A list of lookup table entries for value transformation. + * + * @return table + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTable() { + return table; + } + + public void setTable(List table) { + this.table = table; + } + + /** + * 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 ObservabilityPipelineOcsfMappingCustomLookup + */ + @JsonAnySetter + public ObservabilityPipelineOcsfMappingCustomLookup 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 ObservabilityPipelineOcsfMappingCustomLookup object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObservabilityPipelineOcsfMappingCustomLookup observabilityPipelineOcsfMappingCustomLookup = + (ObservabilityPipelineOcsfMappingCustomLookup) o; + return Objects.equals(this._default, observabilityPipelineOcsfMappingCustomLookup._default) + && Objects.equals(this.table, observabilityPipelineOcsfMappingCustomLookup.table) + && Objects.equals( + this.additionalProperties, + observabilityPipelineOcsfMappingCustomLookup.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(_default, table, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObservabilityPipelineOcsfMappingCustomLookup {\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append(" table: ").append(toIndentedString(table)).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/ObservabilityPipelineOcsfMappingCustomLookupTableEntry.java b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomLookupTableEntry.java new file mode 100644 index 00000000000..c0b8468b96c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomLookupTableEntry.java @@ -0,0 +1,286 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A single entry in a lookup table for value transformation. */ +@JsonPropertyOrder({ + ObservabilityPipelineOcsfMappingCustomLookupTableEntry.JSON_PROPERTY_CONTAINS, + ObservabilityPipelineOcsfMappingCustomLookupTableEntry.JSON_PROPERTY_EQUALS, + ObservabilityPipelineOcsfMappingCustomLookupTableEntry.JSON_PROPERTY_EQUALS_SOURCE, + ObservabilityPipelineOcsfMappingCustomLookupTableEntry.JSON_PROPERTY_MATCHES, + ObservabilityPipelineOcsfMappingCustomLookupTableEntry.JSON_PROPERTY_NOT_MATCHES, + ObservabilityPipelineOcsfMappingCustomLookupTableEntry.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ObservabilityPipelineOcsfMappingCustomLookupTableEntry { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONTAINS = "contains"; + private String contains; + + public static final String JSON_PROPERTY_EQUALS = "equals"; + private Object _equals = null; + + public static final String JSON_PROPERTY_EQUALS_SOURCE = "equals_source"; + private String equalsSource; + + public static final String JSON_PROPERTY_MATCHES = "matches"; + private String matches; + + public static final String JSON_PROPERTY_NOT_MATCHES = "not_matches"; + private String notMatches; + + public static final String JSON_PROPERTY_VALUE = "value"; + private Object value = null; + + public ObservabilityPipelineOcsfMappingCustomLookupTableEntry contains(String contains) { + this.contains = contains; + return this; + } + + /** + * The substring to match in the source value. + * + * @return contains + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTAINS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getContains() { + return contains; + } + + public void setContains(String contains) { + this.contains = contains; + } + + public ObservabilityPipelineOcsfMappingCustomLookupTableEntry _equals(Object _equals) { + this._equals = _equals; + return this; + } + + /** + * The exact value to match in the source. + * + * @return _equals + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EQUALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getEquals() { + return _equals; + } + + public void setEquals(Object _equals) { + this._equals = _equals; + } + + public ObservabilityPipelineOcsfMappingCustomLookupTableEntry equalsSource(String equalsSource) { + this.equalsSource = equalsSource; + return this; + } + + /** + * The source field to match against. + * + * @return equalsSource + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EQUALS_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEqualsSource() { + return equalsSource; + } + + public void setEqualsSource(String equalsSource) { + this.equalsSource = equalsSource; + } + + public ObservabilityPipelineOcsfMappingCustomLookupTableEntry matches(String matches) { + this.matches = matches; + return this; + } + + /** + * A regex pattern to match in the source value. + * + * @return matches + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MATCHES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMatches() { + return matches; + } + + public void setMatches(String matches) { + this.matches = matches; + } + + public ObservabilityPipelineOcsfMappingCustomLookupTableEntry notMatches(String notMatches) { + this.notMatches = notMatches; + return this; + } + + /** + * A regex pattern that must not match the source value. + * + * @return notMatches + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NOT_MATCHES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getNotMatches() { + return notMatches; + } + + public void setNotMatches(String notMatches) { + this.notMatches = notMatches; + } + + public ObservabilityPipelineOcsfMappingCustomLookupTableEntry value(Object value) { + this.value = value; + return this; + } + + /** + * The value to use when a match is found. + * + * @return value + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + /** + * 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 ObservabilityPipelineOcsfMappingCustomLookupTableEntry + */ + @JsonAnySetter + public ObservabilityPipelineOcsfMappingCustomLookupTableEntry 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 ObservabilityPipelineOcsfMappingCustomLookupTableEntry object is equal to + * o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObservabilityPipelineOcsfMappingCustomLookupTableEntry + observabilityPipelineOcsfMappingCustomLookupTableEntry = + (ObservabilityPipelineOcsfMappingCustomLookupTableEntry) o; + return Objects.equals( + this.contains, observabilityPipelineOcsfMappingCustomLookupTableEntry.contains) + && Objects.equals( + this._equals, observabilityPipelineOcsfMappingCustomLookupTableEntry._equals) + && Objects.equals( + this.equalsSource, observabilityPipelineOcsfMappingCustomLookupTableEntry.equalsSource) + && Objects.equals( + this.matches, observabilityPipelineOcsfMappingCustomLookupTableEntry.matches) + && Objects.equals( + this.notMatches, observabilityPipelineOcsfMappingCustomLookupTableEntry.notMatches) + && Objects.equals(this.value, observabilityPipelineOcsfMappingCustomLookupTableEntry.value) + && Objects.equals( + this.additionalProperties, + observabilityPipelineOcsfMappingCustomLookupTableEntry.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + contains, _equals, equalsSource, matches, notMatches, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObservabilityPipelineOcsfMappingCustomLookupTableEntry {\n"); + sb.append(" contains: ").append(toIndentedString(contains)).append("\n"); + sb.append(" _equals: ").append(toIndentedString(_equals)).append("\n"); + sb.append(" equalsSource: ").append(toIndentedString(equalsSource)).append("\n"); + sb.append(" matches: ").append(toIndentedString(matches)).append("\n"); + sb.append(" notMatches: ").append(toIndentedString(notMatches)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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/ObservabilityPipelineOcsfMappingCustomMetadata.java b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomMetadata.java new file mode 100644 index 00000000000..f96d6d9c64b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineOcsfMappingCustomMetadata.java @@ -0,0 +1,214 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +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; + +/** Metadata for the custom OCSF mapping. */ +@JsonPropertyOrder({ + ObservabilityPipelineOcsfMappingCustomMetadata.JSON_PROPERTY_CLASS, + ObservabilityPipelineOcsfMappingCustomMetadata.JSON_PROPERTY_PROFILES, + ObservabilityPipelineOcsfMappingCustomMetadata.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ObservabilityPipelineOcsfMappingCustomMetadata { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CLASS = "class"; + private String _class; + + public static final String JSON_PROPERTY_PROFILES = "profiles"; + private List profiles = null; + + public static final String JSON_PROPERTY_VERSION = "version"; + private String version; + + public ObservabilityPipelineOcsfMappingCustomMetadata() {} + + @JsonCreator + public ObservabilityPipelineOcsfMappingCustomMetadata( + @JsonProperty(required = true, value = JSON_PROPERTY_CLASS) String _class, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION) String version) { + this._class = _class; + this.version = version; + } + + public ObservabilityPipelineOcsfMappingCustomMetadata _class(String _class) { + this._class = _class; + return this; + } + + /** + * The OCSF event class name. + * + * @return _class + */ + @JsonProperty(JSON_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClassAttribute() { + return _class; + } + + public void setClassAttribute(String _class) { + this._class = _class; + } + + public ObservabilityPipelineOcsfMappingCustomMetadata profiles(List profiles) { + this.profiles = profiles; + return this; + } + + public ObservabilityPipelineOcsfMappingCustomMetadata addProfilesItem(String profilesItem) { + if (this.profiles == null) { + this.profiles = new ArrayList<>(); + } + this.profiles.add(profilesItem); + return this; + } + + /** + * A list of OCSF profiles to apply. + * + * @return profiles + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROFILES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getProfiles() { + return profiles; + } + + public void setProfiles(List profiles) { + this.profiles = profiles; + } + + public ObservabilityPipelineOcsfMappingCustomMetadata version(String version) { + this.version = version; + return this; + } + + /** + * The OCSF schema version. + * + * @return version + */ + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /** + * 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 ObservabilityPipelineOcsfMappingCustomMetadata + */ + @JsonAnySetter + public ObservabilityPipelineOcsfMappingCustomMetadata 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 ObservabilityPipelineOcsfMappingCustomMetadata object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObservabilityPipelineOcsfMappingCustomMetadata observabilityPipelineOcsfMappingCustomMetadata = + (ObservabilityPipelineOcsfMappingCustomMetadata) o; + return Objects.equals(this._class, observabilityPipelineOcsfMappingCustomMetadata._class) + && Objects.equals(this.profiles, observabilityPipelineOcsfMappingCustomMetadata.profiles) + && Objects.equals(this.version, observabilityPipelineOcsfMappingCustomMetadata.version) + && Objects.equals( + this.additionalProperties, + observabilityPipelineOcsfMappingCustomMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(_class, profiles, version, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObservabilityPipelineOcsfMappingCustomMetadata {\n"); + sb.append(" _class: ").append(toIndentedString(_class)).append("\n"); + sb.append(" profiles: ").append(toIndentedString(profiles)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_custom_mapping_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_custom_mapping_returns_OK_response.freeze new file mode 100644 index 00000000000..0a0ae84b13b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_custom_mapping_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-02-10T14:12:05.668Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_custom_mapping_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_custom_mapping_returns_OK_response.json new file mode 100644 index 00000000000..c5c4434fd3a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_custom_mapping_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"config\":{\"destinations\":[{\"id\":\"datadog-logs-destination\",\"inputs\":[\"my-processor-group\"],\"type\":\"datadog_logs\"}],\"processor_groups\":[{\"enabled\":true,\"id\":\"my-processor-group\",\"include\":\"service:my-service\",\"inputs\":[\"datadog-agent-source\"],\"processors\":[{\"enabled\":true,\"id\":\"ocsf-mapper-processor\",\"include\":\"service:my-service\",\"mappings\":[{\"include\":\"source:custom\",\"mapping\":{\"mapping\":[{\"default\":\"\",\"dest\":\"time\",\"source\":\"timestamp\"},{\"default\":\"\",\"dest\":\"severity\",\"source\":\"level\"},{\"default\":\"\",\"dest\":\"device.type\",\"lookup\":{\"table\":[{\"contains\":\"Desktop\",\"value\":\"desktop\"}]},\"source\":\"host.type\"}],\"metadata\":{\"class\":\"Device Inventory Info\",\"profiles\":[\"container\"],\"version\":\"1.3.0\"},\"version\":1}}],\"type\":\"ocsf_mapper\"}]}],\"sources\":[{\"id\":\"datadog-agent-source\",\"type\":\"datadog_agent\"}]},\"name\":\"OCSF Custom Mapper Pipeline\"},\"type\":\"pipelines\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/obs-pipelines/pipelines/validate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[]}\n", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "53ece09f-7d78-b332-7b7e-dee4b1d3bc51" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_invalid_custom_mapping_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_invalid_custom_mapping_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..55487b67b25 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_invalid_custom_mapping_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2026-02-10T14:12:06.064Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_invalid_custom_mapping_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_invalid_custom_mapping_returns_Bad_Request_response.json new file mode 100644 index 00000000000..b92ed7da43b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_invalid_custom_mapping_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"config\":{\"destinations\":[{\"id\":\"datadog-logs-destination\",\"inputs\":[\"my-processor-group\"],\"type\":\"datadog_logs\"}],\"processor_groups\":[{\"enabled\":true,\"id\":\"my-processor-group\",\"include\":\"service:my-service\",\"inputs\":[\"datadog-agent-source\"],\"processors\":[{\"enabled\":true,\"id\":\"ocsf-mapper-processor\",\"include\":\"service:my-service\",\"mappings\":[{\"include\":\"source:custom\",\"mapping\":{\"mapping\":[{\"dest\":\"time\",\"source\":\"timestamp\"}],\"metadata\":{\"class\":\"Invalid Class\",\"profiles\":[\"container\"],\"version\":\"1.3.0\"},\"version\":0}}],\"type\":\"ocsf_mapper\"}]}],\"sources\":[{\"id\":\"datadog-agent-source\",\"type\":\"datadog_agent\"}]},\"name\":\"OCSF Invalid Mapper Pipeline\"},\"type\":\"pipelines\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/obs-pipelines/pipelines/validate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Schema version must be a positive integer\",\"meta\":{\"field\":\"mappings.0.version\",\"id\":\"ocsf-mapper-processor\",\"message\":\"Schema version must be a positive integer\"}},{\"title\":\"Invalid custom mapping class\",\"meta\":{\"field\":\"mappings.0.metadata.class\",\"id\":\"ocsf-mapper-processor\",\"message\":\"Invalid custom mapping class\"}}]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "61f12364-3079-3b64-7e3d-eccb484f7786" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_library_mapping_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_library_mapping_returns_OK_response.freeze new file mode 100644 index 00000000000..fbeecac324c --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_library_mapping_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-02-10T14:12:05.285Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_library_mapping_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_library_mapping_returns_OK_response.json new file mode 100644 index 00000000000..7949590a2aa --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_observability_pipeline_with_OCSF_mapper_library_mapping_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"config\":{\"destinations\":[{\"id\":\"datadog-logs-destination\",\"inputs\":[\"my-processor-group\"],\"type\":\"datadog_logs\"}],\"processor_groups\":[{\"enabled\":true,\"id\":\"my-processor-group\",\"include\":\"service:my-service\",\"inputs\":[\"datadog-agent-source\"],\"processors\":[{\"enabled\":true,\"id\":\"ocsf-mapper-processor\",\"include\":\"service:my-service\",\"mappings\":[{\"include\":\"source:cloudtrail\",\"mapping\":\"CloudTrail Account Change\"}],\"type\":\"ocsf_mapper\"}]}],\"sources\":[{\"id\":\"datadog-agent-source\",\"type\":\"datadog_agent\"}]},\"name\":\"OCSF Mapper Pipeline\"},\"type\":\"pipelines\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/obs-pipelines/pipelines/validate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[]}\n", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5e3a17b9-b10f-f846-3285-d7e228eca707" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/apm.feature b/src/test/resources/com/datadog/api/client/v2/api/apm.feature index e35bd4d4750..c286ba4f8ba 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/apm.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/apm.feature @@ -9,5 +9,6 @@ Feature: APM And a valid "appKeyAuth" key in the system And an instance of "APM" API And new "GetServiceList" request + And request contains "filter[env]" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/code_coverage.feature b/src/test/resources/com/datadog/api/client/v2/api/code_coverage.feature new file mode 100644 index 00000000000..657ee0375c9 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/code_coverage.feature @@ -0,0 +1,156 @@ +@endpoint(code-coverage) @endpoint(code-coverage-v2) +Feature: Code Coverage + Retrieve and analyze code coverage data from Code Coverage. See the [Code + Coverage page](https://docs.datadoghq.com/code_coverage/) for more + information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "CodeCoverage" API + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a branch returns "Bad Request" response + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a branch returns "Not Found" response + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a branch returns "OK" response + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 200 OK + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a branch with empty branch name returns bad request + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "branch": ""}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a branch with empty repository_id returns bad request + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"repository_id": "", "branch": "prod"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a commit in nonexistent repository returns not found + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/nonexistent-repo", "commit_sha": "c55b0ce584e139bde41a00002ab31bc7d75f791d"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a commit returns "Bad Request" response + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a commit returns "Not Found" response + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a commit returns "OK" response + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 200 OK + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a commit with empty commit_sha returns bad request + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "commit_sha": ""}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a commit with empty repository_id returns bad request + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "", "commit_sha": "c55b0ce584e139bde41a00002ab31bc7d75f791d"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a commit with invalid commit SHA returns bad request + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "commit_sha": "abc123"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a nonexistent branch returns not found + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "branch": "nonexistent-branch"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a nonexistent commit returns not found + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "commit_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a nonexistent repository returns not found + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/nonexistent-repo", "branch": "main"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for an existing branch with valid repository + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "branch": "prod"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "ci_app_coverage_branch_summary" + And the response "data.attributes" has field "total_coverage" + And the response "data.attributes" has field "patch_coverage" + And the response "data.attributes" has field "evaluated_reports_count" + And the response "data.attributes" has field "evaluated_flags_count" + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for an existing commit with valid repository + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "commit_sha": "c55b0ce584e139bde41a00002ab31bc7d75f791d"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "ci_app_coverage_commit_summary" + And the response "data.attributes" has field "total_coverage" + And the response "data.attributes" has field "patch_coverage" + And the response "data.attributes" has field "evaluated_reports_count" + And the response "data.attributes" has field "evaluated_flags_count" diff --git a/src/test/resources/com/datadog/api/client/v2/api/observability_pipelines.feature b/src/test/resources/com/datadog/api/client/v2/api/observability_pipelines.feature index 725b9e425a7..1210c58b316 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/observability_pipelines.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/observability_pipelines.feature @@ -167,3 +167,26 @@ Feature: Observability Pipelines When the request is sent Then the response status is 200 OK And the response "errors" has length 0 + + @team:DataDog/observability-pipelines + Scenario: Validate an observability pipeline with OCSF mapper custom mapping returns "OK" response + Given new "ValidatePipeline" request + And body with value {"data": {"attributes": {"config": {"destinations": [{"id": "datadog-logs-destination", "inputs": ["my-processor-group"], "type": "datadog_logs"}], "processor_groups": [{"enabled": true, "id": "my-processor-group", "include": "service:my-service", "inputs": ["datadog-agent-source"], "processors": [{"enabled": true, "id": "ocsf-mapper-processor", "include": "service:my-service", "type": "ocsf_mapper", "mappings": [{"include": "source:custom", "mapping": {"version": 1, "metadata": {"class": "Device Inventory Info", "profiles": ["container"], "version": "1.3.0"}, "mapping": [{"dest": "time", "source": "timestamp", "default": ""}, {"dest": "severity", "source": "level", "default": ""}, {"dest": "device.type", "source": "host.type", "default": "", "lookup": {"table": [{"contains": "Desktop", "value": "desktop"}]}}]}}]}]}], "sources": [{"id": "datadog-agent-source", "type": "datadog_agent"}]}, "name": "OCSF Custom Mapper Pipeline"}, "type": "pipelines"}} + When the request is sent + Then the response status is 200 OK + And the response "errors" has length 0 + + @team:DataDog/observability-pipelines + Scenario: Validate an observability pipeline with OCSF mapper invalid custom mapping returns "Bad Request" response + Given new "ValidatePipeline" request + And body with value {"data": {"attributes": {"config": {"destinations": [{"id": "datadog-logs-destination", "inputs": ["my-processor-group"], "type": "datadog_logs"}], "processor_groups": [{"enabled": true, "id": "my-processor-group", "include": "service:my-service", "inputs": ["datadog-agent-source"], "processors": [{"enabled": true, "id": "ocsf-mapper-processor", "include": "service:my-service", "type": "ocsf_mapper", "mappings": [{"include": "source:custom", "mapping": {"version": 0, "metadata": {"class": "Invalid Class", "profiles": ["container"], "version": "1.3.0"}, "mapping": [{"dest": "time", "source": "timestamp"}]}}]}]}], "sources": [{"id": "datadog-agent-source", "type": "datadog_agent"}]}, "name": "OCSF Invalid Mapper Pipeline"}, "type": "pipelines"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/observability-pipelines + Scenario: Validate an observability pipeline with OCSF mapper library mapping returns "OK" response + Given new "ValidatePipeline" request + And body with value {"data": {"attributes": {"config": {"destinations": [{"id": "datadog-logs-destination", "inputs": ["my-processor-group"], "type": "datadog_logs"}], "processor_groups": [{"enabled": true, "id": "my-processor-group", "include": "service:my-service", "inputs": ["datadog-agent-source"], "processors": [{"enabled": true, "id": "ocsf-mapper-processor", "include": "service:my-service", "type": "ocsf_mapper", "mappings": [{"include": "source:cloudtrail", "mapping": "CloudTrail Account Change"}]}]}], "sources": [{"id": "datadog-agent-source", "type": "datadog_agent"}]}, "name": "OCSF Mapper Pipeline"}, "type": "pipelines"}} + When the request is sent + Then the response status is 200 OK + And the response "errors" has length 0 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 5727d36b956..75d0d7f71ed 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 @@ -1061,6 +1061,18 @@ "type": "idempotent" } }, + "GetCodeCoverageBranchSummary": { + "tag": "Code Coverage", + "undo": { + "type": "safe" + } + }, + "GetCodeCoverageCommitSummary": { + "tag": "Code Coverage", + "undo": { + "type": "safe" + } + }, "ListContainerImages": { "tag": "Container Images", "undo": {