diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index da1a2769faa4..245e17abb95a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -17831,6 +17831,76 @@ components: required: - data type: object + CostRecommendationArray: + description: A page of cost recommendations with pagination metadata. + properties: + data: + description: The list of cost recommendations on this page. + items: + $ref: "#/components/schemas/CostRecommendationData" + type: array + meta: + $ref: "#/components/schemas/RecommendationsPageMeta" + required: + - data + type: object + CostRecommendationData: + description: A single cost recommendation entry in JSON:API form. + properties: + attributes: + $ref: "#/components/schemas/CostRecommendationDataAttributes" + id: + description: Unique identifier for the recommendation. + type: string + type: + $ref: "#/components/schemas/CostRecommendationDataType" + required: + - type + type: object + CostRecommendationDataAttributes: + description: Attributes describing a single cost recommendation. + properties: + dd_resource_key: + description: Datadog resource key identifying the recommended resource. + type: string + potential_daily_savings: + $ref: "#/components/schemas/CostRecommendationDataAttributesPotentialDailySavings" + recommendation_type: + description: The kind of recommendation (for example, `terminate` or `rightsize`). + type: string + resource_id: + description: Cloud provider identifier of the resource. + type: string + resource_type: + description: Resource type (for example, `aws_ec2_instance`). + type: string + tags: + description: Tags attached to the recommended resource. + items: + description: A single resource tag. + type: string + type: array + type: object + CostRecommendationDataAttributesPotentialDailySavings: + description: Estimated daily savings if the recommendation is applied. + properties: + amount: + description: Numeric amount of the potential daily savings. + format: double + type: number + currency: + description: ISO 4217 currency code for the savings amount. + type: string + type: object + CostRecommendationDataType: + default: recommendation + description: Recommendation resource type. + enum: + - recommendation + example: recommendation + type: string + x-enum-varnames: + - RECOMMENDATION CostTag: description: A Cloud Cost Management tag. properties: @@ -63436,6 +63506,64 @@ components: type: string x-enum-varnames: - RECOMMENDATION + RecommendationsFilterRequest: + description: Request body for filtering cost recommendations. + example: + filter: "@resource_table:aws_ec2_instance" + sort: + - expression: potential_daily_savings.amount + order: DESC + properties: + filter: + description: Filter expression applied to the recommendations. + type: string + scope: + description: Recommendations scope. Defaults to `ccm`; use `experiment` for experimental recommendations or `*` for both. + type: string + sort: + description: Ordered list of sort clauses applied to the result set. + items: + $ref: "#/components/schemas/RecommendationsFilterRequestSortItems" + type: array + view: + description: Active view name (for example, `active`, `dismissed`, `open`, `in-progress`, or `completed`). + type: string + type: object + RecommendationsFilterRequestSortItems: + 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`). + type: string + order: + description: Sort direction, either `ASC` or `DESC`. + type: string + type: object + RecommendationsPageMeta: + description: Top-level JSON:API meta object for paginated cost recommendation responses. + properties: + page: + $ref: "#/components/schemas/RecommendationsPageMetaPage" + type: object + RecommendationsPageMetaPage: + description: Pagination metadata for a page of cost recommendations. + properties: + filter: + description: The filter expression that was applied to produce this page. + type: string + next_page_token: + description: Opaque token used to fetch the next page; absent on the last page. + type: string + page_size: + description: Number of items returned in this page (1–10000). + format: int32 + maximum: 10000 + minimum: 1 + type: integer + page_token: + description: Pagination token echoed back from the request. + type: string + type: object ReferenceTableCreateSourceType: description: The source type for creating reference table data. Only these source types can be created through this API. enum: @@ -105850,6 +105978,76 @@ paths: operator: OR permissions: - cloud_cost_management_read + /api/v2/cost/recommendations: + post: + description: List cost recommendations matching a filter, with pagination and sorting. + operationId: SearchCostRecommendations + parameters: + - description: Number of results per page (1–10000). + in: query + name: page[size] + schema: + type: string + - description: Pagination token from a previous response. + in: query + name: page[token] + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + filter: "@resource_table:aws_ec2_instance" + sort: + - expression: potential_daily_savings.amount + order: DESC + schema: + $ref: "#/components/schemas/RecommendationsFilterRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + dd_resource_key: "arn:aws:ec2:us-east-1:123456789012:instance/i-1234567890abcdef0" + potential_daily_savings: + amount: 1.23 + currency: USD + recommendation_type: terminate + resource_id: i-1234567890abcdef0 + resource_type: aws_ec2_instance + tags: + - "env:prod" + - "team:ccm" + id: encoded-event-id-1 + type: recommendation + meta: + page: + filter: "@resource_table:aws_ec2_instance" + next_page_token: "" + page_size: 100 + schema: + $ref: "#/components/schemas/CostRecommendationArray" + description: OK + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: Search cost recommendations + tags: + - Cloud Cost Management + 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/cost/tag_descriptions: get: description: List Cloud Cost Management tag key descriptions for the organization. Use `filter[cloud]` to scope the result to a single cloud provider; when omitted, both cross-cloud defaults and cloud-specific descriptions are returned. diff --git a/examples/v2/cloud-cost-management/SearchCostRecommendations.ts b/examples/v2/cloud-cost-management/SearchCostRecommendations.ts new file mode 100644 index 000000000000..b92b8f4fe705 --- /dev/null +++ b/examples/v2/cloud-cost-management/SearchCostRecommendations.ts @@ -0,0 +1,30 @@ +/** + * Search cost recommendations returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.searchCostRecommendations"] = true; +const apiInstance = new v2.CloudCostManagementApi(configuration); + +const params: v2.CloudCostManagementApiSearchCostRecommendationsRequest = { + body: { + filter: "@resource_table:aws_ec2_instance", + sort: [ + { + expression: "potential_daily_savings.amount", + order: "DESC", + }, + ], + }, +}; + +apiInstance + .searchCostRecommendations(params) + .then((data: v2.CostRecommendationArray) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index bb8db8d6acc4..e2262f6b4839 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -7016,6 +7016,21 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { "v2.ListCostOCIConfigs": { "operationResponseType": "OCIConfigsResponse", }, + "v2.SearchCostRecommendations": { + "pageSize": { + "type": "string", + "format": "", + }, + "pageToken": { + "type": "string", + "format": "", + }, + "body": { + "type": "RecommendationsFilterRequest", + "format": "", + }, + "operationResponseType": "CostRecommendationArray", + }, "v2.ListCostTagDescriptions": { "filterCloud": { "type": "string", diff --git a/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index 578dbb420012..17779e4599e4 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/cloud_cost_management.feature @@ -736,6 +736,14 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 204 Successfully reordered rulesets + @generated @skip @team:DataDog/ccm-optimize + Scenario: Search cost recommendations returns "OK" response + Given operation "SearchCostRecommendations" enabled + And new "SearchCostRecommendations" request + And body with value {"filter": "@resource_table:aws_ec2_instance", "sort": [{"expression": "potential_daily_savings.amount", "order": "DESC"}]} + When the request is sent + Then the response status is 200 OK + @team:DataDog/cloud-cost-management Scenario: Update Cloud Cost Management AWS CUR config returns "Not Found" response Given new "UpdateCostAWSCURConfig" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 02753f1a80a7..27b9c797dfd2 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1826,6 +1826,12 @@ "type": "safe" } }, + "SearchCostRecommendations": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "ListCostTagDescriptions": { "tag": "Cloud Cost Management", "undo": { diff --git a/packages/datadog-api-client-common/configuration.ts b/packages/datadog-api-client-common/configuration.ts index b7324b9b1c1c..2d1b85aed568 100644 --- a/packages/datadog-api-client-common/configuration.ts +++ b/packages/datadog-api-client-common/configuration.ts @@ -385,6 +385,7 @@ export function createConfiguration( "v2.listCostTagMetadata": false, "v2.listCostTagMetadataMetrics": false, "v2.listCostTagMetadataOrchestrators": false, + "v2.searchCostRecommendations": false, "v2.createDashboardSecureEmbed": false, "v2.deleteDashboardSecureEmbed": false, "v2.getDashboardSecureEmbed": false, diff --git a/packages/datadog-api-client-v2/apis/CloudCostManagementApi.ts b/packages/datadog-api-client-v2/apis/CloudCostManagementApi.ts index 91bce498e8c0..dee5c6d8bbb4 100644 --- a/packages/datadog-api-client-v2/apis/CloudCostManagementApi.ts +++ b/packages/datadog-api-client-v2/apis/CloudCostManagementApi.ts @@ -48,6 +48,7 @@ import { CostAnomalyResponse } from "../models/CostAnomalyResponse"; import { CostCurrencyResponse } from "../models/CostCurrencyResponse"; import { CostMetricsResponse } from "../models/CostMetricsResponse"; import { CostOrchestratorsResponse } from "../models/CostOrchestratorsResponse"; +import { CostRecommendationArray } from "../models/CostRecommendationArray"; import { CostTagDescriptionsResponse } from "../models/CostTagDescriptionsResponse"; import { CostTagKeyMetadataResponse } from "../models/CostTagKeyMetadataResponse"; import { CostTagKeyResponse } from "../models/CostTagKeyResponse"; @@ -67,6 +68,7 @@ import { GCPUsageCostConfigResponse } from "../models/GCPUsageCostConfigResponse import { GCPUsageCostConfigsResponse } from "../models/GCPUsageCostConfigsResponse"; import { JSONAPIErrorResponse } from "../models/JSONAPIErrorResponse"; import { OCIConfigsResponse } from "../models/OCIConfigsResponse"; +import { RecommendationsFilterRequest } from "../models/RecommendationsFilterRequest"; import { ReorderRuleResourceArray } from "../models/ReorderRuleResourceArray"; import { ReorderRulesetResourceArray } from "../models/ReorderRulesetResourceArray"; import { RulesetResp } from "../models/RulesetResp"; @@ -2615,6 +2617,73 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } + public async searchCostRecommendations( + body: RecommendationsFilterRequest, + pageSize?: string, + pageToken?: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'searchCostRecommendations'"); + if (!_config.unstableOperations["v2.searchCostRecommendations"]) { + throw new Error( + "Unstable operation 'searchCostRecommendations' is disabled" + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "searchCostRecommendations"); + } + + // Path Params + const localVarPath = "/api/v2/cost/recommendations"; + + // Make Request Context + const requestContext = _config + .getServer("v2.CloudCostManagementApi.searchCostRecommendations") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Query Params + if (pageSize !== undefined) { + requestContext.setQueryParam( + "page[size]", + ObjectSerializer.serialize(pageSize, "string", ""), + "" + ); + } + if (pageToken !== undefined) { + requestContext.setQueryParam( + "page[token]", + ObjectSerializer.serialize(pageToken, "string", ""), + "" + ); + } + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "RecommendationsFilterRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async updateCostAWSCURConfig( cloudAccountId: number, body: AwsCURConfigPatchRequest, @@ -6150,6 +6219,64 @@ export class CloudCostManagementApiResponseProcessor { ); } + /** + * 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 searchCostRecommendations + * @throws ApiException if the response code was not in [200, 299] + */ + public async searchCostRecommendations( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: CostRecommendationArray = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "CostRecommendationArray" + ) as CostRecommendationArray; + return body; + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "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: CostRecommendationArray = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "CostRecommendationArray", + "" + ) as CostRecommendationArray; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -7399,6 +7526,23 @@ export interface CloudCostManagementApiReorderTagPipelinesRulesetsRequest { body: ReorderRulesetResourceArray; } +export interface CloudCostManagementApiSearchCostRecommendationsRequest { + /** + * @type RecommendationsFilterRequest + */ + body: RecommendationsFilterRequest; + /** + * Number of results per page (1–10000). + * @type string + */ + pageSize?: string; + /** + * Pagination token from a previous response. + * @type string + */ + pageToken?: string; +} + export interface CloudCostManagementApiUpdateCostAWSCURConfigRequest { /** * Cloud Account id. @@ -8667,6 +8811,31 @@ export class CloudCostManagementApi { }); } + /** + * List cost recommendations matching a filter, with pagination and sorting. + * @param param The request object + */ + public searchCostRecommendations( + param: CloudCostManagementApiSearchCostRecommendationsRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.searchCostRecommendations( + param.body, + param.pageSize, + param.pageToken, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.searchCostRecommendations( + responseContext + ); + }); + }); + } + /** * Update the status (active/archived) and/or account filtering configuration of an AWS CUR config. * @param param The request object diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 2766bf2fc2f6..3c7e3fec7ae2 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -313,6 +313,7 @@ export { CloudCostManagementApiListCustomCostsFilesRequest, CloudCostManagementApiReorderCustomAllocationRulesRequest, CloudCostManagementApiReorderTagPipelinesRulesetsRequest, + CloudCostManagementApiSearchCostRecommendationsRequest, CloudCostManagementApiUpdateCostAWSCURConfigRequest, CloudCostManagementApiUpdateCostAzureUCConfigsRequest, CloudCostManagementApiUpdateCostGCPUsageCostConfigRequest, @@ -2488,6 +2489,11 @@ export { CostMetricType } from "./models/CostMetricType"; export { CostOrchestrator } from "./models/CostOrchestrator"; export { CostOrchestratorsResponse } from "./models/CostOrchestratorsResponse"; export { CostOrchestratorType } from "./models/CostOrchestratorType"; +export { CostRecommendationArray } from "./models/CostRecommendationArray"; +export { CostRecommendationData } from "./models/CostRecommendationData"; +export { CostRecommendationDataAttributes } from "./models/CostRecommendationDataAttributes"; +export { CostRecommendationDataAttributesPotentialDailySavings } from "./models/CostRecommendationDataAttributesPotentialDailySavings"; +export { CostRecommendationDataType } from "./models/CostRecommendationDataType"; export { CostTag } from "./models/CostTag"; export { CostTagAttributes } from "./models/CostTagAttributes"; export { CostTagDescription } from "./models/CostTagDescription"; @@ -5358,6 +5364,10 @@ export { ReadinessGateThresholdType } from "./models/ReadinessGateThresholdType" export { RecommendationAttributes } from "./models/RecommendationAttributes"; export { RecommendationData } from "./models/RecommendationData"; export { RecommendationDocument } from "./models/RecommendationDocument"; +export { RecommendationsFilterRequest } from "./models/RecommendationsFilterRequest"; +export { RecommendationsFilterRequestSortItems } from "./models/RecommendationsFilterRequestSortItems"; +export { RecommendationsPageMeta } from "./models/RecommendationsPageMeta"; +export { RecommendationsPageMetaPage } from "./models/RecommendationsPageMetaPage"; export { RecommendationType } from "./models/RecommendationType"; export { ReferenceTableCreateSourceType } from "./models/ReferenceTableCreateSourceType"; export { ReferenceTableSchemaFieldType } from "./models/ReferenceTableSchemaFieldType"; diff --git a/packages/datadog-api-client-v2/models/CostRecommendationArray.ts b/packages/datadog-api-client-v2/models/CostRecommendationArray.ts new file mode 100644 index 000000000000..a1362e2b15ca --- /dev/null +++ b/packages/datadog-api-client-v2/models/CostRecommendationArray.ts @@ -0,0 +1,63 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { CostRecommendationData } from "./CostRecommendationData"; +import { RecommendationsPageMeta } from "./RecommendationsPageMeta"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A page of cost recommendations with pagination metadata. + */ +export class CostRecommendationArray { + /** + * The list of cost recommendations on this page. + */ + "data": Array; + /** + * Top-level JSON:API meta object for paginated cost recommendation responses. + */ + "meta"?: RecommendationsPageMeta; + + /** + * 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, + }, + meta: { + baseName: "meta", + type: "RecommendationsPageMeta", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CostRecommendationArray.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CostRecommendationData.ts b/packages/datadog-api-client-v2/models/CostRecommendationData.ts new file mode 100644 index 000000000000..37b8463c910e --- /dev/null +++ b/packages/datadog-api-client-v2/models/CostRecommendationData.ts @@ -0,0 +1,71 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { CostRecommendationDataAttributes } from "./CostRecommendationDataAttributes"; +import { CostRecommendationDataType } from "./CostRecommendationDataType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A single cost recommendation entry in JSON:API form. + */ +export class CostRecommendationData { + /** + * Attributes describing a single cost recommendation. + */ + "attributes"?: CostRecommendationDataAttributes; + /** + * Unique identifier for the recommendation. + */ + "id"?: string; + /** + * Recommendation resource type. + */ + "type": CostRecommendationDataType; + + /** + * 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: "CostRecommendationDataAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "CostRecommendationDataType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CostRecommendationData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CostRecommendationDataAttributes.ts b/packages/datadog-api-client-v2/models/CostRecommendationDataAttributes.ts new file mode 100644 index 000000000000..557339b06aba --- /dev/null +++ b/packages/datadog-api-client-v2/models/CostRecommendationDataAttributes.ts @@ -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 2020-Present Datadog, Inc. + */ +import { CostRecommendationDataAttributesPotentialDailySavings } from "./CostRecommendationDataAttributesPotentialDailySavings"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes describing a single cost recommendation. + */ +export class CostRecommendationDataAttributes { + /** + * Datadog resource key identifying the recommended resource. + */ + "ddResourceKey"?: string; + /** + * Estimated daily savings if the recommendation is applied. + */ + "potentialDailySavings"?: CostRecommendationDataAttributesPotentialDailySavings; + /** + * The kind of recommendation (for example, `terminate` or `rightsize`). + */ + "recommendationType"?: string; + /** + * Cloud provider identifier of the resource. + */ + "resourceId"?: string; + /** + * Resource type (for example, `aws_ec2_instance`). + */ + "resourceType"?: string; + /** + * Tags attached to the recommended resource. + */ + "tags"?: 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 = { + ddResourceKey: { + baseName: "dd_resource_key", + type: "string", + }, + potentialDailySavings: { + baseName: "potential_daily_savings", + type: "CostRecommendationDataAttributesPotentialDailySavings", + }, + recommendationType: { + baseName: "recommendation_type", + type: "string", + }, + resourceId: { + baseName: "resource_id", + type: "string", + }, + resourceType: { + baseName: "resource_type", + type: "string", + }, + tags: { + baseName: "tags", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CostRecommendationDataAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CostRecommendationDataAttributesPotentialDailySavings.ts b/packages/datadog-api-client-v2/models/CostRecommendationDataAttributesPotentialDailySavings.ts new file mode 100644 index 000000000000..02b0ed8c3469 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CostRecommendationDataAttributesPotentialDailySavings.ts @@ -0,0 +1,61 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Estimated daily savings if the recommendation is applied. + */ +export class CostRecommendationDataAttributesPotentialDailySavings { + /** + * Numeric amount of the potential daily savings. + */ + "amount"?: number; + /** + * ISO 4217 currency code for the savings amount. + */ + "currency"?: 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 = { + amount: { + baseName: "amount", + type: "number", + format: "double", + }, + currency: { + baseName: "currency", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CostRecommendationDataAttributesPotentialDailySavings.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CostRecommendationDataType.ts b/packages/datadog-api-client-v2/models/CostRecommendationDataType.ts new file mode 100644 index 000000000000..86fadc51958d --- /dev/null +++ b/packages/datadog-api-client-v2/models/CostRecommendationDataType.ts @@ -0,0 +1,14 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Recommendation resource type. + */ + +export type CostRecommendationDataType = typeof RECOMMENDATION | UnparsedObject; +export const RECOMMENDATION = "recommendation"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index 73b9f71edc08..c82282f10689 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -757,6 +757,10 @@ import { CostMetric } from "./CostMetric"; import { CostMetricsResponse } from "./CostMetricsResponse"; import { CostOrchestrator } from "./CostOrchestrator"; import { CostOrchestratorsResponse } from "./CostOrchestratorsResponse"; +import { CostRecommendationArray } from "./CostRecommendationArray"; +import { CostRecommendationData } from "./CostRecommendationData"; +import { CostRecommendationDataAttributes } from "./CostRecommendationDataAttributes"; +import { CostRecommendationDataAttributesPotentialDailySavings } from "./CostRecommendationDataAttributesPotentialDailySavings"; import { CostTag } from "./CostTag"; import { CostTagAttributes } from "./CostTagAttributes"; import { CostTagDescription } from "./CostTagDescription"; @@ -3003,6 +3007,10 @@ import { ReadinessGate } from "./ReadinessGate"; import { RecommendationAttributes } from "./RecommendationAttributes"; import { RecommendationData } from "./RecommendationData"; import { RecommendationDocument } from "./RecommendationDocument"; +import { RecommendationsFilterRequest } from "./RecommendationsFilterRequest"; +import { RecommendationsFilterRequestSortItems } from "./RecommendationsFilterRequestSortItems"; +import { RecommendationsPageMeta } from "./RecommendationsPageMeta"; +import { RecommendationsPageMetaPage } from "./RecommendationsPageMetaPage"; import { RegisterAppKeyResponse } from "./RegisterAppKeyResponse"; import { RelationAttributes } from "./RelationAttributes"; import { RelationEntity } from "./RelationEntity"; @@ -4827,6 +4835,7 @@ const enumsMap: { [key: string]: any[] } = { CostCurrencyType: ["cost_currency"], CostMetricType: ["cost_metric"], CostOrchestratorType: ["cost_orchestrator"], + CostRecommendationDataType: ["recommendation"], CostTagDescriptionSource: ["human", "ai_generated", "datadog"], CostTagDescriptionType: ["cost_tag_description"], CostTagKeyMetadataType: ["cost_tag_key_metadata"], @@ -7706,6 +7715,11 @@ const typeMap: { [index: string]: any } = { CostMetricsResponse: CostMetricsResponse, CostOrchestrator: CostOrchestrator, CostOrchestratorsResponse: CostOrchestratorsResponse, + CostRecommendationArray: CostRecommendationArray, + CostRecommendationData: CostRecommendationData, + CostRecommendationDataAttributes: CostRecommendationDataAttributes, + CostRecommendationDataAttributesPotentialDailySavings: + CostRecommendationDataAttributesPotentialDailySavings, CostTag: CostTag, CostTagAttributes: CostTagAttributes, CostTagDescription: CostTagDescription, @@ -10404,6 +10418,10 @@ const typeMap: { [index: string]: any } = { RecommendationAttributes: RecommendationAttributes, RecommendationData: RecommendationData, RecommendationDocument: RecommendationDocument, + RecommendationsFilterRequest: RecommendationsFilterRequest, + RecommendationsFilterRequestSortItems: RecommendationsFilterRequestSortItems, + RecommendationsPageMeta: RecommendationsPageMeta, + RecommendationsPageMetaPage: RecommendationsPageMetaPage, RegisterAppKeyResponse: RegisterAppKeyResponse, RelationAttributes: RelationAttributes, RelationEntity: RelationEntity, diff --git a/packages/datadog-api-client-v2/models/RecommendationsFilterRequest.ts b/packages/datadog-api-client-v2/models/RecommendationsFilterRequest.ts new file mode 100644 index 000000000000..791bde0499f8 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RecommendationsFilterRequest.ts @@ -0,0 +1,77 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RecommendationsFilterRequestSortItems } from "./RecommendationsFilterRequestSortItems"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Request body for filtering cost recommendations. + */ +export class RecommendationsFilterRequest { + /** + * Filter expression applied to the recommendations. + */ + "filter"?: string; + /** + * Recommendations scope. Defaults to `ccm`; use `experiment` for experimental recommendations or `*` for both. + */ + "scope"?: string; + /** + * Ordered list of sort clauses applied to the result set. + */ + "sort"?: Array; + /** + * Active view name (for example, `active`, `dismissed`, `open`, `in-progress`, or `completed`). + */ + "view"?: 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 = { + filter: { + baseName: "filter", + type: "string", + }, + scope: { + baseName: "scope", + type: "string", + }, + sort: { + baseName: "sort", + type: "Array", + }, + view: { + baseName: "view", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RecommendationsFilterRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RecommendationsFilterRequestSortItems.ts b/packages/datadog-api-client-v2/models/RecommendationsFilterRequestSortItems.ts new file mode 100644 index 000000000000..669c6d1b7c84 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RecommendationsFilterRequestSortItems.ts @@ -0,0 +1,60 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A single sort clause applied to the cost recommendations result set. + */ +export class RecommendationsFilterRequestSortItems { + /** + * Field to sort by (for example, `potential_daily_savings.amount`). + */ + "expression"?: string; + /** + * Sort direction, either `ASC` or `DESC`. + */ + "order"?: 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 = { + expression: { + baseName: "expression", + type: "string", + }, + order: { + baseName: "order", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RecommendationsFilterRequestSortItems.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RecommendationsPageMeta.ts b/packages/datadog-api-client-v2/models/RecommendationsPageMeta.ts new file mode 100644 index 000000000000..9b2e327d10e3 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RecommendationsPageMeta.ts @@ -0,0 +1,53 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RecommendationsPageMetaPage } from "./RecommendationsPageMetaPage"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Top-level JSON:API meta object for paginated cost recommendation responses. + */ +export class RecommendationsPageMeta { + /** + * Pagination metadata for a page of cost recommendations. + */ + "page"?: RecommendationsPageMetaPage; + + /** + * 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 = { + page: { + baseName: "page", + type: "RecommendationsPageMetaPage", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RecommendationsPageMeta.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RecommendationsPageMetaPage.ts b/packages/datadog-api-client-v2/models/RecommendationsPageMetaPage.ts new file mode 100644 index 000000000000..69e290e4528e --- /dev/null +++ b/packages/datadog-api-client-v2/models/RecommendationsPageMetaPage.ts @@ -0,0 +1,77 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Pagination metadata for a page of cost recommendations. + */ +export class RecommendationsPageMetaPage { + /** + * The filter expression that was applied to produce this page. + */ + "filter"?: string; + /** + * Opaque token used to fetch the next page; absent on the last page. + */ + "nextPageToken"?: string; + /** + * Number of items returned in this page (1–10000). + */ + "pageSize"?: number; + /** + * Pagination token echoed back from the request. + */ + "pageToken"?: 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 = { + filter: { + baseName: "filter", + type: "string", + }, + nextPageToken: { + baseName: "next_page_token", + type: "string", + }, + pageSize: { + baseName: "page_size", + type: "number", + format: "int32", + }, + pageToken: { + baseName: "page_token", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RecommendationsPageMetaPage.attributeTypeMap; + } + + public constructor() {} +}