Skip to content

Commit

Permalink
Regenerate client from commit f39beecd of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Nov 15, 2023
1 parent 6cf238b commit 786489a
Show file tree
Hide file tree
Showing 11 changed files with 400 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-11-14 15:18:19.873863",
"spec_repo_commit": "b95546fe"
"regenerated": "2023-11-15 13:47:31.744350",
"spec_repo_commit": "f39beecd"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-11-14 15:18:19.888396",
"spec_repo_commit": "b95546fe"
"regenerated": "2023-11-15 13:47:31.784212",
"spec_repo_commit": "f39beecd"
}
}
}
98 changes: 98 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11747,6 +11747,53 @@ components:
type: string
x-enum-varnames:
- PROCESS
ProjectedCost:
description: Projected Cost data.
properties:
attributes:
$ref: '#/components/schemas/ProjectedCostAttributes'
id:
description: Unique ID of the response.
type: string
type:
$ref: '#/components/schemas/CostByOrgType'
type: object
ProjectedCostAttributes:
description: Projected Cost attributes data.
properties:
charges:
description: List of charges data reported for the requested month.
items:
$ref: '#/components/schemas/ChargebackBreakdown'
type: array
date:
description: The month requested.
format: date-time
type: string
org_name:
description: The organization name.
type: string
projected_total_cost:
description: The total projected cost of products for the month.
format: double
type: number
public_id:
description: The organization public ID.
type: string
region:
description: The region of the Datadog instance that the organization belongs
to.
type: string
type: object
ProjectedCostResponse:
description: Projected Cost response.
properties:
data:
description: Response containing Projected Cost.
items:
$ref: '#/components/schemas/ProjectedCost'
type: array
type: object
QueryFormula:
description: A formula for calculation based on one or more queries.
properties:
Expand Down Expand Up @@ -29935,6 +29982,57 @@ paths:
summary: Get hourly usage for observability pipelines
tags:
- Usage Metering
/api/v2/usage/projected_cost:
get:
description: 'Get projected cost across multi-org and single root-org accounts.

Projected cost data is only available for the current month and becomes available
around the 12th of the month.

This endpoint requires the usage_read authorization scope.'
operationId: GetProjectedCost
parameters:
- description: String to specify whether cost is broken down at a parent-org
level or at the sub-org level. Available views are `summary` and `sub-org`.
Defaults to `summary`.
in: query
name: view
required: false
schema:
type: string
responses:
'200':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/ProjectedCostResponse'
description: OK
'400':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
'403':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden - User is not authorized
'429':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Too many requests
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- usage_read
summary: Get projected cost across your account
tags:
- Usage Metering
/api/v2/user_invitations:
post:
description: Sends emails to one or more users inviting them to join the organization.
Expand Down
21 changes: 21 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5125,6 +5125,27 @@ process\_summary\_type
:members:
:show-inheritance:

projected\_cost
---------------

.. automodule:: datadog_api_client.v2.model.projected_cost
:members:
:show-inheritance:

projected\_cost\_attributes
---------------------------

.. automodule:: datadog_api_client.v2.model.projected_cost_attributes
:members:
:show-inheritance:

projected\_cost\_response
-------------------------

.. automodule:: datadog_api_client.v2.model.projected_cost_response
:members:
:show-inheritance:

query\_formula
--------------

Expand Down
15 changes: 15 additions & 0 deletions examples/v2/usage-metering/GetProjectedCost.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Get projected cost across your account returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = UsageMeteringApi(api_client)
response = api_instance.get_projected_cost(
view="sub-org",
)

print(response)
44 changes: 44 additions & 0 deletions src/datadog_api_client/v2/api/usage_metering_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from datadog_api_client.v2.model.hourly_usage_response import HourlyUsageResponse
from datadog_api_client.v2.model.usage_lambda_traced_invocations_response import UsageLambdaTracedInvocationsResponse
from datadog_api_client.v2.model.usage_observability_pipelines_response import UsageObservabilityPipelinesResponse
from datadog_api_client.v2.model.projected_cost_response import ProjectedCostResponse


