-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerate client from commit 1920836f of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Jan 8, 2025
1 parent
e390ba0
commit 377dc95
Showing
15 changed files
with
543 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ntless-Scanning_730042230/Get-AWS-Scan-Options-returns-OK-response_2545056747/frozen.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"2024-12-18T15:40:11.636Z" |
57 changes: 57 additions & 0 deletions
57
...less-Scanning_730042230/Get-AWS-Scan-Options-returns-OK-response_2545056747/recording.har
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"log": { | ||
"_recordingName": "Agentless Scanning/Get AWS Scan Options returns \"OK\" response", | ||
"creator": { | ||
"comment": "persister:fs", | ||
"name": "Polly.JS", | ||
"version": "6.0.5" | ||
}, | ||
"entries": [ | ||
{ | ||
"_id": "2cb6ecfe386c3349268926da480a6b5d", | ||
"_order": 0, | ||
"cache": {}, | ||
"request": { | ||
"bodySize": 0, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"_fromType": "array", | ||
"name": "accept", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 530, | ||
"httpVersion": "HTTP/1.1", | ||
"method": "GET", | ||
"queryString": [], | ||
"url": "https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws" | ||
}, | ||
"response": { | ||
"bodySize": 11, | ||
"content": { | ||
"mimeType": "application/vnd.api+json", | ||
"size": 11, | ||
"text": "{\"data\":[]}" | ||
}, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/vnd.api+json" | ||
} | ||
], | ||
"headersSize": 674, | ||
"httpVersion": "HTTP/1.1", | ||
"redirectURL": "", | ||
"status": 200, | ||
"statusText": "OK" | ||
}, | ||
"startedDateTime": "2024-12-18T15:40:11.830Z", | ||
"time": 308 | ||
} | ||
], | ||
"pages": [], | ||
"version": "1.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Get AWS Scan Options returns "OK" response | ||
*/ | ||
|
||
import { client, v2 } from "@datadog/datadog-api-client"; | ||
|
||
const configuration = client.createConfiguration(); | ||
const apiInstance = new v2.AgentlessScanningApi(configuration); | ||
|
||
apiInstance | ||
.listAwsScanOptions() | ||
.then((data: v2.AwsScanOptionsResponse) => { | ||
console.log( | ||
"API called successfully. Returned data: " + JSON.stringify(data) | ||
); | ||
}) | ||
.catch((error: any) => console.error(error)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@endpoint(agentless-scanning) @endpoint(agentless-scanning-v2) | ||
Feature: Agentless Scanning | ||
Datadog Agentless Scanning provides visibility into risks and | ||
vulnerabilities within your hosts, running containers, and serverless | ||
functions—all without requiring teams to install Agents on every host or | ||
where Agents cannot be installed. Go to | ||
https://www.datadoghq.com/blog/agentless-scanning/ to learn more | ||
|
||
@team:DataDog/k9-cloud-security-platform | ||
Scenario: Get AWS Scan Options returns "OK" response | ||
Given a valid "apiKeyAuth" key in the system | ||
And a valid "appKeyAuth" key in the system | ||
And an instance of "AgentlessScanning" API | ||
And new "ListAwsScanOptions" request | ||
When the request is sent | ||
Then the response status is 200 OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
packages/datadog-api-client-v2/apis/AgentlessScanningApi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
import { BaseAPIRequestFactory } from "../../datadog-api-client-common/baseapi"; | ||
import { | ||
Configuration, | ||
applySecurityAuthentication, | ||
} from "../../datadog-api-client-common/configuration"; | ||
import { | ||
RequestContext, | ||
HttpMethod, | ||
ResponseContext, | ||
} from "../../datadog-api-client-common/http/http"; | ||
|
||
import { logger } from "../../../logger"; | ||
import { ObjectSerializer } from "../models/ObjectSerializer"; | ||
import { ApiException } from "../../datadog-api-client-common/exception"; | ||
|
||
import { APIErrorResponse } from "../models/APIErrorResponse"; | ||
import { AwsScanOptionsResponse } from "../models/AwsScanOptionsResponse"; | ||
|
||
export class AgentlessScanningApiRequestFactory extends BaseAPIRequestFactory { | ||
public async listAwsScanOptions( | ||
_options?: Configuration | ||
): Promise<RequestContext> { | ||
const _config = _options || this.configuration; | ||
|
||
// Path Params | ||
const localVarPath = "/api/v2/agentless_scanning/accounts/aws"; | ||
|
||
// Make Request Context | ||
const requestContext = _config | ||
.getServer("v2.AgentlessScanningApi.listAwsScanOptions") | ||
.makeRequestContext(localVarPath, HttpMethod.GET); | ||
requestContext.setHeaderParam("Accept", "application/json"); | ||
requestContext.setHttpConfig(_config.httpConfig); | ||
|
||
// Apply auth methods | ||
applySecurityAuthentication(_config, requestContext, [ | ||
"apiKeyAuth", | ||
"appKeyAuth", | ||
]); | ||
|
||
return requestContext; | ||
} | ||
} | ||
|
||
export class AgentlessScanningApiResponseProcessor { | ||
/** | ||
* Unwraps the actual response sent by the server from the response context and deserializes the response content | ||
* to the expected objects | ||
* | ||
* @params response Response returned by the server for a request to listAwsScanOptions | ||
* @throws ApiException if the response code was not in [200, 299] | ||
*/ | ||
public async listAwsScanOptions( | ||
response: ResponseContext | ||
): Promise<AwsScanOptionsResponse> { | ||
const contentType = ObjectSerializer.normalizeMediaType( | ||
response.headers["content-type"] | ||
); | ||
if (response.httpStatusCode === 200) { | ||
const body: AwsScanOptionsResponse = ObjectSerializer.deserialize( | ||
ObjectSerializer.parse(await response.body.text(), contentType), | ||
"AwsScanOptionsResponse" | ||
) as AwsScanOptionsResponse; | ||
return body; | ||
} | ||
if (response.httpStatusCode === 403 || response.httpStatusCode === 429) { | ||
const bodyText = ObjectSerializer.parse( | ||
await response.body.text(), | ||
contentType | ||
); | ||
let body: APIErrorResponse; | ||
try { | ||
body = ObjectSerializer.deserialize( | ||
bodyText, | ||
"APIErrorResponse" | ||
) as APIErrorResponse; | ||
} catch (error) { | ||
logger.debug(`Got error deserializing error: ${error}`); | ||
throw new ApiException<APIErrorResponse>( | ||
response.httpStatusCode, | ||
bodyText | ||
); | ||
} | ||
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body); | ||
} | ||
|
||
// Work around for missing responses in specification, e.g. for petstore.yaml | ||
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { | ||
const body: AwsScanOptionsResponse = ObjectSerializer.deserialize( | ||
ObjectSerializer.parse(await response.body.text(), contentType), | ||
"AwsScanOptionsResponse", | ||
"" | ||
) as AwsScanOptionsResponse; | ||
return body; | ||
} | ||
|
||
const body = (await response.body.text()) || ""; | ||
throw new ApiException<string>( | ||
response.httpStatusCode, | ||
'Unknown API Status Code!\nBody: "' + body + '"' | ||
); | ||
} | ||
} | ||
|
||
export class AgentlessScanningApi { | ||
private requestFactory: AgentlessScanningApiRequestFactory; | ||
private responseProcessor: AgentlessScanningApiResponseProcessor; | ||
private configuration: Configuration; | ||
|
||
public constructor( | ||
configuration: Configuration, | ||
requestFactory?: AgentlessScanningApiRequestFactory, | ||
responseProcessor?: AgentlessScanningApiResponseProcessor | ||
) { | ||
this.configuration = configuration; | ||
this.requestFactory = | ||
requestFactory || new AgentlessScanningApiRequestFactory(configuration); | ||
this.responseProcessor = | ||
responseProcessor || new AgentlessScanningApiResponseProcessor(); | ||
} | ||
|
||
/** | ||
* Fetches the scan options configured for AWS accounts. | ||
* @param param The request object | ||
*/ | ||
public listAwsScanOptions( | ||
options?: Configuration | ||
): Promise<AwsScanOptionsResponse> { | ||
const requestContextPromise = | ||
this.requestFactory.listAwsScanOptions(options); | ||
return requestContextPromise.then((requestContext) => { | ||
return this.configuration.httpApi | ||
.send(requestContext) | ||
.then((responseContext) => { | ||
return this.responseProcessor.listAwsScanOptions(responseContext); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.