Skip to content

Commit a85b014

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 0e95be4c of spec repo
1 parent 87b8aa3 commit a85b014

File tree

12 files changed

+436
-4
lines changed

12 files changed

+436
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2023-10-31 15:36:16.587379",
8-
"spec_repo_commit": "38f019bb"
7+
"regenerated": "2023-10-31 17:31:23.542708",
8+
"spec_repo_commit": "0e95be4c"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-10-31 15:36:16.603629",
13-
"spec_repo_commit": "38f019bb"
12+
"regenerated": "2023-10-31 17:31:23.563020",
13+
"spec_repo_commit": "0e95be4c"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11453,6 +11453,53 @@ components:
1145311453
type: string
1145411454
x-enum-varnames:
1145511455
- PROCESS
11456+
ProjectedCost:
11457+
description: Projected Cost data.
11458+
properties:
11459+
attributes:
11460+
$ref: '#/components/schemas/ProjectedCostAttributes'
11461+
id:
11462+
description: Unique ID of the response.
11463+
type: string
11464+
type:
11465+
$ref: '#/components/schemas/CostByOrgType'
11466+
type: object
11467+
ProjectedCostAttributes:
11468+
description: Projected Cost attributes data.
11469+
properties:
11470+
charges:
11471+
description: List of charges data reported for the requested month.
11472+
items:
11473+
$ref: '#/components/schemas/ChargebackBreakdown'
11474+
type: array
11475+
date:
11476+
description: The month requested.
11477+
format: date-time
11478+
type: string
11479+
org_name:
11480+
description: The organization name.
11481+
type: string
11482+
projected_total_cost:
11483+
description: The total projected cost of products for the month.
11484+
format: double
11485+
type: number
11486+
public_id:
11487+
description: The organization public ID.
11488+
type: string
11489+
region:
11490+
description: The region of the Datadog instance that the organization belongs
11491+
to.
11492+
type: string
11493+
type: object
11494+
ProjectedCostResponse:
11495+
description: Projected Cost response.
11496+
properties:
11497+
data:
11498+
description: Response containing Projected Cost.
11499+
items:
11500+
$ref: '#/components/schemas/ProjectedCost'
11501+
type: array
11502+
type: object
1145611503
QueryFormula:
1145711504
description: A formula for calculation based on one or more queries.
1145811505
properties:
@@ -29223,6 +29270,49 @@ paths:
2922329270
summary: Get hourly usage for observability pipelines
2922429271
tags:
2922529272
- Usage Metering
29273+
/api/v2/usage/projected_cost:
29274+
get:
29275+
description: 'Get projected cost across multi-org and single root-org accounts.
29276+
29277+
Projected cost data is only available for the current month and becomes available
29278+
around the 12th of the month.
29279+
29280+
This endpoint requires the usage_read authorization scope.'
29281+
operationId: GetProjectedCost
29282+
parameters: []
29283+
responses:
29284+
'200':
29285+
content:
29286+
application/json;datetime-format=rfc3339:
29287+
schema:
29288+
$ref: '#/components/schemas/ProjectedCostResponse'
29289+
description: OK
29290+
'400':
29291+
content:
29292+
application/json;datetime-format=rfc3339:
29293+
schema:
29294+
$ref: '#/components/schemas/APIErrorResponse'
29295+
description: Bad Request
29296+
'403':
29297+
content:
29298+
application/json;datetime-format=rfc3339:
29299+
schema:
29300+
$ref: '#/components/schemas/APIErrorResponse'
29301+
description: Forbidden - User is not authorized
29302+
'429':
29303+
content:
29304+
application/json;datetime-format=rfc3339:
29305+
schema:
29306+
$ref: '#/components/schemas/APIErrorResponse'
29307+
description: Too many requests
29308+
security:
29309+
- apiKeyAuth: []
29310+
appKeyAuth: []
29311+
- AuthZ:
29312+
- usage_read
29313+
summary: Get projected cost across your account
29314+
tags:
29315+
- Usage Metering
2922629316
/api/v2/user_invitations:
2922729317
post:
2922829318
description: Sends emails to one or more users inviting them to join the organization.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Get projected cost across your account returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.UsageMeteringApi(configuration);
9+
10+
apiInstance
11+
.getProjectedCost()
12+
.then((data: v2.ProjectedCostResponse) => {
13+
console.log(
14+
"API called successfully. Returned data: " + JSON.stringify(data)
15+
);
16+
})
17+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5073,6 +5073,9 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
50735073
},
50745074
"operationResponseType": "UsageObservabilityPipelinesResponse",
50755075
},
5076+
"v2.GetProjectedCost": {
5077+
"operationResponseType": "ProjectedCostResponse",
5078+
},
50765079
"v2.SendInvitations": {
50775080
"body": {
50785081
"type": "UserInvitationsRequest",

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,6 +1847,12 @@
18471847
"type": "safe"
18481848
}
18491849
},
1850+
"GetProjectedCost": {
1851+
"tag": "Usage Metering",
1852+
"undo": {
1853+
"type": "safe"
1854+
}
1855+
},
18501856
"SendInvitations": {
18511857
"tag": "Users",
18521858
"undo": {

features/v2/usage_metering.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ Feature: Usage Metering
149149
And the response "data[0].type" is equal to "usage_timeseries"
150150
And the response "data[0].attributes.product_family" is equal to "observability-pipelines"
151151

152+
@generated @skip @team:DataDog/red-zone-revenue-query
153+
Scenario: Get projected cost across your account returns "Bad Request" response
154+
Given new "GetProjectedCost" request
155+
When the request is sent
156+
Then the response status is 400 Bad Request
157+
158+
@generated @skip @team:DataDog/red-zone-revenue-query
159+
Scenario: Get projected cost across your account returns "OK" response
160+
Given new "GetProjectedCost" request
161+
When the request is sent
162+
Then the response status is 200 OK
163+
152164
@team:DataDog/red-zone-revenue-query
153165
Scenario: GetEstimatedCostByOrg with both start_month and start_date returns "Bad Request" response
154166
Given new "GetEstimatedCostByOrg" request

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

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { ApiException } from "../../datadog-api-client-common/exception";
1919
import { APIErrorResponse } from "../models/APIErrorResponse";
2020
import { CostByOrgResponse } from "../models/CostByOrgResponse";
2121
import { HourlyUsageResponse } from "../models/HourlyUsageResponse";
22+
import { ProjectedCostResponse } from "../models/ProjectedCostResponse";
2223
import { UsageApplicationSecurityMonitoringResponse } from "../models/UsageApplicationSecurityMonitoringResponse";
2324
import { UsageLambdaTracedInvocationsResponse } from "../models/UsageLambdaTracedInvocationsResponse";
2425
import { UsageObservabilityPipelinesResponse } from "../models/UsageObservabilityPipelinesResponse";
@@ -290,6 +291,34 @@ export class UsageMeteringApiRequestFactory extends BaseAPIRequestFactory {
290291
return requestContext;
291292
}
292293

294+
public async getProjectedCost(
295+
_options?: Configuration
296+
): Promise<RequestContext> {
297+
const _config = _options || this.configuration;
298+
299+
// Path Params
300+
const localVarPath = "/api/v2/usage/projected_cost";
301+
302+
// Make Request Context
303+
const requestContext = _config
304+
.getServer("v2.UsageMeteringApi.getProjectedCost")
305+
.makeRequestContext(localVarPath, HttpMethod.GET);
306+
requestContext.setHeaderParam(
307+
"Accept",
308+
"application/json;datetime-format=rfc3339"
309+
);
310+
requestContext.setHttpConfig(_config.httpConfig);
311+
312+
// Apply auth methods
313+
applySecurityAuthentication(_config, requestContext, [
314+
"AuthZ",
315+
"apiKeyAuth",
316+
"appKeyAuth",
317+
]);
318+
319+
return requestContext;
320+
}
321+
293322
public async getUsageApplicationSecurityMonitoring(
294323
startHr: Date,
295324
endHr?: Date,
@@ -690,6 +719,68 @@ export class UsageMeteringApiResponseProcessor {
690719
);
691720
}
692721

722+
/**
723+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
724+
* to the expected objects
725+
*
726+
* @params response Response returned by the server for a request to getProjectedCost
727+
* @throws ApiException if the response code was not in [200, 299]
728+
*/
729+
public async getProjectedCost(
730+
response: ResponseContext
731+
): Promise<ProjectedCostResponse> {
732+
const contentType = ObjectSerializer.normalizeMediaType(
733+
response.headers["content-type"]
734+
);
735+
if (response.httpStatusCode == 200) {
736+
const body: ProjectedCostResponse = ObjectSerializer.deserialize(
737+
ObjectSerializer.parse(await response.body.text(), contentType),
738+
"ProjectedCostResponse"
739+
) as ProjectedCostResponse;
740+
return body;
741+
}
742+
if (
743+
response.httpStatusCode == 400 ||
744+
response.httpStatusCode == 403 ||
745+
response.httpStatusCode == 429
746+
) {
747+
const bodyText = ObjectSerializer.parse(
748+
await response.body.text(),
749+
contentType
750+
);
751+
let body: APIErrorResponse;
752+
try {
753+
body = ObjectSerializer.deserialize(
754+
bodyText,
755+
"APIErrorResponse"
756+
) as APIErrorResponse;
757+
} catch (error) {
758+
logger.info(`Got error deserializing error: ${error}`);
759+
throw new ApiException<APIErrorResponse>(
760+
response.httpStatusCode,
761+
bodyText
762+
);
763+
}
764+
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
765+
}
766+
767+
// Work around for missing responses in specification, e.g. for petstore.yaml
768+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
769+
const body: ProjectedCostResponse = ObjectSerializer.deserialize(
770+
ObjectSerializer.parse(await response.body.text(), contentType),
771+
"ProjectedCostResponse",
772+
""
773+
) as ProjectedCostResponse;
774+
return body;
775+
}
776+
777+
const body = (await response.body.text()) || "";
778+
throw new ApiException<string>(
779+
response.httpStatusCode,
780+
'Unknown API Status Code!\nBody: "' + body + '"'
781+
);
782+
}
783+
693784
/**
694785
* Unwraps the actual response sent by the server from the response context and deserializes the response content
695786
* to the expected objects
@@ -1159,6 +1250,25 @@ export class UsageMeteringApi {
11591250
});
11601251
}
11611252

1253+
/**
1254+
* Get projected cost across multi-org and single root-org accounts.
1255+
* Projected cost data is only available for the current month and becomes available around the 12th of the month.
1256+
* This endpoint requires the usage_read authorization scope.
1257+
* @param param The request object
1258+
*/
1259+
public getProjectedCost(
1260+
options?: Configuration
1261+
): Promise<ProjectedCostResponse> {
1262+
const requestContextPromise = this.requestFactory.getProjectedCost(options);
1263+
return requestContextPromise.then((requestContext) => {
1264+
return this.configuration.httpApi
1265+
.send(requestContext)
1266+
.then((responseContext) => {
1267+
return this.responseProcessor.getProjectedCost(responseContext);
1268+
});
1269+
});
1270+
}
1271+
11621272
/**
11631273
* Get hourly usage for application security .
11641274
* **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,9 @@ export { ProcessSummariesResponse } from "./models/ProcessSummariesResponse";
11141114
export { ProcessSummary } from "./models/ProcessSummary";
11151115
export { ProcessSummaryAttributes } from "./models/ProcessSummaryAttributes";
11161116
export { ProcessSummaryType } from "./models/ProcessSummaryType";
1117+
export { ProjectedCost } from "./models/ProjectedCost";
1118+
export { ProjectedCostAttributes } from "./models/ProjectedCostAttributes";
1119+
export { ProjectedCostResponse } from "./models/ProjectedCostResponse";
11171120
export { QueryFormula } from "./models/QueryFormula";
11181121
export { QuerySortOrder } from "./models/QuerySortOrder";
11191122
export { RelationshipToIncidentAttachment } from "./models/RelationshipToIncidentAttachment";

packages/datadog-api-client-v2/models/ObjectSerializer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,9 @@ import { ProcessSummariesMetaPage } from "./ProcessSummariesMetaPage";
533533
import { ProcessSummariesResponse } from "./ProcessSummariesResponse";
534534
import { ProcessSummary } from "./ProcessSummary";
535535
import { ProcessSummaryAttributes } from "./ProcessSummaryAttributes";
536+
import { ProjectedCost } from "./ProjectedCost";
537+
import { ProjectedCostAttributes } from "./ProjectedCostAttributes";
538+
import { ProjectedCostResponse } from "./ProjectedCostResponse";
536539
import { QueryFormula } from "./QueryFormula";
537540
import { RUMAggregateBucketValueTimeseriesPoint } from "./RUMAggregateBucketValueTimeseriesPoint";
538541
import { RUMAggregateRequest } from "./RUMAggregateRequest";
@@ -2019,6 +2022,9 @@ const typeMap: { [index: string]: any } = {
20192022
ProcessSummariesResponse: ProcessSummariesResponse,
20202023
ProcessSummary: ProcessSummary,
20212024
ProcessSummaryAttributes: ProcessSummaryAttributes,
2025+
ProjectedCost: ProjectedCost,
2026+
ProjectedCostAttributes: ProjectedCostAttributes,
2027+
ProjectedCostResponse: ProjectedCostResponse,
20222028
QueryFormula: QueryFormula,
20232029
RUMAggregateBucketValueTimeseriesPoint:
20242030
RUMAggregateBucketValueTimeseriesPoint,

0 commit comments

Comments
 (0)