Skip to content

Commit 7d47e4e

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit b6250b4 of spec repo
1 parent 1bdc031 commit 7d47e4e

8 files changed

Lines changed: 241 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127092,6 +127092,56 @@ paths:
127092127092
x-unstable: |-
127093127093
**Note**: This endpoint is in preview and is subject to change.
127094127094
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
127095+
get:
127096+
description: Get the custom forecast for a budget.
127097+
operationId: GetCustomForecast
127098+
parameters:
127099+
- $ref: "#/components/parameters/BudgetID"
127100+
responses:
127101+
"200":
127102+
content:
127103+
application/json:
127104+
examples:
127105+
default:
127106+
value:
127107+
data:
127108+
attributes:
127109+
budget_uid: 00000000-0000-0000-0000-000000000001
127110+
created_at: 1738258683590
127111+
created_by: 00000000-0a0a-0a0a-aaa0-00000000000a
127112+
entries:
127113+
- amount: 400
127114+
month: 202501
127115+
tag_filters:
127116+
- tag_key: service
127117+
tag_value: ec2
127118+
- amount: 450
127119+
month: 202502
127120+
tag_filters:
127121+
- tag_key: service
127122+
tag_value: ec2
127123+
updated_at: 1738258683590
127124+
updated_by: 00000000-0a0a-0a0a-aaa0-00000000000a
127125+
id: 11111111-1111-1111-1111-111111111111
127126+
type: custom_forecast
127127+
schema:
127128+
$ref: "#/components/schemas/CustomForecastResponse"
127129+
description: OK
127130+
"400":
127131+
$ref: "#/components/responses/BadRequestResponse"
127132+
"404":
127133+
$ref: "#/components/responses/NotFoundResponse"
127134+
"429":
127135+
$ref: "#/components/responses/TooManyRequestsResponse"
127136+
security:
127137+
- apiKeyAuth: []
127138+
appKeyAuth: []
127139+
summary: Get a budget's custom forecast
127140+
tags:
127141+
- Cloud Cost Management
127142+
x-unstable: |-
127143+
**Note**: This endpoint is in preview and is subject to change.
127144+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
127095127145
/api/v2/cost/budgets:
127096127146
get:
127097127147
description: List budgets.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Get a budget's custom forecast returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.getCustomForecast"] = true;
9+
const apiInstance = new v2.CloudCostManagementApi(configuration);
10+
11+
const params: v2.CloudCostManagementApiGetCustomForecastRequest = {
12+
budgetId: "budget_id",
13+
};
14+
15+
apiInstance
16+
.getCustomForecast(params)
17+
.then((data: v2.CustomForecastResponse) => {
18+
console.log(
19+
"API called successfully. Returned data: " + JSON.stringify(data)
20+
);
21+
})
22+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7728,6 +7728,13 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
77287728
},
77297729
"operationResponseType": "{}",
77307730
},
7731+
"v2.GetCustomForecast": {
7732+
"budgetId": {
7733+
"type": "string",
7734+
"format": "",
7735+
},
7736+
"operationResponseType": "CustomForecastResponse",
7737+
},
77317738
"v2.DeleteCustomForecast": {
77327739
"budgetId": {
77337740
"type": "string",

features/v2/cloud_cost_management.feature

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,30 @@ Feature: Cloud Cost Management
375375
When the request is sent
376376
Then the response status is 404 Not Found
377377

378+
@generated @skip @team:DataDog/cloud-cost-management
379+
Scenario: Get a budget's custom forecast returns "Bad Request" response
380+
Given operation "GetCustomForecast" enabled
381+
And new "GetCustomForecast" request
382+
And request contains "budget_id" parameter from "REPLACE.ME"
383+
When the request is sent
384+
Then the response status is 400 Bad Request
385+
386+
@generated @skip @team:DataDog/cloud-cost-management
387+
Scenario: Get a budget's custom forecast returns "Not Found" response
388+
Given operation "GetCustomForecast" enabled
389+
And new "GetCustomForecast" request
390+
And request contains "budget_id" parameter from "REPLACE.ME"
391+
When the request is sent
392+
Then the response status is 404 Not Found
393+
394+
@generated @skip @team:DataDog/cloud-cost-management
395+
Scenario: Get a budget's custom forecast returns "OK" response
396+
Given operation "GetCustomForecast" enabled
397+
And new "GetCustomForecast" request
398+
And request contains "budget_id" parameter from "REPLACE.ME"
399+
When the request is sent
400+
Then the response status is 200 OK
401+
378402
@replay-only @team:DataDog/cloud-cost-management
379403
Scenario: Get a tag pipeline ruleset returns "OK" response
380404
Given new "GetTagPipelinesRuleset" request

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,12 @@
17851785
"type": "idempotent"
17861786
}
17871787
},
1788+
"GetCustomForecast": {
1789+
"tag": "Cloud Cost Management",
1790+
"undo": {
1791+
"type": "safe"
1792+
}
1793+
},
17881794
"ListBudgets": {
17891795
"tag": "Cloud Cost Management",
17901796
"undo": {

packages/datadog-api-client-common/configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ export function createConfiguration(
465465
"v2.getCommitmentsUtilizationTimeseries": false,
466466
"v2.getCostAnomaly": false,
467467
"v2.getCostTagMetadataCurrency": false,
468+
"v2.getCustomForecast": false,
468469
"v2.listCostAnomalies": false,
469470
"v2.listCostTagKeySources": false,
470471
"v2.listCostTagMetadata": false,

packages/datadog-api-client-v2/apis/CloudCostManagementApi.ts

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,6 +1892,45 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory
18921892
return requestContext;
18931893
}
18941894

1895+
public async getCustomForecast(
1896+
budgetId: string,
1897+
_options?: Configuration
1898+
): Promise<RequestContext> {
1899+
const _config = _options || this.configuration;
1900+
1901+
logger.warn("Using unstable operation 'getCustomForecast'");
1902+
if (!_config.unstableOperations["v2.getCustomForecast"]) {
1903+
throw new Error("Unstable operation 'getCustomForecast' is disabled");
1904+
}
1905+
1906+
// verify required parameter 'budgetId' is not null or undefined
1907+
if (budgetId === null || budgetId === undefined) {
1908+
throw new RequiredError("budgetId", "getCustomForecast");
1909+
}
1910+
1911+
// Path Params
1912+
const localVarPath =
1913+
"/api/v2/cost/budget/{budget_id}/custom-forecast".replace(
1914+
"{budget_id}",
1915+
encodeURIComponent(String(budgetId))
1916+
);
1917+
1918+
// Make Request Context
1919+
const requestContext = _config
1920+
.getServer("v2.CloudCostManagementApi.getCustomForecast")
1921+
.makeRequestContext(localVarPath, HttpMethod.GET);
1922+
requestContext.setHeaderParam("Accept", "application/json");
1923+
requestContext.setHttpConfig(_config.httpConfig);
1924+
1925+
// Apply auth methods
1926+
applySecurityAuthentication(_config, requestContext, [
1927+
"apiKeyAuth",
1928+
"appKeyAuth",
1929+
]);
1930+
1931+
return requestContext;
1932+
}
1933+
18951934
public async getTagPipelinesRuleset(
18961935
rulesetId: string,
18971936
_options?: Configuration
@@ -5576,6 +5615,68 @@ export class CloudCostManagementApiResponseProcessor {
55765615
);
55775616
}
55785617

5618+
/**
5619+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
5620+
* to the expected objects
5621+
*
5622+
* @params response Response returned by the server for a request to getCustomForecast
5623+
* @throws ApiException if the response code was not in [200, 299]
5624+
*/
5625+
public async getCustomForecast(
5626+
response: ResponseContext
5627+
): Promise<CustomForecastResponse> {
5628+
const contentType = ObjectSerializer.normalizeMediaType(
5629+
response.headers["content-type"]
5630+
);
5631+
if (response.httpStatusCode === 200) {
5632+
const body: CustomForecastResponse = ObjectSerializer.deserialize(
5633+
ObjectSerializer.parse(await response.body.text(), contentType),
5634+
"CustomForecastResponse"
5635+
) as CustomForecastResponse;
5636+
return body;
5637+
}
5638+
if (
5639+
response.httpStatusCode === 400 ||
5640+
response.httpStatusCode === 404 ||
5641+
response.httpStatusCode === 429
5642+
) {
5643+
const bodyText = ObjectSerializer.parse(
5644+
await response.body.text(),
5645+
contentType
5646+
);
5647+
let body: APIErrorResponse;
5648+
try {
5649+
body = ObjectSerializer.deserialize(
5650+
bodyText,
5651+
"APIErrorResponse"
5652+
) as APIErrorResponse;
5653+
} catch (error) {
5654+
logger.debug(`Got error deserializing error: ${error}`);
5655+
throw new ApiException<APIErrorResponse>(
5656+
response.httpStatusCode,
5657+
bodyText
5658+
);
5659+
}
5660+
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
5661+
}
5662+
5663+
// Work around for missing responses in specification, e.g. for petstore.yaml
5664+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
5665+
const body: CustomForecastResponse = ObjectSerializer.deserialize(
5666+
ObjectSerializer.parse(await response.body.text(), contentType),
5667+
"CustomForecastResponse",
5668+
""
5669+
) as CustomForecastResponse;
5670+
return body;
5671+
}
5672+
5673+
const body = (await response.body.text()) || "";
5674+
throw new ApiException<string>(
5675+
response.httpStatusCode,
5676+
'Unknown API Status Code!\nBody: "' + body + '"'
5677+
);
5678+
}
5679+
55795680
/**
55805681
* Unwraps the actual response sent by the server from the response context and deserializes the response content
55815682
* to the expected objects
@@ -8125,6 +8226,14 @@ export interface CloudCostManagementApiGetCustomCostsFileRequest {
81258226
fileId: string;
81268227
}
81278228

8229+
export interface CloudCostManagementApiGetCustomForecastRequest {
8230+
/**
8231+
* Budget id.
8232+
* @type string
8233+
*/
8234+
budgetId: string;
8235+
}
8236+
81288237
export interface CloudCostManagementApiGetTagPipelinesRulesetRequest {
81298238
/**
81308239
* The unique identifier of the ruleset
@@ -9311,6 +9420,27 @@ export class CloudCostManagementApi {
93119420
});
93129421
}
93139422

9423+
/**
9424+
* Get the custom forecast for a budget.
9425+
* @param param The request object
9426+
*/
9427+
public getCustomForecast(
9428+
param: CloudCostManagementApiGetCustomForecastRequest,
9429+
options?: Configuration
9430+
): Promise<CustomForecastResponse> {
9431+
const requestContextPromise = this.requestFactory.getCustomForecast(
9432+
param.budgetId,
9433+
options
9434+
);
9435+
return requestContextPromise.then((requestContext) => {
9436+
return this.configuration.httpApi
9437+
.send(requestContext)
9438+
.then((responseContext) => {
9439+
return this.responseProcessor.getCustomForecast(responseContext);
9440+
});
9441+
});
9442+
}
9443+
93149444
/**
93159445
* Get a specific tag pipeline ruleset - Retrieve a specific tag pipeline ruleset by its ID
93169446
* @param param The request object

packages/datadog-api-client-v2/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ export {
348348
CloudCostManagementApiGetCostTagMetadataCurrencyRequest,
349349
CloudCostManagementApiGetCustomAllocationRuleRequest,
350350
CloudCostManagementApiGetCustomCostsFileRequest,
351+
CloudCostManagementApiGetCustomForecastRequest,
351352
CloudCostManagementApiGetTagPipelinesRulesetRequest,
352353
CloudCostManagementApiListCostAnomaliesRequest,
353354
CloudCostManagementApiListCostTagDescriptionsRequest,

0 commit comments

Comments
 (0)