hyperping

package module
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

hyperping-go

Go client library for the Hyperping uptime monitoring API.

Maintained by Hyperping. Originally written by Develeap as github.com/develeap/hyperping-go; this repository continues it from v0.7.1 under the module path github.com/hyperping/hyperping-go.

Used as the shared HTTP client by:

Installation

go get github.com/hyperping/hyperping-go@latest

Usage

package main

import (
    "context"
    "fmt"
    "log"

    hyperping "github.com/hyperping/hyperping-go"
)

func main() {
    client := hyperping.NewClient("sk_your_api_key")

    monitors, err := client.ListMonitors(context.Background())
    if err != nil {
        log.Fatal(err)
    }

    for _, m := range monitors {
        fmt.Printf("%s: down=%v\n", m.Name, m.Down)
    }
}

API Coverage

Resource Operations
Monitors List, Get, Create, Update, Delete, Pause, Resume
Incidents List, Get, Create, Update, Resolve, AddUpdate, Delete
Maintenance List, Get, Create, Update, Delete
Status Pages List, Get, Create, Update, Delete
Subscribers List, Add, Delete
Healthchecks List, Get, Create, Update, Delete, Pause, Resume
Outages List, Get, Create, Acknowledge, Resolve, Escalate, Unacknowledge, Delete
Reports ListMonitorReports, GetMonitorReport

Configuration

client := hyperping.NewClient(
    "sk_your_api_key",
    hyperping.WithBaseURL("https://api.hyperping.io"),
    hyperping.WithMaxRetries(3),
)

MCP Client

The library also exposes a JSON-RPC 2.0 MCP client for the Hyperping MCP server (25 read tools, 5 write tools).

// Initialize transport (validates URL, enforces TLS 1.2+)
transport, err := hyperping.NewMcpTransport("sk_your_api_key", "")
if err != nil {
    log.Fatal(err)
}
mcpClient := hyperping.NewMCPClient(transport)

// Query response time over the last 24h for two monitors. Pass zero-value
// from/to to let the server use its default window (currently 30 days).
// Omit uuids entirely to query every monitor in the project.
now := time.Now().UTC()
resp, err := mcpClient.GetMonitorResponseTime(ctx, now.Add(-24*time.Hour), now,
    "mon_skuPqyDxN9MScu", "mon_IwBwebrfw2S2Q9")
if err != nil {
    log.Fatal(err)
}
if resp != nil {
    fmt.Printf("avg: %.0fms, p95: %.0fms (across %d monitors)\n",
        resp.AvgResponseTime, resp.P95ResponseTime, len(resp.Monitors))
}

Pass an empty string for the URL to use the official endpoint (https://api.hyperping.io/v1/mcp). Pass http://localhost:PORT for local development.

v0.7.0 breaking change: GetMonitorMtta, GetMonitorMttr, GetMonitorResponseTime, and GetMonitorUptime migrated to a canonical windowed signature (ctx, from, to time.Time, uuids ...string) and new typed response models. The pre-v0.7.0 methods sent the wrong arg name to the server (uuid / monitor_uuid string instead of monitor_uuids array) and decoded into structs whose fields the server never returned — every call returned all-zero values silently. See CHANGELOG.md for the full migration table.

v0.4.0 breaking change: NewMcpTransport now returns (*McpTransport, error). Callers must handle the returned error.

Integration tests

The SDK ships a separate integration test suite that hits the live Hyperping MCP server, gated behind a integration build tag:

HYPERPING_TEST_API_KEY=sk_... go test -tags=integration -race -count=1 ./...

CI runs this job automatically when the HYPERPING_TEST_API_KEY repository secret is configured; PRs from forks skip cleanly. The schema-snapshot unit test (testdata/mcp_tools_list.json + schema_contract_test.go) runs on every build and provides drift detection without requiring network access.

Features

  • Automatic retry with exponential backoff and jitter on 5xx and 429 responses
  • Retry-After header respected on rate limit responses
  • Circuit breaker (via gobreaker) to prevent cascading failures
  • Context propagation on all API calls; in-flight MCP calls respect context cancellation
  • Structured error types: *APIError with status code and message
  • MCP JSON-RPC 2.0 client with 30 typed tools (25 read, 5 write)
  • TLS 1.2+ enforced on all transport connections with AEAD cipher suites
  • Mutex double-checked locking on MCP handshake prevents concurrent initialization races

Testing

Interfaces for all resource types are defined in interface.go, enabling straightforward mock injection in tests:

type MockMonitorAPI struct{}

func (m *MockMonitorAPI) ListMonitors(ctx context.Context) ([]hyperping.Monitor, error) {
    return []hyperping.Monitor{{Name: "test"}}, nil
}

License

MIT, see LICENSE. Copyright Develeap (original author) and Hyperping. Maintained by Hyperping.

Migrating from github.com/develeap/hyperping-go

The API is unchanged; only the module path differs:

go get github.com/hyperping/hyperping-go@latest

and replace the import path github.com/develeap/hyperping-go with github.com/hyperping/hyperping-go.

Documentation

Overview

Package hyperping provides a Go client for the Hyperping API.

Index

Constants

View Source
const (
	// DefaultBaseURL is the default Hyperping API base URL.
	DefaultBaseURL = "https://api.hyperping.io"

	// DefaultTimeout is the default HTTP client timeout.
	DefaultTimeout = 30 * time.Second

	// DefaultMaxRetries is the default number of retry attempts.
	DefaultMaxRetries = 3

	// DefaultRetryWaitMin is the minimum wait time between retries.
	DefaultRetryWaitMin = 1 * time.Second //nolint:revive // Min/Max pairing is clearer than removing suffix

	// DefaultRetryWaitMax is the maximum wait time between retries.
	DefaultRetryWaitMax = 30 * time.Second
)
View Source
const (
	// HeaderContentType is the Content-Type HTTP header.
	HeaderContentType = "Content-Type"

	// HeaderAuthorization is the Authorization HTTP header.
	HeaderAuthorization = "Authorization"

	// HeaderAccept is the Accept HTTP header.
	HeaderAccept = "Accept"
)

HTTP header names.

View Source
const (
	// BearerPrefix is the prefix for Bearer token authentication.
	BearerPrefix = "Bearer "

	// APIKeyPrefix is the prefix for Hyperping API keys.
	APIKeyPrefix = "sk_"

	// APIKeyPatternString is the regex pattern string for matching API keys.
	APIKeyPatternString = `sk_[a-zA-Z0-9_-]+` // #nosec G101 -- regex pattern for validation, not a credential
)

Authentication constants.

View Source
const (
	DefaultMCPURL     = "https://api.hyperping.io/v1/mcp"
	DefaultMCPTimeout = 30 * time.Second
)
View Source
const (
	// DefaultMonitorFrequency is the default check frequency for monitors in seconds.
	// This is used when no frequency is specified in the API request.
	DefaultMonitorFrequency = 60

	// DefaultMonitorTimeout is the default timeout for monitor checks in seconds.
	// This is used when no timeout is specified in the API request.
	DefaultMonitorTimeout = 10

	// DefaultNotifyBeforeMinutes is the default number of minutes before maintenance
	// to notify subscribers. This is used when no notification time is specified.
	DefaultNotifyBeforeMinutes = 60
)
View Source
const (
	// HealthchecksBasePath is the base path for healthcheck endpoints (v2).
	HealthchecksBasePath = "/v2/healthchecks"

	// IncidentsBasePath is the base path for incident endpoints (v3).
	IncidentsBasePath = "/v3/incidents"

	// MaintenanceBasePath is the base path for maintenance window endpoints (v1).
	MaintenanceBasePath = "/v1/maintenance-windows"

	// MonitorsBasePath is the base path for monitor endpoints (v1).
	MonitorsBasePath = "/v1/monitors"

	// OutagesBasePath is the base path for outage endpoints (v2).
	OutagesBasePath = "/v2/outages"

	// ReportsBasePath is the base path for report endpoints (v2).
	ReportsBasePath = "/v2/reporting/monitor-reports"

	// SSOConnectionsBasePath is the base path for status-page SSO connection endpoints (v2).
	SSOConnectionsBasePath = "/v2/sso-connections"

	// StatuspagesBasePath is the base path for status page endpoints (v2).
	StatuspagesBasePath = "/v2/statuspages"
)

API base paths - exported for use in tests. These are the canonical API paths used by the client.

View Source
const (
	// ContentTypeJSON is the MIME type for JSON content.
	ContentTypeJSON = "application/json"
)

Content type values.

View Source
const SSOConnectionProviderOIDC = "oidc"

SSOConnectionProviderOIDC is the provider of OpenID Connect connections, the only kind the API creates and changes. SAML (okta, azure, google, saml) and WorkOS connections are set up in the dashboard and are read-only here.

Variables

View Source
var (
	// ErrNotFound is returned when a resource is not found (404).
	ErrNotFound = errors.New("resource not found")

	// ErrUnauthorized is returned when authentication fails (401/403).
	ErrUnauthorized = errors.New("unauthorized: invalid or missing API key")

	// ErrRateLimited is returned when rate limit is exceeded (429).
	ErrRateLimited = errors.New("rate limit exceeded")

	// ErrValidation is returned when request validation fails (400/422).
	ErrValidation = errors.New("validation error")

	// ErrServerError is returned for server errors (5xx).
	ErrServerError = errors.New("server error")
)

Common errors returned by the client.

View Source
var (
	// AllowedFrequencies contains valid monitor check frequencies in seconds.
	AllowedFrequencies = []int{10, 20, 30, 60, 120, 180, 300, 600, 1800, 3600, 21600, 43200, 86400}

	// AllowedTimeouts contains valid monitor timeout values in seconds.
	AllowedTimeouts = []int{5, 10, 15, 20}

	// AllowedProtocols contains valid monitor protocols.
	AllowedProtocols = []string{"http", "port", "icmp", "dns"}

	// AllowedDNSRecordTypes contains valid DNS record types for DNS-protocol monitors.
	AllowedDNSRecordTypes = []string{"A", "AAAA", "CNAME", "MX", "NS", "TXT", "SOA", "SRV", "CAA", "PTR"}

	// AllowedMethods contains valid HTTP methods for monitors.
	AllowedMethods = []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"}

	// AllowedIPVersions contains valid values for a monitor's ip_version.
	AllowedIPVersions = []int{4, 6}

	// AllowedSSLAlertDays contains valid values for a monitor's ssl_alert_days
	// (days before TLS certificate expiry to send the first alert; -1 = never).
	AllowedSSLAlertDays = []int{-1, 1, 3, 7, 15, 30, 60, 90}

	// AllowedDomainAlertDays contains valid values for a monitor's
	// domain_alert_days (days before domain registration expiry to alert;
	// -1 = never).
	AllowedDomainAlertDays = []int{-1, 7, 14, 30, 60, 90}

	// AllowedRegions contains valid monitor check regions.
	// Combined from official Hyperping API documentation and real API responses.
	// See: https://hyperping.com/docs/api/monitors/create
	AllowedRegions = []string{

		"london",
		"frankfurt",
		"paris",
		"amsterdam",

		"singapore",
		"sydney",
		"tokyo",
		"seoul",
		"mumbai",
		"bangalore",

		"virginia",
		"california",
		"sanfrancisco",
		"nyc",
		"toronto",

		"saopaulo",

		"bahrain",

		"capetown",
	}

	// AllowedIncidentTypes contains valid incident type values.
	AllowedIncidentTypes = []string{"outage", "incident"}

	// AllowedIncidentUpdateTypes contains valid incident update type values.
	AllowedIncidentUpdateTypes = []string{"investigating", "identified", "update", "monitoring", "resolved"}

	// AllowedNotificationOptions contains valid maintenance notification options.
	// "none" disables notifications, "scheduled" sends before start, "immediate" sends at creation.
	AllowedNotificationOptions = []string{"none", "scheduled", "immediate"}

	// AllowedPeriodTypes contains valid healthcheck period type values.
	AllowedPeriodTypes = []string{"seconds", "minutes", "hours", "days"}

	// AllowedStatusPageThemes contains valid status page theme values.
	AllowedStatusPageThemes = []string{"light", "dark", "system"}

	// AllowedStatusPageFonts contains valid status page font values.
	AllowedStatusPageFonts = []string{
		"system-ui", "Lato", "Manrope", "Inter", "Open Sans",
		"Montserrat", "Poppins", "Roboto", "Raleway", "Nunito",
		"Merriweather", "DM Sans", "Work Sans",
	}

	// AllowedLanguages contains valid language codes for status page configuration.
	// From API spec: https://hyperping.com/docs/api/status-pages/create
	// Note: LocalizedText struct supports additional languages for content fields,
	// but the status page `languages` setting only accepts these values.
	AllowedLanguages = []string{"en", "fr", "de", "ru", "nl", "pl", "sv"}

	// AllowedSubscriberTypes contains valid subscriber type values.
	AllowedSubscriberTypes = []string{"email", "sms", "teams"}
)

APIKeyPattern is the compiled regex for matching Hyperping API keys.

View Source
var ErrSessionLost = errors.New("MCP session lost; re-initialize required")

ErrSessionLost indicates the MCP server returned HTTP 404 for a request that carried an Mcp-Session-Id header. The transport clears its session state and performs one re-initialize + retry automatically; callers see this error only when the retried call also fails with a session-loss response.

Functions

func IsCircuitBreakerOpen

func IsCircuitBreakerOpen(err error) bool

IsCircuitBreakerOpen checks if an error is due to the circuit breaker being open. This occurs when too many recent API calls failed, triggering the circuit breaker to stop all requests for a recovery period (30 seconds by default).

func IsNotFound

func IsNotFound(err error) bool

IsNotFound checks if an error is a not found error.

func IsRateLimited

func IsRateLimited(err error) bool

IsRateLimited checks if an error is a rate limit error.

func IsServerError

func IsServerError(err error) bool

IsServerError checks if an error is a server error.

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized checks if an error is an unauthorized error.

func IsValidation

func IsValidation(err error) bool

IsValidation checks if an error is a validation error.

func ValidateResourceID

func ValidateResourceID(id string) error

ValidateResourceID validates that a resource ID is safe for use in URL paths. Prevents path traversal (../), URL parameter injection (?key=val), and SSRF via URL authority override (@evil.com). Exported for use in provider ImportState validation (VULN-015).

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Details    []ValidationDetail
	RetryAfter int // seconds to wait before retrying (for rate limits)
}

