Skip to content

Commit

Permalink
Regenerate client from commit ef5e1314 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jun 16, 2022
1 parent 4bba59f commit 7ac1a76
Show file tree
Hide file tree
Showing 7 changed files with 365 additions and 11 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.2",
"regenerated": "2022-06-14 14:43:08.683585",
"spec_repo_commit": "905f3e95"
"regenerated": "2022-06-16 09:23:23.074741",
"spec_repo_commit": "ef5e1314"
},
"v2": {
"apigentools_version": "1.6.2",
"regenerated": "2022-06-14 14:43:08.695892",
"spec_repo_commit": "905f3e95"
"regenerated": "2022-06-16 09:23:23.092064",
"spec_repo_commit": "ef5e1314"
}
}
}
28 changes: 28 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6469,6 +6469,10 @@ components:
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsForgetAfter'
learningDuration:
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsLearningDuration'
learningMethod:
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsLearningMethod'
learningThreshold:
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsLearningThreshold'
type: object
SecurityMonitoringRuleNewValueOptionsForgetAfter:
description: The duration in days after which a learned value is forgotten.
Expand All @@ -6489,6 +6493,7 @@ components:
- THREE_WEEKS
- FOUR_WEEKS
SecurityMonitoringRuleNewValueOptionsLearningDuration:
default: 0
description: 'The duration in days during which values are learned, and after
which signals will be generated for values that
Expand All @@ -6504,6 +6509,29 @@ components:
- ZERO_DAYS
- ONE_DAY
- SEVEN_DAYS
SecurityMonitoringRuleNewValueOptionsLearningMethod:
default: duration
description: The learning method used to determine when signals should be generated
for values that weren't learned.
enum:
- duration
- threshold
type: string
x-enum-varnames:
- DURATION
- THRESHOLD
SecurityMonitoringRuleNewValueOptionsLearningThreshold:
default: 0
description: A number of occurrences after which signals will be generated for
values that weren't learned.
enum:
- 0
- 1
format: int32
type: integer
x-enum-varnames:
- ZERO_OCCURRENCES
- ONE_OCCURRENCE
SecurityMonitoringRuleOptions:
description: Options on rules.
properties:
Expand Down
110 changes: 108 additions & 2 deletions api/v2/datadog/model_security_monitoring_rule_new_value_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ type SecurityMonitoringRuleNewValueOptions struct {
// The duration in days during which values are learned, and after which signals will be generated for values that
// weren't learned. If set to 0, a signal will be generated for all new values after the first value is learned.
LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"`
// The learning method used to determine when signals should be generated for values that weren't learned.
LearningMethod *SecurityMonitoringRuleNewValueOptionsLearningMethod `json:"learningMethod,omitempty"`
// A number of occurrences after which signals will be generated for values that weren't learned.
LearningThreshold *SecurityMonitoringRuleNewValueOptionsLearningThreshold `json:"learningThreshold,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:-`
AdditionalProperties map[string]interface{}
Expand All @@ -26,6 +30,12 @@ type SecurityMonitoringRuleNewValueOptions struct {
// will change when the set of required properties is changed.
func NewSecurityMonitoringRuleNewValueOptions() *SecurityMonitoringRuleNewValueOptions {
this := SecurityMonitoringRuleNewValueOptions{}
var learningDuration SecurityMonitoringRuleNewValueOptionsLearningDuration = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS
this.LearningDuration = &learningDuration
var learningMethod SecurityMonitoringRuleNewValueOptionsLearningMethod = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION
this.LearningMethod = &learningMethod
var learningThreshold SecurityMonitoringRuleNewValueOptionsLearningThreshold = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES
this.LearningThreshold = &learningThreshold
return &this
}

Expand All @@ -34,6 +44,12 @@ func NewSecurityMonitoringRuleNewValueOptions() *SecurityMonitoringRuleNewValueO
// but it doesn't guarantee that properties required by API are set.
func NewSecurityMonitoringRuleNewValueOptionsWithDefaults() *SecurityMonitoringRuleNewValueOptions {
this := SecurityMonitoringRuleNewValueOptions{}
var learningDuration SecurityMonitoringRuleNewValueOptionsLearningDuration = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS
this.LearningDuration = &learningDuration
var learningMethod SecurityMonitoringRuleNewValueOptionsLearningMethod = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION
this.LearningMethod = &learningMethod
var learningThreshold SecurityMonitoringRuleNewValueOptionsLearningThreshold = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES
this.LearningThreshold = &learningThreshold
return &this
}

Expand Down Expand Up @@ -101,6 +117,70 @@ func (o *SecurityMonitoringRuleNewValueOptions) SetLearningDuration(v SecurityMo
o.LearningDuration = &v
}

// GetLearningMethod returns the LearningMethod field value if set, zero value otherwise.
func (o *SecurityMonitoringRuleNewValueOptions) GetLearningMethod() SecurityMonitoringRuleNewValueOptionsLearningMethod {
if o == nil || o.LearningMethod == nil {
var ret SecurityMonitoringRuleNewValueOptionsLearningMethod
return ret
}
return *o.LearningMethod
}

// GetLearningMethodOk returns a tuple with the LearningMethod field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SecurityMonitoringRuleNewValueOptions) GetLearningMethodOk() (*SecurityMonitoringRuleNewValueOptionsLearningMethod, bool) {
if o == nil || o.LearningMethod == nil {
return nil, false
}
return o.LearningMethod, true
}

// HasLearningMethod returns a boolean if a field has been set.
func (o *SecurityMonitoringRuleNewValueOptions) HasLearningMethod() bool {
if o != nil && o.LearningMethod != nil {
return true
}

return false
}

// SetLearningMethod gets a reference to the given SecurityMonitoringRuleNewValueOptionsLearningMethod and assigns it to the LearningMethod field.
func (o *SecurityMonitoringRuleNewValueOptions) SetLearningMethod(v SecurityMonitoringRuleNewValueOptionsLearningMethod) {
o.LearningMethod = &v
}

// GetLearningThreshold returns the LearningThreshold field value if set, zero value otherwise.
func (o *SecurityMonitoringRuleNewValueOptions) GetLearningThreshold() SecurityMonitoringRuleNewValueOptionsLearningThreshold {
if o == nil || o.LearningThreshold == nil {
var ret SecurityMonitoringRuleNewValueOptionsLearningThreshold
return ret
}
return *o.LearningThreshold
}

// GetLearningThresholdOk returns a tuple with the LearningThreshold field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SecurityMonitoringRuleNewValueOptions) GetLearningThresholdOk() (*SecurityMonitoringRuleNewValueOptionsLearningThreshold, bool) {
if o == nil || o.LearningThreshold == nil {
return nil, false
}
return o.LearningThreshold, true
}

