Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
379 changes: 379 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions examples/v2/product-catalog/ListProductCatalogSKUs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
List SKUs returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.product_catalog_api import ProductCatalogApi
from datadog_api_client.v2.model.product_catalog_sk_us_api_version import ProductCatalogSKUsAPIVersion

configuration = Configuration()
configuration.unstable_operations["list_product_catalog_sk_us"] = True
with ApiClient(configuration) as api_client:
api_instance = ProductCatalogApi(api_client)
response = api_instance.list_product_catalog_sk_us(
version=ProductCatalogSKUsAPIVersion.V1,
)

print(response)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ def __init__(
"v2.query_event_filtered_users": False,
"v2.query_users": False,
"v2.update_connection": False,
"v2.list_product_catalog_sk_us": False,
"v2.get_pruned_trace_by_id": False,
"v2.get_trace_by_id": False,
"v2.get_asm_service_by_name": False,
Expand Down
93 changes: 93 additions & 0 deletions src/datadog_api_client/v2/api/product_catalog_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Any, Dict, Union

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
from datadog_api_client.model_utils import (
datetime,
UnsetType,
unset,
)
from datadog_api_client.v2.model.product_catalog_sk_us_response import ProductCatalogSKUsResponse
from datadog_api_client.v2.model.product_catalog_sk_us_api_version import ProductCatalogSKUsAPIVersion


class ProductCatalogApi:
"""
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.
"""

def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient(Configuration())
self.api_client = api_client

self._list_product_catalog_sk_us_endpoint = _Endpoint(
settings={
"response_type": (ProductCatalogSKUsResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/product-catalog/skus",
"operation_id": "list_product_catalog_sk_us",
"http_method": "GET",
"version": "v2",
},
params_map={
"version": {
"required": True,
"openapi_types": (ProductCatalogSKUsAPIVersion,),
"attribute": "version",
"location": "query",
},
"as_of_date": {
"openapi_types": (datetime,),
"attribute": "as_of_date",
"location": "query",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

def list_product_catalog_sk_us(
self,
version: ProductCatalogSKUsAPIVersion,
*,
as_of_date: Union[datetime, UnsetType] = unset,
) -> ProductCatalogSKUsResponse:
"""List SKUs.

Get every generally available Datadog SKU, with the pricing and allotment metadata that
applies to it, for the Datadog site serving the request. A SKU is generally available
when it is billed through a metered commitment or through automatic billing; SKUs in any
other phase are not returned.

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

Each SKU is a separate resource in ``data`` , identified by its SKU code, and sorted by
that code in ascending order. The whole catalog is returned in a single response, so
this endpoint is not paginated.

:param version: The version of the product catalog contract to return. ``v1`` is the latest.
:type version: ProductCatalogSKUsAPIVersion
:param as_of_date: 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 as_of_date: datetime, optional
:rtype: ProductCatalogSKUsResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["version"] = version

if as_of_date is not unset:
kwargs["as_of_date"] = as_of_date

return self._list_product_catalog_sk_us_endpoint.call_with_http_info(**kwargs)
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
from datadog_api_client.v2.api.powerpack_api import PowerpackApi
from datadog_api_client.v2.api.processes_api import ProcessesApi
from datadog_api_client.v2.api.product_analytics_api import ProductAnalyticsApi
from datadog_api_client.v2.api.product_catalog_api import ProductCatalogApi
from datadog_api_client.v2.api.rum_api import RUMApi
from datadog_api_client.v2.api.rum_config_api import RUMConfigApi
from datadog_api_client.v2.api.rum_insights_api import RUMInsightsApi
Expand Down Expand Up @@ -242,6 +243,7 @@
"PowerpackApi",
"ProcessesApi",
"ProductAnalyticsApi",
"ProductCatalogApi",
"RUMApi",
"RUMConfigApi",
"RUMInsightsApi",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class ProductCatalogSKUsAPIVersion(ModelSimple):
"""
The version of the product catalog contract to return.

:param value: If omitted defaults to "v1". Must be one of ["v1"].
:type value: str
"""

allowed_values = {
"v1",
}
V1: ClassVar["ProductCatalogSKUsAPIVersion"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


ProductCatalogSKUsAPIVersion.V1 = ProductCatalogSKUsAPIVersion("v1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import List, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.product_catalog_sku_data_response import ProductCatalogSKUDataResponse


class ProductCatalogSKUsResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.product_catalog_sku_data_response import ProductCatalogSKUDataResponse

return {
"data": ([ProductCatalogSKUDataResponse],),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: List[ProductCatalogSKUDataResponse], **kwargs):
"""
Response containing the generally available SKUs and their pricing metadata.

:param data: The generally available SKUs, sorted by SKU code in ascending order.
:type data: [ProductCatalogSKUDataResponse]
"""
super().__init__(kwargs)

self_.data = data
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


class ProductCatalogSKUAllotment(ModelNormal):
@cached_property
def openapi_types(_):
return {
"child_sku_code": (str,),
"hourly_quantity": (float,),
"monthly_quantity": (int,),
"parent_sku_code": (str,),
}

attribute_map = {
"child_sku_code": "child_sku_code",
"hourly_quantity": "hourly_quantity",
"monthly_quantity": "monthly_quantity",
"parent_sku_code": "parent_sku_code",
}

def __init__(
self_, child_sku_code: str, hourly_quantity: float, monthly_quantity: int, parent_sku_code: str, **kwargs
):
"""
A quantity of one SKU that is included with, and consumed before, the billable usage of
another SKU.

:param child_sku_code: The code of the SKU that receives the allotment.
:type child_sku_code: str

:param hourly_quantity: The quantity allotted per hour. Fractional for some allotments, and equal to
``monthly_quantity`` for others, depending on how the child SKU meters usage.
:type hourly_quantity: float

:param monthly_quantity: The quantity allotted per month.
:type monthly_quantity: int

:param parent_sku_code: The code of the SKU that provides the allotment. Always the code of the SKU the
allotment is returned under.
:type parent_sku_code: str
"""
super().__init__(kwargs)

self_.child_sku_code = child_sku_code
self_.hourly_quantity = hourly_quantity
self_.monthly_quantity = monthly_quantity
self_.parent_sku_code = parent_sku_code
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import List, Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
none_type,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.product_catalog_sku_allotment import ProductCatalogSKUAllotment
from datadog_api_client.v2.model.product_catalog_sku_on_demand_option import ProductCatalogSKUOnDemandOption
from datadog_api_client.v2.model.product_catalog_sku_tiered_pricing import ProductCatalogSKUTieredPricing
from datadog_api_client.v2.model.product_catalog_sku_pricing_type import ProductCatalogSKUPricingType


class ProductCatalogSKUDataAttributesResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.product_catalog_sku_allotment import ProductCatalogSKUAllotment
from datadog_api_client.v2.model.product_catalog_sku_on_demand_option import ProductCatalogSKUOnDemandOption
from datadog_api_client.v2.model.product_catalog_sku_tiered_pricing import ProductCatalogSKUTieredPricing
from datadog_api_client.v2.model.product_catalog_sku_pricing_type import ProductCatalogSKUPricingType

return {
"allotments": ([ProductCatalogSKUAllotment],),
"billing_dimension": (str,),
"billing_units": (str, none_type),
"currency": (str,),
"default_on_demand_option": (ProductCatalogSKUOnDemandOption,),
"number_of_units_included_in_price": (int,),
"on_demand_list_price": (str, none_type),
"on_demand_tiered": (ProductCatalogSKUTieredPricing,),
"pricing_type": (ProductCatalogSKUPricingType,),
"sku_name": (str,),
}

attribute_map = {
"allotments": "allotments",
"billing_dimension": "billing_dimension",
"billing_units": "billing_units",
"currency": "currency",
"default_on_demand_option": "default_on_demand_option",
"number_of_units_included_in_price": "number_of_units_included_in_price",
"on_demand_list_price": "on_demand_list_price",
"on_demand_tiered": "on_demand_tiered",
"pricing_type": "pricing_type",
"sku_name": "sku_name",
}

def __init__(
self_,
allotments: List[ProductCatalogSKUAllotment],
billing_dimension: str,
billing_units: Union[str, none_type],
currency: str,
default_on_demand_option: ProductCatalogSKUOnDemandOption,
number_of_units_included_in_price: int,
on_demand_list_price: Union[str, none_type],
on_demand_tiered: Union[ProductCatalogSKUTieredPricing, none_type],
pricing_type: ProductCatalogSKUPricingType,
sku_name: str,
**kwargs,
):
"""
The pricing and allotment metadata of a SKU.

:param allotments: 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.
:type allotments: [ProductCatalogSKUAllotment]

:param billing_dimension: 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.
:type billing_dimension: str

:param billing_units: 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``.
:type billing_units: str, none_type

:param currency: The ISO-4217 code of the currency the prices are expressed in.
:type currency: str

:param default_on_demand_option: The billing frequency applied to on-demand usage of the SKU by default.
:type default_on_demand_option: ProductCatalogSKUOnDemandOption

:param number_of_units_included_in_price: 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``.
:type number_of_units_included_in_price: int

:param on_demand_list_price: 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``.
:type on_demand_list_price: str, none_type

:param on_demand_tiered: The tiered pricing applied to on-demand usage of the SKU. ``null`` when the SKU is priced
with a single list price instead.
:type on_demand_tiered: ProductCatalogSKUTieredPricing, none_type

:param pricing_type: How the SKU is priced. ``usage`` prices each billable usage unit, and ``percent`` prices a
percentage; percent-priced SKUs have no ``billing_units``.
:type pricing_type: ProductCatalogSKUPricingType

:param sku_name: The human-readable name of the SKU.
:type sku_name: str
"""
super().__init__(kwargs)

self_.allotments = allotments
self_.billing_dimension = billing_dimension
self_.billing_units = billing_units
self_.currency = currency
self_.default_on_demand_option = default_on_demand_option
self_.number_of_units_included_in_price = number_of_units_included_in_price
self_.on_demand_list_price = on_demand_list_price
self_.on_demand_tiered = on_demand_tiered
self_.pricing_type = pricing_type
self_.sku_name = sku_name
Loading
Loading