-
Notifications
You must be signed in to change notification settings - Fork 52
/
model_sensitive_data_scanner_included_keyword_configuration.go
138 lines (121 loc) · 5.2 KB
/
model_sensitive_data_scanner_included_keyword_configuration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// 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 (
"fmt"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// SensitiveDataScannerIncludedKeywordConfiguration Object defining a set of keywords and a number of characters that help reduce noise.
// You can provide a list of keywords you would like to check within a defined proximity of the matching pattern.
// If any of the keywords are found within the proximity check, the match is kept.
// If none are found, the match is discarded.
type SensitiveDataScannerIncludedKeywordConfiguration struct {
// The number of characters behind a match detected by Sensitive Data Scanner to look for the keywords defined.
// `character_count` should be greater than the maximum length of a keyword defined for a rule.
CharacterCount int64 `json:"character_count"`
// Keyword list that will be checked during scanning in order to validate a match.
// The number of keywords in the list must be less than or equal to 30.
Keywords []string `json:"keywords"`
// 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{}
}
// NewSensitiveDataScannerIncludedKeywordConfiguration instantiates a new SensitiveDataScannerIncludedKeywordConfiguration object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewSensitiveDataScannerIncludedKeywordConfiguration(characterCount int64, keywords []string) *SensitiveDataScannerIncludedKeywordConfiguration {
this := SensitiveDataScannerIncludedKeywordConfiguration{}
this.CharacterCount = characterCount
this.Keywords = keywords
return &this
}
// NewSensitiveDataScannerIncludedKeywordConfigurationWithDefaults instantiates a new SensitiveDataScannerIncludedKeywordConfiguration object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewSensitiveDataScannerIncludedKeywordConfigurationWithDefaults() *SensitiveDataScannerIncludedKeywordConfiguration {
this := SensitiveDataScannerIncludedKeywordConfiguration{}
return &this
}
// GetCharacterCount returns the CharacterCount field value.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) GetCharacterCount() int64 {
if o == nil {
var ret int64
return ret
}
return o.CharacterCount
}
// GetCharacterCountOk returns a tuple with the CharacterCount field value
// and a boolean to check if the value has been set.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) GetCharacterCountOk() (*int64, bool) {
if o == nil {
return nil, false
}
return &o.CharacterCount, true
}
// SetCharacterCount sets field value.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) SetCharacterCount(v int64) {
o.CharacterCount = v
}
// GetKeywords returns the Keywords field value.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) GetKeywords() []string {
if o == nil {
var ret []string
return ret
}
return o.Keywords
}
// GetKeywordsOk returns a tuple with the Keywords field value
// and a boolean to check if the value has been set.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) GetKeywordsOk() (*[]string, bool) {
if o == nil {
return nil, false
}
return &o.Keywords, true
}
// SetKeywords sets field value.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) SetKeywords(v []string) {
o.Keywords = v
}
// MarshalJSON serializes the struct using spec logic.
func (o SensitiveDataScannerIncludedKeywordConfiguration) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["character_count"] = o.CharacterCount
toSerialize["keywords"] = o.Keywords
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
CharacterCount *int64 `json:"character_count"`
Keywords *[]string `json:"keywords"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.CharacterCount == nil {
return fmt.Errorf("required field character_count missing")
}
if all.Keywords == nil {
return fmt.Errorf("required field keywords missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"character_count", "keywords"})
} else {
return err
}
o.CharacterCount = *all.CharacterCount
o.Keywords = *all.Keywords
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
return nil
}