|
| 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 | +// SensitiveDataScannerSuppressions Object describing the suppressions for a rule. There are three types of suppressions, `starts_with`, `ends_with`, and `exact_match`. |
| 12 | +// Suppressed matches are not obfuscated, counted in metrics, or displayed in the Findings page. |
| 13 | +type SensitiveDataScannerSuppressions struct { |
| 14 | + // List of strings to use for suppression of matches ending with these strings. |
| 15 | + EndsWith []string `json:"ends_with,omitempty"` |
| 16 | + // List of strings to use for suppression of matches exactly matching these strings. |
| 17 | + ExactMatch []string `json:"exact_match,omitempty"` |
| 18 | + // List of strings to use for suppression of matches starting with these strings. |
| 19 | + StartsWith []string `json:"starts_with,omitempty"` |
| 20 | + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct |
| 21 | + UnparsedObject map[string]interface{} `json:"-"` |
| 22 | + AdditionalProperties map[string]interface{} `json:"-"` |
| 23 | +} |
| 24 | + |
| 25 | +// NewSensitiveDataScannerSuppressions instantiates a new SensitiveDataScannerSuppressions object. |
| 26 | +// This constructor will assign default values to properties that have it defined, |
| 27 | +// and makes sure properties required by API are set, but the set of arguments |
| 28 | +// will change when the set of required properties is changed. |
| 29 | +func NewSensitiveDataScannerSuppressions() *SensitiveDataScannerSuppressions { |
| 30 | + this := SensitiveDataScannerSuppressions{} |
| 31 | + return &this |
| 32 | +} |
| 33 | + |
| 34 | +// NewSensitiveDataScannerSuppressionsWithDefaults instantiates a new SensitiveDataScannerSuppressions object. |
| 35 | +// This constructor will only assign default values to properties that have it defined, |
| 36 | +// but it doesn't guarantee that properties required by API are set. |
| 37 | +func NewSensitiveDataScannerSuppressionsWithDefaults() *SensitiveDataScannerSuppressions { |
| 38 | + this := SensitiveDataScannerSuppressions{} |
| 39 | + return &this |
| 40 | +} |
| 41 | + |
| 42 | +// GetEndsWith returns the EndsWith field value if set, zero value otherwise. |
| 43 | +func (o *SensitiveDataScannerSuppressions) GetEndsWith() []string { |
| 44 | + if o == nil || o.EndsWith == nil { |
| 45 | + var ret []string |
| 46 | + return ret |
| 47 | + } |
| 48 | + return o.EndsWith |
| 49 | +} |
| 50 | + |
| 51 | +// GetEndsWithOk returns a tuple with the EndsWith field value if set, nil otherwise |
| 52 | +// and a boolean to check if the value has been set. |
| 53 | +func (o *SensitiveDataScannerSuppressions) GetEndsWithOk() (*[]string, bool) { |
| 54 | + if o == nil || o.EndsWith == nil { |
| 55 | + return nil, false |
| 56 | + } |
| 57 | + return &o.EndsWith, true |
| 58 | +} |
| 59 | + |
| 60 | +// HasEndsWith returns a boolean if a field has been set. |
| 61 | +func (o *SensitiveDataScannerSuppressions) HasEndsWith() bool { |
| 62 | + return o != nil && o.EndsWith != nil |
| 63 | +} |
| 64 | + |
| 65 | +// SetEndsWith gets a reference to the given []string and assigns it to the EndsWith field. |
| 66 | +func (o *SensitiveDataScannerSuppressions) SetEndsWith(v []string) { |
| 67 | + o.EndsWith = v |
| 68 | +} |
| 69 | + |
| 70 | +// GetExactMatch returns the ExactMatch field value if set, zero value otherwise. |
| 71 | +func (o *SensitiveDataScannerSuppressions) GetExactMatch() []string { |
| 72 | + if o == nil || o.ExactMatch == nil { |
| 73 | + var ret []string |
| 74 | + return ret |
| 75 | + } |
| 76 | + return o.ExactMatch |
| 77 | +} |
| 78 | + |
| 79 | +// GetExactMatchOk returns a tuple with the ExactMatch field value if set, nil otherwise |
| 80 | +// and a boolean to check if the value has been set. |
| 81 | +func (o *SensitiveDataScannerSuppressions) GetExactMatchOk() (*[]string, bool) { |
| 82 | + if o == nil || o.ExactMatch == nil { |
| 83 | + return nil, false |
| 84 | + } |
| 85 | + return &o.ExactMatch, true |
| 86 | +} |
| 87 | + |
| 88 | +// HasExactMatch returns a boolean if a field has been set. |
| 89 | +func (o *SensitiveDataScannerSuppressions) HasExactMatch() bool { |
| 90 | + return o != nil && o.ExactMatch != nil |
| 91 | +} |
| 92 | + |
| 93 | +// SetExactMatch gets a reference to the given []string and assigns it to the ExactMatch field. |
| 94 | +func (o *SensitiveDataScannerSuppressions) SetExactMatch(v []string) { |
| 95 | + o.ExactMatch = v |
| 96 | +} |
| 97 | + |
| 98 | +// GetStartsWith returns the StartsWith field value if set, zero value otherwise. |
| 99 | +func (o *SensitiveDataScannerSuppressions) GetStartsWith() []string { |
| 100 | + if o == nil || o.StartsWith == nil { |
| 101 | + var ret []string |
| 102 | + return ret |
| 103 | + } |
| 104 | + return o.StartsWith |
| 105 | +} |
| 106 | + |
| 107 | +// GetStartsWithOk returns a tuple with the StartsWith field value if set, nil otherwise |
| 108 | +// and a boolean to check if the value has been set. |
| 109 | +func (o *SensitiveDataScannerSuppressions) GetStartsWithOk() (*[]string, bool) { |
| 110 | + if o == nil || o.StartsWith == nil { |
| 111 | + return nil, false |
| 112 | + } |
| 113 | + return &o.StartsWith, true |
| 114 | +} |
| 115 | + |
| 116 | +// HasStartsWith returns a boolean if a field has been set. |
| 117 | +func (o *SensitiveDataScannerSuppressions) HasStartsWith() bool { |
| 118 | + return o != nil && o.StartsWith != nil |
| 119 | +} |
| 120 | + |
| 121 | +// SetStartsWith gets a reference to the given []string and assigns it to the StartsWith field. |
| 122 | +func (o *SensitiveDataScannerSuppressions) SetStartsWith(v []string) { |
| 123 | + o.StartsWith = v |
| 124 | +} |
| 125 | + |
| 126 | +// MarshalJSON serializes the struct using spec logic. |
| 127 | +func (o SensitiveDataScannerSuppressions) MarshalJSON() ([]byte, error) { |
| 128 | + toSerialize := map[string]interface{}{} |
| 129 | + if o.UnparsedObject != nil { |
| 130 | + return datadog.Marshal(o.UnparsedObject) |
| 131 | + } |
| 132 | + if o.EndsWith != nil { |
| 133 | + toSerialize["ends_with"] = o.EndsWith |
| 134 | + } |
| 135 | + if o.ExactMatch != nil { |
| 136 | + toSerialize["exact_match"] = o.ExactMatch |
| 137 | + } |
| 138 | + if o.StartsWith != nil { |
| 139 | + toSerialize["starts_with"] = o.StartsWith |
| 140 | + } |
| 141 | + |
| 142 | + for key, value := range o.AdditionalProperties { |
| 143 | + toSerialize[key] = value |
| 144 | + } |
| 145 | + return datadog.Marshal(toSerialize) |
| 146 | +} |
| 147 | + |
| 148 | +// UnmarshalJSON deserializes the given payload. |
| 149 | +func (o *SensitiveDataScannerSuppressions) UnmarshalJSON(bytes []byte) (err error) { |
| 150 | + all := struct { |
| 151 | + EndsWith []string `json:"ends_with,omitempty"` |
| 152 | + ExactMatch []string `json:"exact_match,omitempty"` |
| 153 | + StartsWith []string `json:"starts_with,omitempty"` |
| 154 | + }{} |
| 155 | + if err = datadog.Unmarshal(bytes, &all); err != nil { |
| 156 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 157 | + } |
| 158 | + additionalProperties := make(map[string]interface{}) |
| 159 | + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { |
| 160 | + datadog.DeleteKeys(additionalProperties, &[]string{"ends_with", "exact_match", "starts_with"}) |
| 161 | + } else { |
| 162 | + return err |
| 163 | + } |
| 164 | + o.EndsWith = all.EndsWith |
| 165 | + o.ExactMatch = all.ExactMatch |
| 166 | + o.StartsWith = all.StartsWith |
| 167 | + |
| 168 | + if len(additionalProperties) > 0 { |
| 169 | + o.AdditionalProperties = additionalProperties |
| 170 | + } |
| 171 | + |
| 172 | + return nil |
| 173 | +} |
0 commit comments