APIError represents an error returned by the Hyperping API.

func NewAPIError

func NewAPIError(statusCode int, message string) *APIError

NewAPIError creates a new APIError from an HTTP response.

func NewRateLimitError

func NewRateLimitError(retryAfter int) *APIError

NewRateLimitError creates a new APIError for rate limiting with retry-after.

func NewValidationError

func NewValidationError(statusCode int, message string, details []ValidationDetail) *APIError

NewValidationError creates a new APIError with validation details.

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface. The message is sanitized to remove sensitive information like API keys.

func (*APIError) Is

func (e *APIError) Is(target error) bool

Is checks if the error matches a target error.

func (*APIError) Unwrap

func (e *APIError) Unwrap() error

Unwrap returns the underlying error based on status code.

type AcknowledgedByUser

type AcknowledgedByUser struct {
	UUID  string `json:"uuid"`
	Email string `json:"email"`
	Name  string `json:"name"`
}

AcknowledgedByUser represents the user who acknowledged an outage.

type AddIncidentUpdateRequest

type AddIncidentUpdateRequest struct {
	Text LocalizedText `json:"text"`
	Type string        `json:"type"`
	Date string        `json:"date"`
}

AddIncidentUpdateRequest represents a request to add an update to an incident. API: POST /v3/incidents/{uuid}/updates

type AddSubscriberRequest

type AddSubscriberRequest struct {
	Type            string  `json:"type"`                        // email, sms, teams (NOT slack - must use OAuth)
	Email           *string `json:"email,omitempty"`             // required if type=email
	Phone           *string `json:"phone,omitempty"`             // required if type=sms
	TeamsWebhookURL *string `json:"teams_webhook_url,omitempty"` // required if type=teams
	Language        *string `json:"language,omitempty"`          // optional, default: en
}

AddSubscriberRequest represents a request to add a subscriber. API: ... /v2/statuspages/{uuid}/subscribers

func (AddSubscriberRequest) Validate

func (r AddSubscriberRequest) Validate() error

Validate checks that the required fields are present based on the subscriber type.

type Alert

type Alert struct {
	UUID           string `json:"uuid"`
	MonitorUUID    string `json:"monitor_uuid"`
	Status         string `json:"status"`
	TriggeredAt    string `json:"triggered_at"`
	AcknowledgedBy string `json:"acknowledged_by,omitempty"`
	ResolvedAt     string `json:"resolved_at,omitempty"`
}

Alert is one entry in the AlertHistory.RawAlerts slice. The pre-v0.7.1 field tags reflect the historical typing; future probes against non-empty rawAlerts arrays should refine these to match the live shape. omitempty is preserved on fields whose population depends on the alert lifecycle (acknowledged-by, resolved-at).

type AlertHistory

type AlertHistory struct {
	TimeGroups  []AlertTimeGroup `json:"timeGroups"`
	TotalAlerts int              `json:"totalAlerts"`
	DownAlerts  int              `json:"downAlerts"`
	UpAlerts    int              `json:"upAlerts"`
	RawAlerts   []Alert          `json:"rawAlerts"`
}

==================== Alert Models ====================

v0.7.1 BREAKING: replaces the pre-v0.7.1 AlertHistory{Alerts, Total} declaration. The server's list_recent_alerts shape is bucketed counts plus a flat rawAlerts list:

{
  "timeGroups": [{"time": "...", "count": N}, ...],
  "totalAlerts": N,
  "downAlerts": N,
  "upAlerts": N,
  "rawAlerts": [ ... ]
}

The pre-v0.7.1 fields were never populated because the server never returned the keys "alerts" or "total". Probed against /v1/mcp tools/call list_recent_alerts on 2026-06-09 to capture the shape above.

Total() is retained as a method so downstream consumers that read the scalar alert count keep compiling, but the underlying source is now the server's TotalAlerts field (zero-valued when rawAlerts is empty).

func (*AlertHistory) Total

func (a *AlertHistory) Total() int

Total reports the aggregate alert count for the response window. It mirrors the server's totalAlerts field rather than summing TimeGroups because the server already does that aggregation and downstream callers should not need to know whether the field exists at the top level or only as a derived sum.

type AlertTimeGroup

type AlertTimeGroup struct {
	Time  string `json:"time"`
	Count int    `json:"count"`
}

AlertTimeGroup is one bucket of the timeGroups histogram returned by list_recent_alerts. Buckets stay populated even when rawAlerts is empty (e.g., the server returns zero-count buckets for every interval in a long window), so Count==0 buckets are valid data, not absence.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the Hyperping API client.

func NewClient

func NewClient(apiKey string, opts ...Option) *Client

NewClient creates a new Hyperping API client.

func (*Client) AcknowledgeOutage

func (c *Client) AcknowledgeOutage(ctx context.Context, uuid string) (*OutageAction, error)

AcknowledgeOutage acknowledges an outage. API: ... /v2/outages/{uuid}/acknowledge

func (*Client) AddIncidentUpdate

func (c *Client) AddIncidentUpdate(ctx context.Context, uuid string, req AddIncidentUpdateRequest) (*Incident, error)

AddIncidentUpdate adds an update to an existing incident.

func (*Client) AddSubscriber

func (c *Client) AddSubscriber(ctx context.Context, uuid string, req AddSubscriberRequest) (*StatusPageSubscriber, error)

AddSubscriber adds a new subscriber to a status page. Note: Slack subscribers cannot be added via API - they must use OAuth flow. Subscribers added via API are automatically confirmed.

func (*Client) CreateHealthcheck

func (c *Client) CreateHealthcheck(ctx context.Context, req CreateHealthcheckRequest) (*Healthcheck, error)

CreateHealthcheck creates a new healthcheck. API: ... /v2/healthchecks

func (*Client) CreateIncident

func (c *Client) CreateIncident(ctx context.Context, req CreateIncidentRequest) (*Incident, error)

CreateIncident creates a new incident. API POST returns minimal response: {"message":"...","uuid":"..."} We must then call GetIncident to retrieve the full incident details.

func (*Client) CreateMaintenance

func (c *Client) CreateMaintenance(ctx context.Context, req CreateMaintenanceRequest) (*Maintenance, error)

CreateMaintenance creates a new maintenance window. API POST returns minimal response: {"uuid": "mw_xxx"} We follow up with a GET to retrieve the full maintenance details.

func (*Client) CreateMonitor

func (c *Client) CreateMonitor(ctx context.Context, req CreateMonitorRequest) (*Monitor, error)

CreateMonitor creates a new monitor.

func (*Client) CreateOutage

func (c *Client) CreateOutage(ctx context.Context, req CreateOutageRequest) (*Outage, error)

CreateOutage creates a manual outage. API: ... /v2/outages

Manual outages are used to track incidents that don't originate from monitor failures. They must be manually resolved via the ResolveOutage endpoint.

func (*Client) CreateSSOConnection added in v0.10.0

func (c *Client) CreateSSOConnection(ctx context.Context, req CreateSSOConnectionRequest) (*SSOConnection, error)

CreateSSOConnection creates an OpenID Connect connection. It is billed like one created in the dashboard.

func (*Client) CreateStatusPage

func (c *Client) CreateStatusPage(ctx context.Context, req CreateStatusPageRequest) (*StatusPage, error)

CreateStatusPage creates a new status page.

func (*Client) DeleteHealthcheck

func (c *Client) DeleteHealthcheck(ctx context.Context, uuid string) error

DeleteHealthcheck deletes a healthcheck. API: ... /v2/healthchecks/{uuid}

func (*Client) DeleteIncident

func (c *Client) DeleteIncident(ctx context.Context, uuid string) error

DeleteIncident deletes an incident.

func (*Client) DeleteMaintenance

func (c *Client) DeleteMaintenance(ctx context.Context, uuid string) error

DeleteMaintenance deletes a maintenance window.

func (*Client) DeleteMonitor

func (c *Client) DeleteMonitor(ctx context.Context, id string) error

DeleteMonitor deletes a monitor.

func (*Client) DeleteOutage

func (c *Client) DeleteOutage(ctx context.Context, uuid string) error

DeleteOutage deletes an outage. API: ... /v2/outages/{uuid}

func (*Client) DeleteSSOConnection added in v0.10.0

func (c *Client) DeleteSSOConnection(ctx context.Context, uuid string) error

DeleteSSOConnection deletes an OpenID Connect connection and stops its billing. The API refuses while a status page still uses it.

func (*Client) DeleteStatusPage

func (c *Client) DeleteStatusPage(ctx context.Context, uuid string) error

DeleteStatusPage deletes a status page. Warning: This action is irreversible.

func (*Client) DeleteSubscriber

func (c *Client) DeleteSubscriber(ctx context.Context, uuid string, subscriberID int) error

DeleteSubscriber deletes a subscriber from a status page.

func (*Client) EscalateOutage

func (c *Client) EscalateOutage(ctx context.Context, uuid string) (*OutageAction, error)

EscalateOutage escalates an outage (triggers additional notifications). API: ... /v2/outages/{uuid}/escalate

func (*Client) GetHealthcheck

func (c *Client) GetHealthcheck(ctx context.Context, uuid string) (*Healthcheck, error)

GetHealthcheck retrieves a single healthcheck by UUID. API: ... /v2/healthchecks/{uuid}

func (*Client) GetIncident

func (c *Client) GetIncident(ctx context.Context, uuid string) (*Incident, error)

GetIncident returns a single incident by UUID.

func (*Client) GetMaintenance

func (c *Client) GetMaintenance(ctx context.Context, uuid string) (*Maintenance, error)

GetMaintenance returns a single maintenance window by UUID.

func (*Client) GetMonitor

func (c *Client) GetMonitor(ctx context.Context, id string) (*Monitor, error)

GetMonitor returns a single monitor by ID.

func (*Client) GetMonitorReport

func (c *Client) GetMonitorReport(ctx context.Context, uuid string, from, to string) (*MonitorReport, error)

GetMonitorReport returns the report for a specific monitor. Optional from/to parameters can be provided for date filtering.

func (*Client) GetOutage

func (c *Client) GetOutage(ctx context.Context, uuid string) (*Outage, error)

GetOutage retrieves a single outage by UUID. API: ... /v2/outages/{uuid}

func (*Client) GetSSOConnection added in v0.10.0

func (c *Client) GetSSOConnection(ctx context.Context, uuid string) (*SSOConnection, error)

GetSSOConnection returns a single SSO connection by UUID.

func (*Client) GetStatusPage

func (c *Client) GetStatusPage(ctx context.Context, uuid string) (*StatusPage, error)

GetStatusPage returns a single status page by UUID.

func (*Client) GetSubscriber

func (c *Client) GetSubscriber(ctx context.Context, statuspageID string, subscriberID int) (*StatusPageSubscriber, error)

GetSubscriber retrieves a single subscriber by ID from a status page. The Hyperping API does not provide a direct GET endpoint for individual subscribers, so this method paginates through the subscriber list with early termination.

func (*Client) IterIncidents

func (c *Client) IterIncidents(ctx context.Context) iter.Seq2[Incident, error]

IterIncidents returns an iterator over all incidents. It calls ListIncidents once and yields each item. On error it yields (Incident{}, err) and stops. If the caller returns false from yield, iteration stops immediately.

func (*Client) IterMonitors

func (c *Client) IterMonitors(ctx context.Context) iter.Seq2[Monitor, error]

IterMonitors returns an iterator over all monitors. It calls ListMonitors once and yields each item. On error it yields (Monitor{}, err) and stops. If the caller returns false from yield, iteration stops immediately.

func (*Client) IterStatusPages

func (c *Client) IterStatusPages(ctx context.Context, search *string) iter.Seq2[StatusPage, error]

IterStatusPages returns an iterator over all status pages, following pagination. It calls ListStatusPages for each page (starting at 0), yielding items one by one. On error it yields (StatusPage{}, err) and stops. Context cancellation propagates as an error through ListStatusPages, so no explicit page cap is needed.

func (*Client) ListHealthchecks

