Skip to content

Commit 4c885eb

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add CSM Agentless Read Endpoint (#1971)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent e390ba0 commit 4c885eb

File tree

15 files changed

+543
-4
lines changed

15 files changed

+543
-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": "2025-01-07 19:53:42.897987",
8-
"spec_repo_commit": "d63fa330"
7+
"regenerated": "2025-01-08 14:02:31.156850",
8+
"spec_repo_commit": "1920836f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-07 19:53:42.913387",
13-
"spec_repo_commit": "d63fa330"
12+
"regenerated": "2025-01-08 14:02:31.172021",
13+
"spec_repo_commit": "1920836f"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,6 +2732,57 @@ components:
27322732
$ref: '#/components/schemas/AwsCURConfig'
27332733
type: array
27342734
type: object
2735+
AwsScanOptionsAttributes:
2736+
description: Attributes for the AWS scan options.
2737+
properties:
2738+
lambda:
2739+
description: Indicates if scanning of Lambda functions is enabled.
2740+
example: true
2741+
type: boolean
2742+
sensitive_data:
2743+
description: Indicates if scanning for sensitive data is enabled.
2744+
example: false
2745+
type: boolean
2746+
vuln_containers_os:
2747+
description: Indicates if scanning for vulnerabilities in containers is
2748+
enabled.
2749+
example: true
2750+
type: boolean
2751+
vuln_host_os:
2752+
description: Indicates if scanning for vulnerabilities in hosts is enabled.
2753+
example: true
2754+
type: boolean
2755+
type: object
2756+
AwsScanOptionsData:
2757+
description: Single AWS Scan Options entry.
2758+
properties:
2759+
attributes:
2760+
$ref: '#/components/schemas/AwsScanOptionsAttributes'
2761+
id:
2762+
description: The ID of the AWS account.
2763+
example: '184366314700'
2764+
type: string
2765+
type:
2766+
$ref: '#/components/schemas/AwsScanOptionsType'
2767+
type: object
2768+
AwsScanOptionsResponse:
2769+
description: Response object that includes a list of AWS scan options.
2770+
properties:
2771+
data:
2772+
description: A list of AWS scan options.
2773+
items:
2774+
$ref: '#/components/schemas/AwsScanOptionsData'
2775+
type: array
2776+
type: object
2777+
AwsScanOptionsType:
2778+
default: aws_scan_options
2779+
description: The type of the resource. The value should always be `aws_scan_options`.
2780+
enum:
2781+
- aws_scan_options
2782+
example: aws_scan_options
2783+
type: string
2784+
x-enum-varnames:
2785+
- AWS_SCAN_OPTIONS
27352786
AzureUCConfig:
27362787
description: Azure config.
27372788
properties:
@@ -30222,6 +30273,24 @@ info:
3022230273
version: '1.0'
3022330274
openapi: 3.0.0
3022430275
paths:
30276+
/api/v2/agentless_scanning/accounts/aws:
30277+
get:
30278+
description: Fetches the scan options configured for AWS accounts.
30279+
operationId: ListAwsScanOptions
30280+
responses:
30281+
'200':
30282+
content:
30283+
application/json:
30284+
schema:
30285+
$ref: '#/components/schemas/AwsScanOptionsResponse'
30286+
description: OK
30287+
'403':
30288+
$ref: '#/components/responses/NotAuthorizedResponse'
30289+
'429':
30290+
$ref: '#/components/responses/TooManyRequestsResponse'
30291+
summary: Get AWS Scan Options
30292+
tags:
30293+
- Agentless Scanning
3022530294
/api/v2/api_keys:
3022630295
get:
3022730296
description: List all API keys available for your account.
@@ -48131,6 +48200,11 @@ tags:
4813148200
externalDocs:
4813248201
url: https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection
4813348202
name: AWS Logs Integration
48203+
- description: "Datadog Agentless Scanning provides visibility into risks and vulnerabilities\nwithin
48204+
your hosts, running containers, and serverless functions\u2014all without\nrequiring
48205+
teams to install Agents on every host or where Agents cannot be installed.\nGo
48206+
to https://www.datadoghq.com/blog/agentless-scanning/ to learn more"
48207+
name: Agentless Scanning
4813448208
- description: Datadog App Builder provides a low-code solution to rapidly develop
4813548209
and integrate secure, customized applications into your monitoring stack that
4813648210
are built to accelerate remediation at scale. These API endpoints allow you to
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2024-12-18T15:40:11.636Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"log": {
3+
"_recordingName": "Agentless Scanning/Get AWS Scan Options returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "2cb6ecfe386c3349268926da480a6b5d",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 0,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
}
23+
],
24+
"headersSize": 530,
25+
"httpVersion": "HTTP/1.1",
26+
"method": "GET",
27+
"queryString": [],
28+
"url": "https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws"
29+
},
30+
"response": {
31+
"bodySize": 11,
32+
"content": {
33+
"mimeType": "application/vnd.api+json",
34+
"size": 11,
35+
"text": "{\"data\":[]}"
36+
},
37+
"cookies": [],
38+
"headers": [
39+
{
40+
"name": "content-type",
41+
"value": "application/vnd.api+json"
42+
}
43+
],
44+
"headersSize": 674,
45+
"httpVersion": "HTTP/1.1",
46+
"redirectURL": "",
47+
"status": 200,
48+
"statusText": "OK"
49+
},
50+
"startedDateTime": "2024-12-18T15:40:11.830Z",
51+
"time": 308
52+
}
53+
],
54+
"pages": [],
55+
"version": "1.2"
56+
}
57+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Get AWS Scan Options 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.AgentlessScanningApi(configuration);
9+
10+
apiInstance
11+
.listAwsScanOptions()
12+
.then((data: v2.AwsScanOptionsResponse) => {
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
@@ -2306,6 +2306,9 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
23062306
"v1.Validate": {
23072307
"operationResponseType": "AuthenticationValidationResponse",
23082308
},
2309+
"v2.ListAwsScanOptions": {
2310+
"operationResponseType": "AwsScanOptionsResponse",
2311+
},
23092312
"v2.ListAPIKeys": {
23102313
"pageSize": {
23112314
"type": "number",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@endpoint(agentless-scanning) @endpoint(agentless-scanning-v2)
2+
Feature: Agentless Scanning
3+
Datadog Agentless Scanning provides visibility into risks and
4+
vulnerabilities within your hosts, running containers, and serverless
5+
functions—all without requiring teams to install Agents on every host or
6+
where Agents cannot be installed. Go to
7+
https://www.datadoghq.com/blog/agentless-scanning/ to learn more
8+
9+
@team:DataDog/k9-cloud-security-platform
10+
Scenario: Get AWS Scan Options returns "OK" response
11+
Given a valid "apiKeyAuth" key in the system
12+
And a valid "appKeyAuth" key in the system
13+
And an instance of "AgentlessScanning" API
14+
And new "ListAwsScanOptions" request
15+
When the request is sent
16+
Then the response status is 200 OK

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
2+
"ListAwsScanOptions": {
3+
"tag": "Agentless Scanning",
4+
"undo": {
5+
"type": "safe"
6+
}
7+
},
28
"ListAPIKeys": {
39
"tag": "Key Management",
410
"undo": {
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
import { BaseAPIRequestFactory } from "../../datadog-api-client-common/baseapi";
2+
import {
3+
Configuration,
4+
applySecurityAuthentication,
5+
} from "../../datadog-api-client-common/configuration";
6+
import {
7+
RequestContext,
8+
HttpMethod,
9+
ResponseContext,
10+
} from "../../datadog-api-client-common/http/http";
11+
12+
import { logger } from "../../../logger";
13+
import { ObjectSerializer } from "../models/ObjectSerializer";
14+
import { ApiException } from "../../datadog-api-client-common/exception";
15+
16+
import { APIErrorResponse } from "../models/APIErrorResponse";
17+
import { AwsScanOptionsResponse } from "../models/AwsScanOptionsResponse";
18+
19+
export class AgentlessScanningApiRequestFactory extends BaseAPIRequestFactory {
20+
public async listAwsScanOptions(
21+
_options?: Configuration
22+
): Promise<RequestContext> {
23+
const _config = _options || this.configuration;
24+
25+
// Path Params
26+
const localVarPath = "/api/v2/agentless_scanning/accounts/aws";
27+
28+
// Make Request Context
29+
const requestContext = _config
30+
.getServer("v2.AgentlessScanningApi.listAwsScanOptions")
31+
.makeRequestContext(localVarPath, HttpMethod.GET);
32+
requestContext.setHeaderParam("Accept", "application/json");
33+
requestContext.setHttpConfig(_config.httpConfig);
34+
35+
// Apply auth methods
36+
applySecurityAuthentication(_config, requestContext, [
37+
"apiKeyAuth",
38+
"appKeyAuth",
39+
]);
40+
41+
return requestContext;
42+
}
43+
}
44+
45+
export class AgentlessScanningApiResponseProcessor {
46+
/**
47+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
48+
* to the expected objects
49+
*
50+
* @params response Response returned by the server for a request to listAwsScanOptions
51+
* @throws ApiException if the response code was not in [200, 299]
52+
*/
53+
public async listAwsScanOptions(
54+
response: ResponseContext
55+
): Promise<AwsScanOptionsResponse> {
56+
const contentType = ObjectSerializer.normalizeMediaType(
57+
response.headers["content-type"]
58+
);
59+
if (response.httpStatusCode === 200) {
60+
const body: AwsScanOptionsResponse = ObjectSerializer.deserialize(
61+
ObjectSerializer.parse(await response.body.text(), contentType),
62+
"AwsScanOptionsResponse"
63+
) as AwsScanOptionsResponse;
64+
return body;
65+
}
66+
if (response.httpStatusCode === 403 || response.httpStatusCode === 429) {
67+
const bodyText = ObjectSerializer.parse(
68+
await response.body.text(),
69+
contentType
70+
);
71+
let body: APIErrorResponse;
72+
try {
73+
body = ObjectSerializer.deserialize(
74+
bodyText,
75+
"APIErrorResponse"
76+
) as APIErrorResponse;
77+
} catch (error) {
78+
logger.debug(`Got error deserializing error: ${error}`);
79+
throw new ApiException<APIErrorResponse>(
80+
response.httpStatusCode,
81+
bodyText
82+
);
83+
}
84+
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
85+
}
86+
87+
// Work around for missing responses in specification, e.g. for petstore.yaml
88+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
89+
const body: AwsScanOptionsResponse = ObjectSerializer.deserialize(
90+
ObjectSerializer.parse(await response.body.text(), contentType),
91+
"AwsScanOptionsResponse",
92+
""
93+
) as AwsScanOptionsResponse;
94+
return body;
95+
}
96+
97+
const body = (await response.body.text()) || "";
98+
throw new ApiException<string>(
99+
response.httpStatusCode,
100+
'Unknown API Status Code!\nBody: "' + body + '"'
101+
);
102+
}
103+
}
104+
105+
export class AgentlessScanningApi {
106+
private requestFactory: AgentlessScanningApiRequestFactory;
107+
private responseProcessor: AgentlessScanningApiResponseProcessor;
108+
private configuration: Configuration;
109+
110+
public constructor(
111+
configuration: Configuration,
112+
requestFactory?: AgentlessScanningApiRequestFactory,
113+
responseProcessor?: AgentlessScanningApiResponseProcessor
114+
) {
115+
this.configuration = configuration;
116+
this.requestFactory =
117+
requestFactory || new AgentlessScanningApiRequestFactory(configuration);
118+
this.responseProcessor =
119+
responseProcessor || new AgentlessScanningApiResponseProcessor();
120+
}
121+
122+
/**
123+
* Fetches the scan options configured for AWS accounts.
124+
* @param param The request object
125+
*/
126+
public listAwsScanOptions(
127+
options?: Configuration
128+
): Promise<AwsScanOptionsResponse> {
129+
const requestContextPromise =
130+
this.requestFactory.listAwsScanOptions(options);
131+
return requestContextPromise.then((requestContext) => {
132+
return this.configuration.httpApi
133+
.send(requestContext)
134+
.then((responseContext) => {
135+
return this.responseProcessor.listAwsScanOptions(responseContext);
136+
});
137+
});
138+
}
139+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export {
2727

2828
export { AWSLogsIntegrationApi } from "./apis/AWSLogsIntegrationApi";
2929

30+
export { AgentlessScanningApi } from "./apis/AgentlessScanningApi";
31+
3032
export {
3133
AppsApiCreateAppRequest,
3234
AppsApiDeleteAppRequest,
@@ -742,6 +744,10 @@ export { AWSRegions } from "./models/AWSRegions";
742744
export { AWSRegionsIncludeAll } from "./models/AWSRegionsIncludeAll";
743745
export { AWSRegionsIncludeOnly } from "./models/AWSRegionsIncludeOnly";
744746
export { AWSResourcesConfig } from "./models/AWSResourcesConfig";
747+
export { AwsScanOptionsAttributes } from "./models/AwsScanOptionsAttributes";
748+
export { AwsScanOptionsData } from "./models/AwsScanOptionsData";
749+
export { AwsScanOptionsResponse } from "./models/AwsScanOptionsResponse";
750+
export { AwsScanOptionsType } from "./models/AwsScanOptionsType";
745751
export { AWSTracesConfig } from "./models/AWSTracesConfig";
746752
export { AzureUCConfig } from "./models/AzureUCConfig";
747753
export { AzureUCConfigPair } from "./models/AzureUCConfigPair";

0 commit comments

Comments
 (0)