diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 07a00c9a7f3..7a0a9aa0fec 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -41461,6 +41461,39 @@ components: example: "/api/v2/scorecard/rules?page%5Blimit%5D=2&page%5Boffset%5D=2&page%5Bsize%5D=2" type: string type: object + ListScorecardScoresMeta: + description: Pagination metadata for scores. + properties: + count: + description: The number of results returned in this page. + format: int64 + type: integer + limit: + description: The page limit. + format: int64 + type: integer + offset: + description: The page offset. + format: int64 + type: integer + total: + description: The total number of results. + format: int64 + type: integer + type: object + ListScorecardScoresResponse: + description: A list of scorecard scores for a given aggregation type. + properties: + data: + description: Array of score objects. + items: + $ref: "#/components/schemas/ScorecardScoreData" + type: array + links: + $ref: "#/components/schemas/ListRulesResponseLinks" + meta: + $ref: "#/components/schemas/ListScorecardScoresMeta" + type: object ListScorecardsResponse: description: Response containing a list of scorecards. properties: @@ -62579,6 +62612,119 @@ components: type: string x-enum-varnames: - SCORECARD + ScorecardScoreAttributes: + description: Attributes of a scorecard score. + properties: + aggregation: + $ref: "#/components/schemas/ScorecardScoresAggregation" + denominator: + description: The denominator used to compute the score ratio. + format: int64 + type: integer + level: + description: The maturity level of the associated rule. + format: int64 + type: integer + numerator: + description: The numerator used to compute the score ratio. + format: int64 + type: integer + score: + description: The computed score ratio (numerator/denominator), from 0 to 1. + format: double + type: number + total_entities: + description: The total number of entities evaluated. + format: int64 + type: integer + total_fail: + description: The number of rules that failed. + format: int64 + type: integer + total_no_data: + description: The number of rules with no data. + format: int64 + type: integer + total_pass: + description: The number of rules that passed. + format: int64 + type: integer + total_skip: + description: The number of rules that were skipped. + format: int64 + type: integer + type: object + ScorecardScoreData: + description: A scorecard score object for a single entity, rule, scorecard, service, or team. + properties: + attributes: + $ref: "#/components/schemas/ScorecardScoreAttributes" + id: + description: The ID of the entity or resource being scored. + example: "" + type: string + relationships: + $ref: "#/components/schemas/ScorecardScoreRelationships" + type: + $ref: "#/components/schemas/ScorecardScoreDataType" + required: + - id + - type + type: object + ScorecardScoreDataType: + default: score + description: The JSON:API resource type. + enum: [score] + example: score + type: string + x-enum-varnames: + - SCORE + ScorecardScoreRelationshipData: + description: A relationship data object for a score. + properties: + id: + description: The ID of the related resource. + example: "" + type: string + type: + description: The type of the related resource. + example: "" + type: string + required: + - id + - type + type: object + ScorecardScoreRelationshipItem: + description: A relationship item for a score. + properties: + data: + $ref: "#/components/schemas/ScorecardScoreRelationshipData" + type: object + ScorecardScoreRelationships: + description: Relationships for a scorecard score, depending on the aggregation type. + properties: + entity: + $ref: "#/components/schemas/ScorecardScoreRelationshipItem" + rule: + $ref: "#/components/schemas/ScorecardScoreRelationshipItem" + scorecard: + $ref: "#/components/schemas/ScorecardScoreRelationshipItem" + service: + $ref: "#/components/schemas/ScorecardScoreRelationshipItem" + team: + $ref: "#/components/schemas/ScorecardScoreRelationshipItem" + type: object + ScorecardScoresAggregation: + description: Dimension to group scores by. + enum: [by-entity, by-rule, by-scorecard, by-team, by-kind] + example: by-entity + type: string + x-enum-varnames: + - BY_ENTITY + - BY_RULE + - BY_SCORECARD + - BY_TEAM + - BY_KIND ScorecardType: default: scorecard description: The JSON:API type for scorecard. @@ -128170,6 +128316,127 @@ paths: summary: List all scorecards tags: - Scorecards + /api/v2/scorecard/scores/{aggregation}: + get: + description: Returns a list of scorecard scores for each aggregation type, with score breakdowns. + operationId: ListScorecardScores + parameters: + - description: The type of scores being requested. + in: path + name: aggregation + required: true + schema: + $ref: "#/components/schemas/ScorecardScoresAggregation" + - description: Filter scores by an entity query string. + in: query + name: filter[entity][query] + required: false + schema: + type: string + - description: Filter scores by rule ID(s), comma-separated. + in: query + name: filter[rule][id] + required: false + schema: + type: string + - description: Filter scores by rule name. + in: query + name: filter[rule][name] + required: false + schema: + type: string + - description: Filter scores by rule level(s), comma-separated. + in: query + name: filter[rule][level] + required: false + schema: + type: string + - description: Filter scores by scorecard ID(s), comma-separated. + in: query + name: filter[rule][scorecard_id] + required: false + schema: + type: string + - description: Filter scores to show only custom rules. + in: query + name: filter[rule][is_custom] + required: false + schema: + type: boolean + - description: Filter scores to show only enabled rules. + in: query + name: filter[rule][is_enabled] + required: false + schema: + type: boolean + - description: "Sort scores by field. Use a hyphen prefix for descending order. Options: score, numerator, denominator, total_pass, total_fail, total_skip, total_no_data." + in: query + name: sort + required: false + schema: + type: string + - description: Offset for pagination. + in: query + name: page[offset] + required: false + schema: + default: 0 + type: integer + - description: Number of scores to return. Max is 1000. + in: query + name: page[limit] + required: false + schema: + default: 100 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + aggregation: by-entity + denominator: 4 + numerator: 3 + score: 0.75 + total_fail: 1 + total_no_data: 0 + total_pass: 3 + total_skip: 0 + id: service:my-service + relationships: + entity: + data: + id: service:my-service + type: entity + type: score + links: + next: /api/v2/scorecard/scores/by-entity?page[offset]=100&page[limit]=100 + meta: + count: 1 + limit: 100 + offset: 0 + total: 42 + schema: + $ref: "#/components/schemas/ListScorecardScoresResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_read + summary: List all scores + tags: + - Scorecards /api/v2/seats/users: delete: description: |- diff --git a/examples/v2/scorecards/ListScorecardScores.java b/examples/v2/scorecards/ListScorecardScores.java new file mode 100644 index 00000000000..a4c192d4c54 --- /dev/null +++ b/examples/v2/scorecards/ListScorecardScores.java @@ -0,0 +1,26 @@ +// List all scores returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.model.ListScorecardScoresResponse; +import com.datadog.api.client.v2.model.ScorecardScoresAggregation; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); + + try { + ListScorecardScoresResponse result = + apiInstance.listScorecardScores(ScorecardScoresAggregation.BY_ENTITY); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ScorecardsApi#listScorecardScores"); + 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/v2/api/ScorecardsApi.java b/src/main/java/com/datadog/api/client/v2/api/ScorecardsApi.java index bee14a2d6d5..d28c22e5fb9 100644 --- a/src/main/java/com/datadog/api/client/v2/api/ScorecardsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/ScorecardsApi.java @@ -12,11 +12,13 @@ import com.datadog.api.client.v2.model.ListCampaignsResponse; import com.datadog.api.client.v2.model.ListRulesResponse; import com.datadog.api.client.v2.model.ListRulesResponseDataItem; +import com.datadog.api.client.v2.model.ListScorecardScoresResponse; import com.datadog.api.client.v2.model.ListScorecardsResponse; import com.datadog.api.client.v2.model.OutcomesBatchRequest; import com.datadog.api.client.v2.model.OutcomesBatchResponse; import com.datadog.api.client.v2.model.OutcomesResponse; import com.datadog.api.client.v2.model.OutcomesResponseDataItem; +import com.datadog.api.client.v2.model.ScorecardScoresAggregation; import com.datadog.api.client.v2.model.UpdateCampaignRequest; import com.datadog.api.client.v2.model.UpdateOutcomesAsyncRequest; import com.datadog.api.client.v2.model.UpdateRuleRequest; @@ -2217,6 +2219,371 @@ public CompletableFuture> listScorecardsWith new GenericType() {}); } + /** Manage optional parameters to listScorecardScores. */ + public static class ListScorecardScoresOptionalParameters { + private String filterEntityQuery; + private String filterRuleId; + private String filterRuleName; + private String filterRuleLevel; + private String filterRuleScorecardId; + private Boolean filterRuleIsCustom; + private Boolean filterRuleIsEnabled; + private String sort; + private Integer pageOffset; + private Integer pageLimit; + + /** + * Set filterEntityQuery. + * + * @param filterEntityQuery Filter scores by an entity query string. (optional) + * @return ListScorecardScoresOptionalParameters + */ + public ListScorecardScoresOptionalParameters filterEntityQuery(String filterEntityQuery) { + this.filterEntityQuery = filterEntityQuery; + return this; + } + + /** + * Set filterRuleId. + * + * @param filterRuleId Filter scores by rule ID(s), comma-separated. (optional) + * @return ListScorecardScoresOptionalParameters + */ + public ListScorecardScoresOptionalParameters filterRuleId(String filterRuleId) { + this.filterRuleId = filterRuleId; + return this; + } + + /** + * Set filterRuleName. + * + * @param filterRuleName Filter scores by rule name. (optional) + * @return ListScorecardScoresOptionalParameters + */ + public ListScorecardScoresOptionalParameters filterRuleName(String filterRuleName) { + this.filterRuleName = filterRuleName; + return this; + } + + /** + * Set filterRuleLevel. + * + * @param filterRuleLevel Filter scores by rule level(s), comma-separated. (optional) + * @return ListScorecardScoresOptionalParameters + */ + public ListScorecardScoresOptionalParameters filterRuleLevel(String filterRuleLevel) { + this.filterRuleLevel = filterRuleLevel; + return this; + } + + /** + * Set filterRuleScorecardId. + * + * @param filterRuleScorecardId Filter scores by scorecard ID(s), comma-separated. (optional) + * @return ListScorecardScoresOptionalParameters + */ + public ListScorecardScoresOptionalParameters filterRuleScorecardId( + String filterRuleScorecardId) { + this.filterRuleScorecardId = filterRuleScorecardId; + return this; + } + + /** + * Set filterRuleIsCustom. + * + * @param filterRuleIsCustom Filter scores to show only custom rules. (optional) + * @return ListScorecardScoresOptionalParameters + */ + public ListScorecardScoresOptionalParameters filterRuleIsCustom(Boolean filterRuleIsCustom) { + this.filterRuleIsCustom = filterRuleIsCustom; + return this; + } + + /** + * Set filterRuleIsEnabled. + * + * @param filterRuleIsEnabled Filter scores to show only enabled rules. (optional) + * @return ListScorecardScoresOptionalParameters + */ + public ListScorecardScoresOptionalParameters filterRuleIsEnabled(Boolean filterRuleIsEnabled) { + this.filterRuleIsEnabled = filterRuleIsEnabled; + return this; + } + + /** + * Set sort. + * + * @param sort Sort scores by field. Use a hyphen prefix for descending order. Options: score, + * numerator, denominator, total_pass, total_fail, total_skip, total_no_data. (optional) + * @return ListScorecardScoresOptionalParameters + */ + public ListScorecardScoresOptionalParameters sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set pageOffset. + * + * @param pageOffset Offset for pagination. (optional, default to 0) + * @return ListScorecardScoresOptionalParameters + */ + public ListScorecardScoresOptionalParameters pageOffset(Integer pageOffset) { + this.pageOffset = pageOffset; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit Number of scores to return. Max is 1000. (optional, default to 100) + * @return ListScorecardScoresOptionalParameters + */ + public ListScorecardScoresOptionalParameters pageLimit(Integer pageLimit) { + this.pageLimit = pageLimit; + return this; + } + } + + /** + * List all scores. + * + *

See {@link #listScorecardScoresWithHttpInfo}. + * + * @param aggregation The type of scores being requested. (required) + * @return ListScorecardScoresResponse + * @throws ApiException if fails to make API call + */ + public ListScorecardScoresResponse listScorecardScores(ScorecardScoresAggregation aggregation) + throws ApiException { + return listScorecardScoresWithHttpInfo(aggregation, new ListScorecardScoresOptionalParameters()) + .getData(); + } + + /** + * List all scores. + * + *

See {@link #listScorecardScoresWithHttpInfoAsync}. + * + * @param aggregation The type of scores being requested. (required) + * @return CompletableFuture<ListScorecardScoresResponse> + */ + public CompletableFuture listScorecardScoresAsync( + ScorecardScoresAggregation aggregation) { + return listScorecardScoresWithHttpInfoAsync( + aggregation, new ListScorecardScoresOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List all scores. + * + *

See {@link #listScorecardScoresWithHttpInfo}. + * + * @param aggregation The type of scores being requested. (required) + * @param parameters Optional parameters for the request. + * @return ListScorecardScoresResponse + * @throws ApiException if fails to make API call + */ + public ListScorecardScoresResponse listScorecardScores( + ScorecardScoresAggregation aggregation, ListScorecardScoresOptionalParameters parameters) + throws ApiException { + return listScorecardScoresWithHttpInfo(aggregation, parameters).getData(); + } + + /** + * List all scores. + * + *

See {@link #listScorecardScoresWithHttpInfoAsync}. + * + * @param aggregation The type of scores being requested. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ListScorecardScoresResponse> + */ + public CompletableFuture listScorecardScoresAsync( + ScorecardScoresAggregation aggregation, ListScorecardScoresOptionalParameters parameters) { + return listScorecardScoresWithHttpInfoAsync(aggregation, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Returns a list of scorecard scores for each aggregation type, with score breakdowns. + * + * @param aggregation The type of scores being requested. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<ListScorecardScoresResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listScorecardScoresWithHttpInfo( + ScorecardScoresAggregation aggregation, ListScorecardScoresOptionalParameters parameters) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'aggregation' is set + if (aggregation == null) { + throw new ApiException( + 400, "Missing the required parameter 'aggregation' when calling listScorecardScores"); + } + String filterEntityQuery = parameters.filterEntityQuery; + String filterRuleId = parameters.filterRuleId; + String filterRuleName = parameters.filterRuleName; + String filterRuleLevel = parameters.filterRuleLevel; + String filterRuleScorecardId = parameters.filterRuleScorecardId; + Boolean filterRuleIsCustom = parameters.filterRuleIsCustom; + Boolean filterRuleIsEnabled = parameters.filterRuleIsEnabled; + String sort = parameters.sort; + Integer pageOffset = parameters.pageOffset; + Integer pageLimit = parameters.pageLimit; + // create path and map variables + String localVarPath = + "/api/v2/scorecard/scores/{aggregation}" + .replaceAll( + "\\{" + "aggregation" + "\\}", apiClient.escapeString(aggregation.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[entity][query]", filterEntityQuery)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule][id]", filterRuleId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][name]", filterRuleName)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][level]", filterRuleLevel)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][scorecard_id]", filterRuleScorecardId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][is_custom]", filterRuleIsCustom)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][is_enabled]", filterRuleIsEnabled)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ScorecardsApi.listScorecardScores", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List all scores. + * + *

See {@link #listScorecardScoresWithHttpInfo}. + * + * @param aggregation The type of scores being requested. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<ListScorecardScoresResponse>> + */ + public CompletableFuture> + listScorecardScoresWithHttpInfoAsync( + ScorecardScoresAggregation aggregation, + ListScorecardScoresOptionalParameters parameters) { + Object localVarPostBody = null; + + // verify the required parameter 'aggregation' is set + if (aggregation == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'aggregation' when calling listScorecardScores")); + return result; + } + String filterEntityQuery = parameters.filterEntityQuery; + String filterRuleId = parameters.filterRuleId; + String filterRuleName = parameters.filterRuleName; + String filterRuleLevel = parameters.filterRuleLevel; + String filterRuleScorecardId = parameters.filterRuleScorecardId; + Boolean filterRuleIsCustom = parameters.filterRuleIsCustom; + Boolean filterRuleIsEnabled = parameters.filterRuleIsEnabled; + String sort = parameters.sort; + Integer pageOffset = parameters.pageOffset; + Integer pageLimit = parameters.pageLimit; + // create path and map variables + String localVarPath = + "/api/v2/scorecard/scores/{aggregation}" + .replaceAll( + "\\{" + "aggregation" + "\\}", apiClient.escapeString(aggregation.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[entity][query]", filterEntityQuery)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule][id]", filterRuleId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][name]", filterRuleName)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][level]", filterRuleLevel)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][scorecard_id]", filterRuleScorecardId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][is_custom]", filterRuleIsCustom)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][is_enabled]", filterRuleIsEnabled)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ScorecardsApi.listScorecardScores", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Update a campaign. * diff --git a/src/main/java/com/datadog/api/client/v2/model/ListScorecardScoresMeta.java b/src/main/java/com/datadog/api/client/v2/model/ListScorecardScoresMeta.java new file mode 100644 index 00000000000..fbe67e8b07d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListScorecardScoresMeta.java @@ -0,0 +1,218 @@ +/* + * 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; + +/** Pagination metadata for scores. */ +@JsonPropertyOrder({ + ListScorecardScoresMeta.JSON_PROPERTY_COUNT, + ListScorecardScoresMeta.JSON_PROPERTY_LIMIT, + ListScorecardScoresMeta.JSON_PROPERTY_OFFSET, + ListScorecardScoresMeta.JSON_PROPERTY_TOTAL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListScorecardScoresMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COUNT = "count"; + private Long count; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + private Long limit; + + public static final String JSON_PROPERTY_OFFSET = "offset"; + private Long offset; + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public ListScorecardScoresMeta count(Long count) { + this.count = count; + return this; + } + + /** + * The number of results returned in this page. + * + * @return count + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getCount() { + return count; + } + + public void setCount(Long count) { + this.count = count; + } + + public ListScorecardScoresMeta limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * The page limit. + * + * @return limit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLimit() { + return limit; + } + + public void setLimit(Long limit) { + this.limit = limit; + } + + public ListScorecardScoresMeta offset(Long offset) { + this.offset = offset; + return this; + } + + /** + * The page offset. + * + * @return offset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getOffset() { + return offset; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public ListScorecardScoresMeta total(Long total) { + this.total = total; + return this; + } + + /** + * The total number of results. + * + * @return total + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + /** + * 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 ListScorecardScoresMeta + */ + @JsonAnySetter + public ListScorecardScoresMeta 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 ListScorecardScoresMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListScorecardScoresMeta listScorecardScoresMeta = (ListScorecardScoresMeta) o; + return Objects.equals(this.count, listScorecardScoresMeta.count) + && Objects.equals(this.limit, listScorecardScoresMeta.limit) + && Objects.equals(this.offset, listScorecardScoresMeta.offset) + && Objects.equals(this.total, listScorecardScoresMeta.total) + && Objects.equals(this.additionalProperties, listScorecardScoresMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(count, limit, offset, total, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListScorecardScoresMeta {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).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/ListScorecardScoresResponse.java b/src/main/java/com/datadog/api/client/v2/model/ListScorecardScoresResponse.java new file mode 100644 index 00000000000..535159bb20a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListScorecardScoresResponse.java @@ -0,0 +1,208 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A list of scorecard scores for a given aggregation type. */ +@JsonPropertyOrder({ + ListScorecardScoresResponse.JSON_PROPERTY_DATA, + ListScorecardScoresResponse.JSON_PROPERTY_LINKS, + ListScorecardScoresResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListScorecardScoresResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public static final String JSON_PROPERTY_LINKS = "links"; + private ListRulesResponseLinks links; + + public static final String JSON_PROPERTY_META = "meta"; + private ListScorecardScoresMeta meta; + + public ListScorecardScoresResponse data(List data) { + this.data = data; + for (ScorecardScoreData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ListScorecardScoresResponse addDataItem(ScorecardScoreData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of score objects. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public ListScorecardScoresResponse links(ListRulesResponseLinks links) { + this.links = links; + this.unparsed |= links.unparsed; + return this; + } + + /** + * Links attributes. + * + * @return links + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ListRulesResponseLinks getLinks() { + return links; + } + + public void setLinks(ListRulesResponseLinks links) { + this.links = links; + } + + public ListScorecardScoresResponse meta(ListScorecardScoresMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Pagination metadata for scores. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ListScorecardScoresMeta getMeta() { + return meta; + } + + public void setMeta(ListScorecardScoresMeta meta) { + this.meta = meta; + } + + /** + * 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 ListScorecardScoresResponse + */ + @JsonAnySetter + public ListScorecardScoresResponse 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 ListScorecardScoresResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListScorecardScoresResponse listScorecardScoresResponse = (ListScorecardScoresResponse) o; + return Objects.equals(this.data, listScorecardScoresResponse.data) + && Objects.equals(this.links, listScorecardScoresResponse.links) + && Objects.equals(this.meta, listScorecardScoresResponse.meta) + && Objects.equals( + this.additionalProperties, listScorecardScoresResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, links, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListScorecardScoresResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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/ScorecardScoreAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreAttributes.java new file mode 100644 index 00000000000..2723e3f6718 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreAttributes.java @@ -0,0 +1,395 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of a scorecard score. */ +@JsonPropertyOrder({ + ScorecardScoreAttributes.JSON_PROPERTY_AGGREGATION, + ScorecardScoreAttributes.JSON_PROPERTY_DENOMINATOR, + ScorecardScoreAttributes.JSON_PROPERTY_LEVEL, + ScorecardScoreAttributes.JSON_PROPERTY_NUMERATOR, + ScorecardScoreAttributes.JSON_PROPERTY_SCORE, + ScorecardScoreAttributes.JSON_PROPERTY_TOTAL_ENTITIES, + ScorecardScoreAttributes.JSON_PROPERTY_TOTAL_FAIL, + ScorecardScoreAttributes.JSON_PROPERTY_TOTAL_NO_DATA, + ScorecardScoreAttributes.JSON_PROPERTY_TOTAL_PASS, + ScorecardScoreAttributes.JSON_PROPERTY_TOTAL_SKIP +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ScorecardScoreAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AGGREGATION = "aggregation"; + private ScorecardScoresAggregation aggregation; + + public static final String JSON_PROPERTY_DENOMINATOR = "denominator"; + private Long denominator; + + public static final String JSON_PROPERTY_LEVEL = "level"; + private Long level; + + public static final String JSON_PROPERTY_NUMERATOR = "numerator"; + private Long numerator; + + public static final String JSON_PROPERTY_SCORE = "score"; + private Double score; + + public static final String JSON_PROPERTY_TOTAL_ENTITIES = "total_entities"; + private Long totalEntities; + + public static final String JSON_PROPERTY_TOTAL_FAIL = "total_fail"; + private Long totalFail; + + public static final String JSON_PROPERTY_TOTAL_NO_DATA = "total_no_data"; + private Long totalNoData; + + public static final String JSON_PROPERTY_TOTAL_PASS = "total_pass"; + private Long totalPass; + + public static final String JSON_PROPERTY_TOTAL_SKIP = "total_skip"; + private Long totalSkip; + + public ScorecardScoreAttributes aggregation(ScorecardScoresAggregation aggregation) { + this.aggregation = aggregation; + this.unparsed |= !aggregation.isValid(); + return this; + } + + /** + * Dimension to group scores by. + * + * @return aggregation + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AGGREGATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ScorecardScoresAggregation getAggregation() { + return aggregation; + } + + public void setAggregation(ScorecardScoresAggregation aggregation) { + if (!aggregation.isValid()) { + this.unparsed = true; + } + this.aggregation = aggregation; + } + + public ScorecardScoreAttributes denominator(Long denominator) { + this.denominator = denominator; + return this; + } + + /** + * The denominator used to compute the score ratio. + * + * @return denominator + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DENOMINATOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getDenominator() { + return denominator; + } + + public void setDenominator(Long denominator) { + this.denominator = denominator; + } + + public ScorecardScoreAttributes level(Long level) { + this.level = level; + return this; + } + + /** + * The maturity level of the associated rule. + * + * @return level + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLevel() { + return level; + } + + public void setLevel(Long level) { + this.level = level; + } + + public ScorecardScoreAttributes numerator(Long numerator) { + this.numerator = numerator; + return this; + } + + /** + * The numerator used to compute the score ratio. + * + * @return numerator + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NUMERATOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getNumerator() { + return numerator; + } + + public void setNumerator(Long numerator) { + this.numerator = numerator; + } + + public ScorecardScoreAttributes score(Double score) { + this.score = score; + return this; + } + + /** + * The computed score ratio (numerator/denominator), from 0 to 1. + * + * @return score + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCORE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getScore() { + return score; + } + + public void setScore(Double score) { + this.score = score; + } + + public ScorecardScoreAttributes totalEntities(Long totalEntities) { + this.totalEntities = totalEntities; + return this; + } + + /** + * The total number of entities evaluated. + * + * @return totalEntities + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_ENTITIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalEntities() { + return totalEntities; + } + + public void setTotalEntities(Long totalEntities) { + this.totalEntities = totalEntities; + } + + public ScorecardScoreAttributes totalFail(Long totalFail) { + this.totalFail = totalFail; + return this; + } + + /** + * The number of rules that failed. + * + * @return totalFail + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_FAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalFail() { + return totalFail; + } + + public void setTotalFail(Long totalFail) { + this.totalFail = totalFail; + } + + public ScorecardScoreAttributes totalNoData(Long totalNoData) { + this.totalNoData = totalNoData; + return this; + } + + /** + * The number of rules with no data. + * + * @return totalNoData + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_NO_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalNoData() { + return totalNoData; + } + + public void setTotalNoData(Long totalNoData) { + this.totalNoData = totalNoData; + } + + public ScorecardScoreAttributes totalPass(Long totalPass) { + this.totalPass = totalPass; + return this; + } + + /** + * The number of rules that passed. + * + * @return totalPass + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_PASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalPass() { + return totalPass; + } + + public void setTotalPass(Long totalPass) { + this.totalPass = totalPass; + } + + public ScorecardScoreAttributes totalSkip(Long totalSkip) { + this.totalSkip = totalSkip; + return this; + } + + /** + * The number of rules that were skipped. + * + * @return totalSkip + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_SKIP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalSkip() { + return totalSkip; + } + + public void setTotalSkip(Long totalSkip) { + this.totalSkip = totalSkip; + } + + /** + * 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 ScorecardScoreAttributes + */ + @JsonAnySetter + public ScorecardScoreAttributes 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 ScorecardScoreAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScorecardScoreAttributes scorecardScoreAttributes = (ScorecardScoreAttributes) o; + return Objects.equals(this.aggregation, scorecardScoreAttributes.aggregation) + && Objects.equals(this.denominator, scorecardScoreAttributes.denominator) + && Objects.equals(this.level, scorecardScoreAttributes.level) + && Objects.equals(this.numerator, scorecardScoreAttributes.numerator) + && Objects.equals(this.score, scorecardScoreAttributes.score) + && Objects.equals(this.totalEntities, scorecardScoreAttributes.totalEntities) + && Objects.equals(this.totalFail, scorecardScoreAttributes.totalFail) + && Objects.equals(this.totalNoData, scorecardScoreAttributes.totalNoData) + && Objects.equals(this.totalPass, scorecardScoreAttributes.totalPass) + && Objects.equals(this.totalSkip, scorecardScoreAttributes.totalSkip) + && Objects.equals(this.additionalProperties, scorecardScoreAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + aggregation, + denominator, + level, + numerator, + score, + totalEntities, + totalFail, + totalNoData, + totalPass, + totalSkip, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScorecardScoreAttributes {\n"); + sb.append(" aggregation: ").append(toIndentedString(aggregation)).append("\n"); + sb.append(" denominator: ").append(toIndentedString(denominator)).append("\n"); + sb.append(" level: ").append(toIndentedString(level)).append("\n"); + sb.append(" numerator: ").append(toIndentedString(numerator)).append("\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append(" totalEntities: ").append(toIndentedString(totalEntities)).append("\n"); + sb.append(" totalFail: ").append(toIndentedString(totalFail)).append("\n"); + sb.append(" totalNoData: ").append(toIndentedString(totalNoData)).append("\n"); + sb.append(" totalPass: ").append(toIndentedString(totalPass)).append("\n"); + sb.append(" totalSkip: ").append(toIndentedString(totalSkip)).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/ScorecardScoreData.java b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreData.java new file mode 100644 index 00000000000..d818e9ab08f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreData.java @@ -0,0 +1,234 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A scorecard score object for a single entity, rule, scorecard, service, or team. */ +@JsonPropertyOrder({ + ScorecardScoreData.JSON_PROPERTY_ATTRIBUTES, + ScorecardScoreData.JSON_PROPERTY_ID, + ScorecardScoreData.JSON_PROPERTY_RELATIONSHIPS, + ScorecardScoreData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ScorecardScoreData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ScorecardScoreAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private ScorecardScoreRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ScorecardScoreDataType type = ScorecardScoreDataType.SCORE; + + public ScorecardScoreData() {} + + @JsonCreator + public ScorecardScoreData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ScorecardScoreDataType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ScorecardScoreData attributes(ScorecardScoreAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a scorecard score. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ScorecardScoreAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ScorecardScoreAttributes attributes) { + this.attributes = attributes; + } + + public ScorecardScoreData id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the entity or resource being scored. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ScorecardScoreData relationships(ScorecardScoreRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Relationships for a scorecard score, depending on the aggregation type. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ScorecardScoreRelationships getRelationships() { + return relationships; + } + + public void setRelationships(ScorecardScoreRelationships relationships) { + this.relationships = relationships; + } + + public ScorecardScoreData type(ScorecardScoreDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ScorecardScoreDataType getType() { + return type; + } + + public void setType(ScorecardScoreDataType 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 ScorecardScoreData + */ + @JsonAnySetter + public ScorecardScoreData 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 ScorecardScoreData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScorecardScoreData scorecardScoreData = (ScorecardScoreData) o; + return Objects.equals(this.attributes, scorecardScoreData.attributes) + && Objects.equals(this.id, scorecardScoreData.id) + && Objects.equals(this.relationships, scorecardScoreData.relationships) + && Objects.equals(this.type, scorecardScoreData.type) + && Objects.equals(this.additionalProperties, scorecardScoreData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScorecardScoreData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).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/ScorecardScoreDataType.java b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreDataType.java new file mode 100644 index 00000000000..d426e2c8ecd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreDataType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The JSON:API resource type. */ +@JsonSerialize(using = ScorecardScoreDataType.ScorecardScoreDataTypeSerializer.class) +public class ScorecardScoreDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("score")); + + public static final ScorecardScoreDataType SCORE = new ScorecardScoreDataType("score"); + + ScorecardScoreDataType(String value) { + super(value, allowedValues); + } + + public static class ScorecardScoreDataTypeSerializer + extends StdSerializer { + public ScorecardScoreDataTypeSerializer(Class t) { + super(t); + } + + public ScorecardScoreDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ScorecardScoreDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ScorecardScoreDataType fromValue(String value) { + return new ScorecardScoreDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreRelationshipData.java b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreRelationshipData.java new file mode 100644 index 00000000000..b2fecd1d71c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreRelationshipData.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; + +/** A relationship data object for a score. */ +@JsonPropertyOrder({ + ScorecardScoreRelationshipData.JSON_PROPERTY_ID, + ScorecardScoreRelationshipData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ScorecardScoreRelationshipData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public ScorecardScoreRelationshipData() {} + + @JsonCreator + public ScorecardScoreRelationshipData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.id = id; + this.type = type; + } + + public ScorecardScoreRelationshipData id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the related resource. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ScorecardScoreRelationshipData type(String type) { + this.type = type; + return this; + } + + /** + * The type of the related resource. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ScorecardScoreRelationshipData + */ + @JsonAnySetter + public ScorecardScoreRelationshipData 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 ScorecardScoreRelationshipData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScorecardScoreRelationshipData scorecardScoreRelationshipData = + (ScorecardScoreRelationshipData) o; + return Objects.equals(this.id, scorecardScoreRelationshipData.id) + && Objects.equals(this.type, scorecardScoreRelationshipData.type) + && Objects.equals( + this.additionalProperties, scorecardScoreRelationshipData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScorecardScoreRelationshipData {\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/ScorecardScoreRelationshipItem.java b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreRelationshipItem.java new file mode 100644 index 00000000000..bd534465e8a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreRelationshipItem.java @@ -0,0 +1,138 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A relationship item for a score. */ +@JsonPropertyOrder({ScorecardScoreRelationshipItem.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ScorecardScoreRelationshipItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ScorecardScoreRelationshipData data; + + public ScorecardScoreRelationshipItem data(ScorecardScoreRelationshipData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A relationship data object for a score. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ScorecardScoreRelationshipData getData() { + return data; + } + + public void setData(ScorecardScoreRelationshipData 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 ScorecardScoreRelationshipItem + */ + @JsonAnySetter + public ScorecardScoreRelationshipItem 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 ScorecardScoreRelationshipItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScorecardScoreRelationshipItem scorecardScoreRelationshipItem = + (ScorecardScoreRelationshipItem) o; + return Objects.equals(this.data, scorecardScoreRelationshipItem.data) + && Objects.equals( + this.additionalProperties, scorecardScoreRelationshipItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScorecardScoreRelationshipItem {\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/ScorecardScoreRelationships.java b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreRelationships.java new file mode 100644 index 00000000000..297d1a79074 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoreRelationships.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; + +/** Relationships for a scorecard score, depending on the aggregation type. */ +@JsonPropertyOrder({ + ScorecardScoreRelationships.JSON_PROPERTY_ENTITY, + ScorecardScoreRelationships.JSON_PROPERTY_RULE, + ScorecardScoreRelationships.JSON_PROPERTY_SCORECARD, + ScorecardScoreRelationships.JSON_PROPERTY_SERVICE, + ScorecardScoreRelationships.JSON_PROPERTY_TEAM +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ScorecardScoreRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENTITY = "entity"; + private ScorecardScoreRelationshipItem entity; + + public static final String JSON_PROPERTY_RULE = "rule"; + private ScorecardScoreRelationshipItem rule; + + public static final String JSON_PROPERTY_SCORECARD = "scorecard"; + private ScorecardScoreRelationshipItem scorecard; + + public static final String JSON_PROPERTY_SERVICE = "service"; + private ScorecardScoreRelationshipItem service; + + public static final String JSON_PROPERTY_TEAM = "team"; + private ScorecardScoreRelationshipItem team; + + public ScorecardScoreRelationships entity(ScorecardScoreRelationshipItem entity) { + this.entity = entity; + this.unparsed |= entity.unparsed; + return this; + } + + /** + * A relationship item for a score. + * + * @return entity + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ScorecardScoreRelationshipItem getEntity() { + return entity; + } + + public void setEntity(ScorecardScoreRelationshipItem entity) { + this.entity = entity; + } + + public ScorecardScoreRelationships rule(ScorecardScoreRelationshipItem rule) { + this.rule = rule; + this.unparsed |= rule.unparsed; + return this; + } + + /** + * A relationship item for a score. + * + * @return rule + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RULE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ScorecardScoreRelationshipItem getRule() { + return rule; + } + + public void setRule(ScorecardScoreRelationshipItem rule) { + this.rule = rule; + } + + public ScorecardScoreRelationships scorecard(ScorecardScoreRelationshipItem scorecard) { + this.scorecard = scorecard; + this.unparsed |= scorecard.unparsed; + return this; + } + + /** + * A relationship item for a score. + * + * @return scorecard + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCORECARD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ScorecardScoreRelationshipItem getScorecard() { + return scorecard; + } + + public void setScorecard(ScorecardScoreRelationshipItem scorecard) { + this.scorecard = scorecard; + } + + public ScorecardScoreRelationships service(ScorecardScoreRelationshipItem service) { + this.service = service; + this.unparsed |= service.unparsed; + return this; + } + + /** + * A relationship item for a score. + * + * @return service + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SERVICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ScorecardScoreRelationshipItem getService() { + return service; + } + + public void setService(ScorecardScoreRelationshipItem service) { + this.service = service; + } + + public ScorecardScoreRelationships team(ScorecardScoreRelationshipItem team) { + this.team = team; + this.unparsed |= team.unparsed; + return this; + } + + /** + * A relationship item for a score. + * + * @return team + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEAM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ScorecardScoreRelationshipItem getTeam() { + return team; + } + + public void setTeam(ScorecardScoreRelationshipItem team) { + this.team = team; + } + + /** + * 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 ScorecardScoreRelationships + */ + @JsonAnySetter + public ScorecardScoreRelationships 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 ScorecardScoreRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScorecardScoreRelationships scorecardScoreRelationships = (ScorecardScoreRelationships) o; + return Objects.equals(this.entity, scorecardScoreRelationships.entity) + && Objects.equals(this.rule, scorecardScoreRelationships.rule) + && Objects.equals(this.scorecard, scorecardScoreRelationships.scorecard) + && Objects.equals(this.service, scorecardScoreRelationships.service) + && Objects.equals(this.team, scorecardScoreRelationships.team) + && Objects.equals( + this.additionalProperties, scorecardScoreRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(entity, rule, scorecard, service, team, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScorecardScoreRelationships {\n"); + sb.append(" entity: ").append(toIndentedString(entity)).append("\n"); + sb.append(" rule: ").append(toIndentedString(rule)).append("\n"); + sb.append(" scorecard: ").append(toIndentedString(scorecard)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" team: ").append(toIndentedString(team)).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/ScorecardScoresAggregation.java b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoresAggregation.java new file mode 100644 index 00000000000..432fe23d250 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ScorecardScoresAggregation.java @@ -0,0 +1,66 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +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; + +/** Dimension to group scores by. */ +@JsonSerialize(using = ScorecardScoresAggregation.ScorecardScoresAggregationSerializer.class) +public class ScorecardScoresAggregation extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("by-entity", "by-rule", "by-scorecard", "by-team", "by-kind")); + + public static final ScorecardScoresAggregation BY_ENTITY = + new ScorecardScoresAggregation("by-entity"); + public static final ScorecardScoresAggregation BY_RULE = + new ScorecardScoresAggregation("by-rule"); + public static final ScorecardScoresAggregation BY_SCORECARD = + new ScorecardScoresAggregation("by-scorecard"); + public static final ScorecardScoresAggregation BY_TEAM = + new ScorecardScoresAggregation("by-team"); + public static final ScorecardScoresAggregation BY_KIND = + new ScorecardScoresAggregation("by-kind"); + + ScorecardScoresAggregation(String value) { + super(value, allowedValues); + } + + public static class ScorecardScoresAggregationSerializer + extends StdSerializer { + public ScorecardScoresAggregationSerializer(Class t) { + super(t); + } + + public ScorecardScoresAggregationSerializer() { + this(null); + } + + @Override + public void serialize( + ScorecardScoresAggregation value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ScorecardScoresAggregation fromValue(String value) { + return new ScorecardScoresAggregation(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/scorecards.feature b/src/test/resources/com/datadog/api/client/v2/api/scorecards.feature index 750948d8991..e932599c677 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/scorecards.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/scorecards.feature @@ -183,6 +183,20 @@ Feature: Scorecards When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/service-catalog + Scenario: List all scores returns "Bad Request" response + Given new "ListScorecardScores" request + And request contains "aggregation" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/service-catalog + Scenario: List all scores returns "OK" response + Given new "ListScorecardScores" request + And request contains "aggregation" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @team:DataDog/service-catalog Scenario: Update Scorecard outcomes asynchronously returns "Accepted" response Given there is a valid "create_scorecard_rule" in the system 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 049acf0531b..998d5322abb 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 @@ -5276,6 +5276,12 @@ "type": "safe" } }, + "ListScorecardScores": { + "tag": "Scorecards", + "undo": { + "type": "safe" + } + }, "UnassignSeatsUser": { "tag": "Seats", "undo": {