func (c *Client) ListHealthchecks(ctx context.Context) ([]Healthcheck, error)

ListHealthchecks retrieves all healthchecks. API: ... /v2/healthchecks

The response can vary in format:

  • Direct array: [{...}, {...}]
  • Wrapped in "healthchecks": {"healthchecks": [{...}]}
  • Wrapped in "data": {"data": [{...}]}

func (*Client) ListIncidents

func (c *Client) ListIncidents(ctx context.Context) ([]Incident, error)

ListIncidents returns all incidents.

func (*Client) ListMaintenance

func (c *Client) ListMaintenance(ctx context.Context) ([]Maintenance, error)

ListMaintenance returns all maintenance windows, paginating through all pages.

func (*Client) ListMonitorReports

func (c *Client) ListMonitorReports(ctx context.Context, from, to string) ([]MonitorReport, error)

ListMonitorReports returns reports for all monitors. Optional from/to parameters can be provided for date filtering. API returns wrapped response: {"period": {...}, "monitors": [...]}

func (*Client) ListMonitors

func (c *Client) ListMonitors(ctx context.Context) ([]Monitor, error)

ListMonitors returns all monitors.

NOTE: The Hyperping API returns all monitors in a single response (no pagination).

func (*Client) ListOutages

func (c *Client) ListOutages(ctx context.Context, opts ...OutageListOption) ([]Outage, error)

ListOutages retrieves all outages, paginating through all pages. API: ... /v2/outages

The response can vary in format:

  • Direct array: [{...}, {...}]
  • Wrapped in "outages": {"outages": [{...}], "hasNextPage": bool}
  • Wrapped in "data": {"data": [{...}]}

Optional filters are applied via functional options (see WithStatus).

func (*Client) ListSSOConnections added in v0.10.0

func (c *Client) ListSSOConnections(ctx context.Context) ([]SSOConnection, error)

ListSSOConnections returns every status-page SSO connection of the API key's project (OpenID Connect, SAML and WorkOS).

func (*Client) ListStatusPages

func (c *Client) ListStatusPages(ctx context.Context, page *int, search *string) (*StatusPagePaginatedResponse, error)

ListStatusPages returns a paginated list of status pages. Parameters:

  • page: Optional 0-indexed page number
  • search: Optional search filter for name, hostname, or subdomain

func (*Client) ListSubscribers

func (c *Client) ListSubscribers(ctx context.Context, uuid string, page *int, subscriberType *string) (*SubscriberPaginatedResponse, error)

ListSubscribers returns a paginated list of subscribers for a status page. Parameters:

  • uuid: Status page UUID
  • page: Optional 0-indexed page number
  • subscriberType: Optional filter by type (all, email, sms, slack, teams)

func (*Client) PauseHealthcheck

func (c *Client) PauseHealthcheck(ctx context.Context, uuid string) (*HealthcheckAction, error)

PauseHealthcheck pauses a healthcheck. API: ... /v2/healthchecks/{uuid}/pause

func (*Client) PauseMonitor

func (c *Client) PauseMonitor(ctx context.Context, id string) (*Monitor, error)

PauseMonitor pauses a monitor.

func (*Client) ResolveIncident

func (c *Client) ResolveIncident(ctx context.Context, uuid string, message string) (*Incident, error)

ResolveIncident resolves an incident by adding a "resolved" update. In the Hyperping v3 API, incidents are resolved by adding an update with type "resolved".

func (*Client) ResolveOutage

func (c *Client) ResolveOutage(ctx context.Context, uuid string) (*OutageAction, error)

ResolveOutage manually resolves an outage. API: ... /v2/outages/{uuid}/resolve

func (*Client) ResumeHealthcheck

func (c *Client) ResumeHealthcheck(ctx context.Context, uuid string) (*HealthcheckAction, error)

ResumeHealthcheck resumes a paused healthcheck. API: ... /v2/healthchecks/{uuid}/resume

func (*Client) ResumeMonitor

func (c *Client) ResumeMonitor(ctx context.Context, id string) (*Monitor, error)

ResumeMonitor resumes a paused monitor.

func (*Client) UnacknowledgeOutage

func (c *Client) UnacknowledgeOutage(ctx context.Context, uuid string) (*OutageAction, error)

UnacknowledgeOutage removes acknowledgement from an outage. API: ... /v2/outages/{uuid}/unacknowledge

func (*Client) UpdateHealthcheck

func (c *Client) UpdateHealthcheck(ctx context.Context, uuid string, req UpdateHealthcheckRequest) (*Healthcheck, error)

UpdateHealthcheck updates an existing healthcheck. API: ... /v2/healthchecks/{uuid}

func (*Client) UpdateIncident

func (c *Client) UpdateIncident(ctx context.Context, uuid string, req UpdateIncidentRequest) (*Incident, error)

UpdateIncident updates an existing incident.

func (*Client) UpdateMaintenance

func (c *Client) UpdateMaintenance(ctx context.Context, uuid string, req UpdateMaintenanceRequest) (*Maintenance, error)

UpdateMaintenance updates an existing maintenance window.

func (*Client) UpdateMonitor

func (c *Client) UpdateMonitor(ctx context.Context, id string, req UpdateMonitorRequest) (*Monitor, error)

UpdateMonitor updates an existing monitor.

func (*Client) UpdateSSOConnection added in v0.10.0

func (c *Client) UpdateSSOConnection(ctx context.Context, uuid string, req UpdateSSOConnectionRequest) (*SSOConnection, error)

UpdateSSOConnection changes an OpenID Connect connection. Only the fields set in req are sent.

func (*Client) UpdateStatusPage

func (c *Client) UpdateStatusPage(ctx context.Context, uuid string, req UpdateStatusPageRequest) (*StatusPage, error)

UpdateStatusPage updates an existing status page. Only provided fields will be updated.

type CreateHealthcheckRequest

type CreateHealthcheckRequest struct {
	Name             string  `json:"name"`
	Cron             *string `json:"cron,omitempty"`         // Required if PeriodValue/PeriodType not set
	Timezone         *string `json:"timezone,omitempty"`     // Required if Cron is set
	PeriodValue      *int    `json:"period_value,omitempty"` // Required if Cron not set
	PeriodType       *string `json:"period_type,omitempty"`  // Required if Cron not set
	GracePeriodValue int     `json:"grace_period_value"`
	GracePeriodType  string  `json:"grace_period_type"`           // seconds, minutes, hours, days
	EscalationPolicy *string `json:"escalation_policy,omitempty"` // UUID of escalation policy
}

CreateHealthcheckRequest represents a request to create a healthcheck. API: POST /v2/healthchecks Note: API accepts snake_case in requests but returns camelCase in responses

func (CreateHealthcheckRequest) Validate

func (r CreateHealthcheckRequest) Validate() error

Validate checks input lengths on CreateHealthcheckRequest fields.

type CreateIncidentRequest

type CreateIncidentRequest struct {
	Title              LocalizedText              `json:"title"`
	Text               LocalizedText              `json:"text"`
	Type               string                     `json:"type"`
	AffectedComponents []string                   `json:"affectedComponents,omitempty"`
	StatusPages        []string                   `json:"statuspages"`
	Date               string                     `json:"date,omitempty"`
	Updates            []AddIncidentUpdateRequest `json:"updates,omitempty"`
}

CreateIncidentRequest represents a request to create an incident. API: POST /v3/incidents

func (CreateIncidentRequest) Validate

func (r CreateIncidentRequest) Validate() error

Validate checks input lengths on CreateIncidentRequest fields.

type CreateMaintenanceRequest

type CreateMaintenanceRequest struct {
	Name                string        `json:"name"`
	Title               LocalizedText `json:"title,omitempty"`
	Text                LocalizedText `json:"text,omitempty"`
	StartDate           string        `json:"start_date"`
	EndDate             string        `json:"end_date"`
	Monitors            []string      `json:"monitors"`
	StatusPages         []string      `json:"statuspages,omitempty"`
	NotificationOption  string        `json:"notificationOption,omitempty"`
	NotificationMinutes *int          `json:"notificationMinutes,omitempty"`
}

CreateMaintenanceRequest represents a request to create a maintenance window. API: POST /v1/maintenance-windows

func (CreateMaintenanceRequest) Validate

func (r CreateMaintenanceRequest) Validate() error

Validate checks input lengths on CreateMaintenanceRequest fields.

type CreateMonitorRequest

type CreateMonitorRequest struct {
	Name               string          `json:"name"`
	URL                string          `json:"url"`
	Protocol           string          `json:"protocol"`
	ProjectUUID        string          `json:"projectUuid,omitempty"`
	HTTPMethod         string          `json:"http_method,omitempty"`
	CheckFrequency     int             `json:"check_frequency,omitempty"`
	Regions            []string        `json:"regions,omitempty"`
	RequestHeaders     []RequestHeader `json:"request_headers,omitempty"`
	RequestBody        *string         `json:"request_body,omitempty"`
	FollowRedirects    *bool           `json:"follow_redirects,omitempty"`
	ExpectedStatusCode string          `json:"expected_status_code,omitempty"`
	RequiredKeyword    *string         `json:"required_keyword,omitempty"`
	Paused             bool            `json:"paused,omitempty"`
	Port               *int            `json:"port,omitempty"`
	AlertsWait         *int            `json:"alerts_wait,omitempty"`
	EscalationPolicy   *string         `json:"escalation_policy,omitempty"`
	DNSRecordType      *string         `json:"dns_record_type,omitempty"`
	DNSNameserver      *string         `json:"dns_nameserver,omitempty"`
	DNSExpectedAnswer  *string         `json:"dns_expected_answer,omitempty"`
	IPVersion          *int            `json:"ip_version,omitempty"`
	SSLAlertDays       *int            `json:"ssl_alert_days,omitempty"`
	SSLReminders       *bool           `json:"ssl_reminders,omitempty"`
	SSLNotifyOnChange  *bool           `json:"ssl_notify_on_change,omitempty"`
	DomainAlertDays    *int            `json:"domain_alert_days,omitempty"`
}

CreateMonitorRequest represents a request to create a monitor. API: POST /v1/monitors

func (CreateMonitorRequest) Validate

func (r CreateMonitorRequest) Validate() error

Validate checks input lengths on CreateMonitorRequest fields.

type CreateOutageRequest

type CreateOutageRequest struct {
	MonitorUUID          string  `json:"monitorUuid"`
	StartDate            string  `json:"startDate"`         // ISO 8601 format
	EndDate              *string `json:"endDate,omitempty"` // ISO 8601 format, optional
	StatusCode           int     `json:"statusCode"`
	Description          string  `json:"description"`
	OutageType           string  `json:"outageType"`                     // "manual" for manually created outages
	EscalationPolicyUUID *string `json:"escalationPolicyUuid,omitempty"` // UUID of escalation policy to trigger
	Severity             *string `json:"severity,omitempty"`
	Summary              *string `json:"summary,omitempty"`
}

CreateOutageRequest represents a request to create a manual outage. API: POST /v2/outages

func (CreateOutageRequest) Validate

func (r CreateOutageRequest) Validate() error

Validate checks input lengths on CreateOutageRequest fields.

type CreateSSOConnectionRequest added in v0.10.0

type CreateSSOConnectionRequest struct {
	Name     string `json:"name"`
	Provider string `json:"provider,omitempty"` // defaults to "oidc", the only accepted value
	// Issuer URL or domain of the identity provider, e.g. "https://tenant.eu.auth0.com".
	Issuer       string `json:"issuer"`
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"` //nolint:gosec // G117: sent to the API, never returned or logged
	// AllowedDomains restricts sign-in to these email domains (empty = any).
	AllowedDomains []string `json:"allowed_domains,omitempty"`
}

CreateSSOConnectionRequest creates an OpenID Connect connection. The API checks the issuer's discovery document and the client credentials before saving anything. API: POST /v2/sso-connections

func (CreateSSOConnectionRequest) String added in v0.10.0

String never prints the client secret.

func (CreateSSOConnectionRequest) Validate added in v0.10.0

func (r CreateSSOConnectionRequest) Validate() error

Validate checks input lengths on CreateSSOConnectionRequest fields.

type CreateStatusPageAuthenticationSettings

type CreateStatusPageAuthenticationSettings struct {
	PasswordProtection *bool    `json:"password_protection,omitempty"`
	GoogleSSO          *bool    `json:"google_sso,omitempty"`
	SAMLSSO            *bool    `json:"saml_sso,omitempty"`
	AllowedDomains     []string `json:"google_allowed_domains,omitempty"`
	SSOConnectionUUID  *string  `json:"sso_connection_uuid,omitempty"`
}

CreateStatusPageAuthenticationSettings represents authentication settings in create requests.

type CreateStatusPageRequest

