From f284e70bf47bde8b3198c9fd956706c7c180bf71 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 2 Sep 2026 18:46:21 +0000 Subject: [PATCH] Regenerate client from commit dbd89fa of spec repo --- .generator/schemas/v2/openapi.yaml | 379 ++++++++++++++ .../ListProductCatalogSKUs.java | 27 + .../com/datadog/api/client/ApiClient.java | 1 + .../api/client/v2/api/ProductCatalogApi.java | 286 ++++++++++ .../v2/model/ProductCatalogSKUAllotment.java | 236 +++++++++ ...oductCatalogSKUDataAttributesResponse.java | 491 ++++++++++++++++++ .../model/ProductCatalogSKUDataResponse.java | 214 ++++++++ .../ProductCatalogSKUOnDemandOption.java | 60 +++ .../model/ProductCatalogSKUPricingTier.java | 245 +++++++++ .../model/ProductCatalogSKUPricingType.java | 62 +++ .../ProductCatalogSKUPricingUnitType.java | 60 +++ .../model/ProductCatalogSKUTieredPricing.java | 168 ++++++ .../v2/model/ProductCatalogSKUType.java | 54 ++ .../model/ProductCatalogSKUsAPIVersion.java | 55 ++ .../v2/model/ProductCatalogSKUsResponse.java | 164 ++++++ .../api/client/v2/api/product_catalog.feature | 30 ++ .../com/datadog/api/client/v2/api/undo.json | 6 + 17 files changed, 2538 insertions(+) create mode 100644 examples/v2/product-catalog/ListProductCatalogSKUs.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/ProductCatalogApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUAllotment.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUDataAttributesResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUDataResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUOnDemandOption.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingTier.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingUnitType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUTieredPricing.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUsAPIVersion.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUsResponse.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/product_catalog.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e8bb5351a80..2080fab81c0 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -86636,6 +86636,225 @@ components: description: Abbreviated unit name (e.g., ns). type: string type: object + ProductCatalogSKUAllotment: + description: |- + A quantity of one SKU that is included with, and consumed before, the billable usage of + another SKU. + properties: + child_sku_code: + description: The code of the SKU that receives the allotment. + example: CUSTOM-EVENTS + type: string + hourly_quantity: + description: |- + The quantity allotted per hour. Fractional for some allotments, and equal to + `monthly_quantity` for others, depending on how the child SKU meters usage. + example: 0.684932 + format: double + type: number + monthly_quantity: + description: The quantity allotted per month. + example: 500 + format: int64 + type: integer + parent_sku_code: + description: |- + The code of the SKU that provides the allotment. Always the code of the SKU the + allotment is returned under. + example: HOSTS-PRO + type: string + required: + - parent_sku_code + - child_sku_code + - monthly_quantity + - hourly_quantity + type: object + ProductCatalogSKUDataAttributesResponse: + description: The pricing and allotment metadata of a SKU. + properties: + allotments: + description: |- + The allotments the SKU provides to other SKUs. Every entry carries the code of this + SKU as its `parent_sku_code`. Empty when the SKU provides no allotments. + items: + $ref: "#/components/schemas/ProductCatalogSKUAllotment" + type: array + billing_dimension: + description: |- + The identifier of the billing dimension the SKU is billed on, as used by the usage + metering endpoints. Several SKUs can share one billing dimension, so this value does + not identify a SKU. + example: infra_host + type: string + billing_units: + description: |- + The billable usage unit the SKU is priced per. `null` for SKUs that are not priced + per unit of usage, such as those whose `pricing_type` is `percent`. + example: hosts + nullable: true + type: string + currency: + description: The ISO-4217 code of the currency the prices are expressed in. + example: USD + type: string + default_on_demand_option: + $ref: "#/components/schemas/ProductCatalogSKUOnDemandOption" + number_of_units_included_in_price: + description: |- + The number of billable usage units included in the price. `0` for SKUs that are not + priced per unit of usage, such as those whose `pricing_type` is `percent`. + example: 1 + format: int64 + type: integer + on_demand_list_price: + description: |- + The public list price of on-demand usage of the SKU, as a decimal string. The number + of decimal places is not normalized, so values such as `0`, `0.9`, and `30000.00` + all occur. `null` when the SKU is priced with tiers, in which case the prices are in + `on_demand_tiered`. + example: "18.00" + nullable: true + type: string + on_demand_tiered: + $ref: "#/components/schemas/ProductCatalogSKUTieredPricing" + pricing_type: + $ref: "#/components/schemas/ProductCatalogSKUPricingType" + sku_name: + description: The human-readable name of the SKU. + example: Infra Pro + type: string + required: + - billing_dimension + - sku_name + - billing_units + - default_on_demand_option + - number_of_units_included_in_price + - on_demand_list_price + - pricing_type + - currency + - allotments + - on_demand_tiered + type: object + ProductCatalogSKUDataResponse: + description: A SKU and the pricing metadata that applies to it. + properties: + attributes: + $ref: "#/components/schemas/ProductCatalogSKUDataAttributesResponse" + id: + description: The code that identifies the SKU. + example: HOSTS-PRO + type: string + type: + $ref: "#/components/schemas/ProductCatalogSKUType" + required: + - id + - type + - attributes + type: object + ProductCatalogSKUOnDemandOption: + description: The billing frequency applied to on-demand usage of the SKU by default. + enum: + - hourly + - monthly + example: monthly + type: string + x-enum-varnames: + - HOURLY + - MONTHLY + ProductCatalogSKUPricingTier: + description: A usage range and the price that applies to usage falling inside it. + properties: + max_usage_quantity: + description: |- + The exclusive upper bound of the usage range the tier prices. `null` on the final + tier, which is unbounded. + example: 100000 + format: int64 + nullable: true + type: integer + min_usage_quantity: + description: The inclusive lower bound of the usage range the tier prices. + example: 1 + format: int64 + type: integer + price: + description: |- + The price applied to usage in the tier, as a decimal string. The number of decimal + places is not normalized, so free tiers appear as either `0` or `0.00`. + example: "120.00" + type: string + pricing_unit_type: + $ref: "#/components/schemas/ProductCatalogSKUPricingUnitType" + required: + - min_usage_quantity + - max_usage_quantity + - price + - pricing_unit_type + type: object + ProductCatalogSKUPricingType: + description: |- + How the SKU is priced. `usage` prices each billable usage unit, and `percent` prices a + percentage; percent-priced SKUs have no `billing_units`. + enum: + - usage + - percent + example: usage + type: string + x-enum-varnames: + - USAGE + - PERCENT + ProductCatalogSKUPricingUnitType: + description: |- + Whether the tier's price applies per unit of usage or to a block of usage. + enum: + - block + - unit + example: unit + type: string + x-enum-varnames: + - BLOCK + - UNIT + ProductCatalogSKUTieredPricing: + description: |- + The tiered pricing applied to on-demand usage of the SKU. `null` when the SKU is priced + with a single list price instead. + nullable: true + properties: + tiers: + description: The pricing tiers, ordered by ascending usage quantity. + items: + $ref: "#/components/schemas/ProductCatalogSKUPricingTier" + type: array + required: + - tiers + type: object + ProductCatalogSKUType: + description: The SKU resource type. + enum: + - Sku + example: Sku + type: string + x-enum-varnames: + - SKU + ProductCatalogSKUsAPIVersion: + description: The version of the product catalog contract to return. + enum: + - v1 + example: v1 + type: string + x-enum-varnames: + - V1 + ProductCatalogSKUsResponse: + description: Response containing the generally available SKUs and their pricing metadata. + properties: + data: + description: The generally available SKUs, sorted by SKU code in ascending order. + items: + $ref: "#/components/schemas/ProductCatalogSKUDataResponse" + type: array + required: + - data + type: object Project: description: A Project. properties: @@ -185774,6 +185993,162 @@ paths: tags: - Rum Audience Management x-unstable: "**Note**: This endpoint may be subject to changes." + /api/v2/product-catalog/skus: + get: + description: |- + Get every generally available Datadog SKU, with the pricing and allotment metadata that + applies to it, for the Datadog site serving the request. A SKU is generally available + when it is billed through a metered commitment or through automatic billing; SKUs in any + other phase are not returned. + + Prices, allotments, and pricing tiers are returned as they were in effect on + `as_of_date`, which defaults to the date of the request. Prices are public list prices: + they do not reflect discounts, commitments, or negotiated rates on an account. + + Each SKU is a separate resource in `data`, identified by its SKU code, and sorted by + that code in ascending order. The whole catalog is returned in a single response, so + this endpoint is not paginated. + operationId: ListProductCatalogSKUs + parameters: + - description: The version of the product catalog contract to return. `v1` is the latest. + example: v1 + in: query + name: version + required: true + schema: + $ref: "#/components/schemas/ProductCatalogSKUsAPIVersion" + - description: |- + The date the returned prices, allotments, and pricing tiers are effective as of, in + `YYYY-MM-DD` format. Defaults to the date of the request, and must not be later + than it. + example: "2026-07-01" + in: query + name: as_of_date + required: false + schema: + format: date + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + allotments: [] + billing_dimension: audit_trail + billing_units: + currency: USD + default_on_demand_option: monthly + number_of_units_included_in_price: 0 + on_demand_list_price: "3.00" + on_demand_tiered: + pricing_type: percent + sku_name: Audit Trail + id: AUDIT-TRAIL + type: Sku + - attributes: + allotments: + - child_sku_code: CM-100 + hourly_quantity: 100 + monthly_quantity: 100 + parent_sku_code: HOSTS-PRO + - child_sku_code: CM-INGEST + hourly_quantity: 100 + monthly_quantity: 100 + parent_sku_code: HOSTS-PRO + - child_sku_code: CUSTOM-EVENTS + hourly_quantity: 0.684932 + monthly_quantity: 500 + parent_sku_code: HOSTS-PRO + - child_sku_code: CONT + hourly_quantity: 10 + monthly_quantity: 10 + parent_sku_code: HOSTS-PRO + - child_sku_code: CONT-EXCL-AGENT + hourly_quantity: 5 + monthly_quantity: 5 + parent_sku_code: HOSTS-PRO + billing_dimension: infra_host + billing_units: hosts + currency: USD + default_on_demand_option: monthly + number_of_units_included_in_price: 1 + on_demand_list_price: "18.00" + on_demand_tiered: + pricing_type: usage + sku_name: Infra Pro + id: HOSTS-PRO + type: Sku + - attributes: + allotments: + - child_sku_code: SDS + hourly_quantity: 1 + monthly_quantity: 1 + parent_sku_code: LLM-OBSERVABILITY-MIN-SPEND + billing_dimension: llm_observability_min_spend + billing_units: requests + currency: USD + default_on_demand_option: monthly + number_of_units_included_in_price: 10000 + on_demand_list_price: + on_demand_tiered: + tiers: + - max_usage_quantity: 100000 + min_usage_quantity: 1 + price: "120.00" + pricing_unit_type: block + - max_usage_quantity: + min_usage_quantity: 100000 + price: "12.00" + pricing_unit_type: unit + pricing_type: usage + sku_name: Agent Observability Min Spend + id: LLM-OBSERVABILITY-MIN-SPEND + type: Sku + schema: + $ref: "#/components/schemas/ProductCatalogSKUsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request - version is missing or invalid, or as_of_date is malformed or in the future + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden - the caller has neither the billing_read nor the usage_read permission + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found - the requested catalog version is not supported + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - billing_read + - AuthZ: + - usage_read + summary: List SKUs + tags: + - Product Catalog + x-permission: + operator: OR + permissions: + - billing_read + - usage_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/pruned_trace/{trace_id}: get: description: |- @@ -222674,6 +223049,10 @@ tags: **Note**: Sending server-side events impacts billing. Review the [pricing page](https://www.datadoghq.com/pricing/?product=product-analytics#products) and contact your Customer Success Manager for more information. name: Product Analytics + - description: |- + Look up the Datadog SKUs that are generally available, together with the public list + prices, allotments, and tiered pricing that apply to them on a given date. + name: Product Catalog - description: |- Manage your Real User Monitoring (RUM) applications, and search or aggregate your RUM events over HTTP. See the [RUM & Session Replay page](https://docs.datadoghq.com/real_user_monitoring/) for more information name: RUM diff --git a/examples/v2/product-catalog/ListProductCatalogSKUs.java b/examples/v2/product-catalog/ListProductCatalogSKUs.java new file mode 100644 index 00000000000..a5085587685 --- /dev/null +++ b/examples/v2/product-catalog/ListProductCatalogSKUs.java @@ -0,0 +1,27 @@ +// List SKUs returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ProductCatalogApi; +import com.datadog.api.client.v2.model.ProductCatalogSKUsAPIVersion; +import com.datadog.api.client.v2.model.ProductCatalogSKUsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listProductCatalogSKUs", true); + ProductCatalogApi apiInstance = new ProductCatalogApi(defaultClient); + + try { + ProductCatalogSKUsResponse result = + apiInstance.listProductCatalogSKUs(ProductCatalogSKUsAPIVersion.V1); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ProductCatalogApi#listProductCatalogSKUs"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 2d9698f1db2..9635aa7aab5 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1344,6 +1344,7 @@ public class ApiClient { put("v2.queryEventFilteredUsers", false); put("v2.queryUsers", false); put("v2.updateConnection", false); + put("v2.listProductCatalogSKUs", false); put("v2.getPrunedTraceByID", false); put("v2.getTraceByID", false); put("v2.getAsmServiceByName", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/ProductCatalogApi.java b/src/main/java/com/datadog/api/client/v2/api/ProductCatalogApi.java new file mode 100644 index 00000000000..6bc85f27686 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/ProductCatalogApi.java @@ -0,0 +1,286 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.ProductCatalogSKUsAPIVersion; +import com.datadog.api.client.v2.model.ProductCatalogSKUsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductCatalogApi { + private ApiClient apiClient; + + public ProductCatalogApi() { + this(ApiClient.getDefaultApiClient()); + } + + public ProductCatalogApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** Manage optional parameters to listProductCatalogSKUs. */ + public static class ListProductCatalogSKUsOptionalParameters { + private OffsetDateTime asOfDate; + + /** + * Set asOfDate. + * + * @param asOfDate The date the returned prices, allotments, and pricing tiers are effective as + * of, in YYYY-MM-DD format. Defaults to the date of the request, and must not + * be later than it. (optional) + * @return ListProductCatalogSKUsOptionalParameters + */ + public ListProductCatalogSKUsOptionalParameters asOfDate(OffsetDateTime asOfDate) { + this.asOfDate = asOfDate; + return this; + } + } + + /** + * List SKUs. + * + *

