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
61 changes: 50 additions & 11 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91830,16 +91830,42 @@ components:
x-enum-varnames:
- RECOMMENDATION
RecommendationsFilterRequest:
description: Request body for filtering cost recommendations.
description: JSON:API request body for filtering cost recommendations.
example:
filter: "@resource_table:aws_ec2_instance"
sort:
- expression: potential_daily_savings.amount
order: DESC
data:
attributes:
scope: ccm
sort:
- expression: potential_daily_savings.amount
order: DESC
id: "@resource_table:aws_ec2_instance"
type: recommendations_filter
properties:
filter:
description: Filter expression applied to the recommendations.
data:
$ref: "#/components/schemas/RecommendationsFilterRequestData"
required:
- data
type: object
RecommendationsFilterRequestData:
description: |-
JSON:API resource containing the cost recommendations filter. This legacy search contract
uses the resource ID for the filter expression rather than as a persistent resource identifier.
properties:
attributes:
$ref: "#/components/schemas/RecommendationsFilterRequestDataAttributes"
id:
description: |-
Filter expression applied to the recommendations. The server treats an omitted ID as `*`
and returns all recommendations.
type: string
type:
$ref: "#/components/schemas/RecommendationsFilterRequestDataType"
required:
- type
type: object
RecommendationsFilterRequestDataAttributes:
description: Attributes used to filter and sort cost recommendations.
properties:
scope:
$ref: "#/components/schemas/RecommendationsFilterRequestScope"
sort:
Expand All @@ -91851,6 +91877,15 @@ components:
description: Active view name (for example, `active`, `dismissed`, `open`, `in-progress`, or `completed`).
type: string
type: object
RecommendationsFilterRequestDataType:
default: recommendations_filter
description: Legacy JSON:API resource type required by the cost recommendations search decoder.
enum:
- recommendations_filter
example: recommendations_filter
type: string
x-enum-varnames:
- RECOMMENDATIONS_FILTER
RecommendationsFilterRequestScope:
description: Recommendations scope. Defaults to `ccm`; use `experiment` for experimental recommendations or `*` for both.
enum:
Expand Down Expand Up @@ -145681,10 +145716,14 @@ paths:
examples:
default:
value:
filter: "@resource_table:aws_ec2_instance"
sort:
- expression: potential_daily_savings.amount
order: DESC
data:
attributes:
scope: ccm
sort:
- expression: potential_daily_savings.amount
order: DESC
id: "@resource_table:aws_ec2_instance"
type: recommendations_filter
schema:
$ref: "#/components/schemas/RecommendationsFilterRequest"
required: true
Expand Down
24 changes: 18 additions & 6 deletions examples/v2/cloud-cost-management/SearchCostRecommendations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,28 @@
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.recommendations_filter_request import RecommendationsFilterRequest
from datadog_api_client.v2.model.recommendations_filter_request_data import RecommendationsFilterRequestData
from datadog_api_client.v2.model.recommendations_filter_request_data_attributes import (
RecommendationsFilterRequestDataAttributes,
)
from datadog_api_client.v2.model.recommendations_filter_request_data_type import RecommendationsFilterRequestDataType
from datadog_api_client.v2.model.recommendations_filter_request_scope import RecommendationsFilterRequestScope
from datadog_api_client.v2.model.recommendations_filter_request_sort_items import RecommendationsFilterRequestSortItems