type CreateStatusPageRequest struct {
	Name      string  `json:"name"`
	Subdomain *string `json:"subdomain,omitempty"`
	Hostname  *string `json:"hostname,omitempty"`
	Website   *string `json:"website,omitempty"`
	// Description is a plain string on write; the API returns a localized map on read.
	Description           *string                                 `json:"description,omitempty"`
	Languages             []string                                `json:"languages,omitempty"`
	DefaultLanguage       *string                                 `json:"default_language,omitempty"`
	Theme                 *string                                 `json:"theme,omitempty"`
	Font                  *string                                 `json:"font,omitempty"`
	AccentColor           *string                                 `json:"accent_color,omitempty"`
	AutoRefresh           *bool                                   `json:"auto_refresh,omitempty"`
	BannerHeader          *bool                                   `json:"banner_header,omitempty"`
	LogoHeight            *string                                 `json:"logo_height,omitempty"`
	Favicon               *string                                 `json:"favicon,omitempty"`
	HidePoweredBy         *bool                                   `json:"hide_powered_by,omitempty"`
	HideFromSearchEngines *bool                                   `json:"hide_from_search_engines,omitempty"`
	GoogleAnalytics       *string                                 `json:"google_analytics,omitempty"`
	Password              *string                                 `json:"password,omitempty"` //nolint:gosec // G117: status page access-control field, not a stored credential
	Subscribe             *CreateStatusPageSubscribeSettings      `json:"subscribe,omitempty"`
	Authentication        *CreateStatusPageAuthenticationSettings `json:"authentication,omitempty"`
	Sections              []CreateStatusPageSection               `json:"sections,omitempty"`
}

CreateStatusPageRequest represents a request to create a status page. API: ... /v2/statuspages

func (CreateStatusPageRequest) Validate

func (r CreateStatusPageRequest) Validate() error

Validate checks input lengths on CreateStatusPageRequest fields.

type CreateStatusPageSection

type CreateStatusPageSection struct {
	// Name is a plain string (stored under the page's default language) or a
	// localized map[string]string (language -> text), stored as sent.
	Name     interface{}               `json:"name"`
	IsSplit  *bool                     `json:"is_split,omitempty"`
	Services []CreateStatusPageService `json:"services,omitempty"`
}

CreateStatusPageSection represents a section in create requests.

type CreateStatusPageService

type CreateStatusPageService struct {
	MonitorUUID       *string                   `json:"monitor_uuid,omitempty"` // top-level monitor services
	UUID              *string                   `json:"uuid,omitempty"`         // nested child services
	NameShown         *string                   `json:"name_shown,omitempty"`   // top-level display name (string)
	Name              map[string]string         `json:"name,omitempty"`         // display name (localized map), both levels
	ShowUptime        *bool                     `json:"show_uptime,omitempty"`
	ShowResponseTimes *bool                     `json:"show_response_times,omitempty"`
	Description       interface{}               `json:"description,omitempty"` // *string or map[string]string (language -> text)
	IsGroup           *bool                     `json:"is_group,omitempty"`
	Services          []CreateStatusPageService `json:"services,omitempty"` // nested services
}

CreateStatusPageService represents a service in create requests. Top-level monitor entries use MonitorUUID ("monitor_uuid"). Nested child services inside groups use UUID ("uuid") - the Hyperping API uses different field names at each nesting level. Group header entries omit both UUID fields and use only a name + IsGroup + Services. Name (localized map, language -> text) is accepted at both levels; NameShown is a plain string stored under the page's default language, top level only.

type CreateStatusPageSubscribeSettings

type CreateStatusPageSubscribeSettings struct {
	Enabled *bool `json:"enabled,omitempty"`
	Email   *bool `json:"email,omitempty"`
	Slack   *bool `json:"slack,omitempty"`
	Teams   *bool `json:"teams,omitempty"`
	SMS     *bool `json:"sms,omitempty"`
}

CreateStatusPageSubscribeSettings represents subscription settings in create requests.

type EscalationPolicy

type EscalationPolicy struct {
	UUID  string           `json:"uuid"`
	Name  string           `json:"name"`
	Team  string           `json:"team"`
	Steps []EscalationStep `json:"steps"`
}

type EscalationPolicyRef

type EscalationPolicyRef struct {
	UUID string `json:"uuid"`
	Name string `json:"name"`
}

EscalationPolicyRef holds both the UUID and display name of an escalation policy. The Hyperping read API returns {"uuid":"...","name":"..."} for escalation_policy. Storing the name enables correct tier classification without extra API calls.

type EscalationPolicyReference

type EscalationPolicyReference struct {
	UUID         string `json:"uuid"`
	Name         string `json:"name"`
	AlertedSteps int    `json:"alertedSteps"`
	TotalSteps   int    `json:"totalSteps"`
}

EscalationPolicyReference is a simplified escalation policy object.

type EscalationStep

type EscalationStep struct {
	Delay      int    `json:"delay"`
	TargetType string `json:"target_type"` // user, schedule, integration
	TargetID   string `json:"target_id"`
}

type FlexibleString

type FlexibleString string

FlexibleString is a string type that can unmarshal from both JSON strings and numbers. This handles API inconsistencies where a field might be returned as either type.

func (FlexibleString) MarshalJSON

func (fs FlexibleString) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for FlexibleString.

func (FlexibleString) String

func (fs FlexibleString) String() string

String returns the string value.

func (*FlexibleString) UnmarshalJSON

func (fs *FlexibleString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for FlexibleString.

type Healthcheck

type Healthcheck struct {
	UUID string `json:"uuid"` // tok_abc123def456 (the secret token of the ping URL)
	// PublicUUID is the public id (hc_…) that status pages reference. Unlike
	// UUID (the ping token), it is not a secret. Nil when the API does not
	// return it (older API versions).
	PublicUUID       *string                    `json:"publicUuid,omitempty"`
	Name             string                     `json:"name"`
	PingURL          string                     `json:"pingUrl"`                    // Auto-generated ping URL
	Cron             string                     `json:"cron,omitempty"`             // Cron expression (e.g., "0 0 * * *")
	Timezone         string                     `json:"timezone,omitempty"`         // Timezone (e.g., "America/New_York"); filled from "tz" when only that is returned
	Tz               string                     `json:"tz,omitempty"`               // Timezone as returned by GET/PUT (API inconsistency: POST returns "timezone")
	PeriodValue      *int                       `json:"periodValue,omitempty"`      // Numeric value for period
	PeriodType       string                     `json:"periodType,omitempty"`       // seconds, minutes, hours, days
	Period           int                        `json:"period"`                     // Calculated period in seconds
	GracePeriod      int                        `json:"gracePeriod"`                // Grace period in seconds
	GracePeriodValue int                        `json:"gracePeriodValue"`           // Numeric value for grace period
	GracePeriodType  string                     `json:"gracePeriodType"`            // seconds, minutes, hours, days
	IsDown           bool                       `json:"isDown"`                     // Current status (read-only)
	IsPaused         bool                       `json:"isPaused"`                   // Whether paused (read-only)
	LastPing         string                     `json:"lastPing,omitempty"`         // ISO 8601 timestamp (read-only)
	DueDate          string                     `json:"dueDate,omitempty"`          // ISO 8601 timestamp (read-only)
	CreatedAt        string                     `json:"createdAt,omitempty"`        // ISO 8601 timestamp (read-only)
	LastLogStartDate string                     `json:"lastLogStartDate,omitempty"` // ISO 8601 timestamp (read-only)
	LastLogEndDate   string                     `json:"lastLogEndDate,omitempty"`   // ISO 8601 timestamp (read-only)
	EscalationPolicy *EscalationPolicyReference `json:"escalationPolicy,omitempty"` // Linked escalation policy
}

Healthcheck represents a Hyperping healthcheck (cron job monitoring). API: GET /v2/healthchecks, GET /v2/healthchecks/{uuid}

Healthchecks monitor cron jobs via ping URLs. When the job runs, it pings the URL. If no ping is received within the expected period + grace period, an alert is triggered.

func (Healthcheck) GetTimezone

func (h Healthcheck) GetTimezone() string

GetTimezone returns the timezone value regardless of which JSON field was populated. The Hyperping API is inconsistent: POST responses use "timezone" while GET and PUT responses use "tz". "tz" is preferred, "timezone" is the fallback.

func (*Healthcheck) UnmarshalJSON

func (h *Healthcheck) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for Healthcheck.

The Hyperping API is inconsistent about the timezone field: GET and PUT responses return "tz" while POST responses return "timezone". After decoding, both Timezone and Tz hold the same value whichever key the API sent ("tz" wins when both are present and differ, since it is the stored column), so callers reading either field see the timezone.

type HealthcheckAPI

type HealthcheckAPI interface {
	GetHealthcheck(ctx context.Context, uuid string) (*Healthcheck, error)
	ListHealthchecks(ctx context.Context) ([]Healthcheck, error)
	CreateHealthcheck(ctx context.Context, req CreateHealthcheckRequest) (*Healthcheck, error)
	UpdateHealthcheck(ctx context.Context, uuid string, req UpdateHealthcheckRequest) (*Healthcheck, error)
	DeleteHealthcheck(ctx context.Context, uuid string) error
	PauseHealthcheck(ctx context.Context, uuid string) (*HealthcheckAction, error)
	ResumeHealthcheck(ctx context.Context, uuid string) (*HealthcheckAction, error)
}

HealthcheckAPI defines the interface for healthcheck operations. This interface enables mocking in unit tests.

type HealthcheckAction

type HealthcheckAction struct {
	Message string `json:"message"`
	UUID    string `json:"uuid"`
}

HealthcheckAction represents an action performed on a healthcheck. Used for pause, resume responses.

type HyperpingAPI

HyperpingAPI combines all API interfaces for the Hyperping client. This is the primary interface used by the provider resources.

type HyperpingAuthError

type HyperpingAuthError struct {
	RequestID string
	// contains filtered or unexported fields
}

HyperpingAuthError is returned when the API responds with 401 Unauthorized or 403 Forbidden. RequestID is the X-Request-Id from the response header.

func (*HyperpingAuthError) Error

func (e *HyperpingAuthError) Error() string

func (*HyperpingAuthError) Unwrap

func (e *HyperpingAuthError) Unwrap() error

type HyperpingNotFoundError

type HyperpingNotFoundError struct {
	RequestID string
	// contains filtered or unexported fields
}

HyperpingNotFoundError is returned when the API responds with 404 Not Found. RequestID is the X-Request-Id from the response header.

func (*HyperpingNotFoundError) Error

func (e *HyperpingNotFoundError) Error() string

func (*HyperpingNotFoundError) Unwrap

func (e *HyperpingNotFoundError) Unwrap() error

type HyperpingRateLimitError

type HyperpingRateLimitError struct {
	RequestID  string
	RetryAfter int
	// contains filtered or unexported fields
}

HyperpingRateLimitError is returned when the API responds with 429 Too Many Requests. RequestID is the X-Request-Id from the response header. RetryAfter is the number of seconds the caller should wait before retrying.

func (*HyperpingRateLimitError) Error

func (e *HyperpingRateLimitError) Error() string

func (*HyperpingRateLimitError) Unwrap

func (e *HyperpingRateLimitError) Unwrap() error

type HyperpingValidationError

type HyperpingValidationError struct {
	RequestID string
	Details   []ValidationDetail
	// contains filtered or unexported fields
}

HyperpingValidationError is returned when the API responds with 400 Bad Request or 422 Unprocessable Entity. RequestID is the X-Request-Id from the response header. Details contains field-level validation errors when the API provides them.

func (*HyperpingValidationError) Error

func (e *HyperpingValidationError) Error() string

func (*HyperpingValidationError) Unwrap

func (e *HyperpingValidationError) Unwrap() error

type Incident

type Incident struct {
	UUID               string           `json:"uuid"`
	Date               string           `json:"date,omitempty"`
	Title              LocalizedText    `json:"title"`
	Text               LocalizedText    `json:"text"`
	Type               string           `json:"type"`
	AffectedComponents []string         `json:"affectedComponents,omitempty"`
	StatusPages        []string         `json:"statuspages"`
	Updates            []IncidentUpdate `json:"updates,omitempty"`
}

Incident represents a Hyperping incident. API: GET /v3/incidents, GET /v3/incidents/{uuid}

type IncidentAPI

type IncidentAPI interface {
	ListIncidents(ctx context.Context) ([]Incident, error)
	GetIncident(ctx context.Context, id string) (*Incident, error)
	CreateIncident(ctx context.Context, req CreateIncidentRequest) (*Incident, error)
	UpdateIncident(ctx context.Context, id string, req UpdateIncidentRequest) (*Incident, error)
	DeleteIncident(ctx context.Context, id string) error
	AddIncidentUpdate(ctx context.Context, uuid string, req AddIncidentUpdateRequest) (*Incident, error)
	ResolveIncident(ctx context.Context, uuid string, message string) (*Incident, error)
	IterIncidents(ctx context.Context) iter.Seq2[Incident, error]
}

IncidentAPI defines the interface for incident operations. This interface enables mocking in unit tests.

type IncidentUpdate

type IncidentUpdate struct {
	UUID string        `json:"uuid"`
	Date string        `json:"date"`
	Text LocalizedText `json:"text"`
	Type string        `json:"type"`
}

IncidentUpdate represents an update to an incident.

type Integration

type Integration struct {
	UUID       string `json:"uuid"`
	Name       string `json:"name"`
	Type       string `json:"type"` // email, slack, webhook, pagerduty
	Enabled    bool   `json:"enabled"`
	LastTestAt string `json:"last_test_at,omitempty"`
	CreatedAt  string `json:"created_at"`
}

type JSONRPCError

type JSONRPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
}

