From 72d44e387998762c51617fdf6ad23e8bf8df617e Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 12 May 2026 20:31:22 +0000 Subject: [PATCH] Regenerate client from commit e88d486 of spec repo --- .generator/schemas/v2/openapi.yaml | 418 +++++++++++ .../cloud-cost-management/GetCostTagKey.java | 24 + .../ListCostTagKeys.java | 24 + .../cloud-cost-management/ListCostTags.java | 24 + .../client/v2/api/CloudCostManagementApi.java | 655 ++++++++++++++++++ .../datadog/api/client/v2/model/CostTag.java | 208 ++++++ .../client/v2/model/CostTagAttributes.java | 177 +++++ .../api/client/v2/model/CostTagKey.java | 209 ++++++ .../client/v2/model/CostTagKeyAttributes.java | 209 ++++++ .../client/v2/model/CostTagKeyDetails.java | 183 +++++ .../client/v2/model/CostTagKeyResponse.java | 145 ++++ .../api/client/v2/model/CostTagKeyType.java | 54 ++ .../client/v2/model/CostTagKeysResponse.java | 154 ++++ .../api/client/v2/model/CostTagType.java | 53 ++ .../api/client/v2/model/CostTagsResponse.java | 154 ++++ .../v2/api/cloud_cost_management.feature | 45 ++ .../com/datadog/api/client/v2/api/undo.json | 18 + 17 files changed, 2754 insertions(+) create mode 100644 examples/v2/cloud-cost-management/GetCostTagKey.java create mode 100644 examples/v2/cloud-cost-management/ListCostTagKeys.java create mode 100644 examples/v2/cloud-cost-management/ListCostTags.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostTag.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostTagAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostTagKey.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostTagKeyAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostTagKeyDetails.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostTagKeyResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostTagKeyType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostTagKeysResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostTagType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostTagsResponse.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5b0100ae0ea..3346060e64c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1461,6 +1461,13 @@ components: required: true schema: type: string + TagKey: + description: The Cloud Cost Management tag key. Tag keys can contain forward slashes (for example, `kubernetes/instance`). + in: path + name: tag_key + required: true + schema: + type: string ToTimestamp: description: The ending timestamp for the SLO status query in epoch seconds. in: query @@ -15600,6 +15607,41 @@ components: type: string x-enum-varnames: - COST_BY_ORG + CostTag: + description: A Cloud Cost Management tag. + properties: + attributes: + $ref: "#/components/schemas/CostTagAttributes" + id: + description: The tag identifier, equal to its `key:value` representation. + example: providername:aws + type: string + type: + $ref: "#/components/schemas/CostTagType" + required: + - attributes + - id + - type + type: object + CostTagAttributes: + description: Attributes of a Cloud Cost Management tag. + properties: + sources: + description: List of sources that define this tag. + example: + - focus + items: + description: A tag source. + type: string + type: array + value: + description: The tag value in `key:value` format. + example: providername:aws + type: string + required: + - sources + - value + type: object CostTagDescription: description: A Cloud Cost Management tag key description, either cross-cloud or scoped to a single cloud provider. properties: @@ -15692,6 +15734,153 @@ components: required: - data type: object + CostTagKey: + description: A Cloud Cost Management tag key. + properties: + attributes: + $ref: "#/components/schemas/CostTagKeyAttributes" + id: + description: The tag key identifier. + example: providername + type: string + type: + $ref: "#/components/schemas/CostTagKeyType" + required: + - attributes + - id + - type + type: object + CostTagKeyAttributes: + description: Attributes of a Cloud Cost Management tag key. + properties: + details: + $ref: "#/components/schemas/CostTagKeyDetails" + sources: + description: List of sources that define this tag key. + example: + - focus + items: + description: A tag key source. + type: string + type: array + value: + description: The tag key name. + example: providername + type: string + required: + - sources + - value + type: object + CostTagKeyDetails: + description: Additional details for a Cloud Cost Management tag key, including its description and example tag values. + properties: + description: + description: Description of the tag key. + example: The cloud provider name reported for the cost line item. + type: string + tag_values: + description: Example tag values observed for this tag key. + example: + - aws + - gcp + - azure + items: + description: A tag value observed for this tag key. + type: string + type: array + required: + - description + - tag_values + type: object + CostTagKeyResponse: + description: A single Cloud Cost Management tag key. + example: + data: + attributes: + details: + description: The cloud provider name reported for the cost line item. + tag_values: + - aws + - gcp + - azure + sources: + - focus + value: providername + id: providername + type: cost_tag_key + properties: + data: + $ref: "#/components/schemas/CostTagKey" + required: + - data + type: object + CostTagKeyType: + default: cost_tag_key + description: Type of the Cloud Cost Management tag key resource. + enum: + - cost_tag_key + example: cost_tag_key + type: string + x-enum-varnames: + - COST_TAG_KEY + CostTagKeysResponse: + description: A list of Cloud Cost Management tag keys. + example: + data: + - attributes: + sources: + - focus + value: providername + id: providername + type: cost_tag_key + - attributes: + sources: [] + value: service + id: service + type: cost_tag_key + properties: + data: + description: The list of Cloud Cost Management tag keys. + items: + $ref: "#/components/schemas/CostTagKey" + type: array + required: + - data + type: object + CostTagType: + default: cost_tag + description: Type of the Cloud Cost Management tag resource. + enum: + - cost_tag + example: cost_tag + type: string + x-enum-varnames: + - COST_TAG + CostTagsResponse: + description: A list of Cloud Cost Management tags. + example: + data: + - attributes: + sources: + - focus + value: providername:aws + id: providername:aws + type: cost_tag + - attributes: + sources: + - focus + value: providername:gcp + id: providername:gcp + type: cost_tag + properties: + data: + description: The list of Cloud Cost Management tags. + items: + $ref: "#/components/schemas/CostTag" + type: array + required: + - data + type: object CoverageSummaryAttributes: description: Attributes object for code coverage summary response. properties: @@ -97149,6 +97338,235 @@ paths: operator: OR permissions: - cloud_cost_management_read + /api/v2/cost/tag_keys: + get: + description: List Cloud Cost Management tag keys. + operationId: ListCostTagKeys + parameters: + - description: The Cloud Cost Management metric to scope the tag keys to. When omitted, returns tag keys across all metrics. + in: query + name: filter[metric] + schema: + type: string + - description: |- + Filter to return only tag keys that appear with the given `key:value` tag values. For example, `filter[tags]=providername:aws` returns tag keys found on the same cost data, such as `is_aws_ec2_compute` and `aws_instance_type`. + in: query + name: filter[tags] + schema: + items: + type: string + type: array + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + sources: + - focus + value: providername + id: providername + type: cost_tag_key + - attributes: + sources: [] + value: service + id: service + type: cost_tag_key + schema: + $ref: "#/components/schemas/CostTagKeysResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: List Cloud Cost Management tag keys + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + /api/v2/cost/tag_keys/{tag_key}: + get: + description: Get details for a specific Cloud Cost Management tag key, including example tag values and description. + operationId: GetCostTagKey + parameters: + - $ref: "#/components/parameters/TagKey" + - description: The Cloud Cost Management metric to scope the tag key details to. When omitted, returns details across all metrics. + in: query + name: filter[metric] + schema: + type: string + - description: |- + Controls the size of the internal tag value search scope. This does **not** restrict the number of example tag values returned in the response. Defaults to 50, maximum 10000. + in: query + name: page[size] + schema: + default: 50 + format: int32 + maximum: 10000 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + details: + description: The cloud provider name reported for the cost line item. + tag_values: + - aws + - gcp + - azure + sources: + - focus + value: providername + id: providername + type: cost_tag_key + schema: + $ref: "#/components/schemas/CostTagKeyResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: Get a Cloud Cost Management tag key + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + /api/v2/cost/tags: + get: + description: List Cloud Cost Management tags for a given metric. + operationId: ListCostTags + parameters: + - description: The Cloud Cost Management metric to scope the tags to. When omitted, returns tags across all metrics. + in: query + name: filter[metric] + schema: + type: string + - description: A substring used to filter the returned tags by name. + in: query + name: filter[match] + schema: + type: string + - description: |- + Filter to return only tags that appear with the given `key:value` tag values. For example, `filter[tags]=providername:aws` returns tags found on the same cost data, such as `aws_instance_type:t3.micro` and `aws_instance_type:m5.large`. + in: query + name: filter[tags] + schema: + items: + type: string + type: array + - description: Restrict the returned tags to those whose key matches one of the given tag keys. + in: query + name: filter[tag_keys] + schema: + items: + type: string + type: array + - description: |- + Controls the size of the internal tag search scope. This does **not** restrict the number of tags returned in the response. Defaults to 50, maximum 10000. + in: query + name: page[size] + schema: + default: 50 + format: int32 + maximum: 10000 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + sources: + - focus + value: providername:aws + id: providername:aws + type: cost_tag + - attributes: + sources: + - focus + value: providername:gcp + id: providername:gcp + type: cost_tag + schema: + $ref: "#/components/schemas/CostTagsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: List Cloud Cost Management tags + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read /api/v2/cost_by_tag/active_billing_dimensions: get: description: |- diff --git a/examples/v2/cloud-cost-management/GetCostTagKey.java b/examples/v2/cloud-cost-management/GetCostTagKey.java new file mode 100644 index 00000000000..6d222600003 --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCostTagKey.java @@ -0,0 +1,24 @@ +// Get a Cloud Cost Management tag key returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.CostTagKeyResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + CostTagKeyResponse result = apiInstance.getCostTagKey("tag_key"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#getCostTagKey"); + 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/cloud-cost-management/ListCostTagKeys.java b/examples/v2/cloud-cost-management/ListCostTagKeys.java new file mode 100644 index 00000000000..fabb9748e96 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostTagKeys.java @@ -0,0 +1,24 @@ +// List Cloud Cost Management tag keys returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.CostTagKeysResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + CostTagKeysResponse result = apiInstance.listCostTagKeys(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#listCostTagKeys"); + 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/cloud-cost-management/ListCostTags.java b/examples/v2/cloud-cost-management/ListCostTags.java new file mode 100644 index 00000000000..608af276fc2 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostTags.java @@ -0,0 +1,24 @@ +// List Cloud Cost Management tags returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.CostTagsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + CostTagsResponse result = apiInstance.listCostTags(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#listCostTags"); + 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/CloudCostManagementApi.java b/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java index 7634320e2fe..0b28f09aef3 100644 --- a/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java @@ -21,6 +21,9 @@ import com.datadog.api.client.v2.model.BudgetValidationResponse; import com.datadog.api.client.v2.model.BudgetWithEntries; import com.datadog.api.client.v2.model.CostTagDescriptionsResponse; +import com.datadog.api.client.v2.model.CostTagKeyResponse; +import com.datadog.api.client.v2.model.CostTagKeysResponse; +import com.datadog.api.client.v2.model.CostTagsResponse; import com.datadog.api.client.v2.model.CreateRulesetRequest; import com.datadog.api.client.v2.model.CustomCostsFileGetResponse; import com.datadog.api.client.v2.model.CustomCostsFileLineItem; @@ -2259,6 +2262,227 @@ public ApiResponse getCostGCPUsageCostConfigWithHttpInfo(Lo new GenericType() {}); } + /** Manage optional parameters to getCostTagKey. */ + public static class GetCostTagKeyOptionalParameters { + private String filterMetric; + private Integer pageSize; + + /** + * Set filterMetric. + * + * @param filterMetric The Cloud Cost Management metric to scope the tag key details to. When + * omitted, returns details across all metrics. (optional) + * @return GetCostTagKeyOptionalParameters + */ + public GetCostTagKeyOptionalParameters filterMetric(String filterMetric) { + this.filterMetric = filterMetric; + return this; + } + + /** + * Set pageSize. + * + * @param pageSize Controls the size of the internal tag value search scope. This does + * not restrict the number of example tag values returned in the response. + * Defaults to 50, maximum 10000. (optional, default to 50) + * @return GetCostTagKeyOptionalParameters + */ + public GetCostTagKeyOptionalParameters pageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + } + + /** + * Get a Cloud Cost Management tag key. + * + *

