Skip to content

feat(uptimerobot): migrate provider to UptimeRobot API v3 - #677

Open
davidgrldo wants to merge 1 commit into
stakater:masterfrom
davidgrldo:enh/637-uptimerobot-api-v3
Open

davidgrldo wants to merge 1 commit into
stakater:masterfrom
davidgrldo:enh/637-uptimerobot-api-v3

Conversation

@davidgrldo

Copy link
Copy Markdown
Contributor

Fixes #637

What

Migrates the UptimeRobot provider from the legacy v2 API to the v3 REST API.

Changes

  • Auth: Authorization: Bearer <apiKey> header on every request (api_key no longer sent in form bodies)
  • REST endpoints: GET/POST/PATCH/DELETE /v3/monitors and /v3/psps with JSON bodies (replaces v2 verb-style POST endpoints)
  • Pagination: cursor-based via nextLink (replaces offset/limit)
  • Error handling: HTTP status codes (v2 stat/error envelope is gone)
  • Rate limiting: bounded retry honoring Retry-After, capped at 3 retries (also fixes the previously unbounded recursive retries in Add/Update)
  • Status pages: attach/detach via PATCH /psps/{id} with the full monitorIds array; Remove now detaches a monitor from its status pages before deleting it
  • CRD unchanged: all existing uptimeRobotConfig fields keep their user-facing format (alertContacts id_threshold_recurrence-, maintenanceWindows, customHTTPStatuses) and are mapped to v3 structured fields internally
  • Tests: 16 new httptest-based unit tests for the v3 client (auth header, JSON bodies, pagination, keyword/alertContacts mapping, PSP attach/detach, 429 retry); live-API integration tests updated to v3 semantics, still self-skip without config
  • Docs: docs/uptimerobot-configuration.md, CONTRIBUTING.md, and example configs updated to the v3 apiURL

Verification

  • go build ./... ✅
  • go vet ./pkg/http/... ./pkg/monitors/uptimerobot/... ✅
  • go test ./pkg/... (all packages, offline) ✅
  • gofmt clean ✅

Notes for reviewers

  • v3 requires timeout on monitor creation; a DefaultTimeout = 30 constant is used.
  • The v2 custom_http_statuses format (200:0_401:1) does not map 1:1 to v3 successHttpResponseCodes — codes flagged :1 become success codes; noted in a code comment.
  • No CRD/schema changes — new v3-only features (tags, custom headers, request body, etc. from [ENHANCE] UptimeRobot all monitors features #603) can follow in a separate PR once this migration lands.

Switch the UptimeRobot provider from the legacy v2 RPC-style API to the
v3 REST API:

- Auth via Authorization: Bearer header (api_key no longer sent in body)
- REST verbs: GET/POST/PATCH/DELETE /monitors and /psps with JSON bodies
- Cursor-based pagination via nextLink
- Bounded 429 retry honoring Retry-After (caps previously unbounded
  recursive retries in Add/Update)
- Remove now detaches the monitor from its status pages before deleting
- Alert contacts / maintenance windows keep their CRD string format,
  mapped to v3 structured fields
- httptest-based offline unit tests for the v3 client
- Docs and example configs updated to the v3 apiURL

Fixes stakater#637

Signed-off-by: davidgrldo <davidgrldo123@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCE] Migrate UptimeRobot controller to API v3

1 participant