JSONRPCError represents a JSON-RPC 2.0 error

type JSONRPCRequest

type JSONRPCRequest struct {
	JSONRPC string         `json:"jsonrpc"`
	ID      any            `json:"id"`
	Method  string         `json:"method"`
	Params  map[string]any `json:"params,omitempty"`
}

JSONRPCRequest represents a JSON-RPC 2.0 request

type JSONRPCResponse

type JSONRPCResponse struct {
	JSONRPC string        `json:"jsonrpc"`
	ID      any           `json:"id"`
	Result  any           `json:"result,omitempty"`
	Error   *JSONRPCError `json:"error,omitempty"`
}

JSONRPCResponse represents a JSON-RPC 2.0 response

type ListMonitorReportsResponse

type ListMonitorReportsResponse struct {
	Period   ReportPeriod    `json:"period"`
	Monitors []MonitorReport `json:"monitors"`
}

ListMonitorReportsResponse wraps the list response from the API. API: GET /v2/reporting/monitor-reports Response format: {"period": {...}, "monitors": [...]}

type LocalizedText

type LocalizedText struct {
	En string `json:"en,omitempty"`
	Fr string `json:"fr,omitempty"`
	De string `json:"de,omitempty"`
	Ru string `json:"ru,omitempty"`
	Nl string `json:"nl,omitempty"`
	Es string `json:"es,omitempty"`
	It string `json:"it,omitempty"`
	Pt string `json:"pt,omitempty"`
	Ja string `json:"ja,omitempty"`
	Zh string `json:"zh,omitempty"`
}

LocalizedText represents text that can be localized in multiple languages. Used for incident/maintenance titles and descriptions. API format: {"en": "English text", "fr": "French text"} Supports all AllowedLanguages: en, fr, de, ru, nl, es, it, pt, ja, zh.

type Logger

type Logger interface {
	// Debug logs a debug-level message with optional key-value pairs.
	Debug(ctx context.Context, msg string, fields map[string]interface{})
}

Logger is an optional interface for logging HTTP requests and responses. This allows the client to be used with any logging framework.

type MCPClient

type MCPClient struct {
	// contains filtered or unexported fields
}

MCPClient is a high-level client for Hyperping MCP server tools

func NewMCPClient

func NewMCPClient(transport MCPTransport) *MCPClient

NewMCPClient creates a new MCP client

func (*MCPClient) CreateMonitor

func (c *MCPClient) CreateMonitor(ctx context.Context, req MCPCreateMonitorRequest) (*MonitorDetails, error)

CreateMonitor creates a new monitor

func (*MCPClient) DeleteMonitor

func (c *MCPClient) DeleteMonitor(ctx context.Context, uuid string) error

DeleteMonitor deletes a monitor by UUID. Note: the MCP server's tools/list does not currently include delete_monitor (verified 2026-06-12). This method follows the pause/resume pattern and will work once the server adds the tool.

func (*MCPClient) GetEscalationPolicy

func (c *MCPClient) GetEscalationPolicy(ctx context.Context, uuid string) (*EscalationPolicy, error)

GetEscalationPolicy returns a single escalation policy

func (*MCPClient) GetIntegration

func (c *MCPClient) GetIntegration(ctx context.Context, uuid string) (*Integration, error)

GetIntegration returns a single integration

func (*MCPClient) GetMonitor

func (c *MCPClient) GetMonitor(ctx context.Context, uuid string) (*MonitorDetails, error)

GetMonitor returns a single monitor by UUID

func (*MCPClient) GetMonitorAnomalies

func (c *MCPClient) GetMonitorAnomalies(ctx context.Context, monitorUUID string) ([]MonitorAnomaly, error)

GetMonitorAnomalies returns anomalies detected for a monitor

func (*MCPClient) GetMonitorHttpLogs

func (c *MCPClient) GetMonitorHttpLogs(ctx context.Context, monitorUUID string) (*ProbeLogResponse, error)

GetMonitorHttpLogs returns HTTP probe logs for a monitor

func (*MCPClient) GetMonitorMtta

func (c *MCPClient) GetMonitorMtta(ctx context.Context, from, to time.Time, uuids ...string) (*MonitorMttaResponse, error)

GetMonitorMtta returns mean-time-to-acknowledge metrics over a date window for the supplied monitors. Pass zero-value from/to to let the server use its default window. Pass no uuids to query every monitor in the project.

v0.7.0 BREAKING: see GetMonitorResponseTime godoc for context. The old signature took (ctx, monitorUUID string) and silently decoded into a MttaReport whose fields the server never returned.

func (*MCPClient) GetMonitorMttr

func (c *MCPClient) GetMonitorMttr(ctx context.Context, from, to time.Time, uuids ...string) (*MonitorMttrResponse, error)

GetMonitorMttr returns mean-time-to-resolve metrics over a date window for the supplied monitors.

v0.7.0 BREAKING: see GetMonitorMtta godoc for context.

func (*MCPClient) GetMonitorOutages

func (c *MCPClient) GetMonitorOutages(ctx context.Context, monitorUUID string, page int) (*OutageList, error)

GetMonitorOutages returns outages for a specific monitor

func (*MCPClient) GetMonitorResponseTime

func (c *MCPClient) GetMonitorResponseTime(ctx context.Context, from, to time.Time, uuids ...string) (*MonitorResponseTimeResponse, error)

GetMonitorResponseTime returns response-time metrics over a date window for the supplied monitors. Pass zero-value from/to to let the server use its default window (currently 30 days). Pass no uuids to query every monitor in the project.

v0.7.0 BREAKING: the pre-v0.7.0 signature took a single monitorUUID string and sent the wrong arg name to the server (uuid, not monitor_uuids), so every call returned an empty body decoded into a struct of zero values. See CHANGELOG.

func (*MCPClient) GetMonitorUptime

func (c *MCPClient) GetMonitorUptime(ctx context.Context, from, to time.Time, uuids ...string) (*MonitorUptimeResponse, error)

GetMonitorUptime returns SLA uptime metrics over a date window for the supplied monitors.

v0.7.0 BREAKING: see GetMonitorMtta godoc for context. The pre-v0.7.0 signature sent the wrong arg name (monitor_uuid singular, while the server declares monitor_uuids array) and decoded into a UptimeReport whose fields the server never returned.

func (*MCPClient) GetOnCallSchedule

func (c *MCPClient) GetOnCallSchedule(ctx context.Context, uuid string) (*OnCallSchedule, error)

GetOnCallSchedule returns a single on-call schedule

func (*MCPClient) GetOutage

func (c *MCPClient) GetOutage(ctx context.Context, uuid string) (*MCPOutage, error)

GetOutage returns a single outage by UUID

func (*MCPClient) GetOutageTimeline

func (c *MCPClient) GetOutageTimeline(ctx context.Context, outageUUID string) (*OutageTimeline, error)

GetOutageTimeline returns the lifecycle timeline for an outage

func (*MCPClient) GetStatusSummary

func (c *MCPClient) GetStatusSummary(ctx context.Context) (*StatusSummary, error)

GetStatusSummary returns aggregate monitor status counts

func (*MCPClient) ListEscalationPolicies

func (c *MCPClient) ListEscalationPolicies(ctx context.Context) ([]EscalationPolicy, error)

ListEscalationPolicies returns all escalation policies

func (*MCPClient) ListIntegrations

func (c *MCPClient) ListIntegrations(ctx context.Context) ([]Integration, error)

ListIntegrations returns all notification channel integrations

func (*MCPClient) ListMonitors

func (c *MCPClient) ListMonitors(ctx context.Context, status string, page, limit int) (*MonitorList, error)

ListMonitors returns paginated list of monitors with optional status filter

func (*MCPClient) ListOnCallSchedules

func (c *MCPClient) ListOnCallSchedules(ctx context.Context) ([]OnCallSchedule, error)

ListOnCallSchedules returns all on-call schedules

func (*MCPClient) ListOutages

func (c *MCPClient) ListOutages(ctx context.Context, page int) (*OutageList, error)

ListOutages returns paginated outage list

func (*MCPClient) ListRecentAlerts

func (c *MCPClient) ListRecentAlerts(ctx context.Context) (*AlertHistory, error)

ListRecentAlerts returns recent alert notifications

func (*MCPClient) ListTeamMembers

func (c *MCPClient) ListTeamMembers(ctx context.Context) ([]TeamMember, error)

ListTeamMembers returns all team members

func (*MCPClient) PauseMonitor

func (c *MCPClient) PauseMonitor(ctx context.Context, uuid string) error

PauseMonitor pauses a monitor

func (*MCPClient) ResumeMonitor

func (c *MCPClient) ResumeMonitor(ctx context.Context, uuid string) error

ResumeMonitor resumes a paused monitor

func (*MCPClient) SearchMonitorsByName

func (c *MCPClient) SearchMonitorsByName(ctx context.Context, query string) ([]Monitor, error)

SearchMonitorsByName searches monitors by name

func (*MCPClient) UpdateMonitor

func (c *MCPClient) UpdateMonitor(ctx context.Context, uuid string, req MCPUpdateMonitorRequest) (*MonitorDetails, error)

UpdateMonitor updates an existing monitor

type MCPCreateMonitorRequest

type MCPCreateMonitorRequest struct {
	Name               string             `json:"name"`
	URL                string             `json:"url"`
	Protocol           *string            `json:"protocol,omitempty"`    // "http", "icmp", "port", "dns"
	Port               *int               `json:"port,omitempty"`        // required when protocol="port"
	HTTPMethod         *string            `json:"http_method,omitempty"` // "GET", "POST", etc.
	Regions            []string           `json:"regions,omitempty"`
	CheckFrequency     *float64           `json:"check_frequency,omitempty"` // seconds
	FollowRedirects    *bool              `json:"follow_redirects,omitempty"`
	Timeout            *int               `json:"timeout,omitempty"`              // 1-60 seconds
	ExpectedStatusCode *string            `json:"expected_status_code,omitempty"` // "200", "2xx", "1xx-3xx"
	RequestBody        *string            `json:"request_body,omitempty"`
	RequestHeaders     []MCPRequestHeader `json:"request_headers,omitempty"`
	RequiredKeyword    *string            `json:"required_keyword,omitempty"`
	Paused             *bool              `json:"paused,omitempty"`
	AlertsWait         *float64           `json:"alerts_wait,omitempty"` // minutes; -1 disables, 0 is immediate
	DNSRecordType      *string            `json:"dns_record_type,omitempty"`
	DNSNameserver      *string            `json:"dns_nameserver,omitempty"`
	DNSExpectedAnswer  *string            `json:"dns_expected_answer,omitempty"`
	EscalationPolicy   *string            `json:"escalation_policy,omitempty"`
	GroupID            any                `json:"group_id,omitempty"` // int or string
}

MCPCreateMonitorRequest carries arguments for the MCP create_monitor tool. Field names and types match the server's inputSchema exactly. Required fields are Name and URL; all others are pointer types so nil values are omitted from the args map and the server applies its own defaults.

type MCPOutage

type MCPOutage struct {
	UUID           string `json:"uuid"`
	MonitorUUID    string `json:"monitor_uuid"`
	Status         string `json:"status"` // active, resolved
	StartedAt      string `json:"started_at"`
	AcknowledgedAt string `json:"acknowledged_at,omitempty"`
	ResolvedAt     string `json:"resolved_at,omitempty"`
	Duration       int    `json:"duration"` // seconds
}

type MCPRequestHeader

type MCPRequestHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

MCPRequestHeader is a single custom HTTP header sent with an MCP create_monitor or update_monitor request. The server declares this as an array of {name, value} objects under the request_headers arg.

type MCPTransport

type MCPTransport interface {
	Initialize(ctx context.Context) (map[string]any, error)
	CallTool(ctx context.Context, toolName string, args map[string]any) (any, error)
}

MCPTransport defines the interface for MCP transport

type MCPUpdateMonitorRequest

type MCPUpdateMonitorRequest struct {
	Name               *string            `json:"name,omitempty"`
	URL                *string            `json:"url,omitempty"`
	Protocol           *string            `json:"protocol,omitempty"`
	Port               *int               `json:"port,omitempty"`
	HTTPMethod         *string            `json:"http_method,omitempty"`
	Regions            []string           `json:"regions,omitempty"`
	CheckFrequency     *float64           `json:"check_frequency,omitempty"`
	FollowRedirects    *bool              `json:"follow_redirects,omitempty"`
	Timeout            *int               `json:"timeout,omitempty"`
	ExpectedStatusCode *string            `json:"expected_status_code,omitempty"`
	RequestBody        *string            `json:"request_body,omitempty"`
	RequestHeaders     []MCPRequestHeader `json:"request_headers,omitempty"`
	RequiredKeyword    *string            `json:"required_keyword,omitempty"`
	Paused             *bool              `json:"paused,omitempty"`
	AlertsWait         *float64           `json:"alerts_wait,omitempty"`
	DNSRecordType      *string            `json:"dns_record_type,omitempty"`
	DNSNameserver      *string            `json:"dns_nameserver,omitempty"`
	DNSExpectedAnswer  *string            `json:"dns_expected_answer,omitempty"`
	EscalationPolicy   *string            `json:"escalation_policy,omitempty"`
	GroupID            any                `json:"group_id,omitempty"`
}

