Skip to content

Commit 26a4329

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 389040e of spec repo
1 parent 54d9501 commit 26a4329

File tree

38 files changed

+4988
-12
lines changed

38 files changed

+4988
-12
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 406 additions & 0 deletions
Large diffs are not rendered by default.

api/datadog/configuration.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ func NewConfiguration() *Configuration {
697697
"v2.GetSLOReport": false,
698698
"v2.GetSLOReportJobStatus": false,
699699
"v2.GetSPARecommendations": false,
700+
"v2.CreateSCAResolveVulnerableSymbols": false,
701+
"v2.CreateSCAResult": false,
700702
"v2.AddMemberTeam": false,
701703
"v2.ListMemberTeams": false,
702704
"v2.RemoveMemberTeam": false,
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
_context "context"
9+
_fmt "fmt"
10+
_log "log"
11+
_nethttp "net/http"
12+
_neturl "net/url"
13+
14+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
15+
)
16+
17+
// StaticAnalysisApi service type
18+
type StaticAnalysisApi datadog.Service
19+
20+
// CreateSCAResolveVulnerableSymbols POST request to resolve vulnerable symbols.
21+
// Post vulnerable symbols
22+
func (a *StaticAnalysisApi) CreateSCAResolveVulnerableSymbols(ctx _context.Context, body ResolveVulnerableSymbolsRequest) (ResolveVulnerableSymbolsResponse, *_nethttp.Response, error) {
23+
var (
24+
localVarHTTPMethod = _nethttp.MethodPost
25+
localVarPostBody interface{}
26+
localVarReturnValue ResolveVulnerableSymbolsResponse
27+
)
28+
29+
operationId := "v2.CreateSCAResolveVulnerableSymbols"
30+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
31+
if !isOperationEnabled {
32+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
33+
}
34+
if isOperationEnabled && a.Client.Cfg.Debug {
35+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
36+
}
37+
38+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.StaticAnalysisApi.CreateSCAResolveVulnerableSymbols")
39+
if err != nil {
40+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
41+
}
42+
43+
localVarPath := localBasePath + "/api/v2/static-analysis-sca/vulnerabilities/resolve-vulnerable-symbols"
44+
45+
localVarHeaderParams := make(map[string]string)
46+
localVarQueryParams := _neturl.Values{}
47+
localVarFormParams := _neturl.Values{}
48+
localVarHeaderParams["Content-Type"] = "application/json"
49+
localVarHeaderParams["Accept"] = "application/json"
50+
51+
// body params
52+
localVarPostBody = &body
53+
if a.Client.Cfg.DelegatedTokenConfig != nil {
54+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
55+
if err != nil {
56+
return localVarReturnValue, nil, err
57+
}
58+
} else {
59+
datadog.SetAuthKeys(
60+
ctx,
61+
&localVarHeaderParams,
62+
[2]string{"apiKeyAuth", "DD-API-KEY"},
63+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
64+
)
65+
}
66+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
67+
if err != nil {
68+
return localVarReturnValue, nil, err
69+
}
70+
71+
localVarHTTPResponse, err := a.Client.CallAPI(req)
72+
if err != nil || localVarHTTPResponse == nil {
73+
return localVarReturnValue, localVarHTTPResponse, err
74+
}
75+
76+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
77+
if err != nil {
78+
return localVarReturnValue, localVarHTTPResponse, err
79+
}
80+
81+
if localVarHTTPResponse.StatusCode >= 300 {
82+
newErr := datadog.GenericOpenAPIError{
83+
ErrorBody: localVarBody,
84+
ErrorMessage: localVarHTTPResponse.Status,
85+
}
86+
if localVarHTTPResponse.StatusCode == 429 {
87+
var v APIErrorResponse
88+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
89+
if err != nil {
90+
return localVarReturnValue, localVarHTTPResponse, newErr
91+
}
92+
newErr.ErrorModel = v
93+
}
94+
return localVarReturnValue, localVarHTTPResponse, newErr
95+
}
96+
97+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
98+
if err != nil {
99+
newErr := datadog.GenericOpenAPIError{
100+
ErrorBody: localVarBody,
101+
ErrorMessage: err.Error(),
102+
}
103+
return localVarReturnValue, localVarHTTPResponse, newErr
104+
}
105+
106+
return localVarReturnValue, localVarHTTPResponse, nil
107+
}
108+
109+
// CreateSCAResult Post dependencies for analysis.
110+
// Post dependencies for analysis
111+
func (a *StaticAnalysisApi) CreateSCAResult(ctx _context.Context, body ScaRequest) (*_nethttp.Response, error) {
112+
var (
113+
localVarHTTPMethod = _nethttp.MethodPost
114+
localVarPostBody interface{}
115+
)
116+
117+
operationId := "v2.CreateSCAResult"
118+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
119+
if !isOperationEnabled {
120+
return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
121+
}
122+
if isOperationEnabled && a.Client.Cfg.Debug {
123+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
124+
}
125+
126+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.StaticAnalysisApi.CreateSCAResult")
127+
if err != nil {
128+
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
129+
}
130+
131+
localVarPath := localBasePath + "/api/v2/static-analysis-sca/dependencies"
132+
133+
localVarHeaderParams := make(map[string]string)
134+
localVarQueryParams := _neturl.Values{}
135+
localVarFormParams := _neturl.Values{}
136+
localVarHeaderParams["Content-Type"] = "application/json"
137+
localVarHeaderParams["Accept"] = "*/*"
138+
139+
// body params
140+
localVarPostBody = &body
141+
if a.Client.Cfg.DelegatedTokenConfig != nil {
142+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
143+
if err != nil {
144+
return nil, err
145+
}
146+
} else {
147+
datadog.SetAuthKeys(
148+
ctx,
149+
&localVarHeaderParams,
150+
[2]string{"apiKeyAuth", "DD-API-KEY"},
151+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
152+
)
153+
}
154+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
155+
if err != nil {
156+
return nil, err
157+
}
158+
159+
localVarHTTPResponse, err := a.Client.CallAPI(req)
160+
if err != nil || localVarHTTPResponse == nil {
161+
return localVarHTTPResponse, err
162+
}
163+
164+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
165+
if err != nil {
166+
return localVarHTTPResponse, err
167+
}
168+
169+
if localVarHTTPResponse.StatusCode >= 300 {
170+
newErr := datadog.GenericOpenAPIError{
171+
ErrorBody: localVarBody,
172+
ErrorMessage: localVarHTTPResponse.Status,
173+
}
174+
if localVarHTTPResponse.StatusCode == 429 {
175+
var v APIErrorResponse
176+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
177+
if err != nil {
178+
return localVarHTTPResponse, newErr
179+
}
180+
newErr.ErrorModel = v
181+
}
182+
return localVarHTTPResponse, newErr
183+
}
184+
185+
return localVarHTTPResponse, nil
186+
}
187+
188+
// NewStaticAnalysisApi Returns NewStaticAnalysisApi.
189+
func NewStaticAnalysisApi(client *datadog.APIClient) *StaticAnalysisApi {
190+
return &StaticAnalysisApi{
191+
Client: client,
192+
}
193+
}