class UsageMeteringApi:
Expand Down Expand Up @@ -207,6 +208,28 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._get_projected_cost_endpoint = _Endpoint(
settings={
"response_type": (ProjectedCostResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/usage/projected_cost",
"operation_id": "get_projected_cost",
"http_method": "GET",
"version": "v2",
},
params_map={
"view": {
"openapi_types": (str,),
"attribute": "view",
"location": "query",
},
},
headers_map={
"accept": ["application/json;datetime-format=rfc3339"],
},
api_client=api_client,
)

self._get_usage_application_security_monitoring_endpoint = _Endpoint(
settings={
"response_type": (UsageApplicationSecurityMonitoringResponse,),
Expand Down Expand Up @@ -465,6 +488,27 @@ def get_hourly_usage(

return self._get_hourly_usage_endpoint.call_with_http_info(**kwargs)

def get_projected_cost(
self,
*,
view: Union[str, UnsetType] = unset,
) -> ProjectedCostResponse:
"""Get projected cost across your account.
Get projected cost across multi-org and single root-org accounts.
Projected cost data is only available for the current month and becomes available around the 12th of the month.
This endpoint requires the usage_read authorization scope.
:param view: String to specify whether cost is broken down at a parent-org level or at the sub-org level. Available views are ``summary`` and ``sub-org``. Defaults to ``summary``.
:type view: str, optional
:rtype: ProjectedCostResponse
"""
kwargs: Dict[str, Any] = {}
if view is not unset:
kwargs["view"] = view

return self._get_projected_cost_endpoint.call_with_http_info(**kwargs)

def get_usage_application_security_monitoring(
self,
start_hr: datetime,
Expand Down
64 changes: 64 additions & 0 deletions src/datadog_api_client/v2/model/projected_cost.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 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 Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.projected_cost_attributes import ProjectedCostAttributes
from datadog_api_client.v2.model.cost_by_org_type import CostByOrgType


class ProjectedCost(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.projected_cost_attributes import ProjectedCostAttributes
from datadog_api_client.v2.model.cost_by_org_type import CostByOrgType

return {
"attributes": (ProjectedCostAttributes,),
"id": (str,),
"type": (CostByOrgType,),
}

attribute_map = {
"attributes": "attributes",
"id": "id",
"type": "type",
}

def __init__(
self_,
attributes: Union[ProjectedCostAttributes, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
type: Union[CostByOrgType, UnsetType] = unset,
**kwargs,
):
"""
Projected Cost data.
:param attributes: Projected Cost attributes data.
:type attributes: ProjectedCostAttributes, optional
:param id: Unique ID of the response.
:type id: str, optional
:param type: Type of cost data.
:type type: CostByOrgType, optional
"""
if attributes is not unset:
kwargs["attributes"] = attributes
if id is not unset:
kwargs["id"] = id
if type is not unset:
kwargs["type"] = type
super().__init__(kwargs)
87 changes: 87 additions & 0 deletions src/datadog_api_client/v2/model/projected_cost_attributes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# 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,
datetime,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.chargeback_breakdown import ChargebackBreakdown


class ProjectedCostAttributes(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.chargeback_breakdown import ChargebackBreakdown

return {
"charges": ([ChargebackBreakdown],),
"date": (datetime,),
"org_name": (str,),
"projected_total_cost": (float,),
"public_id": (str,),
"region": (str,),
}

attribute_map = {
"charges": "charges",
"date": "date",
"org_name": "org_name",
"projected_total_cost": "projected_total_cost",
"public_id": "public_id",
"region": "region",
}

def __init__(
self_,
charges: Union[List[ChargebackBreakdown], UnsetType] = unset,
date: Union[datetime, UnsetType] = unset,
org_name: Union[str, UnsetType] = unset,
projected_total_cost: Union[float, UnsetType] = unset,
public_id: Union[str, UnsetType] = unset,
region: Union[str, UnsetType] = unset,
**kwargs,
):
"""
Projected Cost attributes data.
:param charges: List of charges data reported for the requested month.
:type charges: [ChargebackBreakdown], optional
:param date: The month requested.
:type date: datetime, optional
:param org_name: The organization name.
:type org_name: str, optional
:param projected_total_cost: The total projected cost of products for the month.
:type projected_total_cost: float, optional
:param public_id: The organization public ID.
:type public_id: str, optional
:param region: The region of the Datadog instance that the organization belongs to.
:type region: str, optional
"""
if charges is not unset:
kwargs["charges"] = charges
if date is not unset:
kwargs["date"] = date
if org_name is not unset:
kwargs["org_name"] = org_name
if projected_total_cost is not unset:
kwargs["projected_total_cost"] = projected_total_cost
if public_id is not unset:
kwargs["public_id"] = public_id
if region is not unset:
kwargs["region"] = region
super().__init__(kwargs)
Loading

0 comments on commit 786489a

Please sign in to comment.