MCPUpdateMonitorRequest carries arguments for the MCP update_monitor tool. The UUID is passed as a separate method argument, not embedded here. All fields are optional; nil values are omitted so only explicitly changed fields reach the server.

type Maintenance

type Maintenance struct {
	UUID                string              `json:"uuid"`
	Name                string              `json:"name"`
	Title               LocalizedText       `json:"title,omitempty"`
	Text                LocalizedText       `json:"text,omitempty"`
	StartDate           *string             `json:"start_date,omitempty"`
	EndDate             *string             `json:"end_date,omitempty"`
	Timezone            string              `json:"timezone,omitempty"`
	Monitors            []string            `json:"monitors"`
	StatusPages         []string            `json:"statuspages,omitempty"`
	BulkUUID            *string             `json:"bulkUuid,omitempty"`
	CreatedBy           string              `json:"createdBy,omitempty"`
	CreatedAt           string              `json:"createdAt,omitempty"`
	NotificationOption  string              `json:"notificationOption,omitempty"` // none, immediate, scheduled
	NotificationMinutes *int                `json:"notificationMinutes,omitempty"`
	Status              string              `json:"status,omitempty"`  // upcoming, ongoing, completed (read-only)
	Updates             []MaintenanceUpdate `json:"updates,omitempty"` // Array of updates (read-only)
}

Maintenance represents a Hyperping maintenance window. API: GET /v1/maintenance-windows, GET /v1/maintenance-windows/{uuid}

type MaintenanceAPI

type MaintenanceAPI interface {
	ListMaintenance(ctx context.Context) ([]Maintenance, error)
	GetMaintenance(ctx context.Context, id string) (*Maintenance, error)
	CreateMaintenance(ctx context.Context, req CreateMaintenanceRequest) (*Maintenance, error)
	UpdateMaintenance(ctx context.Context, id string, req UpdateMaintenanceRequest) (*Maintenance, error)
	DeleteMaintenance(ctx context.Context, id string) error
}

MaintenanceAPI defines the interface for maintenance operations. This interface enables mocking in unit tests.

type MaintenanceUpdate

type MaintenanceUpdate struct {
	Text LocalizedText `json:"text"`
	Date string        `json:"date"`
}

MaintenanceUpdate represents an update to a maintenance window.

type McpTransport

type McpTransport struct {
	// contains filtered or unexported fields
}

McpTransport is the low-level JSON-RPC 2.0 client for the Hyperping MCP server

func NewMcpTransport

func NewMcpTransport(apiKey string, baseURL string, opts ...TransportOption) (*McpTransport, error)

NewMcpTransport creates a new MCP transport. Returns an error if baseURL fails validation (must be HTTPS or localhost).

func (*McpTransport) CallTool

func (t *McpTransport) CallTool(ctx context.Context, toolName string, args map[string]any) (any, error)

func (*McpTransport) Initialize

func (t *McpTransport) Initialize(ctx context.Context) (map[string]any, error)

Initialize performs the MCP initialize handshake. On success it stores the captured Mcp-Session-Id (if any) and marks the transport ready for tool calls.

Concurrency:

  • Initialize is safe to call concurrently from multiple goroutines. The stampede guard (initInflightMu, double-checked locking via initialized.Load) ensures only one goroutine performs the actual handshake; subsequent callers short-circuit on the published state and return immediately. Without this guard a worker pool that pre-initialized would issue N parallel handshakes against the server.
  • Calling Initialize concurrently with in-flight CallTool requests is permitted (no deadlock, no data corruption), but may cause a CallTool in the middle of callToolOnce to surface ErrSessionLost spuriously for a backward-compat 404. The race between the snapshot at the top of callToolOnce and a session id newly issued mid-call is treated as session-loss by the recovery path. In steady-state usage, prefer letting CallTool's built-in init guard manage initialization.

type Metrics

type Metrics interface {
	// RecordAPICall records an API call with method, path, status code, and duration in seconds.
	RecordAPICall(ctx context.Context, method, path string, statusCode int, durationSec float64)
	// RecordRetry records a retry attempt.
	RecordRetry(ctx context.Context, method, path string, attempt int)
	// RecordCircuitBreakerState records circuit breaker state changes.
	RecordCircuitBreakerState(ctx context.Context, state string)
}

Metrics is an optional interface for collecting operational metrics. This allows integration with Prometheus, CloudWatch, Datadog, etc.

type Monitor

type Monitor struct {
	ID                 int                  `json:"id"` // v1 numeric ID (used by status page renderer)
	UUID               string               `json:"uuid"`
	Name               string               `json:"name"`
	URL                string               `json:"url"`
	Protocol           string               `json:"protocol"`
	ProjectUUID        string               `json:"projectUuid,omitempty"`
	HTTPMethod         string               `json:"http_method"`
	Regions            []string             `json:"regions"`
	CheckFrequency     int                  `json:"check_frequency"`
	RequestHeaders     []RequestHeader      `json:"request_headers"`
	RequestBody        string               `json:"request_body,omitempty"`
	FollowRedirects    bool                 `json:"follow_redirects"`
	ExpectedStatusCode FlexibleString       `json:"expected_status_code"`
	RequiredKeyword    *string              `json:"required_keyword,omitempty"`
	Paused             bool                 `json:"paused"`
	Port               *int                 `json:"port,omitempty"`
	AlertsWait         int                  `json:"alerts_wait,omitempty"`
	EscalationPolicy   *EscalationPolicyRef `json:"-"` // populated by UnmarshalJSON
	DNSRecordType      *string              `json:"dns_record_type,omitempty"`
	DNSNameserver      *string              `json:"dns_nameserver,omitempty"`
	DNSExpectedAnswer  *string              `json:"dns_expected_answer,omitempty"`
	Status             string               `json:"status,omitempty"`
	SSLExpiration      *int                 `json:"ssl_expiration,omitempty"` // Whole days (rounded down) until the TLS certificate expires (read-only)
	// IPVersion is 4 or 6; an IPv6 monitor is checked over IPv6 only (http,
	// port and icmp). Pointer so an absent field (older API) stays nil.
	IPVersion *int `json:"ip_version,omitempty"`
	// TLS certificate and domain expiry alerting. Pointers so an absent field
	// (older API) maps to nil rather than a misleading zero value.
	SSLAlertDays      *int  `json:"ssl_alert_days,omitempty"`       // Days before cert expiry to send the first alert (-1 = never)
	SSLReminders      *bool `json:"ssl_reminders,omitempty"`        // Also remind at the standard steps below the threshold
	SSLNotifyOnChange *bool `json:"ssl_notify_on_change,omitempty"` // Notify when the served certificate changes
	DomainAlertDays   *int  `json:"domain_alert_days,omitempty"`    // Days before domain registration expiry to alert (-1 = never)
	DomainExpiration  *int  `json:"domain_expiration,omitempty"`    // Whole days until the domain registration expires (read-only, nullable)
}

Monitor represents a Hyperping monitor. API: GET /v1/monitors, GET /v1/monitors/{uuid}

The escalation_policy field is polymorphic: the read API returns an object {"uuid":"...","name":"..."}, while POST/PUT send a plain UUID string. UnmarshalJSON handles both shapes and normalises to EscalationPolicyRef.

func (*Monitor) UnmarshalJSON

func (m *Monitor) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for Monitor. It handles the escalation_policy field being either a plain UUID string or an object {"uuid":"...","name":"..."} as returned by the Hyperping read API.

type MonitorAPI

type MonitorAPI interface {
	ListMonitors(ctx context.Context) ([]Monitor, error)
	GetMonitor(ctx context.Context, uuid string) (*Monitor, error)
	CreateMonitor(ctx context.Context, req CreateMonitorRequest) (*Monitor, error)
	UpdateMonitor(ctx context.Context, uuid string, req UpdateMonitorRequest) (*Monitor, error)
	DeleteMonitor(ctx context.Context, uuid string) error
	PauseMonitor(ctx context.Context, uuid string) (*Monitor, error)
	ResumeMonitor(ctx context.Context, uuid string) (*Monitor, error)
	IterMonitors(ctx context.Context) iter.Seq2[Monitor, error]
}

MonitorAPI defines the interface for monitor operations. This interface enables mocking in unit tests.

type MonitorAnomaly

type MonitorAnomaly struct {
	UUID        string  `json:"uuid"`
	MonitorUUID string  `json:"monitor_uuid"`
	DetectedAt  string  `json:"detected_at"`
	Score       float64 `json:"score"`
	Type        string  `json:"type"`
}

type MonitorDetails

type MonitorDetails struct {
	UUID             string            `json:"uuid"`
	Name             string            `json:"name"`
	URL              string            `json:"url"`
	Status           string            `json:"status"` // up, down, paused, ssl_expiring
	Method           string            `json:"method"`
	Frequency        int               `json:"frequency"`
	ExpectedStatus   int               `json:"expected_status"`
	Regions          []string          `json:"regions"`
	CreatedAt        string            `json:"created_at"`
	UpdatedAt        string            `json:"updated_at"`
	Tags             []string          `json:"tags,omitempty"`
	EscalationPolicy *string           `json:"escalation_policy,omitempty"`
	CustomHeaders    map[string]string `json:"custom_headers,omitempty"`
}

type MonitorList

type MonitorList struct {
	Monitors []Monitor `json:"monitors"`
	Total    int       `json:"total"`
	Page     int       `json:"page"`
	Limit    int       `json:"limit"`
}

type MonitorMttaEntry

type MonitorMttaEntry struct {
	UUID         string  `json:"uuid"`
	Name         string  `json:"name"`
	Protocol     string  `json:"protocol"`
	Acknowledged int     `json:"acknowledged"`
	Mtta         float64 `json:"mtta"`
}

type MonitorMttaResponse

type MonitorMttaResponse struct {
	Monitors          []MonitorMttaEntry `json:"monitors"`
	TotalAcknowledged int                `json:"totalAcknowledged"`
	Mtta              float64            `json:"mtta"`
}

==================== MTTA (windowed) ====================

v0.7.0 BREAKING: replaces MttaReport. The pre-v0.7.0 struct modeled fields that the server never returned, so every call decoded zero values silently. The shape below matches the live MCP server (probed 2026-06-08 against /v1/mcp tools/call get_monitor_mtta):

{
  "monitors": [ ... per-monitor entries when alerts present ... ],
  "totalAcknowledged": N,
  "mtta": <seconds>
}

Per-monitor MTTA entries mirror the MTTR per-monitor shape for forward-compatibility; the server returns an empty array when there are no acknowledged alerts in the window.

type MonitorMttrEntry

type MonitorMttrEntry struct {
	UUID          string  `json:"uuid"`
	Name          string  `json:"name"`
	Protocol      string  `json:"protocol"`
	OutageCount   int     `json:"outageCount"`
	TotalDowntime float64 `json:"totalDowntime"`
	Mttr          float64 `json:"mttr"`
	Mtta          float64 `json:"mtta"`
	LongestOutage float64 `json:"longestOutage"`
}

type MonitorMttrResponse

type MonitorMttrResponse struct {
	Monitors           []MonitorMttrEntry `json:"monitors"`
	TotalOutages       int                `json:"totalOutages"`
	TotalOutagesLength int                `json:"totalOutagesLength"`
	Mttr               float64            `json:"mttr"`
	Mtta               float64            `json:"mtta"`
}

==================== MTTR (windowed) ====================

v0.7.0 BREAKING: replaces MttrReport.

type MonitorReference

type MonitorReference struct {
	UUID     string `json:"uuid"`
	Name     string `json:"name"`
	URL      string `json:"url"`
	Protocol string `json:"protocol"`
}

MonitorReference is a simplified monitor object included in outage responses.

type MonitorReport

type MonitorReport struct {
	UUID          string       `json:"uuid"`
	Name          string       `json:"name"`
	Protocol      string       `json:"protocol"`
	Period        ReportPeriod `json:"period"`
	SLA           float64      `json:"sla"`
	MTTR          int          `json:"mttr,omitempty"`          // Mean Time To Recovery in seconds
	MTTRFormatted string       `json:"mttrFormatted,omitempty"` // Human-readable MTTR
	Outages       OutageStats  `json:"outages"`
}

MonitorReport represents a report for a monitor. API: GET /v2/reporting/monitor-reports/{uuid} API: GET /v2/reporting/monitor-reports?from=&to=

type MonitorResponseTimeEntry

type MonitorResponseTimeEntry struct {
	UUID                    string              `json:"uuid"`
	Name                    string              `json:"name"`
	Protocol                string              `json:"protocol"`
	AvgResponseTime         float64             `json:"avgResponseTime"`
	AvgResponseTimeByRegion map[string]*float64 `json:"avgResponseTimeByRegion"`
	Count                   int                 `json:"count"`
}

AvgResponseTimeByRegion uses *float64 because the server returns null for regions that recorded no probes in the window. Differentiating "no data" from "0 ms" matters for downstream metric emission.

type MonitorResponseTimeResponse

type MonitorResponseTimeResponse struct {
	TimeGroups      []ResponseTimeGroup        `json:"timeGroups"`
	AvgResponseTime float64                    `json:"avgResponseTime"`
	P95ResponseTime float64                    `json:"p95ResponseTime"`
	Monitors        []MonitorResponseTimeEntry `json:"monitors"`
}

