diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e8bb5351a80b..2080fab81c04 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.ts b/examples/v2/product-catalog/ListProductCatalogSKUs.ts new file mode 100644 index 000000000000..1db1c44ab04f --- /dev/null +++ b/examples/v2/product-catalog/ListProductCatalogSKUs.ts @@ -0,0 +1,22 @@ +/** + * List SKUs returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.listProductCatalogSKUs"] = true; +const apiInstance = new v2.ProductCatalogApi(configuration); + +const params: v2.ProductCatalogApiListProductCatalogSKUsRequest = { + version: "v1", +}; + +apiInstance + .listProductCatalogSKUs(params) + .then((data: v2.ProductCatalogSKUsResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index 52cbb0657038..8c61f9be2bfa 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -14641,6 +14641,17 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "ListConnectionsResponse", }, + "v2.ListProductCatalogSKUs": { + "version": { + "type": "ProductCatalogSKUsAPIVersion", + "format": "", + }, + "asOfDate": { + "type": "Date", + "format": "date", + }, + "operationResponseType": "ProductCatalogSKUsResponse", + }, "v2.GetPrunedTraceByID": { "traceId": { "type": "string", diff --git a/features/v2/product_catalog.feature b/features/v2/product_catalog.feature new file mode 100644 index 000000000000..49b85083244c --- /dev/null +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 535ebca0b11d..383d0fec6e5d 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -6611,6 +6611,12 @@ "type": "safe" } }, + "ListProductCatalogSKUs": { + "tag": "Product Catalog", + "undo": { + "type": "safe" + } + }, "GetPrunedTraceByID": { "tag": "APM Trace", "undo": { diff --git a/packages/datadog-api-client-common/configuration.ts b/packages/datadog-api-client-common/configuration.ts index 29587e955555..c0ab5035cf8e 100644 --- a/packages/datadog-api-client-common/configuration.ts +++ b/packages/datadog-api-client-common/configuration.ts @@ -736,6 +736,7 @@ export function createConfiguration( "v2.queryEventFilteredUsers": false, "v2.queryUsers": false, "v2.updateConnection": false, + "v2.listProductCatalogSKUs": false, "v2.getPrunedTraceByID": false, "v2.getTraceByID": false, "v2.getAsmServiceByName": false, diff --git a/packages/datadog-api-client-v2/apis/ProductCatalogApi.ts b/packages/datadog-api-client-v2/apis/ProductCatalogApi.ts new file mode 100644 index 000000000000..2c5a9bdd9959 --- /dev/null +++ b/packages/datadog-api-client-v2/apis/ProductCatalogApi.ts @@ -0,0 +1,237 @@ +import { + BaseAPIRequestFactory, + RequiredError, +} from "../../datadog-api-client-common/baseapi"; +import { + Configuration, + applySecurityAuthentication, +} from "../../datadog-api-client-common/configuration"; +import { + RequestContext, + HttpMethod, + ResponseContext, +} from "../../datadog-api-client-common/http/http"; + +import { logger } from "../../../logger"; +import { ObjectSerializer } from "../models/ObjectSerializer"; +import { ApiException } from "../../datadog-api-client-common/exception"; + +import { APIErrorResponse } from "../models/APIErrorResponse"; +import { JSONAPIErrorResponse } from "../models/JSONAPIErrorResponse"; +import { ProductCatalogSKUsAPIVersion } from "../models/ProductCatalogSKUsAPIVersion"; +import { ProductCatalogSKUsResponse } from "../models/ProductCatalogSKUsResponse"; + +export class ProductCatalogApiRequestFactory extends BaseAPIRequestFactory { + public async listProductCatalogSKUs( + version: ProductCatalogSKUsAPIVersion, + asOfDate?: Date, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'listProductCatalogSKUs'"); + if (!_config.unstableOperations["v2.listProductCatalogSKUs"]) { + throw new Error( + "Unstable operation 'listProductCatalogSKUs' is disabled" + ); + } + + // verify required parameter 'version' is not null or undefined + if (version === null || version === undefined) { + throw new RequiredError("version", "listProductCatalogSKUs"); + } + + // Path Params + const localVarPath = "/api/v2/product-catalog/skus"; + + // Make Request Context + const requestContext = _config + .getServer("v2.ProductCatalogApi.listProductCatalogSKUs") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Query Params + if (version !== undefined) { + requestContext.setQueryParam( + "version", + ObjectSerializer.serialize(version, "ProductCatalogSKUsAPIVersion", ""), + "" + ); + } + if (asOfDate !== undefined) { + requestContext.setQueryParam( + "as_of_date", + ObjectSerializer.serialize(asOfDate, "Date", "date"), + "" + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } +} + +export class ProductCatalogApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listProductCatalogSKUs + * @throws ApiException if the response code was not in [200, 299] + */ + public async listProductCatalogSKUs( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: ProductCatalogSKUsResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ProductCatalogSKUsResponse" + ) as ProductCatalogSKUsResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ProductCatalogSKUsResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ProductCatalogSKUsResponse", + "" + ) as ProductCatalogSKUsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } +} + +export interface ProductCatalogApiListProductCatalogSKUsRequest { + /** + * The version of the product catalog contract to return. `v1` is the latest. + * @type ProductCatalogSKUsAPIVersion + */ + version: ProductCatalogSKUsAPIVersion; + /** + * 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. + * @type Date + */ + asOfDate?: Date; +} + +export class ProductCatalogApi { + private requestFactory: ProductCatalogApiRequestFactory; + private responseProcessor: ProductCatalogApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: ProductCatalogApiRequestFactory, + responseProcessor?: ProductCatalogApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = + requestFactory || new ProductCatalogApiRequestFactory(configuration); + this.responseProcessor = + responseProcessor || new ProductCatalogApiResponseProcessor(); + } + + /** + * 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 param The request object + */ + public listProductCatalogSKUs( + param: ProductCatalogApiListProductCatalogSKUsRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.listProductCatalogSKUs( + param.version, + param.asOfDate, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listProductCatalogSKUs(responseContext); + }); + }); + } +} diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 5d90143066e3..6284ad5d4e3c 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -1235,6 +1235,11 @@ export { ProductAnalyticsApi, } from "./apis/ProductAnalyticsApi"; +export { + ProductCatalogApiListProductCatalogSKUsRequest, + ProductCatalogApi, +} from "./apis/ProductCatalogApi"; + export { RUMApiAggregateRUMEventsRequest, RUMApiCreateRUMApplicationRequest, @@ -7229,6 +7234,17 @@ export { ProductAnalyticsTimeseriesResponseAttributes } from "./models/ProductAn export { ProductAnalyticsTimeseriesResponseData } from "./models/ProductAnalyticsTimeseriesResponseData"; export { ProductAnalyticsTimeseriesResponseType } from "./models/ProductAnalyticsTimeseriesResponseType"; export { ProductAnalyticsUnit } from "./models/ProductAnalyticsUnit"; +export { ProductCatalogSKUAllotment } from "./models/ProductCatalogSKUAllotment"; +export { ProductCatalogSKUDataAttributesResponse } from "./models/ProductCatalogSKUDataAttributesResponse"; +export { ProductCatalogSKUDataResponse } from "./models/ProductCatalogSKUDataResponse"; +export { ProductCatalogSKUOnDemandOption } from "./models/ProductCatalogSKUOnDemandOption"; +export { ProductCatalogSKUPricingTier } from "./models/ProductCatalogSKUPricingTier"; +export { ProductCatalogSKUPricingType } from "./models/ProductCatalogSKUPricingType"; +export { ProductCatalogSKUPricingUnitType } from "./models/ProductCatalogSKUPricingUnitType"; +export { ProductCatalogSKUsAPIVersion } from "./models/ProductCatalogSKUsAPIVersion"; +export { ProductCatalogSKUsResponse } from "./models/ProductCatalogSKUsResponse"; +export { ProductCatalogSKUTieredPricing } from "./models/ProductCatalogSKUTieredPricing"; +export { ProductCatalogSKUType } from "./models/ProductCatalogSKUType"; export { Project } from "./models/Project"; export { ProjectAttributes } from "./models/ProjectAttributes"; export { ProjectColumnsConfig } from "./models/ProjectColumnsConfig"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index b4b099663af6..802229bb7a6e 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -4040,6 +4040,12 @@ import { ProductAnalyticsTimeseriesResponse } from "./ProductAnalyticsTimeseries import { ProductAnalyticsTimeseriesResponseAttributes } from "./ProductAnalyticsTimeseriesResponseAttributes"; import { ProductAnalyticsTimeseriesResponseData } from "./ProductAnalyticsTimeseriesResponseData"; import { ProductAnalyticsUnit } from "./ProductAnalyticsUnit"; +import { ProductCatalogSKUAllotment } from "./ProductCatalogSKUAllotment"; +import { ProductCatalogSKUDataAttributesResponse } from "./ProductCatalogSKUDataAttributesResponse"; +import { ProductCatalogSKUDataResponse } from "./ProductCatalogSKUDataResponse"; +import { ProductCatalogSKUPricingTier } from "./ProductCatalogSKUPricingTier"; +import { ProductCatalogSKUTieredPricing } from "./ProductCatalogSKUTieredPricing"; +import { ProductCatalogSKUsResponse } from "./ProductCatalogSKUsResponse"; import { Project } from "./Project"; import { ProjectAttributes } from "./ProjectAttributes"; import { ProjectColumnsConfig } from "./ProjectColumnsConfig"; @@ -8064,6 +8070,11 @@ const enumsMap: { [key: string]: any[] } = { ProductAnalyticsScalarResponseType: ["scalar_response"], ProductAnalyticsServerSideEventItemType: ["server"], ProductAnalyticsTimeseriesResponseType: ["timeseries_response"], + ProductCatalogSKUOnDemandOption: ["hourly", "monthly"], + ProductCatalogSKUPricingType: ["usage", "percent"], + ProductCatalogSKUPricingUnitType: ["block", "unit"], + ProductCatalogSKUType: ["Sku"], + ProductCatalogSKUsAPIVersion: ["v1"], ProjectFavoriteResourceType: ["project_favorite"], ProjectResourceType: ["project"], ProjectedCostType: ["projected_cost"], @@ -14140,6 +14151,13 @@ const typeMap: { [index: string]: any } = { ProductAnalyticsTimeseriesResponseData: ProductAnalyticsTimeseriesResponseData, ProductAnalyticsUnit: ProductAnalyticsUnit, + ProductCatalogSKUAllotment: ProductCatalogSKUAllotment, + ProductCatalogSKUDataAttributesResponse: + ProductCatalogSKUDataAttributesResponse, + ProductCatalogSKUDataResponse: ProductCatalogSKUDataResponse, + ProductCatalogSKUPricingTier: ProductCatalogSKUPricingTier, + ProductCatalogSKUTieredPricing: ProductCatalogSKUTieredPricing, + ProductCatalogSKUsResponse: ProductCatalogSKUsResponse, Project: Project, ProjectAttributes: ProjectAttributes, ProjectColumnsConfig: ProjectColumnsConfig, diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUAllotment.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUAllotment.ts new file mode 100644 index 000000000000..df414ae2d602 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUAllotment.ts @@ -0,0 +1,85 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A quantity of one SKU that is included with, and consumed before, the billable usage of + * another SKU. + */ +export class ProductCatalogSKUAllotment { + /** + * The code of the SKU that receives the allotment. + */ + "childSkuCode": string; + /** + * The quantity allotted per hour. Fractional for some allotments, and equal to + * `monthly_quantity` for others, depending on how the child SKU meters usage. + */ + "hourlyQuantity": number; + /** + * The quantity allotted per month. + */ + "monthlyQuantity": number; + /** + * The code of the SKU that provides the allotment. Always the code of the SKU the + * allotment is returned under. + */ + "parentSkuCode": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + childSkuCode: { + baseName: "child_sku_code", + type: "string", + required: true, + }, + hourlyQuantity: { + baseName: "hourly_quantity", + type: "number", + required: true, + format: "double", + }, + monthlyQuantity: { + baseName: "monthly_quantity", + type: "number", + required: true, + format: "int64", + }, + parentSkuCode: { + baseName: "parent_sku_code", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ProductCatalogSKUAllotment.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUDataAttributesResponse.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUDataAttributesResponse.ts new file mode 100644 index 000000000000..00e18a936a3c --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUDataAttributesResponse.ts @@ -0,0 +1,149 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { ProductCatalogSKUAllotment } from "./ProductCatalogSKUAllotment"; +import { ProductCatalogSKUOnDemandOption } from "./ProductCatalogSKUOnDemandOption"; +import { ProductCatalogSKUPricingType } from "./ProductCatalogSKUPricingType"; +import { ProductCatalogSKUTieredPricing } from "./ProductCatalogSKUTieredPricing"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The pricing and allotment metadata of a SKU. + */ +export class ProductCatalogSKUDataAttributesResponse { + /** + * 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. + */ + "allotments": Array; + /** + * 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. + */ + "billingDimension": string; + /** + * 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`. + */ + "billingUnits": string | null; + /** + * The ISO-4217 code of the currency the prices are expressed in. + */ + "currency": string; + /** + * The billing frequency applied to on-demand usage of the SKU by default. + */ + "defaultOnDemandOption": ProductCatalogSKUOnDemandOption; + /** + * 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`. + */ + "numberOfUnitsIncludedInPrice": number; + /** + * 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`. + */ + "onDemandListPrice": string | null; + /** + * The tiered pricing applied to on-demand usage of the SKU. `null` when the SKU is priced + * with a single list price instead. + */ + "onDemandTiered": ProductCatalogSKUTieredPricing | null; + /** + * How the SKU is priced. `usage` prices each billable usage unit, and `percent` prices a + * percentage; percent-priced SKUs have no `billing_units`. + */ + "pricingType": ProductCatalogSKUPricingType; + /** + * The human-readable name of the SKU. + */ + "skuName": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + allotments: { + baseName: "allotments", + type: "Array", + required: true, + }, + billingDimension: { + baseName: "billing_dimension", + type: "string", + required: true, + }, + billingUnits: { + baseName: "billing_units", + type: "string", + required: true, + }, + currency: { + baseName: "currency", + type: "string", + required: true, + }, + defaultOnDemandOption: { + baseName: "default_on_demand_option", + type: "ProductCatalogSKUOnDemandOption", + required: true, + }, + numberOfUnitsIncludedInPrice: { + baseName: "number_of_units_included_in_price", + type: "number", + required: true, + format: "int64", + }, + onDemandListPrice: { + baseName: "on_demand_list_price", + type: "string", + required: true, + }, + onDemandTiered: { + baseName: "on_demand_tiered", + type: "ProductCatalogSKUTieredPricing", + required: true, + }, + pricingType: { + baseName: "pricing_type", + type: "ProductCatalogSKUPricingType", + required: true, + }, + skuName: { + baseName: "sku_name", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ProductCatalogSKUDataAttributesResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUDataResponse.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUDataResponse.ts new file mode 100644 index 000000000000..7a0b08fd3824 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUDataResponse.ts @@ -0,0 +1,73 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { ProductCatalogSKUDataAttributesResponse } from "./ProductCatalogSKUDataAttributesResponse"; +import { ProductCatalogSKUType } from "./ProductCatalogSKUType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A SKU and the pricing metadata that applies to it. + */ +export class ProductCatalogSKUDataResponse { + /** + * The pricing and allotment metadata of a SKU. + */ + "attributes": ProductCatalogSKUDataAttributesResponse; + /** + * The code that identifies the SKU. + */ + "id": string; + /** + * The SKU resource type. + */ + "type": ProductCatalogSKUType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "ProductCatalogSKUDataAttributesResponse", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "ProductCatalogSKUType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ProductCatalogSKUDataResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUOnDemandOption.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUOnDemandOption.ts new file mode 100644 index 000000000000..f512757b2147 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUOnDemandOption.ts @@ -0,0 +1,18 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The billing frequency applied to on-demand usage of the SKU by default. + */ + +export type ProductCatalogSKUOnDemandOption = + | typeof HOURLY + | typeof MONTHLY + | UnparsedObject; +export const HOURLY = "hourly"; +export const MONTHLY = "monthly"; diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUPricingTier.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUPricingTier.ts new file mode 100644 index 000000000000..da7b0d04419f --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUPricingTier.ts @@ -0,0 +1,85 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { ProductCatalogSKUPricingUnitType } from "./ProductCatalogSKUPricingUnitType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A usage range and the price that applies to usage falling inside it. + */ +export class ProductCatalogSKUPricingTier { + /** + * The exclusive upper bound of the usage range the tier prices. `null` on the final + * tier, which is unbounded. + */ + "maxUsageQuantity": number | null; + /** + * The inclusive lower bound of the usage range the tier prices. + */ + "minUsageQuantity": number; + /** + * 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`. + */ + "price": string; + /** + * Whether the tier's price applies per unit of usage or to a block of usage. + */ + "pricingUnitType": ProductCatalogSKUPricingUnitType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + maxUsageQuantity: { + baseName: "max_usage_quantity", + type: "number", + required: true, + format: "int64", + }, + minUsageQuantity: { + baseName: "min_usage_quantity", + type: "number", + required: true, + format: "int64", + }, + price: { + baseName: "price", + type: "string", + required: true, + }, + pricingUnitType: { + baseName: "pricing_unit_type", + type: "ProductCatalogSKUPricingUnitType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ProductCatalogSKUPricingTier.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUPricingType.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUPricingType.ts new file mode 100644 index 000000000000..d1242f1df221 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUPricingType.ts @@ -0,0 +1,19 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * How the SKU is priced. `usage` prices each billable usage unit, and `percent` prices a + * percentage; percent-priced SKUs have no `billing_units`. + */ + +export type ProductCatalogSKUPricingType = + | typeof USAGE + | typeof PERCENT + | UnparsedObject; +export const USAGE = "usage"; +export const PERCENT = "percent"; diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUPricingUnitType.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUPricingUnitType.ts new file mode 100644 index 000000000000..2d32ddb1f0fa --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUPricingUnitType.ts @@ -0,0 +1,18 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Whether the tier's price applies per unit of usage or to a block of usage. + */ + +export type ProductCatalogSKUPricingUnitType = + | typeof BLOCK + | typeof UNIT + | UnparsedObject; +export const BLOCK = "block"; +export const UNIT = "unit"; diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUTieredPricing.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUTieredPricing.ts new file mode 100644 index 000000000000..235ab26c81de --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUTieredPricing.ts @@ -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 2020-Present Datadog, Inc. + */ +import { ProductCatalogSKUPricingTier } from "./ProductCatalogSKUPricingTier"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The tiered pricing applied to on-demand usage of the SKU. `null` when the SKU is priced + * with a single list price instead. + */ +export class ProductCatalogSKUTieredPricing { + /** + * The pricing tiers, ordered by ascending usage quantity. + */ + "tiers": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + tiers: { + baseName: "tiers", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ProductCatalogSKUTieredPricing.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUType.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUType.ts new file mode 100644 index 000000000000..220edb35f654 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUType.ts @@ -0,0 +1,14 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The SKU resource type. + */ + +export type ProductCatalogSKUType = typeof SKU | UnparsedObject; +export const SKU = "Sku"; diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUsAPIVersion.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUsAPIVersion.ts new file mode 100644 index 000000000000..7ae101c361c4 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUsAPIVersion.ts @@ -0,0 +1,14 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The version of the product catalog contract to return. + */ + +export type ProductCatalogSKUsAPIVersion = typeof V1 | UnparsedObject; +export const V1 = "v1"; diff --git a/packages/datadog-api-client-v2/models/ProductCatalogSKUsResponse.ts b/packages/datadog-api-client-v2/models/ProductCatalogSKUsResponse.ts new file mode 100644 index 000000000000..2bd1e1e8100d --- /dev/null +++ b/packages/datadog-api-client-v2/models/ProductCatalogSKUsResponse.ts @@ -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 2020-Present Datadog, Inc. + */ +import { ProductCatalogSKUDataResponse } from "./ProductCatalogSKUDataResponse"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing the generally available SKUs and their pricing metadata. + */ +export class ProductCatalogSKUsResponse { + /** + * The generally available SKUs, sorted by SKU code in ascending order. + */ + "data": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ProductCatalogSKUsResponse.attributeTypeMap; + } + + public constructor() {} +}