Skip to content

Commit

Permalink
Regenerate client from commit 603ea76a of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Oct 22, 2024
1 parent fa05cb3 commit 153cca6
Show file tree
Hide file tree
Showing 54 changed files with 1,104 additions and 494 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-21 20:59:46.944958",
"spec_repo_commit": "9ac9609b"
"regenerated": "2024-10-22 18:12:46.451600",
"spec_repo_commit": "603ea76a"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-21 20:59:46.962979",
"spec_repo_commit": "9ac9609b"
"regenerated": "2024-10-22 18:12:46.471165",
"spec_repo_commit": "603ea76a"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"2024-10-21T20:05:58.636Z"
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"log": {
"_recordingName": "Security Monitoring/List findings with detection_type query param returns \"OK\" response",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.5"
},
"entries": [
{
"_id": "5f6fcc703704b0462fc33728fd9b12b2",
"_order": 0,
"cache": {},
"request": {
"bodySize": 0,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
}
],
"headersSize": 611,
"httpVersion": "HTTP/1.1",
"method": "GET",
"queryString": [
{
"name": "filter",
"value": {
"vulnerability_type": [
"misconfiguration",
"attack_path"
]
}
}
],
"url": "https://api.datadoghq.com/api/v2/posture_management/findings?filter%5Bvulnerability_type%5D=misconfiguration&filter%5Bvulnerability_type%5D=attack_path"
},
"response": {
"bodySize": 89,
"content": {
"mimeType": "application/vnd.api+json",
"size": 89,
"text": "{\"data\":[],\"meta\":{\"page\":{\"total_filtered_count\":0},\"snapshot_timestamp\":1729541158755}}"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/vnd.api+json"
}
],
"headersSize": 524,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2024-10-21T20:05:58.644Z",
"time": 141
}
],
"pages": [],
"version": "1.2"
}
}
22 changes: 22 additions & 0 deletions examples/v2/security-monitoring/ListFindings_1668290866.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* List findings with detection_type query param returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.listFindings"] = true;
const apiInstance = new v2.SecurityMonitoringApi(configuration);

const params: v2.SecurityMonitoringApiListFindingsRequest = {
filterVulnerabilityType: ["misconfiguration", "attack_path"],
};

