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/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/README.md b/packages/datadog-api-client/README.md index cb048f3d9d71..4b9e7b471f2e 100644 --- a/packages/datadog-api-client/README.md +++ b/packages/datadog-api-client/README.md @@ -449,6 +449,7 @@ apiInstance | Powerpack | @datadog/datadog-api-client-powerpack | [README.md](../../services/powerpack/README.md) | | Processes | @datadog/datadog-api-client-processes | [README.md](../../services/processes/README.md) | | Product Analytics | @datadog/datadog-api-client-product-analytics | [README.md](../../services/product-analytics/README.md) | +| Product Catalog | @datadog/datadog-api-client-product-catalog | [README.md](../../services/product-catalog/README.md) | | Reference Tables | @datadog/datadog-api-client-reference-tables | [README.md](../../services/reference-tables/README.md) | | Report Schedules | @datadog/datadog-api-client-report-schedules | [README.md](../../services/report-schedules/README.md) | | Reporting And Sharing | @datadog/datadog-api-client-reporting-and-sharing | [README.md](../../services/reporting-and-sharing/README.md) | diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index 270d6f387a22..d1dedd3fb160 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -14668,6 +14668,17 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "ListConnectionsResponse", }, + "ProductCatalogApi.V2.ListProductCatalogSKUs": { + version: { + type: "ProductCatalogSKUsAPIVersion", + format: "", + }, + asOfDate: { + type: "Date", + format: "date", + }, + operationResponseType: "ProductCatalogSKUsResponse", + }, "APMTraceApi.V2.GetPrunedTraceByID": { traceId: { type: "string", diff --git a/services/product_catalog/.yarnrc.yml b/services/product_catalog/.yarnrc.yml new file mode 100644 index 000000000000..3186f3f0795a --- /dev/null +++ b/services/product_catalog/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/services/product_catalog/README.md b/services/product_catalog/README.md new file mode 100644 index 000000000000..41feecc540af --- /dev/null +++ b/services/product_catalog/README.md @@ -0,0 +1,45 @@ +# @datadog/datadog-api-client-product-catalog + +## 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. + +## Navigation + +- [Installation](#installation) +- [Getting Started](#getting-started) + +## Installation + +```sh +# NPM +npm install @datadog/datadog-api-client-product-catalog +# Yarn +yarn add @datadog/datadog-api-client-product-catalog +``` + +## Getting Started +```ts +import { createConfiguration } from "@datadog/datadog-api-client"; +import { ProductCatalogApiV2 } from "@datadog/datadog-api-client-product-catalog"; +import { v2 } from "@datadog/datadog-api-client-product-catalog"; + +const configuration = createConfiguration(); +// Enable unstable operations +const configurationOpts = { + unstableOperations: { + "ProductCatalogApi.v2.listProductCatalogSKUs": true + } +} + +const configuration = createConfiguration(configurationOpts); +const apiInstance = new ProductCatalogApiV2(configuration); +const params = {/* parameters */}; + +apiInstance.listProductCatalogSKUs(params).then((data) => { + console.log("API called successfully. Returned data: " + JSON.stringify(data)); +}).catch((error) => { + console.error("Error calling API: " + error); +}); +``` \ No newline at end of file diff --git a/services/product_catalog/package.json b/services/product_catalog/package.json new file mode 100644 index 000000000000..a1f00816beb5 --- /dev/null +++ b/services/product_catalog/package.json @@ -0,0 +1,43 @@ +{ + "name": "@datadog/datadog-api-client-product-catalog", + "description": "", + "author": "", + "keywords": [ + "api", + "fetch", + "typescript" + ], + "license": "Apache-2.0", + "licenses": [ + { + "type": "Apache-2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/DataDog/datadog-api-client-typescript.git", + "directory": "services/product-catalog" + }, + "files": [ + "dist/**/*" + ], + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts": { + "prepack": "yarn workspace @datadog/datadog-api-client build && yarn build", + "build": "yarn generate-version-files && tsc", + "generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts" + }, + "dependencies": { + "@datadog/datadog-api-client": "^2.0.0-beta.2" + }, + "devDependencies": { + "typescript": "5.8.3" + }, + "engines": { + "node": ">=18.0.0" + }, + "version": "0.0.1", + "packageManager": "yarn@4.9.1" +} diff --git a/services/product_catalog/src/index.ts b/services/product_catalog/src/index.ts new file mode 100644 index 000000000000..512edefcf6bf --- /dev/null +++ b/services/product_catalog/src/index.ts @@ -0,0 +1,3 @@ +export * as v2 from "./v2"; + +export { ProductCatalogApi as ProductCatalogApiV2 } from "./v2/ProductCatalogApi"; diff --git a/services/product_catalog/src/v2/ProductCatalogApi.ts b/services/product_catalog/src/v2/ProductCatalogApi.ts new file mode 100644 index 000000000000..d932a1dba7a4 --- /dev/null +++ b/services/product_catalog/src/v2/ProductCatalogApi.ts @@ -0,0 +1,262 @@ +import { + ApiException, + BaseAPIRequestFactory, + BaseServerConfiguration, + buildUserAgent, + Configuration, + createConfiguration, + deserialize, + getPreferredMediaType, + HttpMethod, + isBrowser, + logger, + normalizeMediaType, + parse, + RequiredError, + RequestContext, + ResponseContext, + serialize, + ServerConfiguration, + stringify, + applySecurityAuthentication, +} from "@datadog/datadog-api-client"; + +import { TypingInfo } from "./models/TypingInfo"; +import { APIErrorResponse } from "./models/APIErrorResponse"; +import { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; +import { ProductCatalogSKUsAPIVersion } from "./models/ProductCatalogSKUsAPIVersion"; +import { ProductCatalogSKUsResponse } from "./models/ProductCatalogSKUsResponse"; +import { version } from "../version"; + +export class ProductCatalogApiRequestFactory extends BaseAPIRequestFactory { + public userAgent: string | undefined; + + public constructor(configuration: Configuration) { + super(configuration); + if (!isBrowser) { + this.userAgent = buildUserAgent("product-catalog", version); + } + } + public async listProductCatalogSKUs( + version: ProductCatalogSKUsAPIVersion, + asOfDate?: Date, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["ProductCatalogApi.v2.listProductCatalogSKUs"] + ) { + throw new Error( + "Unstable operation 'listProductCatalogSKUs' is disabled. Enable it by setting `configuration.unstableOperations['ProductCatalogApi.v2.listProductCatalogSKUs'] = true`", + ); + } + + // 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 { server, overrides } = _config.getServerAndOverrides( + "ProductCatalogApi.v2.listProductCatalogSKUs", + ProductCatalogApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Query Params + if (version !== undefined) { + requestContext.setQueryParam( + "version", + serialize(version, TypingInfo, "ProductCatalogSKUsAPIVersion", ""), + "", + ); + } + if (asOfDate !== undefined) { + requestContext.setQueryParam( + "as_of_date", + serialize(asOfDate, TypingInfo, "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 = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: ProductCatalogSKUsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ProductCatalogSKUsResponse", + ) as ProductCatalogSKUsResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "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 = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "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 = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "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; + + static operationServers: { [key: string]: BaseServerConfiguration[] } = {}; + + public constructor( + configuration?: Configuration, + requestFactory?: ProductCatalogApiRequestFactory, + responseProcessor?: ProductCatalogApiResponseProcessor, + ) { + this.configuration = configuration || createConfiguration(); + this.requestFactory = + requestFactory || new ProductCatalogApiRequestFactory(this.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/services/product_catalog/src/v2/index.ts b/services/product_catalog/src/v2/index.ts new file mode 100644 index 000000000000..b30d483f85cd --- /dev/null +++ b/services/product_catalog/src/v2/index.ts @@ -0,0 +1,20 @@ +export { + ProductCatalogApiListProductCatalogSKUsRequest, + ProductCatalogApi, +} from "./ProductCatalogApi"; + +export { APIErrorResponse } from "./models/APIErrorResponse"; +export { JSONAPIErrorItem } from "./models/JSONAPIErrorItem"; +export { JSONAPIErrorItemSource } from "./models/JSONAPIErrorItemSource"; +export { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; +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"; diff --git a/services/product_catalog/src/v2/models/APIErrorResponse.ts b/services/product_catalog/src/v2/models/APIErrorResponse.ts new file mode 100644 index 000000000000..58d6c35b80f0 --- /dev/null +++ b/services/product_catalog/src/v2/models/APIErrorResponse.ts @@ -0,0 +1,45 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * API error response. + */ +export class APIErrorResponse { + /** + * A list of errors. + */ + "errors": 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 = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return APIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/product_catalog/src/v2/models/JSONAPIErrorItem.ts b/services/product_catalog/src/v2/models/JSONAPIErrorItem.ts new file mode 100644 index 000000000000..a1ca45cd463c --- /dev/null +++ b/services/product_catalog/src/v2/models/JSONAPIErrorItem.ts @@ -0,0 +1,78 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; + +/** + * API error response body + */ +export class JSONAPIErrorItem { + /** + * A human-readable explanation specific to this occurrence of the error. + */ + "detail"?: string; + /** + * Non-standard meta-information about the error + */ + "meta"?: { [key: string]: any }; + /** + * References to the source of the error. + */ + "source"?: JSONAPIErrorItemSource; + /** + * Status code of the response. + */ + "status"?: string; + /** + * Short human-readable summary of the error. + */ + "title"?: 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 = { + detail: { + baseName: "detail", + type: "string", + }, + meta: { + baseName: "meta", + type: "{ [key: string]: any; }", + }, + source: { + baseName: "source", + type: "JSONAPIErrorItemSource", + }, + status: { + baseName: "status", + type: "string", + }, + title: { + baseName: "title", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/product_catalog/src/v2/models/JSONAPIErrorItemSource.ts b/services/product_catalog/src/v2/models/JSONAPIErrorItemSource.ts new file mode 100644 index 000000000000..5889114315fa --- /dev/null +++ b/services/product_catalog/src/v2/models/JSONAPIErrorItemSource.ts @@ -0,0 +1,60 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * References to the source of the error. + */ +export class JSONAPIErrorItemSource { + /** + * A string indicating the name of a single request header which caused the error. + */ + "header"?: string; + /** + * A string indicating which URI query parameter caused the error. + */ + "parameter"?: string; + /** + * A JSON pointer to the value in the request document that caused the error. + */ + "pointer"?: 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 = { + header: { + baseName: "header", + type: "string", + }, + parameter: { + baseName: "parameter", + type: "string", + }, + pointer: { + baseName: "pointer", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorItemSource.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/product_catalog/src/v2/models/JSONAPIErrorResponse.ts b/services/product_catalog/src/v2/models/JSONAPIErrorResponse.ts new file mode 100644 index 000000000000..68aa04ffc27b --- /dev/null +++ b/services/product_catalog/src/v2/models/JSONAPIErrorResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; + +/** + * API error response. + */ +export class JSONAPIErrorResponse { + /** + * A list of errors. + */ + "errors": 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 = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/product_catalog/src/v2/models/ProductCatalogSKUAllotment.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUAllotment.ts new file mode 100644 index 000000000000..6f1342a08a70 --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUAllotment.ts @@ -0,0 +1,77 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * 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/services/product_catalog/src/v2/models/ProductCatalogSKUDataAttributesResponse.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUDataAttributesResponse.ts new file mode 100644 index 000000000000..0cd47ff768ce --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUDataAttributesResponse.ts @@ -0,0 +1,142 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ProductCatalogSKUAllotment } from "./ProductCatalogSKUAllotment"; +import { ProductCatalogSKUOnDemandOption } from "./ProductCatalogSKUOnDemandOption"; +import { ProductCatalogSKUPricingType } from "./ProductCatalogSKUPricingType"; +import { ProductCatalogSKUTieredPricing } from "./ProductCatalogSKUTieredPricing"; + +/** + * 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/services/product_catalog/src/v2/models/ProductCatalogSKUDataResponse.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUDataResponse.ts new file mode 100644 index 000000000000..41efcc03fd5c --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUDataResponse.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ProductCatalogSKUDataAttributesResponse } from "./ProductCatalogSKUDataAttributesResponse"; +import { ProductCatalogSKUType } from "./ProductCatalogSKUType"; + +/** + * 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/services/product_catalog/src/v2/models/ProductCatalogSKUOnDemandOption.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUOnDemandOption.ts new file mode 100644 index 000000000000..ebacc69567f0 --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUOnDemandOption.ts @@ -0,0 +1,11 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * 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/services/product_catalog/src/v2/models/ProductCatalogSKUPricingTier.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUPricingTier.ts new file mode 100644 index 000000000000..b5a60361026a --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUPricingTier.ts @@ -0,0 +1,78 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ProductCatalogSKUPricingUnitType } from "./ProductCatalogSKUPricingUnitType"; + +/** + * 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/services/product_catalog/src/v2/models/ProductCatalogSKUPricingType.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUPricingType.ts new file mode 100644 index 000000000000..5128c74a5a08 --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUPricingType.ts @@ -0,0 +1,12 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * 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/services/product_catalog/src/v2/models/ProductCatalogSKUPricingUnitType.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUPricingUnitType.ts new file mode 100644 index 000000000000..affbd6a4a403 --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUPricingUnitType.ts @@ -0,0 +1,11 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * 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/services/product_catalog/src/v2/models/ProductCatalogSKUTieredPricing.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUTieredPricing.ts new file mode 100644 index 000000000000..60594fc6b672 --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUTieredPricing.ts @@ -0,0 +1,48 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ProductCatalogSKUPricingTier } from "./ProductCatalogSKUPricingTier"; + +/** + * 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/services/product_catalog/src/v2/models/ProductCatalogSKUType.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUType.ts new file mode 100644 index 000000000000..9223cffceafc --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The SKU resource type. + */ +export type ProductCatalogSKUType = typeof SKU | UnparsedObject; +export const SKU = "Sku"; diff --git a/services/product_catalog/src/v2/models/ProductCatalogSKUsAPIVersion.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUsAPIVersion.ts new file mode 100644 index 000000000000..de640c98bcbb --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUsAPIVersion.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The version of the product catalog contract to return. + */ +export type ProductCatalogSKUsAPIVersion = typeof V1 | UnparsedObject; +export const V1 = "v1"; diff --git a/services/product_catalog/src/v2/models/ProductCatalogSKUsResponse.ts b/services/product_catalog/src/v2/models/ProductCatalogSKUsResponse.ts new file mode 100644 index 000000000000..44c52bc5414a --- /dev/null +++ b/services/product_catalog/src/v2/models/ProductCatalogSKUsResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ProductCatalogSKUDataResponse } from "./ProductCatalogSKUDataResponse"; + +/** + * 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() {} +} diff --git a/services/product_catalog/src/v2/models/TypingInfo.ts b/services/product_catalog/src/v2/models/TypingInfo.ts new file mode 100644 index 000000000000..04d973ced096 --- /dev/null +++ b/services/product_catalog/src/v2/models/TypingInfo.ts @@ -0,0 +1,36 @@ +import { ModelTypingInfo } from "@datadog/datadog-api-client"; + +import { APIErrorResponse } from "./APIErrorResponse"; +import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; +import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; +import { JSONAPIErrorResponse } from "./JSONAPIErrorResponse"; +import { ProductCatalogSKUAllotment } from "./ProductCatalogSKUAllotment"; +import { ProductCatalogSKUDataAttributesResponse } from "./ProductCatalogSKUDataAttributesResponse"; +import { ProductCatalogSKUDataResponse } from "./ProductCatalogSKUDataResponse"; +import { ProductCatalogSKUPricingTier } from "./ProductCatalogSKUPricingTier"; +import { ProductCatalogSKUTieredPricing } from "./ProductCatalogSKUTieredPricing"; +import { ProductCatalogSKUsResponse } from "./ProductCatalogSKUsResponse"; + +export const TypingInfo: ModelTypingInfo = { + enumsMap: { + ProductCatalogSKUOnDemandOption: ["hourly", "monthly"], + ProductCatalogSKUPricingType: ["usage", "percent"], + ProductCatalogSKUPricingUnitType: ["block", "unit"], + ProductCatalogSKUType: ["Sku"], + ProductCatalogSKUsAPIVersion: ["v1"], + }, + oneOfMap: {}, + typeMap: { + APIErrorResponse: APIErrorResponse, + JSONAPIErrorItem: JSONAPIErrorItem, + JSONAPIErrorItemSource: JSONAPIErrorItemSource, + JSONAPIErrorResponse: JSONAPIErrorResponse, + ProductCatalogSKUAllotment: ProductCatalogSKUAllotment, + ProductCatalogSKUDataAttributesResponse: + ProductCatalogSKUDataAttributesResponse, + ProductCatalogSKUDataResponse: ProductCatalogSKUDataResponse, + ProductCatalogSKUPricingTier: ProductCatalogSKUPricingTier, + ProductCatalogSKUTieredPricing: ProductCatalogSKUTieredPricing, + ProductCatalogSKUsResponse: ProductCatalogSKUsResponse, + }, +}; diff --git a/services/product_catalog/tsconfig.json b/services/product_catalog/tsconfig.json new file mode 100644 index 000000000000..d6c32bfb893c --- /dev/null +++ b/services/product_catalog/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "strict": true, + /* Basic Options */ + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + + "esModuleInterop": true, + "resolveJsonModule": true, + + "noImplicitAny": true, + "noImplicitThis": true, + + /* Additional Checks */ + "noUnusedLocals": false /* Report errors on unused locals. */, // TODO: reenable (unused imports!) + "noUnusedParameters": false /* Report errors on unused parameters. */, // TODO: set to true again + "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, + "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, + + "sourceMap": true, + "outDir": "./dist", + "lib": ["es6", "es7"] + }, + "exclude": ["dist", "node_modules", "tests"], + "include": ["src"] +} diff --git a/yarn.lock b/yarn.lock index de2d0fd2410d..3af632f9f3b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1225,6 +1225,15 @@ __metadata: languageName: unknown linkType: soft +"@datadog/datadog-api-client-product-catalog@workspace:services/product_catalog": + version: 0.0.0-use.local + resolution: "@datadog/datadog-api-client-product-catalog@workspace:services/product_catalog" + dependencies: + "@datadog/datadog-api-client": "npm:^2.0.0-beta.2" + typescript: "npm:5.8.3" + languageName: unknown + linkType: soft + "@datadog/datadog-api-client-reference-tables@workspace:services/reference_tables": version: 0.0.0-use.local resolution: "@datadog/datadog-api-client-reference-tables@workspace:services/reference_tables"