Skip to content

Commit

Permalink
Add table checks and tests (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
HuwCampbell authored May 9, 2024
2 parents c19ef40 + 580932d commit fdc2887
Show file tree
Hide file tree
Showing 6 changed files with 481 additions and 120 deletions.
2 changes: 1 addition & 1 deletion client/data_source_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func DataSourceUser() *schema.Resource {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
},
},
},
Expand Down
25 changes: 25 additions & 0 deletions client/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,35 @@ type ColumnKind struct {
Units *string `json:"units,omitempty"`
}

const (
ColumnConstraint_NOT_NULL = "notnull"
ColumnConstraint_UNIQUE = "uniqueness"
ColumnConstraint_NOT_CONSTANT = "notconstant"
ColumnConstraint_ACCEPTED_VALUES = "acceptedvalues"
ColumnConstraint_IN_RANGE = "inrange"
ColumnConstraint_STATISTICS_IN_RANGE = "statisticsinrange"
ColumnConstraint_ROW_CHECK = "rowcheck"
ColumnConstraint_AGGREGATE_CHECK = "aggregatecheck"
)

type ColumnConstraint struct {
Type string `json:"adt_type"`
Name *string `json:"name,omitempty"`
Threshold *float64 `json:"threshold"`
Min *string `json:"min"`
Max *string `json:"max"`
Expression *SQLExpression `json:"expression"`
Aggregation *AggregateExpression `json:"aggregation"`
PerPartition *bool `json:"perPartition,omitempty"`
Acceptable []string `json:"ok,omitempty"`
}

// ColumnInfo ..
type ColumnInfo struct {
Description string `json:"description"`
Column *ColumnRepresentation `json:"column"`
Kind *ColumnKind `json:"kind,omitempty"`
Constraints []ColumnConstraint `json:"constraints,omitempty"`
}

// Table ...
Expand Down Expand Up @@ -542,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
2 changes: 1 addition & 1 deletion client/resource_metrics_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ func buildDimensions(d *schema.ResourceData) ([]Dimension, error) {
name := value["name"].(string)
expression := value["expression"].(string)
var filter *string
if filterRaw, _ := value["filter"].(string); filterRaw != "" {
if filterRaw, _ := value["filter"].(string); filterRaw != "" {
filter = &filterRaw
}
Dimension := Dimension{
Expand Down
Loading

0 comments on commit fdc2887

Please sign in to comment.