Skip to content

Commit 60d3480

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit dcadb1c of spec repo (#119)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 576da1b commit 60d3480

19 files changed

+909
-5
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.4.1.dev6",
7-
"regenerated": "2021-05-07 12:39:57.714478",
8-
"spec_repo_commit": "52e5730"
7+
"regenerated": "2021-05-10 13:53:22.439851",
8+
"spec_repo_commit": "dcadb1c"
99
},
1010
"v2": {
1111
"apigentools_version": "1.4.1.dev6",
12-
"regenerated": "2021-05-07 12:40:03.752061",
13-
"spec_repo_commit": "52e5730"
12+
"regenerated": "2021-05-10 13:53:28.157313",
13+
"spec_repo_commit": "dcadb1c"
1414
}
1515
}
1616
}

features/v1/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,12 @@
10741074
"type": "safe"
10751075
}
10761076
},
1077+
"GetUsageLogsByRetention": {
1078+
"tag": "Usage Metering",
1079+
"undo": {
1080+
"type": "safe"
1081+
}
1082+
},
10771083
"GetUsageLogsByIndex": {
10781084
"tag": "Usage Metering",
10791085
"undo": {

features/v1/usage_metering.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ Feature: Usage Metering
3131
When the request is sent
3232
Then the response status is 200 OK
3333

34+
@generated @skip
35+
Scenario: Get hourly logs usage by retention returns "Bad Request" response
36+
Given new "GetUsageLogsByRetention" request
37+
When the request is sent
38+
Then the response status is 400 Bad Request
39+
40+
@generated @skip
41+
Scenario: Get hourly logs usage by retention returns "OK" response
42+
Given new "GetUsageLogsByRetention" request
43+
When the request is sent
44+
Then the response status is 200 OK
45+
3446
@generated @skip
3547
Scenario: Get hourly usage for Compliance Monitoring returns "Bad Request" response
3648
Given new "GetUsageComplianceMonitoring" request

packages/datadog-api-client-v1/.openapi-generator/FILES

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ models/LogsArithmeticProcessor.ts
185185
models/LogsArithmeticProcessorType.ts
186186
models/LogsAttributeRemapper.ts
187187
models/LogsAttributeRemapperType.ts
188+
models/LogsByRetention.ts
189+
models/LogsByRetentionMonthlyUsage.ts
190+
models/LogsByRetentionOrgUsage.ts
191+
models/LogsByRetentionOrgs.ts
188192
models/LogsCategoryProcessor.ts
189193
models/LogsCategoryProcessorCategory.ts
190194
models/LogsCategoryProcessorType.ts
@@ -215,6 +219,8 @@ models/LogsPipelineProcessorType.ts
215219
models/LogsPipelinesOrder.ts
216220
models/LogsProcessor.ts
217221
models/LogsQueryCompute.ts
222+
models/LogsRetentionAggSumUsage.ts
223+
models/LogsRetentionSumUsage.ts
218224
models/LogsServiceRemapper.ts
219225
models/LogsServiceRemapperType.ts
220226
models/LogsSort.ts
@@ -467,6 +473,8 @@ models/UsageLambdaHour.ts
467473
models/UsageLambdaResponse.ts
468474
models/UsageLogsByIndexHour.ts
469475
models/UsageLogsByIndexResponse.ts
476+
models/UsageLogsByRetentionHour.ts
477+
models/UsageLogsByRetentionResponse.ts
470478
models/UsageLogsHour.ts
471479
models/UsageLogsResponse.ts
472480
models/UsageMetricCategory.ts

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

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { UsageIngestedSpansResponse } from '../models/UsageIngestedSpansResponse
2222
import { UsageIoTResponse } from '../models/UsageIoTResponse';
2323
import { UsageLambdaResponse } from '../models/UsageLambdaResponse';
2424
import { UsageLogsByIndexResponse } from '../models/UsageLogsByIndexResponse';
25+
import { UsageLogsByRetentionResponse } from '../models/UsageLogsByRetentionResponse';
2526
import { UsageLogsResponse } from '../models/UsageLogsResponse';
2627
import { UsageNetworkFlowsResponse } from '../models/UsageNetworkFlowsResponse';
2728
import { UsageNetworkHostsResponse } from '../models/UsageNetworkHostsResponse';
@@ -1010,6 +1011,59 @@ export class UsageMeteringApiRequestFactory extends BaseAPIRequestFactory {
10101011
return requestContext;
10111012
}
10121013

1014+
/**
1015+
* Get hourly usage for indexed logs by retention period.
1016+
* Get hourly logs usage by retention
1017+
* @param startHr Datetime in ISO-8601 format, UTC, precise to hour: &#x60;[YYYY-MM-DDThh]&#x60; for usage beginning at this hour.
1018+
* @param endHr Datetime in ISO-8601 format, UTC, precise to hour: &#x60;[YYYY-MM-DDThh]&#x60; for usage ending **before** this hour.
1019+
*/
1020+
public async getUsageLogsByRetention(startHr: Date, endHr?: Date, options?: Configuration): Promise<RequestContext> {
1021+
let config = options || this.configuration;
1022+
1023+
// verify required parameter 'startHr' is not null or undefined
1024+
if (startHr === null || startHr === undefined) {
1025+
throw new RequiredError('Required parameter startHr was null or undefined when calling getUsageLogsByRetention.');
1026+
}
1027+
1028+
1029+
1030+
// Path Params
1031+
const localVarPath = '/api/v1/usage/logs-by-retention';
1032+
1033+
// Make Request Context
1034+
const requestContext = getServer(config, 'UsageMeteringApi.getUsageLogsByRetention').makeRequestContext(localVarPath, HttpMethod.GET);
1035+
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1036+
requestContext.setHttpConfig(config.httpConfig);
1037+
1038+
// Query Params
1039+
if (startHr !== undefined) {
1040+
requestContext.setQueryParam("start_hr", ObjectSerializer.serialize(startHr, "Date", "date-time"));
1041+
}
1042+
if (endHr !== undefined) {
1043+
requestContext.setQueryParam("end_hr", ObjectSerializer.serialize(endHr, "Date", "date-time"));
1044+
}
1045+
1046+
// Header Params
1047+
1048+
// Form Params
1049+
1050+
1051+
// Body Params
1052+
1053+
let authMethod = null;
1054+
// Apply auth methods
1055+
authMethod = config.authMethods["apiKeyAuth"]
1056+
if (authMethod) {
1057+
await authMethod.applySecurityAuthentication(requestContext);
1058+
}
1059+
authMethod = config.authMethods["appKeyAuth"]
1060+
if (authMethod) {
1061+
await authMethod.applySecurityAuthentication(requestContext);
1062+
}
1063+
1064+
return requestContext;
1065+
}
1066+
10131067
/**
10141068
* Get hourly usage for network flows.
10151069
* Get hourly usage for Network Flows
@@ -2443,6 +2497,50 @@ export class UsageMeteringApiResponseProcessor {
24432497
throw new ApiException<string>(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
24442498
}
24452499

2500+
/**
2501+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
2502+
* to the expected objects
2503+
*
2504+
* @params response Response returned by the server for a request to getUsageLogsByRetention
2505+
* @throws ApiException if the response code was not in [200, 299]
2506+
*/
2507+
public async getUsageLogsByRetention(response: ResponseContext): Promise<UsageLogsByRetentionResponse > {
2508+
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2509+
if (isCodeInRange("200", response.httpStatusCode)) {
2510+
const body: UsageLogsByRetentionResponse = ObjectSerializer.deserialize(
2511+
ObjectSerializer.parse(await response.body.text(), contentType),
2512+
"UsageLogsByRetentionResponse", ""
2513+
) as UsageLogsByRetentionResponse;
2514+
return body;
2515+
}
2516+
if (isCodeInRange("400", response.httpStatusCode)) {
2517+
const body: APIErrorResponse = ObjectSerializer.deserialize(
2518+
ObjectSerializer.parse(await response.body.text(), contentType),
2519+
"APIErrorResponse", ""
2520+
) as APIErrorResponse;
2521+
throw new ApiException<APIErrorResponse>(400, body);
2522+
}
2523+
if (isCodeInRange("403", response.httpStatusCode)) {
2524+
const body: APIErrorResponse = ObjectSerializer.deserialize(
2525+
ObjectSerializer.parse(await response.body.text(), contentType),
2526+
"APIErrorResponse", ""
2527+
) as APIErrorResponse;
2528+
throw new ApiException<APIErrorResponse>(403, body);
2529+
}
2530+
2531+
// Work around for missing responses in specification, e.g. for petstore.yaml
2532+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2533+
const body: UsageLogsByRetentionResponse = ObjectSerializer.deserialize(
2534+
ObjectSerializer.parse(await response.body.text(), contentType),
2535+
"UsageLogsByRetentionResponse", ""
2536+
) as UsageLogsByRetentionResponse;
2537+
return body;
2538+
}
2539+
2540+
let body = response.body || "";
2541+
throw new ApiException<string>(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
2542+
}
2543+
24462544
/**
24472545
* Unwraps the actual response sent by the server from the response context and deserializes the response content
24482546
* to the expected objects

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

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/**
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2020-Present Datadog, Inc.
5+
*
6+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7+
* https://openapi-generator.tech
8+
* Do not edit the class manually.
9+
*/
10+
11+
import { LogsByRetentionMonthlyUsage } from './LogsByRetentionMonthlyUsage';
12+
import { LogsByRetentionOrgs } from './LogsByRetentionOrgs';
13+
import { LogsRetentionAggSumUsage } from './LogsRetentionAggSumUsage';
14+
import { HttpFile } from '../http/http';
15+
import { ObjectSerializer } from './ObjectSerializer';
16+
17+
/**
18+
* Object containing logs usage data broken down by retention period.
19+
*/
20+
21+
export class LogsByRetention {
22+
'orgs'?: LogsByRetentionOrgs;
23+
/**
24+
* Aggregated index logs usage for each retention period with usage.
25+
*/
26+
'usage'?: Array<LogsRetentionAggSumUsage>;
27+
'usageByMonth'?: LogsByRetentionMonthlyUsage;
28+
29+
static readonly discriminator: string | undefined = undefined;
30+
31+
static readonly attributeTypeMap: {[key: string]: {baseName: string, type: string, format: string}} = {
32+
"orgs": {
33+
"baseName": "orgs",
34+
"type": "LogsByRetentionOrgs",
35+
"format": ""
36+
},
37+
"usage": {
38+
"baseName": "usage",
39+
"type": "Array<LogsRetentionAggSumUsage>",
40+
"format": ""
41+
},
42+
"usageByMonth": {
43+
"baseName": "usage_by_month",
44+
"type": "LogsByRetentionMonthlyUsage",
45+
"format": ""
46+
} };
47+
48+
static getAttributeTypeMap() {
49+
return LogsByRetention.attributeTypeMap;
50+
}
51+
52+
static deserialize(data: {[key: string]: any}): LogsByRetention {
53+
let res = new LogsByRetention();
54+
55+
res.orgs = ObjectSerializer.deserialize(data.orgs, "LogsByRetentionOrgs", "")
56+
57+
res.usage = ObjectSerializer.deserialize(data.usage, "Array<LogsRetentionAggSumUsage>", "")
58+
59+
res.usageByMonth = ObjectSerializer.deserialize(data.usage_by_month, "LogsByRetentionMonthlyUsage", "")
60+
61+
62+
return res;
63+
}
64+
65+
static serialize(data: LogsByRetention): {[key: string]: any} {
66+
let attributeTypes = LogsByRetention.getAttributeTypeMap();
67+
let res: {[index: string]: any} = {};
68+
for (let [key, value] of Object.entries(data)) {
69+
if (!(key in attributeTypes)) {
70+
throw new TypeError(`${key} attribute not in schema`);
71+
}
72+
}
73+
res.orgs = ObjectSerializer.serialize(data.orgs, "LogsByRetentionOrgs", "")
74+
75+
res.usage = ObjectSerializer.serialize(data.usage, "Array<LogsRetentionAggSumUsage>", "")
76+
77+
res.usage_by_month = ObjectSerializer.serialize(data.usageByMonth, "LogsByRetentionMonthlyUsage", "")
78+
79+
return res
80+
}
81+
82+
public constructor() {
83+
}
84+
}
85+
86+
87+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2020-Present Datadog, Inc.
5+
*
6+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7+
* https://openapi-generator.tech
8+
* Do not edit the class manually.
9+
*/
10+
11+
import { LogsRetentionSumUsage } from './LogsRetentionSumUsage';
12+
import { HttpFile } from '../http/http';
13+
import { ObjectSerializer } from './ObjectSerializer';
14+
15+
/**
16+
* Object containing a summary of indexed logs usage by retention period for a single month.
17+
*/
18+
19+
export class LogsByRetentionMonthlyUsage {
20+
/**
21+
* The month for the usage.
22+
*/
23+
'date'?: string;
24+
/**
25+
* Indexed logs usage for each active retention for the month.
26+
*/
27+
'usage'?: Array<LogsRetentionSumUsage>;
28+
29+
static readonly discriminator: string | undefined = undefined;
30+
31+
static readonly attributeTypeMap: {[key: string]: {baseName: string, type: string, format: string}} = {
32+
"date": {
33+
"baseName": "date",
34+
"type": "string",
35+
"format": "datetime"
36+
},
37+
"usage": {
38+
"baseName": "usage",
39+
"type": "Array<LogsRetentionSumUsage>",
40+
"format": ""
41+
} };
42+
43+
static getAttributeTypeMap() {
44+
return LogsByRetentionMonthlyUsage.attributeTypeMap;
45+
}
46+
47+
static deserialize(data: {[key: string]: any}): LogsByRetentionMonthlyUsage {
48+
let res = new LogsByRetentionMonthlyUsage();
49+
50+
res.date = ObjectSerializer.deserialize(data.date, "string", "datetime")
51+
52+
res.usage = ObjectSerializer.deserialize(data.usage, "Array<LogsRetentionSumUsage>", "")
53+
54+
55+
return res;
56+
}
57+
58+
static serialize(data: LogsByRetentionMonthlyUsage): {[key: string]: any} {
59+
let attributeTypes = LogsByRetentionMonthlyUsage.getAttributeTypeMap();
60+
let res: {[index: string]: any} = {};
61+
for (let [key, value] of Object.entries(data)) {
62+
if (!(key in attributeTypes)) {
63+
throw new TypeError(`${key} attribute not in schema`);
64+
}
65+
}
66+
res.date = ObjectSerializer.serialize(data.date, "string", "datetime")
67+
68+
res.usage = ObjectSerializer.serialize(data.usage, "Array<LogsRetentionSumUsage>", "")
69+
70+
return res
71+
}
72+
73+
public constructor() {
74+
}
75+
}
76+
77+
78+

0 commit comments

Comments
 (0)