Skip to content

Commit 228ee49

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 092c127 of spec repo (DataDog#3302)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent c963ec1 commit 228ee49

17 files changed

Lines changed: 256 additions & 6 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46152,7 +46152,7 @@ paths:
4615246152
$ref: '#/components/responses/NotAuthorizedResponse'
4615346153
'429':
4615446154
$ref: '#/components/responses/TooManyRequestsResponse'
46155-
summary: Get AWS Scan Options
46155+
summary: List AWS Scan Options
4615646156
tags:
4615746157
- Agentless Scanning
4615846158
post:
@@ -46204,6 +46204,29 @@ paths:
4620446204
summary: Delete AWS Scan Options
4620546205
tags:
4620646206
- Agentless Scanning
46207+
get:
46208+
description: Fetches the Agentless scan options for an activated account.
46209+
operationId: GetAwsScanOptions
46210+
parameters:
46211+
- $ref: '#/components/parameters/AwsAccountId'
46212+
responses:
46213+
'200':
46214+
content:
46215+
application/json:
46216+
schema:
46217+
$ref: '#/components/schemas/AwsScanOptionsResponse'
46218+
description: OK
46219+
'400':
46220+
$ref: '#/components/responses/BadRequestResponse'
46221+
'403':
46222+
$ref: '#/components/responses/NotAuthorizedResponse'
46223+
'404':
46224+
$ref: '#/components/responses/NotFoundResponse'
46225+
'429':
46226+
$ref: '#/components/responses/TooManyRequestsResponse'
46227+
summary: Get AWS scan options
46228+
tags:
46229+
- Agentless Scanning
4620746230
patch:
4620846231
description: Update the Agentless scan options for an activated account.
4620946232
operationId: UpdateAwsScanOptions

api/datadogV2/api_agentless_scanning.go

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,84 @@ func (a *AgentlessScanningApi) GetAwsOnDemandTask(ctx _context.Context, taskId s
321321
return localVarReturnValue, localVarHTTPResponse, nil
322322
}
323323

324+
// GetAwsScanOptions Get AWS scan options.
325+
// Fetches the Agentless scan options for an activated account.
326+
func (a *AgentlessScanningApi) GetAwsScanOptions(ctx _context.Context, accountId string) (AwsScanOptionsResponse, *_nethttp.Response, error) {
327+
var (
328+
localVarHTTPMethod = _nethttp.MethodGet
329+
localVarPostBody interface{}
330+
localVarReturnValue AwsScanOptionsResponse
331+
)
332+
333+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AgentlessScanningApi.GetAwsScanOptions")
334+
if err != nil {
335+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
336+
}
337+
338+
localVarPath := localBasePath + "/api/v2/agentless_scanning/accounts/aws/{account_id}"
339+
localVarPath = datadog.ReplacePathParameter(localVarPath, "{account_id}", _neturl.PathEscape(datadog.ParameterToString(accountId, "")))
340+
341+
localVarHeaderParams := make(map[string]string)
342+
localVarQueryParams := _neturl.Values{}
343+
localVarFormParams := _neturl.Values{}
344+
localVarHeaderParams["Accept"] = "application/json"
345+
346+
if a.Client.Cfg.DelegatedTokenConfig != nil {
347+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
348+
if err != nil {
349+
return localVarReturnValue, nil, err
350+
}
351+
} else {
352+
datadog.SetAuthKeys(
353+
ctx,
354+
&localVarHeaderParams,
355+
[2]string{"apiKeyAuth", "DD-API-KEY"},
356+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
357+
)
358+
}
359+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
360+
if err != nil {
361+
return localVarReturnValue, nil, err
362+
}
363+
364+
localVarHTTPResponse, err := a.Client.CallAPI(req)
365+
if err != nil || localVarHTTPResponse == nil {
366+
return localVarReturnValue, localVarHTTPResponse, err
367+
}
368+
369+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
370+
if err != nil {
371+
return localVarReturnValue, localVarHTTPResponse, err
372+
}
373+
374+
if localVarHTTPResponse.StatusCode >= 300 {
375+
newErr := datadog.GenericOpenAPIError{
376+
ErrorBody: localVarBody,
377+
ErrorMessage: localVarHTTPResponse.Status,
378+
}
379+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
380+
var v APIErrorResponse
381+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
382+
if err != nil {
383+
return localVarReturnValue, localVarHTTPResponse, newErr
384+
}
385+
newErr.ErrorModel = v
386+
}
387+
return localVarReturnValue, localVarHTTPResponse, newErr
388+
}
389+
390+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
391+
if err != nil {
392+
newErr := datadog.GenericOpenAPIError{
393+
ErrorBody: localVarBody,
394+
ErrorMessage: err.Error(),
395+
}
396+
return localVarReturnValue, localVarHTTPResponse, newErr
397+
}
398+
399+
return localVarReturnValue, localVarHTTPResponse, nil
400+
}
401+
324402
// ListAwsOnDemandTasks Get AWS On Demand tasks.
325403
// Fetches the most recent 1000 AWS on demand tasks.
326404
func (a *AgentlessScanningApi) ListAwsOnDemandTasks(ctx _context.Context) (AwsOnDemandListResponse, *_nethttp.Response, error) {
@@ -398,7 +476,7 @@ func (a *AgentlessScanningApi) ListAwsOnDemandTasks(ctx _context.Context) (AwsOn
398476
return localVarReturnValue, localVarHTTPResponse, nil
399477
}
400478

401-
// ListAwsScanOptions Get AWS Scan Options.
479+
// ListAwsScanOptions List AWS Scan Options.
402480
// Fetches the scan options configured for AWS accounts.
403481
func (a *AgentlessScanningApi) ListAwsScanOptions(ctx _context.Context) (AwsScanOptionsListResponse, *_nethttp.Response, error) {
404482
var (

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
// - [AgentlessScanningApi.CreateAwsScanOptions]
3636
// - [AgentlessScanningApi.DeleteAwsScanOptions]
3737
// - [AgentlessScanningApi.GetAwsOnDemandTask]
38+
// - [AgentlessScanningApi.GetAwsScanOptions]
3839
// - [AgentlessScanningApi.ListAwsOnDemandTasks]
3940
// - [AgentlessScanningApi.ListAwsScanOptions]
4041
// - [AgentlessScanningApi.UpdateAwsScanOptions]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Get AWS scan options returns "OK" response
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"encoding/json"
8+
"fmt"
9+
"os"
10+
11+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
12+
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
13+
)
14+
15+
func main() {
16+
// there is a valid "aws_scan_options" in the system
17+
AwsScanOptionsID := os.Getenv("AWS_SCAN_OPTIONS_ID")
18+
19+
ctx := datadog.NewDefaultContext(context.Background())
20+
configuration := datadog.NewConfiguration()
21+
apiClient := datadog.NewAPIClient(configuration)
22+
api := datadogV2.NewAgentlessScanningApi(apiClient)
23+
resp, r, err := api.GetAwsScanOptions(ctx, AwsScanOptionsID)
24+
25+
if err != nil {
26+
fmt.Fprintf(os.Stderr, "Error when calling `AgentlessScanningApi.GetAwsScanOptions`: %v\n", err)
27+
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
28+
}
29+
30+
responseContent, _ := json.MarshalIndent(resp, "", " ")
31+
fmt.Fprintf(os.Stdout, "Response from `AgentlessScanningApi.GetAwsScanOptions`:\n%s\n", responseContent)
32+
}

examples/v2/agentless-scanning/ListAwsScanOptions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Get AWS Scan Options returns "OK" response
1+
// List AWS Scan Options returns "OK" response
22

33
package main
44

tests/scenarios/cassettes/TestScenarios/v2/Feature_Agentless_Scanning/Scenario_Get_AWS_Scan_Options_returns_OK_response.freeze

Lines changed: 0 additions & 1 deletion
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-08-27T13:04:35.618Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
interactions:
2+
- request:
3+
body: ''
4+
form: {}
5+
headers:
6+
Accept:
7+
- application/json
8+
id: 0
9+
method: GET
10+
url: https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws/not-an-account-id
11+
response:
12+
body: '{"errors":[{"title":"Generic Error","detail":"missing or invalid url parameter
13+
''accountId'', expected 12 digit format ''123456789012''"}]}'
14+
code: 400
15+
duration: 0ms
16+
headers:
17+
Content-Type:
18+
- application/vnd.api+json
19+
status: 400 Bad Request
20+
version: 2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-08-27T01:14:07.103Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
interactions:
2+
- request:
3+
body: ''
4+
form: {}
5+
headers:
6+
Accept:
7+
- application/json
8+
id: 0
9+
method: GET
10+
url: https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws/404404404404
11+
response:
12+
body: '{"errors":[{"status":"404","detail":"no aws scan options found for subscription
13+
404404404404"}]}'
14+
code: 404
15+
duration: 0ms
16+
headers:
17+
Content-Type:
18+
- application/vnd.api+json
19+
status: 404 Not Found
20+
version: 2

0 commit comments

Comments
 (0)