Skip to content

Commit

Permalink
Add CSM Agentless Read Endpoint (#2850)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Jan 8, 2025
1 parent 74a7aeb commit a4d1f50
Show file tree
Hide file tree
Showing 14 changed files with 806 additions and 4 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": "2025-01-07 19:53:43.106062",
"spec_repo_commit": "d63fa330"
"regenerated": "2025-01-08 14:02:30.066418",
"spec_repo_commit": "1920836f"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-07 19:53:43.122252",
"spec_repo_commit": "d63fa330"
"regenerated": "2025-01-08 14:02:30.082176",
"spec_repo_commit": "1920836f"
}
}
}
74 changes: 74 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2732,6 +2732,57 @@ components:
$ref: '#/components/schemas/AwsCURConfig'
type: array
type: object
AwsScanOptionsAttributes:
description: Attributes for the AWS scan options.
properties:
lambda:
description: Indicates if scanning of Lambda functions is enabled.
example: true
type: boolean
sensitive_data:
description: Indicates if scanning for sensitive data is enabled.
example: false
type: boolean
vuln_containers_os:
description: Indicates if scanning for vulnerabilities in containers is
enabled.
example: true
type: boolean
vuln_host_os:
description: Indicates if scanning for vulnerabilities in hosts is enabled.
example: true
type: boolean
type: object
AwsScanOptionsData:
description: Single AWS Scan Options entry.
properties:
attributes:
$ref: '#/components/schemas/AwsScanOptionsAttributes'
id:
description: The ID of the AWS account.
example: '184366314700'
type: string
type:
$ref: '#/components/schemas/AwsScanOptionsType'
type: object
AwsScanOptionsResponse:
description: Response object that includes a list of AWS scan options.
properties:
data:
description: A list of AWS scan options.
items:
$ref: '#/components/schemas/AwsScanOptionsData'
type: array
type: object
AwsScanOptionsType:
default: aws_scan_options
description: The type of the resource. The value should always be `aws_scan_options`.
enum:
- aws_scan_options
example: aws_scan_options
type: string
x-enum-varnames:
- AWS_SCAN_OPTIONS
AzureUCConfig:
description: Azure config.
properties:
Expand Down Expand Up @@ -30222,6 +30273,24 @@ info:
version: '1.0'
openapi: 3.0.0
paths:
/api/v2/agentless_scanning/accounts/aws:
get:
description: Fetches the scan options configured for AWS accounts.
operationId: ListAwsScanOptions
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/AwsScanOptionsResponse'
description: OK
'403':
$ref: '#/components/responses/NotAuthorizedResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Get AWS Scan Options
tags:
- Agentless Scanning
/api/v2/api_keys:
get:
description: List all API keys available for your account.
Expand Down Expand Up @@ -48131,6 +48200,11 @@ tags:
externalDocs:
url: https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection
name: AWS Logs Integration
- description: "Datadog Agentless Scanning provides visibility into risks and vulnerabilities\nwithin
your hosts, running containers, and serverless functions\u2014all without\nrequiring
teams to install Agents on every host or where Agents cannot be installed.\nGo
to https://www.datadoghq.com/blog/agentless-scanning/ to learn more"
name: Agentless Scanning
- description: Datadog App Builder provides a low-code solution to rapidly develop
and integrate secure, customized applications into your monitoring stack that
are built to accelerate remediation at scale. These API endpoints allow you to
Expand Down
93 changes: 93 additions & 0 deletions api/datadogV2/api_agentless_scanning.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
_context "context"
_nethttp "net/http"
_neturl "net/url"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// AgentlessScanningApi service type
type AgentlessScanningApi datadog.Service

// ListAwsScanOptions Get AWS Scan Options.
// Fetches the scan options configured for AWS accounts.
func (a *AgentlessScanningApi) ListAwsScanOptions(ctx _context.Context) (AwsScanOptionsResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarReturnValue AwsScanOptionsResponse
)

localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AgentlessScanningApi.ListAwsScanOptions")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}

localVarPath := localBasePath + "/api/v2/agentless_scanning/accounts/aws"

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarHeaderParams["Accept"] = "application/json"

datadog.SetAuthKeys(
ctx,
&localVarHeaderParams,
[2]string{"apiKeyAuth", "DD-API-KEY"},
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
)
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}

localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}

// NewAgentlessScanningApi Returns NewAgentlessScanningApi.
func NewAgentlessScanningApi(client *datadog.APIClient) *AgentlessScanningApi {
return &AgentlessScanningApi{
Client: client,
}
}
1 change: 1 addition & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
// - [AWSIntegrationApi.ListAWSNamespaces]
// - [AWSIntegrationApi.UpdateAWSAccount]
// - [AWSLogsIntegrationApi.ListAWSLogsServices]
// - [AgentlessScanningApi.ListAwsScanOptions]
// - [AppsApi.CreateApp]
// - [AppsApi.DeleteApp]
// - [AppsApi.DeleteApps]
Expand Down
Loading

0 comments on commit a4d1f50

Please sign in to comment.