Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove checks_version from the supported attributes #102

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions docs/data-sources/betteruptime_monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ Monitor lookup.
- **auth_username** (String, Sensitive) Basic HTTP authentication username to include with the request.
- **call** (Boolean) Should we call the on-call person?
- **check_frequency** (Number) How often should we check your website? In seconds.
- **checks_version** (String) Valid values:

`v1` Proxy-based infrastructure. We use proxies around the world to make regional checks.

`v2` Edge-based infrastructure. More advanced infrastructure, allows running low level checks in regions.
- **confirmation_period** (Number) How long should we wait after observing a failure before we start a new incident? In seconds.
- **created_at** (String) The time when this monitor was created.
- **domain_expiration** (Number) How many days before the domain expires do you want to be alerted? Valid values are 1, 2, 3, 7, 14, 30, and 60.
Expand All @@ -42,9 +37,7 @@ Monitor lookup.

`ipv4` Use IPv4 only,

`ipv6` Use IPv6 only

Note: ip_version is used only if "checks_version" is set to "v2".
`ipv6` Use IPv6 only.
- **last_checked_at** (String) When the website was last checked.
- **maintenance_days** (List of String) An array of maintenance days to set. If a maintenance window is overnight both affected days should be set. Allowed values are ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] or any subset of these days.
- **maintenance_from** (String) Start of the maintenance window each day. We won't check your website during this window. Example: "01:00:00"
Expand Down
9 changes: 1 addition & 8 deletions docs/resources/betteruptime_monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ https://betterstack.com/docs/uptime/api/monitors/
- **auth_username** (String, Sensitive) Basic HTTP authentication username to include with the request.
- **call** (Boolean) Should we call the on-call person?
- **check_frequency** (Number) How often should we check your website? In seconds.
- **checks_version** (String) Valid values:

`v1` Proxy-based infrastructure. We use proxies around the world to make regional checks.

`v2` Edge-based infrastructure. More advanced infrastructure, allows running low level checks in regions.
- **confirmation_period** (Number) How long should we wait after observing a failure before we start a new incident? In seconds.
- **domain_expiration** (Number) How many days before the domain expires do you want to be alerted? Valid values are 1, 2, 3, 7, 14, 30, and 60.
- **email** (Boolean) Should we send an email to the on-call person?
Expand All @@ -68,9 +63,7 @@ https://betterstack.com/docs/uptime/api/monitors/

`ipv4` Use IPv4 only,

`ipv6` Use IPv6 only

Note: ip_version is used only if "checks_version" is set to "v2".
`ipv6` Use IPv6 only.
- **maintenance_days** (List of String) An array of maintenance days to set. If a maintenance window is overnight both affected days should be set. Allowed values are ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] or any subset of these days.
- **maintenance_from** (String) Start of the maintenance window each day. We won't check your website during this window. Example: "01:00:00"
- **maintenance_timezone** (String) The timezone to use for the maintenance window each day. Defaults to UTC. The accepted values can be found in the Rails TimeZone documentation. https://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html
Expand Down
55 changes: 1 addition & 54 deletions internal/provider/resource_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (

// TODO: change to map<name, description> and then use to gen monitor_type description
var monitorTypes = []string{"status", "expected_status_code", "keyword", "keyword_absence", "ping", "tcp", "udp", "smtp", "pop", "imap", "playwright"}
var checksVersions = []string{"v1", "v2"}
var ipVersions = []string{"ipv4", "ipv6"}
var monitorSchema = map[string]*schema.Schema{
"team_name": {
Description: "Used to specify the team the resource should be created in when using global tokens.",
Expand Down Expand Up @@ -283,65 +281,16 @@ var monitorSchema = map[string]*schema.Schema{
Computed: true,
Sensitive: true,
},
"checks_version": {
Description: strings.ReplaceAll(`Valid values:

**v1** Proxy-based infrastructure. We use proxies around the world to make regional checks.

**v2** Edge-based infrastructure. More advanced infrastructure, allows running low level checks in regions.`, "**", "`"),
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateDiagFunc: func(v interface{}, path cty.Path) diag.Diagnostics {
if v == nil {
return nil
}
s := v.(string)
for _, checksVersion := range checksVersions {
if s == checksVersion {
return nil
}
}
return diag.Diagnostics{
diag.Diagnostic{
AttributePath: path,
Severity: diag.Error,
Summary: `Invalid "checks_version"`,
Detail: fmt.Sprintf("Expected one of %v or nil", checksVersions),
},
}
},
},
"ip_version": {
Description: strings.ReplaceAll(`Valid values:

**ipv4** Use IPv4 only,

**ipv6** Use IPv6 only

Note: ip_version is used only if "checks_version" is set to "v2".`, "**", "`"),
**ipv6** Use IPv6 only`, "**", "`"),
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateDiagFunc: func(v interface{}, path cty.Path) diag.Diagnostics {
if v == nil {
return nil
}
s := v.(string)
for _, checksVersion := range ipVersions {
if s == checksVersion {
return nil
}
}
return diag.Diagnostics{
diag.Diagnostic{
AttributePath: path,
Severity: diag.Error,
Summary: `Invalid "ip_version"`,
Detail: fmt.Sprintf("Expected one of %v or nil", ipVersions),
},
}
},
PetrHeinz marked this conversation as resolved.
Show resolved Hide resolved
},
"maintenance_from": {
Description: "Start of the maintenance window each day. We won't check your website during this window. Example: \"01:00:00\"",
Expand Down Expand Up @@ -460,7 +409,6 @@ type monitor struct {
RequestHeaders *[]map[string]interface{} `json:"request_headers,omitempty"`
AuthUsername *string `json:"auth_username,omitempty"`
AuthPassword *string `json:"auth_password,omitempty"`
ChecksVersion *string `json:"checks_version,omitempty"`
IpVersion *string `json:"ip_version,omitempty"`
MaintenanceFrom *string `json:"maintenance_from,omitempty"`
MaintenanceTo *string `json:"maintenance_to,omitempty"`
Expand Down Expand Up @@ -521,7 +469,6 @@ func monitorRef(in *monitor) []struct {
{k: "request_headers", v: &in.RequestHeaders},
{k: "auth_username", v: &in.AuthUsername},
{k: "auth_password", v: &in.AuthPassword},
{k: "checks_version", v: &in.ChecksVersion},
{k: "ip_version", v: &in.IpVersion},
{k: "maintenance_from", v: &in.MaintenanceFrom},
{k: "maintenance_to", v: &in.MaintenanceTo},
Expand Down
Loading