See {@link #getCostTagKeyWithHttpInfo}. + * + * @param tagKey The Cloud Cost Management tag key. Tag keys can contain forward slashes (for + * example, kubernetes/instance). (required) + * @return CostTagKeyResponse + * @throws ApiException if fails to make API call + */ + public CostTagKeyResponse getCostTagKey(String tagKey) throws ApiException { + return getCostTagKeyWithHttpInfo(tagKey, new GetCostTagKeyOptionalParameters()).getData(); + } + + /** + * Get a Cloud Cost Management tag key. + * + *

See {@link #getCostTagKeyWithHttpInfoAsync}. + * + * @param tagKey The Cloud Cost Management tag key. Tag keys can contain forward slashes (for + * example, kubernetes/instance). (required) + * @return CompletableFuture<CostTagKeyResponse> + */ + public CompletableFuture getCostTagKeyAsync(String tagKey) { + return getCostTagKeyWithHttpInfoAsync(tagKey, new GetCostTagKeyOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a Cloud Cost Management tag key. + * + *

See {@link #getCostTagKeyWithHttpInfo}. + * + * @param tagKey The Cloud Cost Management tag key. Tag keys can contain forward slashes (for + * example, kubernetes/instance). (required) + * @param parameters Optional parameters for the request. + * @return CostTagKeyResponse + * @throws ApiException if fails to make API call + */ + public CostTagKeyResponse getCostTagKey(String tagKey, GetCostTagKeyOptionalParameters parameters) + throws ApiException { + return getCostTagKeyWithHttpInfo(tagKey, parameters).getData(); + } + + /** + * Get a Cloud Cost Management tag key. + * + *

See {@link #getCostTagKeyWithHttpInfoAsync}. + * + * @param tagKey The Cloud Cost Management tag key. Tag keys can contain forward slashes (for + * example, kubernetes/instance). (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<CostTagKeyResponse> + */ + public CompletableFuture getCostTagKeyAsync( + String tagKey, GetCostTagKeyOptionalParameters parameters) { + return getCostTagKeyWithHttpInfoAsync(tagKey, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get details for a specific Cloud Cost Management tag key, including example tag values and + * description. + * + * @param tagKey The Cloud Cost Management tag key. Tag keys can contain forward slashes (for + * example, kubernetes/instance). (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<CostTagKeyResponse> + * @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 -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getCostTagKeyWithHttpInfo( + String tagKey, GetCostTagKeyOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'tagKey' is set + if (tagKey == null) { + throw new ApiException( + 400, "Missing the required parameter 'tagKey' when calling getCostTagKey"); + } + String filterMetric = parameters.filterMetric; + Integer pageSize = parameters.pageSize; + // create path and map variables + String localVarPath = + "/api/v2/cost/tag_keys/{tag_key}" + .replaceAll("\\{" + "tag_key" + "\\}", apiClient.escapeString(tagKey.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[metric]", filterMetric)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.getCostTagKey", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a Cloud Cost Management tag key. + * + *

See {@link #getCostTagKeyWithHttpInfo}. + * + * @param tagKey The Cloud Cost Management tag key. Tag keys can contain forward slashes (for + * example, kubernetes/instance). (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<CostTagKeyResponse>> + */ + public CompletableFuture> getCostTagKeyWithHttpInfoAsync( + String tagKey, GetCostTagKeyOptionalParameters parameters) { + Object localVarPostBody = null; + + // verify the required parameter 'tagKey' is set + if (tagKey == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'tagKey' when calling getCostTagKey")); + return result; + } + String filterMetric = parameters.filterMetric; + Integer pageSize = parameters.pageSize; + // create path and map variables + String localVarPath = + "/api/v2/cost/tag_keys/{tag_key}" + .replaceAll("\\{" + "tag_key" + "\\}", apiClient.escapeString(tagKey.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[metric]", filterMetric)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.getCostTagKey", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Get custom allocation rule. * @@ -3386,6 +3610,437 @@ public ApiResponse listCostTagDescriptionsWithHttpI new GenericType() {}); } + /** Manage optional parameters to listCostTagKeys. */ + public static class ListCostTagKeysOptionalParameters { + private String filterMetric; + private List filterTags; + + /** + * Set filterMetric. + * + * @param filterMetric The Cloud Cost Management metric to scope the tag keys to. When omitted, + * returns tag keys across all metrics. (optional) + * @return ListCostTagKeysOptionalParameters + */ + public ListCostTagKeysOptionalParameters filterMetric(String filterMetric) { + this.filterMetric = filterMetric; + return this; + } + + /** + * Set filterTags. + * + * @param filterTags Filter to return only tag keys that appear with the given key:value + * tag values. For example, filter[tags]=providername:aws returns tag + * keys found on the same cost data, such as is_aws_ec2_compute and + * aws_instance_type. (optional) + * @return ListCostTagKeysOptionalParameters + */ + public ListCostTagKeysOptionalParameters filterTags(List filterTags) { + this.filterTags = filterTags; + return this; + } + } + + /** + * List Cloud Cost Management tag keys. + * + *

See {@link #listCostTagKeysWithHttpInfo}. + * + * @return CostTagKeysResponse + * @throws ApiException if fails to make API call + */ + public CostTagKeysResponse listCostTagKeys() throws ApiException { + return listCostTagKeysWithHttpInfo(new ListCostTagKeysOptionalParameters()).getData(); + } + + /** + * List Cloud Cost Management tag keys. + * + *

See {@link #listCostTagKeysWithHttpInfoAsync}. + * + * @return CompletableFuture<CostTagKeysResponse> + */ + public CompletableFuture listCostTagKeysAsync() { + return listCostTagKeysWithHttpInfoAsync(new ListCostTagKeysOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List Cloud Cost Management tag keys. + * + *

See {@link #listCostTagKeysWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CostTagKeysResponse + * @throws ApiException if fails to make API call + */ + public CostTagKeysResponse listCostTagKeys(ListCostTagKeysOptionalParameters parameters) + throws ApiException { + return listCostTagKeysWithHttpInfo(parameters).getData(); + } + + /** + * List Cloud Cost Management tag keys. + * + *

See {@link #listCostTagKeysWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<CostTagKeysResponse> + */ + public CompletableFuture listCostTagKeysAsync( + ListCostTagKeysOptionalParameters parameters) { + return listCostTagKeysWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List Cloud Cost Management tag keys. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<CostTagKeysResponse> + * @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 listCostTagKeysWithHttpInfo( + ListCostTagKeysOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + String filterMetric = parameters.filterMetric; + List filterTags = parameters.filterTags; + // create path and map variables + String localVarPath = "/api/v2/cost/tag_keys"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[metric]", filterMetric)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "filter[tags]", filterTags)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listCostTagKeys", + 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 Cloud Cost Management tag keys. + * + *

See {@link #listCostTagKeysWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<CostTagKeysResponse>> + */ + public CompletableFuture> listCostTagKeysWithHttpInfoAsync( + ListCostTagKeysOptionalParameters parameters) { + Object localVarPostBody = null; + String filterMetric = parameters.filterMetric; + List filterTags = parameters.filterTags; + // create path and map variables + String localVarPath = "/api/v2/cost/tag_keys"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[metric]", filterMetric)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "filter[tags]", filterTags)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listCostTagKeys", + 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() {}); + } + + /** Manage optional parameters to listCostTags. */ + public static class ListCostTagsOptionalParameters { + private String filterMetric; + private String filterMatch; + private List filterTags; + private List filterTagKeys; + private Integer pageSize; + + /** + * Set filterMetric. + * + * @param filterMetric The Cloud Cost Management metric to scope the tags to. When omitted, + * returns tags across all metrics. (optional) + * @return ListCostTagsOptionalParameters + */ + public ListCostTagsOptionalParameters filterMetric(String filterMetric) { + this.filterMetric = filterMetric; + return this; + } + + /** + * Set filterMatch. + * + * @param filterMatch A substring used to filter the returned tags by name. (optional) + * @return ListCostTagsOptionalParameters + */ + public ListCostTagsOptionalParameters filterMatch(String filterMatch) { + this.filterMatch = filterMatch; + return this; + } + + /** + * Set filterTags. + * + * @param filterTags Filter to return only tags that appear with the given key:value + * tag values. For example, filter[tags]=providername:aws returns tags + * found on the same cost data, such as aws_instance_type:t3.micro and + * aws_instance_type:m5.large. (optional) + * @return ListCostTagsOptionalParameters + */ + public ListCostTagsOptionalParameters filterTags(List filterTags) { + this.filterTags = filterTags; + return this; + } + + /** + * Set filterTagKeys. + * + * @param filterTagKeys Restrict the returned tags to those whose key matches one of the given + * tag keys. (optional) + * @return ListCostTagsOptionalParameters + */ + public ListCostTagsOptionalParameters filterTagKeys(List filterTagKeys) { + this.filterTagKeys = filterTagKeys; + return this; + } + + /** + * Set pageSize. + * + * @param pageSize Controls the size of the internal tag search scope. This does + * not restrict the number of tags returned in the response. Defaults to + * 50, maximum 10000. (optional, default to 50) + * @return ListCostTagsOptionalParameters + */ + public ListCostTagsOptionalParameters pageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + } + + /** + * List Cloud Cost Management tags. + * + *

See {@link #listCostTagsWithHttpInfo}. + * + * @return CostTagsResponse + * @throws ApiException if fails to make API call + */ + public CostTagsResponse listCostTags() throws ApiException { + return listCostTagsWithHttpInfo(new ListCostTagsOptionalParameters()).getData(); + } + + /** + * List Cloud Cost Management tags. + * + *

See {@link #listCostTagsWithHttpInfoAsync}. + * + * @return CompletableFuture<CostTagsResponse> + */ + public CompletableFuture listCostTagsAsync() { + return listCostTagsWithHttpInfoAsync(new ListCostTagsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List Cloud Cost Management tags. + * + *

See {@link #listCostTagsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CostTagsResponse + * @throws ApiException if fails to make API call + */ + public CostTagsResponse listCostTags(ListCostTagsOptionalParameters parameters) + throws ApiException { + return listCostTagsWithHttpInfo(parameters).getData(); + } + + /** + * List Cloud Cost Management tags. + * + *

See {@link #listCostTagsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<CostTagsResponse> + */ + public CompletableFuture listCostTagsAsync( + ListCostTagsOptionalParameters parameters) { + return listCostTagsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List Cloud Cost Management tags for a given metric. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<CostTagsResponse> + * @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 listCostTagsWithHttpInfo( + ListCostTagsOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + String filterMetric = parameters.filterMetric; + String filterMatch = parameters.filterMatch; + List filterTags = parameters.filterTags; + List filterTagKeys = parameters.filterTagKeys; + Integer pageSize = parameters.pageSize; + // create path and map variables + String localVarPath = "/api/v2/cost/tags"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[metric]", filterMetric)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[match]", filterMatch)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "filter[tags]", filterTags)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "filter[tag_keys]", filterTagKeys)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listCostTags", + 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 Cloud Cost Management tags. + * + *

See {@link #listCostTagsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<CostTagsResponse>> + */ + public CompletableFuture> listCostTagsWithHttpInfoAsync( + ListCostTagsOptionalParameters parameters) { + Object localVarPostBody = null; + String filterMetric = parameters.filterMetric; + String filterMatch = parameters.filterMatch; + List filterTags = parameters.filterTags; + List filterTagKeys = parameters.filterTagKeys; + Integer pageSize = parameters.pageSize; + // create path and map variables + String localVarPath = "/api/v2/cost/tags"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[metric]", filterMetric)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[match]", filterMatch)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "filter[tags]", filterTags)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "filter[tag_keys]", filterTagKeys)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listCostTags", + 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() {}); + } + /** * List custom allocation rules. * diff --git a/src/main/java/com/datadog/api/client/v2/model/CostTag.java b/src/main/java/com/datadog/api/client/v2/model/CostTag.java new file mode 100644 index 00000000000..e00cafefde7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostTag.java @@ -0,0 +1,208 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A Cloud Cost Management tag. */ +@JsonPropertyOrder({ + CostTag.JSON_PROPERTY_ATTRIBUTES, + CostTag.JSON_PROPERTY_ID, + CostTag.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostTag { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CostTagAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CostTagType type = CostTagType.COST_TAG; + + public CostTag() {} + + @JsonCreator + public CostTag( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) CostTagAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CostTagType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CostTag attributes(CostTagAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a Cloud Cost Management tag. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CostTagAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CostTagAttributes attributes) { + this.attributes = attributes; + } + + public CostTag id(String id) { + this.id = id; + return this; + } + + /** + * The tag identifier, equal to its key:value representation. + * + * @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 CostTag type(CostTagType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the Cloud Cost Management tag resource. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CostTagType getType() { + return type; + } + + public void setType(CostTagType 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 CostTag + */ + @JsonAnySetter + public CostTag 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 CostTag object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostTag costTag = (CostTag) o; + return Objects.equals(this.attributes, costTag.attributes) + && Objects.equals(this.id, costTag.id) + && Objects.equals(this.type, costTag.type) + && Objects.equals(this.additionalProperties, costTag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostTag {\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/CostTagAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CostTagAttributes.java new file mode 100644 index 00000000000..65ed67013fb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostTagAttributes.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of a Cloud Cost Management tag. */ +@JsonPropertyOrder({CostTagAttributes.JSON_PROPERTY_SOURCES, CostTagAttributes.JSON_PROPERTY_VALUE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostTagAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_SOURCES = "sources"; + private List sources = new ArrayList<>(); + + public static final String JSON_PROPERTY_VALUE = "value"; + private String value; + + public CostTagAttributes() {} + + @JsonCreator + public CostTagAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCES) List sources, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) String value) { + this.sources = sources; + this.value = value; + } + + public CostTagAttributes sources(List sources) { + this.sources = sources; + return this; + } + + public CostTagAttributes addSourcesItem(String sourcesItem) { + this.sources.add(sourcesItem); + return this; + } + + /** + * List of sources that define this tag. + * + * @return sources + */ + @JsonProperty(JSON_PROPERTY_SOURCES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getSources() { + return sources; + } + + public void setSources(List sources) { + this.sources = sources; + } + + public CostTagAttributes value(String value) { + this.value = value; + return this; + } + + /** + * The tag value in key:value format. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CostTagAttributes + */ + @JsonAnySetter + public CostTagAttributes 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 CostTagAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostTagAttributes costTagAttributes = (CostTagAttributes) o; + return Objects.equals(this.sources, costTagAttributes.sources) + && Objects.equals(this.value, costTagAttributes.value) + && Objects.equals(this.additionalProperties, costTagAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(sources, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostTagAttributes {\n"); + sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CostTagKey.java b/src/main/java/com/datadog/api/client/v2/model/CostTagKey.java new file mode 100644 index 00000000000..274cda87465 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostTagKey.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A Cloud Cost Management tag key. */ +@JsonPropertyOrder({ + CostTagKey.JSON_PROPERTY_ATTRIBUTES, + CostTagKey.JSON_PROPERTY_ID, + CostTagKey.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostTagKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CostTagKeyAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CostTagKeyType type = CostTagKeyType.COST_TAG_KEY; + + public CostTagKey() {} + + @JsonCreator + public CostTagKey( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CostTagKeyAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CostTagKeyType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CostTagKey attributes(CostTagKeyAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a Cloud Cost Management tag key. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CostTagKeyAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CostTagKeyAttributes attributes) { + this.attributes = attributes; + } + + public CostTagKey id(String id) { + this.id = id; + return this; + } + + /** + * The tag key identifier. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CostTagKey type(CostTagKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the Cloud Cost Management tag key resource. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CostTagKeyType getType() { + return type; + } + + public void setType(CostTagKeyType 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 CostTagKey + */ + @JsonAnySetter + public CostTagKey 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 CostTagKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostTagKey costTagKey = (CostTagKey) o; + return Objects.equals(this.attributes, costTagKey.attributes) + && Objects.equals(this.id, costTagKey.id) + && Objects.equals(this.type, costTagKey.type) + && Objects.equals(this.additionalProperties, costTagKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostTagKey {\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/CostTagKeyAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CostTagKeyAttributes.java new file mode 100644 index 00000000000..ac0eeb32446 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostTagKeyAttributes.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of a Cloud Cost Management tag key. */ +@JsonPropertyOrder({ + CostTagKeyAttributes.JSON_PROPERTY_DETAILS, + CostTagKeyAttributes.JSON_PROPERTY_SOURCES, + CostTagKeyAttributes.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostTagKeyAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DETAILS = "details"; + private CostTagKeyDetails details; + + public static final String JSON_PROPERTY_SOURCES = "sources"; + private List sources = new ArrayList<>(); + + public static final String JSON_PROPERTY_VALUE = "value"; + private String value; + + public CostTagKeyAttributes() {} + + @JsonCreator + public CostTagKeyAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCES) List sources, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) String value) { + this.sources = sources; + this.value = value; + } + + public CostTagKeyAttributes details(CostTagKeyDetails details) { + this.details = details; + this.unparsed |= details.unparsed; + return this; + } + + /** + * Additional details for a Cloud Cost Management tag key, including its description and example + * tag values. + * + * @return details + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DETAILS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CostTagKeyDetails getDetails() { + return details; + } + + public void setDetails(CostTagKeyDetails details) { + this.details = details; + } + + public CostTagKeyAttributes sources(List sources) { + this.sources = sources; + return this; + } + + public CostTagKeyAttributes addSourcesItem(String sourcesItem) { + this.sources.add(sourcesItem); + return this; + } + + /** + * List of sources that define this tag key. + * + * @return sources + */ + @JsonProperty(JSON_PROPERTY_SOURCES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getSources() { + return sources; + } + + public void setSources(List sources) { + this.sources = sources; + } + + public CostTagKeyAttributes value(String value) { + this.value = value; + return this; + } + + /** + * The tag key name. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CostTagKeyAttributes + */ + @JsonAnySetter + public CostTagKeyAttributes 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 CostTagKeyAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostTagKeyAttributes costTagKeyAttributes = (CostTagKeyAttributes) o; + return Objects.equals(this.details, costTagKeyAttributes.details) + && Objects.equals(this.sources, costTagKeyAttributes.sources) + && Objects.equals(this.value, costTagKeyAttributes.value) + && Objects.equals(this.additionalProperties, costTagKeyAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(details, sources, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostTagKeyAttributes {\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CostTagKeyDetails.java b/src/main/java/com/datadog/api/client/v2/model/CostTagKeyDetails.java new file mode 100644 index 00000000000..3d74c52f0aa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostTagKeyDetails.java @@ -0,0 +1,183 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * Additional details for a Cloud Cost Management tag key, including its description and example tag + * values. + */ +@JsonPropertyOrder({ + CostTagKeyDetails.JSON_PROPERTY_DESCRIPTION, + CostTagKeyDetails.JSON_PROPERTY_TAG_VALUES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostTagKeyDetails { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_TAG_VALUES = "tag_values"; + private List tagValues = new ArrayList<>(); + + public CostTagKeyDetails() {} + + @JsonCreator + public CostTagKeyDetails( + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_TAG_VALUES) List tagValues) { + this.description = description; + this.tagValues = tagValues; + } + + public CostTagKeyDetails description(String description) { + this.description = description; + return this; + } + + /** + * Description of the tag key. + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CostTagKeyDetails tagValues(List tagValues) { + this.tagValues = tagValues; + return this; + } + + public CostTagKeyDetails addTagValuesItem(String tagValuesItem) { + this.tagValues.add(tagValuesItem); + return this; + } + + /** + * Example tag values observed for this tag key. + * + * @return tagValues + */ + @JsonProperty(JSON_PROPERTY_TAG_VALUES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTagValues() { + return tagValues; + } + + public void setTagValues(List tagValues) { + this.tagValues = tagValues; + } + + /** + * 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 CostTagKeyDetails + */ + @JsonAnySetter + public CostTagKeyDetails 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 CostTagKeyDetails object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostTagKeyDetails costTagKeyDetails = (CostTagKeyDetails) o; + return Objects.equals(this.description, costTagKeyDetails.description) + && Objects.equals(this.tagValues, costTagKeyDetails.tagValues) + && Objects.equals(this.additionalProperties, costTagKeyDetails.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, tagValues, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostTagKeyDetails {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" tagValues: ").append(toIndentedString(tagValues)).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/CostTagKeyResponse.java b/src/main/java/com/datadog/api/client/v2/model/CostTagKeyResponse.java new file mode 100644 index 00000000000..01264d90562 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostTagKeyResponse.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A single Cloud Cost Management tag key. */ +@JsonPropertyOrder({CostTagKeyResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostTagKeyResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CostTagKey data; + + public CostTagKeyResponse() {} + + @JsonCreator + public CostTagKeyResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CostTagKey data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CostTagKeyResponse data(CostTagKey data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A Cloud Cost Management tag key. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CostTagKey getData() { + return data; + } + + public void setData(CostTagKey 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 CostTagKeyResponse + */ + @JsonAnySetter + public CostTagKeyResponse 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 CostTagKeyResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostTagKeyResponse costTagKeyResponse = (CostTagKeyResponse) o; + return Objects.equals(this.data, costTagKeyResponse.data) + && Objects.equals(this.additionalProperties, costTagKeyResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostTagKeyResponse {\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/CostTagKeyType.java b/src/main/java/com/datadog/api/client/v2/model/CostTagKeyType.java new file mode 100644 index 00000000000..f1f2bf1f6d8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostTagKeyType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type of the Cloud Cost Management tag key resource. */ +@JsonSerialize(using = CostTagKeyType.CostTagKeyTypeSerializer.class) +public class CostTagKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("cost_tag_key")); + + public static final CostTagKeyType COST_TAG_KEY = new CostTagKeyType("cost_tag_key"); + + CostTagKeyType(String value) { + super(value, allowedValues); + } + + public static class CostTagKeyTypeSerializer extends StdSerializer { + public CostTagKeyTypeSerializer(Class t) { + super(t); + } + + public CostTagKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(CostTagKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CostTagKeyType fromValue(String value) { + return new CostTagKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CostTagKeysResponse.java b/src/main/java/com/datadog/api/client/v2/model/CostTagKeysResponse.java new file mode 100644 index 00000000000..b0110248bf3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostTagKeysResponse.java @@ -0,0 +1,154 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A list of Cloud Cost Management tag keys. */ +@JsonPropertyOrder({CostTagKeysResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostTagKeysResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public CostTagKeysResponse() {} + + @JsonCreator + public CostTagKeysResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public CostTagKeysResponse data(List data) { + this.data = data; + for (CostTagKey item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CostTagKeysResponse addDataItem(CostTagKey dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of Cloud Cost Management tag keys. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CostTagKeysResponse + */ + @JsonAnySetter + public CostTagKeysResponse 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 CostTagKeysResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostTagKeysResponse costTagKeysResponse = (CostTagKeysResponse) o; + return Objects.equals(this.data, costTagKeysResponse.data) + && Objects.equals(this.additionalProperties, costTagKeysResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostTagKeysResponse {\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/CostTagType.java b/src/main/java/com/datadog/api/client/v2/model/CostTagType.java new file mode 100644 index 00000000000..6e30622b690 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostTagType.java @@ -0,0 +1,53 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type of the Cloud Cost Management tag resource. */ +@JsonSerialize(using = CostTagType.CostTagTypeSerializer.class) +public class CostTagType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("cost_tag")); + + public static final CostTagType COST_TAG = new CostTagType("cost_tag"); + + CostTagType(String value) { + super(value, allowedValues); + } + + public static class CostTagTypeSerializer extends StdSerializer { + public CostTagTypeSerializer(Class t) { + super(t); + } + + public CostTagTypeSerializer() { + this(null); + } + + @Override + public void serialize(CostTagType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CostTagType fromValue(String value) { + return new CostTagType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CostTagsResponse.java b/src/main/java/com/datadog/api/client/v2/model/CostTagsResponse.java new file mode 100644 index 00000000000..fdcbc648d74 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostTagsResponse.java @@ -0,0 +1,154 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A list of Cloud Cost Management tags. */ +@JsonPropertyOrder({CostTagsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostTagsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public CostTagsResponse() {} + + @JsonCreator + public CostTagsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public CostTagsResponse data(List data) { + this.data = data; + for (CostTag item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CostTagsResponse addDataItem(CostTag dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of Cloud Cost Management tags. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CostTagsResponse + */ + @JsonAnySetter + public CostTagsResponse 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 CostTagsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostTagsResponse costTagsResponse = (CostTagsResponse) o; + return Objects.equals(this.data, costTagsResponse.data) + && Objects.equals(this.additionalProperties, costTagsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostTagsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature index bf9f695d40e..fdaf32850e5 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature @@ -250,6 +250,27 @@ Feature: Cloud Cost Management And the response "data.type" is equal to "gcp_uc_config" And the response "data.attributes.account_id" is equal to "123456_ABCDEF_123ABC" + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get a Cloud Cost Management tag key returns "Bad Request" response + Given new "GetCostTagKey" request + And request contains "tag_key" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get a Cloud Cost Management tag key returns "Not Found" response + Given new "GetCostTagKey" request + And request contains "tag_key" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get a Cloud Cost Management tag key returns "OK" response + Given new "GetCostTagKey" request + And request contains "tag_key" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @team:DataDog/cloud-cost-management Scenario: Get a budget returns "Not Found" response Given new "GetBudget" request @@ -325,6 +346,30 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tag keys returns "Bad Request" response + Given new "ListCostTagKeys" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tag keys returns "OK" response + Given new "ListCostTagKeys" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tags returns "Bad Request" response + Given new "ListCostTags" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tags returns "OK" response + Given new "ListCostTags" request + When the request is sent + Then the response status is 200 OK + @replay-only @team:DataDog/cloud-cost-management Scenario: List Custom Costs Files returns "OK" response Given new "ListCustomCostsFiles" request 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 3d8451720f7..b2d6f99f26c 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 @@ -1476,6 +1476,24 @@ "type": "safe" } }, + "ListCostTagKeys": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "GetCostTagKey": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "ListCostTags": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "GetActiveBillingDimensions": { "tag": "Usage Metering", "undo": {