-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CSM Agentless Read Endpoint (#2850)
Co-authored-by: ci.datadog-api-spec <[email protected]>
- Loading branch information
1 parent
74a7aeb
commit a4d1f50
Showing
14 changed files
with
806 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
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,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, | ||
} | ||
} |
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.