==================== Response time (windowed) ====================

v0.7.0 BREAKING: replaces ResponseTimeReport.

type MonitorUptimeEntry

type MonitorUptimeEntry struct {
	UUID          string         `json:"uuid"`
	Name          string         `json:"name"`
	Protocol      string         `json:"protocol"`
	UptimePeriods []UptimePeriod `json:"uptimePeriods"`
	AverageUptime float64        `json:"averageUptime"`
	OutageCount   int            `json:"outageCount"`
	TotalDowntime float64        `json:"totalDowntime"`
	Mttr          float64        `json:"mttr"`
	LongestOutage float64        `json:"longestOutage"`
}

type MonitorUptimeResponse

type MonitorUptimeResponse struct {
	Monitors           []MonitorUptimeEntry `json:"monitors"`
	PeriodAverages     []UptimePeriod       `json:"periodAverages"`
	TotalOutages       int                  `json:"totalOutages"`
	TotalOutagesLength int                  `json:"totalOutagesLength"`
	MTTR               float64              `json:"MTTR"`
	AverageUptime      string               `json:"averageUptime"`
}

==================== Uptime (windowed) ====================

v0.7.0 BREAKING: replaces UptimeReport. Note that the server returns the top-level AverageUptime as a string ("100%") and the per-monitor AverageUptime as a number — the types here reflect that asymmetry.

type OnCallSchedule

type OnCallSchedule struct {
	UUID          string `json:"uuid"`
	Name          string `json:"name"`
	Team          string `json:"team"`
	CurrentOncall string `json:"current_oncall"`
	NextOncall    string `json:"next_oncall"`
	RotationStart string `json:"rotation_start"`
	RotationEnd   string `json:"rotation_end"`
}

type Option

type Option func(*Client)

Option is a functional option for configuring the Client.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL sets a custom base URL for the client. The URL must use HTTPS or target localhost / 127.0.0.1; any other value results in a deferred error returned on the first API call.

func WithCircuitBreakerSettings

func WithCircuitBreakerSettings(settings gobreaker.Settings) Option

WithCircuitBreakerSettings replaces the default circuit breaker configuration. Use this to tune thresholds (MaxRequests, Interval, Timeout, ReadyToTrip, etc.) for environments with different failure characteristics.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

WithHTTPClient sets a custom HTTP client.

func WithLogger

func WithLogger(logger Logger) Option

WithLogger sets a logger for HTTP request/response logging.

func WithMaxRetries

func WithMaxRetries(maxRetries int) Option

WithMaxRetries sets the maximum number of retry attempts.

func WithMetrics

func WithMetrics(metrics Metrics) Option

WithMetrics sets a metrics collector for operational observability.

func WithNoCircuitBreaker

func WithNoCircuitBreaker() Option

WithNoCircuitBreaker disables the circuit breaker for this client. Intended for use in tests to avoid the gobreaker state machine interfering with request-level assertions.

func WithRetryWait

func WithRetryWait(minWait, maxWait time.Duration) Option

WithRetryWait sets the minimum and maximum retry wait times.

func WithVersion

func WithVersion(version string) Option

WithVersion sets the version for the User-Agent header.

type Outage

type Outage struct {
	UUID               string                     `json:"uuid"`
	StartDate          string                     `json:"startDate"`
	EndDate            *string                    `json:"endDate"`            // null if ongoing
	DurationMs         int                        `json:"durationMs"`         // Duration in milliseconds
	StatusCode         int                        `json:"statusCode"`         // HTTP status code
	Description        string                     `json:"description"`        // Error message
	OutageType         string                     `json:"outageType"`         // "manual" or "automatic"
	IsResolved         bool                       `json:"isResolved"`         // Whether resolved
	DetectedLocation   string                     `json:"detectedLocation"`   // Location that detected outage
	ConfirmedLocations string                     `json:"confirmedLocations"` // Comma-separated locations
	AcknowledgedAt     *string                    `json:"acknowledgedAt"`     // ISO 8601 timestamp
	AcknowledgedBy     *AcknowledgedByUser        `json:"acknowledgedBy"`     // User who acknowledged
	Monitor            MonitorReference           `json:"monitor"`            // Associated monitor
	EscalationPolicy   *EscalationPolicyReference `json:"escalationPolicy"`   // Linked escalation policy
	Severity           string                     `json:"severity,omitempty"`
	Summary            string                     `json:"summary,omitempty"`
}

Outage represents a Hyperping outage (system-generated monitor failure). API: GET /v2/outages, GET /v2/outages/:uuid

Outages are different from Incidents: - Outages are automatically detected monitor failures (system-generated) - Incidents are manually created status page notifications (user-created)

Outage Types: - monitor: Automatically resolved when monitor recovers - manual: Must be manually resolved via API or dashboard

type OutageAPI

type OutageAPI interface {
	GetOutage(ctx context.Context, uuid string) (*Outage, error)
	ListOutages(ctx context.Context, opts ...OutageListOption) ([]Outage, error)
	CreateOutage(ctx context.Context, req CreateOutageRequest) (*Outage, error)
	AcknowledgeOutage(ctx context.Context, uuid string) (*OutageAction, error)
	UnacknowledgeOutage(ctx context.Context, uuid string) (*OutageAction, error)
	ResolveOutage(ctx context.Context, uuid string) (*OutageAction, error)
	EscalateOutage(ctx context.Context, uuid string) (*OutageAction, error)
	DeleteOutage(ctx context.Context, uuid string) error
}

OutageAPI defines the interface for outage operations. This interface enables mocking in unit tests.

type OutageAction

type OutageAction struct {
	Message string `json:"message"`
	UUID    string `json:"uuid"`
}

OutageAction represents an action performed on an outage. Used for acknowledge, resolve, escalate responses.

type OutageDetail

type OutageDetail struct {
	StartDate         string `json:"startDate"`
	EndDate           string `json:"endDate"`
	Duration          int    `json:"duration,omitempty"`          // Duration in seconds
	DurationFormatted string `json:"durationFormatted,omitempty"` // Human-readable duration
}

OutageDetail contains details about a specific outage.

type OutageEvent

type OutageEvent struct {
	Timestamp string `json:"timestamp"`
	Status    string `json:"status"` // started, acknowledged, resolved
	User      string `json:"user,omitempty"`
	Note      string `json:"note,omitempty"`
}

type OutageList

type OutageList struct {
	Outages []MCPOutage `json:"outages"`
	Total   int         `json:"total"`
}

type OutageListOption

type OutageListOption func(*outageListOptions)

OutageListOption configures a ListOutages call.

func WithStatus

func WithStatus(s string) OutageListOption

WithStatus filters the outage list by status.

Accepted values: "all", "ongoing", "resolved". An empty string (the zero value) leaves the parameter unset so the server's default applies. Validation happens inside ListOutages so that this constructor remains a pure value setter.

type OutageStats

type OutageStats struct {
	Count                  int            `json:"count"`
	TotalDowntime          int            `json:"totalDowntime"`
	TotalDowntimeFormatted string         `json:"totalDowntimeFormatted"`
	LongestOutage          int            `json:"longestOutage"`
	LongestOutageFormatted string         `json:"longestOutageFormatted"`
	Details                []OutageDetail `json:"details"`
}

OutageStats contains statistics about outages.

type OutageTimeline

type OutageTimeline struct {
	UUID        string        `json:"uuid"`
	MonitorUUID string        `json:"monitor_uuid"`
	Events      []OutageEvent `json:"events"`
}

type ProbeLog

type ProbeLog struct {
	Timestamp string `json:"timestamp"`
	Status    int    `json:"status"`
	Response  int    `json:"response"`
}

type ProbeLogResponse

type ProbeLogResponse struct {
	UUID   string     `json:"uuid"`
	Status int        `json:"status"`
	Logs   []ProbeLog `json:"logs"`
}

type ReportPeriod

type ReportPeriod struct {
	From string `json:"from"`
	To   string `json:"to"`
}

ReportPeriod represents the time period for a report.

type ReportsAPI

type ReportsAPI interface {
	GetMonitorReport(ctx context.Context, uuid string, from, to string) (*MonitorReport, error)
	ListMonitorReports(ctx context.Context, from, to string) ([]MonitorReport, error)
}

ReportsAPI defines the interface for reporting operations. This interface enables mocking in unit tests.

type RequestHeader

type RequestHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

RequestHeader represents a single HTTP header for monitor requests. API format: [{"name": "Header-Name", "value": "header-value"}]

type ResponseTimeGroup

type ResponseTimeGroup struct {
	Time            string  `json:"time"`
	AvgResponseTime float64 `json:"avgResponseTime"`
	Count           int     `json:"count"`
}

type SSOConnection added in v0.10.0

type SSOConnection struct {
	UUID           string   `json:"uuid"` // e.g., "sso_abc123xyz"
	Name           string   `json:"name"`
	Provider       string   `json:"provider"` // oidc, okta, azure, google, saml, workos
	AllowedDomains []string `json:"allowed_domains"`
	Active         bool     `json:"active"`
	// Configured is true once the identity provider settings are saved.
	Configured bool `json:"configured"`
	// OpenID Connect only (nil for other providers). Issuer is the one the
	// identity provider publishes in its discovery document, which may differ
	// from the URL that was sent (trailing slash, discovery path).
	Issuer   *string `json:"issuer"`
	ClientID *string `json:"client_id"`
	// The client secret is write-only: the API only says whether one is saved.
	HasClientSecret bool `json:"has_client_secret"`
	// RedirectURI is the callback URL to register in the identity provider.
	RedirectURI *string `json:"redirect_uri"`
	CreatedAt   *string `json:"created_at"`
	UpdatedAt   *string `json:"updated_at"`
}

SSOConnection is an identity provider that visitors of a private status page sign in with. A page uses it through StatusPageAuthenticationSettings.SSOConnectionUUID. API: GET /v2/sso-connections/{uuid}

type SSOConnectionAPI added in v0.10.0

type SSOConnectionAPI interface {
	ListSSOConnections(ctx context.Context) ([]SSOConnection, error)
	GetSSOConnection(ctx context.Context, uuid string) (*SSOConnection, error)
	CreateSSOConnection(ctx context.Context, req CreateSSOConnectionRequest) (*SSOConnection, error)
	UpdateSSOConnection(ctx context.Context, uuid string, req UpdateSSOConnectionRequest) (*SSOConnection, error)
	DeleteSSOConnection(ctx context.Context, uuid string) error
}

SSOConnectionAPI defines the interface for status-page SSO connection operations. This interface enables mocking in unit tests.

type StatusPage

type StatusPage struct {
	UUID              string              `json:"uuid"` // e.g., "sp_abc123xyz"
	Name              string              `json:"name"`
	Hostname          *string             `json:"hostname"`        // custom domain
	HostedSubdomain   string              `json:"hostedsubdomain"` // e.g., "mycompany.hyperping.app"
	URL               string              `json:"url"`             // active URL
	PasswordProtected bool                `json:"password_protected"`
	Settings          StatusPageSettings  `json:"settings"`
	Sections          []StatusPageSection `json:"sections"`
}

StatusPage represents a Hyperping status page. API: ... /v2/statuspages/{uuid}

type StatusPageAPI

type StatusPageAPI interface {
	ListStatusPages(ctx context.Context, page *int, search *string) (*StatusPagePaginatedResponse, error)
	GetStatusPage(ctx context.Context, uuid string) (*StatusPage, error)
	CreateStatusPage(ctx context.Context, req CreateStatusPageRequest) (*StatusPage, error)
	UpdateStatusPage(ctx context.Context, uuid string, req UpdateStatusPageRequest) (*StatusPage, error)
	DeleteStatusPage(ctx context.Context, uuid string) error
	ListSubscribers(ctx context.Context, uuid string, page *int, subscriberType *string) (*SubscriberPaginatedResponse, error)
	GetSubscriber(ctx context.Context, statuspageID string, subscriberID int) (*StatusPageSubscriber, error)
	AddSubscriber(ctx context.Context, uuid string, req AddSubscriberRequest) (*StatusPageSubscriber, error)
	DeleteSubscriber(ctx context.Context, uuid string, subscriberID int) error
	IterStatusPages(ctx context.Context, search *string) iter.Seq2[StatusPage, error]
}

StatusPageAPI defines the interface for status page operations. This interface enables mocking in unit tests.

type StatusPageAuthenticationSettings

type StatusPageAuthenticationSettings struct {
	PasswordProtection bool     `json:"password_protection"`
	GoogleSSO          bool     `json:"google_sso"`
	SAMLSSO            bool     `json:"saml_sso"`
	AllowedDomains     []string `json:"google_allowed_domains"`
	SSOConnectionUUID  *string  `json:"sso_connection_uuid"`
}

StatusPageAuthenticationSettings represents authentication settings for a status page.

type StatusPagePaginatedResponse

type StatusPagePaginatedResponse struct {
	StatusPages    []StatusPage `json:"statuspages"`
	HasNextPage    bool         `json:"hasNextPage"`
	Total          int          `json:"total"`
	Page           int          `json:"page"`
	ResultsPerPage int          `json:"resultsPerPage"`
}

