Skip to content

Commit

Permalink
Add status field to status page resources (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
lazandrei19 authored Aug 26, 2024
1 parent 14b3b86 commit 50392de
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GOLANGCI_LINT := golangci-lint run --disable-all \
-E staticcheck \
-E typecheck \
-E unused
VERSION := 0.11.8
VERSION := 0.11.9
.PHONY: test build

help:
Expand Down
1 change: 1 addition & 0 deletions docs/resources/betteruptime_status_page_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://betterstack.com/docs/uptime/api/status-page-resources/

- **availability** (Number) The availability of this resource (from 0.0 to 1.0).
- **id** (String) The ID of this Status Page Resource.
- **status** (String) The current status of the resource. Can be one of `not_monitored` (when the underlying monitor is paused), `operational`, `maintenance`, `degraded`, or `downtime`
- **status_history** (List of Object) History of a single status page resource history (see [below for nested schema](#nestedatt--status_history))

<a id="nestedatt--status_history"></a>
Expand Down
8 changes: 8 additions & 0 deletions internal/provider/resource_status_page_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ var statusPageResourceSchema = map[string]*schema.Schema{
Schema: statusPageStatusHistorySchema,
},
},
"status": {
Description: "The current status of the resource. Can be one of `not_monitored` (when the underlying monitor is paused), `operational`, `maintenance`, `degraded`, or `downtime`",
Type: schema.TypeString,
Optional: false,
Computed: true,
},
}

var statusPageStatusHistorySchema = map[string]*schema.Schema{
Expand Down Expand Up @@ -154,6 +160,7 @@ type statusPageResource struct {
FixedPosition *bool `json:"fixed_position,omitempty"`
WidgetType *string `json:"widget_type,omitempty"`
Availability *float32 `json:"availability,omitempty"`
Status *string `json:"status,omitempty"`
StatusHistory *[]map[string]interface{} `json:"status_history,omitempty"`
}

Expand Down Expand Up @@ -183,6 +190,7 @@ func statusPageResourceRef(in *statusPageResource) []struct {
{k: "widget_type", v: &in.WidgetType},
{k: "availability", v: &in.Availability},
{k: "status_history", v: &in.StatusHistory},
{k: "status", v: &in.Status},
}
}

Expand Down

0 comments on commit 50392de

Please sign in to comment.