See {@link #listProductCatalogSKUsWithHttpInfo}. + * + * @param version The version of the product catalog contract to return. v1 is the + * latest. (required) + * @return ProductCatalogSKUsResponse + * @throws ApiException if fails to make API call + */ + public ProductCatalogSKUsResponse listProductCatalogSKUs(ProductCatalogSKUsAPIVersion version) + throws ApiException { + return listProductCatalogSKUsWithHttpInfo( + version, new ListProductCatalogSKUsOptionalParameters()) + .getData(); + } + + /** + * List SKUs. + * + *

See {@link #listProductCatalogSKUsWithHttpInfoAsync}. + * + * @param version The version of the product catalog contract to return. v1 is the + * latest. (required) + * @return CompletableFuture<ProductCatalogSKUsResponse> + */ + public CompletableFuture listProductCatalogSKUsAsync( + ProductCatalogSKUsAPIVersion version) { + return listProductCatalogSKUsWithHttpInfoAsync( + version, new ListProductCatalogSKUsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List SKUs. + * + *

See {@link #listProductCatalogSKUsWithHttpInfo}. + * + * @param version The version of the product catalog contract to return. v1 is the + * latest. (required) + * @param parameters Optional parameters for the request. + * @return ProductCatalogSKUsResponse + * @throws ApiException if fails to make API call + */ + public ProductCatalogSKUsResponse listProductCatalogSKUs( + ProductCatalogSKUsAPIVersion version, ListProductCatalogSKUsOptionalParameters parameters) + throws ApiException { + return listProductCatalogSKUsWithHttpInfo(version, parameters).getData(); + } + + /** + * List SKUs. + * + *

See {@link #listProductCatalogSKUsWithHttpInfoAsync}. + * + * @param version The version of the product catalog contract to return. v1 is the + * latest. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ProductCatalogSKUsResponse> + */ + public CompletableFuture listProductCatalogSKUsAsync( + ProductCatalogSKUsAPIVersion version, ListProductCatalogSKUsOptionalParameters parameters) { + return listProductCatalogSKUsWithHttpInfoAsync(version, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get every generally available Datadog SKU, with the pricing and allotment metadata that applies + * to it, for the Datadog site serving the request. A SKU is generally available when it is billed + * through a metered commitment or through automatic billing; SKUs in any other phase are not + * returned. + * + *

Prices, allotments, and pricing tiers are returned as they were in effect on + * as_of_date, which defaults to the date of the request. Prices are public list prices: + * they do not reflect discounts, commitments, or negotiated rates on an account. + * + *

Each SKU is a separate resource in data, identified by its SKU code, and sorted + * by that code in ascending order. The whole catalog is returned in a single response, so this + * endpoint is not paginated. + * + * @param version The version of the product catalog contract to return. v1 is the + * latest. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<ProductCatalogSKUsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request - version is missing or invalid, or as_of_date is malformed or in the future -
403 Forbidden - the caller has neither the billing_read nor the usage_read permission -
404 Not Found - the requested catalog version is not supported -
429 Too many requests -
+ */ + public ApiResponse listProductCatalogSKUsWithHttpInfo( + ProductCatalogSKUsAPIVersion version, ListProductCatalogSKUsOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listProductCatalogSKUs"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'version' is set + if (version == null) { + throw new ApiException( + 400, "Missing the required parameter 'version' when calling listProductCatalogSKUs"); + } + OffsetDateTime asOfDate = parameters.asOfDate; + // create path and map variables + String localVarPath = "/api/v2/product-catalog/skus"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "version", version)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "as_of_date", asOfDate)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ProductCatalogApi.listProductCatalogSKUs", + 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 SKUs. + * + *

See {@link #listProductCatalogSKUsWithHttpInfo}. + * + * @param version The version of the product catalog contract to return. v1 is the + * latest. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<ProductCatalogSKUsResponse>> + */ + public CompletableFuture> + listProductCatalogSKUsWithHttpInfoAsync( + ProductCatalogSKUsAPIVersion version, + ListProductCatalogSKUsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listProductCatalogSKUs"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'version' is set + if (version == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'version' when calling listProductCatalogSKUs")); + return result; + } + OffsetDateTime asOfDate = parameters.asOfDate; + // create path and map variables + String localVarPath = "/api/v2/product-catalog/skus"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "version", version)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "as_of_date", asOfDate)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ProductCatalogApi.listProductCatalogSKUs", + 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() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUAllotment.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUAllotment.java new file mode 100644 index 00000000000..68b109ea5a5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUAllotment.java @@ -0,0 +1,236 @@ +/* + * 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 quantity of one SKU that is included with, and consumed before, the billable usage of another + * SKU. + */ +@JsonPropertyOrder({ + ProductCatalogSKUAllotment.JSON_PROPERTY_CHILD_SKU_CODE, + ProductCatalogSKUAllotment.JSON_PROPERTY_HOURLY_QUANTITY, + ProductCatalogSKUAllotment.JSON_PROPERTY_MONTHLY_QUANTITY, + ProductCatalogSKUAllotment.JSON_PROPERTY_PARENT_SKU_CODE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductCatalogSKUAllotment { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHILD_SKU_CODE = "child_sku_code"; + private String childSkuCode; + + public static final String JSON_PROPERTY_HOURLY_QUANTITY = "hourly_quantity"; + private Double hourlyQuantity; + + public static final String JSON_PROPERTY_MONTHLY_QUANTITY = "monthly_quantity"; + private Long monthlyQuantity; + + public static final String JSON_PROPERTY_PARENT_SKU_CODE = "parent_sku_code"; + private String parentSkuCode; + + public ProductCatalogSKUAllotment() {} + + @JsonCreator + public ProductCatalogSKUAllotment( + @JsonProperty(required = true, value = JSON_PROPERTY_CHILD_SKU_CODE) String childSkuCode, + @JsonProperty(required = true, value = JSON_PROPERTY_HOURLY_QUANTITY) Double hourlyQuantity, + @JsonProperty(required = true, value = JSON_PROPERTY_MONTHLY_QUANTITY) Long monthlyQuantity, + @JsonProperty(required = true, value = JSON_PROPERTY_PARENT_SKU_CODE) String parentSkuCode) { + this.childSkuCode = childSkuCode; + this.hourlyQuantity = hourlyQuantity; + this.monthlyQuantity = monthlyQuantity; + this.parentSkuCode = parentSkuCode; + } + + public ProductCatalogSKUAllotment childSkuCode(String childSkuCode) { + this.childSkuCode = childSkuCode; + return this; + } + + /** + * The code of the SKU that receives the allotment. + * + * @return childSkuCode + */ + @JsonProperty(JSON_PROPERTY_CHILD_SKU_CODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getChildSkuCode() { + return childSkuCode; + } + + public void setChildSkuCode(String childSkuCode) { + this.childSkuCode = childSkuCode; + } + + public ProductCatalogSKUAllotment hourlyQuantity(Double hourlyQuantity) { + this.hourlyQuantity = hourlyQuantity; + return this; + } + + /** + * The quantity allotted per hour. Fractional for some allotments, and equal to + * monthly_quantity for others, depending on how the child SKU meters usage. + * + * @return hourlyQuantity + */ + @JsonProperty(JSON_PROPERTY_HOURLY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getHourlyQuantity() { + return hourlyQuantity; + } + + public void setHourlyQuantity(Double hourlyQuantity) { + this.hourlyQuantity = hourlyQuantity; + } + + public ProductCatalogSKUAllotment monthlyQuantity(Long monthlyQuantity) { + this.monthlyQuantity = monthlyQuantity; + return this; + } + + /** + * The quantity allotted per month. + * + * @return monthlyQuantity + */ + @JsonProperty(JSON_PROPERTY_MONTHLY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getMonthlyQuantity() { + return monthlyQuantity; + } + + public void setMonthlyQuantity(Long monthlyQuantity) { + this.monthlyQuantity = monthlyQuantity; + } + + public ProductCatalogSKUAllotment parentSkuCode(String parentSkuCode) { + this.parentSkuCode = parentSkuCode; + return this; + } + + /** + * The code of the SKU that provides the allotment. Always the code of the SKU the allotment is + * returned under. + * + * @return parentSkuCode + */ + @JsonProperty(JSON_PROPERTY_PARENT_SKU_CODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getParentSkuCode() { + return parentSkuCode; + } + + public void setParentSkuCode(String parentSkuCode) { + this.parentSkuCode = parentSkuCode; + } + + /** + * 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 ProductCatalogSKUAllotment + */ + @JsonAnySetter + public ProductCatalogSKUAllotment 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 ProductCatalogSKUAllotment object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductCatalogSKUAllotment productCatalogSkuAllotment = (ProductCatalogSKUAllotment) o; + return Objects.equals(this.childSkuCode, productCatalogSkuAllotment.childSkuCode) + && Objects.equals(this.hourlyQuantity, productCatalogSkuAllotment.hourlyQuantity) + && Objects.equals(this.monthlyQuantity, productCatalogSkuAllotment.monthlyQuantity) + && Objects.equals(this.parentSkuCode, productCatalogSkuAllotment.parentSkuCode) + && Objects.equals( + this.additionalProperties, productCatalogSkuAllotment.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + childSkuCode, hourlyQuantity, monthlyQuantity, parentSkuCode, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductCatalogSKUAllotment {\n"); + sb.append(" childSkuCode: ").append(toIndentedString(childSkuCode)).append("\n"); + sb.append(" hourlyQuantity: ").append(toIndentedString(hourlyQuantity)).append("\n"); + sb.append(" monthlyQuantity: ").append(toIndentedString(monthlyQuantity)).append("\n"); + sb.append(" parentSkuCode: ").append(toIndentedString(parentSkuCode)).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/ProductCatalogSKUDataAttributesResponse.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUDataAttributesResponse.java new file mode 100644 index 00000000000..e01ae6eb459 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUDataAttributesResponse.java @@ -0,0 +1,491 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The pricing and allotment metadata of a SKU. */ +@JsonPropertyOrder({ + ProductCatalogSKUDataAttributesResponse.JSON_PROPERTY_ALLOTMENTS, + ProductCatalogSKUDataAttributesResponse.JSON_PROPERTY_BILLING_DIMENSION, + ProductCatalogSKUDataAttributesResponse.JSON_PROPERTY_BILLING_UNITS, + ProductCatalogSKUDataAttributesResponse.JSON_PROPERTY_CURRENCY, + ProductCatalogSKUDataAttributesResponse.JSON_PROPERTY_DEFAULT_ON_DEMAND_OPTION, + ProductCatalogSKUDataAttributesResponse.JSON_PROPERTY_NUMBER_OF_UNITS_INCLUDED_IN_PRICE, + ProductCatalogSKUDataAttributesResponse.JSON_PROPERTY_ON_DEMAND_LIST_PRICE, + ProductCatalogSKUDataAttributesResponse.JSON_PROPERTY_ON_DEMAND_TIERED, + ProductCatalogSKUDataAttributesResponse.JSON_PROPERTY_PRICING_TYPE, + ProductCatalogSKUDataAttributesResponse.JSON_PROPERTY_SKU_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductCatalogSKUDataAttributesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALLOTMENTS = "allotments"; + private List allotments = new ArrayList<>(); + + public static final String JSON_PROPERTY_BILLING_DIMENSION = "billing_dimension"; + private String billingDimension; + + public static final String JSON_PROPERTY_BILLING_UNITS = "billing_units"; + private String billingUnits; + + public static final String JSON_PROPERTY_CURRENCY = "currency"; + private String currency; + + public static final String JSON_PROPERTY_DEFAULT_ON_DEMAND_OPTION = "default_on_demand_option"; + private ProductCatalogSKUOnDemandOption defaultOnDemandOption; + + public static final String JSON_PROPERTY_NUMBER_OF_UNITS_INCLUDED_IN_PRICE = + "number_of_units_included_in_price"; + private Long numberOfUnitsIncludedInPrice; + + public static final String JSON_PROPERTY_ON_DEMAND_LIST_PRICE = "on_demand_list_price"; + private String onDemandListPrice; + + public static final String JSON_PROPERTY_ON_DEMAND_TIERED = "on_demand_tiered"; + private ProductCatalogSKUTieredPricing onDemandTiered; + + public static final String JSON_PROPERTY_PRICING_TYPE = "pricing_type"; + private ProductCatalogSKUPricingType pricingType; + + public static final String JSON_PROPERTY_SKU_NAME = "sku_name"; + private String skuName; + + public ProductCatalogSKUDataAttributesResponse() {} + + @JsonCreator + public ProductCatalogSKUDataAttributesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ALLOTMENTS) + List allotments, + @JsonProperty(required = true, value = JSON_PROPERTY_BILLING_DIMENSION) + String billingDimension, + @JsonProperty(required = true, value = JSON_PROPERTY_BILLING_UNITS) String billingUnits, + @JsonProperty(required = true, value = JSON_PROPERTY_CURRENCY) String currency, + @JsonProperty(required = true, value = JSON_PROPERTY_DEFAULT_ON_DEMAND_OPTION) + ProductCatalogSKUOnDemandOption defaultOnDemandOption, + @JsonProperty(required = true, value = JSON_PROPERTY_NUMBER_OF_UNITS_INCLUDED_IN_PRICE) + Long numberOfUnitsIncludedInPrice, + @JsonProperty(required = true, value = JSON_PROPERTY_ON_DEMAND_LIST_PRICE) + String onDemandListPrice, + @JsonProperty(required = true, value = JSON_PROPERTY_ON_DEMAND_TIERED) + ProductCatalogSKUTieredPricing onDemandTiered, + @JsonProperty(required = true, value = JSON_PROPERTY_PRICING_TYPE) + ProductCatalogSKUPricingType pricingType, + @JsonProperty(required = true, value = JSON_PROPERTY_SKU_NAME) String skuName) { + this.allotments = allotments; + for (ProductCatalogSKUAllotment item : allotments) { + this.unparsed |= item.unparsed; + } + this.billingDimension = billingDimension; + this.billingUnits = billingUnits; + if (billingUnits != null) {} + this.currency = currency; + this.defaultOnDemandOption = defaultOnDemandOption; + this.unparsed |= !defaultOnDemandOption.isValid(); + this.numberOfUnitsIncludedInPrice = numberOfUnitsIncludedInPrice; + this.onDemandListPrice = onDemandListPrice; + if (onDemandListPrice != null) {} + this.onDemandTiered = onDemandTiered; + if (onDemandTiered != null) { + this.unparsed |= onDemandTiered.unparsed; + } + this.pricingType = pricingType; + this.unparsed |= !pricingType.isValid(); + this.skuName = skuName; + } + + public ProductCatalogSKUDataAttributesResponse allotments( + List allotments) { + this.allotments = allotments; + for (ProductCatalogSKUAllotment item : allotments) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ProductCatalogSKUDataAttributesResponse addAllotmentsItem( + ProductCatalogSKUAllotment allotmentsItem) { + this.allotments.add(allotmentsItem); + this.unparsed |= allotmentsItem.unparsed; + return this; + } + + /** + * The allotments the SKU provides to other SKUs. Every entry carries the code of this SKU as its + * parent_sku_code. Empty when the SKU provides no allotments. + * + * @return allotments + */ + @JsonProperty(JSON_PROPERTY_ALLOTMENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getAllotments() { + return allotments; + } + + public void setAllotments(List allotments) { + this.allotments = allotments; + if (allotments != null) { + for (ProductCatalogSKUAllotment item : allotments) { + this.unparsed |= item.unparsed; + } + } + } + + public ProductCatalogSKUDataAttributesResponse billingDimension(String billingDimension) { + this.billingDimension = billingDimension; + return this; + } + + /** + * The identifier of the billing dimension the SKU is billed on, as used by the usage metering + * endpoints. Several SKUs can share one billing dimension, so this value does not identify a SKU. + * + * @return billingDimension + */ + @JsonProperty(JSON_PROPERTY_BILLING_DIMENSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getBillingDimension() { + return billingDimension; + } + + public void setBillingDimension(String billingDimension) { + this.billingDimension = billingDimension; + } + + public ProductCatalogSKUDataAttributesResponse billingUnits(String billingUnits) { + this.billingUnits = billingUnits; + if (billingUnits != null) {} + return this; + } + + /** + * The billable usage unit the SKU is priced per. null for SKUs that are not priced + * per unit of usage, such as those whose pricing_type is percent. + * + * @return billingUnits + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BILLING_UNITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getBillingUnits() { + return billingUnits; + } + + public void setBillingUnits(String billingUnits) { + this.billingUnits = billingUnits; + } + + public ProductCatalogSKUDataAttributesResponse currency(String currency) { + this.currency = currency; + return this; + } + + /** + * The ISO-4217 code of the currency the prices are expressed in. + * + * @return currency + */ + @JsonProperty(JSON_PROPERTY_CURRENCY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public ProductCatalogSKUDataAttributesResponse defaultOnDemandOption( + ProductCatalogSKUOnDemandOption defaultOnDemandOption) { + this.defaultOnDemandOption = defaultOnDemandOption; + this.unparsed |= !defaultOnDemandOption.isValid(); + return this; + } + + /** + * The billing frequency applied to on-demand usage of the SKU by default. + * + * @return defaultOnDemandOption + */ + @JsonProperty(JSON_PROPERTY_DEFAULT_ON_DEMAND_OPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProductCatalogSKUOnDemandOption getDefaultOnDemandOption() { + return defaultOnDemandOption; + } + + public void setDefaultOnDemandOption(ProductCatalogSKUOnDemandOption defaultOnDemandOption) { + if (!defaultOnDemandOption.isValid()) { + this.unparsed = true; + } + this.defaultOnDemandOption = defaultOnDemandOption; + } + + public ProductCatalogSKUDataAttributesResponse numberOfUnitsIncludedInPrice( + Long numberOfUnitsIncludedInPrice) { + this.numberOfUnitsIncludedInPrice = numberOfUnitsIncludedInPrice; + return this; + } + + /** + * The number of billable usage units included in the price. 0 for SKUs that are not + * priced per unit of usage, such as those whose pricing_type is percent + * . + * + * @return numberOfUnitsIncludedInPrice + */ + @JsonProperty(JSON_PROPERTY_NUMBER_OF_UNITS_INCLUDED_IN_PRICE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getNumberOfUnitsIncludedInPrice() { + return numberOfUnitsIncludedInPrice; + } + + public void setNumberOfUnitsIncludedInPrice(Long numberOfUnitsIncludedInPrice) { + this.numberOfUnitsIncludedInPrice = numberOfUnitsIncludedInPrice; + } + + public ProductCatalogSKUDataAttributesResponse onDemandListPrice(String onDemandListPrice) { + this.onDemandListPrice = onDemandListPrice; + if (onDemandListPrice != null) {} + return this; + } + + /** + * The public list price of on-demand usage of the SKU, as a decimal string. The number of decimal + * places is not normalized, so values such as 0, 0.9, and + * 30000.00 all occur. null when the SKU is priced with tiers, in which case + * the prices are in on_demand_tiered. + * + * @return onDemandListPrice + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ON_DEMAND_LIST_PRICE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getOnDemandListPrice() { + return onDemandListPrice; + } + + public void setOnDemandListPrice(String onDemandListPrice) { + this.onDemandListPrice = onDemandListPrice; + } + + public ProductCatalogSKUDataAttributesResponse onDemandTiered( + ProductCatalogSKUTieredPricing onDemandTiered) { + this.onDemandTiered = onDemandTiered; + if (onDemandTiered != null) { + this.unparsed |= onDemandTiered.unparsed; + } + return this; + } + + /** + * The tiered pricing applied to on-demand usage of the SKU. null when the SKU is + * priced with a single list price instead. + * + * @return onDemandTiered + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ON_DEMAND_TIERED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProductCatalogSKUTieredPricing getOnDemandTiered() { + return onDemandTiered; + } + + public void setOnDemandTiered(ProductCatalogSKUTieredPricing onDemandTiered) { + this.onDemandTiered = onDemandTiered; + if (onDemandTiered != null) { + this.unparsed |= onDemandTiered.unparsed; + } + } + + public ProductCatalogSKUDataAttributesResponse pricingType( + ProductCatalogSKUPricingType pricingType) { + this.pricingType = pricingType; + this.unparsed |= !pricingType.isValid(); + return this; + } + + /** + * How the SKU is priced. usage prices each billable usage unit, and percent + * prices a percentage; percent-priced SKUs have no billing_units. + * + * @return pricingType + */ + @JsonProperty(JSON_PROPERTY_PRICING_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProductCatalogSKUPricingType getPricingType() { + return pricingType; + } + + public void setPricingType(ProductCatalogSKUPricingType pricingType) { + if (!pricingType.isValid()) { + this.unparsed = true; + } + this.pricingType = pricingType; + } + + public ProductCatalogSKUDataAttributesResponse skuName(String skuName) { + this.skuName = skuName; + return this; + } + + /** + * The human-readable name of the SKU. + * + * @return skuName + */ + @JsonProperty(JSON_PROPERTY_SKU_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSkuName() { + return skuName; + } + + public void setSkuName(String skuName) { + this.skuName = skuName; + } + + /** + * 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 ProductCatalogSKUDataAttributesResponse + */ + @JsonAnySetter + public ProductCatalogSKUDataAttributesResponse 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 ProductCatalogSKUDataAttributesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductCatalogSKUDataAttributesResponse productCatalogSkuDataAttributesResponse = + (ProductCatalogSKUDataAttributesResponse) o; + return Objects.equals(this.allotments, productCatalogSkuDataAttributesResponse.allotments) + && Objects.equals( + this.billingDimension, productCatalogSkuDataAttributesResponse.billingDimension) + && Objects.equals(this.billingUnits, productCatalogSkuDataAttributesResponse.billingUnits) + && Objects.equals(this.currency, productCatalogSkuDataAttributesResponse.currency) + && Objects.equals( + this.defaultOnDemandOption, + productCatalogSkuDataAttributesResponse.defaultOnDemandOption) + && Objects.equals( + this.numberOfUnitsIncludedInPrice, + productCatalogSkuDataAttributesResponse.numberOfUnitsIncludedInPrice) + && Objects.equals( + this.onDemandListPrice, productCatalogSkuDataAttributesResponse.onDemandListPrice) + && Objects.equals( + this.onDemandTiered, productCatalogSkuDataAttributesResponse.onDemandTiered) + && Objects.equals(this.pricingType, productCatalogSkuDataAttributesResponse.pricingType) + && Objects.equals(this.skuName, productCatalogSkuDataAttributesResponse.skuName) + && Objects.equals( + this.additionalProperties, + productCatalogSkuDataAttributesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allotments, + billingDimension, + billingUnits, + currency, + defaultOnDemandOption, + numberOfUnitsIncludedInPrice, + onDemandListPrice, + onDemandTiered, + pricingType, + skuName, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductCatalogSKUDataAttributesResponse {\n"); + sb.append(" allotments: ").append(toIndentedString(allotments)).append("\n"); + sb.append(" billingDimension: ").append(toIndentedString(billingDimension)).append("\n"); + sb.append(" billingUnits: ").append(toIndentedString(billingUnits)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" defaultOnDemandOption: ") + .append(toIndentedString(defaultOnDemandOption)) + .append("\n"); + sb.append(" numberOfUnitsIncludedInPrice: ") + .append(toIndentedString(numberOfUnitsIncludedInPrice)) + .append("\n"); + sb.append(" onDemandListPrice: ").append(toIndentedString(onDemandListPrice)).append("\n"); + sb.append(" onDemandTiered: ").append(toIndentedString(onDemandTiered)).append("\n"); + sb.append(" pricingType: ").append(toIndentedString(pricingType)).append("\n"); + sb.append(" skuName: ").append(toIndentedString(skuName)).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/ProductCatalogSKUDataResponse.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUDataResponse.java new file mode 100644 index 00000000000..ce64c17378c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUDataResponse.java @@ -0,0 +1,214 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A SKU and the pricing metadata that applies to it. */ +@JsonPropertyOrder({ + ProductCatalogSKUDataResponse.JSON_PROPERTY_ATTRIBUTES, + ProductCatalogSKUDataResponse.JSON_PROPERTY_ID, + ProductCatalogSKUDataResponse.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductCatalogSKUDataResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ProductCatalogSKUDataAttributesResponse attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ProductCatalogSKUType type; + + public ProductCatalogSKUDataResponse() {} + + @JsonCreator + public ProductCatalogSKUDataResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ProductCatalogSKUDataAttributesResponse attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ProductCatalogSKUType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ProductCatalogSKUDataResponse attributes( + ProductCatalogSKUDataAttributesResponse attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The pricing and allotment metadata of a SKU. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProductCatalogSKUDataAttributesResponse getAttributes() { + return attributes; + } + + public void setAttributes(ProductCatalogSKUDataAttributesResponse attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public ProductCatalogSKUDataResponse id(String id) { + this.id = id; + return this; + } + + /** + * The code that identifies the SKU. + * + * @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 ProductCatalogSKUDataResponse type(ProductCatalogSKUType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The SKU resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProductCatalogSKUType getType() { + return type; + } + + public void setType(ProductCatalogSKUType 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 ProductCatalogSKUDataResponse + */ + @JsonAnySetter + public ProductCatalogSKUDataResponse 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 ProductCatalogSKUDataResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductCatalogSKUDataResponse productCatalogSkuDataResponse = (ProductCatalogSKUDataResponse) o; + return Objects.equals(this.attributes, productCatalogSkuDataResponse.attributes) + && Objects.equals(this.id, productCatalogSkuDataResponse.id) + && Objects.equals(this.type, productCatalogSkuDataResponse.type) + && Objects.equals( + this.additionalProperties, productCatalogSkuDataResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductCatalogSKUDataResponse {\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/ProductCatalogSKUOnDemandOption.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUOnDemandOption.java new file mode 100644 index 00000000000..79e895d4cd2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUOnDemandOption.java @@ -0,0 +1,60 @@ +/* + * 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 billing frequency applied to on-demand usage of the SKU by default. */ +@JsonSerialize( + using = ProductCatalogSKUOnDemandOption.ProductCatalogSKUOnDemandOptionSerializer.class) +public class ProductCatalogSKUOnDemandOption extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("hourly", "monthly")); + + public static final ProductCatalogSKUOnDemandOption HOURLY = + new ProductCatalogSKUOnDemandOption("hourly"); + public static final ProductCatalogSKUOnDemandOption MONTHLY = + new ProductCatalogSKUOnDemandOption("monthly"); + + ProductCatalogSKUOnDemandOption(String value) { + super(value, allowedValues); + } + + public static class ProductCatalogSKUOnDemandOptionSerializer + extends StdSerializer { + public ProductCatalogSKUOnDemandOptionSerializer(Class t) { + super(t); + } + + public ProductCatalogSKUOnDemandOptionSerializer() { + this(null); + } + + @Override + public void serialize( + ProductCatalogSKUOnDemandOption value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ProductCatalogSKUOnDemandOption fromValue(String value) { + return new ProductCatalogSKUOnDemandOption(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingTier.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingTier.java new file mode 100644 index 00000000000..f69122cfa1d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingTier.java @@ -0,0 +1,245 @@ +/* + * 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 usage range and the price that applies to usage falling inside it. */ +@JsonPropertyOrder({ + ProductCatalogSKUPricingTier.JSON_PROPERTY_MAX_USAGE_QUANTITY, + ProductCatalogSKUPricingTier.JSON_PROPERTY_MIN_USAGE_QUANTITY, + ProductCatalogSKUPricingTier.JSON_PROPERTY_PRICE, + ProductCatalogSKUPricingTier.JSON_PROPERTY_PRICING_UNIT_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductCatalogSKUPricingTier { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_MAX_USAGE_QUANTITY = "max_usage_quantity"; + private Long maxUsageQuantity; + + public static final String JSON_PROPERTY_MIN_USAGE_QUANTITY = "min_usage_quantity"; + private Long minUsageQuantity; + + public static final String JSON_PROPERTY_PRICE = "price"; + private String price; + + public static final String JSON_PROPERTY_PRICING_UNIT_TYPE = "pricing_unit_type"; + private ProductCatalogSKUPricingUnitType pricingUnitType; + + public ProductCatalogSKUPricingTier() {} + + @JsonCreator + public ProductCatalogSKUPricingTier( + @JsonProperty(required = true, value = JSON_PROPERTY_MAX_USAGE_QUANTITY) + Long maxUsageQuantity, + @JsonProperty(required = true, value = JSON_PROPERTY_MIN_USAGE_QUANTITY) + Long minUsageQuantity, + @JsonProperty(required = true, value = JSON_PROPERTY_PRICE) String price, + @JsonProperty(required = true, value = JSON_PROPERTY_PRICING_UNIT_TYPE) + ProductCatalogSKUPricingUnitType pricingUnitType) { + this.maxUsageQuantity = maxUsageQuantity; + if (maxUsageQuantity != null) {} + this.minUsageQuantity = minUsageQuantity; + this.price = price; + this.pricingUnitType = pricingUnitType; + this.unparsed |= !pricingUnitType.isValid(); + } + + public ProductCatalogSKUPricingTier maxUsageQuantity(Long maxUsageQuantity) { + this.maxUsageQuantity = maxUsageQuantity; + if (maxUsageQuantity != null) {} + return this; + } + + /** + * The exclusive upper bound of the usage range the tier prices. null on the final + * tier, which is unbounded. + * + * @return maxUsageQuantity + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MAX_USAGE_QUANTITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getMaxUsageQuantity() { + return maxUsageQuantity; + } + + public void setMaxUsageQuantity(Long maxUsageQuantity) { + this.maxUsageQuantity = maxUsageQuantity; + } + + public ProductCatalogSKUPricingTier minUsageQuantity(Long minUsageQuantity) { + this.minUsageQuantity = minUsageQuantity; + return this; + } + + /** + * The inclusive lower bound of the usage range the tier prices. + * + * @return minUsageQuantity + */ + @JsonProperty(JSON_PROPERTY_MIN_USAGE_QUANTITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getMinUsageQuantity() { + return minUsageQuantity; + } + + public void setMinUsageQuantity(Long minUsageQuantity) { + this.minUsageQuantity = minUsageQuantity; + } + + public ProductCatalogSKUPricingTier price(String price) { + this.price = price; + return this; + } + + /** + * The price applied to usage in the tier, as a decimal string. The number of decimal places is + * not normalized, so free tiers appear as either 0 or 0.00. + * + * @return price + */ + @JsonProperty(JSON_PROPERTY_PRICE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + + public ProductCatalogSKUPricingTier pricingUnitType( + ProductCatalogSKUPricingUnitType pricingUnitType) { + this.pricingUnitType = pricingUnitType; + this.unparsed |= !pricingUnitType.isValid(); + return this; + } + + /** + * Whether the tier's price applies per unit of usage or to a block of usage. + * + * @return pricingUnitType + */ + @JsonProperty(JSON_PROPERTY_PRICING_UNIT_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProductCatalogSKUPricingUnitType getPricingUnitType() { + return pricingUnitType; + } + + public void setPricingUnitType(ProductCatalogSKUPricingUnitType pricingUnitType) { + if (!pricingUnitType.isValid()) { + this.unparsed = true; + } + this.pricingUnitType = pricingUnitType; + } + + /** + * 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 ProductCatalogSKUPricingTier + */ + @JsonAnySetter + public ProductCatalogSKUPricingTier 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 ProductCatalogSKUPricingTier object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductCatalogSKUPricingTier productCatalogSkuPricingTier = (ProductCatalogSKUPricingTier) o; + return Objects.equals(this.maxUsageQuantity, productCatalogSkuPricingTier.maxUsageQuantity) + && Objects.equals(this.minUsageQuantity, productCatalogSkuPricingTier.minUsageQuantity) + && Objects.equals(this.price, productCatalogSkuPricingTier.price) + && Objects.equals(this.pricingUnitType, productCatalogSkuPricingTier.pricingUnitType) + && Objects.equals( + this.additionalProperties, productCatalogSkuPricingTier.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + maxUsageQuantity, minUsageQuantity, price, pricingUnitType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductCatalogSKUPricingTier {\n"); + sb.append(" maxUsageQuantity: ").append(toIndentedString(maxUsageQuantity)).append("\n"); + sb.append(" minUsageQuantity: ").append(toIndentedString(minUsageQuantity)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" pricingUnitType: ").append(toIndentedString(pricingUnitType)).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/ProductCatalogSKUPricingType.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingType.java new file mode 100644 index 00000000000..6d66ccfba8f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingType.java @@ -0,0 +1,62 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * How the SKU is priced. usage prices each billable usage unit, and percent + * prices a percentage; percent-priced SKUs have no billing_units. + */ +@JsonSerialize(using = ProductCatalogSKUPricingType.ProductCatalogSKUPricingTypeSerializer.class) +public class ProductCatalogSKUPricingType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("usage", "percent")); + + public static final ProductCatalogSKUPricingType USAGE = + new ProductCatalogSKUPricingType("usage"); + public static final ProductCatalogSKUPricingType PERCENT = + new ProductCatalogSKUPricingType("percent"); + + ProductCatalogSKUPricingType(String value) { + super(value, allowedValues); + } + + public static class ProductCatalogSKUPricingTypeSerializer + extends StdSerializer { + public ProductCatalogSKUPricingTypeSerializer(Class t) { + super(t); + } + + public ProductCatalogSKUPricingTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ProductCatalogSKUPricingType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ProductCatalogSKUPricingType fromValue(String value) { + return new ProductCatalogSKUPricingType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingUnitType.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingUnitType.java new file mode 100644 index 00000000000..9fa508338d0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUPricingUnitType.java @@ -0,0 +1,60 @@ +/* + * 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; + +/** Whether the tier's price applies per unit of usage or to a block of usage. */ +@JsonSerialize( + using = ProductCatalogSKUPricingUnitType.ProductCatalogSKUPricingUnitTypeSerializer.class) +public class ProductCatalogSKUPricingUnitType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("block", "unit")); + + public static final ProductCatalogSKUPricingUnitType BLOCK = + new ProductCatalogSKUPricingUnitType("block"); + public static final ProductCatalogSKUPricingUnitType UNIT = + new ProductCatalogSKUPricingUnitType("unit"); + + ProductCatalogSKUPricingUnitType(String value) { + super(value, allowedValues); + } + + public static class ProductCatalogSKUPricingUnitTypeSerializer + extends StdSerializer { + public ProductCatalogSKUPricingUnitTypeSerializer(Class t) { + super(t); + } + + public ProductCatalogSKUPricingUnitTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ProductCatalogSKUPricingUnitType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ProductCatalogSKUPricingUnitType fromValue(String value) { + return new ProductCatalogSKUPricingUnitType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUTieredPricing.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUTieredPricing.java new file mode 100644 index 00000000000..cda0123fba4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUTieredPricing.java @@ -0,0 +1,168 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * The tiered pricing applied to on-demand usage of the SKU. null when the SKU is + * priced with a single list price instead. + */ +@JsonPropertyOrder({ProductCatalogSKUTieredPricing.JSON_PROPERTY_TIERS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductCatalogSKUTieredPricing { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TIERS = "tiers"; + private List tiers = new ArrayList<>(); + + public ProductCatalogSKUTieredPricing() {} + + @JsonCreator + public ProductCatalogSKUTieredPricing( + @JsonProperty(required = true, value = JSON_PROPERTY_TIERS) + List tiers) { + this.tiers = tiers; + for (ProductCatalogSKUPricingTier item : tiers) { + this.unparsed |= item.unparsed; + } + } + + public ProductCatalogSKUTieredPricing tiers(List tiers) { + this.tiers = tiers; + for (ProductCatalogSKUPricingTier item : tiers) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ProductCatalogSKUTieredPricing addTiersItem(ProductCatalogSKUPricingTier tiersItem) { + this.tiers.add(tiersItem); + this.unparsed |= tiersItem.unparsed; + return this; + } + + /** + * The pricing tiers, ordered by ascending usage quantity. + * + * @return tiers + */ + @JsonProperty(JSON_PROPERTY_TIERS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTiers() { + return tiers; + } + + public void setTiers(List tiers) { + this.tiers = tiers; + if (tiers != null) { + for (ProductCatalogSKUPricingTier item : tiers) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * 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 ProductCatalogSKUTieredPricing + */ + @JsonAnySetter + public ProductCatalogSKUTieredPricing 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 ProductCatalogSKUTieredPricing object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductCatalogSKUTieredPricing productCatalogSkuTieredPricing = + (ProductCatalogSKUTieredPricing) o; + return Objects.equals(this.tiers, productCatalogSkuTieredPricing.tiers) + && Objects.equals( + this.additionalProperties, productCatalogSkuTieredPricing.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tiers, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductCatalogSKUTieredPricing {\n"); + sb.append(" tiers: ").append(toIndentedString(tiers)).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/ProductCatalogSKUType.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUType.java new file mode 100644 index 00000000000..a5c769ba876 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUType.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; + +/** The SKU resource type. */ +@JsonSerialize(using = ProductCatalogSKUType.ProductCatalogSKUTypeSerializer.class) +public class ProductCatalogSKUType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Sku")); + + public static final ProductCatalogSKUType SKU = new ProductCatalogSKUType("Sku"); + + ProductCatalogSKUType(String value) { + super(value, allowedValues); + } + + public static class ProductCatalogSKUTypeSerializer extends StdSerializer { + public ProductCatalogSKUTypeSerializer(Class t) { + super(t); + } + + public ProductCatalogSKUTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ProductCatalogSKUType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ProductCatalogSKUType fromValue(String value) { + return new ProductCatalogSKUType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUsAPIVersion.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUsAPIVersion.java new file mode 100644 index 00000000000..42a767069e8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUsAPIVersion.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 version of the product catalog contract to return. */ +@JsonSerialize(using = ProductCatalogSKUsAPIVersion.ProductCatalogSKUsAPIVersionSerializer.class) +public class ProductCatalogSKUsAPIVersion extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("v1")); + + public static final ProductCatalogSKUsAPIVersion V1 = new ProductCatalogSKUsAPIVersion("v1"); + + ProductCatalogSKUsAPIVersion(String value) { + super(value, allowedValues); + } + + public static class ProductCatalogSKUsAPIVersionSerializer + extends StdSerializer { + public ProductCatalogSKUsAPIVersionSerializer(Class t) { + super(t); + } + + public ProductCatalogSKUsAPIVersionSerializer() { + this(null); + } + + @Override + public void serialize( + ProductCatalogSKUsAPIVersion value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ProductCatalogSKUsAPIVersion fromValue(String value) { + return new ProductCatalogSKUsAPIVersion(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUsResponse.java b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUsResponse.java new file mode 100644 index 00000000000..59ff2cd264e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductCatalogSKUsResponse.java @@ -0,0 +1,164 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing the generally available SKUs and their pricing metadata. */ +@JsonPropertyOrder({ProductCatalogSKUsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductCatalogSKUsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public ProductCatalogSKUsResponse() {} + + @JsonCreator + public ProductCatalogSKUsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + for (ProductCatalogSKUDataResponse item : data) { + this.unparsed |= item.unparsed; + } + } + + public ProductCatalogSKUsResponse data(List data) { + this.data = data; + for (ProductCatalogSKUDataResponse item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ProductCatalogSKUsResponse addDataItem(ProductCatalogSKUDataResponse dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The generally available SKUs, sorted by SKU code in ascending order. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (ProductCatalogSKUDataResponse item : data) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * 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 ProductCatalogSKUsResponse + */ + @JsonAnySetter + public ProductCatalogSKUsResponse 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 ProductCatalogSKUsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductCatalogSKUsResponse productCatalogSkUsResponse = (ProductCatalogSKUsResponse) o; + return Objects.equals(this.data, productCatalogSkUsResponse.data) + && Objects.equals( + this.additionalProperties, productCatalogSkUsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductCatalogSKUsResponse {\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/product_catalog.feature b/src/test/resources/com/datadog/api/client/v2/api/product_catalog.feature new file mode 100644 index 00000000000..49b85083244 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/product_catalog.feature @@ -0,0 +1,30 @@ +@endpoint(product-catalog) @endpoint(product-catalog-v2) +Feature: Product Catalog + Look up the Datadog SKUs that are generally available, together with the + public list prices, allotments, and tiered pricing that apply to them on a + given date. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ProductCatalog" API + And operation "ListProductCatalogSKUs" enabled + And new "ListProductCatalogSKUs" request + + @generated @skip @team:DataDog/red-zone-product-catalog + Scenario: List SKUs returns "Bad Request - version is missing or invalid, or as_of_date is malformed or in the future" response + Given request contains "version" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request - version is missing or invalid, or as_of_date is malformed or in the future + + @generated @skip @team:DataDog/red-zone-product-catalog + Scenario: List SKUs returns "Not Found - the requested catalog version is not supported" response + Given request contains "version" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found - the requested catalog version is not supported + + @generated @skip @team:DataDog/red-zone-product-catalog + Scenario: List SKUs returns "OK" response + Given request contains "version" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 535ebca0b11..383d0fec6e5 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 @@ -6611,6 +6611,12 @@ "type": "safe" } }, + "ListProductCatalogSKUs": { + "tag": "Product Catalog", + "undo": { + "type": "safe" + } + }, "GetPrunedTraceByID": { "tag": "APM Trace", "undo": {