api/datadogV2/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,8 @@
556556
// - [SpansMetricsApi.GetSpansMetric]
557557
// - [SpansMetricsApi.ListSpansMetrics]
558558
// - [SpansMetricsApi.UpdateSpansMetric]
559+
// - [StaticAnalysisApi.CreateSCAResolveVulnerableSymbols]
560+
// - [StaticAnalysisApi.CreateSCAResult]
559561
// - [SyntheticsApi.GetOnDemandConcurrencyCap]
560562
// - [SyntheticsApi.SetOnDemandConcurrencyCap]
561563
// - [TeamsApi.AddMemberTeam]
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// ResolveVulnerableSymbolsRequest The definition of `ResolveVulnerableSymbolsRequest` object.
12+
type ResolveVulnerableSymbolsRequest struct {
13+
// The definition of `ResolveVulnerableSymbolsRequestData` object.
14+
Data *ResolveVulnerableSymbolsRequestData `json:"data,omitempty"`
15+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
16+
UnparsedObject map[string]interface{} `json:"-"`
17+
AdditionalProperties map[string]interface{} `json:"-"`
18+
}
19+
20+
// NewResolveVulnerableSymbolsRequest instantiates a new ResolveVulnerableSymbolsRequest object.
21+
// This constructor will assign default values to properties that have it defined,
22+
// and makes sure properties required by API are set, but the set of arguments
23+
// will change when the set of required properties is changed.
24+
func NewResolveVulnerableSymbolsRequest() *ResolveVulnerableSymbolsRequest {
25+
this := ResolveVulnerableSymbolsRequest{}
26+
return &this
27+
}
28+
29+
// NewResolveVulnerableSymbolsRequestWithDefaults instantiates a new ResolveVulnerableSymbolsRequest object.
30+
// This constructor will only assign default values to properties that have it defined,
31+
// but it doesn't guarantee that properties required by API are set.
32+
func NewResolveVulnerableSymbolsRequestWithDefaults() *ResolveVulnerableSymbolsRequest {
33+
this := ResolveVulnerableSymbolsRequest{}
34+
return &this
35+
}
36+
37+
// GetData returns the Data field value if set, zero value otherwise.
38+
func (o *ResolveVulnerableSymbolsRequest) GetData() ResolveVulnerableSymbolsRequestData {
39+
if o == nil || o.Data == nil {
40+
var ret ResolveVulnerableSymbolsRequestData
41+
return ret
42+
}
43+
return *o.Data
44+
}
45+
46+
// GetDataOk returns a tuple with the Data field value if set, nil otherwise
47+
// and a boolean to check if the value has been set.
48+
func (o *ResolveVulnerableSymbolsRequest) GetDataOk() (*ResolveVulnerableSymbolsRequestData, bool) {
49+
if o == nil || o.Data == nil {
50+
return nil, false
51+
}
52+
return o.Data, true
53+
}
54+
55+
// HasData returns a boolean if a field has been set.
56+
func (o *ResolveVulnerableSymbolsRequest) HasData() bool {
57+
return o != nil && o.Data != nil
58+
}
59+
60+
// SetData gets a reference to the given ResolveVulnerableSymbolsRequestData and assigns it to the Data field.
61+
func (o *ResolveVulnerableSymbolsRequest) SetData(v ResolveVulnerableSymbolsRequestData) {
62+
o.Data = &v
63+
}
64+
65+
// MarshalJSON serializes the struct using spec logic.
66+
func (o ResolveVulnerableSymbolsRequest) MarshalJSON() ([]byte, error) {
67+
toSerialize := map[string]interface{}{}
68+
if o.UnparsedObject != nil {
69+
return datadog.Marshal(o.UnparsedObject)
70+
}
71+
if o.Data != nil {
72+
toSerialize["data"] = o.Data
73+
}
74+
75+
for key, value := range o.AdditionalProperties {
76+
toSerialize[key] = value
77+
}
78+
return datadog.Marshal(toSerialize)
79+
}
80+
81+
// UnmarshalJSON deserializes the given payload.
82+
func (o *ResolveVulnerableSymbolsRequest) UnmarshalJSON(bytes []byte) (err error) {
83+
all := struct {
84+
Data *ResolveVulnerableSymbolsRequestData `json:"data,omitempty"`
85+
}{}
86+
if err = datadog.Unmarshal(bytes, &all); err != nil {
87+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
88+
}
89+
additionalProperties := make(map[string]interface{})
90+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
91+
datadog.DeleteKeys(additionalProperties, &[]string{"data"})
92+
} else {
93+
return err
94+
}
95+
96+
hasInvalidField := false
97+
if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil {
98+
hasInvalidField = true
99+
}
100+
o.Data = all.Data
101+
102+
if len(additionalProperties) > 0 {
103+
o.AdditionalProperties = additionalProperties
104+
}
105+
106+
if hasInvalidField {
107+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
108+
}
109+
110+
return nil
111+
}

0 commit comments

Comments
 (0)