From 580932d9f32327d2da20ce1e0739124f4817bd4e Mon Sep 17 00:00:00 2001 From: Huw Campbell Date: Mon, 6 May 2024 10:16:48 +1000 Subject: [PATCH] Allow one to set whether it's a full scan check --- client/models.go | 1 + client/resource_table_monitoring.go | 12 ++++++++++-- client/structure.go | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/models.go b/client/models.go index 4a10db4..ae3f632 100644 --- a/client/models.go +++ b/client/models.go @@ -566,6 +566,7 @@ type MonitoringPlan struct { Type string `json:"adt_type"` Tables []int `json:"tables,omitempty"` Excluded []int `json:"excluded"` + FullScan *bool `json:"fullScan"` } // TableMonitoring ... diff --git a/client/resource_table_monitoring.go b/client/resource_table_monitoring.go index 9926ce9..a953c02 100644 --- a/client/resource_table_monitoring.go +++ b/client/resource_table_monitoring.go @@ -186,6 +186,11 @@ func excludedTables() *schema.Resource { func monitoringTables() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ + "full_scan": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, "tables": { Type: schema.TypeSet, Description: "Tables to monitor with this job", @@ -345,9 +350,11 @@ func resourceTableMonitoringDelete(d *schema.ResourceData, m interface{}) error func expandTableMonitoringPlan(d *schema.ResourceData) (*MonitoringPlan, error) { if inclusion, _ := expandSingleMap(d.Get("include")); inclusion != nil { + fullScan, _ := d.Get("full_scan").(bool) plan := MonitoringPlan{ - Type: "inclusion", - Tables: expandIdentifierList(inclusion["tables"].(*schema.Set).List()), + Type: "inclusion", + Tables: expandIdentifierList(inclusion["tables"].(*schema.Set).List()), + FullScan: &fullScan, } return &plan, nil } @@ -370,6 +377,7 @@ func flattenTableMonitoringPlan(plan *MonitoringPlan) (string, []map[string]inte if plan.Type == "inclusion" { single := make(map[string]interface{}) single["tables"] = identifierList(plan.Tables) + single["full_scan"] = plan.FullScan res = append(res, single) loc = "include" } else { diff --git a/client/structure.go b/client/structure.go index 89cc346..634e779 100644 --- a/client/structure.go +++ b/client/structure.go @@ -16,6 +16,7 @@ var namePattern = regexp.MustCompile(`^[a-z][a-z0-9_]*$`) var identifierPattern = regexp.MustCompile(`^[0-9]+$`) type Bag = map[string]interface{} + func makeBags(num int) []Bag { return make([]Bag, 0, num) }