apiInstance
.listFindings(params)
.then((data: v2.ListFindingsResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
8 changes: 8 additions & 0 deletions features/v2/security_monitoring.feature
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,14 @@ Feature: Security Monitoring
When the request with pagination is sent
Then the response status is 200 OK

@team:DataDog/cloud-security-posture-management
Scenario: List findings with detection_type query param returns "OK" response
Given operation "ListFindings" enabled
And new "ListFindings" request
And request contains "filter[vulnerability_type]" parameter with value ["misconfiguration", "attack_path"]
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/k9-cloud-security-platform
Scenario: List rules returns "Bad Request" response
Given new "ListSecurityMonitoringRules" request
Expand Down
38 changes: 30 additions & 8 deletions packages/datadog-api-client-common/http/http.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { userAgent } from "../../../userAgent";
// TODO: evaluate if we can easily get rid of this library
import FormData from "form-data";
import URLParse from "url-parse";
import { isBrowser } from "../util";
import { COLLECTION_FORMATS } from "../baseapi";

/**
* Interface for aborting fetch requests.
Expand Down Expand Up @@ -88,7 +88,7 @@ export interface HttpConfiguration {
export class RequestContext {
private headers: { [key: string]: string } = {};
private body: RequestBody = undefined;
private url: URLParse;
private url: URL;
private httpConfig: HttpConfiguration = {};

/**
Expand All @@ -101,7 +101,7 @@ export class RequestContext {
url: string,
private httpMethod: HttpMethod
) {
this.url = new URLParse(url, true);
this.url = new URL(url);
if (!isBrowser) {
this.headers = { "user-agent": userAgent };
}
Expand All @@ -120,7 +120,7 @@ export class RequestContext {
*
*/
public setUrl(url: string): void {
this.url = new URLParse(url, true);
this.url = new URL(url);
}

/**
Expand Down Expand Up @@ -148,10 +148,32 @@ export class RequestContext {
return this.body;
}

public setQueryParam(name: string, value: string): void {
const queryObj = this.url.query;
queryObj[name] = value;
this.url.set("query", queryObj);
/**
* Sets query parameters on the request URL
*
* @param name the name of the query parameter
* @param value the value of the query parameter
* @param collectionFormat the format of the query parameter See https://spec.openapis.org/oas/v3.0.2#style-values
*/
public setQueryParam(
name: string,
value: string | string[],
collectionFormat: string
): void {
if (collectionFormat === "multi") {
for (const val of value) {
this.url.searchParams.append(name, val);
}
return;
}

if (Array.isArray(value)) {
const delimiter =
COLLECTION_FORMATS[collectionFormat as keyof typeof COLLECTION_FORMATS];
value = value.join(delimiter);
}

return this.url.searchParams.set(name, value);
}

/**
Expand Down
21 changes: 14 additions & 7 deletions packages/datadog-api-client-v1/apis/AWSIntegrationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,19 +364,22 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
if (accountId !== undefined) {
requestContext.setQueryParam(
"account_id",
ObjectSerializer.serialize(accountId, "string", "")
ObjectSerializer.serialize(accountId, "string", ""),
""
);
}
if (roleName !== undefined) {
requestContext.setQueryParam(
"role_name",
ObjectSerializer.serialize(roleName, "string", "")
ObjectSerializer.serialize(roleName, "string", ""),
""
);
}
if (accessKeyId !== undefined) {
requestContext.setQueryParam(
"access_key_id",
ObjectSerializer.serialize(accessKeyId, "string", "")
ObjectSerializer.serialize(accessKeyId, "string", ""),
""
);
}

Expand Down Expand Up @@ -438,7 +441,8 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
if (accountId !== undefined) {
requestContext.setQueryParam(
"account_id",
ObjectSerializer.serialize(accountId, "string", "")
ObjectSerializer.serialize(accountId, "string", ""),
""
);
}

Expand Down Expand Up @@ -479,19 +483,22 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
if (accountId !== undefined) {
requestContext.setQueryParam(
"account_id",
ObjectSerializer.serialize(accountId, "string", "")
ObjectSerializer.serialize(accountId, "string", ""),
""
);
}
if (roleName !== undefined) {
requestContext.setQueryParam(
"role_name",
ObjectSerializer.serialize(roleName, "string", "")
ObjectSerializer.serialize(roleName, "string", ""),
""
);
}
if (accessKeyId !== undefined) {
requestContext.setQueryParam(
"access_key_id",
ObjectSerializer.serialize(accessKeyId, "string", "")
ObjectSerializer.serialize(accessKeyId, "string", ""),
""
);
}

Expand Down
18 changes: 12 additions & 6 deletions packages/datadog-api-client-v1/apis/DashboardsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,15 @@ export class DashboardsApiRequestFactory extends BaseAPIRequestFactory {
if (pageSize !== undefined) {
requestContext.setQueryParam(
"page_size",
ObjectSerializer.serialize(pageSize, "number", "int64")
ObjectSerializer.serialize(pageSize, "number", "int64"),
""
);
}
if (pageNumber !== undefined) {
requestContext.setQueryParam(
"page_number",
ObjectSerializer.serialize(pageNumber, "number", "int64")
ObjectSerializer.serialize(pageNumber, "number", "int64"),
""
);
}

Expand Down Expand Up @@ -415,25 +417,29 @@ export class DashboardsApiRequestFactory extends BaseAPIRequestFactory {
if (filterShared !== undefined) {
requestContext.setQueryParam(
"filter[shared]",
ObjectSerializer.serialize(filterShared, "boolean", "")
ObjectSerializer.serialize(filterShared, "boolean", ""),
""
);
}
if (filterDeleted !== undefined) {
requestContext.setQueryParam(
"filter[deleted]",
ObjectSerializer.serialize(filterDeleted, "boolean", "")
ObjectSerializer.serialize(filterDeleted, "boolean", ""),
""
);
}
if (count !== undefined) {
requestContext.setQueryParam(
"count",
ObjectSerializer.serialize(count, "number", "int64")
ObjectSerializer.serialize(count, "number", "int64"),
""
);
}
if (start !== undefined) {
requestContext.setQueryParam(
"start",
ObjectSerializer.serialize(start, "number", "int64")
ObjectSerializer.serialize(start, "number", "int64"),
""
);
}

Expand Down
6 changes: 4 additions & 2 deletions packages/datadog-api-client-v1/apis/DowntimesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,15 @@ export class DowntimesApiRequestFactory extends BaseAPIRequestFactory {
if (currentOnly !== undefined) {
requestContext.setQueryParam(
"current_only",
ObjectSerializer.serialize(currentOnly, "boolean", "")
ObjectSerializer.serialize(currentOnly, "boolean", ""),
""
);
}
if (withCreator !== undefined) {
requestContext.setQueryParam(
"with_creator",
ObjectSerializer.serialize(withCreator, "boolean", "")
ObjectSerializer.serialize(withCreator, "boolean", ""),
""
);
}

Expand Down
24 changes: 16 additions & 8 deletions packages/datadog-api-client-v1/apis/EventsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,49 +133,57 @@ export class EventsApiRequestFactory extends BaseAPIRequestFactory {
if (start !== undefined) {
requestContext.setQueryParam(
"start",
ObjectSerializer.serialize(start, "number", "int64")
ObjectSerializer.serialize(start, "number", "int64"),
""
);
}
if (end !== undefined) {
requestContext.setQueryParam(
"end",
ObjectSerializer.serialize(end, "number", "int64")
ObjectSerializer.serialize(end, "number", "int64"),
""
);
}
if (priority !== undefined) {
requestContext.setQueryParam(
"priority",
ObjectSerializer.serialize(priority, "EventPriority", "")
ObjectSerializer.serialize(priority, "EventPriority", ""),
""
);
}
if (sources !== undefined) {
requestContext.setQueryParam(
"sources",
ObjectSerializer.serialize(sources, "string", "")
ObjectSerializer.serialize(sources, "string", ""),
""
);
}
if (tags !== undefined) {
requestContext.setQueryParam(
"tags",
ObjectSerializer.serialize(tags, "string", "")
ObjectSerializer.serialize(tags, "string", ""),
""
);
}
if (unaggregated !== undefined) {
requestContext.setQueryParam(
"unaggregated",
ObjectSerializer.serialize(unaggregated, "boolean", "")
ObjectSerializer.serialize(unaggregated, "boolean", ""),
""
);
}
if (excludeAggregate !== undefined) {
requestContext.setQueryParam(
"exclude_aggregate",
ObjectSerializer.serialize(excludeAggregate, "boolean", "")
ObjectSerializer.serialize(excludeAggregate, "boolean", ""),
""
);
}
if (page !== undefined) {
requestContext.setQueryParam(
"page",
ObjectSerializer.serialize(page, "number", "int32")
ObjectSerializer.serialize(page, "number", "int32"),
""
);
}

Expand Down
Loading

0 comments on commit 153cca6

Please sign in to comment.