body = RecommendationsFilterRequest(
filter="@resource_table:aws_ec2_instance",
sort=[
RecommendationsFilterRequestSortItems(
expression="potential_daily_savings.amount",
order="DESC",
data=RecommendationsFilterRequestData(
attributes=RecommendationsFilterRequestDataAttributes(
scope=RecommendationsFilterRequestScope.CCM,
sort=[
RecommendationsFilterRequestSortItems(
expression="potential_daily_savings.amount",
order="DESC",
),
],
),
],
id="@resource_table:aws_ec2_instance",
type=RecommendationsFilterRequestDataType.RECOMMENDATIONS_FILTER,
),
)

configuration = Configuration()
Expand Down
59 changes: 12 additions & 47 deletions src/datadog_api_client/v2/model/recommendations_filter_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,39 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import List, Union, TYPE_CHECKING
from typing import TYPE_CHECKING

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


if TYPE_CHECKING:
from datadog_api_client.v2.model.recommendations_filter_request_scope import RecommendationsFilterRequestScope
from datadog_api_client.v2.model.recommendations_filter_request_sort_items import (
RecommendationsFilterRequestSortItems,
)
from datadog_api_client.v2.model.recommendations_filter_request_data import RecommendationsFilterRequestData


class RecommendationsFilterRequest(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.recommendations_filter_request_scope import RecommendationsFilterRequestScope
from datadog_api_client.v2.model.recommendations_filter_request_sort_items import (
RecommendationsFilterRequestSortItems,
)
from datadog_api_client.v2.model.recommendations_filter_request_data import RecommendationsFilterRequestData

return {
"filter": (str,),
"scope": (RecommendationsFilterRequestScope,),
"sort": ([RecommendationsFilterRequestSortItems],),
"view": (str,),
"data": (RecommendationsFilterRequestData,),
}

attribute_map = {
"filter": "filter",
"scope": "scope",
"sort": "sort",
"view": "view",
"data": "data",
}

def __init__(
self_,
filter: Union[str, UnsetType] = unset,
scope: Union[RecommendationsFilterRequestScope, UnsetType] = unset,
sort: Union[List[RecommendationsFilterRequestSortItems], UnsetType] = unset,
view: Union[str, UnsetType] = unset,
**kwargs,
):
def __init__(self_, data: RecommendationsFilterRequestData, **kwargs):
"""
Request body for filtering cost recommendations.
JSON:API request body for filtering cost recommendations.

:param filter: Filter expression applied to the recommendations.
:type filter: str, optional

:param scope: Recommendations scope. Defaults to ``ccm`` ; use ``experiment`` for experimental recommendations or ``*`` for both.
:type scope: RecommendationsFilterRequestScope, optional

:param sort: Ordered list of sort clauses applied to the result set.
:type sort: [RecommendationsFilterRequestSortItems], optional

:param view: Active view name (for example, ``active`` , ``dismissed`` , ``open`` , ``in-progress`` , or ``completed`` ).
:type view: str, optional
:param data: JSON:API resource containing the cost recommendations filter. This legacy search contract
uses the resource ID for the filter expression rather than as a persistent resource identifier.
:type data: RecommendationsFilterRequestData
"""
if filter is not unset:
kwargs["filter"] = filter
if scope is not unset:
kwargs["scope"] = scope
if sort is not unset:
kwargs["sort"] = sort
if view is not unset:
kwargs["view"] = view
super().__init__(kwargs)

self_.data = data
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 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.recommendations_filter_request_data_attributes import (
RecommendationsFilterRequestDataAttributes,
)
from datadog_api_client.v2.model.recommendations_filter_request_data_type import (
RecommendationsFilterRequestDataType,
)


class RecommendationsFilterRequestData(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.recommendations_filter_request_data_attributes import (
RecommendationsFilterRequestDataAttributes,
)
from datadog_api_client.v2.model.recommendations_filter_request_data_type import (
RecommendationsFilterRequestDataType,
)

return {
"attributes": (RecommendationsFilterRequestDataAttributes,),
"id": (str,),
"type": (RecommendationsFilterRequestDataType,),
}

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

def __init__(
self_,
type: RecommendationsFilterRequestDataType,
attributes: Union[RecommendationsFilterRequestDataAttributes, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
**kwargs,
):
"""
JSON:API resource containing the cost recommendations filter. This legacy search contract
uses the resource ID for the filter expression rather than as a persistent resource identifier.

:param attributes: Attributes used to filter and sort cost recommendations.
:type attributes: RecommendationsFilterRequestDataAttributes, optional

:param id: Filter expression applied to the recommendations. The server treats an omitted ID as ``*``
and returns all recommendations.
:type id: str, optional

:param type: Legacy JSON:API resource type required by the cost recommendations search decoder.
:type type: RecommendationsFilterRequestDataType
"""
if attributes is not unset:
kwargs["attributes"] = attributes
if id is not unset:
kwargs["id"] = id
super().__init__(kwargs)

self_.type = type
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 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,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.recommendations_filter_request_scope import RecommendationsFilterRequestScope
from datadog_api_client.v2.model.recommendations_filter_request_sort_items import (
RecommendationsFilterRequestSortItems,
)


class RecommendationsFilterRequestDataAttributes(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.recommendations_filter_request_scope import RecommendationsFilterRequestScope
from datadog_api_client.v2.model.recommendations_filter_request_sort_items import (
RecommendationsFilterRequestSortItems,
)

return {
"scope": (RecommendationsFilterRequestScope,),
"sort": ([RecommendationsFilterRequestSortItems],),
"view": (str,),
}

attribute_map = {
"scope": "scope",
"sort": "sort",
"view": "view",
}

def __init__(
self_,
scope: Union[RecommendationsFilterRequestScope, UnsetType] = unset,
sort: Union[List[RecommendationsFilterRequestSortItems], UnsetType] = unset,
view: Union[str, UnsetType] = unset,
**kwargs,
):
"""
Attributes used to filter and sort cost recommendations.

:param scope: Recommendations scope. Defaults to ``ccm`` ; use ``experiment`` for experimental recommendations or ``*`` for both.
:type scope: RecommendationsFilterRequestScope, optional

:param sort: Ordered list of sort clauses applied to the result set.
:type sort: [RecommendationsFilterRequestSortItems], optional

:param view: Active view name (for example, ``active`` , ``dismissed`` , ``open`` , ``in-progress`` , or ``completed`` ).
:type view: str, optional
"""
if scope is not unset:
kwargs["scope"] = scope
if sort is not unset:
kwargs["sort"] = sort
if view is not unset:
kwargs["view"] = view
super().__init__(kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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 RecommendationsFilterRequestDataType(ModelSimple):
"""
Legacy JSON:API resource type required by the cost recommendations search decoder.

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

allowed_values = {
"recommendations_filter",
}
RECOMMENDATIONS_FILTER: ClassVar["RecommendationsFilterRequestDataType"]

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


RecommendationsFilterRequestDataType.RECOMMENDATIONS_FILTER = RecommendationsFilterRequestDataType(
"recommendations_filter"
)
Loading
Loading