Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from louy/docs
Browse files Browse the repository at this point in the history
Docs
  • Loading branch information
louy authored Jun 3, 2018
2 parents 754cd1d + 0a9cd83 commit bdeca41
Show file tree
Hide file tree
Showing 9 changed files with 260 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# v0.1.0
- initial release
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ resource "uptimerobot_monitor" "main" {
}
resource "uptimerobot_status_page" "main" {
friendly_name = "My Status Page"
custom_domain = "status.example.com"
password = "WeAreAwsome"
sort_monitors = "down-up-paused"
monitors = ["${resource.uptimerobot_monitor.main.id}"]
hide_logo = false # pro only
friendly_name = "My Status Page"
custom_domain = "status.example.com"
password = "WeAreAwsome"
sort_monitors = "down-up-paused"
monitors = ["${resource.uptimerobot_monitor.main.id}"]
hide_url_links = false # pro only
}
resource "aws_route53_record" {
Expand Down
14 changes: 6 additions & 8 deletions uptimerobot/resource_uptimerobot_status_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ func resourceStatusPage() *schema.Resource {
Default: "a-z",
},
"status": &schema.Schema{
Type: schema.TypeString,
Computed: true,
// ValidateFunc: validation.StringInSlice(mapKeys(statusPageStatus), false),
// Optional: true,
// Default: "active",
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice(mapKeys(statusPageStatus), false),
Default: "active",
},
"monitors": &schema.Schema{
Type: schema.TypeList,
Expand Down Expand Up @@ -107,7 +106,7 @@ func resourceStatusPageCreate(d *schema.ResourceData, m interface{}) error {
}
// log.Printf("[DEBUG] Sort: %s %d", d.Get("sort").(string), statusPageSort[d.Get("sort").(string)])
data.Add("sort", fmt.Sprintf("%d", statusPageSort[d.Get("sort").(string)]))
// data.Add("status", fmt.Sprintf("%d", statusPageStatus[d.Get("status").(string)]))
data.Add("status", fmt.Sprintf("%d", statusPageStatus[d.Get("status").(string)]))

body, err := uptimerobotAPICall(
m.(UptimeRobotConfig).apiKey,
Expand All @@ -119,7 +118,6 @@ func resourceStatusPageCreate(d *schema.ResourceData, m interface{}) error {
}
psp := body["psp"].(map[string]interface{})
d.SetId(fmt.Sprintf("%d", int(psp["id"].(float64))))
d.Set("status", "active")
d.Set("standard_url", psp["standard_url"].(string))
if psp["custom_url"] != nil {
d.Set("custom_url", psp["custom_url"].(string))
Expand Down Expand Up @@ -188,7 +186,7 @@ func resourceStatusPageUpdate(d *schema.ResourceData, m interface{}) error {
data.Add("monitors", strings.Join(strMonitors, "-"))
}
data.Add("sort", fmt.Sprintf("%d", statusPageSort[d.Get("sort").(string)]))
// data.Add("status", fmt.Sprintf("%d", statusPageStatus[d.Get("status").(string)]))
data.Add("status", fmt.Sprintf("%d", statusPageStatus[d.Get("status").(string)]))

_, err := uptimerobotAPICall(
m.(UptimeRobotConfig).apiKey,
Expand Down
26 changes: 26 additions & 0 deletions website/docs/d/account.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
layout: "uptimerobot"
page_title: "UptimeRobot: uptimerobot_account"
sidebar_current: "docs-uptimerobot-datasource-account"
description: |-
Get information about your account
---

# Data Source: uptimerobot_account

Use this data source to get information about the current UptimeRobot account.

## Example Usage

```hcl
data "uptimerobot_account" "main" {}
```

## Attributes Reference

* `email` - the account e-mail
* `monitor_limit` - the max number of monitors that can be created for the account
* `monitor_interval` - the min monitoring interval (in seconds) supported by the account
* `up_monitors` - the number of "up" monitors
* `down_monitors` - the number of "down" monitors
* `pause_monitors` - the number of "paused" monitors
36 changes: 36 additions & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
layout: "uptimerobot"
page_title: "Provider: UptimeRobot"
sidebar_current: "docs-uptimerobot-index"
description: |-
The UptimeRobot provider is used to interact with the resources supported by UptimeRobot. The provider needs to be configured with the proper credentials before it can be used.
---

# UptimeRobot Provider
The UptimeRobot provider is used to interact with the resources supported by UptimeRobot. The provider needs to be configured with the proper credentials before it can be used.
Use the navigation to the left to read about the available resources.

## Example Usage

```hcl
# Configure the UptimeRobot Provider
provider "uptimerobot" {
api_key = "${var.uptimerobot_api_key}"
}
# Create a monitor
resource "uptimerobot_monitor" "web" {
friendly_name = "My Monitor"
type = "http"
url = "http://example.com"
}
```

## Authentication
The UptimeRobot provider needs an account-specific (main) api key to work. You can find that key for your account in the [My Settings](https://uptimerobot.com/dashboard#mySettings) page on UptimeRobot's website.

## Argument Reference

The following arguments are supported in the `provider` block:

* `api_key` - (Required) UptimeRobot's account-specific api key.
44 changes: 44 additions & 0 deletions website/docs/r/alert_contact.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
- layout: `uptimerobot`
- page_title: `UptimeRobot: uptimerobot_alert_contact`
- sidebar_current: `docs-uptimerobot-resource-alert-contact`
description: |-
Set up an alert contact
---

# Resource: uptimerobot_alert_contact

Use this resource to create an alert contact

## Example Usage

```hcl
resource `uptimerobot_alert_contact` `slack` {
friendly_name = `Slack Alert`
type = `slack`
webhook_url = `https://hooks.slack.com/services/XXXXXXX`
}
```

## Arguments Reference

* `friendly_name` - friendly name of the alert contact (for making it easier to distinguish from others).
* `type` - the type of the alert contact notified (Zapier, HipChat and Slack are not supported in the api yet)

Possible values are the following:
- `sms`
- `email`
- `twitter-dm`
- `boxcar`
- `webhook`
- `pushbullet`
- `zapier`
- `pushover`
- `hipchat`
- `slack`
* `value` - alert contact's address/phone/url

## Attributes Reference

* `id` - the ID of the alert contact.
* `status` - the status of the alert contact (`not activated`, `paused` or `active`)
52 changes: 52 additions & 0 deletions website/docs/r/monitor.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
layout: "uptimerobot"
page_title: "UptimeRobot: uptimerobot_monitor"
sidebar_current: "docs-uptimerobot-resource-monitor"
description: |-
Set up a monitor
---

# Resource: uptimerobot_monitor

Use this resource to create a monitor

## Example Usage

```hcl
resource "uptimerobot_monitor" "my_website" {
friendly_name = "My Monitor"
type = "http"
url = "http://example.com"
}
```

## Arguments Reference

* `friendly_name` - friendly name of the monitor (for making it easier to distinguish from others).
* `url` - the URL/IP of the monitor.
* `type` - the type of the monitor. Can be one of the following:
- *`http`*
- *`keyword`* - will also enable the following options:
- `keyword_type` - if the monitor will be flagged as down when the keyword exists or not exists. Can be one of the following:
- `exists`
- `not exists`
- `keyword_value` - the value of the keyword.
- *`ping`*
- *`port`* - will also enable the following options:
- `sub_type` - which pre-defined port/service is monitored or if a custom port is monitored. Can be one of the following:
- `http`
- `https`
- `ftp`
- `smtp`
- `pop3`
- `imap`
- `custom`
- `port` - the port monitored (only if subtype is `custom`)
* `http_username` - used for password-protected web pages (HTTP Basic Auth). Available for HTTP and keyword monitoring.
* `http_password` - used for password-protected web pages (HTTP Basic Auth). Available for HTTP and keyword monitoring.
* `interval` - the interval for the monitoring check (300 seconds by default).

## Attributes Reference

* `id` - the ID of the monitor (can be used for monitor-specific requests)
* `status` - the status of the monitor (`paused`, `not checked yet`, `up`, `seems down`, or `down`)
45 changes: 45 additions & 0 deletions website/docs/r/status_page.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
layout: "uptimerobot"
page_title: "UptimeRobot: uptimerobot_status_page"
sidebar_current: "docs-uptimerobot-resource-status-page"
description: |-
Set up a status page
---

# Resource: uptimerobot_status_page

Use this resource to create a status page

## Example Usage

```hcl
resource "uptimerobot_status_page" "my_status_page" {
friendly_name = "My Status Page"
custom_domain = "status.example.com"
password = "WeAreAwsome"
sort_monitors = "down-up-paused"
monitors = ["${resource.uptimerobot_monitor.main.id}"]
hide_url_links = true # pro only
}
```

## Arguments Reference

* `friendly_name` - friendly name of the monitor (for making it easier to distinguish from others).
* `monitors` - The monitors to be displayed. Use `[0]` for all monitors (default).
* `custom_domain` - (optional) the domain or subdomain that the status page will run on.
* `password` - (optional) the password for the status page.
* `sort` - (optional) the sorting of the status page. Can be one of the following:
- `a-z`
- `z-a`
- `up-down-paused`
- `down-up-paused`
* `status` - the status of the status page (`paused` or `active`). Defaults to `active`
<!-- * `hide_url_links` - (optional) for hiding the Uptime Robot links and only available in the Pro Plan -->

## Attributes Reference

* `id` - the ID of the status page
* `dns_address` - the dns address that you need to point your custom domain to (`stats.uptimerobot.com`)
* `standard_url` - the full url of the page on uptimerobot.com
* `custom_url` - the full url of the page (only if `custom_domain` is set)
43 changes: 43 additions & 0 deletions website/uptimerobot.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<% wrap_layout :inner do %>
<% content_for :sidebar do %>
<div class="docs-sidebar hidden-print affix-top" role="complementary">
<ul class="nav docs-sidenav">
<li<%= sidebar_current("docs-home") %>>
<a href="/docs/providers/index.html">All Providers</a>
</li>

<li<%= sidebar_current("docs-uptimerobot-index") %>>
<a href="/docs/providers/uptimerobot/index.html">UptimeRobot Provider</a>
</li>

<li<%= sidebar_current("docs-uptimerobot-datasource") %>>
<a href="#">Data Sources</a>
<ul class="nav nav-visible">

<li<%= sidebar_current("docs-uptimerobot-datasource-account") %>>
<a href="/docs/providers/uptimerobot/d/account.html">uptimerobot_account</a>
</li>
</ul>
</li>

<li<%= sidebar_current("docs-uptimerobot-resource") %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-uptimerobot-resource-alert-contact") %>>
<a href="/docs/providers/uptimerobot/r/alert_contact.html">uptimerobot_alert_contact</a>
</li>
<li<%= sidebar_current("docs-uptimerobot-resource-monitor") %>>
<a href="/docs/providers/uptimerobot/r/monitor.html">uptimerobot_monitor</a>
</li>
<li<%= sidebar_current("docs-uptimerobot-resource-status-page") %>>
<a href="/docs/providers/uptimerobot/r/status_page.html">uptimerobot_status_page</a>
</li>
</ul>
</li>

</ul>
</div>
<% end %>

<%= yield %>
<% end %>

0 comments on commit bdeca41

Please sign in to comment.