Skip to content

Commit

Permalink
fix dlp dict phrases patterns issue typo & idm_profile_match_accuracy (
Browse files Browse the repository at this point in the history
…#228)

* fix dlp dict phrases patterns issue typo
* Added zia_dlp_idm_profiles_lite
* Updated to zscaler-sdk-go v1.4.4
* Added new zia_dlp_dictionaries attributes
* fix binNumbers panic issue
* Added computed and removed other readonly a attrib
* Updated CHANGELOG and release-notes
* remove name from flattenIDMProfileMatchAccuracySimple
* check custom_phrase_match_type
* Update zia_dlp_dictionaries docs
  • Loading branch information
amazzalel-habib authored May 1, 2023
1 parent 52537a2 commit ef62393
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 3 deletions.
6 changes: 6 additions & 0 deletions docs/data-sources/zia_dlp_dictionaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ In addition to all arguments above, the following attributes are exported:

* `action` - (String) The action applied to a DLP dictionary using patterns
* `pattern` - (String) DLP dictionary pattern
* `ignore_exact_match_idm_dict` - (Boolean) Indicates whether to exclude documents that are a 100% match to already-indexed documents from triggering an Indexed Document Match (IDM) Dictionary.
* `include_bin_numbers` - (Boolean) A true value denotes that the specified Bank Identification Number (BIN) values are included in the Credit Cards dictionary. A false value denotes that the specified BIN values are excluded from the Credit Cards dictionary. Note: This field is applicable only to the predefined Credit Cards dictionary and its clones.
* `bin_numbers` - (Boolean) The list of Bank Identification Number (BIN) values that are included or excluded from the Credit Cards dictionary. BIN values can be specified only for Diners Club, Mastercard, RuPay, and Visa cards. Up to 512 BIN values can be configured in a dictionary. Note: This field is applicable only to the predefined Credit Cards dictionary and its clones.
* `dict_template_id` - (Number) ID of the predefined dictionary (original source dictionary) that is used for cloning. This field is applicable only to cloned dictionaries. Only a limited set of identification-based predefined dictionaries (e.g., Credit Cards, Social Security Numbers, National Identification Numbers, etc.) can be cloned. Up to 4 clones can be created from a predefined dictionary.
* `predefined_clone` - (Boolean) This field is set to true if the dictionary is cloned from a predefined dictionary. Otherwise, it is set to false.
* `custom` - (Boolean) This value is set to true for custom DLP dictionaries.
7 changes: 5 additions & 2 deletions docs/resources/zia_dlp_dictionaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The following arguments are supported:
* `custom_phrase_match_type` - (Required) The DLP custom phrase match type. Supported values are:
* `MATCH_ALL_CUSTOM_PHRASE_PATTERN_DICTIONARY`
* `MATCH_ANY_CUSTOM_PHRASE_PATTERN_DICTIONARY`
Note: This attribute should only be set when the dictionary_type is set to ``PATTERNS_AND_PHRASES``

* `phrases` - (Required) List containing the phrases used within a custom DLP dictionary. This attribute is not applicable to predefined DLP dictionaries. Required when `dictionary_type` is `PATTERNS_AND_PHRASES`
* `action` - (Required) The action applied to a DLP dictionary using patterns. The following values are supported:
Expand Down Expand Up @@ -105,5 +106,7 @@ The following arguments are supported:
- `"HEAVY"`

* `proximity` - (Optional) The DLP dictionary proximity length.
* `custom` - (Optional) This value is set to true for custom DLP dictionaries.
* `proximity_length_enabled` - (Optional) This value is set to true if proximity length and high confidence phrases are enabled for the DLP dictionary.
* `ignore_exact_match_idm_dict` - (Optional) Indicates whether to exclude documents that are a 100% match to already-indexed documents from triggering an Indexed Document Match (IDM) Dictionary.
* `include_bin_numbers` - (Optional) A true value denotes that the specified Bank Identification Number (BIN) values are included in the Credit Cards dictionary. A false value denotes that the specified BIN values are excluded from the Credit Cards dictionary. Note: This field is applicable only to the predefined Credit Cards dictionary and its clones.
* `bin_numbers` - (Optional) The list of Bank Identification Number (BIN) values that are included or excluded from the Credit Cards dictionary. BIN values can be specified only for Diners Club, Mastercard, RuPay, and Visa cards. Up to 512 BIN values can be configured in a dictionary. Note: This field is applicable only to the predefined Credit Cards dictionary and its clones.
* `dict_template_id` - (Optional) ID of the predefined dictionary (original source dictionary) that is used for cloning. This field is applicable only to cloned dictionaries. Only a limited set of identification-based predefined dictionaries (e.g., Credit Cards, Social Security Numbers, National Identification Numbers, etc.) can be cloned. Up to 4 clones can be created from a predefined dictionary.
56 changes: 55 additions & 1 deletion zia/data_source_zia_dlp_dictionaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/zscaler/zscaler-sdk-go/zia/services/common"
"github.com/zscaler/zscaler-sdk-go/zia/services/dlpdictionaries"
)

