diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b8661d93ff7..07cf64fab0e 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 @@ -67602,6 +67809,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. @@ -74203,6 +74411,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 +103802,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/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/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/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/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/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": {