Skip to content

Commit

Permalink
Allow one to set whether it's a full scan check
Browse files Browse the repository at this point in the history
  • Loading branch information
HuwCampbell committed May 6, 2024
1 parent 7b3de1a commit 580932d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand Down
12 changes: 10 additions & 2 deletions client/resource_table_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
}
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions client/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 580932d

Please sign in to comment.