StatusPagePaginatedResponse represents a paginated list of status pages. API: ... /v2/statuspages with pagination

type StatusPageSection

type StatusPageSection struct {
	Name     map[string]string   `json:"name"` // language -> text
	IsSplit  bool                `json:"is_split"`
	Services []StatusPageService `json:"services"`
}

StatusPageSection represents a section on a status page.

type StatusPageService

type StatusPageService struct {
	ID                *FlexibleString     `json:"id,omitempty"`
	UUID              string              `json:"uuid,omitempty"`
	Name              map[string]string   `json:"name"` // language -> text
	IsGroup           bool                `json:"is_group"`
	Type              string              `json:"type,omitempty"` // monitor, healthcheck, server or component; empty for a group header (read-only)
	ShowUptime        bool                `json:"show_uptime"`
	ShowResponseTimes bool                `json:"show_response_times"`
	Description       map[string]string   `json:"description,omitempty"`
	Services          []StatusPageService `json:"services,omitempty"` // nested services if is_group
}

StatusPageService represents a service (monitor or component) in a section. The ID field uses *FlexibleString because the Hyperping v2 API returns different types depending on how the service was created:

  • a string UUID (e.g. "mon_abc123") when set via v2 API with UUID strings
  • an integer (e.g. 117122) when set via v1 admin UI or numeric ID workaround
  • absent entirely for group header entries (which have no top-level monitor)

FlexibleString handles both string and numeric JSON values via UnmarshalJSON.

type StatusPageSettings

type StatusPageSettings struct {
	Name                  string                           `json:"name"`
	Website               string                           `json:"website,omitempty"`
	Description           map[string]string                `json:"description,omitempty"` // language -> text
	Languages             []string                         `json:"languages"`
	DefaultLanguage       string                           `json:"default_language"`
	Theme                 string                           `json:"theme"` // light, dark, system
	Font                  string                           `json:"font"`
	AccentColor           string                           `json:"accent_color"` // hex color
	AutoRefresh           bool                             `json:"auto_refresh"`
	BannerHeader          bool                             `json:"banner_header"`
	LogoHeight            string                           `json:"logo_height"`
	Favicon               *string                          `json:"favicon"`
	HidePoweredBy         bool                             `json:"hide_powered_by"`
	HideFromSearchEngines bool                             `json:"hide_from_search_engines"`
	GoogleAnalytics       *string                          `json:"google_analytics"`
	Subscribe             StatusPageSubscribeSettings      `json:"subscribe"`
	Authentication        StatusPageAuthenticationSettings `json:"authentication"`
}

StatusPageSettings represents the settings for a status page.

type StatusPageSubscribeSettings

type StatusPageSubscribeSettings struct {
	Enabled bool `json:"enabled"`
	Email   bool `json:"email"`
	Slack   bool `json:"slack"`
	Teams   bool `json:"teams"`
	SMS     bool `json:"sms"`
}

StatusPageSubscribeSettings represents subscription settings for a status page.

type StatusPageSubscriber

type StatusPageSubscriber struct {
	ID           int     `json:"id"`
	Type         string  `json:"type"` // email, sms, slack, teams
	Value        string  `json:"value"`
	Language     string  `json:"language"` // ISO 639-1 language code
	Email        *string `json:"email"`
	Phone        *string `json:"phone"`
	SlackChannel *string `json:"slack_channel"`
	CreatedAt    string  `json:"created_at"` // ISO 8601 timestamp
}

StatusPageSubscriber represents a subscriber to a status page. API: ... /v2/statuspages/{uuid}/subscribers

type StatusSummary

type StatusSummary struct {
	Total          int      `json:"total"`
	Up             int      `json:"up"`
	Down           int      `json:"down"`
	Paused         int      `json:"paused"`
	Unknown        int      `json:"unknown"`
	DownMonitors   []string `json:"down_monitors"`
	PausedMonitors []string `json:"paused_monitors"`
}

StatusSummary mirrors the get_status_summary response shape probed against /v1/mcp tools/call on 2026-06-09. The pre-v0.7.1 struct declared only Total/Up/Down; Paused, Unknown, DownMonitors, and PausedMonitors were silently dropped at decode time because the fields did not exist on the Go type. Adding them is a wire-level additive change but counts as a feature surface change against the pre-v0.7.1 SDK because consumers now see them on the response.

type SubscriberPaginatedResponse

type SubscriberPaginatedResponse struct {
	Subscribers    []StatusPageSubscriber `json:"subscribers"`
	HasNextPage    bool                   `json:"hasNextPage"`
	Total          int                    `json:"total"`
	Page           int                    `json:"page"`
	ResultsPerPage int                    `json:"resultsPerPage"`
}

SubscriberPaginatedResponse represents a paginated list of subscribers. API: ... /v2/statuspages/{uuid}/subscribers with pagination

type TeamMember

type TeamMember struct {
	UUID              string  `json:"uuid"`
	Email             string  `json:"email"`
	Name              string  `json:"name"`
	Phone             string  `json:"phone,omitempty"`
	ProfilePictureURL string  `json:"profilePictureUrl,omitempty"`
	SsoPictureURL     *string `json:"ssoPictureUrl"`
	AccountRole       string  `json:"accountRole"`
}

==================== Team Models ====================

v0.7.1 BREAKING: replaces the pre-v0.7.1 TeamMember{Role,Status} declaration. The server returns accountRole (not role), no status field at all, plus phone/profilePictureUrl/ssoPictureUrl that were silently dropped at decode time. SsoPictureUrl is *string because the server returns JSON null for members who never signed in via SSO; differentiating "no SSO photo" from "" lets consumers render a placeholder accurately. Probed against /v1/mcp tools/call list_team_members on 2026-06-09.

type TransportOption

type TransportOption func(*McpTransport)

TransportOption configures McpTransport

func WithMCPHTTPClient

func WithMCPHTTPClient(h *http.Client) TransportOption

WithMCPHTTPClient sets a custom HTTP client

func WithMCPMaxRetries

func WithMCPMaxRetries(n int) TransportOption

WithMCPMaxRetries sets the maximum retry attempts

func WithMCPTimeout

func WithMCPTimeout(d time.Duration) TransportOption

WithMCPTimeout sets the request timeout

type UpdateHealthcheckRequest

type UpdateHealthcheckRequest struct {
	Name             *string `json:"name,omitempty"`
	Cron             *string `json:"cron,omitempty"`
	Timezone         *string `json:"timezone,omitempty"`
	PeriodValue      *int    `json:"period_value,omitempty"`
	PeriodType       *string `json:"period_type,omitempty"`
	GracePeriodValue *int    `json:"grace_period_value,omitempty"`
	GracePeriodType  *string `json:"grace_period_type,omitempty"`
	EscalationPolicy *string `json:"escalation_policy,omitempty"`
}

UpdateHealthcheckRequest represents a request to update a healthcheck. API: PUT /v2/healthchecks/{uuid} Note: API accepts snake_case in requests but returns camelCase in responses

type UpdateIncidentRequest

type UpdateIncidentRequest struct {
	Title              *LocalizedText             `json:"title,omitempty"`
	Text               *LocalizedText             `json:"text,omitempty"`
	Type               *string                    `json:"type,omitempty"`
	AffectedComponents *[]string                  `json:"affectedComponents,omitempty"`
	StatusPages        *[]string                  `json:"statuspages,omitempty"`
	Updates            []AddIncidentUpdateRequest `json:"updates,omitempty"`
}

UpdateIncidentRequest represents a request to update an incident. API: PUT /v3/incidents/{uuid}

type UpdateMaintenanceRequest

type UpdateMaintenanceRequest struct {
	Name                *string        `json:"name,omitempty"`
	Title               *LocalizedText `json:"title,omitempty"`
	Text                *LocalizedText `json:"text,omitempty"`
	StartDate           *string        `json:"start_date,omitempty"`
	EndDate             *string        `json:"end_date,omitempty"`
	Monitors            *[]string      `json:"monitors,omitempty"`
	StatusPages         *[]string      `json:"statuspages,omitempty"`
	NotificationOption  *string        `json:"notificationOption,omitempty"`
	NotificationMinutes *int           `json:"notificationMinutes,omitempty"`
}

UpdateMaintenanceRequest represents a request to update a maintenance window. API: PUT /v1/maintenance-windows/{uuid}

type UpdateMonitorRequest

type UpdateMonitorRequest struct {
	Name               *string          `json:"name,omitempty"`
	URL                *string          `json:"url,omitempty"`
	Protocol           *string          `json:"protocol,omitempty"`
	ProjectUUID        *string          `json:"projectUuid,omitempty"`
	HTTPMethod         *string          `json:"http_method,omitempty"`
	CheckFrequency     *int             `json:"check_frequency,omitempty"`
	Regions            *[]string        `json:"regions,omitempty"`
	RequestHeaders     *[]RequestHeader `json:"request_headers,omitempty"`
	RequestBody        *string          `json:"request_body,omitempty"`
	FollowRedirects    *bool            `json:"follow_redirects,omitempty"`
	ExpectedStatusCode *string          `json:"expected_status_code,omitempty"`
	RequiredKeyword    *string          `json:"required_keyword,omitempty"`
	Paused             *bool            `json:"paused,omitempty"`
	Port               *int             `json:"port,omitempty"`
	AlertsWait         *int             `json:"alerts_wait,omitempty"`
	EscalationPolicy   *string          `json:"escalation_policy,omitempty"`
	DNSRecordType      *string          `json:"dns_record_type,omitempty"`
	DNSNameserver      *string          `json:"dns_nameserver,omitempty"`
	DNSExpectedAnswer  *string          `json:"dns_expected_answer,omitempty"`
	IPVersion          *int             `json:"ip_version,omitempty"`
	SSLAlertDays       *int             `json:"ssl_alert_days,omitempty"`
	SSLReminders       *bool            `json:"ssl_reminders,omitempty"`
	SSLNotifyOnChange  *bool            `json:"ssl_notify_on_change,omitempty"`
	DomainAlertDays    *int             `json:"domain_alert_days,omitempty"`
}

UpdateMonitorRequest represents a request to update a monitor. API: PUT /v1/monitors/{uuid}

type UpdateSSOConnectionRequest added in v0.10.0

type UpdateSSOConnectionRequest struct {
	Name           *string   `json:"name,omitempty"`
	Issuer         *string   `json:"issuer,omitempty"`
	ClientID       *string   `json:"client_id,omitempty"`
	ClientSecret   *string   `json:"client_secret,omitempty"` //nolint:gosec // G117: sent to the API, never returned or logged
	AllowedDomains *[]string `json:"allowed_domains,omitempty"`
}

UpdateSSOConnectionRequest changes an OpenID Connect connection. Only the fields set are sent. Sending the identity provider settings already saved changes nothing; new ones are checked against the identity provider first, and a new ClientID needs its ClientSecret. API: PUT /v2/sso-connections/{uuid}

func (UpdateSSOConnectionRequest) String added in v0.10.0

String never prints the client secret.

func (UpdateSSOConnectionRequest) Validate added in v0.10.0

func (r UpdateSSOConnectionRequest) Validate() error

Validate checks input lengths on UpdateSSOConnectionRequest fields.

type UpdateStatusPageRequest

type UpdateStatusPageRequest struct {
	Name      *string `json:"name,omitempty"`
	Subdomain *string `json:"subdomain,omitempty"`
	Hostname  *string `json:"hostname,omitempty"`
	Website   *string `json:"website,omitempty"`
	// Description is a plain string on write; the API returns a localized map on read.
	Description           *string                                 `json:"description,omitempty"`
	Languages             []string                                `json:"languages,omitempty"`
	DefaultLanguage       *string                                 `json:"default_language,omitempty"`
	Theme                 *string                                 `json:"theme,omitempty"`
	Font                  *string                                 `json:"font,omitempty"`
	AccentColor           *string                                 `json:"accent_color,omitempty"`
	AutoRefresh           *bool                                   `json:"auto_refresh,omitempty"`
	BannerHeader          *bool                                   `json:"banner_header,omitempty"`
	LogoHeight            *string                                 `json:"logo_height,omitempty"`
	Favicon               *string                                 `json:"favicon,omitempty"`
	HidePoweredBy         *bool                                   `json:"hide_powered_by,omitempty"`
	HideFromSearchEngines *bool                                   `json:"hide_from_search_engines,omitempty"`
	GoogleAnalytics       *string                                 `json:"google_analytics,omitempty"`
	Password              *string                                 `json:"password,omitempty"` //nolint:gosec // G117: status page access-control field, not a stored credential
	Subscribe             *CreateStatusPageSubscribeSettings      `json:"subscribe,omitempty"`
	Authentication        *CreateStatusPageAuthenticationSettings `json:"authentication,omitempty"`
	Sections              []CreateStatusPageSection               `json:"sections,omitempty"`
}

UpdateStatusPageRequest represents a request to update a status page. API: ... /v2/statuspages/{uuid}

type UptimePeriod

type UptimePeriod struct {
	Date   string  `json:"date"`
	Uptime float64 `json:"uptime"`
}

type ValidationDetail

type ValidationDetail struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

ValidationDetail represents a field-level validation error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址