Skip to content

Commit

Permalink
Add use_recommended_keywords attribute to sensitive data scanner ru…
Browse files Browse the repository at this point in the history
…le spec (#2752)

Co-authored-by: ci.datadog-api-spec <[email protected]>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Oct 30, 2024
1 parent e413315 commit 6452a5e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 7 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.6",
"regenerated": "2024-10-28 23:07:44.281357",
"spec_repo_commit": "4251a422"
"regenerated": "2024-10-29 20:46:37.332067",
"spec_repo_commit": "c0b9551e"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-28 23:07:44.299802",
"spec_repo_commit": "4251a422"
"regenerated": "2024-10-29 20:46:37.350717",
"spec_repo_commit": "c0b9551e"
}
}
}
7 changes: 7 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21870,6 +21870,13 @@ components:
items:
type: string
type: array
use_recommended_keywords:
description: 'Should the rule use the underlying standard pattern keyword
configuration. If set to `true`, the rule must be tied

to a standard pattern. If set to `false`, the specified keywords and `character_count`
are applied.'
type: boolean
required:
- keywords
- character_count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ type SensitiveDataScannerIncludedKeywordConfiguration struct {
// 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"`
// Should the rule use the underlying standard pattern keyword configuration. If set to `true`, the rule must be tied
// to a standard pattern. If set to `false`, the specified keywords and `character_count` are applied.
UseRecommendedKeywords *bool `json:"use_recommended_keywords,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{} `json:"-"`
Expand Down Expand Up @@ -91,6 +94,34 @@ func (o *SensitiveDataScannerIncludedKeywordConfiguration) SetKeywords(v []strin
o.Keywords = v
}

// GetUseRecommendedKeywords returns the UseRecommendedKeywords field value if set, zero value otherwise.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) GetUseRecommendedKeywords() bool {
if o == nil || o.UseRecommendedKeywords == nil {
var ret bool
return ret
}
return *o.UseRecommendedKeywords
}

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

// HasUseRecommendedKeywords returns a boolean if a field has been set.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) HasUseRecommendedKeywords() bool {
return o != nil && o.UseRecommendedKeywords != nil
}

// SetUseRecommendedKeywords gets a reference to the given bool and assigns it to the UseRecommendedKeywords field.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) SetUseRecommendedKeywords(v bool) {
o.UseRecommendedKeywords = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o SensitiveDataScannerIncludedKeywordConfiguration) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
Expand All @@ -99,6 +130,9 @@ func (o SensitiveDataScannerIncludedKeywordConfiguration) MarshalJSON() ([]byte,
}
toSerialize["character_count"] = o.CharacterCount
toSerialize["keywords"] = o.Keywords
if o.UseRecommendedKeywords != nil {
toSerialize["use_recommended_keywords"] = o.UseRecommendedKeywords
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
Expand All @@ -109,8 +143,9 @@ func (o SensitiveDataScannerIncludedKeywordConfiguration) MarshalJSON() ([]byte,
// UnmarshalJSON deserializes the given payload.
func (o *SensitiveDataScannerIncludedKeywordConfiguration) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
CharacterCount *int64 `json:"character_count"`
Keywords *[]string `json:"keywords"`
CharacterCount *int64 `json:"character_count"`
Keywords *[]string `json:"keywords"`
UseRecommendedKeywords *bool `json:"use_recommended_keywords,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
Expand All @@ -123,12 +158,13 @@ func (o *SensitiveDataScannerIncludedKeywordConfiguration) UnmarshalJSON(bytes [
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"character_count", "keywords"})
datadog.DeleteKeys(additionalProperties, &[]string{"character_count", "keywords", "use_recommended_keywords"})
} else {
return err
}
o.CharacterCount = *all.CharacterCount
o.Keywords = *all.Keywords
o.UseRecommendedKeywords = all.UseRecommendedKeywords

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
Expand Down

0 comments on commit 6452a5e

Please sign in to comment.