Expand All @@ -26,6 +27,10 @@ func dataSourceDLPDictionaries() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"custom": {
Type: schema.TypeBool,
Computed: true,
},
"confidence_threshold": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -129,6 +134,11 @@ func dataSourceDLPDictionaries() *schema.Resource {
Computed: true,
Description: "Identifier that uniquely identifies an entity",
},
"name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"extensions": {
Type: schema.TypeMap,
Computed: true,
Expand All @@ -152,6 +162,37 @@ func dataSourceDLPDictionaries() *schema.Resource {
Computed: true,
Description: "The DLP dictionary proximity length.",
},
"ignore_exact_match_idm_dict": {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether to exclude documents that are a 100% match to already-indexed documents from triggering an Indexed Document Match (IDM) Dictionary.",
},
"include_bin_numbers": {
Type: schema.TypeBool,
Computed: true,
Description: "A true value denotes that the specified Bank Identification Number (BIN) values are included in the Credit Cards dictionary. A false value denotes that the specified BIN values are excluded from the Credit Cards dictionary.Note: This field is applicable only to the predefined Credit Cards dictionary and its clones.",
},
"bin_numbers": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeInt},
Description: "The list of Bank Identification Number (BIN) values that are included or excluded from the Credit Cards dictionary. BIN values can be specified only for Diners Club, Mastercard, RuPay, and Visa cards. Up to 512 BIN values can be configured in a dictionary. Note: This field is applicable only to the predefined Credit Cards dictionary and its clones.",
},
"dict_template_id": {
Type: schema.TypeInt,
Computed: true,
Description: "ID of the predefined dictionary (original source dictionary) that is used for cloning. This field is applicable only to cloned dictionaries. Only a limited set of identification-based predefined dictionaries (e.g., Credit Cards, Social Security Numbers, National Identification Numbers, etc.) can be cloned. Up to 4 clones can be created from a predefined dictionary.",
},
"predefined_clone": {
Type: schema.TypeBool,
Computed: true,
Description: "This field is set to true if the dictionary is cloned from a predefined dictionary. Otherwise, it is set to false.",
},
"proximity_length_enabled": {
Type: schema.TypeBool,
Computed: true,
Description: "This value is set to true if proximity length and high confidence phrases are enabled for the DLP dictionary.",
},
},
}
}
Expand Down Expand Up @@ -183,11 +224,19 @@ func dataSourceDLPDictionariesRead(d *schema.ResourceData, m interface{}) error
d.SetId(fmt.Sprintf("%d", resp.ID))
_ = d.Set("name", resp.Name)
_ = d.Set("description", resp.Description)
_ = d.Set("custom", resp.Custom)
_ = d.Set("confidence_threshold", resp.ConfidenceThreshold)
_ = d.Set("custom_phrase_match_type", resp.CustomPhraseMatchType)
_ = d.Set("name_l10n_tag", resp.NameL10nTag)
_ = d.Set("threshold_type", resp.ThresholdType)
_ = d.Set("dictionary_type", resp.DictionaryType)
_ = d.Set("ignore_exact_match_idm_dict", resp.IgnoreExactMatchIdmDict)
_ = d.Set("include_bin_numbers", resp.IncludeBinNumbers)
_ = d.Set("bin_numbers", resp.BinNumbers)
_ = d.Set("dict_template_id", resp.DictTemplateId)
_ = d.Set("predefined_clone", resp.PredefinedClone)
_ = d.Set("proximity_length_enabled", resp.ProximityLengthEnabled)
_ = d.Set("proximity", resp.Proximity)
if err := d.Set("phrases", flattenPhrases(resp)); err != nil {
return err
}
Expand Down Expand Up @@ -251,9 +300,14 @@ func flattenEDMDetails(edm *dlpdictionaries.DlpDictionary) []interface{} {
func flattenIDMProfileMatchAccuracy(edm *dlpdictionaries.DlpDictionary) []interface{} {
idmProfileMatchAccuracies := make([]interface{}, len(edm.IDMProfileMatchAccuracy))
for i, val := range edm.IDMProfileMatchAccuracy {
exts := []common.IDNameExtensions{}
if val.AdpIdmProfile != nil {
exts = append(exts, *val.AdpIdmProfile)
}

idmProfileMatchAccuracies[i] = map[string]interface{}{
"match_accuracy": val.MatchAccuracy,
"adp_idm_profile": val.AdpIdmProfile,
"adp_idm_profile": flattenIDNameExtensions(exts),
}
}

Expand Down

0 comments on commit ef62393

Please sign in to comment.