Skip to content

Commit ce9a706

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit c021d4b of spec repo
1 parent 9e6f711 commit ce9a706

6 files changed

Lines changed: 230 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.

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": {

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7746,6 +7746,13 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
77467746
},
77477747
operationResponseType: "{}",
77487748
},
7749+
"CloudCostManagementApi.V2.GetCustomForecast": {
7750+
budgetId: {
7751+
type: "string",
7752+
format: "",
7753+
},
7754+
operationResponseType: "CustomForecastResponse",
7755+
},
77497756
"CloudCostManagementApi.V2.DeleteCustomForecast": {
77507757
budgetId: {
77517758
type: "string",

services/cloud_cost_management/src/v2/CloudCostManagementApi.ts

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,6 +2273,59 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory
22732273
return requestContext;
22742274
}
22752275

2276+
public async getCustomForecast(
2277+
budgetId: string,
2278+
_options?: Configuration,
2279+
): Promise<RequestContext> {
2280+
const _config = _options || this.configuration;
2281+
2282+
if (
2283+
!_config.unstableOperations["CloudCostManagementApi.v2.getCustomForecast"]
2284+
) {
2285+
throw new Error(
2286+
"Unstable operation 'getCustomForecast' is disabled. Enable it by setting `configuration.unstableOperations['CloudCostManagementApi.v2.getCustomForecast'] = true`",
2287+
);
2288+
}
2289+
2290+
// verify required parameter 'budgetId' is not null or undefined
2291+
if (budgetId === null || budgetId === undefined) {
2292+
throw new RequiredError("budgetId", "getCustomForecast");
2293+
}
2294+
2295+
// Path Params
2296+
const localVarPath =
2297+
"/api/v2/cost/budget/{budget_id}/custom-forecast".replace(
2298+
"{budget_id}",
2299+
encodeURIComponent(String(budgetId)),
2300+
);
2301+
2302+
// Make Request Context
2303+
const { server, overrides } = _config.getServerAndOverrides(
2304+
"CloudCostManagementApi.v2.getCustomForecast",
2305+
CloudCostManagementApi.operationServers,
2306+
);
2307+
const requestContext = server.makeRequestContext(
2308+
localVarPath,
2309+
HttpMethod.GET,
2310+
overrides,
2311+
);
2312+
requestContext.setHeaderParam("Accept", "application/json");
2313+
requestContext.setHttpConfig(_config.httpConfig);
2314+
2315+
// Set User-Agent
2316+
if (this.userAgent) {
2317+
requestContext.setHeaderParam("User-Agent", this.userAgent);
2318+
}
2319+
2320+
// Apply auth methods
2321+
applySecurityAuthentication(_config, requestContext, [
2322+
"apiKeyAuth",
2323+
"appKeyAuth",
2324+
]);
2325+
2326+
return requestContext;
2327+
}
2328+
22762329
public async getTagPipelinesRuleset(
22772330
rulesetId: string,
22782331
_options?: Configuration,
@@ -6224,6 +6277,66 @@ export class CloudCostManagementApiResponseProcessor {
62246277
);
62256278
}
62266279

6280+
/**
6281+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
6282+
* to the expected objects
6283+
*
6284+
* @params response Response returned by the server for a request to getCustomForecast
6285+
* @throws ApiException if the response code was not in [200, 299]
6286+
*/
6287+
public async getCustomForecast(
6288+
response: ResponseContext,
6289+
): Promise<CustomForecastResponse> {
6290+
const contentType = normalizeMediaType(response.headers["content-type"]);
6291+
if (response.httpStatusCode === 200) {
6292+
const body: CustomForecastResponse = deserialize(
6293+
parse(await response.body.text(), contentType),
6294+
TypingInfo,
6295+
"CustomForecastResponse",
6296+
) as CustomForecastResponse;
6297+
return body;
6298+
}
6299+
if (
6300+
response.httpStatusCode === 400 ||
6301+
response.httpStatusCode === 404 ||
6302+
response.httpStatusCode === 429
6303+
) {
6304+
const bodyText = parse(await response.body.text(), contentType);
6305+
let body: APIErrorResponse;
6306+
try {
6307+
body = deserialize(
6308+
bodyText,
6309+
TypingInfo,
6310+
"APIErrorResponse",
6311+
) as APIErrorResponse;
6312+
} catch (error) {
6313+
logger.debug(`Got error deserializing error: ${error}`);
6314+
throw new ApiException<APIErrorResponse>(
6315+
response.httpStatusCode,
6316+
bodyText,
6317+
);
6318+
}
6319+
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
6320+
}
6321+
6322+
// Work around for missing responses in specification, e.g. for petstore.yaml
6323+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
6324+
const body: CustomForecastResponse = deserialize(
6325+
parse(await response.body.text(), contentType),
6326+
TypingInfo,
6327+
"CustomForecastResponse",
6328+
"",
6329+
) as CustomForecastResponse;
6330+
return body;
6331+
}
6332+
6333+
const body = (await response.body.text()) || "";
6334+
throw new ApiException<string>(
6335+
response.httpStatusCode,
6336+
'Unknown API Status Code!\nBody: "' + body + '"',
6337+
);
6338+
}
6339+
62276340
/**
62286341
* Unwraps the actual response sent by the server from the response context and deserializes the response content
62296342
* to the expected objects
@@ -8695,6 +8808,14 @@ export interface CloudCostManagementApiGetCustomCostsFileRequest {
86958808
fileId: string;
86968809
}
86978810

8811+
export interface CloudCostManagementApiGetCustomForecastRequest {
8812+
/**
8813+
* Budget id.
8814+
* @type string
8815+
*/
8816+
budgetId: string;
8817+
}
8818+
86988819
export interface CloudCostManagementApiGetTagPipelinesRulesetRequest {
86998820
/**
87008821
* The unique identifier of the ruleset
@@ -9884,6 +10005,27 @@ export class CloudCostManagementApi {
988410005
});
988510006
}
988610007

10008+
/**
10009+
* Get the custom forecast for a budget.
10010+
* @param param The request object
10011+
*/
10012+
public getCustomForecast(
10013+
param: CloudCostManagementApiGetCustomForecastRequest,
10014+
options?: Configuration,
10015+
): Promise<CustomForecastResponse> {
10016+
const requestContextPromise = this.requestFactory.getCustomForecast(
10017+
param.budgetId,
10018+
options,
10019+
);
10020+
return requestContextPromise.then((requestContext) => {
10021+
return this.configuration.httpApi
10022+
.send(requestContext)
10023+
.then((responseContext) => {
10024+
return this.responseProcessor.getCustomForecast(responseContext);
10025+
});
10026+
});
10027+
}
10028+
988710029
/**
988810030
* Get a specific tag pipeline ruleset - Retrieve a specific tag pipeline ruleset by its ID
988910031
* @param param The request object

services/cloud_cost_management/src/v2/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export {
3232
CloudCostManagementApiGetCostTagMetadataCurrencyRequest,
3333
CloudCostManagementApiGetCustomAllocationRuleRequest,
3434
CloudCostManagementApiGetCustomCostsFileRequest,
35+
CloudCostManagementApiGetCustomForecastRequest,
3536
CloudCostManagementApiGetTagPipelinesRulesetRequest,
3637
CloudCostManagementApiListCostAnomaliesRequest,
3738
CloudCostManagementApiListCostTagDescriptionsRequest,

0 commit comments

Comments
 (0)