Skip to content

Commit

Permalink
fix: Fixed computed attributes in the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
willguibr committed Jun 28, 2024
1 parent 9e85f76 commit 931f138
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
1 change: 0 additions & 1 deletion zia/resource_zia_dlp_web_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ func resourceDlpWebRules() *schema.Resource {
"zscaler_incident_receiver": {
Type: schema.TypeBool,
Optional: true,
Default: true,
Description: "Indicates whether a Zscaler Incident Receiver is associated to the DLP policy rule.",
},
"locations": setIDsSchemaTypeCustom(intPtr(8), "The Name-ID pairs of locations to which the DLP policy rule must be applied."),
Expand Down
1 change: 0 additions & 1 deletion zia/resource_zia_location_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ func resourceLocationManagement() *schema.Resource {
"display_time_unit": {
Type: schema.TypeString,
Optional: true,
Default: "MINUTE",
Description: "Display Time Unit. The time unit to display for IP Surrogate idle time to disassociation.",
ValidateFunc: validation.StringInSlice([]string{
"MINUTE",
Expand Down
31 changes: 6 additions & 25 deletions zia/resource_zia_url_filtering_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,14 @@ func resourceURLFilteringRules() *schema.Resource {
Description: "Enforce a set a validity time period for the URL Filtering rule.",
},
"validity_start_time": {
Type: schema.TypeString,
Optional: true,
Description: "If enforceTimeValidity is set to true, the URL Filtering rule is valid starting on this date and time.",
ValidateFunc: validateTimesNotInPast,
Type: schema.TypeString,
Optional: true,
Description: "If enforceTimeValidity is set to true, the URL Filtering rule is valid starting on this date and time.",
},
"validity_end_time": {
Type: schema.TypeString,
Optional: true,
Description: "If enforceTimeValidity is set to true, the URL Filtering rule ceases to be valid on this end date and time.",
ValidateFunc: validateTimesNotInPast,
Type: schema.TypeString,
Optional: true,
Description: "If enforceTimeValidity is set to true, the URL Filtering rule ceases to be valid on this end date and time.",
},
"validity_time_zone_id": {
Type: schema.TypeString,
Expand Down Expand Up @@ -764,23 +762,6 @@ func ConvertRFC1123ToEpoch(timeStr string) (int, error) {
return int(t.Unix()), nil
}

func validateTimesNotInPast(val interface{}, key string) (warns []string, errs []error) {
timeStr := val.(string)
timeVal, err := ConvertRFC1123ToEpoch(timeStr)
if err != nil {
errs = append(errs, fmt.Errorf("%q: invalid time format: %v. Expected format: RFC1123 (Mon, 02 Jan 2006 15:04:05 MST)", key, err))
return
}

now := time.Now().Unix()

if int64(timeVal) < now {
errs = append(errs, fmt.Errorf("%q: time cannot be in the past", key))
}

return
}

func convertAndValidateSizeQuota(sizeQuotaMB int) (int, error) {
const (
minMB = 10
Expand Down

0 comments on commit 931f138

Please sign in to comment.