Skip to content

Commit b9c37c1

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 4a308ca of spec repo (#4134)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent e05ea81 commit b9c37c1

35 files changed

Lines changed: 4348 additions & 6 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 597 additions & 3 deletions
Large diffs are not rendered by default.

api/datadogV2/api_application_security.go

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

api/datadogV2/doc.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,19 @@
9292
// - [AppBuilderApi.UpdateProtectionLevel]
9393
// - [ApplicationSecurityApi.CreateApplicationSecurityWafCustomRule]
9494
// - [ApplicationSecurityApi.CreateApplicationSecurityWafExclusionFilter]
95+
// - [ApplicationSecurityApi.CreateApplicationSecurityWafPolicy]
9596
// - [ApplicationSecurityApi.DeleteApplicationSecurityWafCustomRule]
9697
// - [ApplicationSecurityApi.DeleteApplicationSecurityWafExclusionFilter]
98+
// - [ApplicationSecurityApi.DeleteApplicationSecurityWafPolicy]
9799
// - [ApplicationSecurityApi.GetApplicationSecurityWafCustomRule]
98100
// - [ApplicationSecurityApi.GetApplicationSecurityWafExclusionFilter]
101+
// - [ApplicationSecurityApi.GetApplicationSecurityWafPolicy]
99102
// - [ApplicationSecurityApi.ListApplicationSecurityWAFCustomRules]
103+
// - [ApplicationSecurityApi.ListApplicationSecurityWAFPolicies]
100104
// - [ApplicationSecurityApi.ListApplicationSecurityWafExclusionFilters]
101105
// - [ApplicationSecurityApi.UpdateApplicationSecurityWafCustomRule]
102106
// - [ApplicationSecurityApi.UpdateApplicationSecurityWafExclusionFilter]
107+
// - [ApplicationSecurityApi.UpdateApplicationSecurityWafPolicy]
103108
// - [AuditApi.ListAuditLogs]
104109
// - [AuditApi.SearchAuditLogs]
105110
// - [AuthNMappingsApi.CreateAuthNMapping]
Lines changed: 352 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,352 @@
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+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// ApplicationSecurityPolicyAttributes A WAF policy.
14+
type ApplicationSecurityPolicyAttributes struct {
15+
// Description of the WAF policy.
16+
Description string `json:"description"`
17+
// Make this policy the default policy. The default policy is applied to
18+
// every service not specifically assigned to another policy.
19+
IsDefault *bool `json:"isDefault,omitempty"`
20+
// The name of the WAF policy.
21+
Name string `json:"name"`
22+
// Presets enabled on this policy.
23+
ProtectionPresets []string `json:"protectionPresets,omitempty"`
24+
// Rule overrides applied by the policy.
25+
Rules []ApplicationSecurityPolicyRuleOverride `json:"rules,omitempty"`
26+
// Deprecated: Ruleset overrides. Use `protectionPresets` instead.
27+
// Deprecated
28+
Rulesets []ApplicationSecurityPolicyRulesetOverride `json:"rulesets,omitempty"`
29+
// The scope of the WAF policy.
30+
Scope []ApplicationSecurityPolicyScope `json:"scope,omitempty"`
31+
// Version of the WAF ruleset maintained by Datadog used by this policy. 0 is the default value.
32+
Version *int64 `json:"version,omitempty"`
33+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
34+
UnparsedObject map[string]interface{} `json:"-"`
35+
AdditionalProperties map[string]interface{} `json:"-"`
36+
}
37+
38+
// NewApplicationSecurityPolicyAttributes instantiates a new ApplicationSecurityPolicyAttributes object.
39+
// This constructor will assign default values to properties that have it defined,
40+
// and makes sure properties required by API are set, but the set of arguments
41+
// will change when the set of required properties is changed.
42+
func NewApplicationSecurityPolicyAttributes(description string, name string) *ApplicationSecurityPolicyAttributes {
43+
this := ApplicationSecurityPolicyAttributes{}
44+
this.Description = description
45+
this.Name = name
46+
var version int64 = 0
47+
this.Version = &version
48+
return &this
49+
}
50+
51+
// NewApplicationSecurityPolicyAttributesWithDefaults instantiates a new ApplicationSecurityPolicyAttributes object.
52+
// This constructor will only assign default values to properties that have it defined,
53+
// but it doesn't guarantee that properties required by API are set.
54+
func NewApplicationSecurityPolicyAttributesWithDefaults() *ApplicationSecurityPolicyAttributes {
55+
this := ApplicationSecurityPolicyAttributes{}
56+
var version int64 = 0
57+
this.Version = &version
58+
return &this
59+
}
60+
61+
// GetDescription returns the Description field value.
62+
func (o *ApplicationSecurityPolicyAttributes) GetDescription() string {
63+
if o == nil {
64+
var ret string
65+
return ret
66+
}
67+
return o.Description
68+
}
69+
70+
// GetDescriptionOk returns a tuple with the Description field value
71+
// and a boolean to check if the value has been set.
72+
func (o *ApplicationSecurityPolicyAttributes) GetDescriptionOk() (*string, bool) {
73+
if o == nil {
74+
return nil, false
75+
}
76+
return &o.Description, true
77+
}
78+
79+
// SetDescription sets field value.
80+
func (o *ApplicationSecurityPolicyAttributes) SetDescription(v string) {
81+
o.Description = v
82+
}
83+
84+
// GetIsDefault returns the IsDefault field value if set, zero value otherwise.
85+
func (o *ApplicationSecurityPolicyAttributes) GetIsDefault() bool {
86+
if o == nil || o.IsDefault == nil {
87+
var ret bool
88+
return ret
89+
}
90+
return *o.IsDefault
91+
}
92+
93+
// GetIsDefaultOk returns a tuple with the IsDefault field value if set, nil otherwise
94+
// and a boolean to check if the value has been set.
95+
func (o *ApplicationSecurityPolicyAttributes) GetIsDefaultOk() (*bool, bool) {
96+
if o == nil || o.IsDefault == nil {
97+
return nil, false
98+
}
99+
return o.IsDefault, true
100+
}
101+
102+
// HasIsDefault returns a boolean if a field has been set.
103+
func (o *ApplicationSecurityPolicyAttributes) HasIsDefault() bool {
104+
return o != nil && o.IsDefault != nil
105+
}
106+
107+
// SetIsDefault gets a reference to the given bool and assigns it to the IsDefault field.
108+
func (o *ApplicationSecurityPolicyAttributes) SetIsDefault(v bool) {
109+
o.IsDefault = &v
110+
}
111+
112+
// GetName returns the Name field value.
113+
func (o *ApplicationSecurityPolicyAttributes) GetName() string {
114+
if o == nil {
115+
var ret string
116+
return ret
117+
}
118+
return o.Name
119+
}
120+
121+
// GetNameOk returns a tuple with the Name field value
122+
// and a boolean to check if the value has been set.
123+
func (o *ApplicationSecurityPolicyAttributes) GetNameOk() (*string, bool) {
124+
if o == nil {
125+
return nil, false
126+
}
127+
return &o.Name, true
128+
}
129+
130+
// SetName sets field value.
131+
func (o *ApplicationSecurityPolicyAttributes) SetName(v string) {
132+
o.Name = v
133+
}
134+
135+
// GetProtectionPresets returns the ProtectionPresets field value if set, zero value otherwise.
136+
func (o *ApplicationSecurityPolicyAttributes) GetProtectionPresets() []string {
137+
if o == nil || o.ProtectionPresets == nil {
138+
var ret []string
139+
return ret
140+
}
141+
return o.ProtectionPresets
142+
}
143+
144+
// GetProtectionPresetsOk returns a tuple with the ProtectionPresets field value if set, nil otherwise
145+
// and a boolean to check if the value has been set.
146+
func (o *ApplicationSecurityPolicyAttributes) GetProtectionPresetsOk() (*[]string, bool) {
147+
if o == nil || o.ProtectionPresets == nil {
148+
return nil, false
149+
}
150+
return &o.ProtectionPresets, true
151+
}
152+
153+
// HasProtectionPresets returns a boolean if a field has been set.
154+
func (o *ApplicationSecurityPolicyAttributes) HasProtectionPresets() bool {
155+
return o != nil && o.ProtectionPresets != nil
156+
}
157+
158+
// SetProtectionPresets gets a reference to the given []string and assigns it to the ProtectionPresets field.
159+
func (o *ApplicationSecurityPolicyAttributes) SetProtectionPresets(v []string) {
160+
o.ProtectionPresets = v
161+
}
162+
163+
// GetRules returns the Rules field value if set, zero value otherwise.
164+
func (o *ApplicationSecurityPolicyAttributes) GetRules() []ApplicationSecurityPolicyRuleOverride {
165+
if o == nil || o.Rules == nil {
166+
var ret []ApplicationSecurityPolicyRuleOverride
167+
return ret
168+
}
169+
return o.Rules
170+
}
171+
172+
// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise
173+
// and a boolean to check if the value has been set.
174+
func (o *ApplicationSecurityPolicyAttributes) GetRulesOk() (*[]ApplicationSecurityPolicyRuleOverride, bool) {
175+
if o == nil || o.Rules == nil {
176+
return nil, false
177+
}
178+
return &o.Rules, true
179+
}
180+
181+
// HasRules returns a boolean if a field has been set.
182+
func (o *ApplicationSecurityPolicyAttributes) HasRules() bool {
183+
return o != nil && o.Rules != nil
184+
}
185+
186+
// SetRules gets a reference to the given []ApplicationSecurityPolicyRuleOverride and assigns it to the Rules field.
187+
func (o *ApplicationSecurityPolicyAttributes) SetRules(v []ApplicationSecurityPolicyRuleOverride) {
188+
o.Rules = v
189+
}
190+
191+
// GetRulesets returns the Rulesets field value if set, zero value otherwise.
192+
// Deprecated
193+
func (o *ApplicationSecurityPolicyAttributes) GetRulesets() []ApplicationSecurityPolicyRulesetOverride {
194+
if o == nil || o.Rulesets == nil {
195+
var ret []ApplicationSecurityPolicyRulesetOverride
196+
return ret
197+
}
198+
return o.Rulesets
199+
}
200+
201+
// GetRulesetsOk returns a tuple with the Rulesets field value if set, nil otherwise
202+
// and a boolean to check if the value has been set.
203+
// Deprecated
204+
func (o *ApplicationSecurityPolicyAttributes) GetRulesetsOk() (*[]ApplicationSecurityPolicyRulesetOverride, bool) {
205+
if o == nil || o.Rulesets == nil {
206+
return nil, false
207+
}
208+
return &o.Rulesets, true
209+
}
210+
211+
// HasRulesets returns a boolean if a field has been set.
212+
func (o *ApplicationSecurityPolicyAttributes) HasRulesets() bool {
213+
return o != nil && o.Rulesets != nil
214+
}
215+
216+
// SetRulesets gets a reference to the given []ApplicationSecurityPolicyRulesetOverride and assigns it to the Rulesets field.
217+
// Deprecated
218+
func (o *ApplicationSecurityPolicyAttributes) SetRulesets(v []ApplicationSecurityPolicyRulesetOverride) {
219+
o.Rulesets = v
220+
}
221+
222+
// GetScope returns the Scope field value if set, zero value otherwise.
223+
func (o *ApplicationSecurityPolicyAttributes) GetScope() []ApplicationSecurityPolicyScope {
224+
if o == nil || o.Scope == nil {
225+
var ret []ApplicationSecurityPolicyScope
226+
return ret
227+
}
228+
return o.Scope
229+
}
230+
231+
// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise
232+
// and a boolean to check if the value has been set.
233+
func (o *ApplicationSecurityPolicyAttributes) GetScopeOk() (*[]ApplicationSecurityPolicyScope, bool) {
234+
if o == nil || o.Scope == nil {
235+
return nil, false
236+
}
237+
return &o.Scope, true
238+
}
239+
240+
// HasScope returns a boolean if a field has been set.
241+
func (o *ApplicationSecurityPolicyAttributes) HasScope() bool {
242+
return o != nil && o.Scope != nil
243+
}
244+
245+
// SetScope gets a reference to the given []ApplicationSecurityPolicyScope and assigns it to the Scope field.
246+
func (o *ApplicationSecurityPolicyAttributes) SetScope(v []ApplicationSecurityPolicyScope) {
247+
o.Scope = v
248+
}
249+
250+
// GetVersion returns the Version field value if set, zero value otherwise.
251+
func (o *ApplicationSecurityPolicyAttributes) GetVersion() int64 {
252+
if o == nil || o.Version == nil {
253+
var ret int64
254+
return ret
255+
}
256+
return *o.Version
257+
}
258+
259+
// GetVersionOk returns a tuple with the Version field value if set, nil otherwise
260+
// and a boolean to check if the value has been set.
261+
func (o *ApplicationSecurityPolicyAttributes) GetVersionOk() (*int64, bool) {
262+
if o == nil || o.Version == nil {
263+
return nil, false
264+
}
265+
return o.Version, true
266+
}
267+
268+
// HasVersion returns a boolean if a field has been set.
269+
func (o *ApplicationSecurityPolicyAttributes) HasVersion() bool {
270+
return o != nil && o.Version != nil
271+
}
272+
273+
// SetVersion gets a reference to the given int64 and assigns it to the Version field.
274+
func (o *ApplicationSecurityPolicyAttributes) SetVersion(v int64) {
275+
o.Version = &v
276+
}
277+
278+
// MarshalJSON serializes the struct using spec logic.
279+
func (o ApplicationSecurityPolicyAttributes) MarshalJSON() ([]byte, error) {
280+
toSerialize := map[string]interface{}{}
281+
if o.UnparsedObject != nil {
282+
return datadog.Marshal(o.UnparsedObject)
283+
}
284+
toSerialize["description"] = o.Description
285+
if o.IsDefault != nil {
286+
toSerialize["isDefault"] = o.IsDefault
287+
}
288+
toSerialize["name"] = o.Name
289+
if o.ProtectionPresets != nil {
290+
toSerialize["protectionPresets"] = o.ProtectionPresets
291+
}
292+
if o.Rules != nil {
293+
toSerialize["rules"] = o.Rules
294+
}
295+
if o.Rulesets != nil {
296+
toSerialize["rulesets"] = o.Rulesets
297+
}
298+
if o.Scope != nil {
299+
toSerialize["scope"] = o.Scope
300+
}
301+
if o.Version != nil {
302+
toSerialize["version"] = o.Version
303+
}
304+
305+
for key, value := range o.AdditionalProperties {
306+
toSerialize[key] = value
307+
}
308+
return datadog.Marshal(toSerialize)
309+
}
310+
311+
// UnmarshalJSON deserializes the given payload.
312+
func (o *ApplicationSecurityPolicyAttributes) UnmarshalJSON(bytes []byte) (err error) {
313+
all := struct {
314+
Description *string `json:"description"`
315+
IsDefault *bool `json:"isDefault,omitempty"`
316+
Name *string `json:"name"`
317+
ProtectionPresets []string `json:"protectionPresets,omitempty"`
318+
Rules []ApplicationSecurityPolicyRuleOverride `json:"rules,omitempty"`
319+
Rulesets []ApplicationSecurityPolicyRulesetOverride `json:"rulesets,omitempty"`
320+
Scope []ApplicationSecurityPolicyScope `json:"scope,omitempty"`
321+
Version *int64 `json:"version,omitempty"`
322+
}{}
323+
if err = datadog.Unmarshal(bytes, &all); err != nil {
324+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
325+
}
326+
if all.Description == nil {
327+
return fmt.Errorf("required field description missing")
328+
}
329+
if all.Name == nil {
330+
return fmt.Errorf("required field name missing")
331+
}
332+
additionalProperties := make(map[string]interface{})
333+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
334+
datadog.DeleteKeys(additionalProperties, &[]string{"description", "isDefault", "name", "protectionPresets", "rules", "rulesets", "scope", "version"})
335+
} else {
336+
return err
337+
}
338+
o.Description = *all.Description
339+
o.IsDefault = all.IsDefault
340+
o.Name = *all.Name
341+
o.ProtectionPresets = all.ProtectionPresets
342+
o.Rules = all.Rules
343+
o.Rulesets = all.Rulesets
344+
o.Scope = all.Scope
345+
o.Version = all.Version
346+
347+
if len(additionalProperties) > 0 {
348+
o.AdditionalProperties = additionalProperties
349+
}
350+
351+
return nil
352+
}

0 commit comments

Comments
 (0)