diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 107e80821394..494c29d081ea 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -93243,7 +93243,7 @@ components: attributes: scope: ccm sort: - - expression: potential_daily_savings.amount + - expression: "@potential_daily_savings" order: DESC id: "@resource_table:aws_ec2_instance" type: recommendations_filter @@ -93262,8 +93262,9 @@ components: $ref: "#/components/schemas/RecommendationsFilterRequestDataAttributes" id: description: |- - Filter expression applied to the recommendations. The server treats an omitted ID as `*` - and returns all recommendations. + Filter expression applied to the recommendations when `attributes.filter` is omitted. + When supplied, `attributes.filter` overrides this value, including when empty. If the + resulting filter is empty, it defaults to `*`. Scope, view, and pagination still apply. type: string type: $ref: "#/components/schemas/RecommendationsFilterRequestDataType" @@ -93273,6 +93274,13 @@ components: RecommendationsFilterRequestDataAttributes: description: Attributes used to filter and sort cost recommendations. properties: + filter: + description: |- + Filter expression applied to the recommendations. When supplied, this attribute overrides + `data.id`, including when empty. When omitted, `data.id` is used. If the resulting filter + is empty, it defaults to `*`. Scope, view, and pagination still apply. + example: "@resource_table:aws_ec2_instance" + type: string scope: $ref: "#/components/schemas/RecommendationsFilterRequestScope" sort: @@ -93308,7 +93316,7 @@ components: description: A single sort clause applied to the cost recommendations result set. properties: expression: - description: Field to sort by (for example, `potential_daily_savings.amount`). + description: Field to sort by (for example, `@potential_daily_savings`). type: string order: description: Sort direction, either `ASC` or `DESC`. @@ -148137,7 +148145,7 @@ paths: attributes: scope: ccm sort: - - expression: potential_daily_savings.amount + - expression: "@potential_daily_savings" order: DESC id: "@resource_table:aws_ec2_instance" type: recommendations_filter diff --git a/examples/v2/cloud-cost-management/SearchCostRecommendations.ts b/examples/v2/cloud-cost-management/SearchCostRecommendations.ts index 8850a3c2405b..810e5b1eafd1 100644 --- a/examples/v2/cloud-cost-management/SearchCostRecommendations.ts +++ b/examples/v2/cloud-cost-management/SearchCostRecommendations.ts @@ -21,7 +21,7 @@ const params: v2.CloudCostManagementApiSearchCostRecommendationsRequest = { scope: "ccm", sort: [ { - expression: "potential_daily_savings.amount", + expression: "@potential_daily_savings", order: "DESC", }, ], diff --git a/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index f6298e74f222..be04d5c8e007 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/cloud_cost_management.feature @@ -974,7 +974,7 @@ Feature: Cloud Cost Management Scenario: Search cost recommendations returns "OK" response Given operation "SearchCostRecommendations" enabled And new "SearchCostRecommendations" request - And body with value {"data": {"attributes": {"scope": "ccm", "sort": [{"expression": "potential_daily_savings.amount", "order": "DESC"}]}, "id": "@resource_table:aws_ec2_instance", "type": "recommendations_filter"}} + And body with value {"data": {"attributes": {"scope": "ccm", "sort": [{"expression": "@potential_daily_savings", "order": "DESC"}]}, "id": "@resource_table:aws_ec2_instance", "type": "recommendations_filter"}} When the request is sent Then the response status is 200 OK diff --git a/packages/datadog-api-client-v2/models/RecommendationsFilterRequestData.ts b/packages/datadog-api-client-v2/models/RecommendationsFilterRequestData.ts index 4ae4b15ff807..3f81f182783a 100644 --- a/packages/datadog-api-client-v2/models/RecommendationsFilterRequestData.ts +++ b/packages/datadog-api-client-v2/models/RecommendationsFilterRequestData.ts @@ -18,8 +18,9 @@ export class RecommendationsFilterRequestData { */ "attributes"?: RecommendationsFilterRequestDataAttributes; /** - * Filter expression applied to the recommendations. The server treats an omitted ID as `*` - * and returns all recommendations. + * Filter expression applied to the recommendations when `attributes.filter` is omitted. + * When supplied, `attributes.filter` overrides this value, including when empty. If the + * resulting filter is empty, it defaults to `*`. Scope, view, and pagination still apply. */ "id"?: string; /** diff --git a/packages/datadog-api-client-v2/models/RecommendationsFilterRequestDataAttributes.ts b/packages/datadog-api-client-v2/models/RecommendationsFilterRequestDataAttributes.ts index dbb607995957..3f8b81b35c9a 100644 --- a/packages/datadog-api-client-v2/models/RecommendationsFilterRequestDataAttributes.ts +++ b/packages/datadog-api-client-v2/models/RecommendationsFilterRequestDataAttributes.ts @@ -12,6 +12,12 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util"; * Attributes used to filter and sort cost recommendations. */ export class RecommendationsFilterRequestDataAttributes { + /** + * Filter expression applied to the recommendations. When supplied, this attribute overrides + * `data.id`, including when empty. When omitted, `data.id` is used. If the resulting filter + * is empty, it defaults to `*`. Scope, view, and pagination still apply. + */ + "filter"?: string; /** * Recommendations scope. Defaults to `ccm`; use `experiment` for experimental recommendations or `*` for both. */ @@ -41,6 +47,10 @@ export class RecommendationsFilterRequestDataAttributes { * @ignore */ static readonly attributeTypeMap: AttributeTypeMap = { + filter: { + baseName: "filter", + type: "string", + }, scope: { baseName: "scope", type: "RecommendationsFilterRequestScope", diff --git a/packages/datadog-api-client-v2/models/RecommendationsFilterRequestSortItems.ts b/packages/datadog-api-client-v2/models/RecommendationsFilterRequestSortItems.ts index 669c6d1b7c84..fbf0d7c092e9 100644 --- a/packages/datadog-api-client-v2/models/RecommendationsFilterRequestSortItems.ts +++ b/packages/datadog-api-client-v2/models/RecommendationsFilterRequestSortItems.ts @@ -11,7 +11,7 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util"; */ export class RecommendationsFilterRequestSortItems { /** - * Field to sort by (for example, `potential_daily_savings.amount`). + * Field to sort by (for example, `@potential_daily_savings`). */ "expression"?: string; /**