// HasLearningThreshold returns a boolean if a field has been set.
func (o *SecurityMonitoringRuleNewValueOptions) HasLearningThreshold() bool {
if o != nil && o.LearningThreshold != nil {
return true
}

return false
}

// SetLearningThreshold gets a reference to the given SecurityMonitoringRuleNewValueOptionsLearningThreshold and assigns it to the LearningThreshold field.
func (o *SecurityMonitoringRuleNewValueOptions) SetLearningThreshold(v SecurityMonitoringRuleNewValueOptionsLearningThreshold) {
o.LearningThreshold = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o SecurityMonitoringRuleNewValueOptions) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
Expand All @@ -113,6 +193,12 @@ func (o SecurityMonitoringRuleNewValueOptions) MarshalJSON() ([]byte, error) {
if o.LearningDuration != nil {
toSerialize["learningDuration"] = o.LearningDuration
}
if o.LearningMethod != nil {
toSerialize["learningMethod"] = o.LearningMethod
}
if o.LearningThreshold != nil {
toSerialize["learningThreshold"] = o.LearningThreshold
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
Expand All @@ -124,8 +210,10 @@ func (o SecurityMonitoringRuleNewValueOptions) MarshalJSON() ([]byte, error) {
func (o *SecurityMonitoringRuleNewValueOptions) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
all := struct {
ForgetAfter *SecurityMonitoringRuleNewValueOptionsForgetAfter `json:"forgetAfter,omitempty"`
LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"`
ForgetAfter *SecurityMonitoringRuleNewValueOptionsForgetAfter `json:"forgetAfter,omitempty"`
LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"`
LearningMethod *SecurityMonitoringRuleNewValueOptionsLearningMethod `json:"learningMethod,omitempty"`
LearningThreshold *SecurityMonitoringRuleNewValueOptionsLearningThreshold `json:"learningThreshold,omitempty"`
}{}
err = json.Unmarshal(bytes, &all)
if err != nil {
Expand All @@ -152,7 +240,25 @@ func (o *SecurityMonitoringRuleNewValueOptions) UnmarshalJSON(bytes []byte) (err
o.UnparsedObject = raw
return nil
}
if v := all.LearningMethod; v != nil && !v.IsValid() {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
o.UnparsedObject = raw
return nil
}
if v := all.LearningThreshold; v != nil && !v.IsValid() {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
o.UnparsedObject = raw
return nil
}
o.ForgetAfter = all.ForgetAfter
o.LearningDuration = all.LearningDuration
o.LearningMethod = all.LearningMethod
o.LearningThreshold = all.LearningThreshold
return nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// 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 datadog

import (
"encoding/json"
"fmt"
)

// SecurityMonitoringRuleNewValueOptionsLearningMethod The learning method used to determine when signals should be generated for values that weren't learned.
type SecurityMonitoringRuleNewValueOptionsLearningMethod string

// List of SecurityMonitoringRuleNewValueOptionsLearningMethod.
const (
SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION SecurityMonitoringRuleNewValueOptionsLearningMethod = "duration"
SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_THRESHOLD SecurityMonitoringRuleNewValueOptionsLearningMethod = "threshold"
)

var allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues = []SecurityMonitoringRuleNewValueOptionsLearningMethod{
SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION,
SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_THRESHOLD,
}

// GetAllowedValues reeturns the list of possible values.
func (v *SecurityMonitoringRuleNewValueOptionsLearningMethod) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsLearningMethod {
return allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues
}

// UnmarshalJSON deserializes the given payload.
func (v *SecurityMonitoringRuleNewValueOptionsLearningMethod) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
*v = SecurityMonitoringRuleNewValueOptionsLearningMethod(value)
return nil
}

// NewSecurityMonitoringRuleNewValueOptionsLearningMethodFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsLearningMethod
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
func NewSecurityMonitoringRuleNewValueOptionsLearningMethodFromValue(v string) (*SecurityMonitoringRuleNewValueOptionsLearningMethod, error) {
ev := SecurityMonitoringRuleNewValueOptionsLearningMethod(v)
if ev.IsValid() {
return &ev, nil
}
return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsLearningMethod: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues)
}

// IsValid return true if the value is valid for the enum, false otherwise.
func (v SecurityMonitoringRuleNewValueOptionsLearningMethod) IsValid() bool {
for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues {
if existing == v {
return true
}
}
return false
}

// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsLearningMethod value.
func (v SecurityMonitoringRuleNewValueOptionsLearningMethod) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningMethod {
return &v
}

// NullableSecurityMonitoringRuleNewValueOptionsLearningMethod handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningMethod.
type NullableSecurityMonitoringRuleNewValueOptionsLearningMethod struct {
value *SecurityMonitoringRuleNewValueOptionsLearningMethod
isSet bool
}

// Get returns the associated value.
func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Get() *SecurityMonitoringRuleNewValueOptionsLearningMethod {
return v.value
}

// Set changes the value and indicates it's been called.
func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Set(val *SecurityMonitoringRuleNewValueOptionsLearningMethod) {
v.value = val
v.isSet = true
}

// IsSet returns whether Set has been called.
func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) IsSet() bool {
return v.isSet
}

// Unset sets the value to nil and resets the set flag.
func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Unset() {
v.value = nil
v.isSet = false
}

// NewNullableSecurityMonitoringRuleNewValueOptionsLearningMethod initializes the struct as if Set has been called.
func NewNullableSecurityMonitoringRuleNewValueOptionsLearningMethod(val *SecurityMonitoringRuleNewValueOptionsLearningMethod) *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod {
return &NullableSecurityMonitoringRuleNewValueOptionsLearningMethod{value: val, isSet: true}
}

// MarshalJSON serializes the associated value.
func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}

// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called.
func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
Loading

0 comments on commit 7ac1a76

Please sign in to comment.