From 310824ff4f0dcb09df7aa268d0f7ca9cbacc6485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Wed, 4 Nov 2026 19:04:18 +0100 Subject: [PATCH] feat(monitor): status pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nrc monitor status-pages list, get, create, update, delete, publish, unpublish and preview-link; layout get and set; incidents list, get, create and update; incidents updates create. Pages are named by id or exact slug. Create fills in no settings. Writes that go public say so. Regenerates the Norcube Monitor client from the status pages API, which adds the monitor.statuspages scope. Signed-off-by: Jan Švábík --- CHANGELOG.md | 21 + docs/DESIGN.md | 11 +- internal/api/monitor/monitor.gen.go | 10254 +++++++++++----- internal/cli/monitor/cmd.go | 13 +- internal/cli/monitor/completion.go | 71 +- internal/cli/monitor/format.go | 127 + internal/cli/monitor/resolve.go | 62 + internal/cli/monitor/statuspage_incidents.go | 554 + internal/cli/monitor/statuspages.go | 592 + internal/cli/monitor_test.go | 388 + .../cli/testdata/golden/commands-monitor.json | 1016 +- .../golden/monitor-status-pages-get.json | 20 + .../golden/monitor-status-pages-get.tsv | 1 + .../golden/monitor-status-pages-get.txt | 16 + .../golden/monitor-status-pages-get.yaml | 17 + .../monitor-status-pages-incidents-get.json | 27 + .../monitor-status-pages-incidents-get.tsv | 1 + .../monitor-status-pages-incidents-get.txt | 10 + .../monitor-status-pages-incidents-get.yaml | 18 + .../monitor-status-pages-incidents-list.json | 29 + .../monitor-status-pages-incidents-list.tsv | 1 + .../monitor-status-pages-incidents-list.txt | 2 + .../monitor-status-pages-incidents-list.yaml | 18 + .../monitor-status-pages-layout-get.json | 29 + .../monitor-status-pages-layout-get.tsv | 1 + .../monitor-status-pages-layout-get.txt | 2 + .../monitor-status-pages-layout-get.yaml | 17 + .../golden/monitor-status-pages-list.json | 41 + .../golden/monitor-status-pages-list.tsv | 2 + .../golden/monitor-status-pages-list.txt | 3 + .../golden/monitor-status-pages-list.yaml | 33 + specs/monitor.openapi.json | 4328 +++++-- 32 files changed, 13374 insertions(+), 4351 deletions(-) create mode 100644 internal/cli/monitor/statuspage_incidents.go create mode 100644 internal/cli/monitor/statuspages.go create mode 100644 internal/cli/testdata/golden/monitor-status-pages-get.json create mode 100644 internal/cli/testdata/golden/monitor-status-pages-get.tsv create mode 100644 internal/cli/testdata/golden/monitor-status-pages-get.txt create mode 100644 internal/cli/testdata/golden/monitor-status-pages-get.yaml create mode 100644 internal/cli/testdata/golden/monitor-status-pages-incidents-get.json create mode 100644 internal/cli/testdata/golden/monitor-status-pages-incidents-get.tsv create mode 100644 internal/cli/testdata/golden/monitor-status-pages-incidents-get.txt create mode 100644 internal/cli/testdata/golden/monitor-status-pages-incidents-get.yaml create mode 100644 internal/cli/testdata/golden/monitor-status-pages-incidents-list.json create mode 100644 internal/cli/testdata/golden/monitor-status-pages-incidents-list.tsv create mode 100644 internal/cli/testdata/golden/monitor-status-pages-incidents-list.txt create mode 100644 internal/cli/testdata/golden/monitor-status-pages-incidents-list.yaml create mode 100644 internal/cli/testdata/golden/monitor-status-pages-layout-get.json create mode 100644 internal/cli/testdata/golden/monitor-status-pages-layout-get.tsv create mode 100644 internal/cli/testdata/golden/monitor-status-pages-layout-get.txt create mode 100644 internal/cli/testdata/golden/monitor-status-pages-layout-get.yaml create mode 100644 internal/cli/testdata/golden/monitor-status-pages-list.json create mode 100644 internal/cli/testdata/golden/monitor-status-pages-list.tsv create mode 100644 internal/cli/testdata/golden/monitor-status-pages-list.txt create mode 100644 internal/cli/testdata/golden/monitor-status-pages-list.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d2ed45..410fd87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,27 @@ Notable changes, newest first. Release notes on GitHub list every commit; this file collects what users and scripts need to know. +## Unreleased + +### New + +- Norcube Monitor status pages: `monitor status-pages list | get | create | + update | delete | publish | unpublish | preview-link`, with pages named by + id or exact slug. + - `create` takes every setting as a flag and fills in none of them. + - `layout get | set --file` (`-` reads standard input); `set` prints the + saved layout, and `get -o json` prints the document `set` takes. + - `incidents list | get | create | update` and `incidents updates create` + post incidents and updates. Writes print the public address of the post, + or say the page isn't published. `--component` takes a component's id or + exact public name. + - Changes to a published page and posts on it are public within a minute; + the help of those commands says so. + - Completion for page slugs and for a page's posted incidents. + - CI tokens change status pages only with the new `monitor.statuspages` + scope, which no other scope includes. Any Norcube Monitor scope reads + them. + ## 0.22.0 (2026-11-04) ### New diff --git a/docs/DESIGN.md b/docs/DESIGN.md index ea4356c..d67e851 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -116,6 +116,8 @@ meaning across the tree: | `acknowledge` | Mark something as being handled without changing it otherwise | `monitor incidents acknowledge` (alias `ack`) | | `verify` | Confirm a contact with a code sent to it | `monitor channels verify` | | `summary` | Counts over a whole resource, not a list | `monitor incidents summary` | +| `publish` / `unpublish` | Make a thing public, or take it offline keeping everything on it | `monitor status-pages publish` | +| `preview-link` | Print a short-lived link to see a thing as the public would | `monitor status-pages preview-link` | | `cancel`, `watch`, `results`, `status`, `check`, `generate`, `import`, `set`, `revoke`, `use` | As named | `domainradar bulk watch`, `langsync terms import status` | `rm` is an alias of `remove` only, never of `delete`. @@ -726,7 +728,7 @@ flag; [CHANGELOG.md](../CHANGELOG.md) says when each arrived. | `langsync` | `init`, `sync`, `pull`; `namespaces list | create | update | delete`; `terms list | add | update | delete | import`, `terms import status`; `translations get | set | suggest | translate-missing`; `languages list | add | remove | create | delete`; `prompts list | get | create | update | delete`; `glossary get`, `glossary items list | get | create | translate | delete`, `glossary languages attach`; `api-keys list | create | revoke`; `audit list` | | `domainradar` | `check`; `bulk create | list | get | results | watch | export | cancel | delete`; `saved list | add | remove`; `watchers list | get | create | update | delete`; `hits list | get`; `names generate | list | get | results | check | delete` | | `billing` | `status`; `subscriptions list`; `usage estimate | metrics`; `invoices list | download`; `budget get | set` | -| `monitor` | `status` (`--fail-on`); `monitors list | get | create | update | delete | pause | resume | run` (`--wait`), `monitors bulk pause | resume | delete`, `monitors results list`, `monitors status-changes list`, `monitors stats get`, `monitors availability get`, `monitors certificate get`, `monitors alerts get | set`; `incidents list | get | acknowledge | summary`; `channels list | get | create | update | delete | test | verify`, `channels deliveries list` | +| `monitor` | `status` (`--fail-on`); `monitors list | get | create | update | delete | pause | resume | run` (`--wait`), `monitors bulk pause | resume | delete`, `monitors results list`, `monitors status-changes list`, `monitors stats get`, `monitors availability get`, `monitors certificate get`, `monitors alerts get | set`; `incidents list | get | acknowledge | summary`; `channels list | get | create | update | delete | test | verify`, `channels deliveries list`; `status-pages list | get | create | update | delete | publish | unpublish | preview-link`, `status-pages layout get | set`, `status-pages incidents list | get | create | update`, `status-pages incidents updates create` | | PromptHub | No command group; `nrc api prompthub ...` | | CMS | None (CMS has no public API) | @@ -738,7 +740,9 @@ now), `backup.verify` (restore tests), `domainradar.check`, monitor's check now), `monitor.write` (manage monitors, alert routing, acknowledge incidents), `monitor.channels` (manage alert channels, test sends and verification codes; not included in `monitor.write`, because -channels hold credentials and sends cost money). +channels hold credentials and sends cost money), `monitor.statuspages` (manage status pages and post +incidents on them; not included in any other scope, because everything it +changes is public). Installation channels: Homebrew cask (with `nrc`), `.deb` / `.rpm` / `.apk`, `install.sh`, release archives (darwin and linux amd64/arm64, @@ -784,6 +788,7 @@ changelog, and the owner's decisions in the planning sessions of | 2026-10-30 | Pin the Go toolchain, check `go mod tidy`, run govulncheck in CI with documented acceptances | Releases had been built with a Go patch with reachable stdlib advisories | 3b2e964 (v0.21.4) | | 2026-10-30 | Engineering reviews are written down as reports and fixed in separate, deliberate changes, not by automatic fix agents | Owner's instruction | owner | | 2026-11-04 | Norcube Monitor in the CLI. Monitors and channels are named by id or exact name (a name matching several is a usage error, never a guess); sub-resources of a monitor are nested resources with standard verbs (`monitors results list`, `monitors stats get`) rather than new verbs; `monitors run --wait` makes the synchronous check's verdict the exit code (`job_failed` on critical or inconclusive, `--fail-on warning`); `monitor status --fail-on` exits 1 with the new code `unhealthy` and prints the report either way (default `none`); bulk actions are their own subgroup (`monitors bulk ...`) so one command's output shape never depends on how many ids it got; a webhook's signing secret is written to `--secret-file` and never printed, Slack and Discord URLs and secret headers come from files or stdin; `output.Object.Text` keeps `-o text` columns fixed for objects whose fields depend on the resource; RFC 9457 problems (`code`, `reason`, `errors`) are parsed by the shared error formatter. No short alias: no product has an abbreviation, and P13 asks for one name. Alert channels get their own scope (`monitor.channels`), granted explicitly and not implied by `monitor.write` (owner: "everything should be well scoped") | Owner's brief: every Norcube Monitor operation, robust, scriptable. Rejected: `--wait` polling a check that is already synchronous; printing the webhook secret once like a CI token (the owner asked that webhook secrets never be printed); `monitors pause a b c` switching to the bulk endpoint and its shape with two or more ids | owner | +| 2026-11-04 | Status pages in the CLI. Pages are named by id or exact slug; a page's posted incidents are a nested resource (`status-pages incidents`), and an update on one is `status-pages incidents updates create` rather than a new verb, by the rule of the Norcube Monitor entry above. `create` marks every setting required and fills in none: a page is public communication, and the backend has no defaults either. `layout set` refuses a document without both lists, since it replaces the layout as a whole. `unpublish` confirms (old addresses are given up); `publish` and posting don't, so an incident pipeline stays one command, and their help says they go public. `preview-link` is a `read`: it changes nothing, though the API asks for `monitor.statuspages` | Owner's brief. Rejected: `incidents post`, a synonym for creating an update; the dashboard's defaults on `create`, as `monitors create` has, because a required setting on a public page should be a choice | owner | | 2026-11-04 | `nrc commands`: the whole command tree as one versioned, offline document; what the tree cannot reveal is declared with annotations (`effect`, flag enums, service), never inferred from verbs | Agents should not crawl dozens of `--help` pages. Prior art: `kubectl api-resources` / `explain` (verbs per resource, offline schema), `aws ... --generate-cli-skeleton` (machine-readable input), cobra's doc generation (`tools/gendocs` already walks the tree). Global flags listed once rather than on every command, to keep the document small; a verb-based guess of the effect was rejected because domain verbs like `check`, `suggest` or `init` don't say whether they change anything | owner | | 2026-11-04 | PulseCheck is renamed Norcube Monitor before its first release, every technical name included: command group `monitor` (`nrc monitor monitors list`), registry key, OAuth audience and generated package `monitor`, scopes `monitor.read`, `monitor.check`, `monitor.write`, `monitor.channels`, endpoint `https://monitor.api.norcube.com/app/v1`, `NORCUBE_MONITOR_URL`. No `pulsecheck` alias or `cmdutil.Renamed` entry | The old name was never in a release, so no script, config file or token depends on it and P10 has nothing to keep; the backend renamed its service, audience and scopes in the same change. Rejected: keeping `pulsecheck` as a hidden alias, which would be a second name for one thing (P13) with no user to serve | owner | @@ -861,7 +866,7 @@ it with the same guarantees as every other product. The steps, in order: | Step | State | | --- | --- | | 1 Audience | `monitor` exists in Norcube Auth (sign-in audience list, CI token exchange) | -| 2 Scopes | `monitor.read`, `monitor.check`, `monitor.write`, `monitor.channels` in the CI token catalog (and so the CLI sign-in catalog), with IAM actions; channel changes and sends only with `monitor.channels`, which `monitor.write` doesn't include; not on the MCP consent screen until the MCP redesign | +| 2 Scopes | `monitor.read`, `monitor.check`, `monitor.write`, `monitor.channels`, `monitor.statuspages` in the CI token catalog (and so the CLI sign-in catalog), with IAM actions; channel changes and sends only with `monitor.channels`, status page changes and posts only with `monitor.statuspages`, neither of which `monitor.write` includes; not on the MCP consent screen until the MCP redesign | | 3 Enforcement | Default-closed route table (`internal/routers/app/scopes.go`) after the token middleware, coverage and matrix tests, and IAM refusing a scoped request the table never checked | | 4 Contract | Every operation has a verb-noun `@Id`, `@Security Bearer`, 401/403 problems and `x-norcube-scopes`; the status route is tagged `Status` and excluded here | | 5 to 10 CLI | Registry entry, hand-kept tables, client, `nrc monitor` commands, completion, command and golden tests | diff --git a/internal/api/monitor/monitor.gen.go b/internal/api/monitor/monitor.gen.go index 082eaa3..8a8f54d 100644 --- a/internal/api/monitor/monitor.gen.go +++ b/internal/api/monitor/monitor.gen.go @@ -85,10 +85,13 @@ const ( ErrorReasonCodeRecentlySent ConstantsErrorReason = "CODE_RECENTLY_SENT" ErrorReasonContactUnverified ConstantsErrorReason = "CONTACT_UNVERIFIED" ErrorReasonDeliveryRejected ConstantsErrorReason = "DELIVERY_REJECTED" + ErrorReasonIncidentResolved ConstantsErrorReason = "INCIDENT_RESOLVED" ErrorReasonInsufficientScope ConstantsErrorReason = "INSUFFICIENT_SCOPE" ErrorReasonMissingOrganizationID ConstantsErrorReason = "MISSING_ORGANIZATION_ID" ErrorReasonMonitorLimit ConstantsErrorReason = "MONITOR_LIMIT" ErrorReasonNothingToVerify ConstantsErrorReason = "NOTHING_TO_VERIFY" + ErrorReasonSlugTaken ConstantsErrorReason = "SLUG_TAKEN" + ErrorReasonStatusPageLimit ConstantsErrorReason = "STATUS_PAGE_LIMIT" ErrorReasonTooManyAttempts ConstantsErrorReason = "TOO_MANY_ATTEMPTS" ErrorReasonUnverifiedChannelLimit ConstantsErrorReason = "UNVERIFIED_CHANNEL_LIMIT" ) @@ -112,6 +115,8 @@ func (e ConstantsErrorReason) Valid() bool { return true case ErrorReasonDeliveryRejected: return true + case ErrorReasonIncidentResolved: + return true case ErrorReasonInsufficientScope: return true case ErrorReasonMissingOrganizationID: @@ -120,6 +125,10 @@ func (e ConstantsErrorReason) Valid() bool { return true case ErrorReasonNothingToVerify: return true + case ErrorReasonSlugTaken: + return true + case ErrorReasonStatusPageLimit: + return true case ErrorReasonTooManyAttempts: return true case ErrorReasonUnverifiedChannelLimit: @@ -1092,368 +1101,890 @@ func (e DtoMonitorStatsGranularity) Valid() bool { } } -// Defines values for DtoStatusChangeFrom. +// Defines values for DtoPublicStatusAffectedStatus. const ( - DtoStatusChangeFromCritical DtoStatusChangeFrom = "critical" - DtoStatusChangeFromOk DtoStatusChangeFrom = "ok" - DtoStatusChangeFromPending DtoStatusChangeFrom = "pending" - DtoStatusChangeFromWarning DtoStatusChangeFrom = "warning" + DtoPublicStatusAffectedStatusDegradedPerformance DtoPublicStatusAffectedStatus = "degraded_performance" + DtoPublicStatusAffectedStatusMajorOutage DtoPublicStatusAffectedStatus = "major_outage" + DtoPublicStatusAffectedStatusOperational DtoPublicStatusAffectedStatus = "operational" + DtoPublicStatusAffectedStatusPartialOutage DtoPublicStatusAffectedStatus = "partial_outage" ) -// Valid indicates whether the value is a known member of the DtoStatusChangeFrom enum. -func (e DtoStatusChangeFrom) Valid() bool { +// Valid indicates whether the value is a known member of the DtoPublicStatusAffectedStatus enum. +func (e DtoPublicStatusAffectedStatus) Valid() bool { switch e { - case DtoStatusChangeFromCritical: + case DtoPublicStatusAffectedStatusDegradedPerformance: return true - case DtoStatusChangeFromOk: + case DtoPublicStatusAffectedStatusMajorOutage: return true - case DtoStatusChangeFromPending: + case DtoPublicStatusAffectedStatusOperational: return true - case DtoStatusChangeFromWarning: + case DtoPublicStatusAffectedStatusPartialOutage: return true default: return false } } -// Defines values for DtoStatusChangeTo. +// Defines values for DtoPublicStatusComponentStatus. const ( - DtoStatusChangeToCritical DtoStatusChangeTo = "critical" - DtoStatusChangeToOk DtoStatusChangeTo = "ok" - DtoStatusChangeToWarning DtoStatusChangeTo = "warning" + DtoPublicStatusComponentStatusDegradedPerformance DtoPublicStatusComponentStatus = "degraded_performance" + DtoPublicStatusComponentStatusMajorOutage DtoPublicStatusComponentStatus = "major_outage" + DtoPublicStatusComponentStatusOperational DtoPublicStatusComponentStatus = "operational" + DtoPublicStatusComponentStatusPartialOutage DtoPublicStatusComponentStatus = "partial_outage" + DtoPublicStatusComponentStatusUnknown DtoPublicStatusComponentStatus = "unknown" ) -// Valid indicates whether the value is a known member of the DtoStatusChangeTo enum. -func (e DtoStatusChangeTo) Valid() bool { +// Valid indicates whether the value is a known member of the DtoPublicStatusComponentStatus enum. +func (e DtoPublicStatusComponentStatus) Valid() bool { switch e { - case DtoStatusChangeToCritical: + case DtoPublicStatusComponentStatusDegradedPerformance: return true - case DtoStatusChangeToOk: + case DtoPublicStatusComponentStatusMajorOutage: return true - case DtoStatusChangeToWarning: + case DtoPublicStatusComponentStatusOperational: + return true + case DtoPublicStatusComponentStatusPartialOutage: + return true + case DtoPublicStatusComponentStatusUnknown: return true default: return false } } -// Defines values for ValidationRule. +// Defines values for DtoPublicStatusDayGrade. const ( - RuleDependsOn ValidationRule = "dependsOn" - RuleDuplicate ValidationRule = "duplicate" - RuleExclusive ValidationRule = "exclusive" - RuleFormat ValidationRule = "format" - RuleImmutable ValidationRule = "immutable" - RuleMax ValidationRule = "max" - RuleMaxItems ValidationRule = "maxItems" - RuleMaxLength ValidationRule = "maxLength" - RuleMin ValidationRule = "min" - RuleMismatch ValidationRule = "mismatch" - RuleNotAllowed ValidationRule = "notAllowed" - RuleOneOf ValidationRule = "oneOf" - RulePublic ValidationRule = "public" - RuleRange ValidationRule = "range" - RuleReference ValidationRule = "reference" - RuleRequired ValidationRule = "required" - RuleType ValidationRule = "type" - RuleUnique ValidationRule = "unique" - RuleUnknown ValidationRule = "unknown" - RuleUnsupported ValidationRule = "unsupported" - RuleUnverified ValidationRule = "unverified" + DtoPublicStatusDayGradeMajor DtoPublicStatusDayGrade = "major" + DtoPublicStatusDayGradeMinor DtoPublicStatusDayGrade = "minor" + DtoPublicStatusDayGradeNoData DtoPublicStatusDayGrade = "no_data" + DtoPublicStatusDayGradeOk DtoPublicStatusDayGrade = "ok" + DtoPublicStatusDayGradePartial DtoPublicStatusDayGrade = "partial" + DtoPublicStatusDayGradeUnknown DtoPublicStatusDayGrade = "unknown" + DtoPublicStatusDayGradeWarning DtoPublicStatusDayGrade = "warning" ) -// Valid indicates whether the value is a known member of the ValidationRule enum. -func (e ValidationRule) Valid() bool { +// Valid indicates whether the value is a known member of the DtoPublicStatusDayGrade enum. +func (e DtoPublicStatusDayGrade) Valid() bool { switch e { - case RuleDependsOn: - return true - case RuleDuplicate: + case DtoPublicStatusDayGradeMajor: return true - case RuleExclusive: + case DtoPublicStatusDayGradeMinor: return true - case RuleFormat: + case DtoPublicStatusDayGradeNoData: return true - case RuleImmutable: + case DtoPublicStatusDayGradeOk: return true - case RuleMax: + case DtoPublicStatusDayGradePartial: return true - case RuleMaxItems: + case DtoPublicStatusDayGradeUnknown: return true - case RuleMaxLength: + case DtoPublicStatusDayGradeWarning: return true - case RuleMin: + default: + return false + } +} + +// Defines values for DtoPublicStatusGroupStatus. +const ( + DtoPublicStatusGroupStatusDegradedPerformance DtoPublicStatusGroupStatus = "degraded_performance" + DtoPublicStatusGroupStatusMajorOutage DtoPublicStatusGroupStatus = "major_outage" + DtoPublicStatusGroupStatusOperational DtoPublicStatusGroupStatus = "operational" + DtoPublicStatusGroupStatusPartialOutage DtoPublicStatusGroupStatus = "partial_outage" + DtoPublicStatusGroupStatusUnknown DtoPublicStatusGroupStatus = "unknown" +) + +// Valid indicates whether the value is a known member of the DtoPublicStatusGroupStatus enum. +func (e DtoPublicStatusGroupStatus) Valid() bool { + switch e { + case DtoPublicStatusGroupStatusDegradedPerformance: return true - case RuleMismatch: + case DtoPublicStatusGroupStatusMajorOutage: return true - case RuleNotAllowed: + case DtoPublicStatusGroupStatusOperational: return true - case RuleOneOf: + case DtoPublicStatusGroupStatusPartialOutage: return true - case RulePublic: + case DtoPublicStatusGroupStatusUnknown: return true - case RuleRange: + default: + return false + } +} + +// Defines values for DtoPublicStatusIncidentImpact. +const ( + DtoPublicStatusIncidentImpactCritical DtoPublicStatusIncidentImpact = "critical" + DtoPublicStatusIncidentImpactMajor DtoPublicStatusIncidentImpact = "major" + DtoPublicStatusIncidentImpactMinor DtoPublicStatusIncidentImpact = "minor" + DtoPublicStatusIncidentImpactNone DtoPublicStatusIncidentImpact = "none" +) + +// Valid indicates whether the value is a known member of the DtoPublicStatusIncidentImpact enum. +func (e DtoPublicStatusIncidentImpact) Valid() bool { + switch e { + case DtoPublicStatusIncidentImpactCritical: return true - case RuleReference: + case DtoPublicStatusIncidentImpactMajor: return true - case RuleRequired: + case DtoPublicStatusIncidentImpactMinor: return true - case RuleType: + case DtoPublicStatusIncidentImpactNone: return true - case RuleUnique: + default: + return false + } +} + +// Defines values for DtoPublicStatusIncidentStatus. +const ( + DtoPublicStatusIncidentStatusIdentified DtoPublicStatusIncidentStatus = "identified" + DtoPublicStatusIncidentStatusInvestigating DtoPublicStatusIncidentStatus = "investigating" + DtoPublicStatusIncidentStatusMonitoring DtoPublicStatusIncidentStatus = "monitoring" + DtoPublicStatusIncidentStatusResolved DtoPublicStatusIncidentStatus = "resolved" +) + +// Valid indicates whether the value is a known member of the DtoPublicStatusIncidentStatus enum. +func (e DtoPublicStatusIncidentStatus) Valid() bool { + switch e { + case DtoPublicStatusIncidentStatusIdentified: return true - case RuleUnknown: + case DtoPublicStatusIncidentStatusInvestigating: return true - case RuleUnsupported: + case DtoPublicStatusIncidentStatusMonitoring: return true - case RuleUnverified: + case DtoPublicStatusIncidentStatusResolved: return true default: return false } } -// Defines values for ValidationUnit. +// Defines values for DtoPublicStatusPageIndicator. const ( - UnitBytes ValidationUnit = "bytes" - UnitCharacters ValidationUnit = "characters" + DtoPublicStatusPageIndicatorCritical DtoPublicStatusPageIndicator = "critical" + DtoPublicStatusPageIndicatorMajor DtoPublicStatusPageIndicator = "major" + DtoPublicStatusPageIndicatorMinor DtoPublicStatusPageIndicator = "minor" + DtoPublicStatusPageIndicatorNone DtoPublicStatusPageIndicator = "none" ) -// Valid indicates whether the value is a known member of the ValidationUnit enum. -func (e ValidationUnit) Valid() bool { +// Valid indicates whether the value is a known member of the DtoPublicStatusPageIndicator enum. +func (e DtoPublicStatusPageIndicator) Valid() bool { switch e { - case UnitBytes: + case DtoPublicStatusPageIndicatorCritical: return true - case UnitCharacters: + case DtoPublicStatusPageIndicatorMajor: + return true + case DtoPublicStatusPageIndicatorMinor: + return true + case DtoPublicStatusPageIndicatorNone: return true default: return false } } -// Defines values for ListAlertChannelDeliveriesParamsStatus. +// Defines values for DtoPublicStatusUpdateStatus. const ( - ListAlertChannelDeliveriesParamsStatusDead ListAlertChannelDeliveriesParamsStatus = "dead" - ListAlertChannelDeliveriesParamsStatusPending ListAlertChannelDeliveriesParamsStatus = "pending" - ListAlertChannelDeliveriesParamsStatusSent ListAlertChannelDeliveriesParamsStatus = "sent" + DtoPublicStatusUpdateStatusIdentified DtoPublicStatusUpdateStatus = "identified" + DtoPublicStatusUpdateStatusInvestigating DtoPublicStatusUpdateStatus = "investigating" + DtoPublicStatusUpdateStatusMonitoring DtoPublicStatusUpdateStatus = "monitoring" + DtoPublicStatusUpdateStatusResolved DtoPublicStatusUpdateStatus = "resolved" ) -// Valid indicates whether the value is a known member of the ListAlertChannelDeliveriesParamsStatus enum. -func (e ListAlertChannelDeliveriesParamsStatus) Valid() bool { +// Valid indicates whether the value is a known member of the DtoPublicStatusUpdateStatus enum. +func (e DtoPublicStatusUpdateStatus) Valid() bool { switch e { - case ListAlertChannelDeliveriesParamsStatusDead: + case DtoPublicStatusUpdateStatusIdentified: return true - case ListAlertChannelDeliveriesParamsStatusPending: + case DtoPublicStatusUpdateStatusInvestigating: return true - case ListAlertChannelDeliveriesParamsStatusSent: + case DtoPublicStatusUpdateStatusMonitoring: + return true + case DtoPublicStatusUpdateStatusResolved: return true default: return false } } -// Defines values for ListIncidentsParamsAcknowledged. +// Defines values for DtoStatusChangeFrom. const ( - False ListIncidentsParamsAcknowledged = "false" - True ListIncidentsParamsAcknowledged = "true" + DtoStatusChangeFromCritical DtoStatusChangeFrom = "critical" + DtoStatusChangeFromOk DtoStatusChangeFrom = "ok" + DtoStatusChangeFromPending DtoStatusChangeFrom = "pending" + DtoStatusChangeFromWarning DtoStatusChangeFrom = "warning" ) -// Valid indicates whether the value is a known member of the ListIncidentsParamsAcknowledged enum. -func (e ListIncidentsParamsAcknowledged) Valid() bool { +// Valid indicates whether the value is a known member of the DtoStatusChangeFrom enum. +func (e DtoStatusChangeFrom) Valid() bool { switch e { - case False: + case DtoStatusChangeFromCritical: return true - case True: + case DtoStatusChangeFromOk: + return true + case DtoStatusChangeFromPending: + return true + case DtoStatusChangeFromWarning: return true default: return false } } -// Defines values for ListIncidentsParamsAspect. +// Defines values for DtoStatusChangeTo. const ( - ListIncidentsParamsAspectAvailability ListIncidentsParamsAspect = "availability" - ListIncidentsParamsAspectCertificate ListIncidentsParamsAspect = "certificate" - ListIncidentsParamsAspectDomain ListIncidentsParamsAspect = "domain" + DtoStatusChangeToCritical DtoStatusChangeTo = "critical" + DtoStatusChangeToOk DtoStatusChangeTo = "ok" + DtoStatusChangeToWarning DtoStatusChangeTo = "warning" ) -// Valid indicates whether the value is a known member of the ListIncidentsParamsAspect enum. -func (e ListIncidentsParamsAspect) Valid() bool { +// Valid indicates whether the value is a known member of the DtoStatusChangeTo enum. +func (e DtoStatusChangeTo) Valid() bool { switch e { - case ListIncidentsParamsAspectAvailability: + case DtoStatusChangeToCritical: return true - case ListIncidentsParamsAspectCertificate: + case DtoStatusChangeToOk: return true - case ListIncidentsParamsAspectDomain: + case DtoStatusChangeToWarning: return true default: return false } } -// Defines values for ListIncidentsParamsSeverity. +// Defines values for DtoStatusPageAffectedStatus. const ( - ListIncidentsParamsSeverityCritical ListIncidentsParamsSeverity = "critical" - ListIncidentsParamsSeverityWarning ListIncidentsParamsSeverity = "warning" + DtoStatusPageAffectedStatusDegradedPerformance DtoStatusPageAffectedStatus = "degraded_performance" + DtoStatusPageAffectedStatusMajorOutage DtoStatusPageAffectedStatus = "major_outage" + DtoStatusPageAffectedStatusOperational DtoStatusPageAffectedStatus = "operational" + DtoStatusPageAffectedStatusPartialOutage DtoStatusPageAffectedStatus = "partial_outage" ) -// Valid indicates whether the value is a known member of the ListIncidentsParamsSeverity enum. -func (e ListIncidentsParamsSeverity) Valid() bool { +// Valid indicates whether the value is a known member of the DtoStatusPageAffectedStatus enum. +func (e DtoStatusPageAffectedStatus) Valid() bool { switch e { - case ListIncidentsParamsSeverityCritical: + case DtoStatusPageAffectedStatusDegradedPerformance: return true - case ListIncidentsParamsSeverityWarning: + case DtoStatusPageAffectedStatusMajorOutage: + return true + case DtoStatusPageAffectedStatusOperational: + return true + case DtoStatusPageAffectedStatusPartialOutage: return true default: return false } } -// Defines values for ListIncidentsParamsStatus. +// Defines values for DtoStatusPageComponentAspects. const ( - ListIncidentsParamsStatusOpen ListIncidentsParamsStatus = "open" - ListIncidentsParamsStatusResolved ListIncidentsParamsStatus = "resolved" + DtoStatusPageComponentAspectsAvailability DtoStatusPageComponentAspects = "availability" + DtoStatusPageComponentAspectsCertificate DtoStatusPageComponentAspects = "certificate" + DtoStatusPageComponentAspectsDomain DtoStatusPageComponentAspects = "domain" ) -// Valid indicates whether the value is a known member of the ListIncidentsParamsStatus enum. -func (e ListIncidentsParamsStatus) Valid() bool { +// Valid indicates whether the value is a known member of the DtoStatusPageComponentAspects enum. +func (e DtoStatusPageComponentAspects) Valid() bool { switch e { - case ListIncidentsParamsStatusOpen: + case DtoStatusPageComponentAspectsAvailability: return true - case ListIncidentsParamsStatusResolved: + case DtoStatusPageComponentAspectsCertificate: + return true + case DtoStatusPageComponentAspectsDomain: return true default: return false } } -// Defines values for ListMonitorsParamsInclude. +// Defines values for DtoStatusPageComponentKind. const ( - History ListMonitorsParamsInclude = "history" + Manual DtoStatusPageComponentKind = "manual" + Monitor DtoStatusPageComponentKind = "monitor" ) -// Valid indicates whether the value is a known member of the ListMonitorsParamsInclude enum. -func (e ListMonitorsParamsInclude) Valid() bool { +// Valid indicates whether the value is a known member of the DtoStatusPageComponentKind enum. +func (e DtoStatusPageComponentKind) Valid() bool { switch e { - case History: + case Manual: + return true + case Monitor: return true default: return false } } -// Defines values for ListMonitorsParamsSort. +// Defines values for DtoStatusPageComponentManualStatus. const ( - Created ListMonitorsParamsSort = "created" - LastChecked ListMonitorsParamsSort = "lastChecked" - Name ListMonitorsParamsSort = "name" - Status ListMonitorsParamsSort = "status" - Uptime ListMonitorsParamsSort = "uptime" + DegradedPerformance DtoStatusPageComponentManualStatus = "degraded_performance" + MajorOutage DtoStatusPageComponentManualStatus = "major_outage" + Operational DtoStatusPageComponentManualStatus = "operational" + PartialOutage DtoStatusPageComponentManualStatus = "partial_outage" ) -// Valid indicates whether the value is a known member of the ListMonitorsParamsSort enum. -func (e ListMonitorsParamsSort) Valid() bool { +// Valid indicates whether the value is a known member of the DtoStatusPageComponentManualStatus enum. +func (e DtoStatusPageComponentManualStatus) Valid() bool { switch e { - case Created: - return true - case LastChecked: + case DegradedPerformance: return true - case Name: + case MajorOutage: return true - case Status: + case Operational: return true - case Uptime: + case PartialOutage: return true default: return false } } -// Defines values for ListMonitorsParamsStatus. +// Defines values for DtoStatusPageIncidentImpact. const ( - ListMonitorsParamsStatusCritical ListMonitorsParamsStatus = "critical" - ListMonitorsParamsStatusOk ListMonitorsParamsStatus = "ok" - ListMonitorsParamsStatusPaused ListMonitorsParamsStatus = "paused" - ListMonitorsParamsStatusPending ListMonitorsParamsStatus = "pending" - ListMonitorsParamsStatusWarning ListMonitorsParamsStatus = "warning" + DtoStatusPageIncidentImpactCritical DtoStatusPageIncidentImpact = "critical" + DtoStatusPageIncidentImpactMajor DtoStatusPageIncidentImpact = "major" + DtoStatusPageIncidentImpactMinor DtoStatusPageIncidentImpact = "minor" + DtoStatusPageIncidentImpactNone DtoStatusPageIncidentImpact = "none" ) -// Valid indicates whether the value is a known member of the ListMonitorsParamsStatus enum. -func (e ListMonitorsParamsStatus) Valid() bool { +// Valid indicates whether the value is a known member of the DtoStatusPageIncidentImpact enum. +func (e DtoStatusPageIncidentImpact) Valid() bool { switch e { - case ListMonitorsParamsStatusCritical: + case DtoStatusPageIncidentImpactCritical: return true - case ListMonitorsParamsStatusOk: + case DtoStatusPageIncidentImpactMajor: return true - case ListMonitorsParamsStatusPaused: + case DtoStatusPageIncidentImpactMinor: return true - case ListMonitorsParamsStatusPending: + case DtoStatusPageIncidentImpactNone: return true - case ListMonitorsParamsStatusWarning: + default: + return false + } +} + +// Defines values for DtoStatusPageIncidentStatus. +const ( + DtoStatusPageIncidentStatusIdentified DtoStatusPageIncidentStatus = "identified" + DtoStatusPageIncidentStatusInvestigating DtoStatusPageIncidentStatus = "investigating" + DtoStatusPageIncidentStatusMonitoring DtoStatusPageIncidentStatus = "monitoring" + DtoStatusPageIncidentStatusResolved DtoStatusPageIncidentStatus = "resolved" +) + +// Valid indicates whether the value is a known member of the DtoStatusPageIncidentStatus enum. +func (e DtoStatusPageIncidentStatus) Valid() bool { + switch e { + case DtoStatusPageIncidentStatusIdentified: + return true + case DtoStatusPageIncidentStatusInvestigating: + return true + case DtoStatusPageIncidentStatusMonitoring: + return true + case DtoStatusPageIncidentStatusResolved: return true default: return false } } -// Defines values for ListMonitorsParamsType. +// Defines values for DtoStatusPageIncidentCreateImpact. const ( - Domain ListMonitorsParamsType = "domain" - Http ListMonitorsParamsType = "http" - Ssl ListMonitorsParamsType = "ssl" + DtoStatusPageIncidentCreateImpactCritical DtoStatusPageIncidentCreateImpact = "critical" + DtoStatusPageIncidentCreateImpactMajor DtoStatusPageIncidentCreateImpact = "major" + DtoStatusPageIncidentCreateImpactMinor DtoStatusPageIncidentCreateImpact = "minor" + DtoStatusPageIncidentCreateImpactNone DtoStatusPageIncidentCreateImpact = "none" ) -// Valid indicates whether the value is a known member of the ListMonitorsParamsType enum. -func (e ListMonitorsParamsType) Valid() bool { +// Valid indicates whether the value is a known member of the DtoStatusPageIncidentCreateImpact enum. +func (e DtoStatusPageIncidentCreateImpact) Valid() bool { switch e { - case Domain: + case DtoStatusPageIncidentCreateImpactCritical: return true - case Http: + case DtoStatusPageIncidentCreateImpactMajor: return true - case Ssl: + case DtoStatusPageIncidentCreateImpactMinor: + return true + case DtoStatusPageIncidentCreateImpactNone: return true default: return false } } -// Defines values for GetMonitorStatsParamsRange. +// Defines values for DtoStatusPageIncidentCreateStatus. const ( - N24h GetMonitorStatsParamsRange = "24h" - N30d GetMonitorStatsParamsRange = "30d" - N7d GetMonitorStatsParamsRange = "7d" - N90d GetMonitorStatsParamsRange = "90d" + DtoStatusPageIncidentCreateStatusIdentified DtoStatusPageIncidentCreateStatus = "identified" + DtoStatusPageIncidentCreateStatusInvestigating DtoStatusPageIncidentCreateStatus = "investigating" + DtoStatusPageIncidentCreateStatusMonitoring DtoStatusPageIncidentCreateStatus = "monitoring" + DtoStatusPageIncidentCreateStatusResolved DtoStatusPageIncidentCreateStatus = "resolved" ) -// Valid indicates whether the value is a known member of the GetMonitorStatsParamsRange enum. -func (e GetMonitorStatsParamsRange) Valid() bool { +// Valid indicates whether the value is a known member of the DtoStatusPageIncidentCreateStatus enum. +func (e DtoStatusPageIncidentCreateStatus) Valid() bool { switch e { - case N24h: + case DtoStatusPageIncidentCreateStatusIdentified: return true - case N30d: + case DtoStatusPageIncidentCreateStatusInvestigating: return true - case N7d: + case DtoStatusPageIncidentCreateStatusMonitoring: return true - case N90d: + case DtoStatusPageIncidentCreateStatusResolved: return true default: return false } } -// ConstantsErrorCode defines model for constants.ErrorCode. -type ConstantsErrorCode string +// Defines values for DtoStatusPageIncidentEntryStatus. +const ( + DtoStatusPageIncidentEntryStatusIdentified DtoStatusPageIncidentEntryStatus = "identified" + DtoStatusPageIncidentEntryStatusInvestigating DtoStatusPageIncidentEntryStatus = "investigating" + DtoStatusPageIncidentEntryStatusMonitoring DtoStatusPageIncidentEntryStatus = "monitoring" + DtoStatusPageIncidentEntryStatusResolved DtoStatusPageIncidentEntryStatus = "resolved" +) -// ConstantsErrorReason defines model for constants.ErrorReason. -type ConstantsErrorReason string +// Valid indicates whether the value is a known member of the DtoStatusPageIncidentEntryStatus enum. +func (e DtoStatusPageIncidentEntryStatus) Valid() bool { + switch e { + case DtoStatusPageIncidentEntryStatusIdentified: + return true + case DtoStatusPageIncidentEntryStatusInvestigating: + return true + case DtoStatusPageIncidentEntryStatusMonitoring: + return true + case DtoStatusPageIncidentEntryStatusResolved: + return true + default: + return false + } +} -// DtoAlertChannel defines model for dto.AlertChannel. -type DtoAlertChannel struct { - CreatedAt string `json:"createdAt"` - Enabled bool `json:"enabled"` - Id openapi_types.UUID `json:"id"` - IsDefault bool `json:"isDefault"` +// Defines values for DtoStatusPageIncidentPostStatus. +const ( + DtoStatusPageIncidentPostStatusIdentified DtoStatusPageIncidentPostStatus = "identified" + DtoStatusPageIncidentPostStatusInvestigating DtoStatusPageIncidentPostStatus = "investigating" + DtoStatusPageIncidentPostStatusMonitoring DtoStatusPageIncidentPostStatus = "monitoring" + DtoStatusPageIncidentPostStatusResolved DtoStatusPageIncidentPostStatus = "resolved" +) - // Kind Kind is how the channel delivers. voice is a voice-call channel made +// Valid indicates whether the value is a known member of the DtoStatusPageIncidentPostStatus enum. +func (e DtoStatusPageIncidentPostStatus) Valid() bool { + switch e { + case DtoStatusPageIncidentPostStatusIdentified: + return true + case DtoStatusPageIncidentPostStatusInvestigating: + return true + case DtoStatusPageIncidentPostStatusMonitoring: + return true + case DtoStatusPageIncidentPostStatusResolved: + return true + default: + return false + } +} + +// Defines values for DtoStatusPageIncidentUpdateImpact. +const ( + DtoStatusPageIncidentUpdateImpactCritical DtoStatusPageIncidentUpdateImpact = "critical" + DtoStatusPageIncidentUpdateImpactMajor DtoStatusPageIncidentUpdateImpact = "major" + DtoStatusPageIncidentUpdateImpactMinor DtoStatusPageIncidentUpdateImpact = "minor" + DtoStatusPageIncidentUpdateImpactNone DtoStatusPageIncidentUpdateImpact = "none" +) + +// Valid indicates whether the value is a known member of the DtoStatusPageIncidentUpdateImpact enum. +func (e DtoStatusPageIncidentUpdateImpact) Valid() bool { + switch e { + case DtoStatusPageIncidentUpdateImpactCritical: + return true + case DtoStatusPageIncidentUpdateImpactMajor: + return true + case DtoStatusPageIncidentUpdateImpactMinor: + return true + case DtoStatusPageIncidentUpdateImpactNone: + return true + default: + return false + } +} + +// Defines values for DtoStatusPageSettingsUptimeDays. +const ( + DtoStatusPageSettingsUptimeDaysN30 DtoStatusPageSettingsUptimeDays = 30 + DtoStatusPageSettingsUptimeDaysN60 DtoStatusPageSettingsUptimeDays = 60 + DtoStatusPageSettingsUptimeDaysN90 DtoStatusPageSettingsUptimeDays = 90 +) + +// Valid indicates whether the value is a known member of the DtoStatusPageSettingsUptimeDays enum. +func (e DtoStatusPageSettingsUptimeDays) Valid() bool { + switch e { + case DtoStatusPageSettingsUptimeDaysN30: + return true + case DtoStatusPageSettingsUptimeDaysN60: + return true + case DtoStatusPageSettingsUptimeDaysN90: + return true + default: + return false + } +} + +// Defines values for DtoStatusPageSettingsUpdateUptimeDays. +const ( + DtoStatusPageSettingsUpdateUptimeDaysN30 DtoStatusPageSettingsUpdateUptimeDays = 30 + DtoStatusPageSettingsUpdateUptimeDaysN60 DtoStatusPageSettingsUpdateUptimeDays = 60 + DtoStatusPageSettingsUpdateUptimeDaysN90 DtoStatusPageSettingsUpdateUptimeDays = 90 +) + +// Valid indicates whether the value is a known member of the DtoStatusPageSettingsUpdateUptimeDays enum. +func (e DtoStatusPageSettingsUpdateUptimeDays) Valid() bool { + switch e { + case DtoStatusPageSettingsUpdateUptimeDaysN30: + return true + case DtoStatusPageSettingsUpdateUptimeDaysN60: + return true + case DtoStatusPageSettingsUpdateUptimeDaysN90: + return true + default: + return false + } +} + +// Defines values for ValidationRule. +const ( + RuleDependsOn ValidationRule = "dependsOn" + RuleDuplicate ValidationRule = "duplicate" + RuleExclusive ValidationRule = "exclusive" + RuleFormat ValidationRule = "format" + RuleImmutable ValidationRule = "immutable" + RuleMax ValidationRule = "max" + RuleMaxItems ValidationRule = "maxItems" + RuleMaxLength ValidationRule = "maxLength" + RuleMin ValidationRule = "min" + RuleMismatch ValidationRule = "mismatch" + RuleNotAllowed ValidationRule = "notAllowed" + RuleOneOf ValidationRule = "oneOf" + RulePublic ValidationRule = "public" + RuleRange ValidationRule = "range" + RuleReference ValidationRule = "reference" + RuleRequired ValidationRule = "required" + RuleType ValidationRule = "type" + RuleUnique ValidationRule = "unique" + RuleUnknown ValidationRule = "unknown" + RuleUnsupported ValidationRule = "unsupported" + RuleUnverified ValidationRule = "unverified" +) + +// Valid indicates whether the value is a known member of the ValidationRule enum. +func (e ValidationRule) Valid() bool { + switch e { + case RuleDependsOn: + return true + case RuleDuplicate: + return true + case RuleExclusive: + return true + case RuleFormat: + return true + case RuleImmutable: + return true + case RuleMax: + return true + case RuleMaxItems: + return true + case RuleMaxLength: + return true + case RuleMin: + return true + case RuleMismatch: + return true + case RuleNotAllowed: + return true + case RuleOneOf: + return true + case RulePublic: + return true + case RuleRange: + return true + case RuleReference: + return true + case RuleRequired: + return true + case RuleType: + return true + case RuleUnique: + return true + case RuleUnknown: + return true + case RuleUnsupported: + return true + case RuleUnverified: + return true + default: + return false + } +} + +// Defines values for ValidationUnit. +const ( + UnitBytes ValidationUnit = "bytes" + UnitCharacters ValidationUnit = "characters" +) + +// Valid indicates whether the value is a known member of the ValidationUnit enum. +func (e ValidationUnit) Valid() bool { + switch e { + case UnitBytes: + return true + case UnitCharacters: + return true + default: + return false + } +} + +// Defines values for ListAlertChannelDeliveriesParamsStatus. +const ( + ListAlertChannelDeliveriesParamsStatusDead ListAlertChannelDeliveriesParamsStatus = "dead" + ListAlertChannelDeliveriesParamsStatusPending ListAlertChannelDeliveriesParamsStatus = "pending" + ListAlertChannelDeliveriesParamsStatusSent ListAlertChannelDeliveriesParamsStatus = "sent" +) + +// Valid indicates whether the value is a known member of the ListAlertChannelDeliveriesParamsStatus enum. +func (e ListAlertChannelDeliveriesParamsStatus) Valid() bool { + switch e { + case ListAlertChannelDeliveriesParamsStatusDead: + return true + case ListAlertChannelDeliveriesParamsStatusPending: + return true + case ListAlertChannelDeliveriesParamsStatusSent: + return true + default: + return false + } +} + +// Defines values for ListIncidentsParamsAcknowledged. +const ( + False ListIncidentsParamsAcknowledged = "false" + True ListIncidentsParamsAcknowledged = "true" +) + +// Valid indicates whether the value is a known member of the ListIncidentsParamsAcknowledged enum. +func (e ListIncidentsParamsAcknowledged) Valid() bool { + switch e { + case False: + return true + case True: + return true + default: + return false + } +} + +// Defines values for ListIncidentsParamsAspect. +const ( + ListIncidentsParamsAspectAvailability ListIncidentsParamsAspect = "availability" + ListIncidentsParamsAspectCertificate ListIncidentsParamsAspect = "certificate" + ListIncidentsParamsAspectDomain ListIncidentsParamsAspect = "domain" +) + +// Valid indicates whether the value is a known member of the ListIncidentsParamsAspect enum. +func (e ListIncidentsParamsAspect) Valid() bool { + switch e { + case ListIncidentsParamsAspectAvailability: + return true + case ListIncidentsParamsAspectCertificate: + return true + case ListIncidentsParamsAspectDomain: + return true + default: + return false + } +} + +// Defines values for ListIncidentsParamsSeverity. +const ( + ListIncidentsParamsSeverityCritical ListIncidentsParamsSeverity = "critical" + ListIncidentsParamsSeverityWarning ListIncidentsParamsSeverity = "warning" +) + +// Valid indicates whether the value is a known member of the ListIncidentsParamsSeverity enum. +func (e ListIncidentsParamsSeverity) Valid() bool { + switch e { + case ListIncidentsParamsSeverityCritical: + return true + case ListIncidentsParamsSeverityWarning: + return true + default: + return false + } +} + +// Defines values for ListIncidentsParamsStatus. +const ( + ListIncidentsParamsStatusOpen ListIncidentsParamsStatus = "open" + ListIncidentsParamsStatusResolved ListIncidentsParamsStatus = "resolved" +) + +// Valid indicates whether the value is a known member of the ListIncidentsParamsStatus enum. +func (e ListIncidentsParamsStatus) Valid() bool { + switch e { + case ListIncidentsParamsStatusOpen: + return true + case ListIncidentsParamsStatusResolved: + return true + default: + return false + } +} + +// Defines values for ListMonitorsParamsInclude. +const ( + History ListMonitorsParamsInclude = "history" +) + +// Valid indicates whether the value is a known member of the ListMonitorsParamsInclude enum. +func (e ListMonitorsParamsInclude) Valid() bool { + switch e { + case History: + return true + default: + return false + } +} + +// Defines values for ListMonitorsParamsSort. +const ( + Created ListMonitorsParamsSort = "created" + LastChecked ListMonitorsParamsSort = "lastChecked" + Name ListMonitorsParamsSort = "name" + Status ListMonitorsParamsSort = "status" + Uptime ListMonitorsParamsSort = "uptime" +) + +// Valid indicates whether the value is a known member of the ListMonitorsParamsSort enum. +func (e ListMonitorsParamsSort) Valid() bool { + switch e { + case Created: + return true + case LastChecked: + return true + case Name: + return true + case Status: + return true + case Uptime: + return true + default: + return false + } +} + +// Defines values for ListMonitorsParamsStatus. +const ( + ListMonitorsParamsStatusCritical ListMonitorsParamsStatus = "critical" + ListMonitorsParamsStatusOk ListMonitorsParamsStatus = "ok" + ListMonitorsParamsStatusPaused ListMonitorsParamsStatus = "paused" + ListMonitorsParamsStatusPending ListMonitorsParamsStatus = "pending" + ListMonitorsParamsStatusWarning ListMonitorsParamsStatus = "warning" +) + +// Valid indicates whether the value is a known member of the ListMonitorsParamsStatus enum. +func (e ListMonitorsParamsStatus) Valid() bool { + switch e { + case ListMonitorsParamsStatusCritical: + return true + case ListMonitorsParamsStatusOk: + return true + case ListMonitorsParamsStatusPaused: + return true + case ListMonitorsParamsStatusPending: + return true + case ListMonitorsParamsStatusWarning: + return true + default: + return false + } +} + +// Defines values for ListMonitorsParamsType. +const ( + ListMonitorsParamsTypeDomain ListMonitorsParamsType = "domain" + ListMonitorsParamsTypeHttp ListMonitorsParamsType = "http" + ListMonitorsParamsTypeSsl ListMonitorsParamsType = "ssl" +) + +// Valid indicates whether the value is a known member of the ListMonitorsParamsType enum. +func (e ListMonitorsParamsType) Valid() bool { + switch e { + case ListMonitorsParamsTypeDomain: + return true + case ListMonitorsParamsTypeHttp: + return true + case ListMonitorsParamsTypeSsl: + return true + default: + return false + } +} + +// Defines values for GetMonitorStatsParamsRange. +const ( + N24h GetMonitorStatsParamsRange = "24h" + N30d GetMonitorStatsParamsRange = "30d" + N7d GetMonitorStatsParamsRange = "7d" + N90d GetMonitorStatsParamsRange = "90d" +) + +// Valid indicates whether the value is a known member of the GetMonitorStatsParamsRange enum. +func (e GetMonitorStatsParamsRange) Valid() bool { + switch e { + case N24h: + return true + case N30d: + return true + case N7d: + return true + case N90d: + return true + default: + return false + } +} + +// Defines values for ListStatusPageIncidentsParamsStatus. +const ( + Open ListStatusPageIncidentsParamsStatus = "open" + Resolved ListStatusPageIncidentsParamsStatus = "resolved" +) + +// Valid indicates whether the value is a known member of the ListStatusPageIncidentsParamsStatus enum. +func (e ListStatusPageIncidentsParamsStatus) Valid() bool { + switch e { + case Open: + return true + case Resolved: + return true + default: + return false + } +} + +// ConstantsErrorCode defines model for constants.ErrorCode. +type ConstantsErrorCode string + +// ConstantsErrorReason defines model for constants.ErrorReason. +type ConstantsErrorReason string + +// DtoAlertChannel defines model for dto.AlertChannel. +type DtoAlertChannel struct { + CreatedAt string `json:"createdAt"` + Enabled bool `json:"enabled"` + Id openapi_types.UUID `json:"id"` + IsDefault bool `json:"isDefault"` + + // Kind Kind is how the channel delivers. voice is a voice-call channel made // before calls were withdrawn: it stays disabled and gets no alerts; // it can be renamed or deleted. Kind DtoAlertChannelKind `json:"kind"` @@ -1461,1843 +1992,4047 @@ type DtoAlertChannel struct { Settings DtoAlertChannelSettings `json:"settings"` UpdatedAt string `json:"updatedAt"` - // Verified Verified is false for an SMS or email-address channel until - // its contact confirmed a code; such a channel gets no alerts. - Verified bool `json:"verified"` + // Verified Verified is false for an SMS or email-address channel until + // its contact confirmed a code; such a channel gets no alerts. + Verified bool `json:"verified"` +} + +// DtoAlertChannelKind Kind is how the channel delivers. voice is a voice-call channel made +// before calls were withdrawn: it stays disabled and gets no alerts; +// it can be renamed or deleted. +type DtoAlertChannelKind string + +// DtoAlertChannelCreate defines model for dto.AlertChannelCreate. +type DtoAlertChannelCreate struct { + // IsDefault IsDefault channels get the alerts of monitors without their own + // alert settings. + IsDefault *bool `json:"isDefault,omitempty"` + Kind DtoAlertChannelCreateKind `json:"kind"` + Name string `json:"name"` + Settings DtoAlertChannelSettingsInput `json:"settings"` +} + +// DtoAlertChannelCreateKind defines model for DtoAlertChannelCreate.Kind. +type DtoAlertChannelCreateKind string + +// DtoAlertChannelSettings defines model for dto.AlertChannelSettings. +type DtoAlertChannelSettings struct { + Address *string `json:"address,omitempty"` + Hint *string `json:"hint,omitempty"` + Members *bool `json:"members,omitempty"` + Phone *string `json:"phone,omitempty"` + Url *string `json:"url,omitempty"` +} + +// DtoAlertChannelSettingsInput defines model for dto.AlertChannelSettingsInput. +type DtoAlertChannelSettingsInput struct { + Address *string `json:"address,omitempty"` + Members *bool `json:"members,omitempty"` + Phone *string `json:"phone,omitempty"` + SigningSecret *string `json:"signingSecret,omitempty"` + Url *string `json:"url,omitempty"` +} + +// DtoAlertChannelTestResult defines model for dto.AlertChannelTestResult. +type DtoAlertChannelTestResult struct { + ProviderRef string `json:"providerRef"` +} + +// DtoAlertChannelUpdate defines model for dto.AlertChannelUpdate. +type DtoAlertChannelUpdate struct { + Enabled *bool `json:"enabled,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + Name *string `json:"name,omitempty"` + RotateSecret *bool `json:"rotateSecret,omitempty"` + Settings *DtoAlertChannelSettingsInput `json:"settings,omitempty"` +} + +// DtoAlertChannelVerifyConfirm defines model for dto.AlertChannelVerifyConfirm. +type DtoAlertChannelVerifyConfirm struct { + Code string `json:"code"` +} + +// DtoAlertChannelWithSecret defines model for dto.AlertChannelWithSecret. +type DtoAlertChannelWithSecret struct { + CreatedAt string `json:"createdAt"` + Enabled bool `json:"enabled"` + Id openapi_types.UUID `json:"id"` + IsDefault bool `json:"isDefault"` + + // Kind Kind is how the channel delivers. voice is a voice-call channel made + // before calls were withdrawn: it stays disabled and gets no alerts; + // it can be renamed or deleted. + Kind DtoAlertChannelWithSecretKind `json:"kind"` + Name string `json:"name"` + Settings DtoAlertChannelSettings `json:"settings"` + SigningSecret *string `json:"signingSecret,omitempty"` + UpdatedAt string `json:"updatedAt"` + + // Verified Verified is false for an SMS or email-address channel until + // its contact confirmed a code; such a channel gets no alerts. + Verified bool `json:"verified"` +} + +// DtoAlertChannelWithSecretKind Kind is how the channel delivers. voice is a voice-call channel made +// before calls were withdrawn: it stays disabled and gets no alerts; +// it can be renamed or deleted. +type DtoAlertChannelWithSecretKind string + +// DtoAvailability defines model for dto.Availability. +type DtoAvailability struct { + Checks int `json:"checks"` + Critical int `json:"critical"` + Days []DtoDayAvailability `json:"days"` + DowntimeMinutes int `json:"downtimeMinutes"` + From string `json:"from"` + Inconclusive int `json:"inconclusive"` + Ok int `json:"ok"` + To string `json:"to"` + + // UptimePercent UptimePercent is (ok + warning) / (ok + warning + critical); absent + // without conclusive checks, and for SSL and domain monitors (no + // uptime: their downtime is always 0). + UptimePercent *float32 `json:"uptimePercent,omitempty"` + Warning int `json:"warning"` +} + +// DtoCertificate defines model for dto.Certificate. +type DtoCertificate struct { + // Chain Chain is what the server presented, leaf first; absent on results + // recorded before chains were kept. + Chain *[]DtoChainCertificate `json:"chain,omitempty"` + ChainValid bool `json:"chainValid"` + DaysRemaining int `json:"daysRemaining"` + + // DnsNames DNSNames are the subject alternative names (SANs). + DnsNames *[]string `json:"dnsNames,omitempty"` + + // FingerprintSha256 FingerprintSHA256 is the SHA-256 of the certificate (DER), hex. + FingerprintSha256 *string `json:"fingerprintSha256,omitempty"` + HostnameValid bool `json:"hostnameValid"` + Issuer string `json:"issuer"` + IssuerOrg *string `json:"issuerOrg,omitempty"` + NotAfter string `json:"notAfter"` + NotBefore string `json:"notBefore"` + SerialNumber *string `json:"serialNumber,omitempty"` + + // SignatureAlgorithm SignatureAlgorithm as Go names it ("SHA256-RSA", "ECDSA-SHA384"). + SignatureAlgorithm *string `json:"signatureAlgorithm,omitempty"` + Subject string `json:"subject"` + + // VerifiedChainLength VerifiedChainLength counts the certificates from the leaf to a + // trusted root, root included; absent when the chain doesn't verify. + VerifiedChainLength *int `json:"verifiedChainLength,omitempty"` +} + +// DtoCertificateRenewal defines model for dto.CertificateRenewal. +type DtoCertificateRenewal struct { + Current DtoRenewedCertificate `json:"current"` + Previous DtoRenewedCertificate `json:"previous"` +} + +// DtoChainCertificate defines model for dto.ChainCertificate. +type DtoChainCertificate struct { + IsCA bool `json:"isCA"` + Issuer string `json:"issuer"` + NotAfter string `json:"notAfter"` + NotBefore string `json:"notBefore"` + Subject string `json:"subject"` +} + +// DtoChannelDelivery defines model for dto.ChannelDelivery. +type DtoChannelDelivery struct { + Attempts int `json:"attempts"` + CreatedAt string `json:"createdAt"` + Event DtoChannelDeliveryEvent `json:"event"` + Id openapi_types.UUID `json:"id"` + + // IncidentId IncidentID is absent for an alert outside an incident. + IncidentId *openapi_types.UUID `json:"incidentId,omitempty"` + LastError *string `json:"lastError,omitempty"` + MonitorId openapi_types.UUID `json:"monitorId"` + MonitorName string `json:"monitorName"` + + // NextAttemptAt NextAttemptAt is set while pending. + NextAttemptAt *string `json:"nextAttemptAt,omitempty"` + SentAt *string `json:"sentAt,omitempty"` + + // Status Status: pending (queued or waiting to retry), sent, dead (gave up). + Status DtoChannelDeliveryStatus `json:"status"` +} + +// DtoChannelDeliveryEvent defines model for DtoChannelDelivery.Event. +type DtoChannelDeliveryEvent string + +// DtoChannelDeliveryStatus Status: pending (queued or waiting to retry), sent, dead (gave up). +type DtoChannelDeliveryStatus string + +// DtoCheckRegion defines model for dto.CheckRegion. +type DtoCheckRegion struct { + // Code Code is the AWS region code, as results' region carries it. + Code string `json:"code"` + + // Name Name is the city people know the region by. + Name string `json:"name"` +} + +// DtoCheckResult defines model for dto.CheckResult. +type DtoCheckResult struct { + Certificate *DtoCertificate `json:"certificate,omitempty"` + CheckedAt string `json:"checkedAt"` + Condition string `json:"condition"` + Domain *DtoDomainRegistration `json:"domain,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + Id int `json:"id"` + Redirects *[]string `json:"redirects,omitempty"` + Region string `json:"region"` + Severity DtoCheckResultSeverity `json:"severity"` + StatusCode *int `json:"statusCode,omitempty"` + Timings DtoCheckTimings `json:"timings"` +} + +// DtoCheckResultSeverity defines model for DtoCheckResult.Severity. +type DtoCheckResultSeverity string + +// DtoCheckTimings defines model for dto.CheckTimings. +type DtoCheckTimings struct { + ConnectMs *int `json:"connectMs,omitempty"` + DnsMs *int `json:"dnsMs,omitempty"` + RedirectMs *int `json:"redirectMs,omitempty"` + TlsMs *int `json:"tlsMs,omitempty"` + TotalMs int `json:"totalMs"` + TtfbMs *int `json:"ttfbMs,omitempty"` +} + +// DtoConditionFacts defines model for dto.ConditionFacts. +type DtoConditionFacts struct { + DaysRemaining *int `json:"daysRemaining,omitempty"` + ExpiresAt *string `json:"expiresAt,omitempty"` + + // ResponseTimeMs ResponseTimeMs and SlowThresholdMs: a slow response's time and the + // threshold it went over (slow_response only). + ResponseTimeMs *int `json:"responseTimeMs,omitempty"` + SlowThresholdMs *int `json:"slowThresholdMs,omitempty"` + StatusCode *int `json:"statusCode,omitempty"` + + // ThresholdDays ThresholdDays is the smallest expiry threshold the expiry is within. + ThresholdDays *int `json:"thresholdDays,omitempty"` +} + +// DtoDayAvailability defines model for dto.DayAvailability. +type DtoDayAvailability struct { + Checks int `json:"checks"` + Critical int `json:"critical"` + + // Date Date is the UTC day, YYYY-MM-DD. + Date string `json:"date"` + + // DowntimeMinutes DowntimeMinutes estimates the time spent down: the share of + // critical checks among the conclusive ones times the minutes the + // day's checks cover. A warning is not downtime. + DowntimeMinutes int `json:"downtimeMinutes"` + Inconclusive int `json:"inconclusive"` + + // NoData NoData: no checks that day (draw it gray, never as up). + NoData bool `json:"noData"` + Ok int `json:"ok"` + UptimePercent *float32 `json:"uptimePercent,omitempty"` + Warning int `json:"warning"` +} + +// DtoDomainRegistration defines model for dto.DomainRegistration. +type DtoDomainRegistration struct { + // CheckedAt CheckedAt is when the registry was asked (lookups are cached up to + // an hour). + CheckedAt string `json:"checkedAt"` + + // DaysRemaining DaysRemaining is 0 on the expiry day, negative after it. + DaysRemaining *int `json:"daysRemaining,omitempty"` + + // Dnssec DNSSEC: signed when the registry holds DS records for the domain; + // absent when the registry doesn't say. + Dnssec *DtoDomainRegistrationDnssec `json:"dnssec,omitempty"` + Domain string `json:"domain"` + + // ExpiresAt ExpiresAt is the expiry date at 00:00 UTC; absent when the registry + // publishes none. + ExpiresAt *string `json:"expiresAt,omitempty"` + + // Nameservers Nameservers are the delegation's nameservers, lower case, in the + // registry's order; [] when unknown (results recorded before they were + // kept, registries that publish none). + Nameservers []string `json:"nameservers"` + Registered bool `json:"registered"` + + // RegisteredAt RegisteredAt is the registration (creation) date at 00:00 UTC, and + // UpdatedAt the registry's last change of it; absent when the registry + // doesn't publish them (and for dns answers). + RegisteredAt *string `json:"registeredAt,omitempty"` + Registrar *string `json:"registrar,omitempty"` + Source DtoDomainRegistrationSource `json:"source"` + + // StatusCodes StatusCodes are the EPP status codes (RFC 5731), e.g. ok, + // clientTransferProhibited, serverHold, pendingDelete, + // redemptionPeriod; [] when unknown (dns answers). + StatusCodes []string `json:"statusCodes"` + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +// DtoDomainRegistrationDnssec DNSSEC: signed when the registry holds DS records for the domain; +// absent when the registry doesn't say. +type DtoDomainRegistrationDnssec string + +// DtoDomainRegistrationSource defines model for DtoDomainRegistration.Source. +type DtoDomainRegistrationSource string + +// DtoDomainSettings defines model for dto.DomainSettings. +type DtoDomainSettings struct { + Domain string `json:"domain"` + ExpiryThresholdsDays []int `json:"expiryThresholdsDays"` +} + +// DtoDomainSettingsInput defines model for dto.DomainSettingsInput. +type DtoDomainSettingsInput struct { + Domain string `json:"domain"` + ExpiryThresholdsDays []int `json:"expiryThresholdsDays"` +} + +// DtoExpiryWatch defines model for dto.ExpiryWatch. +type DtoExpiryWatch struct { + ThresholdsDays []int `json:"thresholdsDays"` +} + +// DtoExpiryWatchInput defines model for dto.ExpiryWatchInput. +type DtoExpiryWatchInput struct { + // ThresholdsDays ThresholdsDays are the expiry warnings, in days before expiry. + ThresholdsDays []int `json:"thresholdsDays"` +} + +// DtoHTTPHeader defines model for dto.HTTPHeader. +type DtoHTTPHeader struct { + Name string `json:"name"` + Secret bool `json:"secret"` + Value *string `json:"value,omitempty"` +} + +// DtoHTTPHeaderInput defines model for dto.HTTPHeaderInput. +type DtoHTTPHeaderInput struct { + Name string `json:"name"` + Secret *bool `json:"secret,omitempty"` + Value *string `json:"value,omitempty"` +} + +// DtoHTTPSettings defines model for dto.HTTPSettings. +type DtoHTTPSettings struct { + // CertificateExpiry CertificateExpiry and DomainExpiry are the watches that are on; + // absent when off. + CertificateExpiry *DtoExpiryWatch `json:"certificateExpiry,omitempty"` + DomainExpiry *DtoExpiryWatch `json:"domainExpiry,omitempty"` + ExpectedStatus []string `json:"expectedStatus"` + FollowRedirects bool `json:"followRedirects"` + Headers []DtoHTTPHeader `json:"headers"` + Keyword *string `json:"keyword,omitempty"` + KeywordCaseSensitive bool `json:"keywordCaseSensitive"` + KeywordMode *string `json:"keywordMode,omitempty"` + MaxRedirects int `json:"maxRedirects"` + Method string `json:"method"` + RequestBody *string `json:"requestBody,omitempty"` + RequestBodyContentType *string `json:"requestBodyContentType,omitempty"` + SlowThresholdMs *int `json:"slowThresholdMs,omitempty"` + TimeoutMs int `json:"timeoutMs"` + Url string `json:"url"` + VerifyTls bool `json:"verifyTls"` +} + +// DtoHTTPSettingsInput defines model for dto.HTTPSettingsInput. +type DtoHTTPSettingsInput struct { + // CertificateExpiry CertificateExpiry watches the expiry of the certificate the URL + // presents (https:// URLs only), judged with every check; omit it to + // leave the watch off. + CertificateExpiry *DtoExpiryWatchInput `json:"certificateExpiry,omitempty"` + + // DomainExpiry DomainExpiry watches the registration of the URL's registrable + // domain (shop.example.com watches example.com), looked up twice a + // day; omit it to leave the watch off. Not for IP addresses. + DomainExpiry *DtoExpiryWatchInput `json:"domainExpiry,omitempty"` + ExpectedStatus []string `json:"expectedStatus"` + FollowRedirects bool `json:"followRedirects"` + Headers *[]DtoHTTPHeaderInput `json:"headers,omitempty"` + + // Keyword Keyword is looked for in the first 256 KiB of the response body. + Keyword *string `json:"keyword,omitempty"` + KeywordCaseSensitive *bool `json:"keywordCaseSensitive,omitempty"` + KeywordMode *DtoHTTPSettingsInputKeywordMode `json:"keywordMode,omitempty"` + MaxRedirects int `json:"maxRedirects"` + Method DtoHTTPSettingsInputMethod `json:"method"` + RequestBody *string `json:"requestBody,omitempty"` + RequestBodyContentType *string `json:"requestBodyContentType,omitempty"` + SlowThresholdMs *int `json:"slowThresholdMs,omitempty"` + TimeoutMs int `json:"timeoutMs"` + Url string `json:"url"` + VerifyTls bool `json:"verifyTls"` +} + +// DtoHTTPSettingsInputKeywordMode defines model for DtoHTTPSettingsInput.KeywordMode. +type DtoHTTPSettingsInputKeywordMode string + +// DtoHTTPSettingsInputMethod defines model for DtoHTTPSettingsInput.Method. +type DtoHTTPSettingsInputMethod string + +// DtoHistoryBeat defines model for dto.HistoryBeat. +type DtoHistoryBeat struct { + CheckedAt string `json:"checkedAt"` + Condition string `json:"condition"` + ResponseTimeMs int `json:"responseTimeMs"` + ResultId int `json:"resultId"` + Severity DtoHistoryBeatSeverity `json:"severity"` + StatusCode *int `json:"statusCode,omitempty"` +} + +// DtoHistoryBeatSeverity defines model for DtoHistoryBeat.Severity. +type DtoHistoryBeatSeverity string + +// DtoIncident defines model for dto.Incident. +type DtoIncident struct { + AcknowledgedAt *string `json:"acknowledgedAt,omitempty"` + AcknowledgedBy *openapi_types.UUID `json:"acknowledgedBy,omitempty"` + + // Aspect Aspect is what the incident is about. + Aspect DtoIncidentAspect `json:"aspect"` + + // Condition Condition is what the latest check that changed the incident found; + // summary is its message, facts its facts. + Condition string `json:"condition"` + + // DurationSeconds DurationSeconds is how long it lasted (or has lasted so far). + DurationSeconds int `json:"durationSeconds"` + Facts DtoConditionFacts `json:"facts"` + Id openapi_types.UUID `json:"id"` + MonitorId openapi_types.UUID `json:"monitorId"` + MonitorName string `json:"monitorName"` + MonitorTarget string `json:"monitorTarget"` + MonitorType DtoIncidentMonitorType `json:"monitorType"` + + // MonitorVariant MonitorVariant names what the monitor does, as on monitor rows + // (keyword for an HTTP monitor with a keyword). + MonitorVariant DtoIncidentMonitorVariant `json:"monitorVariant"` + OpenedAt string `json:"openedAt"` + PeakSeverity DtoIncidentPeakSeverity `json:"peakSeverity"` + ResolvedAt *string `json:"resolvedAt,omitempty"` + + // Severity Severity is the current one; peakSeverity the worst it reached (a + // de-escalated incident stays open at warning). + Severity DtoIncidentSeverity `json:"severity"` + Status DtoIncidentStatus `json:"status"` + Summary string `json:"summary"` + + // Title Title names the problem in the monitor type's words (an expiry's + // days counted now, or when it ended). + Title string `json:"title"` +} + +// DtoIncidentAspect Aspect is what the incident is about. +type DtoIncidentAspect string + +// DtoIncidentMonitorType defines model for DtoIncident.MonitorType. +type DtoIncidentMonitorType string + +// DtoIncidentMonitorVariant MonitorVariant names what the monitor does, as on monitor rows +// (keyword for an HTTP monitor with a keyword). +type DtoIncidentMonitorVariant string + +// DtoIncidentPeakSeverity defines model for DtoIncident.PeakSeverity. +type DtoIncidentPeakSeverity string + +// DtoIncidentSeverity Severity is the current one; peakSeverity the worst it reached (a +// de-escalated incident stays open at warning). +type DtoIncidentSeverity string + +// DtoIncidentStatus defines model for DtoIncident.Status. +type DtoIncidentStatus string + +// DtoIncidentDelivery defines model for dto.IncidentDelivery. +type DtoIncidentDelivery struct { + // AlertId AlertID is the alert this delivery sends: an alert goes to every + // channel of its route, one delivery each. + AlertId openapi_types.UUID `json:"alertId"` + Attempts int `json:"attempts"` + ChannelId *openapi_types.UUID `json:"channelId,omitempty"` + ChannelKind *string `json:"channelKind,omitempty"` + ChannelName *string `json:"channelName,omitempty"` + Event DtoIncidentDeliveryEvent `json:"event"` + LastError *string `json:"lastError,omitempty"` + + // NextAttemptAt NextAttemptAt is when a pending delivery is tried again. + NextAttemptAt *string `json:"nextAttemptAt,omitempty"` + + // QueuedAt QueuedAt is when the alert was queued: the time of the timeline + // entry that sent it (opened, escalated, threshold, reminder). + QueuedAt string `json:"queuedAt"` + SentAt *string `json:"sentAt,omitempty"` + Status DtoIncidentDeliveryStatus `json:"status"` +} + +// DtoIncidentDeliveryEvent defines model for DtoIncidentDelivery.Event. +type DtoIncidentDeliveryEvent string + +// DtoIncidentDeliveryStatus defines model for DtoIncidentDelivery.Status. +type DtoIncidentDeliveryStatus string + +// DtoIncidentDetail defines model for dto.IncidentDetail. +type DtoIncidentDetail struct { + AcknowledgedAt *string `json:"acknowledgedAt,omitempty"` + AcknowledgedBy *openapi_types.UUID `json:"acknowledgedBy,omitempty"` + + // AcknowledgedByName AcknowledgedByName names who acknowledged it (their name, else + // email); absent when nobody did or Norcube Auth couldn't say. + AcknowledgedByName *string `json:"acknowledgedByName,omitempty"` + Alerts []DtoIncidentDelivery `json:"alerts"` + + // Aspect Aspect is what the incident is about. + Aspect DtoIncidentDetailAspect `json:"aspect"` + + // Condition Condition is what the latest check that changed the incident found; + // summary is its message, facts its facts. + Condition string `json:"condition"` + + // DurationSeconds DurationSeconds is how long it lasted (or has lasted so far). + DurationSeconds int `json:"durationSeconds"` + Facts DtoConditionFacts `json:"facts"` + Id openapi_types.UUID `json:"id"` + MonitorId openapi_types.UUID `json:"monitorId"` + MonitorName string `json:"monitorName"` + MonitorTarget string `json:"monitorTarget"` + MonitorType DtoIncidentDetailMonitorType `json:"monitorType"` + + // MonitorVariant MonitorVariant names what the monitor does, as on monitor rows + // (keyword for an HTTP monitor with a keyword). + MonitorVariant DtoIncidentDetailMonitorVariant `json:"monitorVariant"` + OpenedAt string `json:"openedAt"` + PeakSeverity DtoIncidentDetailPeakSeverity `json:"peakSeverity"` + ResolvedAt *string `json:"resolvedAt,omitempty"` + + // Severity Severity is the current one; peakSeverity the worst it reached (a + // de-escalated incident stays open at warning). + Severity DtoIncidentDetailSeverity `json:"severity"` + Status DtoIncidentDetailStatus `json:"status"` + Summary string `json:"summary"` + Timeline []DtoIncidentEvent `json:"timeline"` + + // Title Title names the problem in the monitor type's words (an expiry's + // days counted now, or when it ended). + Title string `json:"title"` +} + +// DtoIncidentDetailAspect Aspect is what the incident is about. +type DtoIncidentDetailAspect string + +// DtoIncidentDetailMonitorType defines model for DtoIncidentDetail.MonitorType. +type DtoIncidentDetailMonitorType string + +// DtoIncidentDetailMonitorVariant MonitorVariant names what the monitor does, as on monitor rows +// (keyword for an HTTP monitor with a keyword). +type DtoIncidentDetailMonitorVariant string + +// DtoIncidentDetailPeakSeverity defines model for DtoIncidentDetail.PeakSeverity. +type DtoIncidentDetailPeakSeverity string + +// DtoIncidentDetailSeverity Severity is the current one; peakSeverity the worst it reached (a +// de-escalated incident stays open at warning). +type DtoIncidentDetailSeverity string + +// DtoIncidentDetailStatus defines model for DtoIncidentDetail.Status. +type DtoIncidentDetailStatus string + +// DtoIncidentEvent defines model for dto.IncidentEvent. +type DtoIncidentEvent struct { + At string `json:"at"` + Detail *map[string]interface{} `json:"detail,omitempty"` + Type DtoIncidentEventType `json:"type"` +} + +// DtoIncidentEventType defines model for DtoIncidentEvent.Type. +type DtoIncidentEventType string + +// DtoIncidentOpenCounts defines model for dto.IncidentOpenCounts. +type DtoIncidentOpenCounts struct { + Critical int `json:"critical"` + Total int `json:"total"` + Unacknowledged int `json:"unacknowledged"` + Warning int `json:"warning"` +} + +// DtoIncidentSummary defines model for dto.IncidentSummary. +type DtoIncidentSummary struct { + // MttrLast30dSeconds MttrLast30dSeconds is the mean time to resolve of those incidents; + // absent when none was resolved. + MttrLast30dSeconds *int `json:"mttrLast30dSeconds,omitempty"` + Open DtoIncidentOpenCounts `json:"open"` + + // ResolvedLast30d ResolvedLast30d counts incidents resolved in the last 30 days, the + // ones mttrLast30dSeconds averages. + ResolvedLast30d int `json:"resolvedLast30d"` + + // ResolvedLast7d ResolvedLast7d counts incidents resolved in the last 7 days. + ResolvedLast7d int `json:"resolvedLast7d"` +} + +// DtoLastCheck defines model for dto.LastCheck. +type DtoLastCheck struct { + At string `json:"at"` + Condition string `json:"condition"` + Severity DtoLastCheckSeverity `json:"severity"` + TotalMs *int `json:"totalMs,omitempty"` +} + +// DtoLastCheckSeverity defines model for DtoLastCheck.Severity. +type DtoLastCheckSeverity string + +// DtoMonitor defines model for dto.Monitor. +type DtoMonitor struct { + // Aspects Aspects are the monitor's watched aspects (an HTTP monitor's + // certificate and domain watches that are on), on list rows too; [] + // without watches. + Aspects []DtoMonitorAspect `json:"aspects"` + + // Condition Condition explains status; absent while pending. + Condition *DtoMonitorCondition `json:"condition,omitempty"` + CreatedAt string `json:"createdAt"` + CreatedBy openapi_types.UUID `json:"createdBy"` + Description string `json:"description"` + Domain *DtoDomainSettings `json:"domain,omitempty"` + + // History History is set on list rows with include=history: the newest + // results (at most 60), newest first; [] for a monitor never checked. + History *[]DtoHistoryBeat `json:"history,omitempty"` + Http *DtoHTTPSettings `json:"http,omitempty"` + Id openapi_types.UUID `json:"id"` + IntervalSeconds int `json:"intervalSeconds"` + + // Last24h Last24h is set on list rows of monitors that track uptime (HTTP): + // the last 24 full hours plus the current one. SSL and domain monitors + // show days left (condition.facts) instead. + Last24h *DtoWindowSummary `json:"last24h,omitempty"` + LastCheck *DtoLastCheck `json:"lastCheck,omitempty"` + Name string `json:"name"` + NextCheckAt *string `json:"nextCheckAt,omitempty"` + + // OverallStatus OverallStatus is the worst of status and the statuses of the + // monitor's watched aspects (critical, warning, pending, ok), paused + // while disabled. The list status filter and sort use it. + OverallStatus DtoMonitorOverallStatus `json:"overallStatus"` + + // ParentResource ParentResource is set when the monitor belongs to a resource of + // another Norcube service ("domainradar:saved_domain:example.com"). It + // can't be deleted here, and its domain can't change. + ParentResource *string `json:"parentResource,omitempty"` + + // Regions Regions are where the monitor is checked from, on list rows too. + // Today every monitor is checked from the one region the service runs + // in; with probes in more regions (planned) a monitor may list + // several. Each result says which region checked it (region). + Regions []DtoCheckRegion `json:"regions"` + Ssl *DtoSSLSettings `json:"ssl,omitempty"` + + // Status Status is the primary aspect's: the severity of the last conclusive + // check, pending before one, paused while disabled. An inconclusive + // check (a failed registry lookup) never changes it. + Status DtoMonitorStatus `json:"status"` + StatusSince string `json:"statusSince"` + Target string `json:"target"` + Type DtoMonitorType `json:"type"` + UpdatedAt string `json:"updatedAt"` + + // Variant Variant is what the monitor does in one word, on list rows too + // (which carry no settings): keyword for an HTTP monitor that looks for + // a keyword in the body, otherwise the type. + Variant DtoMonitorVariant `json:"variant"` +} + +// DtoMonitorOverallStatus OverallStatus is the worst of status and the statuses of the +// monitor's watched aspects (critical, warning, pending, ok), paused +// while disabled. The list status filter and sort use it. +type DtoMonitorOverallStatus string + +// DtoMonitorStatus Status is the primary aspect's: the severity of the last conclusive +// check, pending before one, paused while disabled. An inconclusive +// check (a failed registry lookup) never changes it. +type DtoMonitorStatus string + +// DtoMonitorType defines model for DtoMonitor.Type. +type DtoMonitorType string + +// DtoMonitorVariant Variant is what the monitor does in one word, on list rows too +// (which carry no settings): keyword for an HTTP monitor that looks for +// a keyword in the body, otherwise the type. +type DtoMonitorVariant string + +// DtoMonitorAlertRoute defines model for dto.MonitorAlertRoute. +type DtoMonitorAlertRoute struct { + ChannelId openapi_types.UUID `json:"channelId"` + Events []DtoMonitorAlertRouteEvents `json:"events"` +} + +// DtoMonitorAlertRouteEvents defines model for DtoMonitorAlertRoute.Events. +type DtoMonitorAlertRouteEvents string + +// DtoMonitorAlerts defines model for dto.MonitorAlerts. +type DtoMonitorAlerts struct { + // ApplicableEvents ApplicableEvents are the events monitors of this type can send + // (offer only these in a routing form). + ApplicableEvents []DtoMonitorAlertsApplicableEvents `json:"applicableEvents"` + ConfirmFailures int `json:"confirmFailures"` + ConfirmSuccesses int `json:"confirmSuccesses"` + ReminderMinutes int `json:"reminderMinutes"` + Routes []DtoMonitorAlertRoute `json:"routes"` + UseDefaults bool `json:"useDefaults"` +} + +// DtoMonitorAlertsApplicableEvents defines model for DtoMonitorAlerts.ApplicableEvents. +type DtoMonitorAlertsApplicableEvents string + +// DtoMonitorAlertsUpdate defines model for dto.MonitorAlertsUpdate. +type DtoMonitorAlertsUpdate struct { + ConfirmFailures *int `json:"confirmFailures,omitempty"` + ConfirmSuccesses *int `json:"confirmSuccesses,omitempty"` + ReminderMinutes *int `json:"reminderMinutes,omitempty"` + Routes *[]DtoMonitorAlertRoute `json:"routes,omitempty"` + UseDefaults *bool `json:"useDefaults,omitempty"` +} + +// DtoMonitorAspect defines model for dto.MonitorAspect. +type DtoMonitorAspect struct { + // AlertedThresholds AlertedThresholds are the expiry thresholds already alerted for the + // current expiry, oldest first; [] before the first (or once renewed). + AlertedThresholds []DtoThresholdAlert `json:"alertedThresholds"` + Aspect DtoMonitorAspectAspect `json:"aspect"` + + // CheckedAt CheckedAt is the last observation, conclusive or not; absent before + // the first. + CheckedAt *string `json:"checkedAt,omitempty"` + + // Condition Condition explains status ("ok", "cert_expiring", "domain_expired", + // ...); absent while pending. + Condition *string `json:"condition,omitempty"` + + // DaysRemaining DaysRemaining is counted when read from expiresAt, negative once + // expired. + DaysRemaining *int `json:"daysRemaining,omitempty"` + ExpiresAt *string `json:"expiresAt,omitempty"` + Message *string `json:"message,omitempty"` + Status DtoMonitorAspectStatus `json:"status"` + + // Subject Subject is what the aspect is about: the URL's host for the + // certificate, its registrable domain for the domain. + Subject string `json:"subject"` + ThresholdsDays []int `json:"thresholdsDays"` +} + +// DtoMonitorAspectAspect defines model for DtoMonitorAspect.Aspect. +type DtoMonitorAspectAspect string + +// DtoMonitorAspectStatus defines model for DtoMonitorAspect.Status. +type DtoMonitorAspectStatus string + +// DtoMonitorBulkItem defines model for dto.MonitorBulkItem. +type DtoMonitorBulkItem struct { + Code *string `json:"code,omitempty"` + Detail *string `json:"detail,omitempty"` + MonitorId openapi_types.UUID `json:"monitorId"` + Ok bool `json:"ok"` +} + +// DtoMonitorBulkRequest defines model for dto.MonitorBulkRequest. +type DtoMonitorBulkRequest struct { + Action DtoMonitorBulkRequestAction `json:"action"` + MonitorIds []string `json:"monitorIds"` +} + +// DtoMonitorBulkRequestAction defines model for DtoMonitorBulkRequest.Action. +type DtoMonitorBulkRequestAction string + +// DtoMonitorBulkResult defines model for dto.MonitorBulkResult. +type DtoMonitorBulkResult struct { + Action DtoMonitorBulkResultAction `json:"action"` + Failed int `json:"failed"` + Items []DtoMonitorBulkItem `json:"items"` + Succeeded int `json:"succeeded"` +} + +// DtoMonitorBulkResultAction defines model for DtoMonitorBulkResult.Action. +type DtoMonitorBulkResultAction string + +// DtoMonitorCertificate defines model for dto.MonitorCertificate. +type DtoMonitorCertificate struct { + // AlertWindowStart AlertWindowStart is when the largest threshold is crossed (notAfter + // minus it): shade from here to notAfter. + AlertWindowStart *string `json:"alertWindowStart,omitempty"` + Certificate DtoCertificate `json:"certificate"` + CheckedAt string `json:"checkedAt"` + Condition string `json:"condition"` + + // DaysRemaining DaysRemaining counts from now (certificate.daysRemaining from the + // check). + DaysRemaining int `json:"daysRemaining"` + ErrorMessage *string `json:"errorMessage,omitempty"` + NextThresholdAt *string `json:"nextThresholdAt,omitempty"` + + // NextThresholdDays NextThresholdDays / NextThresholdAt: the next threshold to cross + // and when; absent once past the smallest. + NextThresholdDays *int `json:"nextThresholdDays,omitempty"` + ResultId int `json:"resultId"` + Severity DtoMonitorCertificateSeverity `json:"severity"` + + // ThresholdsDays ThresholdsDays are the SSL monitor's expiry thresholds, largest + // first; empty for an HTTP monitor (no expiry alerts). + ThresholdsDays []int `json:"thresholdsDays"` +} + +// DtoMonitorCertificateSeverity defines model for DtoMonitorCertificate.Severity. +type DtoMonitorCertificateSeverity string + +// DtoMonitorCondition defines model for dto.MonitorCondition. +type DtoMonitorCondition struct { + // AlertedThresholds AlertedThresholds are the expiry thresholds already alerted for the + // current expiry (SSL and domain monitors), oldest first; [] otherwise. + // An HTTP monitor's watched certificate and domain have theirs on + // aspects. + AlertedThresholds []DtoThresholdAlert `json:"alertedThresholds"` + + // Code Code is the condition ("ok", "slow_response", "cert_expiring", ...), + // worded per monitor type by the dashboard. + Code string `json:"code"` + + // ConclusiveAt ConclusiveAt is when a check last confirmed it; older than + // lastCheck.at when the newest checks couldn't tell. + ConclusiveAt *string `json:"conclusiveAt,omitempty"` + Facts DtoConditionFacts `json:"facts"` + Message *string `json:"message,omitempty"` + + // Since Since is when the status began (statusSince). + Since string `json:"since"` +} + +// DtoMonitorCreate defines model for dto.MonitorCreate. +type DtoMonitorCreate struct { + Description *string `json:"description,omitempty"` + Domain *DtoDomainSettingsInput `json:"domain,omitempty"` + Http *DtoHTTPSettingsInput `json:"http,omitempty"` + + // IntervalSeconds The org's plan can require more than the 30-second floor (60 s by + // default), and domain monitors run at most hourly (3600); the error + // message names the minimum. + IntervalSeconds int `json:"intervalSeconds"` + Name string `json:"name"` + Ssl *DtoSSLSettingsInput `json:"ssl,omitempty"` + Type DtoMonitorCreateType `json:"type"` +} + +// DtoMonitorCreateType defines model for DtoMonitorCreate.Type. +type DtoMonitorCreateType string + +// DtoMonitorEvent defines model for dto.MonitorEvent. +type DtoMonitorEvent struct { + Aspect DtoMonitorEventAspect `json:"aspect"` + At string `json:"at"` + + // CheckResultId CheckResultID is the check that saw it. + CheckResultId int `json:"checkResultId"` + Id int `json:"id"` + + // Renewal Renewal is set on certificate_renewed. + Renewal *DtoCertificateRenewal `json:"renewal,omitempty"` + + // Type Type: certificate_renewed, a check saw a certificate other than the + // newest one so far, expiring later (SSL monitors and HTTP monitors + // that watch their certificate; an older certificate, say from a node + // behind on renewals, is not one). + Type DtoMonitorEventType `json:"type"` +} + +// DtoMonitorEventAspect defines model for DtoMonitorEvent.Aspect. +type DtoMonitorEventAspect string + +// DtoMonitorEventType Type: certificate_renewed, a check saw a certificate other than the +// newest one so far, expiring later (SSL monitors and HTTP monitors +// that watch their certificate; an older certificate, say from a node +// behind on renewals, is not one). +type DtoMonitorEventType string + +// DtoMonitorStats defines model for dto.MonitorStats. +type DtoMonitorStats struct { + AvgMs *int `json:"avgMs,omitempty"` + Checks int `json:"checks"` + Critical int `json:"critical"` + From string `json:"from"` + Granularity DtoMonitorStatsGranularity `json:"granularity"` + Inconclusive int `json:"inconclusive"` + MaxMs *int `json:"maxMs,omitempty"` + Ok int `json:"ok"` + Series []DtoStatsBucket `json:"series"` + To string `json:"to"` + + // UptimePercent UptimePercent is (ok + warning) / (ok + warning + critical); absent + // without conclusive checks and for SSL and domain monitors. + UptimePercent *float32 `json:"uptimePercent,omitempty"` + Warning int `json:"warning"` +} + +// DtoMonitorStatsGranularity defines model for DtoMonitorStats.Granularity. +type DtoMonitorStatsGranularity string + +// DtoMonitorUpdate defines model for dto.MonitorUpdate. +type DtoMonitorUpdate struct { + Description *string `json:"description,omitempty"` + Domain *DtoDomainSettingsInput `json:"domain,omitempty"` + Http *DtoHTTPSettingsInput `json:"http,omitempty"` + IntervalSeconds *int `json:"intervalSeconds,omitempty"` + Name *string `json:"name,omitempty"` + Ssl *DtoSSLSettingsInput `json:"ssl,omitempty"` +} + +// DtoPublicStatusAffected defines model for dto.PublicStatusAffected. +type DtoPublicStatusAffected struct { + Id openapi_types.UUID `json:"id"` + Name string `json:"name"` + Status DtoPublicStatusAffectedStatus `json:"status"` +} + +// DtoPublicStatusAffectedStatus defines model for DtoPublicStatusAffected.Status. +type DtoPublicStatusAffectedStatus string + +// DtoPublicStatusComponent defines model for dto.PublicStatusComponent. +type DtoPublicStatusComponent struct { + // AvgResponseMs AvgResponseMs over the page's range, when the page shows response + // times. + AvgResponseMs *int `json:"avgResponseMs,omitempty"` + + // Days Days are the bar, oldest first, when the page shows bars and the + // component counts availability. + Days *[]DtoPublicStatusDay `json:"days,omitempty"` + Description string `json:"description"` + Id openapi_types.UUID `json:"id"` + Name string `json:"name"` + Status DtoPublicStatusComponentStatus `json:"status"` + + // UptimePercent UptimePercent over the page's range, when the page shows it. + UptimePercent *float32 `json:"uptimePercent,omitempty"` +} + +// DtoPublicStatusComponentStatus defines model for DtoPublicStatusComponent.Status. +type DtoPublicStatusComponentStatus string + +// DtoPublicStatusDay defines model for dto.PublicStatusDay. +type DtoPublicStatusDay struct { + // AvgResponseMs AvgResponseMs: when the page shows response times. + AvgResponseMs *int `json:"avgResponseMs,omitempty"` + Day string `json:"day"` + DowntimeMinutes *int `json:"downtimeMinutes,omitempty"` + Grade DtoPublicStatusDayGrade `json:"grade"` + UptimePercent *float32 `json:"uptimePercent,omitempty"` +} + +// DtoPublicStatusDayGrade defines model for DtoPublicStatusDay.Grade. +type DtoPublicStatusDayGrade string + +// DtoPublicStatusGroup defines model for dto.PublicStatusGroup. +type DtoPublicStatusGroup struct { + Collapsed bool `json:"collapsed"` + Components []DtoPublicStatusComponent `json:"components"` + Description string `json:"description"` + Id openapi_types.UUID `json:"id"` + Name string `json:"name"` + Status DtoPublicStatusGroupStatus `json:"status"` +} + +// DtoPublicStatusGroupStatus defines model for DtoPublicStatusGroup.Status. +type DtoPublicStatusGroupStatus string + +// DtoPublicStatusHistory defines model for dto.PublicStatusHistory. +type DtoPublicStatusHistory struct { + Incidents []DtoPublicStatusIncident `json:"incidents"` + SchemaVersion int `json:"schemaVersion"` +} + +// DtoPublicStatusIncident defines model for dto.PublicStatusIncident. +type DtoPublicStatusIncident struct { + Components []DtoPublicStatusAffected `json:"components"` + Id openapi_types.UUID `json:"id"` + Impact DtoPublicStatusIncidentImpact `json:"impact"` + ResolvedAt *string `json:"resolvedAt,omitempty"` + StartedAt string `json:"startedAt"` + Status DtoPublicStatusIncidentStatus `json:"status"` + Title string `json:"title"` + Updates []DtoPublicStatusUpdate `json:"updates"` +} + +// DtoPublicStatusIncidentImpact defines model for DtoPublicStatusIncident.Impact. +type DtoPublicStatusIncidentImpact string + +// DtoPublicStatusIncidentStatus defines model for DtoPublicStatusIncident.Status. +type DtoPublicStatusIncidentStatus string + +// DtoPublicStatusPage defines model for dto.PublicStatusPage. +type DtoPublicStatusPage struct { + // Active Active are the open posts, newest first. + Active []DtoPublicStatusIncident `json:"active"` + + // AsOf AsOf is when the content last changed. + AsOf *string `json:"asOf,omitempty"` + Components []DtoPublicStatusComponent `json:"components"` + Description string `json:"description"` + Groups []DtoPublicStatusGroup `json:"groups"` + Id openapi_types.UUID `json:"id"` + + // Indicator Indicator is the page's one-word verdict. + Indicator DtoPublicStatusPageIndicator `json:"indicator"` + Name string `json:"name"` + + // Published Published false: only preview links show it. + Published bool `json:"published"` + SchemaVersion int `json:"schemaVersion"` + SearchIndexing bool `json:"searchIndexing"` + Slug string `json:"slug"` + TimeZone string `json:"timeZone"` + + // UptimeDays UptimeDays is how many days the bars cover. + UptimeDays int `json:"uptimeDays"` +} + +// DtoPublicStatusPageIndicator Indicator is the page's one-word verdict. +type DtoPublicStatusPageIndicator string + +// DtoPublicStatusPreview defines model for dto.PublicStatusPreview. +type DtoPublicStatusPreview struct { + History DtoPublicStatusHistory `json:"history"` + Page DtoPublicStatusPage `json:"page"` +} + +// DtoPublicStatusUpdate defines model for dto.PublicStatusUpdate. +type DtoPublicStatusUpdate struct { + Body string `json:"body"` + CreatedAt string `json:"createdAt"` + Id openapi_types.UUID `json:"id"` + Status DtoPublicStatusUpdateStatus `json:"status"` +} + +// DtoPublicStatusUpdateStatus defines model for DtoPublicStatusUpdate.Status. +type DtoPublicStatusUpdateStatus string + +// DtoRenewedCertificate defines model for dto.RenewedCertificate. +type DtoRenewedCertificate struct { + FingerprintSha256 *string `json:"fingerprintSha256,omitempty"` + Issuer string `json:"issuer"` + NotAfter string `json:"notAfter"` + NotBefore string `json:"notBefore"` + SerialNumber string `json:"serialNumber"` + Subject string `json:"subject"` +} + +// DtoSSLSettings defines model for dto.SSLSettings. +type DtoSSLSettings struct { + ExpiryThresholdsDays []int `json:"expiryThresholdsDays"` + Host string `json:"host"` + Port int `json:"port"` + ServerName *string `json:"serverName,omitempty"` +} + +// DtoSSLSettingsInput defines model for dto.SSLSettingsInput. +type DtoSSLSettingsInput struct { + ExpiryThresholdsDays []int `json:"expiryThresholdsDays"` + Host string `json:"host"` + Port int `json:"port"` + ServerName *string `json:"serverName,omitempty"` +} + +// DtoStatsBucket defines model for dto.StatsBucket. +type DtoStatsBucket struct { + AvgMs int `json:"avgMs"` + Checks int `json:"checks"` + Critical int `json:"critical"` + Inconclusive int `json:"inconclusive"` + MaxMs int `json:"maxMs"` + Ok int `json:"ok"` + P50Ms int `json:"p50Ms"` + P95Ms int `json:"p95Ms"` + Region string `json:"region"` + Start string `json:"start"` + Warning int `json:"warning"` +} + +// DtoStatusChange defines model for dto.StatusChange. +type DtoStatusChange struct { + ChangedAt string `json:"changedAt"` + + // CheckResultId CheckResultID is the result that made the change (raw results are + // kept about 30 days, changes a year). + CheckResultId int `json:"checkResultId"` + + // Condition Condition is what the check that made the change found. + Condition string `json:"condition"` + + // DurationSeconds DurationSeconds is how long the status lasted (until now for the + // newest change). + DurationSeconds int `json:"durationSeconds"` + + // EndedAt EndedAt is when the next change happened; absent for the newest + // change (the current status, unless the monitor is paused). + EndedAt *string `json:"endedAt,omitempty"` + + // Events Events are what else happened while this status lasted (from + // changedAt to endedAt), newest first: certificate renewals. [] when + // nothing did. + Events []DtoMonitorEvent `json:"events"` + From DtoStatusChangeFrom `json:"from"` + Id int `json:"id"` + Message *string `json:"message,omitempty"` + StatusCode *int `json:"statusCode,omitempty"` + To DtoStatusChangeTo `json:"to"` +} + +// DtoStatusChangeFrom defines model for DtoStatusChange.From. +type DtoStatusChangeFrom string + +// DtoStatusChangeTo defines model for DtoStatusChange.To. +type DtoStatusChangeTo string + +// DtoStatusPage defines model for dto.StatusPage. +type DtoStatusPage struct { + CreatedAt string `json:"createdAt"` + Description string `json:"description"` + Id openapi_types.UUID `json:"id"` + Name string `json:"name"` + + // Published Published pages are public; others answer 404. + Published bool `json:"published"` + PublishedAt *string `json:"publishedAt,omitempty"` + Settings DtoStatusPageSettings `json:"settings"` + Slug string `json:"slug"` + UpdatedAt string `json:"updatedAt"` + + // Url URL is the page's public address. + Url string `json:"url"` +} + +// DtoStatusPageAffected defines model for dto.StatusPageAffected. +type DtoStatusPageAffected struct { + ComponentId openapi_types.UUID `json:"componentId"` + Status DtoStatusPageAffectedStatus `json:"status"` +} + +// DtoStatusPageAffectedStatus defines model for DtoStatusPageAffected.Status. +type DtoStatusPageAffectedStatus string + +// DtoStatusPageComponent defines model for dto.StatusPageComponent. +type DtoStatusPageComponent struct { + // Aspects Aspects: what counts towards a monitor component's status. + Aspects *[]DtoStatusPageComponentAspects `json:"aspects,omitempty"` + Description *string `json:"description,omitempty"` + Id *openapi_types.UUID `json:"id,omitempty"` + Kind DtoStatusPageComponentKind `json:"kind"` + + // ManualStatus ManualStatus: a manual component's status. + ManualStatus *DtoStatusPageComponentManualStatus `json:"manualStatus,omitempty"` + + // MonitorId MonitorID: a monitor component's monitor. The public never sees it. + MonitorId *openapi_types.UUID `json:"monitorId,omitempty"` + + // Name Name is what the public sees; the monitor's name and target never are. + Name string `json:"name"` +} + +// DtoStatusPageComponentAspects defines model for DtoStatusPageComponent.Aspects. +type DtoStatusPageComponentAspects string + +// DtoStatusPageComponentKind defines model for DtoStatusPageComponent.Kind. +type DtoStatusPageComponentKind string + +// DtoStatusPageComponentManualStatus ManualStatus: a manual component's status. +type DtoStatusPageComponentManualStatus string + +// DtoStatusPageCreate defines model for dto.StatusPageCreate. +type DtoStatusPageCreate struct { + Description *string `json:"description,omitempty"` + Name string `json:"name"` + Settings DtoStatusPageSettings `json:"settings"` + + // Slug Slug is the page's address: lowercase letters, digits and hyphens. + Slug string `json:"slug"` +} + +// DtoStatusPageGroup defines model for dto.StatusPageGroup. +type DtoStatusPageGroup struct { + Collapsed *bool `json:"collapsed,omitempty"` + Components []DtoStatusPageComponent `json:"components"` + Description *string `json:"description,omitempty"` + Id *openapi_types.UUID `json:"id,omitempty"` + Name string `json:"name"` +} + +// DtoStatusPageIncident defines model for dto.StatusPageIncident. +type DtoStatusPageIncident struct { + Components []DtoStatusPageAffected `json:"components"` + CreatedAt string `json:"createdAt"` + Id openapi_types.UUID `json:"id"` + Impact DtoStatusPageIncidentImpact `json:"impact"` + MonitorIncidentIds []string `json:"monitorIncidentIds"` + ResolvedAt *string `json:"resolvedAt,omitempty"` + StartedAt string `json:"startedAt"` + Status DtoStatusPageIncidentStatus `json:"status"` + StatusPageId openapi_types.UUID `json:"statusPageId"` + Title string `json:"title"` + UpdatedAt string `json:"updatedAt"` + Updates []DtoStatusPageIncidentEntry `json:"updates"` +} + +// DtoStatusPageIncidentImpact defines model for DtoStatusPageIncident.Impact. +type DtoStatusPageIncidentImpact string + +// DtoStatusPageIncidentStatus defines model for DtoStatusPageIncident.Status. +type DtoStatusPageIncidentStatus string + +// DtoStatusPageIncidentCreate defines model for dto.StatusPageIncidentCreate. +type DtoStatusPageIncidentCreate struct { + // Body Body is the first update's text. + Body string `json:"body"` + Components *[]DtoStatusPageAffected `json:"components,omitempty"` + Impact DtoStatusPageIncidentCreateImpact `json:"impact"` + + // MonitorIncidentIds MonitorIncidentIDs are the monitor incidents the post is about (for + // your navigation, never published). + MonitorIncidentIds *[]openapi_types.UUID `json:"monitorIncidentIds,omitempty"` + + // StartedAt StartedAt defaults to now. + StartedAt *string `json:"startedAt,omitempty"` + Status DtoStatusPageIncidentCreateStatus `json:"status"` + Title string `json:"title"` +} + +// DtoStatusPageIncidentCreateImpact defines model for DtoStatusPageIncidentCreate.Impact. +type DtoStatusPageIncidentCreateImpact string + +// DtoStatusPageIncidentCreateStatus defines model for DtoStatusPageIncidentCreate.Status. +type DtoStatusPageIncidentCreateStatus string + +// DtoStatusPageIncidentEntry defines model for dto.StatusPageIncidentEntry. +type DtoStatusPageIncidentEntry struct { + Body string `json:"body"` + CreatedAt string `json:"createdAt"` + Id openapi_types.UUID `json:"id"` + Status DtoStatusPageIncidentEntryStatus `json:"status"` +} + +// DtoStatusPageIncidentEntryStatus defines model for DtoStatusPageIncidentEntry.Status. +type DtoStatusPageIncidentEntryStatus string + +// DtoStatusPageIncidentPost defines model for dto.StatusPageIncidentPost. +type DtoStatusPageIncidentPost struct { + Body string `json:"body"` + + // Components Components, when given, replaces the affected components. + Components *[]DtoStatusPageAffected `json:"components,omitempty"` + Status DtoStatusPageIncidentPostStatus `json:"status"` +} + +// DtoStatusPageIncidentPostStatus defines model for DtoStatusPageIncidentPost.Status. +type DtoStatusPageIncidentPostStatus string + +// DtoStatusPageIncidentUpdate defines model for dto.StatusPageIncidentUpdate. +type DtoStatusPageIncidentUpdate struct { + Components *[]DtoStatusPageAffected `json:"components,omitempty"` + Impact *DtoStatusPageIncidentUpdateImpact `json:"impact,omitempty"` + MonitorIncidentIds *[]openapi_types.UUID `json:"monitorIncidentIds,omitempty"` + StartedAt *string `json:"startedAt,omitempty"` + Title *string `json:"title,omitempty"` +} + +// DtoStatusPageIncidentUpdateImpact defines model for DtoStatusPageIncidentUpdate.Impact. +type DtoStatusPageIncidentUpdateImpact string + +// DtoStatusPageLayout defines model for dto.StatusPageLayout. +type DtoStatusPageLayout struct { + Components []DtoStatusPageComponent `json:"components"` + Groups []DtoStatusPageGroup `json:"groups"` +} + +// DtoStatusPagePreviewLink defines model for dto.StatusPagePreviewLink. +type DtoStatusPagePreviewLink struct { + ExpiresAt string `json:"expiresAt"` + Url string `json:"url"` +} + +// DtoStatusPageSettings defines model for dto.StatusPageSettings. +type DtoStatusPageSettings struct { + // HistoryDays HistoryDays is how far back resolved incidents stay on the page. + HistoryDays int `json:"historyDays"` + + // SearchIndexing SearchIndexing false asks search engines to leave the page out. + SearchIndexing bool `json:"searchIndexing"` + ShowResponseTime bool `json:"showResponseTime"` + ShowUptimeBars bool `json:"showUptimeBars"` + ShowUptimePercent bool `json:"showUptimePercent"` + + // TimeZone TimeZone is the IANA zone times are shown in. + TimeZone string `json:"timeZone"` + + // UptimeDays UptimeDays is how many days the bars cover. + UptimeDays DtoStatusPageSettingsUptimeDays `json:"uptimeDays"` +} + +// DtoStatusPageSettingsUptimeDays UptimeDays is how many days the bars cover. +type DtoStatusPageSettingsUptimeDays int + +// DtoStatusPageSettingsUpdate defines model for dto.StatusPageSettingsUpdate. +type DtoStatusPageSettingsUpdate struct { + HistoryDays *int `json:"historyDays,omitempty"` + SearchIndexing *bool `json:"searchIndexing,omitempty"` + ShowResponseTime *bool `json:"showResponseTime,omitempty"` + ShowUptimeBars *bool `json:"showUptimeBars,omitempty"` + ShowUptimePercent *bool `json:"showUptimePercent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + UptimeDays *DtoStatusPageSettingsUpdateUptimeDays `json:"uptimeDays,omitempty"` +} + +// DtoStatusPageSettingsUpdateUptimeDays defines model for DtoStatusPageSettingsUpdate.UptimeDays. +type DtoStatusPageSettingsUpdateUptimeDays int + +// DtoStatusPageUpdate defines model for dto.StatusPageUpdate. +type DtoStatusPageUpdate struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + Settings *DtoStatusPageSettingsUpdate `json:"settings,omitempty"` + Slug *string `json:"slug,omitempty"` +} + +// DtoThresholdAlert defines model for dto.ThresholdAlert. +type DtoThresholdAlert struct { + AlertedAt string `json:"alertedAt"` + Days int `json:"days"` +} + +// DtoWindowSummary defines model for dto.WindowSummary. +type DtoWindowSummary struct { + AvgMs *int `json:"avgMs,omitempty"` + Checks int `json:"checks"` + Critical int `json:"critical"` + From string `json:"from"` + Inconclusive int `json:"inconclusive"` + Ok int `json:"ok"` + + // P50Ms P50Ms and P95Ms approximate the window's median and 95th percentile + // response time (the checks-weighted mean of the hourly percentiles). + P50Ms *int `json:"p50Ms,omitempty"` + P95Ms *int `json:"p95Ms,omitempty"` + + // UptimePercent UptimePercent is (ok + warning) / (ok + warning + critical): a + // warning still answered, an inconclusive check counts neither way. + // WarningPercent is the warnings' share of the conclusive checks. + UptimePercent *float32 `json:"uptimePercent,omitempty"` + Warning int `json:"warning"` + WarningPercent *float32 `json:"warningPercent,omitempty"` +} + +// ResponseAPIResponsePaginationCursors defines model for response.APIResponsePaginationCursors. +type ResponseAPIResponsePaginationCursors struct { + Next *string `json:"next,omitempty"` + Prev *string `json:"prev,omitempty"` +} + +// ResponseAPIResponsePaginationMeta defines model for response.APIResponsePaginationMeta. +type ResponseAPIResponsePaginationMeta struct { + Timestamp *string `json:"timestamp,omitempty"` +} + +// ResponseAPIResponseWithPagination defines model for response.APIResponseWithPagination. +type ResponseAPIResponseWithPagination struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List interface{} `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` +} + +// ResponseProblem defines model for response.Problem. +type ResponseProblem struct { + Code ConstantsErrorCode `json:"code"` + + // Data Data holds stable facts about the error ("limit"), the same ones gRPC + // sends as ErrorInfo metadata. + Data *map[string]string `json:"data,omitempty"` + + // Detail Detail is an English sentence for people. + Detail string `json:"detail"` + + // Errors Errors lists the field problems of a VALIDATION_FAILED problem. + Errors *[]ValidationViolation `json:"errors,omitempty"` + + // Instance Instance identifies this occurrence: the request id the server + // generated, also sent as X-Request-ID and logged as request_id. + Instance string `json:"instance"` + + // Reason Reason is a finer stable cause within Code, when there is one. + Reason *ConstantsErrorReason `json:"reason,omitempty"` + Status int `json:"status"` + Timestamp string `json:"timestamp"` + Title string `json:"title"` + + // Type Type identifies the problem type (one per code); it may be + // dereferenced for documentation. + Type string `json:"type"` +} + +// ValidationParams defines model for validation.Params. +type ValidationParams struct { + // Allowed Allowed: oneOf. + Allowed *[]string `json:"allowed,omitempty"` + + // Expected Expected: type, mismatch. + Expected *string `json:"expected,omitempty"` + + // Field Field is the pointer of the other field: min and max compared with a + // field, exclusive, dependsOn. + Field *string `json:"field,omitempty"` + + // Max Max: range, max, maxLength, maxItems. + Max *int `json:"max,omitempty"` + + // Min Min: range, min. + Min *int `json:"min,omitempty"` + + // Unit Unit: maxLength. + Unit *ValidationUnit `json:"unit,omitempty"` + + // Value Value: unsupported. + Value *string `json:"value,omitempty"` +} + +// ValidationRule defines model for validation.Rule. +type ValidationRule string + +// ValidationUnit defines model for validation.Unit. +type ValidationUnit string + +// ValidationViolation defines model for validation.Violation. +type ValidationViolation struct { + Detail string `json:"detail"` + Params *ValidationParams `json:"params,omitempty"` + Pointer string `json:"pointer"` + Rule ValidationRule `json:"rule"` +} + +// ListAlertChannelsParams defines parameters for ListAlertChannels. +type ListAlertChannelsParams struct { + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + Limit *int `form:"limit,omitempty" json:"limit,omitempty"` +} + +// ListAlertChannelDeliveriesParams defines parameters for ListAlertChannelDeliveries. +type ListAlertChannelDeliveriesParams struct { + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + Limit *int `form:"limit,omitempty" json:"limit,omitempty"` + Status *ListAlertChannelDeliveriesParamsStatus `form:"status,omitempty" json:"status,omitempty"` +} + +// ListAlertChannelDeliveriesParamsStatus defines parameters for ListAlertChannelDeliveries. +type ListAlertChannelDeliveriesParamsStatus string + +// ListIncidentsParams defines parameters for ListIncidents. +type ListIncidentsParams struct { + // Acknowledged Acknowledged: true for incidents someone acknowledged, false for + // the others. + Acknowledged *ListIncidentsParamsAcknowledged `form:"acknowledged,omitempty" json:"acknowledged,omitempty"` + + // Aspect Aspect is what the incident is about. + Aspect *ListIncidentsParamsAspect `form:"aspect,omitempty" json:"aspect,omitempty"` + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + + // From From and To bound when the incident started: from inclusive, to + // exclusive (RFC 3339). + From *time.Time `form:"from,omitempty" json:"from,omitempty"` + Limit *int `form:"limit,omitempty" json:"limit,omitempty"` + MonitorId *openapi_types.UUID `form:"monitorId,omitempty" json:"monitorId,omitempty"` + + // Q Q is part of the monitor's name or target, any case. + Q *string `form:"q,omitempty" json:"q,omitempty"` + + // Severity Severity matches an open incident's current severity and a resolved + // one's peak severity (how bad it got). + Severity *ListIncidentsParamsSeverity `form:"severity,omitempty" json:"severity,omitempty"` + Status *ListIncidentsParamsStatus `form:"status,omitempty" json:"status,omitempty"` + To *time.Time `form:"to,omitempty" json:"to,omitempty"` +} + +// ListIncidentsParamsAcknowledged defines parameters for ListIncidents. +type ListIncidentsParamsAcknowledged string + +// ListIncidentsParamsAspect defines parameters for ListIncidents. +type ListIncidentsParamsAspect string + +// ListIncidentsParamsSeverity defines parameters for ListIncidents. +type ListIncidentsParamsSeverity string + +// ListIncidentsParamsStatus defines parameters for ListIncidents. +type ListIncidentsParamsStatus string + +// ListMonitorsParams defines parameters for ListMonitors. +type ListMonitorsParams struct { + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + + // Include Include is a comma-separated list of optional row parts: history + // adds each row's last 60 check results. + Include *ListMonitorsParamsInclude `form:"include,omitempty" json:"include,omitempty"` + Limit *int `form:"limit,omitempty" json:"limit,omitempty"` + Q *string `form:"q,omitempty" json:"q,omitempty"` + + // Sort Sort: status (default, by overall status: critical, warning, + // pending, ok, paused, then name), name (A to Z), lastChecked (most recent first), uptime + // (lowest over last24h first; no data, and SSL and domain monitors, + // last), created (newest first). + // A cursor only continues the sort it came from. + Sort *ListMonitorsParamsSort `form:"sort,omitempty" json:"sort,omitempty"` + + // Status Status matches the overall status (the worst of the monitor's status + // and its watched aspects'). + Status *ListMonitorsParamsStatus `form:"status,omitempty" json:"status,omitempty"` + Type *ListMonitorsParamsType `form:"type,omitempty" json:"type,omitempty"` +} + +// ListMonitorsParamsInclude defines parameters for ListMonitors. +type ListMonitorsParamsInclude string + +// ListMonitorsParamsSort defines parameters for ListMonitors. +type ListMonitorsParamsSort string + +// ListMonitorsParamsStatus defines parameters for ListMonitors. +type ListMonitorsParamsStatus string + +// ListMonitorsParamsType defines parameters for ListMonitors. +type ListMonitorsParamsType string + +// GetMonitorAvailabilityParams defines parameters for GetMonitorAvailability. +type GetMonitorAvailabilityParams struct { + // Days Days is how many UTC days, ending today, the bar covers (default 90). + Days *int `form:"days,omitempty" json:"days,omitempty"` +} + +// ListMonitorResultsParams defines parameters for ListMonitorResults. +type ListMonitorResultsParams struct { + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + From *time.Time `form:"from,omitempty" json:"from,omitempty"` + Limit *int `form:"limit,omitempty" json:"limit,omitempty"` + To *time.Time `form:"to,omitempty" json:"to,omitempty"` +} + +// GetMonitorStatsParams defines parameters for GetMonitorStats. +type GetMonitorStatsParams struct { + Range GetMonitorStatsParamsRange `form:"range" json:"range"` +} + +// GetMonitorStatsParamsRange defines parameters for GetMonitorStats. +type GetMonitorStatsParamsRange string + +// ListMonitorStatusChangesParams defines parameters for ListMonitorStatusChanges. +type ListMonitorStatusChangesParams struct { + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + Limit *int `form:"limit,omitempty" json:"limit,omitempty"` +} + +// ListStatusPagesParams defines parameters for ListStatusPages. +type ListStatusPagesParams struct { + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + Limit *int `form:"limit,omitempty" json:"limit,omitempty"` + + // MonitorId MonitorID lists the pages that show this monitor instead (at most 50, + // not paginated). + MonitorId *openapi_types.UUID `form:"monitorId,omitempty" json:"monitorId,omitempty"` +} + +// ListStatusPageIncidentsParams defines parameters for ListStatusPageIncidents. +type ListStatusPageIncidentsParams struct { + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + Limit *int `form:"limit,omitempty" json:"limit,omitempty"` + + // Status Status filters on open or resolved. + Status *ListStatusPageIncidentsParamsStatus `form:"status,omitempty" json:"status,omitempty"` +} + +// ListStatusPageIncidentsParamsStatus defines parameters for ListStatusPageIncidents. +type ListStatusPageIncidentsParamsStatus string + +// CreateAlertChannelJSONRequestBody defines body for CreateAlertChannel for application/json ContentType. +type CreateAlertChannelJSONRequestBody = DtoAlertChannelCreate + +// UpdateAlertChannelJSONRequestBody defines body for UpdateAlertChannel for application/json ContentType. +type UpdateAlertChannelJSONRequestBody = DtoAlertChannelUpdate + +// ConfirmAlertChannelVerificationJSONRequestBody defines body for ConfirmAlertChannelVerification for application/json ContentType. +type ConfirmAlertChannelVerificationJSONRequestBody = DtoAlertChannelVerifyConfirm + +// CreateMonitorJSONRequestBody defines body for CreateMonitor for application/json ContentType. +type CreateMonitorJSONRequestBody = DtoMonitorCreate + +// ApplyMonitorBulkActionJSONRequestBody defines body for ApplyMonitorBulkAction for application/json ContentType. +type ApplyMonitorBulkActionJSONRequestBody = DtoMonitorBulkRequest + +// UpdateMonitorJSONRequestBody defines body for UpdateMonitor for application/json ContentType. +type UpdateMonitorJSONRequestBody = DtoMonitorUpdate + +// SetMonitorAlertsJSONRequestBody defines body for SetMonitorAlerts for application/json ContentType. +type SetMonitorAlertsJSONRequestBody = DtoMonitorAlertsUpdate + +// CreateStatusPageJSONRequestBody defines body for CreateStatusPage for application/json ContentType. +type CreateStatusPageJSONRequestBody = DtoStatusPageCreate + +// UpdateStatusPageJSONRequestBody defines body for UpdateStatusPage for application/json ContentType. +type UpdateStatusPageJSONRequestBody = DtoStatusPageUpdate + +// CreateStatusPageIncidentJSONRequestBody defines body for CreateStatusPageIncident for application/json ContentType. +type CreateStatusPageIncidentJSONRequestBody = DtoStatusPageIncidentCreate + +// UpdateStatusPageIncidentJSONRequestBody defines body for UpdateStatusPageIncident for application/json ContentType. +type UpdateStatusPageIncidentJSONRequestBody = DtoStatusPageIncidentUpdate + +// CreateStatusPageIncidentUpdateJSONRequestBody defines body for CreateStatusPageIncidentUpdate for application/json ContentType. +type CreateStatusPageIncidentUpdateJSONRequestBody = DtoStatusPageIncidentPost + +// SetStatusPageLayoutJSONRequestBody defines body for SetStatusPageLayout for application/json ContentType. +type SetStatusPageLayoutJSONRequestBody = DtoStatusPageLayout + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Doer performs HTTP requests. +// +// The standard http.Client implements this interface. +type HttpRequestDoer interface { + Do(req *http.Request) (*http.Response, error) +} + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client HttpRequestDoer + + // A list of callbacks for modifying requests which are generated before sending over + // the network. + RequestEditors []RequestEditorFn +} + +// ClientOption allows setting custom parameters during construction +type ClientOption func(*Client) error + +// Creates a new Client, with reasonable defaults +func NewClient(server string, opts ...ClientOption) (*Client, error) { + // create a client with sane default values + client := Client{ + Server: server, + } + // mutate client and add all optional params + for _, o := range opts { + if err := o(&client); err != nil { + return nil, err + } + } + // ensure the server URL always has a trailing slash + if !strings.HasSuffix(client.Server, "/") { + client.Server += "/" + } + // create httpClient, if not already present + if client.Client == nil { + client.Client = &http.Client{} + } + return &client, nil +} + +// WithHTTPClient allows overriding the default Doer, which is +// automatically created using http.Client. This is useful for tests. +func WithHTTPClient(doer HttpRequestDoer) ClientOption { + return func(c *Client) error { + c.Client = doer + return nil + } +} + +// WithRequestEditorFn allows setting up a callback function, which will be +// called right before sending the request. This can be used to mutate the request. +func WithRequestEditorFn(fn RequestEditorFn) ClientOption { + return func(c *Client) error { + c.RequestEditors = append(c.RequestEditors, fn) + return nil + } +} + +// The interface specification for the client above. +type ClientInterface interface { + // ListAlertChannels request + ListAlertChannels(ctx context.Context, params *ListAlertChannelsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateAlertChannelWithBody request with any body + CreateAlertChannelWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CreateAlertChannel(ctx context.Context, body CreateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteAlertChannel request + DeleteAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetAlertChannel request + GetAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateAlertChannelWithBody request with any body + UpdateAlertChannelWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + UpdateAlertChannel(ctx context.Context, id openapi_types.UUID, body UpdateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListAlertChannelDeliveries request + ListAlertChannelDeliveries(ctx context.Context, id openapi_types.UUID, params *ListAlertChannelDeliveriesParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // TestAlertChannel request + TestAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // SendAlertChannelVerification request + SendAlertChannelVerification(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ConfirmAlertChannelVerificationWithBody request with any body + ConfirmAlertChannelVerificationWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + ConfirmAlertChannelVerification(ctx context.Context, id openapi_types.UUID, body ConfirmAlertChannelVerificationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListIncidents request + ListIncidents(ctx context.Context, params *ListIncidentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetIncidentSummary request + GetIncidentSummary(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetIncident request + GetIncident(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // AcknowledgeIncident request + AcknowledgeIncident(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListMonitors request + ListMonitors(ctx context.Context, params *ListMonitorsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateMonitorWithBody request with any body + CreateMonitorWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CreateMonitor(ctx context.Context, body CreateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ApplyMonitorBulkActionWithBody request with any body + ApplyMonitorBulkActionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + ApplyMonitorBulkAction(ctx context.Context, body ApplyMonitorBulkActionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteMonitor request + DeleteMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetMonitor request + GetMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateMonitorWithBody request with any body + UpdateMonitorWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + UpdateMonitor(ctx context.Context, id openapi_types.UUID, body UpdateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetMonitorAlerts request + GetMonitorAlerts(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // SetMonitorAlertsWithBody request with any body + SetMonitorAlertsWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + SetMonitorAlerts(ctx context.Context, id openapi_types.UUID, body SetMonitorAlertsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetMonitorAvailability request + GetMonitorAvailability(ctx context.Context, id openapi_types.UUID, params *GetMonitorAvailabilityParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetMonitorCertificate request + GetMonitorCertificate(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // RunMonitorCheck request + RunMonitorCheck(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PauseMonitor request + PauseMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListMonitorResults request + ListMonitorResults(ctx context.Context, id openapi_types.UUID, params *ListMonitorResultsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ResumeMonitor request + ResumeMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetMonitorStats request + GetMonitorStats(ctx context.Context, id openapi_types.UUID, params *GetMonitorStatsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListMonitorStatusChanges request + ListMonitorStatusChanges(ctx context.Context, id openapi_types.UUID, params *ListMonitorStatusChangesParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListStatusPages request + ListStatusPages(ctx context.Context, params *ListStatusPagesParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateStatusPageWithBody request with any body + CreateStatusPageWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CreateStatusPage(ctx context.Context, body CreateStatusPageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteStatusPage request + DeleteStatusPage(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetStatusPage request + GetStatusPage(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateStatusPageWithBody request with any body + UpdateStatusPageWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + UpdateStatusPage(ctx context.Context, id openapi_types.UUID, body UpdateStatusPageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListStatusPageIncidents request + ListStatusPageIncidents(ctx context.Context, id openapi_types.UUID, params *ListStatusPageIncidentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateStatusPageIncidentWithBody request with any body + CreateStatusPageIncidentWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CreateStatusPageIncident(ctx context.Context, id openapi_types.UUID, body CreateStatusPageIncidentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetStatusPageIncident request + GetStatusPageIncident(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateStatusPageIncidentWithBody request with any body + UpdateStatusPageIncidentWithBody(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + UpdateStatusPageIncident(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, body UpdateStatusPageIncidentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateStatusPageIncidentUpdateWithBody request with any body + CreateStatusPageIncidentUpdateWithBody(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CreateStatusPageIncidentUpdate(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, body CreateStatusPageIncidentUpdateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetStatusPageLayout request + GetStatusPageLayout(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // SetStatusPageLayoutWithBody request with any body + SetStatusPageLayoutWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + SetStatusPageLayout(ctx context.Context, id openapi_types.UUID, body SetStatusPageLayoutJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PreviewStatusPage request + PreviewStatusPage(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateStatusPagePreviewLink request + CreateStatusPagePreviewLink(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PublishStatusPage request + PublishStatusPage(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UnpublishStatusPage request + UnpublishStatusPage(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) } -// DtoAlertChannelKind Kind is how the channel delivers. voice is a voice-call channel made -// before calls were withdrawn: it stays disabled and gets no alerts; -// it can be renamed or deleted. -type DtoAlertChannelKind string +func (c *Client) ListAlertChannels(ctx context.Context, params *ListAlertChannelsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListAlertChannelsRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} -// DtoAlertChannelCreate defines model for dto.AlertChannelCreate. -type DtoAlertChannelCreate struct { - // IsDefault IsDefault channels get the alerts of monitors without their own - // alert settings. - IsDefault *bool `json:"isDefault,omitempty"` - Kind DtoAlertChannelCreateKind `json:"kind"` - Name string `json:"name"` - Settings DtoAlertChannelSettingsInput `json:"settings"` +func (c *Client) CreateAlertChannelWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateAlertChannelRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoAlertChannelCreateKind defines model for DtoAlertChannelCreate.Kind. -type DtoAlertChannelCreateKind string +func (c *Client) CreateAlertChannel(ctx context.Context, body CreateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateAlertChannelRequest(c.Server, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} -// DtoAlertChannelSettings defines model for dto.AlertChannelSettings. -type DtoAlertChannelSettings struct { - Address *string `json:"address,omitempty"` - Hint *string `json:"hint,omitempty"` - Members *bool `json:"members,omitempty"` - Phone *string `json:"phone,omitempty"` - Url *string `json:"url,omitempty"` +func (c *Client) DeleteAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteAlertChannelRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoAlertChannelSettingsInput defines model for dto.AlertChannelSettingsInput. -type DtoAlertChannelSettingsInput struct { - Address *string `json:"address,omitempty"` - Members *bool `json:"members,omitempty"` - Phone *string `json:"phone,omitempty"` - SigningSecret *string `json:"signingSecret,omitempty"` - Url *string `json:"url,omitempty"` +func (c *Client) GetAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetAlertChannelRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) UpdateAlertChannelWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateAlertChannelRequestWithBody(c.Server, id, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) UpdateAlertChannel(ctx context.Context, id openapi_types.UUID, body UpdateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateAlertChannelRequest(c.Server, id, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ListAlertChannelDeliveries(ctx context.Context, id openapi_types.UUID, params *ListAlertChannelDeliveriesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListAlertChannelDeliveriesRequest(c.Server, id, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) TestAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewTestAlertChannelRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) SendAlertChannelVerification(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewSendAlertChannelVerificationRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ConfirmAlertChannelVerificationWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewConfirmAlertChannelVerificationRequestWithBody(c.Server, id, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ConfirmAlertChannelVerification(ctx context.Context, id openapi_types.UUID, body ConfirmAlertChannelVerificationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewConfirmAlertChannelVerificationRequest(c.Server, id, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ListIncidents(ctx context.Context, params *ListIncidentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListIncidentsRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetIncidentSummary(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetIncidentSummaryRequest(c.Server) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetIncident(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetIncidentRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) AcknowledgeIncident(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAcknowledgeIncidentRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ListMonitors(ctx context.Context, params *ListMonitorsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListMonitorsRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CreateMonitorWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateMonitorRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CreateMonitor(ctx context.Context, body CreateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateMonitorRequest(c.Server, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoAlertChannelTestResult defines model for dto.AlertChannelTestResult. -type DtoAlertChannelTestResult struct { - ProviderRef string `json:"providerRef"` +func (c *Client) ApplyMonitorBulkActionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewApplyMonitorBulkActionRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoAlertChannelUpdate defines model for dto.AlertChannelUpdate. -type DtoAlertChannelUpdate struct { - Enabled *bool `json:"enabled,omitempty"` - IsDefault *bool `json:"isDefault,omitempty"` - Name *string `json:"name,omitempty"` - RotateSecret *bool `json:"rotateSecret,omitempty"` - Settings *DtoAlertChannelSettingsInput `json:"settings,omitempty"` +func (c *Client) ApplyMonitorBulkAction(ctx context.Context, body ApplyMonitorBulkActionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewApplyMonitorBulkActionRequest(c.Server, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoAlertChannelVerifyConfirm defines model for dto.AlertChannelVerifyConfirm. -type DtoAlertChannelVerifyConfirm struct { - Code string `json:"code"` +func (c *Client) DeleteMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteMonitorRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoAlertChannelWithSecret defines model for dto.AlertChannelWithSecret. -type DtoAlertChannelWithSecret struct { - CreatedAt string `json:"createdAt"` - Enabled bool `json:"enabled"` - Id openapi_types.UUID `json:"id"` - IsDefault bool `json:"isDefault"` - - // Kind Kind is how the channel delivers. voice is a voice-call channel made - // before calls were withdrawn: it stays disabled and gets no alerts; - // it can be renamed or deleted. - Kind DtoAlertChannelWithSecretKind `json:"kind"` - Name string `json:"name"` - Settings DtoAlertChannelSettings `json:"settings"` - SigningSecret *string `json:"signingSecret,omitempty"` - UpdatedAt string `json:"updatedAt"` - - // Verified Verified is false for an SMS or email-address channel until - // its contact confirmed a code; such a channel gets no alerts. - Verified bool `json:"verified"` +func (c *Client) GetMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetMonitorRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoAlertChannelWithSecretKind Kind is how the channel delivers. voice is a voice-call channel made -// before calls were withdrawn: it stays disabled and gets no alerts; -// it can be renamed or deleted. -type DtoAlertChannelWithSecretKind string - -// DtoAvailability defines model for dto.Availability. -type DtoAvailability struct { - Checks int `json:"checks"` - Critical int `json:"critical"` - Days []DtoDayAvailability `json:"days"` - DowntimeMinutes int `json:"downtimeMinutes"` - From string `json:"from"` - Inconclusive int `json:"inconclusive"` - Ok int `json:"ok"` - To string `json:"to"` - - // UptimePercent UptimePercent is (ok + warning) / (ok + warning + critical); absent - // without conclusive checks, and for SSL and domain monitors (no - // uptime: their downtime is always 0). - UptimePercent *float32 `json:"uptimePercent,omitempty"` - Warning int `json:"warning"` +func (c *Client) UpdateMonitorWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateMonitorRequestWithBody(c.Server, id, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoCertificate defines model for dto.Certificate. -type DtoCertificate struct { - // Chain Chain is what the server presented, leaf first; absent on results - // recorded before chains were kept. - Chain *[]DtoChainCertificate `json:"chain,omitempty"` - ChainValid bool `json:"chainValid"` - DaysRemaining int `json:"daysRemaining"` - - // DnsNames DNSNames are the subject alternative names (SANs). - DnsNames *[]string `json:"dnsNames,omitempty"` - - // FingerprintSha256 FingerprintSHA256 is the SHA-256 of the certificate (DER), hex. - FingerprintSha256 *string `json:"fingerprintSha256,omitempty"` - HostnameValid bool `json:"hostnameValid"` - Issuer string `json:"issuer"` - IssuerOrg *string `json:"issuerOrg,omitempty"` - NotAfter string `json:"notAfter"` - NotBefore string `json:"notBefore"` - SerialNumber *string `json:"serialNumber,omitempty"` - - // SignatureAlgorithm SignatureAlgorithm as Go names it ("SHA256-RSA", "ECDSA-SHA384"). - SignatureAlgorithm *string `json:"signatureAlgorithm,omitempty"` - Subject string `json:"subject"` - - // VerifiedChainLength VerifiedChainLength counts the certificates from the leaf to a - // trusted root, root included; absent when the chain doesn't verify. - VerifiedChainLength *int `json:"verifiedChainLength,omitempty"` +func (c *Client) UpdateMonitor(ctx context.Context, id openapi_types.UUID, body UpdateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateMonitorRequest(c.Server, id, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoCertificateRenewal defines model for dto.CertificateRenewal. -type DtoCertificateRenewal struct { - Current DtoRenewedCertificate `json:"current"` - Previous DtoRenewedCertificate `json:"previous"` +func (c *Client) GetMonitorAlerts(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetMonitorAlertsRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoChainCertificate defines model for dto.ChainCertificate. -type DtoChainCertificate struct { - IsCA bool `json:"isCA"` - Issuer string `json:"issuer"` - NotAfter string `json:"notAfter"` - NotBefore string `json:"notBefore"` - Subject string `json:"subject"` +func (c *Client) SetMonitorAlertsWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewSetMonitorAlertsRequestWithBody(c.Server, id, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoChannelDelivery defines model for dto.ChannelDelivery. -type DtoChannelDelivery struct { - Attempts int `json:"attempts"` - CreatedAt string `json:"createdAt"` - Event DtoChannelDeliveryEvent `json:"event"` - Id openapi_types.UUID `json:"id"` - - // IncidentId IncidentID is absent for an alert outside an incident. - IncidentId *openapi_types.UUID `json:"incidentId,omitempty"` - LastError *string `json:"lastError,omitempty"` - MonitorId openapi_types.UUID `json:"monitorId"` - MonitorName string `json:"monitorName"` - - // NextAttemptAt NextAttemptAt is set while pending. - NextAttemptAt *string `json:"nextAttemptAt,omitempty"` - SentAt *string `json:"sentAt,omitempty"` - - // Status Status: pending (queued or waiting to retry), sent, dead (gave up). - Status DtoChannelDeliveryStatus `json:"status"` +func (c *Client) SetMonitorAlerts(ctx context.Context, id openapi_types.UUID, body SetMonitorAlertsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewSetMonitorAlertsRequest(c.Server, id, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoChannelDeliveryEvent defines model for DtoChannelDelivery.Event. -type DtoChannelDeliveryEvent string +func (c *Client) GetMonitorAvailability(ctx context.Context, id openapi_types.UUID, params *GetMonitorAvailabilityParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetMonitorAvailabilityRequest(c.Server, id, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} -// DtoChannelDeliveryStatus Status: pending (queued or waiting to retry), sent, dead (gave up). -type DtoChannelDeliveryStatus string +func (c *Client) GetMonitorCertificate(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetMonitorCertificateRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} -// DtoCheckRegion defines model for dto.CheckRegion. -type DtoCheckRegion struct { - // Code Code is the AWS region code, as results' region carries it. - Code string `json:"code"` +func (c *Client) RunMonitorCheck(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRunMonitorCheckRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // Name Name is the city people know the region by. - Name string `json:"name"` +func (c *Client) PauseMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPauseMonitorRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoCheckResult defines model for dto.CheckResult. -type DtoCheckResult struct { - Certificate *DtoCertificate `json:"certificate,omitempty"` - CheckedAt string `json:"checkedAt"` - Condition string `json:"condition"` - Domain *DtoDomainRegistration `json:"domain,omitempty"` - ErrorMessage *string `json:"errorMessage,omitempty"` - Id int `json:"id"` - Redirects *[]string `json:"redirects,omitempty"` - Region string `json:"region"` - Severity DtoCheckResultSeverity `json:"severity"` - StatusCode *int `json:"statusCode,omitempty"` - Timings DtoCheckTimings `json:"timings"` +func (c *Client) ListMonitorResults(ctx context.Context, id openapi_types.UUID, params *ListMonitorResultsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListMonitorResultsRequest(c.Server, id, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoCheckResultSeverity defines model for DtoCheckResult.Severity. -type DtoCheckResultSeverity string +func (c *Client) ResumeMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewResumeMonitorRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} -// DtoCheckTimings defines model for dto.CheckTimings. -type DtoCheckTimings struct { - ConnectMs *int `json:"connectMs,omitempty"` - DnsMs *int `json:"dnsMs,omitempty"` - RedirectMs *int `json:"redirectMs,omitempty"` - TlsMs *int `json:"tlsMs,omitempty"` - TotalMs int `json:"totalMs"` - TtfbMs *int `json:"ttfbMs,omitempty"` +func (c *Client) GetMonitorStats(ctx context.Context, id openapi_types.UUID, params *GetMonitorStatsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetMonitorStatsRequest(c.Server, id, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoConditionFacts defines model for dto.ConditionFacts. -type DtoConditionFacts struct { - DaysRemaining *int `json:"daysRemaining,omitempty"` - ExpiresAt *string `json:"expiresAt,omitempty"` +func (c *Client) ListMonitorStatusChanges(ctx context.Context, id openapi_types.UUID, params *ListMonitorStatusChangesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListMonitorStatusChangesRequest(c.Server, id, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // ResponseTimeMs ResponseTimeMs and SlowThresholdMs: a slow response's time and the - // threshold it went over (slow_response only). - ResponseTimeMs *int `json:"responseTimeMs,omitempty"` - SlowThresholdMs *int `json:"slowThresholdMs,omitempty"` - StatusCode *int `json:"statusCode,omitempty"` +func (c *Client) ListStatusPages(ctx context.Context, params *ListStatusPagesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListStatusPagesRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // ThresholdDays ThresholdDays is the smallest expiry threshold the expiry is within. - ThresholdDays *int `json:"thresholdDays,omitempty"` +func (c *Client) CreateStatusPageWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateStatusPageRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoDayAvailability defines model for dto.DayAvailability. -type DtoDayAvailability struct { - Checks int `json:"checks"` - Critical int `json:"critical"` +func (c *Client) CreateStatusPage(ctx context.Context, body CreateStatusPageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateStatusPageRequest(c.Server, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // Date Date is the UTC day, YYYY-MM-DD. - Date string `json:"date"` +func (c *Client) DeleteStatusPage(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteStatusPageRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // DowntimeMinutes DowntimeMinutes estimates the time spent down: the share of - // critical checks among the conclusive ones times the minutes the - // day's checks cover. A warning is not downtime. - DowntimeMinutes int `json:"downtimeMinutes"` - Inconclusive int `json:"inconclusive"` +func (c *Client) GetStatusPage(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetStatusPageRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // NoData NoData: no checks that day (draw it gray, never as up). - NoData bool `json:"noData"` - Ok int `json:"ok"` - UptimePercent *float32 `json:"uptimePercent,omitempty"` - Warning int `json:"warning"` +func (c *Client) UpdateStatusPageWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateStatusPageRequestWithBody(c.Server, id, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoDomainRegistration defines model for dto.DomainRegistration. -type DtoDomainRegistration struct { - // CheckedAt CheckedAt is when the registry was asked (lookups are cached up to - // an hour). - CheckedAt string `json:"checkedAt"` +func (c *Client) UpdateStatusPage(ctx context.Context, id openapi_types.UUID, body UpdateStatusPageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateStatusPageRequest(c.Server, id, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // DaysRemaining DaysRemaining is 0 on the expiry day, negative after it. - DaysRemaining *int `json:"daysRemaining,omitempty"` +func (c *Client) ListStatusPageIncidents(ctx context.Context, id openapi_types.UUID, params *ListStatusPageIncidentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListStatusPageIncidentsRequest(c.Server, id, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // Dnssec DNSSEC: signed when the registry holds DS records for the domain; - // absent when the registry doesn't say. - Dnssec *DtoDomainRegistrationDnssec `json:"dnssec,omitempty"` - Domain string `json:"domain"` +func (c *Client) CreateStatusPageIncidentWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateStatusPageIncidentRequestWithBody(c.Server, id, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // ExpiresAt ExpiresAt is the expiry date at 00:00 UTC; absent when the registry - // publishes none. - ExpiresAt *string `json:"expiresAt,omitempty"` +func (c *Client) CreateStatusPageIncident(ctx context.Context, id openapi_types.UUID, body CreateStatusPageIncidentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateStatusPageIncidentRequest(c.Server, id, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // Nameservers Nameservers are the delegation's nameservers, lower case, in the - // registry's order; [] when unknown (results recorded before they were - // kept, registries that publish none). - Nameservers []string `json:"nameservers"` - Registered bool `json:"registered"` +func (c *Client) GetStatusPageIncident(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetStatusPageIncidentRequest(c.Server, id, incidentId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // RegisteredAt RegisteredAt is the registration (creation) date at 00:00 UTC, and - // UpdatedAt the registry's last change of it; absent when the registry - // doesn't publish them (and for dns answers). - RegisteredAt *string `json:"registeredAt,omitempty"` - Registrar *string `json:"registrar,omitempty"` - Source DtoDomainRegistrationSource `json:"source"` +func (c *Client) UpdateStatusPageIncidentWithBody(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateStatusPageIncidentRequestWithBody(c.Server, id, incidentId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // StatusCodes StatusCodes are the EPP status codes (RFC 5731), e.g. ok, - // clientTransferProhibited, serverHold, pendingDelete, - // redemptionPeriod; [] when unknown (dns answers). - StatusCodes []string `json:"statusCodes"` - UpdatedAt *string `json:"updatedAt,omitempty"` +func (c *Client) UpdateStatusPageIncident(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, body UpdateStatusPageIncidentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateStatusPageIncidentRequest(c.Server, id, incidentId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoDomainRegistrationDnssec DNSSEC: signed when the registry holds DS records for the domain; -// absent when the registry doesn't say. -type DtoDomainRegistrationDnssec string +func (c *Client) CreateStatusPageIncidentUpdateWithBody(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateStatusPageIncidentUpdateRequestWithBody(c.Server, id, incidentId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} -// DtoDomainRegistrationSource defines model for DtoDomainRegistration.Source. -type DtoDomainRegistrationSource string +func (c *Client) CreateStatusPageIncidentUpdate(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, body CreateStatusPageIncidentUpdateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateStatusPageIncidentUpdateRequest(c.Server, id, incidentId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} -// DtoDomainSettings defines model for dto.DomainSettings. -type DtoDomainSettings struct { - Domain string `json:"domain"` - ExpiryThresholdsDays []int `json:"expiryThresholdsDays"` +func (c *Client) GetStatusPageLayout(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetStatusPageLayoutRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoDomainSettingsInput defines model for dto.DomainSettingsInput. -type DtoDomainSettingsInput struct { - Domain string `json:"domain"` - ExpiryThresholdsDays []int `json:"expiryThresholdsDays"` +func (c *Client) SetStatusPageLayoutWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewSetStatusPageLayoutRequestWithBody(c.Server, id, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoExpiryWatch defines model for dto.ExpiryWatch. -type DtoExpiryWatch struct { - ThresholdsDays []int `json:"thresholdsDays"` +func (c *Client) SetStatusPageLayout(ctx context.Context, id openapi_types.UUID, body SetStatusPageLayoutJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewSetStatusPageLayoutRequest(c.Server, id, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoExpiryWatchInput defines model for dto.ExpiryWatchInput. -type DtoExpiryWatchInput struct { - // ThresholdsDays ThresholdsDays are the expiry warnings, in days before expiry. - ThresholdsDays []int `json:"thresholdsDays"` +func (c *Client) PreviewStatusPage(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPreviewStatusPageRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoHTTPHeader defines model for dto.HTTPHeader. -type DtoHTTPHeader struct { - Name string `json:"name"` - Secret bool `json:"secret"` - Value *string `json:"value,omitempty"` +func (c *Client) CreateStatusPagePreviewLink(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateStatusPagePreviewLinkRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoHTTPHeaderInput defines model for dto.HTTPHeaderInput. -type DtoHTTPHeaderInput struct { - Name string `json:"name"` - Secret *bool `json:"secret,omitempty"` - Value *string `json:"value,omitempty"` +func (c *Client) PublishStatusPage(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPublishStatusPageRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoHTTPSettings defines model for dto.HTTPSettings. -type DtoHTTPSettings struct { - // CertificateExpiry CertificateExpiry and DomainExpiry are the watches that are on; - // absent when off. - CertificateExpiry *DtoExpiryWatch `json:"certificateExpiry,omitempty"` - DomainExpiry *DtoExpiryWatch `json:"domainExpiry,omitempty"` - ExpectedStatus []string `json:"expectedStatus"` - FollowRedirects bool `json:"followRedirects"` - Headers []DtoHTTPHeader `json:"headers"` - Keyword *string `json:"keyword,omitempty"` - KeywordCaseSensitive bool `json:"keywordCaseSensitive"` - KeywordMode *string `json:"keywordMode,omitempty"` - MaxRedirects int `json:"maxRedirects"` - Method string `json:"method"` - RequestBody *string `json:"requestBody,omitempty"` - RequestBodyContentType *string `json:"requestBodyContentType,omitempty"` - SlowThresholdMs *int `json:"slowThresholdMs,omitempty"` - TimeoutMs int `json:"timeoutMs"` - Url string `json:"url"` - VerifyTls bool `json:"verifyTls"` +func (c *Client) UnpublishStatusPage(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUnpublishStatusPageRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } -// DtoHTTPSettingsInput defines model for dto.HTTPSettingsInput. -type DtoHTTPSettingsInput struct { - // CertificateExpiry CertificateExpiry watches the expiry of the certificate the URL - // presents (https:// URLs only), judged with every check; omit it to - // leave the watch off. - CertificateExpiry *DtoExpiryWatchInput `json:"certificateExpiry,omitempty"` +// NewListAlertChannelsRequest generates requests for ListAlertChannels +func NewListAlertChannelsRequest(server string, params *ListAlertChannelsParams) (*http.Request, error) { + var err error - // DomainExpiry DomainExpiry watches the registration of the URL's registrable - // domain (shop.example.com watches example.com), looked up twice a - // day; omit it to leave the watch off. Not for IP addresses. - DomainExpiry *DtoExpiryWatchInput `json:"domainExpiry,omitempty"` - ExpectedStatus []string `json:"expectedStatus"` - FollowRedirects bool `json:"followRedirects"` - Headers *[]DtoHTTPHeaderInput `json:"headers,omitempty"` + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // Keyword Keyword is looked for in the first 256 KiB of the response body. - Keyword *string `json:"keyword,omitempty"` - KeywordCaseSensitive *bool `json:"keywordCaseSensitive,omitempty"` - KeywordMode *DtoHTTPSettingsInputKeywordMode `json:"keywordMode,omitempty"` - MaxRedirects int `json:"maxRedirects"` - Method DtoHTTPSettingsInputMethod `json:"method"` - RequestBody *string `json:"requestBody,omitempty"` - RequestBodyContentType *string `json:"requestBodyContentType,omitempty"` - SlowThresholdMs *int `json:"slowThresholdMs,omitempty"` - TimeoutMs int `json:"timeoutMs"` - Url string `json:"url"` - VerifyTls bool `json:"verifyTls"` -} + operationPath := fmt.Sprintf("/alert-channels") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } -// DtoHTTPSettingsInputKeywordMode defines model for DtoHTTPSettingsInput.KeywordMode. -type DtoHTTPSettingsInputKeywordMode string + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } -// DtoHTTPSettingsInputMethod defines model for DtoHTTPSettingsInput.Method. -type DtoHTTPSettingsInputMethod string + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string -// DtoHistoryBeat defines model for dto.HistoryBeat. -type DtoHistoryBeat struct { - CheckedAt string `json:"checkedAt"` - Condition string `json:"condition"` - ResponseTimeMs int `json:"responseTimeMs"` - ResultId int `json:"resultId"` - Severity DtoHistoryBeatSeverity `json:"severity"` - StatusCode *int `json:"statusCode,omitempty"` + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil } -// DtoHistoryBeatSeverity defines model for DtoHistoryBeat.Severity. -type DtoHistoryBeatSeverity string +// NewCreateAlertChannelRequest calls the generic CreateAlertChannel builder with application/json body +func NewCreateAlertChannelRequest(server string, body CreateAlertChannelJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateAlertChannelRequestWithBody(server, "application/json", bodyReader) +} -// DtoIncident defines model for dto.Incident. -type DtoIncident struct { - AcknowledgedAt *string `json:"acknowledgedAt,omitempty"` - AcknowledgedBy *openapi_types.UUID `json:"acknowledgedBy,omitempty"` +// NewCreateAlertChannelRequestWithBody generates requests for CreateAlertChannel with any type of body +func NewCreateAlertChannelRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error - // Aspect Aspect is what the incident is about. - Aspect DtoIncidentAspect `json:"aspect"` + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // Condition Condition is what the latest check that changed the incident found; - // summary is its message, facts its facts. - Condition string `json:"condition"` + operationPath := fmt.Sprintf("/alert-channels") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - // DurationSeconds DurationSeconds is how long it lasted (or has lasted so far). - DurationSeconds int `json:"durationSeconds"` - Facts DtoConditionFacts `json:"facts"` - Id openapi_types.UUID `json:"id"` - MonitorId openapi_types.UUID `json:"monitorId"` - MonitorName string `json:"monitorName"` - MonitorTarget string `json:"monitorTarget"` - MonitorType DtoIncidentMonitorType `json:"monitorType"` + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // MonitorVariant MonitorVariant names what the monitor does, as on monitor rows - // (keyword for an HTTP monitor with a keyword). - MonitorVariant DtoIncidentMonitorVariant `json:"monitorVariant"` - OpenedAt string `json:"openedAt"` - PeakSeverity DtoIncidentPeakSeverity `json:"peakSeverity"` - ResolvedAt *string `json:"resolvedAt,omitempty"` + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } - // Severity Severity is the current one; peakSeverity the worst it reached (a - // de-escalated incident stays open at warning). - Severity DtoIncidentSeverity `json:"severity"` - Status DtoIncidentStatus `json:"status"` - Summary string `json:"summary"` + req.Header.Add("Content-Type", contentType) - // Title Title names the problem in the monitor type's words (an expiry's - // days counted now, or when it ended). - Title string `json:"title"` + return req, nil } -// DtoIncidentAspect Aspect is what the incident is about. -type DtoIncidentAspect string - -// DtoIncidentMonitorType defines model for DtoIncident.MonitorType. -type DtoIncidentMonitorType string +// NewDeleteAlertChannelRequest generates requests for DeleteAlertChannel +func NewDeleteAlertChannelRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error -// DtoIncidentMonitorVariant MonitorVariant names what the monitor does, as on monitor rows -// (keyword for an HTTP monitor with a keyword). -type DtoIncidentMonitorVariant string + var pathParam0 string -// DtoIncidentPeakSeverity defines model for DtoIncident.PeakSeverity. -type DtoIncidentPeakSeverity string + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } -// DtoIncidentSeverity Severity is the current one; peakSeverity the worst it reached (a -// de-escalated incident stays open at warning). -type DtoIncidentSeverity string + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } -// DtoIncidentStatus defines model for DtoIncident.Status. -type DtoIncidentStatus string + operationPath := fmt.Sprintf("/alert-channels/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } -// DtoIncidentDelivery defines model for dto.IncidentDelivery. -type DtoIncidentDelivery struct { - // AlertId AlertID is the alert this delivery sends: an alert goes to every - // channel of its route, one delivery each. - AlertId openapi_types.UUID `json:"alertId"` - Attempts int `json:"attempts"` - ChannelId *openapi_types.UUID `json:"channelId,omitempty"` - ChannelKind *string `json:"channelKind,omitempty"` - ChannelName *string `json:"channelName,omitempty"` - Event DtoIncidentDeliveryEvent `json:"event"` - LastError *string `json:"lastError,omitempty"` + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // NextAttemptAt NextAttemptAt is when a pending delivery is tried again. - NextAttemptAt *string `json:"nextAttemptAt,omitempty"` + req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil) + if err != nil { + return nil, err + } - // QueuedAt QueuedAt is when the alert was queued: the time of the timeline - // entry that sent it (opened, escalated, threshold, reminder). - QueuedAt string `json:"queuedAt"` - SentAt *string `json:"sentAt,omitempty"` - Status DtoIncidentDeliveryStatus `json:"status"` + return req, nil } -// DtoIncidentDeliveryEvent defines model for DtoIncidentDelivery.Event. -type DtoIncidentDeliveryEvent string - -// DtoIncidentDeliveryStatus defines model for DtoIncidentDelivery.Status. -type DtoIncidentDeliveryStatus string +// NewGetAlertChannelRequest generates requests for GetAlertChannel +func NewGetAlertChannelRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error -// DtoIncidentDetail defines model for dto.IncidentDetail. -type DtoIncidentDetail struct { - AcknowledgedAt *string `json:"acknowledgedAt,omitempty"` - AcknowledgedBy *openapi_types.UUID `json:"acknowledgedBy,omitempty"` + var pathParam0 string - // AcknowledgedByName AcknowledgedByName names who acknowledged it (their name, else - // email); absent when nobody did or Norcube Auth couldn't say. - AcknowledgedByName *string `json:"acknowledgedByName,omitempty"` - Alerts []DtoIncidentDelivery `json:"alerts"` + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } - // Aspect Aspect is what the incident is about. - Aspect DtoIncidentDetailAspect `json:"aspect"` + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // Condition Condition is what the latest check that changed the incident found; - // summary is its message, facts its facts. - Condition string `json:"condition"` + operationPath := fmt.Sprintf("/alert-channels/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - // DurationSeconds DurationSeconds is how long it lasted (or has lasted so far). - DurationSeconds int `json:"durationSeconds"` - Facts DtoConditionFacts `json:"facts"` - Id openapi_types.UUID `json:"id"` - MonitorId openapi_types.UUID `json:"monitorId"` - MonitorName string `json:"monitorName"` - MonitorTarget string `json:"monitorTarget"` - MonitorType DtoIncidentDetailMonitorType `json:"monitorType"` + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // MonitorVariant MonitorVariant names what the monitor does, as on monitor rows - // (keyword for an HTTP monitor with a keyword). - MonitorVariant DtoIncidentDetailMonitorVariant `json:"monitorVariant"` - OpenedAt string `json:"openedAt"` - PeakSeverity DtoIncidentDetailPeakSeverity `json:"peakSeverity"` - ResolvedAt *string `json:"resolvedAt,omitempty"` + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } - // Severity Severity is the current one; peakSeverity the worst it reached (a - // de-escalated incident stays open at warning). - Severity DtoIncidentDetailSeverity `json:"severity"` - Status DtoIncidentDetailStatus `json:"status"` - Summary string `json:"summary"` - Timeline []DtoIncidentEvent `json:"timeline"` + return req, nil +} - // Title Title names the problem in the monitor type's words (an expiry's - // days counted now, or when it ended). - Title string `json:"title"` +// NewUpdateAlertChannelRequest calls the generic UpdateAlertChannel builder with application/json body +func NewUpdateAlertChannelRequest(server string, id openapi_types.UUID, body UpdateAlertChannelJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpdateAlertChannelRequestWithBody(server, id, "application/json", bodyReader) } -// DtoIncidentDetailAspect Aspect is what the incident is about. -type DtoIncidentDetailAspect string +// NewUpdateAlertChannelRequestWithBody generates requests for UpdateAlertChannel with any type of body +func NewUpdateAlertChannelRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error -// DtoIncidentDetailMonitorType defines model for DtoIncidentDetail.MonitorType. -type DtoIncidentDetailMonitorType string + var pathParam0 string -// DtoIncidentDetailMonitorVariant MonitorVariant names what the monitor does, as on monitor rows -// (keyword for an HTTP monitor with a keyword). -type DtoIncidentDetailMonitorVariant string + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } -// DtoIncidentDetailPeakSeverity defines model for DtoIncidentDetail.PeakSeverity. -type DtoIncidentDetailPeakSeverity string + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } -// DtoIncidentDetailSeverity Severity is the current one; peakSeverity the worst it reached (a -// de-escalated incident stays open at warning). -type DtoIncidentDetailSeverity string + operationPath := fmt.Sprintf("/alert-channels/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } -// DtoIncidentDetailStatus defines model for DtoIncidentDetail.Status. -type DtoIncidentDetailStatus string + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } -// DtoIncidentEvent defines model for dto.IncidentEvent. -type DtoIncidentEvent struct { - At string `json:"at"` - Detail *map[string]interface{} `json:"detail,omitempty"` - Type DtoIncidentEventType `json:"type"` -} + req, err := http.NewRequest(http.MethodPatch, queryURL.String(), body) + if err != nil { + return nil, err + } -// DtoIncidentEventType defines model for DtoIncidentEvent.Type. -type DtoIncidentEventType string + req.Header.Add("Content-Type", contentType) -// DtoIncidentOpenCounts defines model for dto.IncidentOpenCounts. -type DtoIncidentOpenCounts struct { - Critical int `json:"critical"` - Total int `json:"total"` - Unacknowledged int `json:"unacknowledged"` - Warning int `json:"warning"` + return req, nil } -// DtoIncidentSummary defines model for dto.IncidentSummary. -type DtoIncidentSummary struct { - // MttrLast30dSeconds MttrLast30dSeconds is the mean time to resolve of those incidents; - // absent when none was resolved. - MttrLast30dSeconds *int `json:"mttrLast30dSeconds,omitempty"` - Open DtoIncidentOpenCounts `json:"open"` +// NewListAlertChannelDeliveriesRequest generates requests for ListAlertChannelDeliveries +func NewListAlertChannelDeliveriesRequest(server string, id openapi_types.UUID, params *ListAlertChannelDeliveriesParams) (*http.Request, error) { + var err error - // ResolvedLast30d ResolvedLast30d counts incidents resolved in the last 30 days, the - // ones mttrLast30dSeconds averages. - ResolvedLast30d int `json:"resolvedLast30d"` + var pathParam0 string - // ResolvedLast7d ResolvedLast7d counts incidents resolved in the last 7 days. - ResolvedLast7d int `json:"resolvedLast7d"` -} + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } -// DtoLastCheck defines model for dto.LastCheck. -type DtoLastCheck struct { - At string `json:"at"` - Condition string `json:"condition"` - Severity DtoLastCheckSeverity `json:"severity"` - TotalMs *int `json:"totalMs,omitempty"` -} + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/alert-channels/%s/deliveries", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// DtoLastCheckSeverity defines model for DtoLastCheck.Severity. -type DtoLastCheckSeverity string + } -// DtoMonitor defines model for dto.Monitor. -type DtoMonitor struct { - // Aspects Aspects are the monitor's watched aspects (an HTTP monitor's - // certificate and domain watches that are on), on list rows too; [] - // without watches. - Aspects []DtoMonitorAspect `json:"aspects"` + if params.Limit != nil { - // Condition Condition explains status; absent while pending. - Condition *DtoMonitorCondition `json:"condition,omitempty"` - CreatedAt string `json:"createdAt"` - CreatedBy openapi_types.UUID `json:"createdBy"` - Description string `json:"description"` - Domain *DtoDomainSettings `json:"domain,omitempty"` + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } - // History History is set on list rows with include=history: the newest - // results (at most 60), newest first; [] for a monitor never checked. - History *[]DtoHistoryBeat `json:"history,omitempty"` - Http *DtoHTTPSettings `json:"http,omitempty"` - Id openapi_types.UUID `json:"id"` - IntervalSeconds int `json:"intervalSeconds"` + } - // Last24h Last24h is set on list rows of monitors that track uptime (HTTP): - // the last 24 full hours plus the current one. SSL and domain monitors - // show days left (condition.facts) instead. - Last24h *DtoWindowSummary `json:"last24h,omitempty"` - LastCheck *DtoLastCheck `json:"lastCheck,omitempty"` - Name string `json:"name"` - NextCheckAt *string `json:"nextCheckAt,omitempty"` + if params.Status != nil { - // OverallStatus OverallStatus is the worst of status and the statuses of the - // monitor's watched aspects (critical, warning, pending, ok), paused - // while disabled. The list status filter and sort use it. - OverallStatus DtoMonitorOverallStatus `json:"overallStatus"` + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "status", *params.Status, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } - // ParentResource ParentResource is set when the monitor belongs to a resource of - // another Norcube service ("domainradar:saved_domain:example.com"). It - // can't be deleted here, and its domain can't change. - ParentResource *string `json:"parentResource,omitempty"` + } - // Regions Regions are where the monitor is checked from, on list rows too. - // Today every monitor is checked from the one region the service runs - // in; with probes in more regions (planned) a monitor may list - // several. Each result says which region checked it (region). - Regions []DtoCheckRegion `json:"regions"` - Ssl *DtoSSLSettings `json:"ssl,omitempty"` + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } - // Status Status is the primary aspect's: the severity of the last conclusive - // check, pending before one, paused while disabled. An inconclusive - // check (a failed registry lookup) never changes it. - Status DtoMonitorStatus `json:"status"` - StatusSince string `json:"statusSince"` - Target string `json:"target"` - Type DtoMonitorType `json:"type"` - UpdatedAt string `json:"updatedAt"` + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } - // Variant Variant is what the monitor does in one word, on list rows too - // (which carry no settings): keyword for an HTTP monitor that looks for - // a keyword in the body, otherwise the type. - Variant DtoMonitorVariant `json:"variant"` + return req, nil } -// DtoMonitorOverallStatus OverallStatus is the worst of status and the statuses of the -// monitor's watched aspects (critical, warning, pending, ok), paused -// while disabled. The list status filter and sort use it. -type DtoMonitorOverallStatus string - -// DtoMonitorStatus Status is the primary aspect's: the severity of the last conclusive -// check, pending before one, paused while disabled. An inconclusive -// check (a failed registry lookup) never changes it. -type DtoMonitorStatus string +// NewTestAlertChannelRequest generates requests for TestAlertChannel +func NewTestAlertChannelRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error -// DtoMonitorType defines model for DtoMonitor.Type. -type DtoMonitorType string + var pathParam0 string -// DtoMonitorVariant Variant is what the monitor does in one word, on list rows too -// (which carry no settings): keyword for an HTTP monitor that looks for -// a keyword in the body, otherwise the type. -type DtoMonitorVariant string + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } -// DtoMonitorAlertRoute defines model for dto.MonitorAlertRoute. -type DtoMonitorAlertRoute struct { - ChannelId openapi_types.UUID `json:"channelId"` - Events []DtoMonitorAlertRouteEvents `json:"events"` -} + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } -// DtoMonitorAlertRouteEvents defines model for DtoMonitorAlertRoute.Events. -type DtoMonitorAlertRouteEvents string + operationPath := fmt.Sprintf("/alert-channels/%s/test", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } -// DtoMonitorAlerts defines model for dto.MonitorAlerts. -type DtoMonitorAlerts struct { - // ApplicableEvents ApplicableEvents are the events monitors of this type can send - // (offer only these in a routing form). - ApplicableEvents []DtoMonitorAlertsApplicableEvents `json:"applicableEvents"` - ConfirmFailures int `json:"confirmFailures"` - ConfirmSuccesses int `json:"confirmSuccesses"` - ReminderMinutes int `json:"reminderMinutes"` - Routes []DtoMonitorAlertRoute `json:"routes"` - UseDefaults bool `json:"useDefaults"` -} + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } -// DtoMonitorAlertsApplicableEvents defines model for DtoMonitorAlerts.ApplicableEvents. -type DtoMonitorAlertsApplicableEvents string + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) + if err != nil { + return nil, err + } -// DtoMonitorAlertsUpdate defines model for dto.MonitorAlertsUpdate. -type DtoMonitorAlertsUpdate struct { - ConfirmFailures *int `json:"confirmFailures,omitempty"` - ConfirmSuccesses *int `json:"confirmSuccesses,omitempty"` - ReminderMinutes *int `json:"reminderMinutes,omitempty"` - Routes *[]DtoMonitorAlertRoute `json:"routes,omitempty"` - UseDefaults *bool `json:"useDefaults,omitempty"` + return req, nil } -// DtoMonitorAspect defines model for dto.MonitorAspect. -type DtoMonitorAspect struct { - // AlertedThresholds AlertedThresholds are the expiry thresholds already alerted for the - // current expiry, oldest first; [] before the first (or once renewed). - AlertedThresholds []DtoThresholdAlert `json:"alertedThresholds"` - Aspect DtoMonitorAspectAspect `json:"aspect"` +// NewSendAlertChannelVerificationRequest generates requests for SendAlertChannelVerification +func NewSendAlertChannelVerificationRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error - // CheckedAt CheckedAt is the last observation, conclusive or not; absent before - // the first. - CheckedAt *string `json:"checkedAt,omitempty"` + var pathParam0 string - // Condition Condition explains status ("ok", "cert_expiring", "domain_expired", - // ...); absent while pending. - Condition *string `json:"condition,omitempty"` + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } - // DaysRemaining DaysRemaining is counted when read from expiresAt, negative once - // expired. - DaysRemaining *int `json:"daysRemaining,omitempty"` - ExpiresAt *string `json:"expiresAt,omitempty"` - Message *string `json:"message,omitempty"` - Status DtoMonitorAspectStatus `json:"status"` + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // Subject Subject is what the aspect is about: the URL's host for the - // certificate, its registrable domain for the domain. - Subject string `json:"subject"` - ThresholdsDays []int `json:"thresholdsDays"` -} + operationPath := fmt.Sprintf("/alert-channels/%s/verify", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } -// DtoMonitorAspectAspect defines model for DtoMonitorAspect.Aspect. -type DtoMonitorAspectAspect string + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } -// DtoMonitorAspectStatus defines model for DtoMonitorAspect.Status. -type DtoMonitorAspectStatus string + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) + if err != nil { + return nil, err + } -// DtoMonitorBulkItem defines model for dto.MonitorBulkItem. -type DtoMonitorBulkItem struct { - Code *string `json:"code,omitempty"` - Detail *string `json:"detail,omitempty"` - MonitorId openapi_types.UUID `json:"monitorId"` - Ok bool `json:"ok"` + return req, nil } -// DtoMonitorBulkRequest defines model for dto.MonitorBulkRequest. -type DtoMonitorBulkRequest struct { - Action DtoMonitorBulkRequestAction `json:"action"` - MonitorIds []string `json:"monitorIds"` +// NewConfirmAlertChannelVerificationRequest calls the generic ConfirmAlertChannelVerification builder with application/json body +func NewConfirmAlertChannelVerificationRequest(server string, id openapi_types.UUID, body ConfirmAlertChannelVerificationJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewConfirmAlertChannelVerificationRequestWithBody(server, id, "application/json", bodyReader) } -// DtoMonitorBulkRequestAction defines model for DtoMonitorBulkRequest.Action. -type DtoMonitorBulkRequestAction string +// NewConfirmAlertChannelVerificationRequestWithBody generates requests for ConfirmAlertChannelVerification with any type of body +func NewConfirmAlertChannelVerificationRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/alert-channels/%s/verify/confirm", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) -// DtoMonitorBulkResult defines model for dto.MonitorBulkResult. -type DtoMonitorBulkResult struct { - Action DtoMonitorBulkResultAction `json:"action"` - Failed int `json:"failed"` - Items []DtoMonitorBulkItem `json:"items"` - Succeeded int `json:"succeeded"` + return req, nil } -// DtoMonitorBulkResultAction defines model for DtoMonitorBulkResult.Action. -type DtoMonitorBulkResultAction string +// NewListIncidentsRequest generates requests for ListIncidents +func NewListIncidentsRequest(server string, params *ListIncidentsParams) (*http.Request, error) { + var err error -// DtoMonitorCertificate defines model for dto.MonitorCertificate. -type DtoMonitorCertificate struct { - // AlertWindowStart AlertWindowStart is when the largest threshold is crossed (notAfter - // minus it): shade from here to notAfter. - AlertWindowStart *string `json:"alertWindowStart,omitempty"` - Certificate DtoCertificate `json:"certificate"` - CheckedAt string `json:"checkedAt"` - Condition string `json:"condition"` + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // DaysRemaining DaysRemaining counts from now (certificate.daysRemaining from the - // check). - DaysRemaining int `json:"daysRemaining"` - ErrorMessage *string `json:"errorMessage,omitempty"` - NextThresholdAt *string `json:"nextThresholdAt,omitempty"` + operationPath := fmt.Sprintf("/incidents") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - // NextThresholdDays NextThresholdDays / NextThresholdAt: the next threshold to cross - // and when; absent once past the smallest. - NextThresholdDays *int `json:"nextThresholdDays,omitempty"` - ResultId int `json:"resultId"` - Severity DtoMonitorCertificateSeverity `json:"severity"` + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // ThresholdsDays ThresholdsDays are the SSL monitor's expiry thresholds, largest - // first; empty for an HTTP monitor (no expiry alerts). - ThresholdsDays []int `json:"thresholdsDays"` -} + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string -// DtoMonitorCertificateSeverity defines model for DtoMonitorCertificate.Severity. -type DtoMonitorCertificateSeverity string + if params.Acknowledged != nil { -// DtoMonitorCondition defines model for dto.MonitorCondition. -type DtoMonitorCondition struct { - // AlertedThresholds AlertedThresholds are the expiry thresholds already alerted for the - // current expiry (SSL and domain monitors), oldest first; [] otherwise. - // An HTTP monitor's watched certificate and domain have theirs on - // aspects. - AlertedThresholds []DtoThresholdAlert `json:"alertedThresholds"` + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "acknowledged", *params.Acknowledged, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } - // Code Code is the condition ("ok", "slow_response", "cert_expiring", ...), - // worded per monitor type by the dashboard. - Code string `json:"code"` + } - // ConclusiveAt ConclusiveAt is when a check last confirmed it; older than - // lastCheck.at when the newest checks couldn't tell. - ConclusiveAt *string `json:"conclusiveAt,omitempty"` - Facts DtoConditionFacts `json:"facts"` - Message *string `json:"message,omitempty"` + if params.Aspect != nil { - // Since Since is when the status began (statusSince). - Since string `json:"since"` -} + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "aspect", *params.Aspect, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// DtoMonitorCreate defines model for dto.MonitorCreate. -type DtoMonitorCreate struct { - Description *string `json:"description,omitempty"` - Domain *DtoDomainSettingsInput `json:"domain,omitempty"` - Http *DtoHTTPSettingsInput `json:"http,omitempty"` + } - // IntervalSeconds The org's plan can require more than the 30-second floor (60 s by - // default), and domain monitors run at most hourly (3600); the error - // message names the minimum. - IntervalSeconds int `json:"intervalSeconds"` - Name string `json:"name"` - Ssl *DtoSSLSettingsInput `json:"ssl,omitempty"` - Type DtoMonitorCreateType `json:"type"` -} + if params.Cursor != nil { -// DtoMonitorCreateType defines model for DtoMonitorCreate.Type. -type DtoMonitorCreateType string + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// DtoMonitorEvent defines model for dto.MonitorEvent. -type DtoMonitorEvent struct { - Aspect DtoMonitorEventAspect `json:"aspect"` - At string `json:"at"` + } - // CheckResultId CheckResultID is the check that saw it. - CheckResultId int `json:"checkResultId"` - Id int `json:"id"` + if params.From != nil { - // Renewal Renewal is set on certificate_renewed. - Renewal *DtoCertificateRenewal `json:"renewal,omitempty"` + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "from", *params.From, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "date-time"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } - // Type Type: certificate_renewed, a check saw a certificate other than the - // newest one so far, expiring later (SSL monitors and HTTP monitors - // that watch their certificate; an older certificate, say from a node - // behind on renewals, is not one). - Type DtoMonitorEventType `json:"type"` -} + } -// DtoMonitorEventAspect defines model for DtoMonitorEvent.Aspect. -type DtoMonitorEventAspect string + if params.Limit != nil { -// DtoMonitorEventType Type: certificate_renewed, a check saw a certificate other than the -// newest one so far, expiring later (SSL monitors and HTTP monitors -// that watch their certificate; an older certificate, say from a node -// behind on renewals, is not one). -type DtoMonitorEventType string + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// DtoMonitorStats defines model for dto.MonitorStats. -type DtoMonitorStats struct { - AvgMs *int `json:"avgMs,omitempty"` - Checks int `json:"checks"` - Critical int `json:"critical"` - From string `json:"from"` - Granularity DtoMonitorStatsGranularity `json:"granularity"` - Inconclusive int `json:"inconclusive"` - MaxMs *int `json:"maxMs,omitempty"` - Ok int `json:"ok"` - Series []DtoStatsBucket `json:"series"` - To string `json:"to"` + } - // UptimePercent UptimePercent is (ok + warning) / (ok + warning + critical); absent - // without conclusive checks and for SSL and domain monitors. - UptimePercent *float32 `json:"uptimePercent,omitempty"` - Warning int `json:"warning"` -} + if params.MonitorId != nil { -// DtoMonitorStatsGranularity defines model for DtoMonitorStats.Granularity. -type DtoMonitorStatsGranularity string + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "monitorId", *params.MonitorId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "uuid"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// DtoMonitorUpdate defines model for dto.MonitorUpdate. -type DtoMonitorUpdate struct { - Description *string `json:"description,omitempty"` - Domain *DtoDomainSettingsInput `json:"domain,omitempty"` - Http *DtoHTTPSettingsInput `json:"http,omitempty"` - IntervalSeconds *int `json:"intervalSeconds,omitempty"` - Name *string `json:"name,omitempty"` - Ssl *DtoSSLSettingsInput `json:"ssl,omitempty"` -} + } -// DtoRenewedCertificate defines model for dto.RenewedCertificate. -type DtoRenewedCertificate struct { - FingerprintSha256 *string `json:"fingerprintSha256,omitempty"` - Issuer string `json:"issuer"` - NotAfter string `json:"notAfter"` - NotBefore string `json:"notBefore"` - SerialNumber string `json:"serialNumber"` - Subject string `json:"subject"` -} + if params.Q != nil { -// DtoSSLSettings defines model for dto.SSLSettings. -type DtoSSLSettings struct { - ExpiryThresholdsDays []int `json:"expiryThresholdsDays"` - Host string `json:"host"` - Port int `json:"port"` - ServerName *string `json:"serverName,omitempty"` -} + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "q", *params.Q, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// DtoSSLSettingsInput defines model for dto.SSLSettingsInput. -type DtoSSLSettingsInput struct { - ExpiryThresholdsDays []int `json:"expiryThresholdsDays"` - Host string `json:"host"` - Port int `json:"port"` - ServerName *string `json:"serverName,omitempty"` -} + } -// DtoStatsBucket defines model for dto.StatsBucket. -type DtoStatsBucket struct { - AvgMs int `json:"avgMs"` - Checks int `json:"checks"` - Critical int `json:"critical"` - Inconclusive int `json:"inconclusive"` - MaxMs int `json:"maxMs"` - Ok int `json:"ok"` - P50Ms int `json:"p50Ms"` - P95Ms int `json:"p95Ms"` - Region string `json:"region"` - Start string `json:"start"` - Warning int `json:"warning"` -} + if params.Severity != nil { -// DtoStatusChange defines model for dto.StatusChange. -type DtoStatusChange struct { - ChangedAt string `json:"changedAt"` + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "severity", *params.Severity, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } - // CheckResultId CheckResultID is the result that made the change (raw results are - // kept about 30 days, changes a year). - CheckResultId int `json:"checkResultId"` + } + + if params.Status != nil { - // Condition Condition is what the check that made the change found. - Condition string `json:"condition"` + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "status", *params.Status, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } - // DurationSeconds DurationSeconds is how long the status lasted (until now for the - // newest change). - DurationSeconds int `json:"durationSeconds"` + } - // EndedAt EndedAt is when the next change happened; absent for the newest - // change (the current status, unless the monitor is paused). - EndedAt *string `json:"endedAt,omitempty"` + if params.To != nil { - // Events Events are what else happened while this status lasted (from - // changedAt to endedAt), newest first: certificate renewals. [] when - // nothing did. - Events []DtoMonitorEvent `json:"events"` - From DtoStatusChangeFrom `json:"from"` - Id int `json:"id"` - Message *string `json:"message,omitempty"` - StatusCode *int `json:"statusCode,omitempty"` - To DtoStatusChangeTo `json:"to"` -} + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "to", *params.To, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "date-time"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// DtoStatusChangeFrom defines model for DtoStatusChange.From. -type DtoStatusChangeFrom string + } -// DtoStatusChangeTo defines model for DtoStatusChange.To. -type DtoStatusChangeTo string + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } -// DtoThresholdAlert defines model for dto.ThresholdAlert. -type DtoThresholdAlert struct { - AlertedAt string `json:"alertedAt"` - Days int `json:"days"` + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil } -// DtoWindowSummary defines model for dto.WindowSummary. -type DtoWindowSummary struct { - AvgMs *int `json:"avgMs,omitempty"` - Checks int `json:"checks"` - Critical int `json:"critical"` - From string `json:"from"` - Inconclusive int `json:"inconclusive"` - Ok int `json:"ok"` +// NewGetIncidentSummaryRequest generates requests for GetIncidentSummary +func NewGetIncidentSummaryRequest(server string) (*http.Request, error) { + var err error - // P50Ms P50Ms and P95Ms approximate the window's median and 95th percentile - // response time (the checks-weighted mean of the hourly percentiles). - P50Ms *int `json:"p50Ms,omitempty"` - P95Ms *int `json:"p95Ms,omitempty"` + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // UptimePercent UptimePercent is (ok + warning) / (ok + warning + critical): a - // warning still answered, an inconclusive check counts neither way. - // WarningPercent is the warnings' share of the conclusive checks. - UptimePercent *float32 `json:"uptimePercent,omitempty"` - Warning int `json:"warning"` - WarningPercent *float32 `json:"warningPercent,omitempty"` -} + operationPath := fmt.Sprintf("/incidents/summary") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } -// ResponseAPIResponsePaginationCursors defines model for response.APIResponsePaginationCursors. -type ResponseAPIResponsePaginationCursors struct { - Next *string `json:"next,omitempty"` - Prev *string `json:"prev,omitempty"` -} + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } -// ResponseAPIResponsePaginationMeta defines model for response.APIResponsePaginationMeta. -type ResponseAPIResponsePaginationMeta struct { - Timestamp *string `json:"timestamp,omitempty"` -} + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } -// ResponseAPIResponseWithPagination defines model for response.APIResponseWithPagination. -type ResponseAPIResponseWithPagination struct { - Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List interface{} `json:"list"` - Meta ResponseAPIResponsePaginationMeta `json:"meta"` + return req, nil } -// ResponseProblem defines model for response.Problem. -type ResponseProblem struct { - Code ConstantsErrorCode `json:"code"` +// NewGetIncidentRequest generates requests for GetIncident +func NewGetIncidentRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error - // Data Data holds stable facts about the error ("limit"), the same ones gRPC - // sends as ErrorInfo metadata. - Data *map[string]string `json:"data,omitempty"` + var pathParam0 string - // Detail Detail is an English sentence for people. - Detail string `json:"detail"` + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } - // Errors Errors lists the field problems of a VALIDATION_FAILED problem. - Errors *[]ValidationViolation `json:"errors,omitempty"` + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // Instance Instance identifies this occurrence: the request id the server - // generated, also sent as X-Request-ID and logged as request_id. - Instance string `json:"instance"` + operationPath := fmt.Sprintf("/incidents/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - // Reason Reason is a finer stable cause within Code, when there is one. - Reason *ConstantsErrorReason `json:"reason,omitempty"` - Status int `json:"status"` - Timestamp string `json:"timestamp"` - Title string `json:"title"` + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // Type Type identifies the problem type (one per code); it may be - // dereferenced for documentation. - Type string `json:"type"` + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil } -// ValidationParams defines model for validation.Params. -type ValidationParams struct { - // Allowed Allowed: oneOf. - Allowed *[]string `json:"allowed,omitempty"` +// NewAcknowledgeIncidentRequest generates requests for AcknowledgeIncident +func NewAcknowledgeIncidentRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error - // Expected Expected: type, mismatch. - Expected *string `json:"expected,omitempty"` + var pathParam0 string - // Field Field is the pointer of the other field: min and max compared with a - // field, exclusive, dependsOn. - Field *string `json:"field,omitempty"` + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } - // Max Max: range, max, maxLength, maxItems. - Max *int `json:"max,omitempty"` + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // Min Min: range, min. - Min *int `json:"min,omitempty"` + operationPath := fmt.Sprintf("/incidents/%s/acknowledge", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - // Unit Unit: maxLength. - Unit *ValidationUnit `json:"unit,omitempty"` + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // Value Value: unsupported. - Value *string `json:"value,omitempty"` + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil } -// ValidationRule defines model for validation.Rule. -type ValidationRule string +// NewListMonitorsRequest generates requests for ListMonitors +func NewListMonitorsRequest(server string, params *ListMonitorsParams) (*http.Request, error) { + var err error -// ValidationUnit defines model for validation.Unit. -type ValidationUnit string + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } -// ValidationViolation defines model for validation.Violation. -type ValidationViolation struct { - Detail string `json:"detail"` - Params *ValidationParams `json:"params,omitempty"` - Pointer string `json:"pointer"` - Rule ValidationRule `json:"rule"` -} + operationPath := fmt.Sprintf("/monitors") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } -// ListAlertChannelsParams defines parameters for ListAlertChannels. -type ListAlertChannelsParams struct { - Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` - Limit *int `form:"limit,omitempty" json:"limit,omitempty"` -} + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } -// ListAlertChannelDeliveriesParams defines parameters for ListAlertChannelDeliveries. -type ListAlertChannelDeliveriesParams struct { - Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` - Limit *int `form:"limit,omitempty" json:"limit,omitempty"` - Status *ListAlertChannelDeliveriesParamsStatus `form:"status,omitempty" json:"status,omitempty"` -} + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string -// ListAlertChannelDeliveriesParamsStatus defines parameters for ListAlertChannelDeliveries. -type ListAlertChannelDeliveriesParamsStatus string + if params.Cursor != nil { -// ListIncidentsParams defines parameters for ListIncidents. -type ListIncidentsParams struct { - // Acknowledged Acknowledged: true for incidents someone acknowledged, false for - // the others. - Acknowledged *ListIncidentsParamsAcknowledged `form:"acknowledged,omitempty" json:"acknowledged,omitempty"` + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } - // Aspect Aspect is what the incident is about. - Aspect *ListIncidentsParamsAspect `form:"aspect,omitempty" json:"aspect,omitempty"` - Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + } - // From From and To bound when the incident started: from inclusive, to - // exclusive (RFC 3339). - From *time.Time `form:"from,omitempty" json:"from,omitempty"` - Limit *int `form:"limit,omitempty" json:"limit,omitempty"` - MonitorId *openapi_types.UUID `form:"monitorId,omitempty" json:"monitorId,omitempty"` + if params.Include != nil { - // Q Q is part of the monitor's name or target, any case. - Q *string `form:"q,omitempty" json:"q,omitempty"` + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "include", *params.Include, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } - // Severity Severity matches an open incident's current severity and a resolved - // one's peak severity (how bad it got). - Severity *ListIncidentsParamsSeverity `form:"severity,omitempty" json:"severity,omitempty"` - Status *ListIncidentsParamsStatus `form:"status,omitempty" json:"status,omitempty"` - To *time.Time `form:"to,omitempty" json:"to,omitempty"` -} + } -// ListIncidentsParamsAcknowledged defines parameters for ListIncidents. -type ListIncidentsParamsAcknowledged string + if params.Limit != nil { -// ListIncidentsParamsAspect defines parameters for ListIncidents. -type ListIncidentsParamsAspect string + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// ListIncidentsParamsSeverity defines parameters for ListIncidents. -type ListIncidentsParamsSeverity string + } -// ListIncidentsParamsStatus defines parameters for ListIncidents. -type ListIncidentsParamsStatus string + if params.Q != nil { -// ListMonitorsParams defines parameters for ListMonitors. -type ListMonitorsParams struct { - Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "q", *params.Q, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } - // Include Include is a comma-separated list of optional row parts: history - // adds each row's last 60 check results. - Include *ListMonitorsParamsInclude `form:"include,omitempty" json:"include,omitempty"` - Limit *int `form:"limit,omitempty" json:"limit,omitempty"` - Q *string `form:"q,omitempty" json:"q,omitempty"` + } - // Sort Sort: status (default, by overall status: critical, warning, - // pending, ok, paused, then name), name (A to Z), lastChecked (most recent first), uptime - // (lowest over last24h first; no data, and SSL and domain monitors, - // last), created (newest first). - // A cursor only continues the sort it came from. - Sort *ListMonitorsParamsSort `form:"sort,omitempty" json:"sort,omitempty"` + if params.Sort != nil { - // Status Status matches the overall status (the worst of the monitor's status - // and its watched aspects'). - Status *ListMonitorsParamsStatus `form:"status,omitempty" json:"status,omitempty"` - Type *ListMonitorsParamsType `form:"type,omitempty" json:"type,omitempty"` -} + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "sort", *params.Sort, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// ListMonitorsParamsInclude defines parameters for ListMonitors. -type ListMonitorsParamsInclude string + } -// ListMonitorsParamsSort defines parameters for ListMonitors. -type ListMonitorsParamsSort string + if params.Status != nil { -// ListMonitorsParamsStatus defines parameters for ListMonitors. -type ListMonitorsParamsStatus string + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "status", *params.Status, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// ListMonitorsParamsType defines parameters for ListMonitors. -type ListMonitorsParamsType string + } -// GetMonitorAvailabilityParams defines parameters for GetMonitorAvailability. -type GetMonitorAvailabilityParams struct { - // Days Days is how many UTC days, ending today, the bar covers (default 90). - Days *int `form:"days,omitempty" json:"days,omitempty"` -} + if params.Type != nil { -// ListMonitorResultsParams defines parameters for ListMonitorResults. -type ListMonitorResultsParams struct { - Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` - From *time.Time `form:"from,omitempty" json:"from,omitempty"` - Limit *int `form:"limit,omitempty" json:"limit,omitempty"` - To *time.Time `form:"to,omitempty" json:"to,omitempty"` -} + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "type", *params.Type, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } -// GetMonitorStatsParams defines parameters for GetMonitorStats. -type GetMonitorStatsParams struct { - Range GetMonitorStatsParamsRange `form:"range" json:"range"` -} + } -// GetMonitorStatsParamsRange defines parameters for GetMonitorStats. -type GetMonitorStatsParamsRange string + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } -// ListMonitorStatusChangesParams defines parameters for ListMonitorStatusChanges. -type ListMonitorStatusChangesParams struct { - Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` - Limit *int `form:"limit,omitempty" json:"limit,omitempty"` -} + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } -// CreateAlertChannelJSONRequestBody defines body for CreateAlertChannel for application/json ContentType. -type CreateAlertChannelJSONRequestBody = DtoAlertChannelCreate + return req, nil +} -// UpdateAlertChannelJSONRequestBody defines body for UpdateAlertChannel for application/json ContentType. -type UpdateAlertChannelJSONRequestBody = DtoAlertChannelUpdate +// NewCreateMonitorRequest calls the generic CreateMonitor builder with application/json body +func NewCreateMonitorRequest(server string, body CreateMonitorJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateMonitorRequestWithBody(server, "application/json", bodyReader) +} -// ConfirmAlertChannelVerificationJSONRequestBody defines body for ConfirmAlertChannelVerification for application/json ContentType. -type ConfirmAlertChannelVerificationJSONRequestBody = DtoAlertChannelVerifyConfirm +// NewCreateMonitorRequestWithBody generates requests for CreateMonitor with any type of body +func NewCreateMonitorRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error -// CreateMonitorJSONRequestBody defines body for CreateMonitor for application/json ContentType. -type CreateMonitorJSONRequestBody = DtoMonitorCreate + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } -// ApplyMonitorBulkActionJSONRequestBody defines body for ApplyMonitorBulkAction for application/json ContentType. -type ApplyMonitorBulkActionJSONRequestBody = DtoMonitorBulkRequest + operationPath := fmt.Sprintf("/monitors") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } -// UpdateMonitorJSONRequestBody defines body for UpdateMonitor for application/json ContentType. -type UpdateMonitorJSONRequestBody = DtoMonitorUpdate + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } -// SetMonitorAlertsJSONRequestBody defines body for SetMonitorAlerts for application/json ContentType. -type SetMonitorAlertsJSONRequestBody = DtoMonitorAlertsUpdate + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } -// RequestEditorFn is the function signature for the RequestEditor callback function -type RequestEditorFn func(ctx context.Context, req *http.Request) error + req.Header.Add("Content-Type", contentType) -// Doer performs HTTP requests. -// -// The standard http.Client implements this interface. -type HttpRequestDoer interface { - Do(req *http.Request) (*http.Response, error) + return req, nil } -// Client which conforms to the OpenAPI3 specification for this service. -type Client struct { - // The endpoint of the server conforming to this interface, with scheme, - // https://api.deepmap.com for example. This can contain a path relative - // to the server, such as https://api.deepmap.com/dev-test, and all the - // paths in the swagger spec will be appended to the server. - Server string - - // Doer for performing requests, typically a *http.Client with any - // customized settings, such as certificate chains. - Client HttpRequestDoer - - // A list of callbacks for modifying requests which are generated before sending over - // the network. - RequestEditors []RequestEditorFn +// NewApplyMonitorBulkActionRequest calls the generic ApplyMonitorBulkAction builder with application/json body +func NewApplyMonitorBulkActionRequest(server string, body ApplyMonitorBulkActionJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewApplyMonitorBulkActionRequestWithBody(server, "application/json", bodyReader) } -// ClientOption allows setting custom parameters during construction -type ClientOption func(*Client) error +// NewApplyMonitorBulkActionRequestWithBody generates requests for ApplyMonitorBulkAction with any type of body +func NewApplyMonitorBulkActionRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error -// Creates a new Client, with reasonable defaults -func NewClient(server string, opts ...ClientOption) (*Client, error) { - // create a client with sane default values - client := Client{ - Server: server, - } - // mutate client and add all optional params - for _, o := range opts { - if err := o(&client); err != nil { - return nil, err - } - } - // ensure the server URL always has a trailing slash - if !strings.HasSuffix(client.Server, "/") { - client.Server += "/" - } - // create httpClient, if not already present - if client.Client == nil { - client.Client = &http.Client{} + serverURL, err := url.Parse(server) + if err != nil { + return nil, err } - return &client, nil -} -// WithHTTPClient allows overriding the default Doer, which is -// automatically created using http.Client. This is useful for tests. -func WithHTTPClient(doer HttpRequestDoer) ClientOption { - return func(c *Client) error { - c.Client = doer - return nil + operationPath := fmt.Sprintf("/monitors/bulk") + if operationPath[0] == '/' { + operationPath = "." + operationPath } -} -// WithRequestEditorFn allows setting up a callback function, which will be -// called right before sending the request. This can be used to mutate the request. -func WithRequestEditorFn(fn RequestEditorFn) ClientOption { - return func(c *Client) error { - c.RequestEditors = append(c.RequestEditors, fn) - return nil + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } -} -// The interface specification for the client above. -type ClientInterface interface { - // ListAlertChannels request - ListAlertChannels(ctx context.Context, params *ListAlertChannelsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } - // CreateAlertChannelWithBody request with any body - CreateAlertChannelWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + req.Header.Add("Content-Type", contentType) - CreateAlertChannel(ctx context.Context, body CreateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + return req, nil +} - // DeleteAlertChannel request - DeleteAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) +// NewDeleteMonitorRequest generates requests for DeleteMonitor +func NewDeleteMonitorRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error - // GetAlertChannel request - GetAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + var pathParam0 string - // UpdateAlertChannelWithBody request with any body - UpdateAlertChannelWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } - UpdateAlertChannel(ctx context.Context, id openapi_types.UUID, body UpdateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // ListAlertChannelDeliveries request - ListAlertChannelDeliveries(ctx context.Context, id openapi_types.UUID, params *ListAlertChannelDeliveriesParams, reqEditors ...RequestEditorFn) (*http.Response, error) + operationPath := fmt.Sprintf("/monitors/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - // TestAlertChannel request - TestAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // SendAlertChannelVerification request - SendAlertChannelVerification(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil) + if err != nil { + return nil, err + } - // ConfirmAlertChannelVerificationWithBody request with any body - ConfirmAlertChannelVerificationWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + return req, nil +} - ConfirmAlertChannelVerification(ctx context.Context, id openapi_types.UUID, body ConfirmAlertChannelVerificationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) +// NewGetMonitorRequest generates requests for GetMonitor +func NewGetMonitorRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error - // ListIncidents request - ListIncidents(ctx context.Context, params *ListIncidentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + var pathParam0 string - // GetIncidentSummary request - GetIncidentSummary(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } - // GetIncident request - GetIncident(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // AcknowledgeIncident request - AcknowledgeIncident(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + operationPath := fmt.Sprintf("/monitors/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - // ListMonitors request - ListMonitors(ctx context.Context, params *ListMonitorsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // CreateMonitorWithBody request with any body - CreateMonitorWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } - CreateMonitor(ctx context.Context, body CreateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + return req, nil +} - // ApplyMonitorBulkActionWithBody request with any body - ApplyMonitorBulkActionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) +// NewUpdateMonitorRequest calls the generic UpdateMonitor builder with application/json body +func NewUpdateMonitorRequest(server string, id openapi_types.UUID, body UpdateMonitorJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpdateMonitorRequestWithBody(server, id, "application/json", bodyReader) +} - ApplyMonitorBulkAction(ctx context.Context, body ApplyMonitorBulkActionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) +// NewUpdateMonitorRequestWithBody generates requests for UpdateMonitor with any type of body +func NewUpdateMonitorRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error - // DeleteMonitor request - DeleteMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + var pathParam0 string - // GetMonitor request - GetMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } - // UpdateMonitorWithBody request with any body - UpdateMonitorWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - UpdateMonitor(ctx context.Context, id openapi_types.UUID, body UpdateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + operationPath := fmt.Sprintf("/monitors/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - // GetMonitorAlerts request - GetMonitorAlerts(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // SetMonitorAlertsWithBody request with any body - SetMonitorAlertsWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + req, err := http.NewRequest(http.MethodPatch, queryURL.String(), body) + if err != nil { + return nil, err + } - SetMonitorAlerts(ctx context.Context, id openapi_types.UUID, body SetMonitorAlertsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + req.Header.Add("Content-Type", contentType) - // GetMonitorAvailability request - GetMonitorAvailability(ctx context.Context, id openapi_types.UUID, params *GetMonitorAvailabilityParams, reqEditors ...RequestEditorFn) (*http.Response, error) + return req, nil +} - // GetMonitorCertificate request - GetMonitorCertificate(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) +// NewGetMonitorAlertsRequest generates requests for GetMonitorAlerts +func NewGetMonitorAlertsRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error - // RunMonitorCheck request - RunMonitorCheck(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + var pathParam0 string - // PauseMonitor request - PauseMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } - // ListMonitorResults request - ListMonitorResults(ctx context.Context, id openapi_types.UUID, params *ListMonitorResultsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - // ResumeMonitor request - ResumeMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + operationPath := fmt.Sprintf("/monitors/%s/alerts", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - // GetMonitorStats request - GetMonitorStats(ctx context.Context, id openapi_types.UUID, params *GetMonitorStatsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // ListMonitorStatusChanges request - ListMonitorStatusChanges(ctx context.Context, id openapi_types.UUID, params *ListMonitorStatusChangesParams, reqEditors ...RequestEditorFn) (*http.Response, error) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil } -func (c *Client) ListAlertChannels(ctx context.Context, params *ListAlertChannelsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListAlertChannelsRequest(c.Server, params) +// NewSetMonitorAlertsRequest calls the generic SetMonitorAlerts builder with application/json body +func NewSetMonitorAlertsRequest(server string, id openapi_types.UUID, body SetMonitorAlertsJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { + bodyReader = bytes.NewReader(buf) + return NewSetMonitorAlertsRequestWithBody(server, id, "application/json", bodyReader) +} + +// NewSetMonitorAlertsRequestWithBody generates requests for SetMonitorAlerts with any type of body +func NewSetMonitorAlertsRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { return nil, err } - return c.Client.Do(req) -} -func (c *Client) CreateAlertChannelWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateAlertChannelRequestWithBody(c.Server, contentType, body) + serverURL, err := url.Parse(server) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { + + operationPath := fmt.Sprintf("/monitors/%s/alerts", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { return nil, err } - return c.Client.Do(req) -} -func (c *Client) CreateAlertChannel(ctx context.Context, body CreateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateAlertChannelRequest(c.Server, body) + req, err := http.NewRequest(http.MethodPut, queryURL.String(), body) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewGetMonitorAvailabilityRequest generates requests for GetMonitorAvailability +func NewGetMonitorAvailabilityRequest(server string, id openapi_types.UUID, params *GetMonitorAvailabilityParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { return nil, err } - return c.Client.Do(req) -} -func (c *Client) DeleteAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteAlertChannelRequest(c.Server, id) + serverURL, err := url.Parse(server) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + + operationPath := fmt.Sprintf("/monitors/%s/availability", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath } - return c.Client.Do(req) -} -func (c *Client) GetAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetAlertChannelRequest(c.Server, id) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Days != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "days", *params.Days, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } - return c.Client.Do(req) -} -func (c *Client) UpdateAlertChannelWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateAlertChannelRequestWithBody(c.Server, id, contentType, body) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) + + return req, nil } -func (c *Client) UpdateAlertChannel(ctx context.Context, id openapi_types.UUID, body UpdateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateAlertChannelRequest(c.Server, id, body) +// NewGetMonitorCertificateRequest generates requests for GetMonitorCertificate +func NewGetMonitorCertificateRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} -func (c *Client) ListAlertChannelDeliveries(ctx context.Context, id openapi_types.UUID, params *ListAlertChannelDeliveriesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListAlertChannelDeliveriesRequest(c.Server, id, params) + serverURL, err := url.Parse(server) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + + operationPath := fmt.Sprintf("/monitors/%s/certificate", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath } - return c.Client.Do(req) -} -func (c *Client) TestAlertChannel(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewTestAlertChannelRequest(c.Server, id) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { return nil, err } - return c.Client.Do(req) + + return req, nil } -func (c *Client) SendAlertChannelVerification(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewSendAlertChannelVerificationRequest(c.Server, id) +// NewRunMonitorCheckRequest generates requests for RunMonitorCheck +func NewRunMonitorCheckRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} -func (c *Client) ConfirmAlertChannelVerificationWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewConfirmAlertChannelVerificationRequestWithBody(c.Server, id, contentType, body) + serverURL, err := url.Parse(server) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + + operationPath := fmt.Sprintf("/monitors/%s/check", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath } - return c.Client.Do(req) -} -func (c *Client) ConfirmAlertChannelVerification(ctx context.Context, id openapi_types.UUID, body ConfirmAlertChannelVerificationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewConfirmAlertChannelVerificationRequest(c.Server, id, body) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) + if err != nil { return nil, err } - return c.Client.Do(req) + + return req, nil } -func (c *Client) ListIncidents(ctx context.Context, params *ListIncidentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListIncidentsRequest(c.Server, params) +// NewPauseMonitorRequest generates requests for PauseMonitor +func NewPauseMonitorRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} -func (c *Client) GetIncidentSummary(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetIncidentSummaryRequest(c.Server) + serverURL, err := url.Parse(server) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + + operationPath := fmt.Sprintf("/monitors/%s/pause", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath } - return c.Client.Do(req) -} -func (c *Client) GetIncident(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetIncidentRequest(c.Server, id) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) + if err != nil { return nil, err } - return c.Client.Do(req) + + return req, nil } -func (c *Client) AcknowledgeIncident(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAcknowledgeIncidentRequest(c.Server, id) +// NewListMonitorResultsRequest generates requests for ListMonitorResults +func NewListMonitorResultsRequest(server string, id openapi_types.UUID, params *ListMonitorResultsParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} -func (c *Client) ListMonitors(ctx context.Context, params *ListMonitorsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListMonitorsRequest(c.Server, params) + serverURL, err := url.Parse(server) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { + + operationPath := fmt.Sprintf("/monitors/%s/results", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { return nil, err } - return c.Client.Do(req) -} -func (c *Client) CreateMonitorWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateMonitorRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.From != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "from", *params.From, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "date-time"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.To != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "to", *params.To, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "date-time"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } -func (c *Client) CreateMonitor(ctx context.Context, body CreateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateMonitorRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } - return c.Client.Do(req) -} -func (c *Client) ApplyMonitorBulkActionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewApplyMonitorBulkActionRequestWithBody(c.Server, contentType, body) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} -func (c *Client) ApplyMonitorBulkAction(ctx context.Context, body ApplyMonitorBulkActionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewApplyMonitorBulkActionRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) + return req, nil } -func (c *Client) DeleteMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteMonitorRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} +// NewResumeMonitorRequest generates requests for ResumeMonitor +func NewResumeMonitorRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error -func (c *Client) GetMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMonitorRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} + var pathParam0 string -func (c *Client) UpdateMonitorWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateMonitorRequestWithBody(c.Server, id, contentType, body) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} -func (c *Client) UpdateMonitor(ctx context.Context, id openapi_types.UUID, body UpdateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateMonitorRequest(c.Server, id, body) + serverURL, err := url.Parse(server) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} -func (c *Client) GetMonitorAlerts(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMonitorAlertsRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + operationPath := fmt.Sprintf("/monitors/%s/resume", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath } - return c.Client.Do(req) -} -func (c *Client) SetMonitorAlertsWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewSetMonitorAlertsRequestWithBody(c.Server, id, contentType, body) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} -func (c *Client) SetMonitorAlerts(ctx context.Context, id openapi_types.UUID, body SetMonitorAlertsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewSetMonitorAlertsRequest(c.Server, id, body) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) + + return req, nil } -func (c *Client) GetMonitorAvailability(ctx context.Context, id openapi_types.UUID, params *GetMonitorAvailabilityParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMonitorAvailabilityRequest(c.Server, id, params) +// NewGetMonitorStatsRequest generates requests for GetMonitorStats +func NewGetMonitorStatsRequest(server string, id openapi_types.UUID, params *GetMonitorStatsParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} -func (c *Client) GetMonitorCertificate(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMonitorCertificateRequest(c.Server, id) + serverURL, err := url.Parse(server) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + + operationPath := fmt.Sprintf("/monitors/%s/stats", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath } - return c.Client.Do(req) -} -func (c *Client) RunMonitorCheck(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRunMonitorCheckRequest(c.Server, id) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "range", params.Range, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } - return c.Client.Do(req) -} -func (c *Client) PauseMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPauseMonitorRequest(c.Server, id) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) + + return req, nil } -func (c *Client) ListMonitorResults(ctx context.Context, id openapi_types.UUID, params *ListMonitorResultsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListMonitorResultsRequest(c.Server, id, params) +// NewListMonitorStatusChangesRequest generates requests for ListMonitorStatusChanges +func NewListMonitorStatusChangesRequest(server string, id openapi_types.UUID, params *ListMonitorStatusChangesParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} -func (c *Client) ResumeMonitor(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResumeMonitorRequest(c.Server, id) + serverURL, err := url.Parse(server) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + + operationPath := fmt.Sprintf("/monitors/%s/status-changes", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath } - return c.Client.Do(req) -} -func (c *Client) GetMonitorStats(ctx context.Context, id openapi_types.UUID, params *GetMonitorStatsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMonitorStatsRequest(c.Server, id, params) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } - return c.Client.Do(req) -} -func (c *Client) ListMonitorStatusChanges(ctx context.Context, id openapi_types.UUID, params *ListMonitorStatusChangesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListMonitorStatusChangesRequest(c.Server, id, params) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) + + return req, nil } -// NewListAlertChannelsRequest generates requests for ListAlertChannels -func NewListAlertChannelsRequest(server string, params *ListAlertChannelsParams) (*http.Request, error) { +// NewListStatusPagesRequest generates requests for ListStatusPages +func NewListStatusPagesRequest(server string, params *ListStatusPagesParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -3305,7 +6040,7 @@ func NewListAlertChannelsRequest(server string, params *ListAlertChannelsParams) return nil, err } - operationPath := fmt.Sprintf("/alert-channels") + operationPath := fmt.Sprintf("/status-pages") if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3348,6 +6083,18 @@ func NewListAlertChannelsRequest(server string, params *ListAlertChannelsParams) } + if params.MonitorId != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "monitorId", *params.MonitorId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "uuid"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + if encoded := queryValues.Encode(); encoded != "" { rawQueryFragments = append(rawQueryFragments, encoded) } @@ -3362,19 +6109,19 @@ func NewListAlertChannelsRequest(server string, params *ListAlertChannelsParams) return req, nil } -// NewCreateAlertChannelRequest calls the generic CreateAlertChannel builder with application/json body -func NewCreateAlertChannelRequest(server string, body CreateAlertChannelJSONRequestBody) (*http.Request, error) { +// NewCreateStatusPageRequest calls the generic CreateStatusPage builder with application/json body +func NewCreateStatusPageRequest(server string, body CreateStatusPageJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewCreateAlertChannelRequestWithBody(server, "application/json", bodyReader) + return NewCreateStatusPageRequestWithBody(server, "application/json", bodyReader) } -// NewCreateAlertChannelRequestWithBody generates requests for CreateAlertChannel with any type of body -func NewCreateAlertChannelRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewCreateStatusPageRequestWithBody generates requests for CreateStatusPage with any type of body +func NewCreateStatusPageRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -3382,7 +6129,7 @@ func NewCreateAlertChannelRequestWithBody(server string, contentType string, bod return nil, err } - operationPath := fmt.Sprintf("/alert-channels") + operationPath := fmt.Sprintf("/status-pages") if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3402,8 +6149,8 @@ func NewCreateAlertChannelRequestWithBody(server string, contentType string, bod return req, nil } -// NewDeleteAlertChannelRequest generates requests for DeleteAlertChannel -func NewDeleteAlertChannelRequest(server string, id openapi_types.UUID) (*http.Request, error) { +// NewDeleteStatusPageRequest generates requests for DeleteStatusPage +func NewDeleteStatusPageRequest(server string, id openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -3418,7 +6165,7 @@ func NewDeleteAlertChannelRequest(server string, id openapi_types.UUID) (*http.R return nil, err } - operationPath := fmt.Sprintf("/alert-channels/%s", pathParam0) + operationPath := fmt.Sprintf("/status-pages/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3436,8 +6183,8 @@ func NewDeleteAlertChannelRequest(server string, id openapi_types.UUID) (*http.R return req, nil } -// NewGetAlertChannelRequest generates requests for GetAlertChannel -func NewGetAlertChannelRequest(server string, id openapi_types.UUID) (*http.Request, error) { +// NewGetStatusPageRequest generates requests for GetStatusPage +func NewGetStatusPageRequest(server string, id openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -3452,7 +6199,7 @@ func NewGetAlertChannelRequest(server string, id openapi_types.UUID) (*http.Requ return nil, err } - operationPath := fmt.Sprintf("/alert-channels/%s", pathParam0) + operationPath := fmt.Sprintf("/status-pages/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3470,19 +6217,19 @@ func NewGetAlertChannelRequest(server string, id openapi_types.UUID) (*http.Requ return req, nil } -// NewUpdateAlertChannelRequest calls the generic UpdateAlertChannel builder with application/json body -func NewUpdateAlertChannelRequest(server string, id openapi_types.UUID, body UpdateAlertChannelJSONRequestBody) (*http.Request, error) { +// NewUpdateStatusPageRequest calls the generic UpdateStatusPage builder with application/json body +func NewUpdateStatusPageRequest(server string, id openapi_types.UUID, body UpdateStatusPageJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewUpdateAlertChannelRequestWithBody(server, id, "application/json", bodyReader) + return NewUpdateStatusPageRequestWithBody(server, id, "application/json", bodyReader) } -// NewUpdateAlertChannelRequestWithBody generates requests for UpdateAlertChannel with any type of body -func NewUpdateAlertChannelRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { +// NewUpdateStatusPageRequestWithBody generates requests for UpdateStatusPage with any type of body +func NewUpdateStatusPageRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -3497,7 +6244,7 @@ func NewUpdateAlertChannelRequestWithBody(server string, id openapi_types.UUID, return nil, err } - operationPath := fmt.Sprintf("/alert-channels/%s", pathParam0) + operationPath := fmt.Sprintf("/status-pages/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3517,8 +6264,8 @@ func NewUpdateAlertChannelRequestWithBody(server string, id openapi_types.UUID, return req, nil } -// NewListAlertChannelDeliveriesRequest generates requests for ListAlertChannelDeliveries -func NewListAlertChannelDeliveriesRequest(server string, id openapi_types.UUID, params *ListAlertChannelDeliveriesParams) (*http.Request, error) { +// NewListStatusPageIncidentsRequest generates requests for ListStatusPageIncidents +func NewListStatusPageIncidentsRequest(server string, id openapi_types.UUID, params *ListStatusPageIncidentsParams) (*http.Request, error) { var err error var pathParam0 string @@ -3533,7 +6280,7 @@ func NewListAlertChannelDeliveriesRequest(server string, id openapi_types.UUID, return nil, err } - operationPath := fmt.Sprintf("/alert-channels/%s/deliveries", pathParam0) + operationPath := fmt.Sprintf("/status-pages/%s/incidents", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3602,8 +6349,19 @@ func NewListAlertChannelDeliveriesRequest(server string, id openapi_types.UUID, return req, nil } -// NewTestAlertChannelRequest generates requests for TestAlertChannel -func NewTestAlertChannelRequest(server string, id openapi_types.UUID) (*http.Request, error) { +// NewCreateStatusPageIncidentRequest calls the generic CreateStatusPageIncident builder with application/json body +func NewCreateStatusPageIncidentRequest(server string, id openapi_types.UUID, body CreateStatusPageIncidentJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateStatusPageIncidentRequestWithBody(server, id, "application/json", bodyReader) +} + +// NewCreateStatusPageIncidentRequestWithBody generates requests for CreateStatusPageIncident with any type of body +func NewCreateStatusPageIncidentRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -3618,7 +6376,7 @@ func NewTestAlertChannelRequest(server string, id openapi_types.UUID) (*http.Req return nil, err } - operationPath := fmt.Sprintf("/alert-channels/%s/test", pathParam0) + operationPath := fmt.Sprintf("/status-pages/%s/incidents", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3628,16 +6386,18 @@ func NewTestAlertChannelRequest(server string, id openapi_types.UUID) (*http.Req return nil, err } - req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } -// NewSendAlertChannelVerificationRequest generates requests for SendAlertChannelVerification -func NewSendAlertChannelVerificationRequest(server string, id openapi_types.UUID) (*http.Request, error) { +// NewGetStatusPageIncidentRequest generates requests for GetStatusPageIncident +func NewGetStatusPageIncidentRequest(server string, id openapi_types.UUID, incidentId openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -3647,12 +6407,19 @@ func NewSendAlertChannelVerificationRequest(server string, id openapi_types.UUID return nil, err } + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "incidentId", incidentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/alert-channels/%s/verify", pathParam0) + operationPath := fmt.Sprintf("/status-pages/%s/incidents/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3662,7 +6429,7 @@ func NewSendAlertChannelVerificationRequest(server string, id openapi_types.UUID return nil, err } - req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } @@ -3670,19 +6437,19 @@ func NewSendAlertChannelVerificationRequest(server string, id openapi_types.UUID return req, nil } -// NewConfirmAlertChannelVerificationRequest calls the generic ConfirmAlertChannelVerification builder with application/json body -func NewConfirmAlertChannelVerificationRequest(server string, id openapi_types.UUID, body ConfirmAlertChannelVerificationJSONRequestBody) (*http.Request, error) { +// NewUpdateStatusPageIncidentRequest calls the generic UpdateStatusPageIncident builder with application/json body +func NewUpdateStatusPageIncidentRequest(server string, id openapi_types.UUID, incidentId openapi_types.UUID, body UpdateStatusPageIncidentJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewConfirmAlertChannelVerificationRequestWithBody(server, id, "application/json", bodyReader) + return NewUpdateStatusPageIncidentRequestWithBody(server, id, incidentId, "application/json", bodyReader) } -// NewConfirmAlertChannelVerificationRequestWithBody generates requests for ConfirmAlertChannelVerification with any type of body -func NewConfirmAlertChannelVerificationRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { +// NewUpdateStatusPageIncidentRequestWithBody generates requests for UpdateStatusPageIncident with any type of body +func NewUpdateStatusPageIncidentRequestWithBody(server string, id openapi_types.UUID, incidentId openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -3692,12 +6459,19 @@ func NewConfirmAlertChannelVerificationRequestWithBody(server string, id openapi return nil, err } + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "incidentId", incidentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/alert-channels/%s/verify/confirm", pathParam0) + operationPath := fmt.Sprintf("/status-pages/%s/incidents/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3707,7 +6481,7 @@ func NewConfirmAlertChannelVerificationRequestWithBody(server string, id openapi return nil, err } - req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + req, err := http.NewRequest(http.MethodPatch, queryURL.String(), body) if err != nil { return nil, err } @@ -3717,16 +6491,41 @@ func NewConfirmAlertChannelVerificationRequestWithBody(server string, id openapi return req, nil } -// NewListIncidentsRequest generates requests for ListIncidents -func NewListIncidentsRequest(server string, params *ListIncidentsParams) (*http.Request, error) { +// NewCreateStatusPageIncidentUpdateRequest calls the generic CreateStatusPageIncidentUpdate builder with application/json body +func NewCreateStatusPageIncidentUpdateRequest(server string, id openapi_types.UUID, incidentId openapi_types.UUID, body CreateStatusPageIncidentUpdateJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateStatusPageIncidentUpdateRequestWithBody(server, id, incidentId, "application/json", bodyReader) +} + +// NewCreateStatusPageIncidentUpdateRequestWithBody generates requests for CreateStatusPageIncidentUpdate with any type of body +func NewCreateStatusPageIncidentUpdateRequestWithBody(server string, id openapi_types.UUID, incidentId openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "incidentId", incidentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/incidents") + operationPath := fmt.Sprintf("/status-pages/%s/incidents/%s/updates", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3736,159 +6535,114 @@ func NewListIncidentsRequest(server string, params *ListIncidentsParams) (*http. return nil, err } - if params != nil { - // queryValues collects non-styled parameters (passthrough, JSON) - // that are safe to round-trip through url.Values.Encode(). - queryValues := queryURL.Query() - // rawQueryFragments collects pre-encoded query fragments from - // styled parameters, preserving literal commas as delimiters - // per the OpenAPI spec (e.g. "color=blue,black,brown"). - var rawQueryFragments []string - - if params.Acknowledged != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "acknowledged", *params.Acknowledged, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Aspect != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "aspect", *params.Aspect, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Cursor != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.From != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "from", *params.From, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "date-time"}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Limit != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } - } + req.Header.Add("Content-Type", contentType) - if params.MonitorId != nil { + return req, nil +} - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "monitorId", *params.MonitorId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "uuid"}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } +// NewGetStatusPageLayoutRequest generates requests for GetStatusPageLayout +func NewGetStatusPageLayoutRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error - } + var pathParam0 string - if params.Q != nil { + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "q", *params.Q, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - } + operationPath := fmt.Sprintf("/status-pages/%s/layout", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - if params.Severity != nil { + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "severity", *params.Severity, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } - } + return req, nil +} - if params.Status != nil { +// NewSetStatusPageLayoutRequest calls the generic SetStatusPageLayout builder with application/json body +func NewSetStatusPageLayoutRequest(server string, id openapi_types.UUID, body SetStatusPageLayoutJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewSetStatusPageLayoutRequestWithBody(server, id, "application/json", bodyReader) +} - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "status", *params.Status, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } +// NewSetStatusPageLayoutRequestWithBody generates requests for SetStatusPageLayout with any type of body +func NewSetStatusPageLayoutRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error - } + var pathParam0 string - if params.To != nil { + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "to", *params.To, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "date-time"}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - } + operationPath := fmt.Sprintf("/status-pages/%s/layout", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } - if encoded := queryValues.Encode(); encoded != "" { - rawQueryFragments = append(rawQueryFragments, encoded) - } - queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + req, err := http.NewRequest(http.MethodPut, queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } -// NewGetIncidentSummaryRequest generates requests for GetIncidentSummary -func NewGetIncidentSummaryRequest(server string) (*http.Request, error) { +// NewPreviewStatusPageRequest generates requests for PreviewStatusPage +func NewPreviewStatusPageRequest(server string, id openapi_types.UUID) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/incidents/summary") + operationPath := fmt.Sprintf("/status-pages/%s/preview", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3906,8 +6660,8 @@ func NewGetIncidentSummaryRequest(server string) (*http.Request, error) { return req, nil } -// NewGetIncidentRequest generates requests for GetIncident -func NewGetIncidentRequest(server string, id openapi_types.UUID) (*http.Request, error) { +// NewCreateStatusPagePreviewLinkRequest generates requests for CreateStatusPagePreviewLink +func NewCreateStatusPagePreviewLinkRequest(server string, id openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -3922,7 +6676,7 @@ func NewGetIncidentRequest(server string, id openapi_types.UUID) (*http.Request, return nil, err } - operationPath := fmt.Sprintf("/incidents/%s", pathParam0) + operationPath := fmt.Sprintf("/status-pages/%s/preview-link", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3932,7 +6686,7 @@ func NewGetIncidentRequest(server string, id openapi_types.UUID) (*http.Request, return nil, err } - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) if err != nil { return nil, err } @@ -3940,8 +6694,8 @@ func NewGetIncidentRequest(server string, id openapi_types.UUID) (*http.Request, return req, nil } -// NewAcknowledgeIncidentRequest generates requests for AcknowledgeIncident -func NewAcknowledgeIncidentRequest(server string, id openapi_types.UUID) (*http.Request, error) { +// NewPublishStatusPageRequest generates requests for PublishStatusPage +func NewPublishStatusPageRequest(server string, id openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -3956,7 +6710,7 @@ func NewAcknowledgeIncidentRequest(server string, id openapi_types.UUID) (*http. return nil, err } - operationPath := fmt.Sprintf("/incidents/%s/acknowledge", pathParam0) + operationPath := fmt.Sprintf("/status-pages/%s/publish", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3974,16 +6728,23 @@ func NewAcknowledgeIncidentRequest(server string, id openapi_types.UUID) (*http. return req, nil } -// NewListMonitorsRequest generates requests for ListMonitors -func NewListMonitorsRequest(server string, params *ListMonitorsParams) (*http.Request, error) { +// NewUnpublishStatusPageRequest generates requests for UnpublishStatusPage +func NewUnpublishStatusPageRequest(server string, id openapi_types.UUID) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/monitors") + operationPath := fmt.Sprintf("/status-pages/%s/unpublish", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3993,964 +6754,1226 @@ func NewListMonitorsRequest(server string, params *ListMonitorsParams) (*http.Re return nil, err } - if params != nil { - // queryValues collects non-styled parameters (passthrough, JSON) - // that are safe to round-trip through url.Values.Encode(). - queryValues := queryURL.Query() - // rawQueryFragments collects pre-encoded query fragments from - // styled parameters, preserving literal commas as delimiters - // per the OpenAPI spec (e.g. "color=blue,black,brown"). - var rawQueryFragments []string - - if params.Cursor != nil { + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) + if err != nil { + return nil, err + } - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } + return req, nil +} +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range c.RequestEditors { + if err := r(ctx, req); err != nil { + return err } - - if params.Include != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "include", *params.Include, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - + } + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err } + } + return nil +} - if params.Limit != nil { +// ClientWithResponses builds on ClientInterface to offer response payloads +type ClientWithResponses struct { + ClientInterface +} - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } +// NewClientWithResponses creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { + client, err := NewClient(server, opts...) + if err != nil { + return nil, err + } + return &ClientWithResponses{client}, nil +} +// WithBaseURL overrides the baseURL. +func WithBaseURL(baseURL string) ClientOption { + return func(c *Client) error { + newBaseURL, err := url.Parse(baseURL) + if err != nil { + return err } + c.Server = newBaseURL.String() + return nil + } +} - if params.Q != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "q", *params.Q, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { + // ListAlertChannelsWithResponse request + ListAlertChannelsWithResponse(ctx context.Context, params *ListAlertChannelsParams, reqEditors ...RequestEditorFn) (*ListAlertChannelsResponse, error) - } + // CreateAlertChannelWithBodyWithResponse request with any body + CreateAlertChannelWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateAlertChannelResponse, error) - if params.Sort != nil { + CreateAlertChannelWithResponse(ctx context.Context, body CreateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateAlertChannelResponse, error) - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "sort", *params.Sort, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } + // DeleteAlertChannelWithResponse request + DeleteAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteAlertChannelResponse, error) - } + // GetAlertChannelWithResponse request + GetAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetAlertChannelResponse, error) - if params.Status != nil { + // UpdateAlertChannelWithBodyWithResponse request with any body + UpdateAlertChannelWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateAlertChannelResponse, error) - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "status", *params.Status, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } + UpdateAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateAlertChannelResponse, error) - } + // ListAlertChannelDeliveriesWithResponse request + ListAlertChannelDeliveriesWithResponse(ctx context.Context, id openapi_types.UUID, params *ListAlertChannelDeliveriesParams, reqEditors ...RequestEditorFn) (*ListAlertChannelDeliveriesResponse, error) - if params.Type != nil { + // TestAlertChannelWithResponse request + TestAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*TestAlertChannelResponse, error) - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "type", *params.Type, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } + // SendAlertChannelVerificationWithResponse request + SendAlertChannelVerificationWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*SendAlertChannelVerificationResponse, error) - } + // ConfirmAlertChannelVerificationWithBodyWithResponse request with any body + ConfirmAlertChannelVerificationWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ConfirmAlertChannelVerificationResponse, error) - if encoded := queryValues.Encode(); encoded != "" { - rawQueryFragments = append(rawQueryFragments, encoded) - } - queryURL.RawQuery = strings.Join(rawQueryFragments, "&") - } + ConfirmAlertChannelVerificationWithResponse(ctx context.Context, id openapi_types.UUID, body ConfirmAlertChannelVerificationJSONRequestBody, reqEditors ...RequestEditorFn) (*ConfirmAlertChannelVerificationResponse, error) - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } + // ListIncidentsWithResponse request + ListIncidentsWithResponse(ctx context.Context, params *ListIncidentsParams, reqEditors ...RequestEditorFn) (*ListIncidentsResponse, error) - return req, nil -} + // GetIncidentSummaryWithResponse request + GetIncidentSummaryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetIncidentSummaryResponse, error) -// NewCreateMonitorRequest calls the generic CreateMonitor builder with application/json body -func NewCreateMonitorRequest(server string, body CreateMonitorJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateMonitorRequestWithBody(server, "application/json", bodyReader) -} + // GetIncidentWithResponse request + GetIncidentWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetIncidentResponse, error) -// NewCreateMonitorRequestWithBody generates requests for CreateMonitor with any type of body -func NewCreateMonitorRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error + // AcknowledgeIncidentWithResponse request + AcknowledgeIncidentWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*AcknowledgeIncidentResponse, error) - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } + // ListMonitorsWithResponse request + ListMonitorsWithResponse(ctx context.Context, params *ListMonitorsParams, reqEditors ...RequestEditorFn) (*ListMonitorsResponse, error) - operationPath := fmt.Sprintf("/monitors") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + // CreateMonitorWithBodyWithResponse request with any body + CreateMonitorWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateMonitorResponse, error) - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } + CreateMonitorWithResponse(ctx context.Context, body CreateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateMonitorResponse, error) - req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) - if err != nil { - return nil, err - } + // ApplyMonitorBulkActionWithBodyWithResponse request with any body + ApplyMonitorBulkActionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ApplyMonitorBulkActionResponse, error) - req.Header.Add("Content-Type", contentType) + ApplyMonitorBulkActionWithResponse(ctx context.Context, body ApplyMonitorBulkActionJSONRequestBody, reqEditors ...RequestEditorFn) (*ApplyMonitorBulkActionResponse, error) - return req, nil -} + // DeleteMonitorWithResponse request + DeleteMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteMonitorResponse, error) -// NewApplyMonitorBulkActionRequest calls the generic ApplyMonitorBulkAction builder with application/json body -func NewApplyMonitorBulkActionRequest(server string, body ApplyMonitorBulkActionJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewApplyMonitorBulkActionRequestWithBody(server, "application/json", bodyReader) -} + // GetMonitorWithResponse request + GetMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorResponse, error) -// NewApplyMonitorBulkActionRequestWithBody generates requests for ApplyMonitorBulkAction with any type of body -func NewApplyMonitorBulkActionRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error + // UpdateMonitorWithBodyWithResponse request with any body + UpdateMonitorWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateMonitorResponse, error) - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } + UpdateMonitorWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateMonitorResponse, error) - operationPath := fmt.Sprintf("/monitors/bulk") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + // GetMonitorAlertsWithResponse request + GetMonitorAlertsWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorAlertsResponse, error) - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } + // SetMonitorAlertsWithBodyWithResponse request with any body + SetMonitorAlertsWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetMonitorAlertsResponse, error) - req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) - if err != nil { - return nil, err - } + SetMonitorAlertsWithResponse(ctx context.Context, id openapi_types.UUID, body SetMonitorAlertsJSONRequestBody, reqEditors ...RequestEditorFn) (*SetMonitorAlertsResponse, error) - req.Header.Add("Content-Type", contentType) + // GetMonitorAvailabilityWithResponse request + GetMonitorAvailabilityWithResponse(ctx context.Context, id openapi_types.UUID, params *GetMonitorAvailabilityParams, reqEditors ...RequestEditorFn) (*GetMonitorAvailabilityResponse, error) - return req, nil -} + // GetMonitorCertificateWithResponse request + GetMonitorCertificateWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorCertificateResponse, error) -// NewDeleteMonitorRequest generates requests for DeleteMonitor -func NewDeleteMonitorRequest(server string, id openapi_types.UUID) (*http.Request, error) { - var err error + // RunMonitorCheckWithResponse request + RunMonitorCheckWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*RunMonitorCheckResponse, error) - var pathParam0 string + // PauseMonitorWithResponse request + PauseMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*PauseMonitorResponse, error) - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err - } + // ListMonitorResultsWithResponse request + ListMonitorResultsWithResponse(ctx context.Context, id openapi_types.UUID, params *ListMonitorResultsParams, reqEditors ...RequestEditorFn) (*ListMonitorResultsResponse, error) - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } + // ResumeMonitorWithResponse request + ResumeMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*ResumeMonitorResponse, error) - operationPath := fmt.Sprintf("/monitors/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + // GetMonitorStatsWithResponse request + GetMonitorStatsWithResponse(ctx context.Context, id openapi_types.UUID, params *GetMonitorStatsParams, reqEditors ...RequestEditorFn) (*GetMonitorStatsResponse, error) - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } + // ListMonitorStatusChangesWithResponse request + ListMonitorStatusChangesWithResponse(ctx context.Context, id openapi_types.UUID, params *ListMonitorStatusChangesParams, reqEditors ...RequestEditorFn) (*ListMonitorStatusChangesResponse, error) - req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil) - if err != nil { - return nil, err - } + // ListStatusPagesWithResponse request + ListStatusPagesWithResponse(ctx context.Context, params *ListStatusPagesParams, reqEditors ...RequestEditorFn) (*ListStatusPagesResponse, error) - return req, nil -} + // CreateStatusPageWithBodyWithResponse request with any body + CreateStatusPageWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateStatusPageResponse, error) -// NewGetMonitorRequest generates requests for GetMonitor -func NewGetMonitorRequest(server string, id openapi_types.UUID) (*http.Request, error) { - var err error + CreateStatusPageWithResponse(ctx context.Context, body CreateStatusPageJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateStatusPageResponse, error) - var pathParam0 string + // DeleteStatusPageWithResponse request + DeleteStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteStatusPageResponse, error) - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err - } + // GetStatusPageWithResponse request + GetStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetStatusPageResponse, error) - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } + // UpdateStatusPageWithBodyWithResponse request with any body + UpdateStatusPageWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateStatusPageResponse, error) - operationPath := fmt.Sprintf("/monitors/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + UpdateStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateStatusPageJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateStatusPageResponse, error) - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } + // ListStatusPageIncidentsWithResponse request + ListStatusPageIncidentsWithResponse(ctx context.Context, id openapi_types.UUID, params *ListStatusPageIncidentsParams, reqEditors ...RequestEditorFn) (*ListStatusPageIncidentsResponse, error) - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } + // CreateStatusPageIncidentWithBodyWithResponse request with any body + CreateStatusPageIncidentWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateStatusPageIncidentResponse, error) - return req, nil -} + CreateStatusPageIncidentWithResponse(ctx context.Context, id openapi_types.UUID, body CreateStatusPageIncidentJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateStatusPageIncidentResponse, error) -// NewUpdateMonitorRequest calls the generic UpdateMonitor builder with application/json body -func NewUpdateMonitorRequest(server string, id openapi_types.UUID, body UpdateMonitorJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateMonitorRequestWithBody(server, id, "application/json", bodyReader) -} + // GetStatusPageIncidentWithResponse request + GetStatusPageIncidentWithResponse(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetStatusPageIncidentResponse, error) -// NewUpdateMonitorRequestWithBody generates requests for UpdateMonitor with any type of body -func NewUpdateMonitorRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { - var err error + // UpdateStatusPageIncidentWithBodyWithResponse request with any body + UpdateStatusPageIncidentWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateStatusPageIncidentResponse, error) - var pathParam0 string + UpdateStatusPageIncidentWithResponse(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, body UpdateStatusPageIncidentJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateStatusPageIncidentResponse, error) - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err - } + // CreateStatusPageIncidentUpdateWithBodyWithResponse request with any body + CreateStatusPageIncidentUpdateWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateStatusPageIncidentUpdateResponse, error) - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } + CreateStatusPageIncidentUpdateWithResponse(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, body CreateStatusPageIncidentUpdateJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateStatusPageIncidentUpdateResponse, error) - operationPath := fmt.Sprintf("/monitors/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + // GetStatusPageLayoutWithResponse request + GetStatusPageLayoutWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetStatusPageLayoutResponse, error) - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } + // SetStatusPageLayoutWithBodyWithResponse request with any body + SetStatusPageLayoutWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetStatusPageLayoutResponse, error) - req, err := http.NewRequest(http.MethodPatch, queryURL.String(), body) - if err != nil { - return nil, err - } + SetStatusPageLayoutWithResponse(ctx context.Context, id openapi_types.UUID, body SetStatusPageLayoutJSONRequestBody, reqEditors ...RequestEditorFn) (*SetStatusPageLayoutResponse, error) - req.Header.Add("Content-Type", contentType) + // PreviewStatusPageWithResponse request + PreviewStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*PreviewStatusPageResponse, error) - return req, nil -} + // CreateStatusPagePreviewLinkWithResponse request + CreateStatusPagePreviewLinkWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*CreateStatusPagePreviewLinkResponse, error) -// NewGetMonitorAlertsRequest generates requests for GetMonitorAlerts -func NewGetMonitorAlertsRequest(server string, id openapi_types.UUID) (*http.Request, error) { - var err error + // PublishStatusPageWithResponse request + PublishStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*PublishStatusPageResponse, error) - var pathParam0 string + // UnpublishStatusPageWithResponse request + UnpublishStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*UnpublishStatusPageResponse, error) +} - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err +type ListAlertChannelsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoAlertChannel `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` } + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem +} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err +// Status returns HTTPResponse.Status +func (r ListAlertChannelsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - operationPath := fmt.Sprintf("/monitors/%s/alerts", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath +// StatusCode returns HTTPResponse.StatusCode +func (r ListAlertChannelsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListAlertChannelsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err +type CreateAlertChannelResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *DtoAlertChannelWithSecret + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem +} + +// Status returns HTTPResponse.Status +func (r CreateAlertChannelResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - return req, nil +// StatusCode returns HTTPResponse.StatusCode +func (r CreateAlertChannelResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 } -// NewSetMonitorAlertsRequest calls the generic SetMonitorAlerts builder with application/json body -func NewSetMonitorAlertsRequest(server string, id openapi_types.UUID, body SetMonitorAlertsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r CreateAlertChannelResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } - bodyReader = bytes.NewReader(buf) - return NewSetMonitorAlertsRequestWithBody(server, id, "application/json", bodyReader) + return "" } -// NewSetMonitorAlertsRequestWithBody generates requests for SetMonitorAlerts with any type of body -func NewSetMonitorAlertsRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { - var err error +type DeleteAlertChannelResponse struct { + Body []byte + HTTPResponse *http.Response + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - var pathParam0 string +// Status returns HTTPResponse.Status +func (r DeleteAlertChannelResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteAlertChannelResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r DeleteAlertChannelResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} - operationPath := fmt.Sprintf("/monitors/%s/alerts", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } +type GetAlertChannelResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoAlertChannel + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err +// Status returns HTTPResponse.Status +func (r GetAlertChannelResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - req, err := http.NewRequest(http.MethodPut, queryURL.String(), body) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r GetAlertChannelResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } - - req.Header.Add("Content-Type", contentType) - - return req, nil + return 0 } -// NewGetMonitorAvailabilityRequest generates requests for GetMonitorAvailability -func NewGetMonitorAvailabilityRequest(server string, id openapi_types.UUID, params *GetMonitorAvailabilityParams) (*http.Request, error) { - var err error +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetAlertChannelResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - var pathParam0 string +type UpdateAlertChannelResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoAlertChannelWithSecret + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err +// Status returns HTTPResponse.Status +func (r UpdateAlertChannelResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r UpdateAlertChannelResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - operationPath := fmt.Sprintf("/monitors/%s/availability", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r UpdateAlertChannelResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err +type ListAlertChannelDeliveriesResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoChannelDelivery `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` } + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - if params != nil { - // queryValues collects non-styled parameters (passthrough, JSON) - // that are safe to round-trip through url.Values.Encode(). - queryValues := queryURL.Query() - // rawQueryFragments collects pre-encoded query fragments from - // styled parameters, preserving literal commas as delimiters - // per the OpenAPI spec (e.g. "color=blue,black,brown"). - var rawQueryFragments []string - - if params.Days != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "days", *params.Days, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if encoded := queryValues.Encode(); encoded != "" { - rawQueryFragments = append(rawQueryFragments, encoded) - } - queryURL.RawQuery = strings.Join(rawQueryFragments, "&") +// Status returns HTTPResponse.Status +func (r ListAlertChannelDeliveriesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r ListAlertChannelDeliveriesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } - - return req, nil + return 0 } -// NewGetMonitorCertificateRequest generates requests for GetMonitorCertificate -func NewGetMonitorCertificateRequest(server string, id openapi_types.UUID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListAlertChannelDeliveriesResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } +type TestAlertChannelResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoAlertChannelTestResult + JSON401 *ResponseProblem + JSON402 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem + JSON409 *ResponseProblem + JSON429 *ResponseProblem + JSON503 *ResponseProblem +} - operationPath := fmt.Sprintf("/monitors/%s/certificate", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath +// Status returns HTTPResponse.Status +func (r TestAlertChannelResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r TestAlertChannelResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r TestAlertChannelResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } - - return req, nil + return "" } -// NewRunMonitorCheckRequest generates requests for RunMonitorCheck -func NewRunMonitorCheckRequest(server string, id openapi_types.UUID) (*http.Request, error) { - var err error - - var pathParam0 string +type SendAlertChannelVerificationResponse struct { + Body []byte + HTTPResponse *http.Response + JSON401 *ResponseProblem + JSON402 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem + JSON409 *ResponseProblem +} - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err +// Status returns HTTPResponse.Status +func (r SendAlertChannelVerificationResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r SendAlertChannelVerificationResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - operationPath := fmt.Sprintf("/monitors/%s/check", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r SendAlertChannelVerificationResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} + +type ConfirmAlertChannelVerificationResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoAlertChannel + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem + JSON409 *ResponseProblem +} - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err +// Status returns HTTPResponse.Status +func (r ConfirmAlertChannelVerificationResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r ConfirmAlertChannelVerificationResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } - - return req, nil + return 0 } -// NewPauseMonitorRequest generates requests for PauseMonitor -func NewPauseMonitorRequest(server string, id openapi_types.UUID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ConfirmAlertChannelVerificationResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err +type ListIncidentsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoIncident `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` } + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem +} - operationPath := fmt.Sprintf("/monitors/%s/pause", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath +// Status returns HTTPResponse.Status +func (r ListIncidentsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r ListIncidentsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListIncidentsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } - - return req, nil + return "" } -// NewListMonitorResultsRequest generates requests for ListMonitorResults -func NewListMonitorResultsRequest(server string, id openapi_types.UUID, params *ListMonitorResultsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err - } +type GetIncidentSummaryResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoIncidentSummary + JSON401 *ResponseProblem + JSON403 *ResponseProblem +} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err +// Status returns HTTPResponse.Status +func (r GetIncidentSummaryResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - operationPath := fmt.Sprintf("/monitors/%s/results", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath +// StatusCode returns HTTPResponse.StatusCode +func (r GetIncidentSummaryResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetIncidentSummaryResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} - if params != nil { - // queryValues collects non-styled parameters (passthrough, JSON) - // that are safe to round-trip through url.Values.Encode(). - queryValues := queryURL.Query() - // rawQueryFragments collects pre-encoded query fragments from - // styled parameters, preserving literal commas as delimiters - // per the OpenAPI spec (e.g. "color=blue,black,brown"). - var rawQueryFragments []string - - if params.Cursor != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.From != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "from", *params.From, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "date-time"}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Limit != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.To != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "to", *params.To, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "date-time"}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } +type GetIncidentResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoIncidentDetail + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - } +// Status returns HTTPResponse.Status +func (r GetIncidentResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - if encoded := queryValues.Encode(); encoded != "" { - rawQueryFragments = append(rawQueryFragments, encoded) - } - queryURL.RawQuery = strings.Join(rawQueryFragments, "&") +// StatusCode returns HTTPResponse.StatusCode +func (r GetIncidentResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetIncidentResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} - return req, nil +type AcknowledgeIncidentResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoIncidentDetail + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem } -// NewResumeMonitorRequest generates requests for ResumeMonitor -func NewResumeMonitorRequest(server string, id openapi_types.UUID) (*http.Request, error) { - var err error +// Status returns HTTPResponse.Status +func (r AcknowledgeIncidentResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - var pathParam0 string +// StatusCode returns HTTPResponse.StatusCode +func (r AcknowledgeIncidentResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r AcknowledgeIncidentResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err +type ListMonitorsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoMonitor `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` } + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem +} - operationPath := fmt.Sprintf("/monitors/%s/resume", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath +// Status returns HTTPResponse.Status +func (r ListMonitorsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r ListMonitorsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListMonitorsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } - - return req, nil + return "" } -// NewGetMonitorStatsRequest generates requests for GetMonitorStats -func NewGetMonitorStatsRequest(server string, id openapi_types.UUID, params *GetMonitorStatsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err - } +type CreateMonitorResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *DtoMonitor + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON402 *ResponseProblem + JSON403 *ResponseProblem + JSON503 *ResponseProblem +} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err +// Status returns HTTPResponse.Status +func (r CreateMonitorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - operationPath := fmt.Sprintf("/monitors/%s/stats", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath +// StatusCode returns HTTPResponse.StatusCode +func (r CreateMonitorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r CreateMonitorResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} - if params != nil { - // queryValues collects non-styled parameters (passthrough, JSON) - // that are safe to round-trip through url.Values.Encode(). - queryValues := queryURL.Query() - // rawQueryFragments collects pre-encoded query fragments from - // styled parameters, preserving literal commas as delimiters - // per the OpenAPI spec (e.g. "color=blue,black,brown"). - var rawQueryFragments []string - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "range", params.Range, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } +type ApplyMonitorBulkActionResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoMonitorBulkResult + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON429 *ResponseProblem + JSON503 *ResponseProblem +} - if encoded := queryValues.Encode(); encoded != "" { - rawQueryFragments = append(rawQueryFragments, encoded) - } - queryURL.RawQuery = strings.Join(rawQueryFragments, "&") +// Status returns HTTPResponse.Status +func (r ApplyMonitorBulkActionResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r ApplyMonitorBulkActionResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } - - return req, nil + return 0 } -// NewListMonitorStatusChangesRequest generates requests for ListMonitorStatusChanges -func NewListMonitorStatusChangesRequest(server string, id openapi_types.UUID, params *ListMonitorStatusChangesParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ApplyMonitorBulkActionResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" +} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } +type DeleteMonitorResponse struct { + Body []byte + HTTPResponse *http.Response + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem + JSON409 *ResponseProblem +} - operationPath := fmt.Sprintf("/monitors/%s/status-changes", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath +// Status returns HTTPResponse.Status +func (r DeleteMonitorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status } + return http.StatusText(0) +} - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteMonitorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - if params != nil { - // queryValues collects non-styled parameters (passthrough, JSON) - // that are safe to round-trip through url.Values.Encode(). - queryValues := queryURL.Query() - // rawQueryFragments collects pre-encoded query fragments from - // styled parameters, preserving literal commas as delimiters - // per the OpenAPI spec (e.g. "color=blue,black,brown"). - var rawQueryFragments []string +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r DeleteMonitorResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - if params.Cursor != nil { +type GetMonitorResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoMonitor + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } +// Status returns HTTPResponse.Status +func (r GetMonitorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - } +// StatusCode returns HTTPResponse.StatusCode +func (r GetMonitorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - if params.Limit != nil { +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetMonitorResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } +type UpdateMonitorResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoMonitor + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem + JSON503 *ResponseProblem +} - } +// Status returns HTTPResponse.Status +func (r UpdateMonitorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - if encoded := queryValues.Encode(); encoded != "" { - rawQueryFragments = append(rawQueryFragments, encoded) - } - queryURL.RawQuery = strings.Join(rawQueryFragments, "&") +// StatusCode returns HTTPResponse.StatusCode +func (r UpdateMonitorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } + return 0 +} - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r UpdateMonitorResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } - - return req, nil + return "" } -func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { - for _, r := range c.RequestEditors { - if err := r(ctx, req); err != nil { - return err - } - } - for _, r := range additionalEditors { - if err := r(ctx, req); err != nil { - return err - } - } - return nil +type GetMonitorAlertsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoMonitorAlerts + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem } -// ClientWithResponses builds on ClientInterface to offer response payloads -type ClientWithResponses struct { - ClientInterface +// Status returns HTTPResponse.Status +func (r GetMonitorAlertsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) } -// NewClientWithResponses creates a new ClientWithResponses, which wraps -// Client with return type handling -func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { - client, err := NewClient(server, opts...) - if err != nil { - return nil, err +// StatusCode returns HTTPResponse.StatusCode +func (r GetMonitorAlertsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode } - return &ClientWithResponses{client}, nil + return 0 } -// WithBaseURL overrides the baseURL. -func WithBaseURL(baseURL string) ClientOption { - return func(c *Client) error { - newBaseURL, err := url.Parse(baseURL) - if err != nil { - return err - } - c.Server = newBaseURL.String() - return nil +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetMonitorAlertsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") } + return "" } -// ClientWithResponsesInterface is the interface specification for the client with responses above. -type ClientWithResponsesInterface interface { - // ListAlertChannelsWithResponse request - ListAlertChannelsWithResponse(ctx context.Context, params *ListAlertChannelsParams, reqEditors ...RequestEditorFn) (*ListAlertChannelsResponse, error) +type SetMonitorAlertsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoMonitorAlerts + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - // CreateAlertChannelWithBodyWithResponse request with any body - CreateAlertChannelWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateAlertChannelResponse, error) +// Status returns HTTPResponse.Status +func (r SetMonitorAlertsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - CreateAlertChannelWithResponse(ctx context.Context, body CreateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateAlertChannelResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r SetMonitorAlertsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - // DeleteAlertChannelWithResponse request - DeleteAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteAlertChannelResponse, error) +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r SetMonitorAlertsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - // GetAlertChannelWithResponse request - GetAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetAlertChannelResponse, error) +type GetMonitorAvailabilityResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoAvailability + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - // UpdateAlertChannelWithBodyWithResponse request with any body - UpdateAlertChannelWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateAlertChannelResponse, error) +// Status returns HTTPResponse.Status +func (r GetMonitorAvailabilityResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - UpdateAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateAlertChannelResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r GetMonitorAvailabilityResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - // ListAlertChannelDeliveriesWithResponse request - ListAlertChannelDeliveriesWithResponse(ctx context.Context, id openapi_types.UUID, params *ListAlertChannelDeliveriesParams, reqEditors ...RequestEditorFn) (*ListAlertChannelDeliveriesResponse, error) +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetMonitorAvailabilityResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - // TestAlertChannelWithResponse request - TestAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*TestAlertChannelResponse, error) +type GetMonitorCertificateResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoMonitorCertificate + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - // SendAlertChannelVerificationWithResponse request - SendAlertChannelVerificationWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*SendAlertChannelVerificationResponse, error) +// Status returns HTTPResponse.Status +func (r GetMonitorCertificateResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - // ConfirmAlertChannelVerificationWithBodyWithResponse request with any body - ConfirmAlertChannelVerificationWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ConfirmAlertChannelVerificationResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r GetMonitorCertificateResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - ConfirmAlertChannelVerificationWithResponse(ctx context.Context, id openapi_types.UUID, body ConfirmAlertChannelVerificationJSONRequestBody, reqEditors ...RequestEditorFn) (*ConfirmAlertChannelVerificationResponse, error) +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetMonitorCertificateResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - // ListIncidentsWithResponse request - ListIncidentsWithResponse(ctx context.Context, params *ListIncidentsParams, reqEditors ...RequestEditorFn) (*ListIncidentsResponse, error) +type RunMonitorCheckResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoCheckResult + JSON401 *ResponseProblem + JSON402 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem + JSON429 *ResponseProblem +} - // GetIncidentSummaryWithResponse request - GetIncidentSummaryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetIncidentSummaryResponse, error) +// Status returns HTTPResponse.Status +func (r RunMonitorCheckResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - // GetIncidentWithResponse request - GetIncidentWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetIncidentResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r RunMonitorCheckResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - // AcknowledgeIncidentWithResponse request - AcknowledgeIncidentWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*AcknowledgeIncidentResponse, error) +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r RunMonitorCheckResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - // ListMonitorsWithResponse request - ListMonitorsWithResponse(ctx context.Context, params *ListMonitorsParams, reqEditors ...RequestEditorFn) (*ListMonitorsResponse, error) +type PauseMonitorResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoMonitor + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - // CreateMonitorWithBodyWithResponse request with any body - CreateMonitorWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateMonitorResponse, error) +// Status returns HTTPResponse.Status +func (r PauseMonitorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - CreateMonitorWithResponse(ctx context.Context, body CreateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateMonitorResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r PauseMonitorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - // ApplyMonitorBulkActionWithBodyWithResponse request with any body - ApplyMonitorBulkActionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ApplyMonitorBulkActionResponse, error) +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r PauseMonitorResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - ApplyMonitorBulkActionWithResponse(ctx context.Context, body ApplyMonitorBulkActionJSONRequestBody, reqEditors ...RequestEditorFn) (*ApplyMonitorBulkActionResponse, error) +type ListMonitorResultsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoCheckResult `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` + } + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - // DeleteMonitorWithResponse request - DeleteMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteMonitorResponse, error) +// Status returns HTTPResponse.Status +func (r ListMonitorResultsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - // GetMonitorWithResponse request - GetMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r ListMonitorResultsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - // UpdateMonitorWithBodyWithResponse request with any body - UpdateMonitorWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateMonitorResponse, error) +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListMonitorResultsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - UpdateMonitorWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateMonitorResponse, error) +type ResumeMonitorResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoMonitor + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - // GetMonitorAlertsWithResponse request - GetMonitorAlertsWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorAlertsResponse, error) +// Status returns HTTPResponse.Status +func (r ResumeMonitorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - // SetMonitorAlertsWithBodyWithResponse request with any body - SetMonitorAlertsWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetMonitorAlertsResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r ResumeMonitorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - SetMonitorAlertsWithResponse(ctx context.Context, id openapi_types.UUID, body SetMonitorAlertsJSONRequestBody, reqEditors ...RequestEditorFn) (*SetMonitorAlertsResponse, error) +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ResumeMonitorResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - // GetMonitorAvailabilityWithResponse request - GetMonitorAvailabilityWithResponse(ctx context.Context, id openapi_types.UUID, params *GetMonitorAvailabilityParams, reqEditors ...RequestEditorFn) (*GetMonitorAvailabilityResponse, error) +type GetMonitorStatsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoMonitorStats + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - // GetMonitorCertificateWithResponse request - GetMonitorCertificateWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorCertificateResponse, error) +// Status returns HTTPResponse.Status +func (r GetMonitorStatsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - // RunMonitorCheckWithResponse request - RunMonitorCheckWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*RunMonitorCheckResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r GetMonitorStatsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - // PauseMonitorWithResponse request - PauseMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*PauseMonitorResponse, error) +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetMonitorStatsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} - // ListMonitorResultsWithResponse request - ListMonitorResultsWithResponse(ctx context.Context, id openapi_types.UUID, params *ListMonitorResultsParams, reqEditors ...RequestEditorFn) (*ListMonitorResultsResponse, error) +type ListMonitorStatusChangesResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoStatusChange `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` + } + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem +} - // ResumeMonitorWithResponse request - ResumeMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*ResumeMonitorResponse, error) +// Status returns HTTPResponse.Status +func (r ListMonitorStatusChangesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - // GetMonitorStatsWithResponse request - GetMonitorStatsWithResponse(ctx context.Context, id openapi_types.UUID, params *GetMonitorStatsParams, reqEditors ...RequestEditorFn) (*GetMonitorStatsResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r ListMonitorStatusChangesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - // ListMonitorStatusChangesWithResponse request - ListMonitorStatusChangesWithResponse(ctx context.Context, id openapi_types.UUID, params *ListMonitorStatusChangesParams, reqEditors ...RequestEditorFn) (*ListMonitorStatusChangesResponse, error) +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListMonitorStatusChangesResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" } -type ListAlertChannelsResponse struct { +type ListStatusPagesResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoAlertChannel `json:"list"` + List []DtoStatusPage `json:"list"` Meta ResponseAPIResponsePaginationMeta `json:"meta"` } JSON400 *ResponseProblem @@ -4959,7 +7982,7 @@ type ListAlertChannelsResponse struct { } // Status returns HTTPResponse.Status -func (r ListAlertChannelsResponse) Status() string { +func (r ListStatusPagesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -4967,7 +7990,7 @@ func (r ListAlertChannelsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListAlertChannelsResponse) StatusCode() int { +func (r ListStatusPagesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -4975,24 +7998,26 @@ func (r ListAlertChannelsResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r ListAlertChannelsResponse) ContentType() string { +func (r ListStatusPagesResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type CreateAlertChannelResponse struct { +type CreateStatusPageResponse struct { Body []byte HTTPResponse *http.Response - JSON201 *DtoAlertChannelWithSecret + JSON201 *DtoStatusPage JSON400 *ResponseProblem JSON401 *ResponseProblem + JSON402 *ResponseProblem JSON403 *ResponseProblem + JSON409 *ResponseProblem } // Status returns HTTPResponse.Status -func (r CreateAlertChannelResponse) Status() string { +func (r CreateStatusPageResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5000,7 +8025,7 @@ func (r CreateAlertChannelResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r CreateAlertChannelResponse) StatusCode() int { +func (r CreateStatusPageResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5008,14 +8033,14 @@ func (r CreateAlertChannelResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r CreateAlertChannelResponse) ContentType() string { +func (r CreateStatusPageResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type DeleteAlertChannelResponse struct { +type DeleteStatusPageResponse struct { Body []byte HTTPResponse *http.Response JSON401 *ResponseProblem @@ -5024,7 +8049,7 @@ type DeleteAlertChannelResponse struct { } // Status returns HTTPResponse.Status -func (r DeleteAlertChannelResponse) Status() string { +func (r DeleteStatusPageResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5032,7 +8057,7 @@ func (r DeleteAlertChannelResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteAlertChannelResponse) StatusCode() int { +func (r DeleteStatusPageResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5040,24 +8065,24 @@ func (r DeleteAlertChannelResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r DeleteAlertChannelResponse) ContentType() string { +func (r DeleteStatusPageResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type GetAlertChannelResponse struct { +type GetStatusPageResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *DtoAlertChannel + JSON200 *DtoStatusPage JSON401 *ResponseProblem JSON403 *ResponseProblem JSON404 *ResponseProblem } // Status returns HTTPResponse.Status -func (r GetAlertChannelResponse) Status() string { +func (r GetStatusPageResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5065,7 +8090,7 @@ func (r GetAlertChannelResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetAlertChannelResponse) StatusCode() int { +func (r GetStatusPageResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5073,25 +8098,26 @@ func (r GetAlertChannelResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetAlertChannelResponse) ContentType() string { +func (r GetStatusPageResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type UpdateAlertChannelResponse struct { +type UpdateStatusPageResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *DtoAlertChannelWithSecret + JSON200 *DtoStatusPage JSON400 *ResponseProblem JSON401 *ResponseProblem JSON403 *ResponseProblem JSON404 *ResponseProblem + JSON409 *ResponseProblem } // Status returns HTTPResponse.Status -func (r UpdateAlertChannelResponse) Status() string { +func (r UpdateStatusPageResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5099,7 +8125,7 @@ func (r UpdateAlertChannelResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UpdateAlertChannelResponse) StatusCode() int { +func (r UpdateStatusPageResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5107,19 +8133,19 @@ func (r UpdateAlertChannelResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r UpdateAlertChannelResponse) ContentType() string { +func (r UpdateStatusPageResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type ListAlertChannelDeliveriesResponse struct { +type ListStatusPageIncidentsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoChannelDelivery `json:"list"` + List []DtoStatusPageIncident `json:"list"` Meta ResponseAPIResponsePaginationMeta `json:"meta"` } JSON400 *ResponseProblem @@ -5129,7 +8155,7 @@ type ListAlertChannelDeliveriesResponse struct { } // Status returns HTTPResponse.Status -func (r ListAlertChannelDeliveriesResponse) Status() string { +func (r ListStatusPageIncidentsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5137,7 +8163,7 @@ func (r ListAlertChannelDeliveriesResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListAlertChannelDeliveriesResponse) StatusCode() int { +func (r ListStatusPageIncidentsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5145,28 +8171,25 @@ func (r ListAlertChannelDeliveriesResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r ListAlertChannelDeliveriesResponse) ContentType() string { +func (r ListStatusPageIncidentsResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type TestAlertChannelResponse struct { +type CreateStatusPageIncidentResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *DtoAlertChannelTestResult + JSON201 *DtoStatusPageIncident + JSON400 *ResponseProblem JSON401 *ResponseProblem - JSON402 *ResponseProblem JSON403 *ResponseProblem JSON404 *ResponseProblem - JSON409 *ResponseProblem - JSON429 *ResponseProblem - JSON503 *ResponseProblem } // Status returns HTTPResponse.Status -func (r TestAlertChannelResponse) Status() string { +func (r CreateStatusPageIncidentResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5174,7 +8197,7 @@ func (r TestAlertChannelResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r TestAlertChannelResponse) StatusCode() int { +func (r CreateStatusPageIncidentResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5182,25 +8205,24 @@ func (r TestAlertChannelResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r TestAlertChannelResponse) ContentType() string { +func (r CreateStatusPageIncidentResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type SendAlertChannelVerificationResponse struct { +type GetStatusPageIncidentResponse struct { Body []byte HTTPResponse *http.Response + JSON200 *DtoStatusPageIncident JSON401 *ResponseProblem - JSON402 *ResponseProblem JSON403 *ResponseProblem JSON404 *ResponseProblem - JSON409 *ResponseProblem } // Status returns HTTPResponse.Status -func (r SendAlertChannelVerificationResponse) Status() string { +func (r GetStatusPageIncidentResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5208,7 +8230,7 @@ func (r SendAlertChannelVerificationResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r SendAlertChannelVerificationResponse) StatusCode() int { +func (r GetStatusPageIncidentResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5216,26 +8238,25 @@ func (r SendAlertChannelVerificationResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r SendAlertChannelVerificationResponse) ContentType() string { +func (r GetStatusPageIncidentResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type ConfirmAlertChannelVerificationResponse struct { +type UpdateStatusPageIncidentResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *DtoAlertChannel + JSON200 *DtoStatusPageIncident JSON400 *ResponseProblem JSON401 *ResponseProblem JSON403 *ResponseProblem JSON404 *ResponseProblem - JSON409 *ResponseProblem } // Status returns HTTPResponse.Status -func (r ConfirmAlertChannelVerificationResponse) Status() string { +func (r UpdateStatusPageIncidentResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5243,7 +8264,7 @@ func (r ConfirmAlertChannelVerificationResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ConfirmAlertChannelVerificationResponse) StatusCode() int { +func (r UpdateStatusPageIncidentResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5251,28 +8272,26 @@ func (r ConfirmAlertChannelVerificationResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r ConfirmAlertChannelVerificationResponse) ContentType() string { +func (r UpdateStatusPageIncidentResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type ListIncidentsResponse struct { +type CreateStatusPageIncidentUpdateResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *struct { - Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoIncident `json:"list"` - Meta ResponseAPIResponsePaginationMeta `json:"meta"` - } - JSON400 *ResponseProblem - JSON401 *ResponseProblem - JSON403 *ResponseProblem + JSON201 *DtoStatusPageIncident + JSON400 *ResponseProblem + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem + JSON409 *ResponseProblem } // Status returns HTTPResponse.Status -func (r ListIncidentsResponse) Status() string { +func (r CreateStatusPageIncidentUpdateResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5280,7 +8299,7 @@ func (r ListIncidentsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListIncidentsResponse) StatusCode() int { +func (r CreateStatusPageIncidentUpdateResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5288,23 +8307,24 @@ func (r ListIncidentsResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r ListIncidentsResponse) ContentType() string { +func (r CreateStatusPageIncidentUpdateResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type GetIncidentSummaryResponse struct { +type GetStatusPageLayoutResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *DtoIncidentSummary + JSON200 *DtoStatusPageLayout JSON401 *ResponseProblem JSON403 *ResponseProblem + JSON404 *ResponseProblem } // Status returns HTTPResponse.Status -func (r GetIncidentSummaryResponse) Status() string { +func (r GetStatusPageLayoutResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5312,7 +8332,7 @@ func (r GetIncidentSummaryResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetIncidentSummaryResponse) StatusCode() int { +func (r GetStatusPageLayoutResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5320,24 +8340,25 @@ func (r GetIncidentSummaryResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetIncidentSummaryResponse) ContentType() string { +func (r GetStatusPageLayoutResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type GetIncidentResponse struct { +type SetStatusPageLayoutResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *DtoIncidentDetail + JSON200 *DtoStatusPageLayout + JSON400 *ResponseProblem JSON401 *ResponseProblem JSON403 *ResponseProblem JSON404 *ResponseProblem } // Status returns HTTPResponse.Status -func (r GetIncidentResponse) Status() string { +func (r SetStatusPageLayoutResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5345,7 +8366,7 @@ func (r GetIncidentResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetIncidentResponse) StatusCode() int { +func (r SetStatusPageLayoutResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5353,24 +8374,24 @@ func (r GetIncidentResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetIncidentResponse) ContentType() string { +func (r SetStatusPageLayoutResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type AcknowledgeIncidentResponse struct { +type PreviewStatusPageResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *DtoIncidentDetail + JSON200 *DtoPublicStatusPreview JSON401 *ResponseProblem JSON403 *ResponseProblem JSON404 *ResponseProblem } // Status returns HTTPResponse.Status -func (r AcknowledgeIncidentResponse) Status() string { +func (r PreviewStatusPageResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5378,7 +8399,7 @@ func (r AcknowledgeIncidentResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r AcknowledgeIncidentResponse) StatusCode() int { +func (r PreviewStatusPageResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5386,28 +8407,24 @@ func (r AcknowledgeIncidentResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r AcknowledgeIncidentResponse) ContentType() string { +func (r PreviewStatusPageResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ListMonitorsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoMonitor `json:"list"` - Meta ResponseAPIResponsePaginationMeta `json:"meta"` - } - JSON400 *ResponseProblem - JSON401 *ResponseProblem - JSON403 *ResponseProblem + } + return "" +} + +type CreateStatusPagePreviewLinkResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DtoStatusPagePreviewLink + JSON401 *ResponseProblem + JSON403 *ResponseProblem + JSON404 *ResponseProblem } // Status returns HTTPResponse.Status -func (r ListMonitorsResponse) Status() string { +func (r CreateStatusPagePreviewLinkResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5415,7 +8432,7 @@ func (r ListMonitorsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListMonitorsResponse) StatusCode() int { +func (r CreateStatusPagePreviewLinkResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5423,26 +8440,26 @@ func (r ListMonitorsResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r ListMonitorsResponse) ContentType() string { +func (r CreateStatusPagePreviewLinkResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type CreateMonitorResponse struct { +type PublishStatusPageResponse struct { Body []byte HTTPResponse *http.Response - JSON201 *DtoMonitor - JSON400 *ResponseProblem + JSON200 *DtoStatusPage JSON401 *ResponseProblem JSON402 *ResponseProblem JSON403 *ResponseProblem - JSON503 *ResponseProblem + JSON404 *ResponseProblem + JSON409 *ResponseProblem } // Status returns HTTPResponse.Status -func (r CreateMonitorResponse) Status() string { +func (r PublishStatusPageResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5450,7 +8467,7 @@ func (r CreateMonitorResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r CreateMonitorResponse) StatusCode() int { +func (r PublishStatusPageResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5458,26 +8475,24 @@ func (r CreateMonitorResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r CreateMonitorResponse) ContentType() string { +func (r PublishStatusPageResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type ApplyMonitorBulkActionResponse struct { +type UnpublishStatusPageResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *DtoMonitorBulkResult - JSON400 *ResponseProblem + JSON200 *DtoStatusPage JSON401 *ResponseProblem JSON403 *ResponseProblem - JSON429 *ResponseProblem - JSON503 *ResponseProblem + JSON404 *ResponseProblem } // Status returns HTTPResponse.Status -func (r ApplyMonitorBulkActionResponse) Status() string { +func (r UnpublishStatusPageResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5485,7 +8500,7 @@ func (r ApplyMonitorBulkActionResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ApplyMonitorBulkActionResponse) StatusCode() int { +func (r UnpublishStatusPageResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5493,800 +8508,1265 @@ func (r ApplyMonitorBulkActionResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r ApplyMonitorBulkActionResponse) ContentType() string { +func (r UnpublishStatusPageResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } - return "" + return "" +} + +// ListAlertChannelsWithResponse request returning *ListAlertChannelsResponse +func (c *ClientWithResponses) ListAlertChannelsWithResponse(ctx context.Context, params *ListAlertChannelsParams, reqEditors ...RequestEditorFn) (*ListAlertChannelsResponse, error) { + rsp, err := c.ListAlertChannels(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListAlertChannelsResponse(rsp) +} + +// CreateAlertChannelWithBodyWithResponse request with arbitrary body returning *CreateAlertChannelResponse +func (c *ClientWithResponses) CreateAlertChannelWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateAlertChannelResponse, error) { + rsp, err := c.CreateAlertChannelWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateAlertChannelResponse(rsp) +} + +func (c *ClientWithResponses) CreateAlertChannelWithResponse(ctx context.Context, body CreateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateAlertChannelResponse, error) { + rsp, err := c.CreateAlertChannel(ctx, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateAlertChannelResponse(rsp) +} + +// DeleteAlertChannelWithResponse request returning *DeleteAlertChannelResponse +func (c *ClientWithResponses) DeleteAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteAlertChannelResponse, error) { + rsp, err := c.DeleteAlertChannel(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteAlertChannelResponse(rsp) +} + +// GetAlertChannelWithResponse request returning *GetAlertChannelResponse +func (c *ClientWithResponses) GetAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetAlertChannelResponse, error) { + rsp, err := c.GetAlertChannel(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetAlertChannelResponse(rsp) +} + +// UpdateAlertChannelWithBodyWithResponse request with arbitrary body returning *UpdateAlertChannelResponse +func (c *ClientWithResponses) UpdateAlertChannelWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateAlertChannelResponse, error) { + rsp, err := c.UpdateAlertChannelWithBody(ctx, id, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateAlertChannelResponse(rsp) +} + +func (c *ClientWithResponses) UpdateAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateAlertChannelResponse, error) { + rsp, err := c.UpdateAlertChannel(ctx, id, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateAlertChannelResponse(rsp) +} + +// ListAlertChannelDeliveriesWithResponse request returning *ListAlertChannelDeliveriesResponse +func (c *ClientWithResponses) ListAlertChannelDeliveriesWithResponse(ctx context.Context, id openapi_types.UUID, params *ListAlertChannelDeliveriesParams, reqEditors ...RequestEditorFn) (*ListAlertChannelDeliveriesResponse, error) { + rsp, err := c.ListAlertChannelDeliveries(ctx, id, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListAlertChannelDeliveriesResponse(rsp) +} + +// TestAlertChannelWithResponse request returning *TestAlertChannelResponse +func (c *ClientWithResponses) TestAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*TestAlertChannelResponse, error) { + rsp, err := c.TestAlertChannel(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseTestAlertChannelResponse(rsp) +} + +// SendAlertChannelVerificationWithResponse request returning *SendAlertChannelVerificationResponse +func (c *ClientWithResponses) SendAlertChannelVerificationWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*SendAlertChannelVerificationResponse, error) { + rsp, err := c.SendAlertChannelVerification(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseSendAlertChannelVerificationResponse(rsp) +} + +// ConfirmAlertChannelVerificationWithBodyWithResponse request with arbitrary body returning *ConfirmAlertChannelVerificationResponse +func (c *ClientWithResponses) ConfirmAlertChannelVerificationWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ConfirmAlertChannelVerificationResponse, error) { + rsp, err := c.ConfirmAlertChannelVerificationWithBody(ctx, id, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseConfirmAlertChannelVerificationResponse(rsp) +} + +func (c *ClientWithResponses) ConfirmAlertChannelVerificationWithResponse(ctx context.Context, id openapi_types.UUID, body ConfirmAlertChannelVerificationJSONRequestBody, reqEditors ...RequestEditorFn) (*ConfirmAlertChannelVerificationResponse, error) { + rsp, err := c.ConfirmAlertChannelVerification(ctx, id, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseConfirmAlertChannelVerificationResponse(rsp) +} + +// ListIncidentsWithResponse request returning *ListIncidentsResponse +func (c *ClientWithResponses) ListIncidentsWithResponse(ctx context.Context, params *ListIncidentsParams, reqEditors ...RequestEditorFn) (*ListIncidentsResponse, error) { + rsp, err := c.ListIncidents(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListIncidentsResponse(rsp) +} + +// GetIncidentSummaryWithResponse request returning *GetIncidentSummaryResponse +func (c *ClientWithResponses) GetIncidentSummaryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetIncidentSummaryResponse, error) { + rsp, err := c.GetIncidentSummary(ctx, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetIncidentSummaryResponse(rsp) +} + +// GetIncidentWithResponse request returning *GetIncidentResponse +func (c *ClientWithResponses) GetIncidentWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetIncidentResponse, error) { + rsp, err := c.GetIncident(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetIncidentResponse(rsp) +} + +// AcknowledgeIncidentWithResponse request returning *AcknowledgeIncidentResponse +func (c *ClientWithResponses) AcknowledgeIncidentWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*AcknowledgeIncidentResponse, error) { + rsp, err := c.AcknowledgeIncident(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseAcknowledgeIncidentResponse(rsp) +} + +// ListMonitorsWithResponse request returning *ListMonitorsResponse +func (c *ClientWithResponses) ListMonitorsWithResponse(ctx context.Context, params *ListMonitorsParams, reqEditors ...RequestEditorFn) (*ListMonitorsResponse, error) { + rsp, err := c.ListMonitors(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListMonitorsResponse(rsp) +} + +// CreateMonitorWithBodyWithResponse request with arbitrary body returning *CreateMonitorResponse +func (c *ClientWithResponses) CreateMonitorWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateMonitorResponse, error) { + rsp, err := c.CreateMonitorWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateMonitorResponse(rsp) +} + +func (c *ClientWithResponses) CreateMonitorWithResponse(ctx context.Context, body CreateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateMonitorResponse, error) { + rsp, err := c.CreateMonitor(ctx, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateMonitorResponse(rsp) +} + +// ApplyMonitorBulkActionWithBodyWithResponse request with arbitrary body returning *ApplyMonitorBulkActionResponse +func (c *ClientWithResponses) ApplyMonitorBulkActionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ApplyMonitorBulkActionResponse, error) { + rsp, err := c.ApplyMonitorBulkActionWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseApplyMonitorBulkActionResponse(rsp) +} + +func (c *ClientWithResponses) ApplyMonitorBulkActionWithResponse(ctx context.Context, body ApplyMonitorBulkActionJSONRequestBody, reqEditors ...RequestEditorFn) (*ApplyMonitorBulkActionResponse, error) { + rsp, err := c.ApplyMonitorBulkAction(ctx, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseApplyMonitorBulkActionResponse(rsp) +} + +// DeleteMonitorWithResponse request returning *DeleteMonitorResponse +func (c *ClientWithResponses) DeleteMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteMonitorResponse, error) { + rsp, err := c.DeleteMonitor(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteMonitorResponse(rsp) +} + +// GetMonitorWithResponse request returning *GetMonitorResponse +func (c *ClientWithResponses) GetMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorResponse, error) { + rsp, err := c.GetMonitor(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetMonitorResponse(rsp) +} + +// UpdateMonitorWithBodyWithResponse request with arbitrary body returning *UpdateMonitorResponse +func (c *ClientWithResponses) UpdateMonitorWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateMonitorResponse, error) { + rsp, err := c.UpdateMonitorWithBody(ctx, id, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateMonitorResponse(rsp) +} + +func (c *ClientWithResponses) UpdateMonitorWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateMonitorResponse, error) { + rsp, err := c.UpdateMonitor(ctx, id, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateMonitorResponse(rsp) +} + +// GetMonitorAlertsWithResponse request returning *GetMonitorAlertsResponse +func (c *ClientWithResponses) GetMonitorAlertsWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorAlertsResponse, error) { + rsp, err := c.GetMonitorAlerts(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetMonitorAlertsResponse(rsp) } -type DeleteMonitorResponse struct { - Body []byte - HTTPResponse *http.Response - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem - JSON409 *ResponseProblem +// SetMonitorAlertsWithBodyWithResponse request with arbitrary body returning *SetMonitorAlertsResponse +func (c *ClientWithResponses) SetMonitorAlertsWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetMonitorAlertsResponse, error) { + rsp, err := c.SetMonitorAlertsWithBody(ctx, id, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseSetMonitorAlertsResponse(rsp) } -// Status returns HTTPResponse.Status -func (r DeleteMonitorResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +func (c *ClientWithResponses) SetMonitorAlertsWithResponse(ctx context.Context, id openapi_types.UUID, body SetMonitorAlertsJSONRequestBody, reqEditors ...RequestEditorFn) (*SetMonitorAlertsResponse, error) { + rsp, err := c.SetMonitorAlerts(ctx, id, body, reqEditors...) + if err != nil { + return nil, err } - return http.StatusText(0) + return ParseSetMonitorAlertsResponse(rsp) } -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteMonitorResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// GetMonitorAvailabilityWithResponse request returning *GetMonitorAvailabilityResponse +func (c *ClientWithResponses) GetMonitorAvailabilityWithResponse(ctx context.Context, id openapi_types.UUID, params *GetMonitorAvailabilityParams, reqEditors ...RequestEditorFn) (*GetMonitorAvailabilityResponse, error) { + rsp, err := c.GetMonitorAvailability(ctx, id, params, reqEditors...) + if err != nil { + return nil, err } - return 0 + return ParseGetMonitorAvailabilityResponse(rsp) } -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r DeleteMonitorResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") +// GetMonitorCertificateWithResponse request returning *GetMonitorCertificateResponse +func (c *ClientWithResponses) GetMonitorCertificateWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorCertificateResponse, error) { + rsp, err := c.GetMonitorCertificate(ctx, id, reqEditors...) + if err != nil { + return nil, err } - return "" + return ParseGetMonitorCertificateResponse(rsp) } -type GetMonitorResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DtoMonitor - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem +// RunMonitorCheckWithResponse request returning *RunMonitorCheckResponse +func (c *ClientWithResponses) RunMonitorCheckWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*RunMonitorCheckResponse, error) { + rsp, err := c.RunMonitorCheck(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseRunMonitorCheckResponse(rsp) } -// Status returns HTTPResponse.Status -func (r GetMonitorResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// PauseMonitorWithResponse request returning *PauseMonitorResponse +func (c *ClientWithResponses) PauseMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*PauseMonitorResponse, error) { + rsp, err := c.PauseMonitor(ctx, id, reqEditors...) + if err != nil { + return nil, err } - return http.StatusText(0) + return ParsePauseMonitorResponse(rsp) } -// StatusCode returns HTTPResponse.StatusCode -func (r GetMonitorResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// ListMonitorResultsWithResponse request returning *ListMonitorResultsResponse +func (c *ClientWithResponses) ListMonitorResultsWithResponse(ctx context.Context, id openapi_types.UUID, params *ListMonitorResultsParams, reqEditors ...RequestEditorFn) (*ListMonitorResultsResponse, error) { + rsp, err := c.ListMonitorResults(ctx, id, params, reqEditors...) + if err != nil { + return nil, err } - return 0 + return ParseListMonitorResultsResponse(rsp) } -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMonitorResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") +// ResumeMonitorWithResponse request returning *ResumeMonitorResponse +func (c *ClientWithResponses) ResumeMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*ResumeMonitorResponse, error) { + rsp, err := c.ResumeMonitor(ctx, id, reqEditors...) + if err != nil { + return nil, err } - return "" + return ParseResumeMonitorResponse(rsp) } -type UpdateMonitorResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DtoMonitor - JSON400 *ResponseProblem - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem - JSON503 *ResponseProblem +// GetMonitorStatsWithResponse request returning *GetMonitorStatsResponse +func (c *ClientWithResponses) GetMonitorStatsWithResponse(ctx context.Context, id openapi_types.UUID, params *GetMonitorStatsParams, reqEditors ...RequestEditorFn) (*GetMonitorStatsResponse, error) { + rsp, err := c.GetMonitorStats(ctx, id, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetMonitorStatsResponse(rsp) } -// Status returns HTTPResponse.Status -func (r UpdateMonitorResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// ListMonitorStatusChangesWithResponse request returning *ListMonitorStatusChangesResponse +func (c *ClientWithResponses) ListMonitorStatusChangesWithResponse(ctx context.Context, id openapi_types.UUID, params *ListMonitorStatusChangesParams, reqEditors ...RequestEditorFn) (*ListMonitorStatusChangesResponse, error) { + rsp, err := c.ListMonitorStatusChanges(ctx, id, params, reqEditors...) + if err != nil { + return nil, err } - return http.StatusText(0) + return ParseListMonitorStatusChangesResponse(rsp) } -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateMonitorResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// ListStatusPagesWithResponse request returning *ListStatusPagesResponse +func (c *ClientWithResponses) ListStatusPagesWithResponse(ctx context.Context, params *ListStatusPagesParams, reqEditors ...RequestEditorFn) (*ListStatusPagesResponse, error) { + rsp, err := c.ListStatusPages(ctx, params, reqEditors...) + if err != nil { + return nil, err } - return 0 + return ParseListStatusPagesResponse(rsp) } -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r UpdateMonitorResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") +// CreateStatusPageWithBodyWithResponse request with arbitrary body returning *CreateStatusPageResponse +func (c *ClientWithResponses) CreateStatusPageWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateStatusPageResponse, error) { + rsp, err := c.CreateStatusPageWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err } - return "" + return ParseCreateStatusPageResponse(rsp) } -type GetMonitorAlertsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DtoMonitorAlerts - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem +func (c *ClientWithResponses) CreateStatusPageWithResponse(ctx context.Context, body CreateStatusPageJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateStatusPageResponse, error) { + rsp, err := c.CreateStatusPage(ctx, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateStatusPageResponse(rsp) } -// Status returns HTTPResponse.Status -func (r GetMonitorAlertsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// DeleteStatusPageWithResponse request returning *DeleteStatusPageResponse +func (c *ClientWithResponses) DeleteStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteStatusPageResponse, error) { + rsp, err := c.DeleteStatusPage(ctx, id, reqEditors...) + if err != nil { + return nil, err } - return http.StatusText(0) + return ParseDeleteStatusPageResponse(rsp) } -// StatusCode returns HTTPResponse.StatusCode -func (r GetMonitorAlertsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// GetStatusPageWithResponse request returning *GetStatusPageResponse +func (c *ClientWithResponses) GetStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetStatusPageResponse, error) { + rsp, err := c.GetStatusPage(ctx, id, reqEditors...) + if err != nil { + return nil, err } - return 0 + return ParseGetStatusPageResponse(rsp) } -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMonitorAlertsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") +// UpdateStatusPageWithBodyWithResponse request with arbitrary body returning *UpdateStatusPageResponse +func (c *ClientWithResponses) UpdateStatusPageWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateStatusPageResponse, error) { + rsp, err := c.UpdateStatusPageWithBody(ctx, id, contentType, body, reqEditors...) + if err != nil { + return nil, err } - return "" + return ParseUpdateStatusPageResponse(rsp) } -type SetMonitorAlertsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DtoMonitorAlerts - JSON400 *ResponseProblem - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem +func (c *ClientWithResponses) UpdateStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateStatusPageJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateStatusPageResponse, error) { + rsp, err := c.UpdateStatusPage(ctx, id, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateStatusPageResponse(rsp) } -// Status returns HTTPResponse.Status -func (r SetMonitorAlertsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// ListStatusPageIncidentsWithResponse request returning *ListStatusPageIncidentsResponse +func (c *ClientWithResponses) ListStatusPageIncidentsWithResponse(ctx context.Context, id openapi_types.UUID, params *ListStatusPageIncidentsParams, reqEditors ...RequestEditorFn) (*ListStatusPageIncidentsResponse, error) { + rsp, err := c.ListStatusPageIncidents(ctx, id, params, reqEditors...) + if err != nil { + return nil, err } - return http.StatusText(0) + return ParseListStatusPageIncidentsResponse(rsp) } -// StatusCode returns HTTPResponse.StatusCode -func (r SetMonitorAlertsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// CreateStatusPageIncidentWithBodyWithResponse request with arbitrary body returning *CreateStatusPageIncidentResponse +func (c *ClientWithResponses) CreateStatusPageIncidentWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateStatusPageIncidentResponse, error) { + rsp, err := c.CreateStatusPageIncidentWithBody(ctx, id, contentType, body, reqEditors...) + if err != nil { + return nil, err } - return 0 + return ParseCreateStatusPageIncidentResponse(rsp) } -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r SetMonitorAlertsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") +func (c *ClientWithResponses) CreateStatusPageIncidentWithResponse(ctx context.Context, id openapi_types.UUID, body CreateStatusPageIncidentJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateStatusPageIncidentResponse, error) { + rsp, err := c.CreateStatusPageIncident(ctx, id, body, reqEditors...) + if err != nil { + return nil, err } - return "" + return ParseCreateStatusPageIncidentResponse(rsp) } -type GetMonitorAvailabilityResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DtoAvailability - JSON400 *ResponseProblem - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem +// GetStatusPageIncidentWithResponse request returning *GetStatusPageIncidentResponse +func (c *ClientWithResponses) GetStatusPageIncidentWithResponse(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetStatusPageIncidentResponse, error) { + rsp, err := c.GetStatusPageIncident(ctx, id, incidentId, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetStatusPageIncidentResponse(rsp) } -// Status returns HTTPResponse.Status -func (r GetMonitorAvailabilityResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// UpdateStatusPageIncidentWithBodyWithResponse request with arbitrary body returning *UpdateStatusPageIncidentResponse +func (c *ClientWithResponses) UpdateStatusPageIncidentWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateStatusPageIncidentResponse, error) { + rsp, err := c.UpdateStatusPageIncidentWithBody(ctx, id, incidentId, contentType, body, reqEditors...) + if err != nil { + return nil, err } - return http.StatusText(0) + return ParseUpdateStatusPageIncidentResponse(rsp) } -// StatusCode returns HTTPResponse.StatusCode -func (r GetMonitorAvailabilityResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +func (c *ClientWithResponses) UpdateStatusPageIncidentWithResponse(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, body UpdateStatusPageIncidentJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateStatusPageIncidentResponse, error) { + rsp, err := c.UpdateStatusPageIncident(ctx, id, incidentId, body, reqEditors...) + if err != nil { + return nil, err } - return 0 + return ParseUpdateStatusPageIncidentResponse(rsp) } -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMonitorAvailabilityResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") +// CreateStatusPageIncidentUpdateWithBodyWithResponse request with arbitrary body returning *CreateStatusPageIncidentUpdateResponse +func (c *ClientWithResponses) CreateStatusPageIncidentUpdateWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateStatusPageIncidentUpdateResponse, error) { + rsp, err := c.CreateStatusPageIncidentUpdateWithBody(ctx, id, incidentId, contentType, body, reqEditors...) + if err != nil { + return nil, err } - return "" + return ParseCreateStatusPageIncidentUpdateResponse(rsp) } -type GetMonitorCertificateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DtoMonitorCertificate - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem +func (c *ClientWithResponses) CreateStatusPageIncidentUpdateWithResponse(ctx context.Context, id openapi_types.UUID, incidentId openapi_types.UUID, body CreateStatusPageIncidentUpdateJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateStatusPageIncidentUpdateResponse, error) { + rsp, err := c.CreateStatusPageIncidentUpdate(ctx, id, incidentId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateStatusPageIncidentUpdateResponse(rsp) } -// Status returns HTTPResponse.Status -func (r GetMonitorCertificateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// GetStatusPageLayoutWithResponse request returning *GetStatusPageLayoutResponse +func (c *ClientWithResponses) GetStatusPageLayoutWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetStatusPageLayoutResponse, error) { + rsp, err := c.GetStatusPageLayout(ctx, id, reqEditors...) + if err != nil { + return nil, err } - return http.StatusText(0) + return ParseGetStatusPageLayoutResponse(rsp) } -// StatusCode returns HTTPResponse.StatusCode -func (r GetMonitorCertificateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// SetStatusPageLayoutWithBodyWithResponse request with arbitrary body returning *SetStatusPageLayoutResponse +func (c *ClientWithResponses) SetStatusPageLayoutWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetStatusPageLayoutResponse, error) { + rsp, err := c.SetStatusPageLayoutWithBody(ctx, id, contentType, body, reqEditors...) + if err != nil { + return nil, err } - return 0 + return ParseSetStatusPageLayoutResponse(rsp) } -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMonitorCertificateResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") +func (c *ClientWithResponses) SetStatusPageLayoutWithResponse(ctx context.Context, id openapi_types.UUID, body SetStatusPageLayoutJSONRequestBody, reqEditors ...RequestEditorFn) (*SetStatusPageLayoutResponse, error) { + rsp, err := c.SetStatusPageLayout(ctx, id, body, reqEditors...) + if err != nil { + return nil, err } - return "" + return ParseSetStatusPageLayoutResponse(rsp) } -type RunMonitorCheckResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DtoCheckResult - JSON401 *ResponseProblem - JSON402 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem - JSON429 *ResponseProblem +// PreviewStatusPageWithResponse request returning *PreviewStatusPageResponse +func (c *ClientWithResponses) PreviewStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*PreviewStatusPageResponse, error) { + rsp, err := c.PreviewStatusPage(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParsePreviewStatusPageResponse(rsp) } -// Status returns HTTPResponse.Status -func (r RunMonitorCheckResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// CreateStatusPagePreviewLinkWithResponse request returning *CreateStatusPagePreviewLinkResponse +func (c *ClientWithResponses) CreateStatusPagePreviewLinkWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*CreateStatusPagePreviewLinkResponse, error) { + rsp, err := c.CreateStatusPagePreviewLink(ctx, id, reqEditors...) + if err != nil { + return nil, err } - return http.StatusText(0) + return ParseCreateStatusPagePreviewLinkResponse(rsp) } -// StatusCode returns HTTPResponse.StatusCode -func (r RunMonitorCheckResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PublishStatusPageWithResponse request returning *PublishStatusPageResponse +func (c *ClientWithResponses) PublishStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*PublishStatusPageResponse, error) { + rsp, err := c.PublishStatusPage(ctx, id, reqEditors...) + if err != nil { + return nil, err } - return 0 + return ParsePublishStatusPageResponse(rsp) } -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r RunMonitorCheckResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") +// UnpublishStatusPageWithResponse request returning *UnpublishStatusPageResponse +func (c *ClientWithResponses) UnpublishStatusPageWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*UnpublishStatusPageResponse, error) { + rsp, err := c.UnpublishStatusPage(ctx, id, reqEditors...) + if err != nil { + return nil, err } - return "" + return ParseUnpublishStatusPageResponse(rsp) } -type PauseMonitorResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DtoMonitor - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem -} +// ParseListAlertChannelsResponse parses an HTTP response from a ListAlertChannelsWithResponse call +func ParseListAlertChannelsResponse(rsp *http.Response) (*ListAlertChannelsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } -// Status returns HTTPResponse.Status -func (r PauseMonitorResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + response := &ListAlertChannelsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PauseMonitorResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoAlertChannel `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + } - return 0 + + return response, nil } -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PauseMonitorResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") +// ParseCreateAlertChannelResponse parses an HTTP response from a CreateAlertChannelWithResponse call +func ParseCreateAlertChannelResponse(rsp *http.Response) (*CreateAlertChannelResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return "" -} -type ListMonitorResultsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoCheckResult `json:"list"` - Meta ResponseAPIResponsePaginationMeta `json:"meta"` + response := &CreateAlertChannelResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - JSON400 *ResponseProblem - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem -} -// Status returns HTTPResponse.Status -func (r ListMonitorResultsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest DtoAlertChannelWithSecret + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + } - return http.StatusText(0) + + return response, nil } -// StatusCode returns HTTPResponse.StatusCode -func (r ListMonitorResultsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// ParseDeleteAlertChannelResponse parses an HTTP response from a DeleteAlertChannelWithResponse call +func ParseDeleteAlertChannelResponse(rsp *http.Response) (*DeleteAlertChannelResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 + + response := &DeleteAlertChannelResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + } + + return response, nil } -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r ListMonitorResultsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") +// ParseGetAlertChannelResponse parses an HTTP response from a GetAlertChannelWithResponse call +func ParseGetAlertChannelResponse(rsp *http.Response) (*GetAlertChannelResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetAlertChannelResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoAlertChannel + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + } - return "" -} -type ResumeMonitorResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DtoMonitor - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem + return response, nil } -// Status returns HTTPResponse.Status -func (r ResumeMonitorResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// ParseUpdateAlertChannelResponse parses an HTTP response from a UpdateAlertChannelWithResponse call +func ParseUpdateAlertChannelResponse(rsp *http.Response) (*UpdateAlertChannelResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r ResumeMonitorResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + response := &UpdateAlertChannelResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return 0 -} -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r ResumeMonitorResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoAlertChannelWithSecret + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest -type GetMonitorStatsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DtoMonitorStats - JSON400 *ResponseProblem - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem -} + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest -// Status returns HTTPResponse.Status -func (r GetMonitorStatsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest -// StatusCode returns HTTPResponse.StatusCode -func (r GetMonitorStatsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMonitorStatsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest -type ListMonitorStatusChangesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoStatusChange `json:"list"` - Meta ResponseAPIResponsePaginationMeta `json:"meta"` } - JSON400 *ResponseProblem - JSON401 *ResponseProblem - JSON403 *ResponseProblem - JSON404 *ResponseProblem + + return response, nil } -// Status returns HTTPResponse.Status -func (r ListMonitorStatusChangesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// ParseListAlertChannelDeliveriesResponse parses an HTTP response from a ListAlertChannelDeliveriesWithResponse call +func ParseListAlertChannelDeliveriesResponse(rsp *http.Response) (*ListAlertChannelDeliveriesResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r ListMonitorStatusChangesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + response := &ListAlertChannelDeliveriesResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return 0 -} -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r ListMonitorStatusChangesResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoChannelDelivery `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + } - return "" + + return response, nil } -// ListAlertChannelsWithResponse request returning *ListAlertChannelsResponse -func (c *ClientWithResponses) ListAlertChannelsWithResponse(ctx context.Context, params *ListAlertChannelsParams, reqEditors ...RequestEditorFn) (*ListAlertChannelsResponse, error) { - rsp, err := c.ListAlertChannels(ctx, params, reqEditors...) +// ParseTestAlertChannelResponse parses an HTTP response from a TestAlertChannelWithResponse call +func ParseTestAlertChannelResponse(rsp *http.Response) (*TestAlertChannelResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseListAlertChannelsResponse(rsp) -} -// CreateAlertChannelWithBodyWithResponse request with arbitrary body returning *CreateAlertChannelResponse -func (c *ClientWithResponses) CreateAlertChannelWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateAlertChannelResponse, error) { - rsp, err := c.CreateAlertChannelWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err + response := &TestAlertChannelResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return ParseCreateAlertChannelResponse(rsp) -} -func (c *ClientWithResponses) CreateAlertChannelWithResponse(ctx context.Context, body CreateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateAlertChannelResponse, error) { - rsp, err := c.CreateAlertChannel(ctx, body, reqEditors...) - if err != nil { - return nil, err + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoAlertChannelTestResult + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 402: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON402 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON429 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON503 = &dest + } - return ParseCreateAlertChannelResponse(rsp) -} -// DeleteAlertChannelWithResponse request returning *DeleteAlertChannelResponse -func (c *ClientWithResponses) DeleteAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteAlertChannelResponse, error) { - rsp, err := c.DeleteAlertChannel(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteAlertChannelResponse(rsp) + return response, nil } -// GetAlertChannelWithResponse request returning *GetAlertChannelResponse -func (c *ClientWithResponses) GetAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetAlertChannelResponse, error) { - rsp, err := c.GetAlertChannel(ctx, id, reqEditors...) +// ParseSendAlertChannelVerificationResponse parses an HTTP response from a SendAlertChannelVerificationWithResponse call +func ParseSendAlertChannelVerificationResponse(rsp *http.Response) (*SendAlertChannelVerificationResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetAlertChannelResponse(rsp) -} -// UpdateAlertChannelWithBodyWithResponse request with arbitrary body returning *UpdateAlertChannelResponse -func (c *ClientWithResponses) UpdateAlertChannelWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateAlertChannelResponse, error) { - rsp, err := c.UpdateAlertChannelWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err + response := &SendAlertChannelVerificationResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return ParseUpdateAlertChannelResponse(rsp) -} -func (c *ClientWithResponses) UpdateAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateAlertChannelJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateAlertChannelResponse, error) { - rsp, err := c.UpdateAlertChannel(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateAlertChannelResponse(rsp) -} + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest -// ListAlertChannelDeliveriesWithResponse request returning *ListAlertChannelDeliveriesResponse -func (c *ClientWithResponses) ListAlertChannelDeliveriesWithResponse(ctx context.Context, id openapi_types.UUID, params *ListAlertChannelDeliveriesParams, reqEditors ...RequestEditorFn) (*ListAlertChannelDeliveriesResponse, error) { - rsp, err := c.ListAlertChannelDeliveries(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListAlertChannelDeliveriesResponse(rsp) -} + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 402: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON402 = &dest -// TestAlertChannelWithResponse request returning *TestAlertChannelResponse -func (c *ClientWithResponses) TestAlertChannelWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*TestAlertChannelResponse, error) { - rsp, err := c.TestAlertChannel(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseTestAlertChannelResponse(rsp) -} + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest -// SendAlertChannelVerificationWithResponse request returning *SendAlertChannelVerificationResponse -func (c *ClientWithResponses) SendAlertChannelVerificationWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*SendAlertChannelVerificationResponse, error) { - rsp, err := c.SendAlertChannelVerification(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseSendAlertChannelVerificationResponse(rsp) -} + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest -// ConfirmAlertChannelVerificationWithBodyWithResponse request with arbitrary body returning *ConfirmAlertChannelVerificationResponse -func (c *ClientWithResponses) ConfirmAlertChannelVerificationWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ConfirmAlertChannelVerificationResponse, error) { - rsp, err := c.ConfirmAlertChannelVerificationWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseConfirmAlertChannelVerificationResponse(rsp) -} + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON409 = &dest -func (c *ClientWithResponses) ConfirmAlertChannelVerificationWithResponse(ctx context.Context, id openapi_types.UUID, body ConfirmAlertChannelVerificationJSONRequestBody, reqEditors ...RequestEditorFn) (*ConfirmAlertChannelVerificationResponse, error) { - rsp, err := c.ConfirmAlertChannelVerification(ctx, id, body, reqEditors...) - if err != nil { - return nil, err } - return ParseConfirmAlertChannelVerificationResponse(rsp) -} -// ListIncidentsWithResponse request returning *ListIncidentsResponse -func (c *ClientWithResponses) ListIncidentsWithResponse(ctx context.Context, params *ListIncidentsParams, reqEditors ...RequestEditorFn) (*ListIncidentsResponse, error) { - rsp, err := c.ListIncidents(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListIncidentsResponse(rsp) + return response, nil } -// GetIncidentSummaryWithResponse request returning *GetIncidentSummaryResponse -func (c *ClientWithResponses) GetIncidentSummaryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetIncidentSummaryResponse, error) { - rsp, err := c.GetIncidentSummary(ctx, reqEditors...) +// ParseConfirmAlertChannelVerificationResponse parses an HTTP response from a ConfirmAlertChannelVerificationWithResponse call +func ParseConfirmAlertChannelVerificationResponse(rsp *http.Response) (*ConfirmAlertChannelVerificationResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetIncidentSummaryResponse(rsp) -} -// GetIncidentWithResponse request returning *GetIncidentResponse -func (c *ClientWithResponses) GetIncidentWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetIncidentResponse, error) { - rsp, err := c.GetIncident(ctx, id, reqEditors...) - if err != nil { - return nil, err + response := &ConfirmAlertChannelVerificationResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return ParseGetIncidentResponse(rsp) -} -// AcknowledgeIncidentWithResponse request returning *AcknowledgeIncidentResponse -func (c *ClientWithResponses) AcknowledgeIncidentWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*AcknowledgeIncidentResponse, error) { - rsp, err := c.AcknowledgeIncident(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseAcknowledgeIncidentResponse(rsp) -} + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoAlertChannel + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest -// ListMonitorsWithResponse request returning *ListMonitorsResponse -func (c *ClientWithResponses) ListMonitorsWithResponse(ctx context.Context, params *ListMonitorsParams, reqEditors ...RequestEditorFn) (*ListMonitorsResponse, error) { - rsp, err := c.ListMonitors(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListMonitorsResponse(rsp) -} + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest -// CreateMonitorWithBodyWithResponse request with arbitrary body returning *CreateMonitorResponse -func (c *ClientWithResponses) CreateMonitorWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateMonitorResponse, error) { - rsp, err := c.CreateMonitorWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateMonitorResponse(rsp) -} + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON409 = &dest -func (c *ClientWithResponses) CreateMonitorWithResponse(ctx context.Context, body CreateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateMonitorResponse, error) { - rsp, err := c.CreateMonitor(ctx, body, reqEditors...) - if err != nil { - return nil, err } - return ParseCreateMonitorResponse(rsp) + + return response, nil } -// ApplyMonitorBulkActionWithBodyWithResponse request with arbitrary body returning *ApplyMonitorBulkActionResponse -func (c *ClientWithResponses) ApplyMonitorBulkActionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ApplyMonitorBulkActionResponse, error) { - rsp, err := c.ApplyMonitorBulkActionWithBody(ctx, contentType, body, reqEditors...) +// ParseListIncidentsResponse parses an HTTP response from a ListIncidentsWithResponse call +func ParseListIncidentsResponse(rsp *http.Response) (*ListIncidentsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseApplyMonitorBulkActionResponse(rsp) -} -func (c *ClientWithResponses) ApplyMonitorBulkActionWithResponse(ctx context.Context, body ApplyMonitorBulkActionJSONRequestBody, reqEditors ...RequestEditorFn) (*ApplyMonitorBulkActionResponse, error) { - rsp, err := c.ApplyMonitorBulkAction(ctx, body, reqEditors...) - if err != nil { - return nil, err + response := &ListIncidentsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return ParseApplyMonitorBulkActionResponse(rsp) -} -// DeleteMonitorWithResponse request returning *DeleteMonitorResponse -func (c *ClientWithResponses) DeleteMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteMonitorResponse, error) { - rsp, err := c.DeleteMonitor(ctx, id, reqEditors...) - if err != nil { - return nil, err + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoIncident `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + } - return ParseDeleteMonitorResponse(rsp) -} -// GetMonitorWithResponse request returning *GetMonitorResponse -func (c *ClientWithResponses) GetMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorResponse, error) { - rsp, err := c.GetMonitor(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetMonitorResponse(rsp) + return response, nil } -// UpdateMonitorWithBodyWithResponse request with arbitrary body returning *UpdateMonitorResponse -func (c *ClientWithResponses) UpdateMonitorWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateMonitorResponse, error) { - rsp, err := c.UpdateMonitorWithBody(ctx, id, contentType, body, reqEditors...) +// ParseGetIncidentSummaryResponse parses an HTTP response from a GetIncidentSummaryWithResponse call +func ParseGetIncidentSummaryResponse(rsp *http.Response) (*GetIncidentSummaryResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseUpdateMonitorResponse(rsp) -} -func (c *ClientWithResponses) UpdateMonitorWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateMonitorJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateMonitorResponse, error) { - rsp, err := c.UpdateMonitor(ctx, id, body, reqEditors...) - if err != nil { - return nil, err + response := &GetIncidentSummaryResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return ParseUpdateMonitorResponse(rsp) -} -// GetMonitorAlertsWithResponse request returning *GetMonitorAlertsResponse -func (c *ClientWithResponses) GetMonitorAlertsWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorAlertsResponse, error) { - rsp, err := c.GetMonitorAlerts(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetMonitorAlertsResponse(rsp) -} + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoIncidentSummary + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest -// SetMonitorAlertsWithBodyWithResponse request with arbitrary body returning *SetMonitorAlertsResponse -func (c *ClientWithResponses) SetMonitorAlertsWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetMonitorAlertsResponse, error) { - rsp, err := c.SetMonitorAlertsWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err } - return ParseSetMonitorAlertsResponse(rsp) + + return response, nil } -func (c *ClientWithResponses) SetMonitorAlertsWithResponse(ctx context.Context, id openapi_types.UUID, body SetMonitorAlertsJSONRequestBody, reqEditors ...RequestEditorFn) (*SetMonitorAlertsResponse, error) { - rsp, err := c.SetMonitorAlerts(ctx, id, body, reqEditors...) +// ParseGetIncidentResponse parses an HTTP response from a GetIncidentWithResponse call +func ParseGetIncidentResponse(rsp *http.Response) (*GetIncidentResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseSetMonitorAlertsResponse(rsp) -} -// GetMonitorAvailabilityWithResponse request returning *GetMonitorAvailabilityResponse -func (c *ClientWithResponses) GetMonitorAvailabilityWithResponse(ctx context.Context, id openapi_types.UUID, params *GetMonitorAvailabilityParams, reqEditors ...RequestEditorFn) (*GetMonitorAvailabilityResponse, error) { - rsp, err := c.GetMonitorAvailability(ctx, id, params, reqEditors...) - if err != nil { - return nil, err + response := &GetIncidentResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return ParseGetMonitorAvailabilityResponse(rsp) -} -// GetMonitorCertificateWithResponse request returning *GetMonitorCertificateResponse -func (c *ClientWithResponses) GetMonitorCertificateWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetMonitorCertificateResponse, error) { - rsp, err := c.GetMonitorCertificate(ctx, id, reqEditors...) - if err != nil { - return nil, err + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoIncidentDetail + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + } - return ParseGetMonitorCertificateResponse(rsp) + + return response, nil } -// RunMonitorCheckWithResponse request returning *RunMonitorCheckResponse -func (c *ClientWithResponses) RunMonitorCheckWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*RunMonitorCheckResponse, error) { - rsp, err := c.RunMonitorCheck(ctx, id, reqEditors...) +// ParseAcknowledgeIncidentResponse parses an HTTP response from a AcknowledgeIncidentWithResponse call +func ParseAcknowledgeIncidentResponse(rsp *http.Response) (*AcknowledgeIncidentResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseRunMonitorCheckResponse(rsp) -} -// PauseMonitorWithResponse request returning *PauseMonitorResponse -func (c *ClientWithResponses) PauseMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*PauseMonitorResponse, error) { - rsp, err := c.PauseMonitor(ctx, id, reqEditors...) - if err != nil { - return nil, err + response := &AcknowledgeIncidentResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return ParsePauseMonitorResponse(rsp) -} -// ListMonitorResultsWithResponse request returning *ListMonitorResultsResponse -func (c *ClientWithResponses) ListMonitorResultsWithResponse(ctx context.Context, id openapi_types.UUID, params *ListMonitorResultsParams, reqEditors ...RequestEditorFn) (*ListMonitorResultsResponse, error) { - rsp, err := c.ListMonitorResults(ctx, id, params, reqEditors...) - if err != nil { - return nil, err + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoIncidentDetail + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + } - return ParseListMonitorResultsResponse(rsp) + + return response, nil } -// ResumeMonitorWithResponse request returning *ResumeMonitorResponse -func (c *ClientWithResponses) ResumeMonitorWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*ResumeMonitorResponse, error) { - rsp, err := c.ResumeMonitor(ctx, id, reqEditors...) +// ParseListMonitorsResponse parses an HTTP response from a ListMonitorsWithResponse call +func ParseListMonitorsResponse(rsp *http.Response) (*ListMonitorsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseResumeMonitorResponse(rsp) -} -// GetMonitorStatsWithResponse request returning *GetMonitorStatsResponse -func (c *ClientWithResponses) GetMonitorStatsWithResponse(ctx context.Context, id openapi_types.UUID, params *GetMonitorStatsParams, reqEditors ...RequestEditorFn) (*GetMonitorStatsResponse, error) { - rsp, err := c.GetMonitorStats(ctx, id, params, reqEditors...) - if err != nil { - return nil, err + response := &ListMonitorsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } - return ParseGetMonitorStatsResponse(rsp) -} -// ListMonitorStatusChangesWithResponse request returning *ListMonitorStatusChangesResponse -func (c *ClientWithResponses) ListMonitorStatusChangesWithResponse(ctx context.Context, id openapi_types.UUID, params *ListMonitorStatusChangesParams, reqEditors ...RequestEditorFn) (*ListMonitorStatusChangesResponse, error) { - rsp, err := c.ListMonitorStatusChanges(ctx, id, params, reqEditors...) - if err != nil { - return nil, err + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoMonitor `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + } - return ParseListMonitorStatusChangesResponse(rsp) + + return response, nil } -// ParseListAlertChannelsResponse parses an HTTP response from a ListAlertChannelsWithResponse call -func ParseListAlertChannelsResponse(rsp *http.Response) (*ListAlertChannelsResponse, error) { +// ParseCreateMonitorResponse parses an HTTP response from a CreateMonitorWithResponse call +func ParseCreateMonitorResponse(rsp *http.Response) (*CreateMonitorResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListAlertChannelsResponse{ + response := &CreateMonitorResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoAlertChannel `json:"list"` - Meta ResponseAPIResponsePaginationMeta `json:"meta"` - } + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest DtoMonitor if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON200 = &dest + response.JSON201 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ResponseProblem @@ -6302,6 +9782,13 @@ func ParseListAlertChannelsResponse(rsp *http.Response) (*ListAlertChannelsRespo } response.JSON401 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 402: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON402 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6309,31 +9796,38 @@ func ParseListAlertChannelsResponse(rsp *http.Response) (*ListAlertChannelsRespo } response.JSON403 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON503 = &dest + } return response, nil } -// ParseCreateAlertChannelResponse parses an HTTP response from a CreateAlertChannelWithResponse call -func ParseCreateAlertChannelResponse(rsp *http.Response) (*CreateAlertChannelResponse, error) { +// ParseApplyMonitorBulkActionResponse parses an HTTP response from a ApplyMonitorBulkActionWithResponse call +func ParseApplyMonitorBulkActionResponse(rsp *http.Response) (*ApplyMonitorBulkActionResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CreateAlertChannelResponse{ + response := &ApplyMonitorBulkActionResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest DtoAlertChannelWithSecret + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoMonitorBulkResult if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON201 = &dest + response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ResponseProblem @@ -6356,20 +9850,34 @@ func ParseCreateAlertChannelResponse(rsp *http.Response) (*CreateAlertChannelRes } response.JSON403 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON429 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON503 = &dest + } return response, nil } -// ParseDeleteAlertChannelResponse parses an HTTP response from a DeleteAlertChannelWithResponse call -func ParseDeleteAlertChannelResponse(rsp *http.Response) (*DeleteAlertChannelResponse, error) { +// ParseDeleteMonitorResponse parses an HTTP response from a DeleteMonitorWithResponse call +func ParseDeleteMonitorResponse(rsp *http.Response) (*DeleteMonitorResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteAlertChannelResponse{ + response := &DeleteMonitorResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -6396,27 +9904,34 @@ func ParseDeleteAlertChannelResponse(rsp *http.Response) (*DeleteAlertChannelRes } response.JSON404 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON409 = &dest + } return response, nil } -// ParseGetAlertChannelResponse parses an HTTP response from a GetAlertChannelWithResponse call -func ParseGetAlertChannelResponse(rsp *http.Response) (*GetAlertChannelResponse, error) { +// ParseGetMonitorResponse parses an HTTP response from a GetMonitorWithResponse call +func ParseGetMonitorResponse(rsp *http.Response) (*GetMonitorResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetAlertChannelResponse{ + response := &GetMonitorResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoAlertChannel + var dest DtoMonitor if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -6448,22 +9963,22 @@ func ParseGetAlertChannelResponse(rsp *http.Response) (*GetAlertChannelResponse, return response, nil } -// ParseUpdateAlertChannelResponse parses an HTTP response from a UpdateAlertChannelWithResponse call -func ParseUpdateAlertChannelResponse(rsp *http.Response) (*UpdateAlertChannelResponse, error) { +// ParseUpdateMonitorResponse parses an HTTP response from a UpdateMonitorWithResponse call +func ParseUpdateMonitorResponse(rsp *http.Response) (*UpdateMonitorResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &UpdateAlertChannelResponse{ + response := &UpdateMonitorResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoAlertChannelWithSecret + var dest DtoMonitor if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -6497,43 +10012,39 @@ func ParseUpdateAlertChannelResponse(rsp *http.Response) (*UpdateAlertChannelRes } response.JSON404 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON503 = &dest + } return response, nil } -// ParseListAlertChannelDeliveriesResponse parses an HTTP response from a ListAlertChannelDeliveriesWithResponse call -func ParseListAlertChannelDeliveriesResponse(rsp *http.Response) (*ListAlertChannelDeliveriesResponse, error) { +// ParseGetMonitorAlertsResponse parses an HTTP response from a GetMonitorAlertsWithResponse call +func ParseGetMonitorAlertsResponse(rsp *http.Response) (*GetMonitorAlertsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListAlertChannelDeliveriesResponse{ + response := &GetMonitorAlertsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoChannelDelivery `json:"list"` - Meta ResponseAPIResponsePaginationMeta `json:"meta"` - } + var dest DtoMonitorAlerts if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest ResponseProblem - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6560,40 +10071,40 @@ func ParseListAlertChannelDeliveriesResponse(rsp *http.Response) (*ListAlertChan return response, nil } -// ParseTestAlertChannelResponse parses an HTTP response from a TestAlertChannelWithResponse call -func ParseTestAlertChannelResponse(rsp *http.Response) (*TestAlertChannelResponse, error) { +// ParseSetMonitorAlertsResponse parses an HTTP response from a SetMonitorAlertsWithResponse call +func ParseSetMonitorAlertsResponse(rsp *http.Response) (*SetMonitorAlertsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &TestAlertChannelResponse{ + response := &SetMonitorAlertsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoAlertChannelTestResult + var dest DtoMonitorAlerts if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON401 = &dest + response.JSON400 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 402: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON402 = &dest + response.JSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ResponseProblem @@ -6609,59 +10120,92 @@ func ParseTestAlertChannelResponse(rsp *http.Response) (*TestAlertChannelRespons } response.JSON404 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + } + + return response, nil +} + +// ParseGetMonitorAvailabilityResponse parses an HTTP response from a GetMonitorAvailabilityWithResponse call +func ParseGetMonitorAvailabilityResponse(rsp *http.Response) (*GetMonitorAvailabilityResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetMonitorAvailabilityResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoAvailability + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON409 = &dest + response.JSON400 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON429 = &dest + response.JSON401 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON503 = &dest + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest } return response, nil } -// ParseSendAlertChannelVerificationResponse parses an HTTP response from a SendAlertChannelVerificationWithResponse call -func ParseSendAlertChannelVerificationResponse(rsp *http.Response) (*SendAlertChannelVerificationResponse, error) { +// ParseGetMonitorCertificateResponse parses an HTTP response from a GetMonitorCertificateWithResponse call +func ParseGetMonitorCertificateResponse(rsp *http.Response) (*GetMonitorCertificateResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &SendAlertChannelVerificationResponse{ + response := &GetMonitorCertificateResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest ResponseProblem + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoMonitorCertificate if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON401 = &dest + response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 402: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON402 = &dest + response.JSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ResponseProblem @@ -6677,52 +10221,45 @@ func ParseSendAlertChannelVerificationResponse(rsp *http.Response) (*SendAlertCh } response.JSON404 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: - var dest ResponseProblem - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON409 = &dest - } return response, nil } -// ParseConfirmAlertChannelVerificationResponse parses an HTTP response from a ConfirmAlertChannelVerificationWithResponse call -func ParseConfirmAlertChannelVerificationResponse(rsp *http.Response) (*ConfirmAlertChannelVerificationResponse, error) { +// ParseRunMonitorCheckResponse parses an HTTP response from a RunMonitorCheckWithResponse call +func ParseRunMonitorCheckResponse(rsp *http.Response) (*RunMonitorCheckResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ConfirmAlertChannelVerificationResponse{ + response := &RunMonitorCheckResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoAlertChannel + var dest DtoCheckResult if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON400 = &dest + response.JSON401 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 402: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON401 = &dest + response.JSON402 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ResponseProblem @@ -6738,90 +10275,97 @@ func ParseConfirmAlertChannelVerificationResponse(rsp *http.Response) (*ConfirmA } response.JSON404 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON409 = &dest + response.JSON429 = &dest } return response, nil } -// ParseListIncidentsResponse parses an HTTP response from a ListIncidentsWithResponse call -func ParseListIncidentsResponse(rsp *http.Response) (*ListIncidentsResponse, error) { +// ParsePauseMonitorResponse parses an HTTP response from a PauseMonitorWithResponse call +func ParsePauseMonitorResponse(rsp *http.Response) (*PauseMonitorResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListIncidentsResponse{ + response := &PauseMonitorResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoIncident `json:"list"` - Meta ResponseAPIResponsePaginationMeta `json:"meta"` - } + var dest DtoMonitor if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON400 = &dest + response.JSON401 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON401 = &dest + response.JSON403 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON403 = &dest + response.JSON404 = &dest } return response, nil } -// ParseGetIncidentSummaryResponse parses an HTTP response from a GetIncidentSummaryWithResponse call -func ParseGetIncidentSummaryResponse(rsp *http.Response) (*GetIncidentSummaryResponse, error) { +// ParseListMonitorResultsResponse parses an HTTP response from a ListMonitorResultsWithResponse call +func ParseListMonitorResultsResponse(rsp *http.Response) (*ListMonitorResultsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetIncidentSummaryResponse{ + response := &ListMonitorResultsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoIncidentSummary + var dest struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoCheckResult `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` + } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6836,27 +10380,34 @@ func ParseGetIncidentSummaryResponse(rsp *http.Response) (*GetIncidentSummaryRes } response.JSON403 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + } return response, nil } -// ParseGetIncidentResponse parses an HTTP response from a GetIncidentWithResponse call -func ParseGetIncidentResponse(rsp *http.Response) (*GetIncidentResponse, error) { +// ParseResumeMonitorResponse parses an HTTP response from a ResumeMonitorWithResponse call +func ParseResumeMonitorResponse(rsp *http.Response) (*ResumeMonitorResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetIncidentResponse{ + response := &ResumeMonitorResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoIncidentDetail + var dest DtoMonitor if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -6888,27 +10439,34 @@ func ParseGetIncidentResponse(rsp *http.Response) (*GetIncidentResponse, error) return response, nil } -// ParseAcknowledgeIncidentResponse parses an HTTP response from a AcknowledgeIncidentWithResponse call -func ParseAcknowledgeIncidentResponse(rsp *http.Response) (*AcknowledgeIncidentResponse, error) { +// ParseGetMonitorStatsResponse parses an HTTP response from a GetMonitorStatsWithResponse call +func ParseGetMonitorStatsResponse(rsp *http.Response) (*GetMonitorStatsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &AcknowledgeIncidentResponse{ + response := &GetMonitorStatsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoIncidentDetail + var dest DtoMonitorStats if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6935,15 +10493,15 @@ func ParseAcknowledgeIncidentResponse(rsp *http.Response) (*AcknowledgeIncidentR return response, nil } -// ParseListMonitorsResponse parses an HTTP response from a ListMonitorsWithResponse call -func ParseListMonitorsResponse(rsp *http.Response) (*ListMonitorsResponse, error) { +// ParseListMonitorStatusChangesResponse parses an HTTP response from a ListMonitorStatusChangesWithResponse call +func ParseListMonitorStatusChangesResponse(rsp *http.Response) (*ListMonitorStatusChangesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListMonitorsResponse{ + response := &ListMonitorStatusChangesResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -6952,7 +10510,7 @@ func ParseListMonitorsResponse(rsp *http.Response) (*ListMonitorsResponse, error case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoMonitor `json:"list"` + List []DtoStatusChange `json:"list"` Meta ResponseAPIResponsePaginationMeta `json:"meta"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6981,31 +10539,42 @@ func ParseListMonitorsResponse(rsp *http.Response) (*ListMonitorsResponse, error } response.JSON403 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + } return response, nil } -// ParseCreateMonitorResponse parses an HTTP response from a CreateMonitorWithResponse call -func ParseCreateMonitorResponse(rsp *http.Response) (*CreateMonitorResponse, error) { +// ParseListStatusPagesResponse parses an HTTP response from a ListStatusPagesWithResponse call +func ParseListStatusPagesResponse(rsp *http.Response) (*ListStatusPagesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CreateMonitorResponse{ + response := &ListStatusPagesResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest DtoMonitor + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoStatusPage `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` + } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON201 = &dest + response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ResponseProblem @@ -7021,13 +10590,6 @@ func ParseCreateMonitorResponse(rsp *http.Response) (*CreateMonitorResponse, err } response.JSON401 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 402: - var dest ResponseProblem - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON402 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -7035,38 +10597,31 @@ func ParseCreateMonitorResponse(rsp *http.Response) (*CreateMonitorResponse, err } response.JSON403 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: - var dest ResponseProblem - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON503 = &dest - } return response, nil } -// ParseApplyMonitorBulkActionResponse parses an HTTP response from a ApplyMonitorBulkActionWithResponse call -func ParseApplyMonitorBulkActionResponse(rsp *http.Response) (*ApplyMonitorBulkActionResponse, error) { +// ParseCreateStatusPageResponse parses an HTTP response from a CreateStatusPageWithResponse call +func ParseCreateStatusPageResponse(rsp *http.Response) (*CreateStatusPageResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ApplyMonitorBulkActionResponse{ + response := &CreateStatusPageResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoMonitorBulkResult + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest DtoStatusPage if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON200 = &dest + response.JSON201 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ResponseProblem @@ -7082,41 +10637,41 @@ func ParseApplyMonitorBulkActionResponse(rsp *http.Response) (*ApplyMonitorBulkA } response.JSON401 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 402: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON403 = &dest + response.JSON402 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON429 = &dest + response.JSON403 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON503 = &dest + response.JSON409 = &dest } return response, nil } -// ParseDeleteMonitorResponse parses an HTTP response from a DeleteMonitorWithResponse call -func ParseDeleteMonitorResponse(rsp *http.Response) (*DeleteMonitorResponse, error) { +// ParseDeleteStatusPageResponse parses an HTTP response from a DeleteStatusPageWithResponse call +func ParseDeleteStatusPageResponse(rsp *http.Response) (*DeleteStatusPageResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteMonitorResponse{ + response := &DeleteStatusPageResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7143,34 +10698,27 @@ func ParseDeleteMonitorResponse(rsp *http.Response) (*DeleteMonitorResponse, err } response.JSON404 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: - var dest ResponseProblem - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON409 = &dest - } return response, nil } -// ParseGetMonitorResponse parses an HTTP response from a GetMonitorWithResponse call -func ParseGetMonitorResponse(rsp *http.Response) (*GetMonitorResponse, error) { +// ParseGetStatusPageResponse parses an HTTP response from a GetStatusPageWithResponse call +func ParseGetStatusPageResponse(rsp *http.Response) (*GetStatusPageResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetMonitorResponse{ + response := &GetStatusPageResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoMonitor + var dest DtoStatusPage if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -7202,22 +10750,22 @@ func ParseGetMonitorResponse(rsp *http.Response) (*GetMonitorResponse, error) { return response, nil } -// ParseUpdateMonitorResponse parses an HTTP response from a UpdateMonitorWithResponse call -func ParseUpdateMonitorResponse(rsp *http.Response) (*UpdateMonitorResponse, error) { +// ParseUpdateStatusPageResponse parses an HTTP response from a UpdateStatusPageWithResponse call +func ParseUpdateStatusPageResponse(rsp *http.Response) (*UpdateStatusPageResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &UpdateMonitorResponse{ + response := &UpdateStatusPageResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoMonitor + var dest DtoStatusPage if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -7251,39 +10799,50 @@ func ParseUpdateMonitorResponse(rsp *http.Response) (*UpdateMonitorResponse, err } response.JSON404 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON503 = &dest + response.JSON409 = &dest } return response, nil } -// ParseGetMonitorAlertsResponse parses an HTTP response from a GetMonitorAlertsWithResponse call -func ParseGetMonitorAlertsResponse(rsp *http.Response) (*GetMonitorAlertsResponse, error) { +// ParseListStatusPageIncidentsResponse parses an HTTP response from a ListStatusPageIncidentsWithResponse call +func ParseListStatusPageIncidentsResponse(rsp *http.Response) (*ListStatusPageIncidentsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetMonitorAlertsResponse{ + response := &ListStatusPageIncidentsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoMonitorAlerts + var dest struct { + Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` + List []DtoStatusPageIncident `json:"list"` + Meta ResponseAPIResponsePaginationMeta `json:"meta"` + } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -7310,26 +10869,26 @@ func ParseGetMonitorAlertsResponse(rsp *http.Response) (*GetMonitorAlertsRespons return response, nil } -// ParseSetMonitorAlertsResponse parses an HTTP response from a SetMonitorAlertsWithResponse call -func ParseSetMonitorAlertsResponse(rsp *http.Response) (*SetMonitorAlertsResponse, error) { +// ParseCreateStatusPageIncidentResponse parses an HTTP response from a CreateStatusPageIncidentWithResponse call +func ParseCreateStatusPageIncidentResponse(rsp *http.Response) (*CreateStatusPageIncidentResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &SetMonitorAlertsResponse{ + response := &CreateStatusPageIncidentResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoMonitorAlerts + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest DtoStatusPageIncident if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON200 = &dest + response.JSON201 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ResponseProblem @@ -7364,34 +10923,27 @@ func ParseSetMonitorAlertsResponse(rsp *http.Response) (*SetMonitorAlertsRespons return response, nil } -// ParseGetMonitorAvailabilityResponse parses an HTTP response from a GetMonitorAvailabilityWithResponse call -func ParseGetMonitorAvailabilityResponse(rsp *http.Response) (*GetMonitorAvailabilityResponse, error) { +// ParseGetStatusPageIncidentResponse parses an HTTP response from a GetStatusPageIncidentWithResponse call +func ParseGetStatusPageIncidentResponse(rsp *http.Response) (*GetStatusPageIncidentResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetMonitorAvailabilityResponse{ + response := &GetStatusPageIncidentResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoAvailability + var dest DtoStatusPageIncident if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest ResponseProblem - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -7418,27 +10970,34 @@ func ParseGetMonitorAvailabilityResponse(rsp *http.Response) (*GetMonitorAvailab return response, nil } -// ParseGetMonitorCertificateResponse parses an HTTP response from a GetMonitorCertificateWithResponse call -func ParseGetMonitorCertificateResponse(rsp *http.Response) (*GetMonitorCertificateResponse, error) { +// ParseUpdateStatusPageIncidentResponse parses an HTTP response from a UpdateStatusPageIncidentWithResponse call +func ParseUpdateStatusPageIncidentResponse(rsp *http.Response) (*UpdateStatusPageIncidentResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetMonitorCertificateResponse{ + response := &UpdateStatusPageIncidentResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoMonitorCertificate + var dest DtoStatusPageIncident if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -7465,40 +11024,40 @@ func ParseGetMonitorCertificateResponse(rsp *http.Response) (*GetMonitorCertific return response, nil } -// ParseRunMonitorCheckResponse parses an HTTP response from a RunMonitorCheckWithResponse call -func ParseRunMonitorCheckResponse(rsp *http.Response) (*RunMonitorCheckResponse, error) { +// ParseCreateStatusPageIncidentUpdateResponse parses an HTTP response from a CreateStatusPageIncidentUpdateWithResponse call +func ParseCreateStatusPageIncidentUpdateResponse(rsp *http.Response) (*CreateStatusPageIncidentUpdateResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &RunMonitorCheckResponse{ + response := &CreateStatusPageIncidentUpdateResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoCheckResult + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest DtoStatusPageIncident if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON200 = &dest + response.JSON201 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON401 = &dest + response.JSON400 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 402: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON402 = &dest + response.JSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ResponseProblem @@ -7514,34 +11073,34 @@ func ParseRunMonitorCheckResponse(rsp *http.Response) (*RunMonitorCheckResponse, } response.JSON404 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON429 = &dest + response.JSON409 = &dest } return response, nil } -// ParsePauseMonitorResponse parses an HTTP response from a PauseMonitorWithResponse call -func ParsePauseMonitorResponse(rsp *http.Response) (*PauseMonitorResponse, error) { +// ParseGetStatusPageLayoutResponse parses an HTTP response from a GetStatusPageLayoutWithResponse call +func ParseGetStatusPageLayoutResponse(rsp *http.Response) (*GetStatusPageLayoutResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PauseMonitorResponse{ + response := &GetStatusPageLayoutResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoMonitor + var dest DtoStatusPageLayout if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -7573,26 +11132,22 @@ func ParsePauseMonitorResponse(rsp *http.Response) (*PauseMonitorResponse, error return response, nil } -// ParseListMonitorResultsResponse parses an HTTP response from a ListMonitorResultsWithResponse call -func ParseListMonitorResultsResponse(rsp *http.Response) (*ListMonitorResultsResponse, error) { +// ParseSetStatusPageLayoutResponse parses an HTTP response from a SetStatusPageLayoutWithResponse call +func ParseSetStatusPageLayoutResponse(rsp *http.Response) (*SetStatusPageLayoutResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListMonitorResultsResponse{ + response := &SetStatusPageLayoutResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoCheckResult `json:"list"` - Meta ResponseAPIResponsePaginationMeta `json:"meta"` - } + var dest DtoStatusPageLayout if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -7631,22 +11186,22 @@ func ParseListMonitorResultsResponse(rsp *http.Response) (*ListMonitorResultsRes return response, nil } -// ParseResumeMonitorResponse parses an HTTP response from a ResumeMonitorWithResponse call -func ParseResumeMonitorResponse(rsp *http.Response) (*ResumeMonitorResponse, error) { +// ParsePreviewStatusPageResponse parses an HTTP response from a PreviewStatusPageWithResponse call +func ParsePreviewStatusPageResponse(rsp *http.Response) (*PreviewStatusPageResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ResumeMonitorResponse{ + response := &PreviewStatusPageResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoMonitor + var dest DtoPublicStatusPreview if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -7678,34 +11233,27 @@ func ParseResumeMonitorResponse(rsp *http.Response) (*ResumeMonitorResponse, err return response, nil } -// ParseGetMonitorStatsResponse parses an HTTP response from a GetMonitorStatsWithResponse call -func ParseGetMonitorStatsResponse(rsp *http.Response) (*GetMonitorStatsResponse, error) { +// ParseCreateStatusPagePreviewLinkResponse parses an HTTP response from a CreateStatusPagePreviewLinkWithResponse call +func ParseCreateStatusPagePreviewLinkResponse(rsp *http.Response) (*CreateStatusPagePreviewLinkResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetMonitorStatsResponse{ + response := &CreateStatusPagePreviewLinkResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DtoMonitorStats + var dest DtoStatusPagePreviewLink if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest ResponseProblem - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -7732,37 +11280,87 @@ func ParseGetMonitorStatsResponse(rsp *http.Response) (*GetMonitorStatsResponse, return response, nil } -// ParseListMonitorStatusChangesResponse parses an HTTP response from a ListMonitorStatusChangesWithResponse call -func ParseListMonitorStatusChangesResponse(rsp *http.Response) (*ListMonitorStatusChangesResponse, error) { +// ParsePublishStatusPageResponse parses an HTTP response from a PublishStatusPageWithResponse call +func ParsePublishStatusPageResponse(rsp *http.Response) (*PublishStatusPageResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListMonitorStatusChangesResponse{ + response := &PublishStatusPageResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Cursors ResponseAPIResponsePaginationCursors `json:"cursors"` - List []DtoStatusChange `json:"list"` - Meta ResponseAPIResponsePaginationMeta `json:"meta"` - } + var dest DtoStatusPage if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON400 = &dest + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 402: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON402 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest ResponseProblem + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON409 = &dest + + } + + return response, nil +} + +// ParseUnpublishStatusPageResponse parses an HTTP response from a UnpublishStatusPageWithResponse call +func ParseUnpublishStatusPageResponse(rsp *http.Response) (*UnpublishStatusPageResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &UnpublishStatusPageResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DtoStatusPage + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ResponseProblem diff --git a/internal/cli/monitor/cmd.go b/internal/cli/monitor/cmd.go index c794f30..161a214 100644 --- a/internal/cli/monitor/cmd.go +++ b/internal/cli/monitor/cmd.go @@ -1,7 +1,7 @@ // Package monitor implements the `norcube monitor ...` command tree: // uptime, SSL certificate and domain expiry monitors, their check history, -// incidents and alert channels, and an organization-wide status for -// scripts and CI. +// incidents and alert channels, public status pages, and an +// organization-wide status for scripts and CI. package monitor import ( @@ -57,7 +57,8 @@ func newCmd(d deps) *cobra.Command { from Norcube's servers. A monitor is an HTTP check (optionally with a keyword), an SSL certificate check or a domain expiry check. Problems confirmed by consecutive checks open incidents, which alert through your -alert channels (email, webhook, Slack, Discord, SMS). +alert channels (email, webhook, Slack, Discord, SMS). Status pages show +chosen monitors to the public. Monitors and channels are named by their id or, where a command says so, by their exact name. Checks count towards your Norcube Monitor usage, on a @@ -68,14 +69,16 @@ critical incident is open, and "monitor monitors run --wait" fails it when the check finds the monitor down. CI tokens need a Norcube Monitor scope: monitor.read (everything that reads), monitor.check (run checks), monitor.write (manage monitors and -incidents) or monitor.channels (manage alert channels, which -monitor.write doesn't include).`, +incidents), monitor.channels (manage alert channels) or +monitor.statuspages (manage status pages and post on them). monitor.write +includes neither of the last two.`, } cmd.AddCommand( newStatusCmd(d), newMonitorsCmd(d), newIncidentsCmd(d), newChannelsCmd(d), + newStatusPagesCmd(d), ) registerCompletions(cmd, d) return cmd diff --git a/internal/cli/monitor/completion.go b/internal/cli/monitor/completion.go index a15c61a..3b6290b 100644 --- a/internal/cli/monitor/completion.go +++ b/internal/cli/monitor/completion.go @@ -16,11 +16,14 @@ const ( completeMonitors = "monitor-monitors" completeChannels = "monitor-channels" completeIncidents = "monitor-incidents" + completePages = "monitor-status-pages" + completePosts = "monitor-status-page-incidents" ) // registerCompletions offers monitor ids (named, with their status), // channel ids and open incident ids to the commands and flags that take -// them. +// them, and status pages (and a page's posted incidents, once the page is +// named) to the status page commands. func registerCompletions(root *cobra.Command, d deps) { monitors := monitorCandidates(d) var walk func(c *cobra.Command) @@ -37,6 +40,10 @@ func registerCompletions(root *cobra.Command, d deps) { c.ValidArgsFunction = completion.Func(completeChannels, 1, channelCandidates(d)) case "": c.ValidArgsFunction = completion.Func(completeIncidents, 1, incidentCandidates(d)) + case "": + c.ValidArgsFunction = completion.Func(completePages, 1, pageCandidates(d)) + case " ": + c.ValidArgsFunction = postArgCompletion(d) } for _, sub := range c.Commands() { walk(sub) @@ -122,3 +129,65 @@ func incidentCandidates(d deps) completion.Fetcher { return out, nil } } + +func pageCandidates(d deps) completion.Fetcher { + return func(cmd *cobra.Command) ([]cobra.Completion, error) { + c, err := d.client(cmd) + if err != nil { + return nil, err + } + limit := maxPageSize + res, err := c.API.ListStatusPagesWithResponse(cmd.Context(), &monitor.ListStatusPagesParams{Limit: &limit}) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, fmt.Errorf("status %d", res.StatusCode()) + } + out := make([]cobra.Completion, 0, len(res.JSON200.List)) + for _, p := range res.JSON200.List { + out = append(out, fmt.Sprintf("%s\t%s (%s)", p.Slug, p.Name, statusPageState(p))) + } + return out, nil + } +} + +// postArgCompletion completes ` `: the page, then that +// page's newest posted incidents, cached per page. +func postArgCompletion(d deps) cobra.CompletionFunc { + return func(cmd *cobra.Command, args []string, toComplete string) ([]cobra.Completion, cobra.ShellCompDirective) { + switch len(args) { + case 0: + return completion.Lookup(cmd, completePages, toComplete, pageCandidates(d)), cobra.ShellCompDirectiveNoFileComp + case 1: + return completion.Lookup(cmd, completePosts+":"+args[0], toComplete, postCandidates(d, args[0])), cobra.ShellCompDirectiveNoFileComp + } + return nil, cobra.ShellCompDirectiveNoFileComp + } +} + +func postCandidates(d deps, page string) completion.Fetcher { + return func(cmd *cobra.Command) ([]cobra.Completion, error) { + c, err := d.client(cmd) + if err != nil { + return nil, err + } + id, err := statusPageID(cmd.Context(), c, page) + if err != nil { + return nil, err + } + limit := maxPageSize + res, err := c.API.ListStatusPageIncidentsWithResponse(cmd.Context(), id, &monitor.ListStatusPageIncidentsParams{Limit: &limit}) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, fmt.Errorf("status %d", res.StatusCode()) + } + out := make([]cobra.Completion, 0, len(res.JSON200.List)) + for _, i := range res.JSON200.List { + out = append(out, fmt.Sprintf("%s\t%s: %s", i.Id, i.Status, i.Title)) + } + return out, nil + } +} diff --git a/internal/cli/monitor/format.go b/internal/cli/monitor/format.go index e2e16af..3e50108 100644 --- a/internal/cli/monitor/format.go +++ b/internal/cli/monitor/format.go @@ -476,3 +476,130 @@ func withoutSecret(c monitor.DtoAlertChannelWithSecret) monitor.DtoAlertChannel UpdatedAt: c.UpdatedAt, Verified: c.Verified, } } + +// ---------- status pages ---------- + +func statusPageState(p monitor.DtoStatusPage) string { + if p.Published { + return "published" + } + return "draft" +} + +func statusPageRow(p monitor.DtoStatusPage) []string { + return []string{p.Id.String(), p.Slug, p.Name, statusPageState(p), p.Url, output.WhenString(p.UpdatedAt)} +} + +func statusPageTable(items []monitor.DtoStatusPage) output.Table[monitor.DtoStatusPage] { + return output.Table[monitor.DtoStatusPage]{ + Headers: []string{"ID", "SLUG", "NAME", "STATE", "URL", "UPDATED"}, + MaxWidths: []int{0, 0, 32, 0, 0, 0}, + Rows: statusPageRow, + Items: items, + } +} + +func statusPageObject(p monitor.DtoStatusPage) output.Object { + s := p.Settings + return output.Object{Value: p, Text: statusPageRow(p), Fields: []output.Field{ + {Name: "ID", Value: p.Id.String()}, + {Name: "Slug", Value: p.Slug}, + {Name: "Name", Value: p.Name}, + {Name: "Description", Value: p.Description}, + {Name: "URL", Value: p.Url}, + {Name: "State", Value: statusPageState(p)}, + {Name: "Published", Value: output.WhenString(cmdutil.Deref(p.PublishedAt))}, + {Name: "Time zone", Value: s.TimeZone}, + {Name: "Uptime days", Value: strconv.Itoa(int(s.UptimeDays))}, + {Name: "History days", Value: strconv.Itoa(s.HistoryDays)}, + {Name: "Uptime bars", Value: yesNo(s.ShowUptimeBars)}, + {Name: "Uptime percent", Value: yesNo(s.ShowUptimePercent)}, + {Name: "Response time", Value: yesNo(s.ShowResponseTime)}, + {Name: "Search indexing", Value: yesNo(s.SearchIndexing)}, + {Name: "Created", Value: output.WhenString(p.CreatedAt)}, + {Name: "Updated", Value: output.WhenString(p.UpdatedAt)}, + }} +} + +// statusPageComponentLine is one component of a layout: its public name, +// where its status comes from, and its id. +func statusPageComponentLine(x monitor.DtoStatusPageComponent) string { + source := string(cmdutil.Deref(x.ManualStatus)) + " (manual)" + if x.MonitorId != nil { + aspects := make([]string, 0, len(cmdutil.Deref(x.Aspects))) + for _, a := range cmdutil.Deref(x.Aspects) { + aspects = append(aspects, string(a)) + } + source = "monitor " + x.MonitorId.String() + " (" + strings.Join(aspects, ", ") + ")" + } + id := "" + if x.Id != nil { + id = x.Id.String() + " " + } + return id + x.Name + ": " + source +} + +func statusPageComponentLines(items []monitor.DtoStatusPageComponent) string { + lines := make([]string, 0, len(items)) + for _, x := range items { + lines = append(lines, statusPageComponentLine(x)) + } + return orNone(lines) +} + +// statusPageLayoutObject shows a layout as its rows; JSON is the document +// `layout set` takes. -o text prints the counts. +func statusPageLayoutObject(l monitor.DtoStatusPageLayout) output.Object { + count := len(l.Components) + fields := []output.Field{{Name: "Components", Value: statusPageComponentLines(l.Components)}} + for _, g := range l.Groups { + count += len(g.Components) + fields = append(fields, output.Field{Name: "Group " + g.Name, Value: statusPageComponentLines(g.Components)}) + } + return output.Object{Value: l, Fields: fields, Text: []string{strconv.Itoa(count), strconv.Itoa(len(l.Groups))}} +} + +// ---------- posted incidents ---------- + +func postRow(i monitor.DtoStatusPageIncident) []string { + return []string{ + i.Id.String(), string(i.Status), string(i.Impact), i.Title, + output.WhenString(i.StartedAt), output.WhenString(cmdutil.Deref(i.ResolvedAt)), strconv.Itoa(len(i.Updates)), + } +} + +func postTable(items []monitor.DtoStatusPageIncident) output.Table[monitor.DtoStatusPageIncident] { + return output.Table[monitor.DtoStatusPageIncident]{ + Headers: []string{"ID", "STATUS", "IMPACT", "TITLE", "STARTED", "RESOLVED", "UPDATES"}, + MaxWidths: []int{0, 0, 0, 48, 0, 0, 0}, + Rows: postRow, + Items: items, + } +} + +func postObject(p monitor.DtoStatusPage, i monitor.DtoStatusPageIncident) output.Object { + address := "not public: the page isn't published" + if p.Published { + address = postURL(p, i.Id) + } + components := make([]string, 0, len(i.Components)) + for _, x := range i.Components { + components = append(components, x.ComponentId.String()+" "+string(x.Status)) + } + updates := make([]string, 0, len(i.Updates)) + for _, u := range i.Updates { + updates = append(updates, stamp(u.CreatedAt)+" "+string(u.Status)+": "+u.Body) + } + return output.Object{Value: i, Text: postRow(i), Fields: []output.Field{ + {Name: "ID", Value: i.Id.String()}, + {Name: "Title", Value: i.Title}, + {Name: "Status", Value: string(i.Status)}, + {Name: "Impact", Value: string(i.Impact)}, + {Name: "Started", Value: output.WhenString(i.StartedAt)}, + {Name: "Resolved", Value: output.WhenString(cmdutil.Deref(i.ResolvedAt))}, + {Name: "Address", Value: address}, + {Name: "Components", Value: orNone(components)}, + {Name: "Monitor incidents", Value: orNone(i.MonitorIncidentIds)}, + {Name: "Updates", Value: orNone(updates)}, + }} +} diff --git a/internal/cli/monitor/resolve.go b/internal/cli/monitor/resolve.go index d5a24eb..c5e6eed 100644 --- a/internal/cli/monitor/resolve.go +++ b/internal/cli/monitor/resolve.go @@ -109,3 +109,65 @@ func channelRef(ctx context.Context, c *monitorContext, ref string) (uuid.UUID, } return uuid.Nil, clierr.Usage(fmt.Errorf("%d alert channels are named %q: name one by id (%s)", len(ids), ref, strings.Join(ids, ", "))) } + +// statusPageID resolves a status page named on the command line: its id, +// which needs no request, or its exact slug. +func statusPageID(ctx context.Context, c *monitorContext, ref string) (uuid.UUID, error) { + ref = strings.TrimSpace(ref) + if id, err := uuid.Parse(ref); err == nil { + return id, nil + } + p, err := statusPageBySlug(ctx, c, ref) + if err != nil { + return uuid.Nil, err + } + return p.Id, nil +} + +// getStatusPage returns a status page named by its id or exact slug. +func getStatusPage(ctx context.Context, c *monitorContext, ref string) (monitor.DtoStatusPage, error) { + ref = strings.TrimSpace(ref) + id, err := uuid.Parse(ref) + if err != nil { + return statusPageBySlug(ctx, c, ref) + } + res, err := c.API.GetStatusPageWithResponse(ctx, id) + if err != nil { + return monitor.DtoStatusPage{}, err + } + if res.JSON200 == nil { + return monitor.DtoStatusPage{}, apiError(res.HTTPResponse, res.Body) + } + return *res.JSON200, nil +} + +// statusPageBySlug looks through the organization's pages: the API has no +// lookup by slug. Slugs are unique, so at most one matches. +func statusPageBySlug(ctx context.Context, c *monitorContext, slug string) (monitor.DtoStatusPage, error) { + if slug == "" { + return monitor.DtoStatusPage{}, clierr.Usage(fmt.Errorf("no status page given")) + } + limit := maxPageSize + params := &monitor.ListStatusPagesParams{Limit: &limit} + for { + res, err := c.API.ListStatusPagesWithResponse(ctx, params) + if err != nil { + return monitor.DtoStatusPage{}, err + } + if res.JSON200 == nil { + return monitor.DtoStatusPage{}, apiError(res.HTTPResponse, res.Body) + } + for _, p := range res.JSON200.List { + if p.Slug == slug { + return p, nil + } + } + next := nextCursor(res.JSON200.Cursors) + if next == "" { + break + } + params.Cursor = &next + } + return monitor.DtoStatusPage{}, &clierr.Error{Code: clierr.CodeNotFound, Message: fmt.Sprintf("no status page with the slug %q", slug), + Hint: "List them with `norcube monitor status-pages list`."} +} diff --git a/internal/cli/monitor/statuspage_incidents.go b/internal/cli/monitor/statuspage_incidents.go new file mode 100644 index 0000000..a859de4 --- /dev/null +++ b/internal/cli/monitor/statuspage_incidents.go @@ -0,0 +1,554 @@ +package monitor + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/google/uuid" + "github.com/spf13/cobra" + + "github.com/norcubeplatform/cli/internal/api/monitor" + "github.com/norcubeplatform/cli/internal/clierr" + "github.com/norcubeplatform/cli/internal/cmdutil" + "github.com/norcubeplatform/cli/internal/output" +) + +var ( + postFilters = []string{"open", "resolved"} + postStatuses = []string{"investigating", "identified", "monitoring", "resolved"} + postImpacts = []string{"none", "minor", "major", "critical"} + affectedStatuses = []string{"operational", "degraded_performance", "partial_outage", "major_outage"} +) + +const componentFlagHelp = `An affected component and the status the page shows it in while the incident is open, as "=" (repeatable): operational, degraded_performance, partial_outage or major_outage` + +func newStatusPageIncidentsCmd(d deps) *cobra.Command { + cmd := &cobra.Command{ + Use: "incidents", + Aliases: []string{"incident"}, + Short: "Post incidents on a status page and keep them updated", + Long: `A posted incident is what you tell the public: a title, an impact and a +series of updates. It is separate from a monitor's own incidents, which stay +internal; a post may link to them for your navigation, but those links are +never published. + +While a post is open, the status it gives an affected component wins over +what the component's monitor says. A post with status resolved moves to the +page's history. On a published page everything here is public within a +minute.`, + } + cmd.AddCommand(newPostListCmd(d), newPostGetCmd(d), newPostCreateCmd(d), newPostUpdateCmd(d), newPostUpdatesCmd(d)) + return cmd +} + +func newPostListCmd(d deps) *cobra.Command { + var ( + pf cmdutil.PageFlags + status string + ) + cmd := &cobra.Command{ + Use: "list ", + Annotations: cmdutil.Reads(), + Short: "List the incidents posted on a status page, newest first", + Example: ` norcube monitor status-pages incidents list acme + norcube monitor status-pages incidents list acme --status open`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + params := monitor.ListStatusPageIncidentsParams{} + if status != "" { + if err := oneOf("--status", status, postFilters); err != nil { + return nil, err + } + v := monitor.ListStatusPageIncidentsParamsStatus(status) + params.Status = &v + } + c, err := d.client(cmd) + if err != nil { + return nil, err + } + id, err := statusPageID(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + page, err := cmdutil.Paginate(cmd.Context(), pf, func(ctx context.Context, cursor string, size int) ([]monitor.DtoStatusPageIncident, string, error) { + p := params + p.Limit = &size + if cursor != "" { + p.Cursor = &cursor + } + res, err := c.API.ListStatusPageIncidentsWithResponse(ctx, id, &p) + if err != nil { + return nil, "", err + } + if res.JSON200 == nil { + return nil, "", apiError(res.HTTPResponse, res.Body) + } + return res.JSON200.List, nextCursor(res.JSON200.Cursors), nil + }) + if err != nil { + return nil, err + } + return nil, page.Print(cmd, postTable(page.Items)) + }), + } + cmd.Flags().StringVar(&status, "status", "", "Only open or resolved incidents") + cmdutil.FlagEnum(cmd, "status", postFilters...) + cmdutil.AddPageFlags(cmd, &pf, defaultPageSize, maxItems) + return cmd +} + +func newPostGetCmd(d deps) *cobra.Command { + return &cobra.Command{ + Use: "get ", + Annotations: cmdutil.Reads(), + Short: "Show a posted incident with its updates and public address", + Example: ` norcube monitor status-pages incidents get acme 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f`, + Args: cobra.ExactArgs(2), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + incidentID, err := idArg("posted incident", args[1]) + if err != nil { + return nil, err + } + c, err := d.client(cmd) + if err != nil { + return nil, err + } + p, err := getStatusPage(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + res, err := c.API.GetStatusPageIncidentWithResponse(cmd.Context(), p.Id, incidentID) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + return postObject(p, *res.JSON200), nil + }), + } +} + +// messageFlags are an update's text, as an argument or from a file. +type messageFlags struct{ message, file string } + +func addMessageFlags(cmd *cobra.Command, f *messageFlags, what string) { + cmd.Flags().StringVar(&f.message, "message", "", what+"; public") + cmd.Flags().StringVar(&f.file, "message-file", "", "Read the message from this file (- for standard input)") + cmd.MarkFlagsMutuallyExclusive("message", "message-file") + cmd.MarkFlagsOneRequired("message", "message-file") +} + +func (f messageFlags) read(cmd *cobra.Command) (string, error) { + text, err := cmdutil.ReadText(cmd.InOrStdin(), f.message, f.file, "the message") + if err != nil { + return "", err + } + if strings.TrimSpace(text) == "" { + return "", clierr.Usage(fmt.Errorf("the message is empty")) + } + return text, nil +} + +func newPostCreateCmd(d deps) *cobra.Command { + var ( + msg messageFlags + title string + status, impact string + startedAt string + components []string + monitorIncidents []string + ) + cmd := &cobra.Command{ + Use: "create ", + Annotations: cmdutil.Writes(), + Short: "Post an incident on a status page; public within a minute on a published page", + Long: `Posts an incident with its first update. On a published page it is public +within a minute: write it for your customers. It counts toward the page's +overall status while it is open, and --component sets what the page shows +for the components it affects. + +--monitor-incident links the monitor incidents the post is about, for your +own navigation; the links are never published.`, + Example: ` norcube monitor status-pages incidents create acme --title "Elevated API errors" --status investigating --impact minor --message "We are looking into it." + norcube monitor status-pages incidents create acme --title "Checkout is down" --status identified --impact major --message-file update.txt --component "Checkout=major_outage" --started-at 20m`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + if err := oneOf("--status", status, postStatuses); err != nil { + return nil, err + } + if err := oneOf("--impact", impact, postImpacts); err != nil { + return nil, err + } + parsed, err := parseAffected(components) + if err != nil { + return nil, err + } + links, err := monitorIncidentIDs(monitorIncidents) + if err != nil { + return nil, err + } + text, err := msg.read(cmd) + if err != nil { + return nil, err + } + body := monitor.DtoStatusPageIncidentCreate{ + Title: strings.TrimSpace(title), Body: text, + Status: monitor.DtoStatusPageIncidentCreateStatus(status), + Impact: monitor.DtoStatusPageIncidentCreateImpact(impact), + } + if startedAt != "" { + at, err := startedAtArg(startedAt, d.now()) + if err != nil { + return nil, err + } + body.StartedAt = &at + } + if len(links) > 0 { + body.MonitorIncidentIds = &links + } + c, err := d.client(cmd) + if err != nil { + return nil, err + } + p, err := getStatusPage(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + if len(parsed) > 0 { + affected, err := resolveAffected(cmd.Context(), c, p.Id, parsed) + if err != nil { + return nil, err + } + body.Components = &affected + } + res, err := c.API.CreateStatusPageIncidentWithResponse(cmd.Context(), p.Id, body) + if err != nil { + return nil, err + } + if res.JSON201 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + return postDone(p, *res.JSON201, "Posted incident"), nil + }), + } + cmd.Flags().StringVar(&title, "title", "", "The incident's public title") + cmd.Flags().StringVar(&status, "status", "", "Where it stands: investigating, identified, monitoring or resolved") + cmd.Flags().StringVar(&impact, "impact", "", "How bad it is: none, minor, major or critical") + addMessageFlags(cmd, &msg, "The first update's text") + cmd.Flags().StringVar(&startedAt, "started-at", "", "When it began, if not now: an RFC 3339 timestamp, a date or an age (20m, 2h)") + cmd.Flags().StringArrayVar(&components, "component", nil, componentFlagHelp) + cmd.Flags().StringSliceVar(&monitorIncidents, "monitor-incident", nil, "Id of a monitor incident this post is about (repeat or comma-separate); never published") + cmdutil.FlagEnum(cmd, "status", postStatuses...) + cmdutil.FlagEnum(cmd, "impact", postImpacts...) + for _, name := range []string{"title", "status", "impact"} { + _ = cmd.MarkFlagRequired(name) + } + return cmd +} + +func newPostUpdateCmd(d deps) *cobra.Command { + var ( + title, impact, startedAt string + components []string + noComponents bool + monitorIncidents []string + noMonitorIncidents bool + ) + cmd := &cobra.Command{ + Use: "update ", + Annotations: cmdutil.Writes(), + Short: "Correct a posted incident; public within a minute on a published page", + Long: `Corrects a post's title, impact, start or references, and changes only what +you pass. It adds no update and doesn't move the status: for that, use +"incidents updates create". --component replaces the affected components as +a whole. Resolved posts can be corrected too. On a published page a +correction is public within a minute.`, + Example: ` norcube monitor status-pages incidents update acme 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f --title "Elevated API errors in Europe" + norcube monitor status-pages incidents update acme 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f --impact major --component "API=partial_outage"`, + Args: cobra.ExactArgs(2), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + incidentID, err := idArg("posted incident", args[1]) + if err != nil { + return nil, err + } + set := cmd.Flags().Changed + var body monitor.DtoStatusPageIncidentUpdate + changed := false + if set("title") { + t := strings.TrimSpace(title) + body.Title, changed = &t, true + } + if set("impact") { + if err := oneOf("--impact", impact, postImpacts); err != nil { + return nil, err + } + v := monitor.DtoStatusPageIncidentUpdateImpact(impact) + body.Impact, changed = &v, true + } + if set("started-at") { + at, err := startedAtArg(startedAt, d.now()) + if err != nil { + return nil, err + } + body.StartedAt, changed = &at, true + } + parsed, err := parseAffected(components) + if err != nil { + return nil, err + } + if noComponents { + body.Components, changed = &[]monitor.DtoStatusPageAffected{}, true + } + if set("monitor-incident") { + links, err := monitorIncidentIDs(monitorIncidents) + if err != nil { + return nil, err + } + body.MonitorIncidentIds, changed = &links, true + } + if noMonitorIncidents { + body.MonitorIncidentIds, changed = &[]uuid.UUID{}, true + } + if !changed && len(parsed) == 0 { + return nil, clierr.Usage(fmt.Errorf("nothing to change: pass --title, --impact, --started-at, --component or --monitor-incident (to add an update, use: incidents updates create)")) + } + c, err := d.client(cmd) + if err != nil { + return nil, err + } + p, err := getStatusPage(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + if len(parsed) > 0 { + affected, err := resolveAffected(cmd.Context(), c, p.Id, parsed) + if err != nil { + return nil, err + } + body.Components = &affected + } + res, err := c.API.UpdateStatusPageIncidentWithResponse(cmd.Context(), p.Id, incidentID, body) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + return postDone(p, *res.JSON200, "Corrected incident"), nil + }), + } + cmd.Flags().StringVar(&title, "title", "", "New public title") + cmd.Flags().StringVar(&impact, "impact", "", "New impact: none, minor, major or critical") + cmd.Flags().StringVar(&startedAt, "started-at", "", "When it began: an RFC 3339 timestamp, a date or an age (20m, 2h)") + cmd.Flags().StringArrayVar(&components, "component", nil, componentFlagHelp) + cmd.Flags().BoolVar(&noComponents, "no-components", false, "Remove every affected component") + cmd.Flags().StringSliceVar(&monitorIncidents, "monitor-incident", nil, "Replace the linked monitor incidents with these ids (repeat or comma-separate); never published") + cmd.Flags().BoolVar(&noMonitorIncidents, "no-monitor-incidents", false, "Remove every link to a monitor incident") + cmd.MarkFlagsMutuallyExclusive("component", "no-components") + cmd.MarkFlagsMutuallyExclusive("monitor-incident", "no-monitor-incidents") + cmdutil.FlagEnum(cmd, "impact", postImpacts...) + return cmd +} + +func newPostUpdatesCmd(d deps) *cobra.Command { + cmd := &cobra.Command{ + Use: "updates", + Short: "Add updates to a posted incident", + Long: `Updates are the timeline of a posted incident: "incidents get" shows them, +and they can't be edited or removed.`, + } + cmd.AddCommand(newPostUpdateCreateCmd(d)) + return cmd +} + +func newPostUpdateCreateCmd(d deps) *cobra.Command { + var ( + msg messageFlags + status string + components []string + noComponents bool + ) + cmd := &cobra.Command{ + Use: "create ", + Annotations: cmdutil.Writes(), + Short: "Post an update on an incident; public within a minute on a published page", + Long: `Adds an update to an open post. Its status becomes the post's; resolved ends +the post and moves it to the page's history, after which it takes no more +updates (post a new incident instead). On a published page the update is +public within a minute. --component replaces the affected components.`, + Example: ` norcube monitor status-pages incidents updates create acme 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f --status monitoring --message "A fix is rolling out." + norcube monitor status-pages incidents updates create acme 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f --status resolved --message "All clear."`, + Args: cobra.ExactArgs(2), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + incidentID, err := idArg("posted incident", args[1]) + if err != nil { + return nil, err + } + if err := oneOf("--status", status, postStatuses); err != nil { + return nil, err + } + parsed, err := parseAffected(components) + if err != nil { + return nil, err + } + text, err := msg.read(cmd) + if err != nil { + return nil, err + } + body := monitor.DtoStatusPageIncidentPost{Status: monitor.DtoStatusPageIncidentPostStatus(status), Body: text} + if noComponents { + body.Components = &[]monitor.DtoStatusPageAffected{} + } + c, err := d.client(cmd) + if err != nil { + return nil, err + } + p, err := getStatusPage(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + if len(parsed) > 0 { + affected, err := resolveAffected(cmd.Context(), c, p.Id, parsed) + if err != nil { + return nil, err + } + body.Components = &affected + } + res, err := c.API.CreateStatusPageIncidentUpdateWithResponse(cmd.Context(), p.Id, incidentID, body) + if err != nil { + return nil, err + } + if res.JSON201 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + return postDone(p, *res.JSON201, "Posted an update on incident"), nil + }), + } + cmd.Flags().StringVar(&status, "status", "", "Where it stands now: investigating, identified, monitoring or resolved") + addMessageFlags(cmd, &msg, "The update's text") + cmd.Flags().StringArrayVar(&components, "component", nil, componentFlagHelp) + cmd.Flags().BoolVar(&noComponents, "no-components", false, "Remove every affected component") + cmd.MarkFlagsMutuallyExclusive("component", "no-components") + cmdutil.FlagEnum(cmd, "status", postStatuses...) + _ = cmd.MarkFlagRequired("status") + return cmd +} + +// postDone is the result of a write on a post: the API's resource, and a +// line saying who can see it now. +func postDone(p monitor.DtoStatusPage, inc monitor.DtoStatusPageIncident, verb string) output.Done { + msg := fmt.Sprintf("%s %q on %s. ", verb, inc.Title, p.Slug) + if p.Published { + msg += "Public within a minute at " + postURL(p, inc.Id) + "." + } else { + msg += "The page isn't published, so only preview links show it." + } + return output.Done{Message: msg, Value: inc, Fields: []output.Field{{Value: inc.Id.String()}, {Value: string(inc.Status)}}} +} + +// postURL is a post's public address. +func postURL(p monitor.DtoStatusPage, id uuid.UUID) string { + return strings.TrimRight(p.Url, "/") + "/incidents/" + id.String() +} + +func startedAtArg(v string, now time.Time) (string, error) { + t, err := cmdutil.ParseTimeArg("started-at", v, now) + if err != nil { + return "", err + } + return t.Format(time.RFC3339), nil +} + +func monitorIncidentIDs(values []string) ([]uuid.UUID, error) { + out := make([]uuid.UUID, 0, len(values)) + for _, v := range values { + id, err := idArg("monitor incident", v) + if err != nil { + return nil, err + } + out = append(out, id) + } + return out, nil +} + +// affectedArg is one --component value: a component's id or public name, +// and the status it should show. +type affectedArg struct{ ref, status string } + +// parseAffected reads --component values before any request. The status +// comes after the last "=", since a component's name may contain one. +func parseAffected(values []string) ([]affectedArg, error) { + out := make([]affectedArg, 0, len(values)) + for _, v := range values { + i := strings.LastIndex(v, "=") + if i <= 0 || i == len(v)-1 { + return nil, clierr.Usage(fmt.Errorf(`--component %q: use "="`, v)) + } + status := strings.TrimSpace(v[i+1:]) + if err := oneOf("--component "+strings.TrimSpace(v[:i]), status, affectedStatuses); err != nil { + return nil, err + } + out = append(out, affectedArg{ref: strings.TrimSpace(v[:i]), status: status}) + } + return out, nil +} + +// resolveAffected turns --component values into the API's shape, reading +// the page's layout only when one names a component by name. +func resolveAffected(ctx context.Context, c *monitorContext, pageID uuid.UUID, args []affectedArg) ([]monitor.DtoStatusPageAffected, error) { + var layout *monitor.DtoStatusPageLayout + out := make([]monitor.DtoStatusPageAffected, 0, len(args)) + for _, a := range args { + id, err := uuid.Parse(a.ref) + if err != nil { + if layout == nil { + res, err := c.API.GetStatusPageLayoutWithResponse(ctx, pageID) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + layout = res.JSON200 + } + if id, err = componentByName(*layout, a.ref); err != nil { + return nil, err + } + } + out = append(out, monitor.DtoStatusPageAffected{ComponentId: id, Status: monitor.DtoStatusPageAffectedStatus(a.status)}) + } + return out, nil +} + +// componentByName finds a component by its exact public name +// (case-insensitive). A name that matches several is a usage error, never a +// guess. +func componentByName(l monitor.DtoStatusPageLayout, name string) (uuid.UUID, error) { + var ids []uuid.UUID + match := func(cs []monitor.DtoStatusPageComponent) { + for _, x := range cs { + if x.Id != nil && strings.EqualFold(x.Name, name) { + ids = append(ids, *x.Id) + } + } + } + match(l.Components) + for _, g := range l.Groups { + match(g.Components) + } + switch len(ids) { + case 0: + return uuid.Nil, &clierr.Error{Code: clierr.CodeNotFound, Message: fmt.Sprintf("no component named %q on this page", name), + Hint: "List them with `norcube monitor status-pages layout get `."} + case 1: + return ids[0], nil + } + names := make([]string, len(ids)) + for i, id := range ids { + names[i] = id.String() + } + return uuid.Nil, clierr.Usage(fmt.Errorf("%d components are named %q: name one by id (%s)", len(ids), name, strings.Join(names, ", "))) +} diff --git a/internal/cli/monitor/statuspages.go b/internal/cli/monitor/statuspages.go new file mode 100644 index 0000000..3e3ca5b --- /dev/null +++ b/internal/cli/monitor/statuspages.go @@ -0,0 +1,592 @@ +package monitor + +import ( + "context" + "fmt" + "net/http" + "strconv" + "strings" + + "github.com/spf13/cobra" + + "github.com/norcubeplatform/cli/internal/api/monitor" + "github.com/norcubeplatform/cli/internal/clierr" + "github.com/norcubeplatform/cli/internal/cmdutil" + "github.com/norcubeplatform/cli/internal/output" +) + +// The bar ranges and history window a page may have; the API refuses others. +var statusPageUptimeDays = []string{"30", "60", "90"} + +const ( + statusPageHistoryDaysMin = 7 + statusPageHistoryDaysMax = 365 +) + +func newStatusPagesCmd(d deps) *cobra.Command { + cmd := &cobra.Command{ + Use: "status-pages", + Aliases: []string{"status-page"}, + Short: "Manage public status pages, their layout and the incidents posted on them", + Long: `A status page is a public page that shows chosen monitors and manual rows +as components, under names you pick; a monitor's own name and target are +never shown. A page starts unpublished: set its layout, check it with a +preview link, then publish it. Changes to a published page, and incidents +posted on it, are public within a minute. + +Pages are named by their id or exact slug. Any Norcube Monitor scope reads +them; a CI token changes them or posts on them only with the +monitor.statuspages scope, which no other scope includes, because +everything it changes is public.`, + } + cmd.AddCommand( + newStatusPageListCmd(d), newStatusPageGetCmd(d), newStatusPageCreateCmd(d), newStatusPageUpdateCmd(d), + newStatusPageDeleteCmd(d), newStatusPagePublishCmd(d), newStatusPageUnpublishCmd(d), newStatusPagePreviewLinkCmd(d), + newStatusPageLayoutCmd(d), newStatusPageIncidentsCmd(d), + ) + return cmd +} + +func newStatusPageListCmd(d deps) *cobra.Command { + var ( + pf cmdutil.PageFlags + monitorIDArg string + ) + cmd := &cobra.Command{ + Use: "list", + Annotations: cmdutil.Reads(), + Short: "List status pages, newest first", + Long: `Lists the organization's status pages, published or not. --monitor lists +the pages that show one monitor instead (at most 50, on one page).`, + Example: ` norcube monitor status-pages list + norcube monitor status-pages list --monitor "Shop" + norcube monitor status-pages list -o json --query "[?published].url"`, + Args: cobra.NoArgs, + RunE: cmdutil.Run(func(cmd *cobra.Command, _ []string) (any, error) { + c, err := d.client(cmd) + if err != nil { + return nil, err + } + params := monitor.ListStatusPagesParams{} + if monitorIDArg != "" { + id, err := monitorRef(cmd.Context(), c, monitorIDArg) + if err != nil { + return nil, err + } + params.MonitorId = &id + } + page, err := cmdutil.Paginate(cmd.Context(), pf, func(ctx context.Context, cursor string, size int) ([]monitor.DtoStatusPage, string, error) { + p := params + p.Limit = &size + if cursor != "" { + p.Cursor = &cursor + } + res, err := c.API.ListStatusPagesWithResponse(ctx, &p) + if err != nil { + return nil, "", err + } + if res.JSON200 == nil { + return nil, "", apiError(res.HTTPResponse, res.Body) + } + return res.JSON200.List, nextCursor(res.JSON200.Cursors), nil + }) + if err != nil { + return nil, err + } + return nil, page.Print(cmd, statusPageTable(page.Items)) + }), + } + cmd.Flags().StringVar(&monitorIDArg, "monitor", "", "Only pages that show this monitor (id or exact name)") + cmdutil.AddPageFlags(cmd, &pf, defaultPageSize, maxItems) + return cmd +} + +func newStatusPageGetCmd(d deps) *cobra.Command { + return &cobra.Command{ + Use: "get ", + Annotations: cmdutil.Reads(), + Short: "Show a status page and its settings", + Example: ` norcube monitor status-pages get acme + norcube monitor status-pages get acme -o json --query url`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + c, err := d.client(cmd) + if err != nil { + return nil, err + } + p, err := getStatusPage(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + return statusPageObject(p), nil + }), + } +} + +// statusPageFlags are the settings create and update share. +type statusPageFlags struct { + slug, description, timeZone string + uptimeDays, historyDays int + bars, percent, response bool + indexing bool +} + +func addStatusPageFlags(cmd *cobra.Command, f *statusPageFlags) { + fl := cmd.Flags() + fl.StringVar(&f.slug, "slug", "", "The page's public address: 3 to 40 lowercase letters, digits or hyphens") + fl.StringVar(&f.description, "description", "", "Public text shown under the page's name") + fl.StringVar(&f.timeZone, "time-zone", "", "IANA time zone the page shows times in, e.g. Europe/Prague") + fl.IntVar(&f.uptimeDays, "uptime-days", 0, "Days the uptime bars cover: 30, 60 or 90") + fl.IntVar(&f.historyDays, "history-days", 0, "Days resolved incidents stay on the page, 7 to 365") + fl.BoolVar(&f.bars, "show-uptime-bars", false, "Show daily uptime bars (--show-uptime-bars=false hides them)") + fl.BoolVar(&f.percent, "show-uptime-percent", false, "Show each component's uptime percentage (--show-uptime-percent=false hides it)") + fl.BoolVar(&f.response, "show-response-time", false, "Show each component's average response time (--show-response-time=false hides it)") + fl.BoolVar(&f.indexing, "search-indexing", false, "Let search engines index the page (--search-indexing=false asks them to leave it out)") + cmdutil.FlagEnum(cmd, "uptime-days", statusPageUptimeDays...) +} + +// checkStatusPageFlags refuses values the API would, before any request. +func checkStatusPageFlags(cmd *cobra.Command, f statusPageFlags) error { + if cmd.Flags().Changed("uptime-days") { + if err := oneOf("--uptime-days", strconv.Itoa(f.uptimeDays), statusPageUptimeDays); err != nil { + return err + } + } + if cmd.Flags().Changed("history-days") && (f.historyDays < statusPageHistoryDaysMin || f.historyDays > statusPageHistoryDaysMax) { + return clierr.Usage(fmt.Errorf("--history-days %d: from %d to %d", f.historyDays, statusPageHistoryDaysMin, statusPageHistoryDaysMax)) + } + return nil +} + +func newStatusPageCreateCmd(d deps) *cobra.Command { + var f statusPageFlags + cmd := &cobra.Command{ + Use: "create ", + Annotations: cmdutil.Writes(), + Short: "Create a status page, unpublished", + Long: `Creates a page that nobody can see yet: set what it shows with "layout +set", check it with "preview-link", then "publish" it. Every setting is +required: the page's public face is your choice, so nothing is filled in +for you. A boolean takes =false to turn it off. + +Your plan limits how many pages an organization has, published or not.`, + Example: ` norcube monitor status-pages create "Acme status" --slug acme --time-zone Europe/Prague --uptime-days 90 --history-days 90 --show-uptime-bars --show-uptime-percent --show-response-time=false --search-indexing`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + if err := checkStatusPageFlags(cmd, f); err != nil { + return nil, err + } + body := monitor.DtoStatusPageCreate{ + Name: strings.TrimSpace(args[0]), + Slug: f.slug, + Settings: monitor.DtoStatusPageSettings{ + TimeZone: f.timeZone, + UptimeDays: monitor.DtoStatusPageSettingsUptimeDays(f.uptimeDays), + HistoryDays: f.historyDays, + ShowUptimeBars: f.bars, + ShowUptimePercent: f.percent, + ShowResponseTime: f.response, + SearchIndexing: f.indexing, + }, + } + if f.description != "" { + body.Description = &f.description + } + c, err := d.client(cmd) + if err != nil { + return nil, err + } + res, err := c.API.CreateStatusPageWithResponse(cmd.Context(), body) + if err != nil { + return nil, err + } + if res.JSON201 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + p := *res.JSON201 + return output.Done{ + Message: fmt.Sprintf("Created status page %s (%s), unpublished. Next: norcube monitor status-pages layout set %s --file layout.json", p.Slug, p.Id, p.Slug), + Value: p, + Fields: []output.Field{{Value: p.Id.String()}, {Value: p.Slug}}, + }, nil + }), + } + addStatusPageFlags(cmd, &f) + for _, name := range []string{"slug", "time-zone", "uptime-days", "history-days", "show-uptime-bars", "show-uptime-percent", "show-response-time", "search-indexing"} { + _ = cmd.MarkFlagRequired(name) + } + return cmd +} + +func newStatusPageUpdateCmd(d deps) *cobra.Command { + var ( + f statusPageFlags + name string + ) + cmd := &cobra.Command{ + Use: "update ", + Annotations: cmdutil.Writes(), + Short: "Change a status page's address, texts or settings", + Long: `Changes only what you pass. On a published page the change is public within +a minute. + +--slug moves the page to a new address. The old address of a published +page redirects to the new one for 30 days, and no other organization can +take it meanwhile; unpublishing or deleting the page gives it up.`, + Example: ` norcube monitor status-pages update acme --name "Acme Inc. status" + norcube monitor status-pages update acme --slug acme-inc + norcube monitor status-pages update acme --uptime-days 30 --show-response-time`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + if err := checkStatusPageFlags(cmd, f); err != nil { + return nil, err + } + body, changed := statusPageUpdateBody(cmd, f, name) + if !changed { + return nil, clierr.Usage(fmt.Errorf("nothing to change: pass --name, --slug, --description or a setting flag (see --help)")) + } + c, err := d.client(cmd) + if err != nil { + return nil, err + } + id, err := statusPageID(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + res, err := c.API.UpdateStatusPageWithResponse(cmd.Context(), id, body) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + p := *res.JSON200 + msg := fmt.Sprintf("Updated status page %s (%s).", p.Slug, p.Id) + if p.Published { + msg += " Public within a minute at " + p.Url + "." + } + return output.Done{Message: msg, Value: p, Fields: []output.Field{{Value: p.Id.String()}, {Value: p.Slug}}}, nil + }), + } + cmd.Flags().StringVar(&name, "name", "", "New public name") + addStatusPageFlags(cmd, &f) + return cmd +} + +// statusPageUpdateBody builds the patch from the flags given, and says +// whether any was. +func statusPageUpdateBody(cmd *cobra.Command, f statusPageFlags, name string) (monitor.DtoStatusPageUpdate, bool) { + set := cmd.Flags().Changed + var body monitor.DtoStatusPageUpdate + changed := false + if set("name") { + n := strings.TrimSpace(name) + body.Name, changed = &n, true + } + if set("slug") { + body.Slug, changed = &f.slug, true + } + if set("description") { + body.Description, changed = &f.description, true + } + var s monitor.DtoStatusPageSettingsUpdate + settings := false + if set("time-zone") { + s.TimeZone, settings = &f.timeZone, true + } + if set("uptime-days") { + v := monitor.DtoStatusPageSettingsUpdateUptimeDays(f.uptimeDays) + s.UptimeDays, settings = &v, true + } + if set("history-days") { + s.HistoryDays, settings = &f.historyDays, true + } + if set("show-uptime-bars") { + s.ShowUptimeBars, settings = &f.bars, true + } + if set("show-uptime-percent") { + s.ShowUptimePercent, settings = &f.percent, true + } + if set("show-response-time") { + s.ShowResponseTime, settings = &f.response, true + } + if set("search-indexing") { + s.SearchIndexing, settings = &f.indexing, true + } + if settings { + body.Settings, changed = &s, true + } + return body, changed +} + +func newStatusPageDeleteCmd(d deps) *cobra.Command { + var yes bool + cmd := &cobra.Command{ + Use: "delete ", + Annotations: cmdutil.Writes(), + Short: "Delete a status page with its layout and posted incidents", + Long: `Deletes the page and everything on it, takes it offline and gives up its +old addresses. The monitors it shows are not touched.`, + Example: ` norcube monitor status-pages delete acme + norcube monitor status-pages delete 6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b --yes`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + c, err := d.client(cmd) + if err != nil { + return nil, err + } + id, err := statusPageID(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + if ok, err := cmdutil.Confirm(fmt.Sprintf("Delete status page %s with its layout and posted incidents? It goes offline", args[0]), yes); err != nil || !ok { + return nil, cmdutil.Cancelled(cmd, err) + } + res, err := c.API.DeleteStatusPageWithResponse(cmd.Context(), id) + if err != nil { + return nil, err + } + if res.StatusCode() != http.StatusNoContent { + return nil, apiError(res.HTTPResponse, res.Body) + } + return output.Done{ + Message: fmt.Sprintf("Deleted status page %s.", args[0]), + Value: deleted{ID: id.String(), Deleted: true}, + Fields: []output.Field{{Value: id.String()}}, + }, nil + }), + } + cmd.Flags().BoolVar(&yes, "yes", false, "Don't ask for confirmation") + return cmd +} + +func newStatusPagePublishCmd(d deps) *cobra.Command { + return &cobra.Command{ + Use: "publish ", + Annotations: cmdutil.Writes(), + Short: "Make a status page public within a minute", + Long: `Publishes the page at its address: it is public within a minute, along +with its page.json and its Atom feed. It needs at least one component. +Publishing a published page changes nothing.`, + Example: ` norcube monitor status-pages publish acme`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + c, err := d.client(cmd) + if err != nil { + return nil, err + } + id, err := statusPageID(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + res, err := c.API.PublishStatusPageWithResponse(cmd.Context(), id) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + p := *res.JSON200 + return output.Done{ + Message: fmt.Sprintf("Published status page %s: public within a minute at %s.", p.Slug, p.Url), + Value: p, + Fields: []output.Field{{Value: p.Id.String()}, {Value: p.Url}}, + }, nil + }), + } +} + +func newStatusPageUnpublishCmd(d deps) *cobra.Command { + var yes bool + cmd := &cobra.Command{ + Use: "unpublish ", + Annotations: cmdutil.Writes(), + Short: "Take a status page offline, keeping everything on it", + Long: `The page's address stops answering and its old addresses are given up, so +another organization can take them. Its layout and posted incidents stay, +and preview links keep working. Unpublishing an unpublished page changes +nothing.`, + Example: ` norcube monitor status-pages unpublish acme + norcube monitor status-pages unpublish acme --yes`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + c, err := d.client(cmd) + if err != nil { + return nil, err + } + id, err := statusPageID(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + if ok, err := cmdutil.Confirm(fmt.Sprintf("Unpublish status page %s? Its address stops answering and its old addresses are given up", args[0]), yes); err != nil || !ok { + return nil, cmdutil.Cancelled(cmd, err) + } + res, err := c.API.UnpublishStatusPageWithResponse(cmd.Context(), id) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + p := *res.JSON200 + return output.Done{ + Message: fmt.Sprintf("Unpublished status page %s (%s).", p.Slug, p.Id), + Value: p, + Fields: []output.Field{{Value: p.Id.String()}, {Value: p.Slug}}, + }, nil + }), + } + cmd.Flags().BoolVar(&yes, "yes", false, "Don't ask for confirmation") + return cmd +} + +func newStatusPagePreviewLinkCmd(d deps) *cobra.Command { + return &cobra.Command{ + Use: "preview-link ", + Annotations: cmdutil.Reads(), + Short: "Print a link to the rendered page that works for 15 minutes", + Long: `Prints a signed link to the page as the public would see it, published or +not. Anyone with the link can open it until it expires, 15 minutes later, +so treat it like a draft you are sharing. It changes nothing, but a CI +token needs the monitor.statuspages scope to get one.`, + Example: ` norcube monitor status-pages preview-link acme + norcube monitor status-pages preview-link acme -o text | cut -f1`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + c, err := d.client(cmd) + if err != nil { + return nil, err + } + id, err := statusPageID(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + res, err := c.API.CreateStatusPagePreviewLinkWithResponse(cmd.Context(), id) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + l := *res.JSON200 + return output.Object{Value: l, Fields: []output.Field{ + {Name: "URL", Value: l.Url}, + {Name: "Expires", Value: output.WhenString(l.ExpiresAt)}, + }}, nil + }), + } +} + +// ---------- layout ---------- + +func newStatusPageLayoutCmd(d deps) *cobra.Command { + cmd := &cobra.Command{ + Use: "layout", + Short: "Show or replace what a status page shows", + Long: `A layout lists a page's components: first those outside any group, then the +groups, each in the order given. A component follows a monitor (kind +monitor, with the aspects that count: availability, certificate, domain) +or has a status you set (kind manual, with manualStatus operational, +degraded_performance, partial_outage or major_outage). The name is what +the public sees; the monitor's name and target never are.`, + } + cmd.AddCommand(newStatusPageLayoutGetCmd(d), newStatusPageLayoutSetCmd(d)) + return cmd +} + +func newStatusPageLayoutGetCmd(d deps) *cobra.Command { + return &cobra.Command{ + Use: "get ", + Annotations: cmdutil.Reads(), + Short: "Show a status page's layout", + Long: `-o json prints the document "layout set" takes, so you can edit and send it back.`, + Example: ` norcube monitor status-pages layout get acme + norcube monitor status-pages layout get acme -o json > layout.json`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + c, err := d.client(cmd) + if err != nil { + return nil, err + } + id, err := statusPageID(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + res, err := c.API.GetStatusPageLayoutWithResponse(cmd.Context(), id) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + return statusPageLayoutObject(*res.JSON200), nil + }), + } +} + +func newStatusPageLayoutSetCmd(d deps) *cobra.Command { + var file string + cmd := &cobra.Command{ + Use: "set ", + Annotations: cmdutil.Writes(), + Short: "Replace a status page's layout from a JSON file; public within a minute on a published page", + Long: `Replaces the layout as a whole and prints the saved one. On a published page +the result is public within a minute, and adding a monitor publishes its +status, so you must be able to read every monitor you name. + +The file has "components" and "groups" (use [] for none), in the shape +"layout get -o json" prints. Keep a row's id to keep the row, leave it out +for a new one. A row left out of the file is removed, and with it its place +on any posted incident.`, + Example: ` norcube monitor status-pages layout set acme --file layout.json + norcube monitor status-pages layout get acme -o json | jq '.groups[0].collapsed = true' | norcube monitor status-pages layout set acme --file -`, + Args: cobra.ExactArgs(1), + RunE: cmdutil.Run(func(cmd *cobra.Command, args []string) (any, error) { + var body monitor.DtoStatusPageLayout + if err := readJSON(cmd, file, "the layout", &body); err != nil { + return nil, err + } + if err := checkLayout(body); err != nil { + return nil, err + } + c, err := d.client(cmd) + if err != nil { + return nil, err + } + p, err := getStatusPage(cmd.Context(), c, args[0]) + if err != nil { + return nil, err + } + res, err := c.API.SetStatusPageLayoutWithResponse(cmd.Context(), p.Id, body) + if err != nil { + return nil, err + } + if res.JSON200 == nil { + return nil, apiError(res.HTTPResponse, res.Body) + } + if p.Published { + fmt.Fprintf(cmdutil.Stderr(cmd), "Saved the layout of %s: public within a minute at %s.\n", p.Slug, p.Url) + } else { + fmt.Fprintf(cmdutil.Stderr(cmd), "Saved the layout of %s. Check it with: norcube monitor status-pages preview-link %s\n", p.Slug, p.Slug) + } + return statusPageLayoutObject(*res.JSON200), nil + }), + } + cmd.Flags().StringVar(&file, "file", "", "Read the layout as JSON from this file (- for standard input)") + _ = cmd.MarkFlagRequired("file") + return cmd +} + +// checkLayout refuses a document that lacks a list. The layout is replaced +// as a whole, so a list left out by mistake must not read as "none". +func checkLayout(l monitor.DtoStatusPageLayout) error { + if l.Components == nil || l.Groups == nil { + return clierr.Usage(fmt.Errorf(`the layout needs both "components" and "groups" (use [] for none)`)) + } + for i, g := range l.Groups { + if g.Components == nil { + return clierr.Usage(fmt.Errorf(`group %d (%s) needs "components" (use [] for none)`, i, g.Name)) + } + } + return nil +} diff --git a/internal/cli/monitor_test.go b/internal/cli/monitor_test.go index abb7e74..62ea693 100644 --- a/internal/cli/monitor_test.go +++ b/internal/cli/monitor_test.go @@ -26,6 +26,16 @@ const ( monPhone = "5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b" monInc = "3f2c8a8e-6c1d-4a59-9a43-2b1f0f6f9d10" monUser = "11111111-2222-4333-8444-555555555555" + + // A published status page with a draft beside it, a monitor component, + // a manual one in a group, and one open posted incident. + spAcme = "6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b" + spDraft = "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d" + spSite = "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5e" + spDesk = "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6f" + spGroup = "c3d4e5f6-a7b8-4c9d-8e1f-2a3b4c5d6e70" + spPost = "8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f" + spPostURL = "https://acme.norcubestatus.com/incidents/" + spPost ) var ( @@ -66,6 +76,20 @@ var ( "settings":{"phone":"+420601123456"},"createdAt":"2026-10-05T09:00:00Z","updatedAt":"2026-10-05T09:00:00Z"}` ) +var ( + spSettingsJSON = `"settings":{"timeZone":"Europe/Prague","uptimeDays":90,"showUptimeBars":true,"showUptimePercent":true,"showResponseTime":false,"historyDays":90,"searchIndexing":true}` + spAcmeJSON = `{"id":"` + spAcme + `","slug":"acme","name":"Acme status","description":"Our services","url":"https://acme.norcubestatus.com","published":true,"publishedAt":"2026-11-02T09:00:00Z",` + + spSettingsJSON + `,"createdAt":"2026-11-01T09:00:00Z","updatedAt":"2026-11-02T09:00:00Z"}` + spDraftJSON = `{"id":"` + spDraft + `","slug":"draft-page","name":"Draft","description":"","url":"https://draft-page.norcubestatus.com","published":false,` + + spSettingsJSON + `,"createdAt":"2026-10-30T09:00:00Z","updatedAt":"2026-10-30T09:00:00Z"}` + spLayoutJSON = `{"components":[{"id":"` + spSite + `","kind":"monitor","monitorId":"` + monShop + `","aspects":["availability","certificate"],"name":"Website"}], + "groups":[{"id":"` + spGroup + `","name":"Support","collapsed":false,"components":[{"id":"` + spDesk + `","kind":"manual","manualStatus":"operational","name":"Support desk"}]}]}` + spPostJSON = `{"id":"` + spPost + `","statusPageId":"` + spAcme + `","title":"Elevated API errors","status":"investigating","impact":"minor","startedAt":"2026-11-03T08:00:00Z", + "components":[{"componentId":"` + spSite + `","status":"partial_outage"}],"monitorIncidentIds":["` + monInc + `"], + "updates":[{"id":"d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f70","status":"investigating","body":"We are looking into it.","createdAt":"2026-11-03T08:05:00Z"}], + "createdAt":"2026-11-03T08:05:00Z","updatedAt":"2026-11-03T08:05:00Z"}` +) + func monList(items ...string) string { return `{"list":[` + strings.Join(items, ",") + `],"cursors":{},"meta":{}}` } @@ -102,6 +126,12 @@ func init() { "GET /alert-channels/" + monPhone: monPhoneJSON, "GET /alert-channels/" + monHook + "/deliveries": monList( `{"id":"bbbbbbbb-cccc-4ddd-8eee-ffffffffffff","event":"down","monitorId":"` + monShop + `","monitorName":"Shop","incidentId":"` + monInc + `","status":"sent","attempts":1,"createdAt":"2026-11-03T08:01:00Z","sentAt":"2026-11-03T08:01:02Z"}`), + "GET /status-pages": monList(spAcmeJSON, spDraftJSON), + "GET /status-pages/" + spAcme: spAcmeJSON, + "GET /status-pages/" + spDraft: spDraftJSON, + "GET /status-pages/" + spAcme + "/layout": spLayoutJSON, + "GET /status-pages/" + spAcme + "/incidents": monList(spPostJSON), + "GET /status-pages/" + spAcme + "/incidents/" + spPost: spPostJSON, } { goldenData[k] = v } @@ -128,6 +158,11 @@ func TestGoldenMonitor(t *testing.T) { {"monitor-channels-list", []string{"monitor", "channels", "list"}}, {"monitor-channels-get", []string{"monitor", "channels", "get", monHook}}, {"monitor-deliveries-list", []string{"monitor", "channels", "deliveries", "list", monHook}}, + {"monitor-status-pages-list", []string{"monitor", "status-pages", "list"}}, + {"monitor-status-pages-get", []string{"monitor", "status-pages", "get", "acme"}}, + {"monitor-status-pages-layout-get", []string{"monitor", "status-pages", "layout", "get", spAcme}}, + {"monitor-status-pages-incidents-list", []string{"monitor", "status-pages", "incidents", "list", spAcme}}, + {"monitor-status-pages-incidents-get", []string{"monitor", "status-pages", "incidents", "get", spAcme, spPost}}, } for _, c := range commands { for format, ext := range goldenFormats { @@ -635,6 +670,12 @@ func TestMonitorCompletion(t *testing.T) { {[]string{"monitor", "channels", "verify", "5e"}, monPhone}, {[]string{"monitor", "incidents", "ack", ""}, monInc}, {[]string{"monitor", "monitors", "list", "--status", ""}, "pending,ok,warning,critical,paused"}, + {[]string{"monitor", "status-pages", "get", ""}, "acme,draft-page"}, + {[]string{"monitor", "status-pages", "layout", "set", "dr"}, "draft-page"}, + {[]string{"monitor", "status-pages", "incidents", "get", "ac"}, "acme"}, + {[]string{"monitor", "status-pages", "incidents", "get", "acme", "8c"}, spPost}, + {[]string{"monitor", "status-pages", "incidents", "updates", "create", "acme", "8c"}, spPost}, + {[]string{"monitor", "status-pages", "create", "x", "--uptime-days", ""}, "30,60,90"}, } for _, c := range cases { got, _ := complete(t, c.args...) @@ -698,3 +739,350 @@ func TestMonitorRequests(t *testing.T) { t.Errorf("rotated secret file %q", got) } } + +// A page is created with every setting spelled out: nothing is filled in, +// and a missing one is a usage error before any request. +func TestMonitorStatusPageCreate(t *testing.T) { + goldenEnv(t) + var rec recorder + goldenHandlers(t, map[string]http.HandlerFunc{"POST /status-pages": rec.handler(201, spDraftJSON)}) + + settings := []string{"--slug", "draft-page", "--time-zone", "Europe/Prague", "--uptime-days", "60", "--history-days", "30", + "--show-uptime-bars", "--show-uptime-percent=false", "--show-response-time=false", "--search-indexing=false"} + + out, stderr, err := run(t, append([]string{"monitor", "status-pages", "create", "Draft", "--description", "Ours", "-o", "json"}, settings...)...) + if err != nil { + t.Fatalf("%v\n%s", err, stderr) + } + if !strings.Contains(out, `"id": "`+spDraft+`"`) { + t.Errorf("stdout: %s", out) + } + want := "map[description:Ours name:Draft settings:map[historyDays:30 searchIndexing:false showResponseTime:false showUptimeBars:true showUptimePercent:false timeZone:Europe/Prague uptimeDays:60] slug:draft-page]" + if got := fmt.Sprint(rec.only(t).body); got != want { + t.Errorf("body %s, want %s", got, want) + } + + rec = recorder{} + cases := []struct { + name string + args []string + want string + }{ + {"a missing setting", append([]string{"Draft"}, settings[:len(settings)-1]...), "search-indexing"}, + {"no name", settings, "accepts 1 arg"}, + {"bad range", append(append([]string{"Draft"}, settings...), "--uptime-days", "45"), "--uptime-days"}, + } + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + _, _, err := run(t, append([]string{"monitor", "status-pages", "create"}, c.args...)...) + if err == nil || exitOf(err) != clierr.ExitUsage || !strings.Contains(err.Error(), c.want) { + t.Errorf("err %v (exit %d), want usage error about %s", err, exitOf(err), c.want) + } + }) + } + badRange := append(append([]string{"monitor", "status-pages", "create", "Draft"}, settings...), "--history-days", "3") + if _, _, err := run(t, badRange...); err == nil || exitOf(err) != clierr.ExitUsage { + t.Errorf("--history-days 3: %v", err) + } + if rec.count() != 0 { + t.Errorf("%d requests were sent", rec.count()) + } +} + +// Pages are named by id or exact slug: a slug that matches nothing exits 3, +// without guessing from a partial match. +func TestMonitorStatusPageNames(t *testing.T) { + goldenEnv(t) + if _, _, err := run(t, "monitor", "status-pages", "get", "acm"); err == nil || exitOf(err) != clierr.ExitNotFound { + t.Errorf("partial slug: %v", err) + } + out, _, err := run(t, "monitor", "status-pages", "get", "draft-page", "-o", "json", "--query", "id") + if err != nil || !strings.Contains(out, spDraft) { + t.Errorf("%v %q", err, out) + } +} + +func TestMonitorStatusPageWrites(t *testing.T) { + goldenEnv(t) + cases := []struct { + name string + args []string + route string + status int + answer string + wantQuery string + wantBody string + wantOut string + }{ + {"update slug and setting", []string{"update", "acme", "--slug", "acme-inc", "--show-uptime-bars=false", "--history-days", "7"}, + "PATCH /status-pages/" + spAcme, 200, spAcmeJSON, "", "map[settings:map[historyDays:7 showUptimeBars:false] slug:acme-inc]", "Public within a minute at https://acme.norcubestatus.com."}, + {"update name only", []string{"update", spDraft, "--name", " New "}, + "PATCH /status-pages/" + spDraft, 200, spDraftJSON, "", "map[name:New]", "Updated status page draft-page"}, + {"publish", []string{"publish", "acme"}, "POST /status-pages/" + spAcme + "/publish", 200, spAcmeJSON, "", "", "public within a minute at https://acme.norcubestatus.com"}, + {"unpublish", []string{"unpublish", "acme", "--yes"}, "POST /status-pages/" + spAcme + "/unpublish", 200, spDraftJSON, "", "", "Unpublished status page"}, + {"preview link", []string{"preview-link", "acme"}, "POST /status-pages/" + spAcme + "/preview-link", 200, + `{"url":"https://preview.norcubestatus.com/__preview/token","expiresAt":"2026-11-03T08:15:00Z"}`, "", "", "https://preview.norcubestatus.com/__preview/token"}, + {"list by monitor", []string{"list", "--monitor", monShop}, "GET /status-pages", 200, monList(spAcmeJSON), "limit=50&monitorId=" + monShop, "", "acme"}, + {"incidents open", []string{"incidents", "list", "acme", "--status", "open"}, "GET /status-pages/" + spAcme + "/incidents", 200, monList(), "limit=50&status=open", "", ""}, + } + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + var rec recorder + goldenHandlers(t, map[string]http.HandlerFunc{c.route: rec.handler(c.status, c.answer)}) + out, stderr, err := run(t, append([]string{"monitor", "status-pages"}, c.args...)...) + if err != nil { + t.Fatalf("%v\n%s", err, stderr) + } + r := rec.only(t) + if r.query != c.wantQuery { + t.Errorf("query %q, want %q", r.query, c.wantQuery) + } + if c.wantBody != "" && fmt.Sprint(r.body) != c.wantBody { + t.Errorf("body %v, want %s", r.body, c.wantBody) + } + if !strings.Contains(out, c.wantOut) { + t.Errorf("stdout %q lacks %q", out, c.wantOut) + } + }) + } + if _, _, err := run(t, "monitor", "status-pages", "update", "acme"); err == nil || exitOf(err) != clierr.ExitUsage { + t.Errorf("nothing to change: %v", err) + } +} + +// Taking a page down asks first; without a terminal it fails and names +// --yes, before anything is changed. +func TestMonitorStatusPageConfirms(t *testing.T) { + goldenEnv(t) + var rec recorder + goldenHandlers(t, map[string]http.HandlerFunc{ + "DELETE /status-pages/" + spAcme: rec.handler(204, ""), + "POST /status-pages/" + spAcme + "/unpublish": rec.handler(200, spDraftJSON), + }) + for _, verb := range []string{"delete", "unpublish"} { + _, _, err := run(t, "monitor", "status-pages", verb, "acme") + if err == nil || exitOf(err) != clierr.ExitUsage || !strings.Contains(err.Error(), "--yes") { + t.Errorf("%s without --yes: %v", verb, err) + } + } + if rec.count() != 0 { + t.Fatalf("%d requests without --yes", rec.count()) + } + out, stderr, err := run(t, "monitor", "status-pages", "delete", "acme", "--yes", "-o", "json") + if err != nil { + t.Fatalf("%v\n%s", err, stderr) + } + if !strings.Contains(out, `"deleted": true`) || !strings.Contains(out, spAcme) { + t.Errorf("stdout: %s", out) + } +} + +// layout set sends the document as it is and prints the saved layout on +// stdout, with the note about publishing on stderr. +func TestMonitorStatusPageLayoutSet(t *testing.T) { + goldenEnv(t) + var rec recorder + goldenHandlers(t, map[string]http.HandlerFunc{"PUT /status-pages/" + spAcme + "/layout": rec.handler(200, spLayoutJSON)}) + + doc := `{"components":[{"kind":"manual","manualStatus":"operational","name":"Support desk"}],"groups":[]}` + path := filepath.Join(t.TempDir(), "layout.json") + if err := os.WriteFile(path, []byte(doc), 0o600); err != nil { + t.Fatal(err) + } + out, stderr, err := run(t, "monitor", "status-pages", "layout", "set", "acme", "--file", path, "-o", "json") + if err != nil { + t.Fatalf("%v\n%s", err, stderr) + } + r := rec.only(t) + if got := fmt.Sprint(r.body); got != "map[components:[map[kind:manual manualStatus:operational name:Support desk]] groups:[]]" { + t.Errorf("body %s", got) + } + if !strings.Contains(out, spSite) || strings.Contains(out, "public within") { + t.Errorf("stdout carries the saved layout only: %s", out) + } + if !strings.Contains(stderr, "public within a minute") { + t.Errorf("stderr %q", stderr) + } + + // Standard input, and what `layout get -o json` prints goes back as is. + rec = recorder{} + goldenHandlers(t, map[string]http.HandlerFunc{"PUT /status-pages/" + spAcme + "/layout": rec.handler(200, spLayoutJSON)}) + got, _, err := run(t, "monitor", "status-pages", "layout", "get", "acme", "-o", "json") + if err != nil { + t.Fatal(err) + } + if _, stderr, err := runIn(t, got, "monitor", "status-pages", "layout", "set", "acme", "--file", "-"); err != nil { + t.Fatalf("%v\n%s", err, stderr) + } + if s := fmt.Sprint(rec.only(t).body); !strings.Contains(s, spSite) || !strings.Contains(s, spGroup) { + t.Errorf("round trip lost ids: %s", s) + } + + // Mistakes never reach the API. + rec = recorder{} + for name, bad := range map[string]string{ + "not json": `{`, + "unknown member": `{"components":[],"groups":[],"extra":1}`, + "no groups": `{"components":[]}`, + "group without": `{"components":[],"groups":[{"name":"API"}]}`, + } { + if _, _, err := runIn(t, bad, "monitor", "status-pages", "layout", "set", "acme", "--file", "-"); err == nil || exitOf(err) != clierr.ExitUsage { + t.Errorf("%s: %v", name, err) + } + } + if _, _, err := run(t, "monitor", "status-pages", "layout", "set", "acme"); err == nil || exitOf(err) != clierr.ExitUsage { + t.Errorf("no --file: %v", err) + } + if rec.count() != 0 { + t.Errorf("%d requests were sent", rec.count()) + } +} + +func TestMonitorStatusPageIncidentCreate(t *testing.T) { + goldenEnv(t) + var rec recorder + goldenHandlers(t, map[string]http.HandlerFunc{"POST /status-pages/" + spAcme + "/incidents": rec.handler(201, spPostJSON)}) + + // A component by public name is looked up in the layout; stdout says + // where the public reads it. + out, stderr, err := runIn(t, "We are looking into it.\n", "monitor", "status-pages", "incidents", "create", "acme", + "--title", "Elevated API errors", "--status", "investigating", "--impact", "minor", "--message-file", "-", + "--component", "website=partial_outage", "--component", spDesk+"=operational", "--monitor-incident", monInc, + "--started-at", "2026-11-03T08:00:00Z") + if err != nil { + t.Fatalf("%v\n%s", err, stderr) + } + if !strings.Contains(out, spPostURL) || !strings.Contains(out, "Public within a minute") { + t.Errorf("stdout: %s", out) + } + b := rec.only(t).body + if b["title"] != "Elevated API errors" || b["status"] != "investigating" || b["impact"] != "minor" || + b["body"] != "We are looking into it." || b["startedAt"] != "2026-11-03T08:00:00Z" { + t.Errorf("body %v", b) + } + want := "[map[componentId:" + spSite + " status:partial_outage] map[componentId:" + spDesk + " status:operational]]" + if got := fmt.Sprint(b["components"]); got != want { + t.Errorf("components %s, want %s", got, want) + } + if got := fmt.Sprint(b["monitorIncidentIds"]); got != "["+monInc+"]" { + t.Errorf("links %s", got) + } + + // On a draft the post says nobody sees it yet. + goldenHandlers(t, map[string]http.HandlerFunc{"POST /status-pages/" + spDraft + "/incidents": (&recorder{}).handler(201, spPostJSON)}) + out, _, err = run(t, "monitor", "status-pages", "incidents", "create", spDraft, "--title", "T", "--status", "resolved", "--impact", "none", "--message", "m") + if err != nil || !strings.Contains(out, "isn't published") || strings.Contains(out, "/incidents/") { + t.Errorf("%v %q", err, out) + } + + // Mistakes never reach the API. + rec = recorder{} + base := []string{"monitor", "status-pages", "incidents", "create", "acme"} + ok := []string{"--title", "T", "--status", "monitoring", "--impact", "minor", "--message", "m"} + for name, args := range map[string][]string{ + "no message": {"--title", "T", "--status", "monitoring", "--impact", "minor"}, + "no title": {"--status", "monitoring", "--impact", "minor", "--message", "m"}, + "bad status": {"--title", "T", "--status", "fixed", "--impact", "minor", "--message", "m"}, + "bad impact": {"--title", "T", "--status", "monitoring", "--impact", "huge", "--message", "m"}, + "blank message": {"--title", "T", "--status", "monitoring", "--impact", "minor", "--message", " "}, + "two messages": append(append([]string{}, ok...), "--message-file", "-"), + "component syntax": append(append([]string{}, ok...), "--component", "Website"), + "component status": append(append([]string{}, ok...), "--component", "Website=unknown"), + "bad link": append(append([]string{}, ok...), "--monitor-incident", "nope"), + "bad time": append(append([]string{}, ok...), "--started-at", "soon"), + } { + if _, _, err := run(t, append(append([]string{}, base...), args...)...); err == nil || exitOf(err) != clierr.ExitUsage { + t.Errorf("%s: %v", name, err) + } + } + if rec.count() != 0 { + t.Errorf("%d requests were sent", rec.count()) + } + + // A component name that isn't on the page exits 3. + if _, _, err := run(t, append(append(append([]string{}, base...), ok...), "--component", "Nothing=major_outage")...); err == nil || exitOf(err) != clierr.ExitNotFound { + t.Errorf("unknown component: %v", err) + } +} + +func TestMonitorStatusPageIncidentUpdates(t *testing.T) { + goldenEnv(t) + route := "/status-pages/" + spAcme + "/incidents/" + spPost + cases := []struct { + name string + args []string + route string + status int + wantBody string + }{ + {"correct", []string{"update", "acme", spPost, "--title", "New", "--impact", "major", "--started-at", "2026-11-03T07:00:00Z"}, + "PATCH " + route, 200, "map[impact:major startedAt:2026-11-03T07:00:00Z title:New]"}, + {"replace components", []string{"update", "acme", spPost, "--component", spSite + "=major_outage"}, + "PATCH " + route, 200, "map[components:[map[componentId:" + spSite + " status:major_outage]]]"}, + {"clear components and links", []string{"update", "acme", spPost, "--no-components", "--no-monitor-incidents"}, + "PATCH " + route, 200, "map[components:[] monitorIncidentIds:[]]"}, + {"post an update", []string{"updates", "create", "acme", spPost, "--status", "monitoring", "--message", "A fix is rolling out."}, + "POST " + route + "/updates", 201, "map[body:A fix is rolling out. status:monitoring]"}, + {"resolve, clearing components", []string{"updates", "create", "acme", spPost, "--status", "resolved", "--message", "All clear.", "--no-components"}, + "POST " + route + "/updates", 201, "map[body:All clear. components:[] status:resolved]"}, + } + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + var rec recorder + goldenHandlers(t, map[string]http.HandlerFunc{c.route: rec.handler(c.status, spPostJSON)}) + out, stderr, err := run(t, append([]string{"monitor", "status-pages", "incidents"}, c.args...)...) + if err != nil { + t.Fatalf("%v\n%s", err, stderr) + } + if got := fmt.Sprint(rec.only(t).body); got != c.wantBody { + t.Errorf("body %s, want %s", got, c.wantBody) + } + if !strings.Contains(out, spPostURL) { + t.Errorf("stdout %q lacks the public address", out) + } + }) + } + + if _, _, err := run(t, "monitor", "status-pages", "incidents", "update", "acme", spPost); err == nil || exitOf(err) != clierr.ExitUsage { + t.Errorf("nothing to change: %v", err) + } + if _, _, err := run(t, "monitor", "status-pages", "incidents", "get", "acme", "nope"); err == nil || exitOf(err) != clierr.ExitUsage { + t.Errorf("an incident is named by id: %v", err) + } + + // A resolved post takes no more updates: the API's 409 exits 8. + goldenHandlers(t, map[string]http.HandlerFunc{"POST " + route + "/updates": (&recorder{}).handler(409, + `{"title":"Conflict","status":409,"detail":"This incident is resolved. Post a new one instead.","code":"CONFLICT","reason":"INCIDENT_RESOLVED"}`)}) + _, _, err := run(t, "monitor", "status-pages", "incidents", "updates", "create", "acme", spPost, "--status", "monitoring", "--message", "m") + if e := Describe(err); e.Code != clierr.CodeConflict || e.ExitCode() != clierr.ExitConflict || !strings.Contains(e.Message, "resolved") { + t.Errorf("resolved: %+v", e) + } +} + +// A token without monitor.statuspages exits 5 and is told which scope it +// lacks: monitor.write doesn't include it. +func TestMonitorStatusPageScope(t *testing.T) { + goldenEnv(t) + goldenHandlers(t, map[string]http.HandlerFunc{"POST /status-pages/" + spAcme + "/publish": (&recorder{}).handler(403, + `{"title":"Forbidden","status":403,"detail":"This token can't change status pages or post on them: it needs the monitor.statuspages scope.","code":"FORBIDDEN","reason":"INSUFFICIENT_SCOPE"}`)}) + _, _, err := run(t, "monitor", "status-pages", "publish", "acme") + if e := Describe(err); e.Code != clierr.CodeInsufficientScope || e.ExitCode() != clierr.ExitAccess || !strings.Contains(e.Message, "monitor.statuspages") { + t.Errorf("scope: %+v", e) + } +} + +// The help of every write that publishes says so. +func TestMonitorStatusPageHelpSaysWhatGoesPublic(t *testing.T) { + goldenEnv(t) + for _, path := range [][]string{ + {"publish"}, {"update"}, {"layout", "set"}, {"incidents", "create"}, {"incidents", "update"}, {"incidents", "updates", "create"}, + } { + out, _, err := run(t, append(append([]string{"monitor", "status-pages"}, path...), "--help")...) + if err != nil { + t.Fatal(err) + } + if !strings.Contains(strings.ReplaceAll(out, "\n", " "), "public within a minute") { + t.Errorf("%v help doesn't say it goes public: %s", path, out) + } + } +} diff --git a/internal/cli/testdata/golden/commands-monitor.json b/internal/cli/testdata/golden/commands-monitor.json index f08b794..fc00aa2 100644 --- a/internal/cli/testdata/golden/commands-monitor.json +++ b/internal/cli/testdata/golden/commands-monitor.json @@ -129,7 +129,7 @@ ], "name": "monitor", "short": "Monitor uptime, SSL certificates and domain expiry, and manage incidents and alerts", - "long": "Norcube Monitor checks your sites, certificates and domains on a schedule\nfrom Norcube's servers. A monitor is an HTTP check (optionally with a\nkeyword), an SSL certificate check or a domain expiry check. Problems\nconfirmed by consecutive checks open incidents, which alert through your\nalert channels (email, webhook, Slack, Discord, SMS).\n\nMonitors and channels are named by their id or, where a command says so,\nby their exact name. Checks count towards your Norcube Monitor usage, on a\nschedule and when you run one now.\n\nIn CI, \"monitor status --fail-on critical\" fails the job while a\ncritical incident is open, and \"monitor monitors run \u003cmonitor\u003e --wait\"\nfails it when the check finds the monitor down. CI tokens need a\nNorcube Monitor scope: monitor.read (everything that reads),\nmonitor.check (run checks), monitor.write (manage monitors and\nincidents) or monitor.channels (manage alert channels, which\nmonitor.write doesn't include).", + "long": "Norcube Monitor checks your sites, certificates and domains on a schedule\nfrom Norcube's servers. A monitor is an HTTP check (optionally with a\nkeyword), an SSL certificate check or a domain expiry check. Problems\nconfirmed by consecutive checks open incidents, which alert through your\nalert channels (email, webhook, Slack, Discord, SMS). Status pages show\nchosen monitors to the public.\n\nMonitors and channels are named by their id or, where a command says so,\nby their exact name. Checks count towards your Norcube Monitor usage, on a\nschedule and when you run one now.\n\nIn CI, \"monitor status --fail-on critical\" fails the job while a\ncritical incident is open, and \"monitor monitors run \u003cmonitor\u003e --wait\"\nfails it when the check finds the monitor down. CI tokens need a\nNorcube Monitor scope: monitor.read (everything that reads),\nmonitor.check (run checks), monitor.write (manage monitors and\nincidents), monitor.channels (manage alert channels) or\nmonitor.statuspages (manage status pages and post on them). monitor.write\nincludes neither of the last two.", "usage": "norcube monitor \u003ccommand\u003e", "group": true, "service": { @@ -2694,6 +2694,1020 @@ ] } ] + }, + { + "command": "norcube monitor status-pages", + "path": [ + "monitor", + "status-pages" + ], + "name": "status-pages", + "aliases": [ + "status-page" + ], + "short": "Manage public status pages, their layout and the incidents posted on them", + "long": "A status page is a public page that shows chosen monitors and manual rows\nas components, under names you pick; a monitor's own name and target are\nnever shown. A page starts unpublished: set its layout, check it with a\npreview link, then publish it. Changes to a published page, and incidents\nposted on it, are public within a minute.\n\nPages are named by their id or exact slug. Any Norcube Monitor scope reads\nthem; a CI token changes them or posts on them only with the\nmonitor.statuspages scope, which no other scope includes, because\neverything it changes is public.", + "usage": "norcube monitor status-pages \u003ccommand\u003e", + "group": true, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "confirm": false, + "wait": false, + "paginated": false, + "flags": [] + }, + { + "command": "norcube monitor status-pages create", + "path": [ + "monitor", + "status-pages", + "create" + ], + "name": "create", + "short": "Create a status page, unpublished", + "long": "Creates a page that nobody can see yet: set what it shows with \"layout\nset\", check it with \"preview-link\", then \"publish\" it. Every setting is\nrequired: the page's public face is your choice, so nothing is filled in\nfor you. A boolean takes =false to turn it off.\n\nYour plan limits how many pages an organization has, published or not.", + "usage": "norcube monitor status-pages create \u003cname\u003e [flags]", + "args": "\u003cname\u003e", + "example": "norcube monitor status-pages create \"Acme status\" --slug acme --time-zone Europe/Prague --uptime-days 90 --history-days 90 --show-uptime-bars --show-uptime-percent --show-response-time=false --search-indexing", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "write", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [ + { + "name": "description", + "type": "string", + "description": "Public text shown under the page's name", + "required": false, + "repeatable": false + }, + { + "name": "history-days", + "type": "int", + "default": "0", + "description": "Days resolved incidents stay on the page, 7 to 365", + "required": true, + "repeatable": false + }, + { + "name": "search-indexing", + "type": "bool", + "default": "false", + "description": "Let search engines index the page (--search-indexing=false asks them to leave it out)", + "required": true, + "repeatable": false + }, + { + "name": "show-response-time", + "type": "bool", + "default": "false", + "description": "Show each component's average response time (--show-response-time=false hides it)", + "required": true, + "repeatable": false + }, + { + "name": "show-uptime-bars", + "type": "bool", + "default": "false", + "description": "Show daily uptime bars (--show-uptime-bars=false hides them)", + "required": true, + "repeatable": false + }, + { + "name": "show-uptime-percent", + "type": "bool", + "default": "false", + "description": "Show each component's uptime percentage (--show-uptime-percent=false hides it)", + "required": true, + "repeatable": false + }, + { + "name": "slug", + "type": "string", + "description": "The page's public address: 3 to 40 lowercase letters, digits or hyphens", + "required": true, + "repeatable": false + }, + { + "name": "time-zone", + "type": "string", + "description": "IANA time zone the page shows times in, e.g. Europe/Prague", + "required": true, + "repeatable": false + }, + { + "name": "uptime-days", + "type": "int", + "default": "0", + "description": "Days the uptime bars cover: 30, 60 or 90", + "required": true, + "repeatable": false, + "enum": [ + "30", + "60", + "90" + ] + } + ] + }, + { + "command": "norcube monitor status-pages delete", + "path": [ + "monitor", + "status-pages", + "delete" + ], + "name": "delete", + "short": "Delete a status page with its layout and posted incidents", + "long": "Deletes the page and everything on it, takes it offline and gives up its\nold addresses. The monitors it shows are not touched.", + "usage": "norcube monitor status-pages delete \u003cpage\u003e [flags]", + "args": "\u003cpage\u003e", + "example": "norcube monitor status-pages delete acme\nnorcube monitor status-pages delete 6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b --yes", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "write", + "confirm": true, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [ + { + "name": "yes", + "type": "bool", + "default": "false", + "description": "Don't ask for confirmation", + "required": false, + "repeatable": false + } + ] + }, + { + "command": "norcube monitor status-pages get", + "path": [ + "monitor", + "status-pages", + "get" + ], + "name": "get", + "short": "Show a status page and its settings", + "usage": "norcube monitor status-pages get \u003cpage\u003e", + "args": "\u003cpage\u003e", + "example": "norcube monitor status-pages get acme\nnorcube monitor status-pages get acme -o json --query url", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "read", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [] + }, + { + "command": "norcube monitor status-pages incidents", + "path": [ + "monitor", + "status-pages", + "incidents" + ], + "name": "incidents", + "aliases": [ + "incident" + ], + "short": "Post incidents on a status page and keep them updated", + "long": "A posted incident is what you tell the public: a title, an impact and a\nseries of updates. It is separate from a monitor's own incidents, which stay\ninternal; a post may link to them for your navigation, but those links are\nnever published.\n\nWhile a post is open, the status it gives an affected component wins over\nwhat the component's monitor says. A post with status resolved moves to the\npage's history. On a published page everything here is public within a\nminute.", + "usage": "norcube monitor status-pages incidents \u003ccommand\u003e", + "group": true, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "confirm": false, + "wait": false, + "paginated": false, + "flags": [] + }, + { + "command": "norcube monitor status-pages incidents create", + "path": [ + "monitor", + "status-pages", + "incidents", + "create" + ], + "name": "create", + "short": "Post an incident on a status page; public within a minute on a published page", + "long": "Posts an incident with its first update. On a published page it is public\nwithin a minute: write it for your customers. It counts toward the page's\noverall status while it is open, and --component sets what the page shows\nfor the components it affects.\n\n--monitor-incident links the monitor incidents the post is about, for your\nown navigation; the links are never published.", + "usage": "norcube monitor status-pages incidents create \u003cpage\u003e [flags]", + "args": "\u003cpage\u003e", + "example": "norcube monitor status-pages incidents create acme --title \"Elevated API errors\" --status investigating --impact minor --message \"We are looking into it.\"\nnorcube monitor status-pages incidents create acme --title \"Checkout is down\" --status identified --impact major --message-file update.txt --component \"Checkout=major_outage\" --started-at 20m", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "write", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [ + { + "name": "component", + "type": "stringArray", + "description": "An affected component and the status the page shows it in while the incident is open, as \"\u003cid or name\u003e=\u003cstatus\u003e\" (repeatable): operational, degraded_performance, partial_outage or major_outage", + "required": false, + "repeatable": true + }, + { + "name": "impact", + "type": "string", + "description": "How bad it is: none, minor, major or critical", + "required": true, + "repeatable": false, + "enum": [ + "none", + "minor", + "major", + "critical" + ] + }, + { + "name": "message", + "type": "string", + "description": "The first update's text; public", + "required": false, + "repeatable": false + }, + { + "name": "message-file", + "type": "string", + "description": "Read the message from this file (- for standard input)", + "required": false, + "repeatable": false + }, + { + "name": "monitor-incident", + "type": "stringSlice", + "description": "Id of a monitor incident this post is about (repeat or comma-separate); never published", + "required": false, + "repeatable": true + }, + { + "name": "started-at", + "type": "string", + "description": "When it began, if not now: an RFC 3339 timestamp, a date or an age (20m, 2h)", + "required": false, + "repeatable": false + }, + { + "name": "status", + "type": "string", + "description": "Where it stands: investigating, identified, monitoring or resolved", + "required": true, + "repeatable": false, + "enum": [ + "investigating", + "identified", + "monitoring", + "resolved" + ] + }, + { + "name": "title", + "type": "string", + "description": "The incident's public title", + "required": true, + "repeatable": false + } + ] + }, + { + "command": "norcube monitor status-pages incidents get", + "path": [ + "monitor", + "status-pages", + "incidents", + "get" + ], + "name": "get", + "short": "Show a posted incident with its updates and public address", + "usage": "norcube monitor status-pages incidents get \u003cpage\u003e \u003cincident\u003e", + "args": "\u003cpage\u003e \u003cincident\u003e", + "example": "norcube monitor status-pages incidents get acme 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "read", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [] + }, + { + "command": "norcube monitor status-pages incidents list", + "path": [ + "monitor", + "status-pages", + "incidents", + "list" + ], + "name": "list", + "short": "List the incidents posted on a status page, newest first", + "usage": "norcube monitor status-pages incidents list \u003cpage\u003e [flags]", + "args": "\u003cpage\u003e", + "example": "norcube monitor status-pages incidents list acme\nnorcube monitor status-pages incidents list acme --status open", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "read", + "confirm": false, + "wait": false, + "paginated": true, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [ + { + "name": "all-pages", + "type": "bool", + "default": "false", + "description": "Follow cursors until every page is fetched (capped by --max-items)", + "required": false, + "repeatable": false + }, + { + "name": "cursor", + "type": "string", + "description": "Continue from the cursor a previous page printed", + "required": false, + "repeatable": false + }, + { + "name": "limit", + "type": "int", + "default": "0", + "description": "Same as --page-size", + "required": false, + "repeatable": false + }, + { + "name": "max-items", + "type": "int", + "default": "0", + "description": "Cap for --all-pages (0 = 10000)", + "required": false, + "repeatable": false + }, + { + "name": "page-size", + "type": "int", + "default": "0", + "description": "Items per request (0 = 50)", + "required": false, + "repeatable": false + }, + { + "name": "status", + "type": "string", + "description": "Only open or resolved incidents", + "required": false, + "repeatable": false, + "enum": [ + "open", + "resolved" + ] + } + ] + }, + { + "command": "norcube monitor status-pages incidents update", + "path": [ + "monitor", + "status-pages", + "incidents", + "update" + ], + "name": "update", + "short": "Correct a posted incident; public within a minute on a published page", + "long": "Corrects a post's title, impact, start or references, and changes only what\nyou pass. It adds no update and doesn't move the status: for that, use\n\"incidents updates create\". --component replaces the affected components as\na whole. Resolved posts can be corrected too. On a published page a\ncorrection is public within a minute.", + "usage": "norcube monitor status-pages incidents update \u003cpage\u003e \u003cincident\u003e [flags]", + "args": "\u003cpage\u003e \u003cincident\u003e", + "example": "norcube monitor status-pages incidents update acme 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f --title \"Elevated API errors in Europe\"\nnorcube monitor status-pages incidents update acme 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f --impact major --component \"API=partial_outage\"", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "write", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [ + { + "name": "component", + "type": "stringArray", + "description": "An affected component and the status the page shows it in while the incident is open, as \"\u003cid or name\u003e=\u003cstatus\u003e\" (repeatable): operational, degraded_performance, partial_outage or major_outage", + "required": false, + "repeatable": true + }, + { + "name": "impact", + "type": "string", + "description": "New impact: none, minor, major or critical", + "required": false, + "repeatable": false, + "enum": [ + "none", + "minor", + "major", + "critical" + ] + }, + { + "name": "monitor-incident", + "type": "stringSlice", + "description": "Replace the linked monitor incidents with these ids (repeat or comma-separate); never published", + "required": false, + "repeatable": true + }, + { + "name": "no-components", + "type": "bool", + "default": "false", + "description": "Remove every affected component", + "required": false, + "repeatable": false + }, + { + "name": "no-monitor-incidents", + "type": "bool", + "default": "false", + "description": "Remove every link to a monitor incident", + "required": false, + "repeatable": false + }, + { + "name": "started-at", + "type": "string", + "description": "When it began: an RFC 3339 timestamp, a date or an age (20m, 2h)", + "required": false, + "repeatable": false + }, + { + "name": "title", + "type": "string", + "description": "New public title", + "required": false, + "repeatable": false + } + ] + }, + { + "command": "norcube monitor status-pages incidents updates", + "path": [ + "monitor", + "status-pages", + "incidents", + "updates" + ], + "name": "updates", + "short": "Add updates to a posted incident", + "long": "Updates are the timeline of a posted incident: \"incidents get\" shows them,\nand they can't be edited or removed.", + "usage": "norcube monitor status-pages incidents updates \u003ccommand\u003e", + "group": true, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "confirm": false, + "wait": false, + "paginated": false, + "flags": [] + }, + { + "command": "norcube monitor status-pages incidents updates create", + "path": [ + "monitor", + "status-pages", + "incidents", + "updates", + "create" + ], + "name": "create", + "short": "Post an update on an incident; public within a minute on a published page", + "long": "Adds an update to an open post. Its status becomes the post's; resolved ends\nthe post and moves it to the page's history, after which it takes no more\nupdates (post a new incident instead). On a published page the update is\npublic within a minute. --component replaces the affected components.", + "usage": "norcube monitor status-pages incidents updates create \u003cpage\u003e \u003cincident\u003e [flags]", + "args": "\u003cpage\u003e \u003cincident\u003e", + "example": "norcube monitor status-pages incidents updates create acme 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f --status monitoring --message \"A fix is rolling out.\"\nnorcube monitor status-pages incidents updates create acme 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f --status resolved --message \"All clear.\"", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "write", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [ + { + "name": "component", + "type": "stringArray", + "description": "An affected component and the status the page shows it in while the incident is open, as \"\u003cid or name\u003e=\u003cstatus\u003e\" (repeatable): operational, degraded_performance, partial_outage or major_outage", + "required": false, + "repeatable": true + }, + { + "name": "message", + "type": "string", + "description": "The update's text; public", + "required": false, + "repeatable": false + }, + { + "name": "message-file", + "type": "string", + "description": "Read the message from this file (- for standard input)", + "required": false, + "repeatable": false + }, + { + "name": "no-components", + "type": "bool", + "default": "false", + "description": "Remove every affected component", + "required": false, + "repeatable": false + }, + { + "name": "status", + "type": "string", + "description": "Where it stands now: investigating, identified, monitoring or resolved", + "required": true, + "repeatable": false, + "enum": [ + "investigating", + "identified", + "monitoring", + "resolved" + ] + } + ] + }, + { + "command": "norcube monitor status-pages layout", + "path": [ + "monitor", + "status-pages", + "layout" + ], + "name": "layout", + "short": "Show or replace what a status page shows", + "long": "A layout lists a page's components: first those outside any group, then the\ngroups, each in the order given. A component follows a monitor (kind\nmonitor, with the aspects that count: availability, certificate, domain)\nor has a status you set (kind manual, with manualStatus operational,\ndegraded_performance, partial_outage or major_outage). The name is what\nthe public sees; the monitor's name and target never are.", + "usage": "norcube monitor status-pages layout \u003ccommand\u003e", + "group": true, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "confirm": false, + "wait": false, + "paginated": false, + "flags": [] + }, + { + "command": "norcube monitor status-pages layout get", + "path": [ + "monitor", + "status-pages", + "layout", + "get" + ], + "name": "get", + "short": "Show a status page's layout", + "long": "-o json prints the document \"layout set\" takes, so you can edit and send it back.", + "usage": "norcube monitor status-pages layout get \u003cpage\u003e", + "args": "\u003cpage\u003e", + "example": "norcube monitor status-pages layout get acme\nnorcube monitor status-pages layout get acme -o json \u003e layout.json", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "read", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [] + }, + { + "command": "norcube monitor status-pages layout set", + "path": [ + "monitor", + "status-pages", + "layout", + "set" + ], + "name": "set", + "short": "Replace a status page's layout from a JSON file; public within a minute on a published page", + "long": "Replaces the layout as a whole and prints the saved one. On a published page\nthe result is public within a minute, and adding a monitor publishes its\nstatus, so you must be able to read every monitor you name.\n\nThe file has \"components\" and \"groups\" (use [] for none), in the shape\n\"layout get -o json\" prints. Keep a row's id to keep the row, leave it out\nfor a new one. A row left out of the file is removed, and with it its place\non any posted incident.", + "usage": "norcube monitor status-pages layout set \u003cpage\u003e [flags]", + "args": "\u003cpage\u003e", + "example": "norcube monitor status-pages layout set acme --file layout.json\nnorcube monitor status-pages layout get acme -o json | jq '.groups[0].collapsed = true' | norcube monitor status-pages layout set acme --file -", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "write", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [ + { + "name": "file", + "type": "string", + "description": "Read the layout as JSON from this file (- for standard input)", + "required": true, + "repeatable": false + } + ] + }, + { + "command": "norcube monitor status-pages list", + "path": [ + "monitor", + "status-pages", + "list" + ], + "name": "list", + "short": "List status pages, newest first", + "long": "Lists the organization's status pages, published or not. --monitor lists\nthe pages that show one monitor instead (at most 50, on one page).", + "usage": "norcube monitor status-pages list [flags]", + "example": "norcube monitor status-pages list\nnorcube monitor status-pages list --monitor \"Shop\"\nnorcube monitor status-pages list -o json --query \"[?published].url\"", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "read", + "confirm": false, + "wait": false, + "paginated": true, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [ + { + "name": "all-pages", + "type": "bool", + "default": "false", + "description": "Follow cursors until every page is fetched (capped by --max-items)", + "required": false, + "repeatable": false + }, + { + "name": "cursor", + "type": "string", + "description": "Continue from the cursor a previous page printed", + "required": false, + "repeatable": false + }, + { + "name": "limit", + "type": "int", + "default": "0", + "description": "Same as --page-size", + "required": false, + "repeatable": false + }, + { + "name": "max-items", + "type": "int", + "default": "0", + "description": "Cap for --all-pages (0 = 10000)", + "required": false, + "repeatable": false + }, + { + "name": "monitor", + "type": "string", + "description": "Only pages that show this monitor (id or exact name)", + "required": false, + "repeatable": false + }, + { + "name": "page-size", + "type": "int", + "default": "0", + "description": "Items per request (0 = 50)", + "required": false, + "repeatable": false + } + ] + }, + { + "command": "norcube monitor status-pages preview-link", + "path": [ + "monitor", + "status-pages", + "preview-link" + ], + "name": "preview-link", + "short": "Print a link to the rendered page that works for 15 minutes", + "long": "Prints a signed link to the page as the public would see it, published or\nnot. Anyone with the link can open it until it expires, 15 minutes later,\nso treat it like a draft you are sharing. It changes nothing, but a CI\ntoken needs the monitor.statuspages scope to get one.", + "usage": "norcube monitor status-pages preview-link \u003cpage\u003e", + "args": "\u003cpage\u003e", + "example": "norcube monitor status-pages preview-link acme\nnorcube monitor status-pages preview-link acme -o text | cut -f1", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "read", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [] + }, + { + "command": "norcube monitor status-pages publish", + "path": [ + "monitor", + "status-pages", + "publish" + ], + "name": "publish", + "short": "Make a status page public within a minute", + "long": "Publishes the page at its address: it is public within a minute, along\nwith its page.json and its Atom feed. It needs at least one component.\nPublishing a published page changes nothing.", + "usage": "norcube monitor status-pages publish \u003cpage\u003e", + "args": "\u003cpage\u003e", + "example": "norcube monitor status-pages publish acme", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "write", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [] + }, + { + "command": "norcube monitor status-pages unpublish", + "path": [ + "monitor", + "status-pages", + "unpublish" + ], + "name": "unpublish", + "short": "Take a status page offline, keeping everything on it", + "long": "The page's address stops answering and its old addresses are given up, so\nanother organization can take them. Its layout and posted incidents stay,\nand preview links keep working. Unpublishing an unpublished page changes\nnothing.", + "usage": "norcube monitor status-pages unpublish \u003cpage\u003e [flags]", + "args": "\u003cpage\u003e", + "example": "norcube monitor status-pages unpublish acme\nnorcube monitor status-pages unpublish acme --yes", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "write", + "confirm": true, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [ + { + "name": "yes", + "type": "bool", + "default": "false", + "description": "Don't ask for confirmation", + "required": false, + "repeatable": false + } + ] + }, + { + "command": "norcube monitor status-pages update", + "path": [ + "monitor", + "status-pages", + "update" + ], + "name": "update", + "short": "Change a status page's address, texts or settings", + "long": "Changes only what you pass. On a published page the change is public within\na minute.\n\n--slug moves the page to a new address. The old address of a published\npage redirects to the new one for 30 days, and no other organization can\ntake it meanwhile; unpublishing or deleting the page gives it up.", + "usage": "norcube monitor status-pages update \u003cpage\u003e [flags]", + "args": "\u003cpage\u003e", + "example": "norcube monitor status-pages update acme --name \"Acme Inc. status\"\nnorcube monitor status-pages update acme --slug acme-inc\nnorcube monitor status-pages update acme --uptime-days 30 --show-response-time", + "group": false, + "service": { + "key": "monitor", + "name": "Norcube Monitor", + "audience": "monitor" + }, + "effect": "write", + "confirm": false, + "wait": false, + "paginated": false, + "outputFormats": [ + "table", + "json", + "yaml", + "text" + ], + "flags": [ + { + "name": "description", + "type": "string", + "description": "Public text shown under the page's name", + "required": false, + "repeatable": false + }, + { + "name": "history-days", + "type": "int", + "default": "0", + "description": "Days resolved incidents stay on the page, 7 to 365", + "required": false, + "repeatable": false + }, + { + "name": "name", + "type": "string", + "description": "New public name", + "required": false, + "repeatable": false + }, + { + "name": "search-indexing", + "type": "bool", + "default": "false", + "description": "Let search engines index the page (--search-indexing=false asks them to leave it out)", + "required": false, + "repeatable": false + }, + { + "name": "show-response-time", + "type": "bool", + "default": "false", + "description": "Show each component's average response time (--show-response-time=false hides it)", + "required": false, + "repeatable": false + }, + { + "name": "show-uptime-bars", + "type": "bool", + "default": "false", + "description": "Show daily uptime bars (--show-uptime-bars=false hides them)", + "required": false, + "repeatable": false + }, + { + "name": "show-uptime-percent", + "type": "bool", + "default": "false", + "description": "Show each component's uptime percentage (--show-uptime-percent=false hides it)", + "required": false, + "repeatable": false + }, + { + "name": "slug", + "type": "string", + "description": "The page's public address: 3 to 40 lowercase letters, digits or hyphens", + "required": false, + "repeatable": false + }, + { + "name": "time-zone", + "type": "string", + "description": "IANA time zone the page shows times in, e.g. Europe/Prague", + "required": false, + "repeatable": false + }, + { + "name": "uptime-days", + "type": "int", + "default": "0", + "description": "Days the uptime bars cover: 30, 60 or 90", + "required": false, + "repeatable": false, + "enum": [ + "30", + "60", + "90" + ] + } + ] } ] } diff --git a/internal/cli/testdata/golden/monitor-status-pages-get.json b/internal/cli/testdata/golden/monitor-status-pages-get.json new file mode 100644 index 0000000..2955050 --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-get.json @@ -0,0 +1,20 @@ +{ + "createdAt": "2026-11-01T09:00:00Z", + "description": "Our services", + "id": "6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b", + "name": "Acme status", + "published": true, + "publishedAt": "2026-11-02T09:00:00Z", + "settings": { + "historyDays": 90, + "searchIndexing": true, + "showResponseTime": false, + "showUptimeBars": true, + "showUptimePercent": true, + "timeZone": "Europe/Prague", + "uptimeDays": 90 + }, + "slug": "acme", + "updatedAt": "2026-11-02T09:00:00Z", + "url": "https://acme.norcubestatus.com" +} diff --git a/internal/cli/testdata/golden/monitor-status-pages-get.tsv b/internal/cli/testdata/golden/monitor-status-pages-get.tsv new file mode 100644 index 0000000..2168cc3 --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-get.tsv @@ -0,0 +1 @@ +6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b acme Acme status published https://acme.norcubestatus.com 2026-11-02T09:00:00Z diff --git a/internal/cli/testdata/golden/monitor-status-pages-get.txt b/internal/cli/testdata/golden/monitor-status-pages-get.txt new file mode 100644 index 0000000..79ee498 --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-get.txt @@ -0,0 +1,16 @@ +ID: 6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b +Slug: acme +Name: Acme status +Description: Our services +URL: https://acme.norcubestatus.com +State: published +Published: 2026-11-02 11:00 +Time zone: Europe/Prague +Uptime days: 90 +History days: 90 +Uptime bars: yes +Uptime percent: yes +Response time: no +Search indexing: yes +Created: 2026-11-01 11:00 +Updated: 2026-11-02 11:00 diff --git a/internal/cli/testdata/golden/monitor-status-pages-get.yaml b/internal/cli/testdata/golden/monitor-status-pages-get.yaml new file mode 100644 index 0000000..cde3a6b --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-get.yaml @@ -0,0 +1,17 @@ +createdAt: "2026-11-01T09:00:00Z" +description: Our services +id: 6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b +name: Acme status +published: true +publishedAt: "2026-11-02T09:00:00Z" +settings: + historyDays: 90 + searchIndexing: true + showResponseTime: false + showUptimeBars: true + showUptimePercent: true + timeZone: Europe/Prague + uptimeDays: 90 +slug: acme +updatedAt: "2026-11-02T09:00:00Z" +url: https://acme.norcubestatus.com diff --git a/internal/cli/testdata/golden/monitor-status-pages-incidents-get.json b/internal/cli/testdata/golden/monitor-status-pages-incidents-get.json new file mode 100644 index 0000000..8b06c36 --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-incidents-get.json @@ -0,0 +1,27 @@ +{ + "components": [ + { + "componentId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5e", + "status": "partial_outage" + } + ], + "createdAt": "2026-11-03T08:05:00Z", + "id": "8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f", + "impact": "minor", + "monitorIncidentIds": [ + "3f2c8a8e-6c1d-4a59-9a43-2b1f0f6f9d10" + ], + "startedAt": "2026-11-03T08:00:00Z", + "status": "investigating", + "statusPageId": "6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b", + "title": "Elevated API errors", + "updatedAt": "2026-11-03T08:05:00Z", + "updates": [ + { + "body": "We are looking into it.", + "createdAt": "2026-11-03T08:05:00Z", + "id": "d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f70", + "status": "investigating" + } + ] +} diff --git a/internal/cli/testdata/golden/monitor-status-pages-incidents-get.tsv b/internal/cli/testdata/golden/monitor-status-pages-incidents-get.tsv new file mode 100644 index 0000000..2e2e02a --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-incidents-get.tsv @@ -0,0 +1 @@ +8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f investigating minor Elevated API errors 2026-11-03T08:00:00Z 1 diff --git a/internal/cli/testdata/golden/monitor-status-pages-incidents-get.txt b/internal/cli/testdata/golden/monitor-status-pages-incidents-get.txt new file mode 100644 index 0000000..b7191ea --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-incidents-get.txt @@ -0,0 +1,10 @@ +ID: 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f +Title: Elevated API errors +Status: investigating +Impact: minor +Started: 2026-11-03 10:00 +Resolved: — +Address: https://acme.norcubestatus.com/incidents/8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f +Components: a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5e partial_outage +Monitor incidents: 3f2c8a8e-6c1d-4a59-9a43-2b1f0f6f9d10 +Updates: 2026-11-03 10:05 investigating: We are looking into it. diff --git a/internal/cli/testdata/golden/monitor-status-pages-incidents-get.yaml b/internal/cli/testdata/golden/monitor-status-pages-incidents-get.yaml new file mode 100644 index 0000000..5b8429d --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-incidents-get.yaml @@ -0,0 +1,18 @@ +components: + - componentId: a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5e + status: partial_outage +createdAt: "2026-11-03T08:05:00Z" +id: 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f +impact: minor +monitorIncidentIds: + - 3f2c8a8e-6c1d-4a59-9a43-2b1f0f6f9d10 +startedAt: "2026-11-03T08:00:00Z" +status: investigating +statusPageId: 6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b +title: Elevated API errors +updatedAt: "2026-11-03T08:05:00Z" +updates: + - body: We are looking into it. + createdAt: "2026-11-03T08:05:00Z" + id: d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f70 + status: investigating diff --git a/internal/cli/testdata/golden/monitor-status-pages-incidents-list.json b/internal/cli/testdata/golden/monitor-status-pages-incidents-list.json new file mode 100644 index 0000000..477c200 --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-incidents-list.json @@ -0,0 +1,29 @@ +[ + { + "components": [ + { + "componentId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5e", + "status": "partial_outage" + } + ], + "createdAt": "2026-11-03T08:05:00Z", + "id": "8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f", + "impact": "minor", + "monitorIncidentIds": [ + "3f2c8a8e-6c1d-4a59-9a43-2b1f0f6f9d10" + ], + "startedAt": "2026-11-03T08:00:00Z", + "status": "investigating", + "statusPageId": "6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b", + "title": "Elevated API errors", + "updatedAt": "2026-11-03T08:05:00Z", + "updates": [ + { + "body": "We are looking into it.", + "createdAt": "2026-11-03T08:05:00Z", + "id": "d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f70", + "status": "investigating" + } + ] + } +] diff --git a/internal/cli/testdata/golden/monitor-status-pages-incidents-list.tsv b/internal/cli/testdata/golden/monitor-status-pages-incidents-list.tsv new file mode 100644 index 0000000..2e2e02a --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-incidents-list.tsv @@ -0,0 +1 @@ +8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f investigating minor Elevated API errors 2026-11-03T08:00:00Z 1 diff --git a/internal/cli/testdata/golden/monitor-status-pages-incidents-list.txt b/internal/cli/testdata/golden/monitor-status-pages-incidents-list.txt new file mode 100644 index 0000000..6415a2b --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-incidents-list.txt @@ -0,0 +1,2 @@ +ID STATUS IMPACT TITLE STARTED RESOLVED UPDATES +8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f investigating minor Elevated API errors 2026-11-03 10:00 — 1 diff --git a/internal/cli/testdata/golden/monitor-status-pages-incidents-list.yaml b/internal/cli/testdata/golden/monitor-status-pages-incidents-list.yaml new file mode 100644 index 0000000..f20656b --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-incidents-list.yaml @@ -0,0 +1,18 @@ +- components: + - componentId: a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5e + status: partial_outage + createdAt: "2026-11-03T08:05:00Z" + id: 8c7d6e5f-4a3b-4c2d-9e1f-0a1b2c3d4e5f + impact: minor + monitorIncidentIds: + - 3f2c8a8e-6c1d-4a59-9a43-2b1f0f6f9d10 + startedAt: "2026-11-03T08:00:00Z" + status: investigating + statusPageId: 6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b + title: Elevated API errors + updatedAt: "2026-11-03T08:05:00Z" + updates: + - body: We are looking into it. + createdAt: "2026-11-03T08:05:00Z" + id: d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f70 + status: investigating diff --git a/internal/cli/testdata/golden/monitor-status-pages-layout-get.json b/internal/cli/testdata/golden/monitor-status-pages-layout-get.json new file mode 100644 index 0000000..0534e8c --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-layout-get.json @@ -0,0 +1,29 @@ +{ + "components": [ + { + "aspects": [ + "availability", + "certificate" + ], + "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5e", + "kind": "monitor", + "monitorId": "7d1c2f7e-6a1f-4f5e-9b8a-1f7c2b3d4e5f", + "name": "Website" + } + ], + "groups": [ + { + "collapsed": false, + "components": [ + { + "id": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6f", + "kind": "manual", + "manualStatus": "operational", + "name": "Support desk" + } + ], + "id": "c3d4e5f6-a7b8-4c9d-8e1f-2a3b4c5d6e70", + "name": "Support" + } + ] +} diff --git a/internal/cli/testdata/golden/monitor-status-pages-layout-get.tsv b/internal/cli/testdata/golden/monitor-status-pages-layout-get.tsv new file mode 100644 index 0000000..556d825 --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-layout-get.tsv @@ -0,0 +1 @@ +2 1 diff --git a/internal/cli/testdata/golden/monitor-status-pages-layout-get.txt b/internal/cli/testdata/golden/monitor-status-pages-layout-get.txt new file mode 100644 index 0000000..f30c50e --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-layout-get.txt @@ -0,0 +1,2 @@ +Components: a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5e Website: monitor 7d1c2f7e-6a1f-4f5e-9b8a-1f7c2b3d4e5f (availability, certificate) +Group Support: b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6f Support desk: operational (manual) diff --git a/internal/cli/testdata/golden/monitor-status-pages-layout-get.yaml b/internal/cli/testdata/golden/monitor-status-pages-layout-get.yaml new file mode 100644 index 0000000..6b5feb8 --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-layout-get.yaml @@ -0,0 +1,17 @@ +components: + - aspects: + - availability + - certificate + id: a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5e + kind: monitor + monitorId: 7d1c2f7e-6a1f-4f5e-9b8a-1f7c2b3d4e5f + name: Website +groups: + - collapsed: false + components: + - id: b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6f + kind: manual + manualStatus: operational + name: Support desk + id: c3d4e5f6-a7b8-4c9d-8e1f-2a3b4c5d6e70 + name: Support diff --git a/internal/cli/testdata/golden/monitor-status-pages-list.json b/internal/cli/testdata/golden/monitor-status-pages-list.json new file mode 100644 index 0000000..17de7c5 --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-list.json @@ -0,0 +1,41 @@ +[ + { + "createdAt": "2026-11-01T09:00:00Z", + "description": "Our services", + "id": "6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b", + "name": "Acme status", + "published": true, + "publishedAt": "2026-11-02T09:00:00Z", + "settings": { + "historyDays": 90, + "searchIndexing": true, + "showResponseTime": false, + "showUptimeBars": true, + "showUptimePercent": true, + "timeZone": "Europe/Prague", + "uptimeDays": 90 + }, + "slug": "acme", + "updatedAt": "2026-11-02T09:00:00Z", + "url": "https://acme.norcubestatus.com" + }, + { + "createdAt": "2026-10-30T09:00:00Z", + "description": "", + "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", + "name": "Draft", + "published": false, + "settings": { + "historyDays": 90, + "searchIndexing": true, + "showResponseTime": false, + "showUptimeBars": true, + "showUptimePercent": true, + "timeZone": "Europe/Prague", + "uptimeDays": 90 + }, + "slug": "draft-page", + "updatedAt": "2026-10-30T09:00:00Z", + "url": "https://draft-page.norcubestatus.com" + } +] diff --git a/internal/cli/testdata/golden/monitor-status-pages-list.tsv b/internal/cli/testdata/golden/monitor-status-pages-list.tsv new file mode 100644 index 0000000..966e9b0 --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-list.tsv @@ -0,0 +1,2 @@ +6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b acme Acme status published https://acme.norcubestatus.com 2026-11-02T09:00:00Z +1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d draft-page Draft draft https://draft-page.norcubestatus.com 2026-10-30T09:00:00Z diff --git a/internal/cli/testdata/golden/monitor-status-pages-list.txt b/internal/cli/testdata/golden/monitor-status-pages-list.txt new file mode 100644 index 0000000..140e6e1 --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-list.txt @@ -0,0 +1,3 @@ +ID SLUG NAME STATE URL UPDATED +6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b acme Acme status published https://acme.norcubestatus.com 2026-11-02 11:00 +1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d draft-page Draft draft https://draft-page.norcubestatus.com 2026-10-30 11:00 diff --git a/internal/cli/testdata/golden/monitor-status-pages-list.yaml b/internal/cli/testdata/golden/monitor-status-pages-list.yaml new file mode 100644 index 0000000..2c5f23a --- /dev/null +++ b/internal/cli/testdata/golden/monitor-status-pages-list.yaml @@ -0,0 +1,33 @@ +- createdAt: "2026-11-01T09:00:00Z" + description: Our services + id: 6e0f4b1a-2c3d-4e5f-8a9b-0c1d2e3f4a5b + name: Acme status + published: true + publishedAt: "2026-11-02T09:00:00Z" + settings: + historyDays: 90 + searchIndexing: true + showResponseTime: false + showUptimeBars: true + showUptimePercent: true + timeZone: Europe/Prague + uptimeDays: 90 + slug: acme + updatedAt: "2026-11-02T09:00:00Z" + url: https://acme.norcubestatus.com +- createdAt: "2026-10-30T09:00:00Z" + description: "" + id: 1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d + name: Draft + published: false + settings: + historyDays: 90 + searchIndexing: true + showResponseTime: false + showUptimeBars: true + showUptimePercent: true + timeZone: Europe/Prague + uptimeDays: 90 + slug: draft-page + updatedAt: "2026-10-30T09:00:00Z" + url: https://draft-page.norcubestatus.com diff --git a/specs/monitor.openapi.json b/specs/monitor.openapi.json index a534682..9582acb 100644 --- a/specs/monitor.openapi.json +++ b/specs/monitor.openapi.json @@ -43,6 +43,9 @@ "MONITOR_LIMIT", "ALERT_CHANNEL_LIMIT", "UNVERIFIED_CHANNEL_LIMIT", + "STATUS_PAGE_LIMIT", + "SLUG_TAKEN", + "INCIDENT_RESOLVED", "MISSING_ORGANIZATION_ID", "INSUFFICIENT_SCOPE", "CALLER_OUTSIDE_NAMESPACE", @@ -60,6 +63,9 @@ "ErrorReasonMonitorLimit", "ErrorReasonAlertChannelLimit", "ErrorReasonUnverifiedChannelLimit", + "ErrorReasonStatusPageLimit", + "ErrorReasonSlugTaken", + "ErrorReasonIncidentResolved", "ErrorReasonMissingOrganizationID", "ErrorReasonInsufficientScope", "ErrorReasonCallerOutsideNamespace", @@ -2270,6 +2276,364 @@ }, "type": "object" }, + "dto.PublicStatusAffected": { + "properties": { + "id": { + "format": "uuid", + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "enum": [ + "operational", + "degraded_performance", + "partial_outage", + "major_outage" + ], + "type": "string" + } + }, + "required": [ + "id", + "name", + "status" + ], + "type": "object" + }, + "dto.PublicStatusComponent": { + "properties": { + "avgResponseMs": { + "description": "AvgResponseMs over the page's range, when the page shows response\ntimes.", + "type": "integer" + }, + "days": { + "description": "Days are the bar, oldest first, when the page shows bars and the\ncomponent counts availability.", + "items": { + "$ref": "#/components/schemas/dto.PublicStatusDay" + }, + "type": "array" + }, + "description": { + "type": "string" + }, + "id": { + "format": "uuid", + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "enum": [ + "operational", + "degraded_performance", + "partial_outage", + "major_outage", + "unknown" + ], + "type": "string" + }, + "uptimePercent": { + "description": "UptimePercent over the page's range, when the page shows it.", + "type": "number" + } + }, + "required": [ + "description", + "id", + "name", + "status" + ], + "type": "object" + }, + "dto.PublicStatusDay": { + "properties": { + "avgResponseMs": { + "description": "AvgResponseMs: when the page shows response times.", + "type": "integer" + }, + "day": { + "example": "2026-11-10", + "type": "string" + }, + "downtimeMinutes": { + "type": "integer" + }, + "grade": { + "enum": [ + "no_data", + "unknown", + "ok", + "warning", + "minor", + "partial", + "major" + ], + "type": "string" + }, + "uptimePercent": { + "type": "number" + } + }, + "required": [ + "day", + "grade" + ], + "type": "object" + }, + "dto.PublicStatusGroup": { + "properties": { + "collapsed": { + "type": "boolean" + }, + "components": { + "items": { + "$ref": "#/components/schemas/dto.PublicStatusComponent" + }, + "type": "array" + }, + "description": { + "type": "string" + }, + "id": { + "format": "uuid", + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "enum": [ + "operational", + "degraded_performance", + "partial_outage", + "major_outage", + "unknown" + ], + "type": "string" + } + }, + "required": [ + "collapsed", + "components", + "description", + "id", + "name", + "status" + ], + "type": "object" + }, + "dto.PublicStatusHistory": { + "properties": { + "incidents": { + "items": { + "$ref": "#/components/schemas/dto.PublicStatusIncident" + }, + "type": "array" + }, + "schemaVersion": { + "example": 1, + "type": "integer" + } + }, + "required": [ + "incidents", + "schemaVersion" + ], + "type": "object" + }, + "dto.PublicStatusIncident": { + "properties": { + "components": { + "items": { + "$ref": "#/components/schemas/dto.PublicStatusAffected" + }, + "type": "array" + }, + "id": { + "format": "uuid", + "type": "string" + }, + "impact": { + "enum": [ + "none", + "minor", + "major", + "critical" + ], + "type": "string" + }, + "resolvedAt": { + "type": "string" + }, + "startedAt": { + "type": "string" + }, + "status": { + "enum": [ + "investigating", + "identified", + "monitoring", + "resolved" + ], + "type": "string" + }, + "title": { + "type": "string" + }, + "updates": { + "items": { + "$ref": "#/components/schemas/dto.PublicStatusUpdate" + }, + "type": "array" + } + }, + "required": [ + "components", + "id", + "impact", + "startedAt", + "status", + "title", + "updates" + ], + "type": "object" + }, + "dto.PublicStatusPage": { + "properties": { + "active": { + "description": "Active are the open posts, newest first.", + "items": { + "$ref": "#/components/schemas/dto.PublicStatusIncident" + }, + "type": "array" + }, + "asOf": { + "description": "AsOf is when the content last changed.", + "type": "string" + }, + "components": { + "items": { + "$ref": "#/components/schemas/dto.PublicStatusComponent" + }, + "type": "array" + }, + "description": { + "type": "string" + }, + "groups": { + "items": { + "$ref": "#/components/schemas/dto.PublicStatusGroup" + }, + "type": "array" + }, + "id": { + "format": "uuid", + "type": "string" + }, + "indicator": { + "description": "Indicator is the page's one-word verdict.", + "enum": [ + "none", + "minor", + "major", + "critical" + ], + "type": "string" + }, + "name": { + "example": "Acme status", + "type": "string" + }, + "published": { + "description": "Published false: only preview links show it.", + "type": "boolean" + }, + "schemaVersion": { + "example": 1, + "type": "integer" + }, + "searchIndexing": { + "type": "boolean" + }, + "slug": { + "example": "acme", + "type": "string" + }, + "timeZone": { + "example": "Europe/Prague", + "type": "string" + }, + "uptimeDays": { + "description": "UptimeDays is how many days the bars cover.", + "example": 90, + "type": "integer" + } + }, + "required": [ + "active", + "components", + "description", + "groups", + "id", + "indicator", + "name", + "published", + "schemaVersion", + "searchIndexing", + "slug", + "timeZone", + "uptimeDays" + ], + "type": "object" + }, + "dto.PublicStatusPreview": { + "properties": { + "history": { + "$ref": "#/components/schemas/dto.PublicStatusHistory" + }, + "page": { + "$ref": "#/components/schemas/dto.PublicStatusPage" + } + }, + "required": [ + "history", + "page" + ], + "type": "object" + }, + "dto.PublicStatusUpdate": { + "properties": { + "body": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "id": { + "format": "uuid", + "type": "string" + }, + "status": { + "enum": [ + "investigating", + "identified", + "monitoring", + "resolved" + ], + "type": "string" + } + }, + "required": [ + "body", + "createdAt", + "id", + "status" + ], + "type": "object" + }, "dto.RenewedCertificate": { "properties": { "fingerprintSha256": { @@ -2481,380 +2845,2394 @@ ], "type": "object" }, - "dto.ThresholdAlert": { + "dto.StatusPage": { "properties": { - "alertedAt": { + "createdAt": { "type": "string" }, - "days": { - "example": 14, - "type": "integer" - } - }, - "required": [ - "alertedAt", - "days" - ], - "type": "object" - }, - "dto.WindowSummary": { - "properties": { - "avgMs": { - "example": 182, - "type": "integer" - }, - "checks": { - "type": "integer" - }, - "critical": { - "type": "integer" + "description": { + "type": "string" }, - "from": { + "id": { + "format": "uuid", "type": "string" }, - "inconclusive": { - "type": "integer" + "name": { + "example": "Acme status", + "type": "string" }, - "ok": { - "type": "integer" + "published": { + "description": "Published pages are public; others answer 404.", + "type": "boolean" }, - "p50Ms": { - "description": "P50Ms and P95Ms approximate the window's median and 95th percentile\nresponse time (the checks-weighted mean of the hourly percentiles).", - "example": 150, - "type": "integer" + "publishedAt": { + "type": "string" }, - "p95Ms": { - "example": 420, - "type": "integer" + "settings": { + "$ref": "#/components/schemas/dto.StatusPageSettings" }, - "uptimePercent": { - "description": "UptimePercent is (ok + warning) / (ok + warning + critical): a\nwarning still answered, an inconclusive check counts neither way.\nWarningPercent is the warnings' share of the conclusive checks.", - "example": 99.93, - "type": "number" + "slug": { + "example": "acme", + "type": "string" }, - "warning": { - "type": "integer" + "updatedAt": { + "type": "string" }, - "warningPercent": { - "example": 0.4, - "type": "number" + "url": { + "description": "URL is the page's public address.", + "example": "https://acme.norcubestatus.com", + "type": "string" } }, "required": [ - "checks", - "critical", - "from", - "inconclusive", - "ok", - "warning" + "createdAt", + "description", + "id", + "name", + "published", + "settings", + "slug", + "updatedAt", + "url" ], "type": "object" }, - "response.APIResponsePaginationCursors": { + "dto.StatusPageAffected": { "properties": { - "next": { - "example": "eyJpZCI6InUuLi4ifQ==", + "componentId": { + "format": "uuid", "type": "string" }, - "prev": { - "example": "eyJpZCI6InUuLi4ifQ==", + "status": { + "enum": [ + "operational", + "degraded_performance", + "partial_outage", + "major_outage" + ], "type": "string" } }, + "required": [ + "componentId", + "status" + ], "type": "object" }, - "response.APIResponsePaginationMeta": { + "dto.StatusPageComponent": { "properties": { - "timestamp": { - "example": "2025-01-08T17:29:30.663Z", + "aspects": { + "description": "Aspects: what counts towards a monitor component's status.", + "items": { + "enum": [ + "availability", + "certificate", + "domain" + ], + "type": "string" + }, + "type": "array" + }, + "description": { + "maxLength": 300, + "type": "string" + }, + "id": { + "format": "uuid", + "type": "string" + }, + "kind": { + "enum": [ + "monitor", + "manual" + ], + "example": "monitor", + "type": "string" + }, + "manualStatus": { + "description": "ManualStatus: a manual component's status.", + "enum": [ + "operational", + "degraded_performance", + "partial_outage", + "major_outage" + ], + "type": "string" + }, + "monitorId": { + "description": "MonitorID: a monitor component's monitor. The public never sees it.", + "format": "uuid", + "type": "string" + }, + "name": { + "description": "Name is what the public sees; the monitor's name and target never are.", + "example": "Website", + "maxLength": 100, "type": "string" } }, + "required": [ + "kind", + "name" + ], "type": "object" }, - "response.APIResponseWithPagination": { + "dto.StatusPageCreate": { "properties": { - "cursors": { - "$ref": "#/components/schemas/response.APIResponsePaginationCursors" + "description": { + "maxLength": 500, + "type": "string" }, - "list": {}, - "meta": { - "$ref": "#/components/schemas/response.APIResponsePaginationMeta" + "name": { + "example": "Acme status", + "maxLength": 100, + "type": "string" + }, + "settings": { + "$ref": "#/components/schemas/dto.StatusPageSettings" + }, + "slug": { + "description": "Slug is the page's address: lowercase letters, digits and hyphens.", + "example": "acme", + "maxLength": 40, + "minLength": 3, + "type": "string" } }, "required": [ - "cursors", - "list", - "meta" + "name", + "settings", + "slug" ], "type": "object" }, - "response.Problem": { + "dto.StatusPageGroup": { "properties": { - "code": { - "allOf": [ - { - "$ref": "#/components/schemas/constants.ErrorCode" - } - ], - "example": "VALIDATION_FAILED" + "collapsed": { + "type": "boolean" }, - "data": { - "additionalProperties": { - "type": "string" + "components": { + "items": { + "$ref": "#/components/schemas/dto.StatusPageComponent" }, - "description": "Data holds stable facts about the error (\"limit\"), the same ones gRPC\nsends as ErrorInfo metadata.", - "type": "object" + "type": "array" }, - "detail": { - "description": "Detail is an English sentence for people.", - "example": "The request has invalid fields.", + "description": { + "maxLength": 300, "type": "string" }, - "errors": { - "description": "Errors lists the field problems of a VALIDATION_FAILED problem.", + "id": { + "format": "uuid", + "type": "string" + }, + "name": { + "example": "API", + "maxLength": 100, + "type": "string" + } + }, + "required": [ + "components", + "name" + ], + "type": "object" + }, + "dto.StatusPageIncident": { + "properties": { + "components": { "items": { - "$ref": "#/components/schemas/validation.Violation" + "$ref": "#/components/schemas/dto.StatusPageAffected" }, "type": "array" }, - "instance": { - "description": "Instance identifies this occurrence: the request id the server\ngenerated, also sent as X-Request-ID and logged as request_id.", - "example": "urn:uuid:3f2c8a8e-6c1d-4a59-9a43-2b1f0f6f9d10", - "format": "uri", + "createdAt": { "type": "string" }, - "reason": { - "allOf": [ - { - "$ref": "#/components/schemas/constants.ErrorReason" - } + "id": { + "format": "uuid", + "type": "string" + }, + "impact": { + "enum": [ + "none", + "minor", + "major", + "critical" ], - "description": "Reason is a finer stable cause within Code, when there is one." + "type": "string" + }, + "monitorIncidentIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "resolvedAt": { + "type": "string" + }, + "startedAt": { + "type": "string" }, "status": { - "example": 400, - "type": "integer" + "enum": [ + "investigating", + "identified", + "monitoring", + "resolved" + ], + "type": "string" }, - "timestamp": { + "statusPageId": { + "format": "uuid", "type": "string" }, "title": { - "example": "Validation failed", "type": "string" }, - "type": { - "description": "Type identifies the problem type (one per code); it may be\ndereferenced for documentation.", - "example": "https://docs.norcube.com/errors/validation-failed", - "format": "uri", + "updatedAt": { "type": "string" + }, + "updates": { + "items": { + "$ref": "#/components/schemas/dto.StatusPageIncidentEntry" + }, + "type": "array" } }, "required": [ - "code", - "detail", - "instance", + "components", + "createdAt", + "id", + "impact", + "monitorIncidentIds", + "startedAt", "status", - "timestamp", + "statusPageId", "title", - "type" + "updatedAt", + "updates" ], "type": "object" }, - "validation.Params": { + "dto.StatusPageIncidentCreate": { "properties": { - "allowed": { - "description": "Allowed: oneOf.", + "body": { + "description": "Body is the first update's text.", + "example": "We are looking into it.", + "maxLength": 5000, + "type": "string" + }, + "components": { "items": { - "type": "string" + "$ref": "#/components/schemas/dto.StatusPageAffected" }, "type": "array" }, - "expected": { - "description": "Expected: type, mismatch.", + "impact": { + "enum": [ + "none", + "minor", + "major", + "critical" + ], + "example": "minor", "type": "string" }, - "field": { - "description": "Field is the pointer of the other field: min and max compared with a\nfield, exclusive, dependsOn.", - "example": "/http/requestBody", + "monitorIncidentIds": { + "description": "MonitorIncidentIDs are the monitor incidents the post is about (for\nyour navigation, never published).", + "items": { + "format": "uuid", + "type": "string" + }, + "type": "array" + }, + "startedAt": { + "description": "StartedAt defaults to now.", "type": "string" }, - "max": { - "description": "Max: range, max, maxLength, maxItems.", - "example": 30000, - "type": "integer" + "status": { + "enum": [ + "investigating", + "identified", + "monitoring", + "resolved" + ], + "example": "investigating", + "type": "string" }, - "min": { - "description": "Min: range, min.", - "example": 1000, - "type": "integer" + "title": { + "example": "Elevated API errors", + "maxLength": 200, + "type": "string" + } + }, + "required": [ + "body", + "impact", + "status", + "title" + ], + "type": "object" + }, + "dto.StatusPageIncidentEntry": { + "properties": { + "body": { + "type": "string" }, - "unit": { - "allOf": [ - { - "$ref": "#/components/schemas/validation.Unit" - } - ], - "description": "Unit: maxLength." + "createdAt": { + "type": "string" }, - "value": { - "description": "Value: unsupported.", + "id": { + "format": "uuid", + "type": "string" + }, + "status": { + "enum": [ + "investigating", + "identified", + "monitoring", + "resolved" + ], "type": "string" } }, + "required": [ + "body", + "createdAt", + "id", + "status" + ], "type": "object" }, - "validation.Rule": { - "enum": [ - "required", - "min", - "max", - "range", - "maxLength", - "maxItems", - "oneOf", - "format", - "public", - "unique", - "exclusive", - "dependsOn", - "notAllowed", - "immutable", - "unknown", - "duplicate", - "type", - "reference", - "unverified", - "unsupported", - "mismatch" + "dto.StatusPageIncidentPost": { + "properties": { + "body": { + "example": "A fix is rolling out.", + "maxLength": 5000, + "type": "string" + }, + "components": { + "description": "Components, when given, replaces the affected components.", + "items": { + "$ref": "#/components/schemas/dto.StatusPageAffected" + }, + "type": "array" + }, + "status": { + "enum": [ + "investigating", + "identified", + "monitoring", + "resolved" + ], + "example": "monitoring", + "type": "string" + } + }, + "required": [ + "body", + "status" ], - "type": "string", - "x-enum-varnames": [ - "RuleRequired", - "RuleMin", - "RuleMax", - "RuleRange", - "RuleMaxLength", - "RuleMaxItems", - "RuleOneOf", - "RuleFormat", - "RulePublic", - "RuleUnique", - "RuleExclusive", - "RuleDependsOn", - "RuleNotAllowed", - "RuleImmutable", - "RuleUnknown", - "RuleDuplicate", - "RuleType", - "RuleReference", - "RuleUnverified", - "RuleUnsupported", - "RuleMismatch" - ] + "type": "object" }, - "validation.Unit": { - "enum": [ - "characters", - "bytes" + "dto.StatusPageIncidentUpdate": { + "properties": { + "components": { + "items": { + "$ref": "#/components/schemas/dto.StatusPageAffected" + }, + "type": "array" + }, + "impact": { + "enum": [ + "none", + "minor", + "major", + "critical" + ], + "type": "string" + }, + "monitorIncidentIds": { + "items": { + "format": "uuid", + "type": "string" + }, + "type": "array" + }, + "startedAt": { + "type": "string" + }, + "title": { + "maxLength": 200, + "type": "string" + } + }, + "type": "object" + }, + "dto.StatusPageLayout": { + "properties": { + "components": { + "items": { + "$ref": "#/components/schemas/dto.StatusPageComponent" + }, + "type": "array" + }, + "groups": { + "items": { + "$ref": "#/components/schemas/dto.StatusPageGroup" + }, + "type": "array" + } + }, + "required": [ + "components", + "groups" ], - "type": "string", - "x-enum-varnames": [ - "UnitCharacters", - "UnitBytes" - ] + "type": "object" }, - "validation.Violation": { + "dto.StatusPagePreviewLink": { "properties": { - "detail": { - "example": "must be between 1000 and 30000", + "expiresAt": { "type": "string" }, - "params": { - "$ref": "#/components/schemas/validation.Params" + "url": { + "type": "string" + } + }, + "required": [ + "expiresAt", + "url" + ], + "type": "object" + }, + "dto.StatusPageSettings": { + "properties": { + "historyDays": { + "description": "HistoryDays is how far back resolved incidents stay on the page.", + "example": 90, + "maximum": 365, + "minimum": 7, + "type": "integer" }, - "pointer": { - "example": "/http/timeoutMs", + "searchIndexing": { + "description": "SearchIndexing false asks search engines to leave the page out.", + "type": "boolean" + }, + "showResponseTime": { + "type": "boolean" + }, + "showUptimeBars": { + "type": "boolean" + }, + "showUptimePercent": { + "type": "boolean" + }, + "timeZone": { + "description": "TimeZone is the IANA zone times are shown in.", + "example": "Europe/Prague", "type": "string" }, - "rule": { - "allOf": [ - { - "$ref": "#/components/schemas/validation.Rule" - } + "uptimeDays": { + "description": "UptimeDays is how many days the bars cover.", + "enum": [ + 30, + 60, + 90 ], - "example": "range" + "example": 90, + "type": "integer" } }, "required": [ - "detail", - "pointer", - "rule" + "historyDays", + "searchIndexing", + "showResponseTime", + "showUptimeBars", + "showUptimePercent", + "timeZone", + "uptimeDays" ], "type": "object" - } - } - }, - "info": { - "contact": { - "email": "jan@jetlio.com", - "name": "Jan Švábík" - }, - "description": "Uptime, SSL certificate and domain expiry monitoring.", - "title": "Norcube Monitor API", - "version": "" - }, - "openapi": "3.0.3", - "paths": { - "/alert-channels": { - "get": { - "description": "The organization's alert channels, newest first. Credentials are never returned.", - "operationId": "listAlertChannels", - "parameters": [ - { - "in": "query", - "name": "cursor", - "schema": { - "type": "string" - } + }, + "dto.StatusPageSettingsUpdate": { + "properties": { + "historyDays": { + "maximum": 365, + "minimum": 7, + "type": "integer" }, - { - "in": "query", - "name": "limit", - "schema": { - "maximum": 100, - "minimum": 1, - "type": "integer" - } + "searchIndexing": { + "type": "boolean" + }, + "showResponseTime": { + "type": "boolean" + }, + "showUptimeBars": { + "type": "boolean" + }, + "showUptimePercent": { + "type": "boolean" + }, + "timeZone": { + "example": "Europe/Prague", + "type": "string" + }, + "uptimeDays": { + "enum": [ + 30, + 60, + 90 + ], + "type": "integer" } - ], - "responses": { - "200": { + }, + "type": "object" + }, + "dto.StatusPageUpdate": { + "properties": { + "description": { + "maxLength": 500, + "type": "string" + }, + "name": { + "maxLength": 100, + "type": "string" + }, + "settings": { + "$ref": "#/components/schemas/dto.StatusPageSettingsUpdate" + }, + "slug": { + "maxLength": 40, + "minLength": 3, + "type": "string" + } + }, + "type": "object" + }, + "dto.ThresholdAlert": { + "properties": { + "alertedAt": { + "type": "string" + }, + "days": { + "example": 14, + "type": "integer" + } + }, + "required": [ + "alertedAt", + "days" + ], + "type": "object" + }, + "dto.WindowSummary": { + "properties": { + "avgMs": { + "example": 182, + "type": "integer" + }, + "checks": { + "type": "integer" + }, + "critical": { + "type": "integer" + }, + "from": { + "type": "string" + }, + "inconclusive": { + "type": "integer" + }, + "ok": { + "type": "integer" + }, + "p50Ms": { + "description": "P50Ms and P95Ms approximate the window's median and 95th percentile\nresponse time (the checks-weighted mean of the hourly percentiles).", + "example": 150, + "type": "integer" + }, + "p95Ms": { + "example": 420, + "type": "integer" + }, + "uptimePercent": { + "description": "UptimePercent is (ok + warning) / (ok + warning + critical): a\nwarning still answered, an inconclusive check counts neither way.\nWarningPercent is the warnings' share of the conclusive checks.", + "example": 99.93, + "type": "number" + }, + "warning": { + "type": "integer" + }, + "warningPercent": { + "example": 0.4, + "type": "number" + } + }, + "required": [ + "checks", + "critical", + "from", + "inconclusive", + "ok", + "warning" + ], + "type": "object" + }, + "response.APIResponsePaginationCursors": { + "properties": { + "next": { + "example": "eyJpZCI6InUuLi4ifQ==", + "type": "string" + }, + "prev": { + "example": "eyJpZCI6InUuLi4ifQ==", + "type": "string" + } + }, + "type": "object" + }, + "response.APIResponsePaginationMeta": { + "properties": { + "timestamp": { + "example": "2025-01-08T17:29:30.663Z", + "type": "string" + } + }, + "type": "object" + }, + "response.APIResponseWithPagination": { + "properties": { + "cursors": { + "$ref": "#/components/schemas/response.APIResponsePaginationCursors" + }, + "list": {}, + "meta": { + "$ref": "#/components/schemas/response.APIResponsePaginationMeta" + } + }, + "required": [ + "cursors", + "list", + "meta" + ], + "type": "object" + }, + "response.Problem": { + "properties": { + "code": { + "allOf": [ + { + "$ref": "#/components/schemas/constants.ErrorCode" + } + ], + "example": "VALIDATION_FAILED" + }, + "data": { + "additionalProperties": { + "type": "string" + }, + "description": "Data holds stable facts about the error (\"limit\"), the same ones gRPC\nsends as ErrorInfo metadata.", + "type": "object" + }, + "detail": { + "description": "Detail is an English sentence for people.", + "example": "The request has invalid fields.", + "type": "string" + }, + "errors": { + "description": "Errors lists the field problems of a VALIDATION_FAILED problem.", + "items": { + "$ref": "#/components/schemas/validation.Violation" + }, + "type": "array" + }, + "instance": { + "description": "Instance identifies this occurrence: the request id the server\ngenerated, also sent as X-Request-ID and logged as request_id.", + "example": "urn:uuid:3f2c8a8e-6c1d-4a59-9a43-2b1f0f6f9d10", + "format": "uri", + "type": "string" + }, + "reason": { + "allOf": [ + { + "$ref": "#/components/schemas/constants.ErrorReason" + } + ], + "description": "Reason is a finer stable cause within Code, when there is one." + }, + "status": { + "example": 400, + "type": "integer" + }, + "timestamp": { + "type": "string" + }, + "title": { + "example": "Validation failed", + "type": "string" + }, + "type": { + "description": "Type identifies the problem type (one per code); it may be\ndereferenced for documentation.", + "example": "https://docs.norcube.com/errors/validation-failed", + "format": "uri", + "type": "string" + } + }, + "required": [ + "code", + "detail", + "instance", + "status", + "timestamp", + "title", + "type" + ], + "type": "object" + }, + "validation.Params": { + "properties": { + "allowed": { + "description": "Allowed: oneOf.", + "items": { + "type": "string" + }, + "type": "array" + }, + "expected": { + "description": "Expected: type, mismatch.", + "type": "string" + }, + "field": { + "description": "Field is the pointer of the other field: min and max compared with a\nfield, exclusive, dependsOn.", + "example": "/http/requestBody", + "type": "string" + }, + "max": { + "description": "Max: range, max, maxLength, maxItems.", + "example": 30000, + "type": "integer" + }, + "min": { + "description": "Min: range, min.", + "example": 1000, + "type": "integer" + }, + "unit": { + "allOf": [ + { + "$ref": "#/components/schemas/validation.Unit" + } + ], + "description": "Unit: maxLength." + }, + "value": { + "description": "Value: unsupported.", + "type": "string" + } + }, + "type": "object" + }, + "validation.Rule": { + "enum": [ + "required", + "min", + "max", + "range", + "maxLength", + "maxItems", + "oneOf", + "format", + "public", + "unique", + "exclusive", + "dependsOn", + "notAllowed", + "immutable", + "unknown", + "duplicate", + "type", + "reference", + "unverified", + "unsupported", + "mismatch" + ], + "type": "string", + "x-enum-varnames": [ + "RuleRequired", + "RuleMin", + "RuleMax", + "RuleRange", + "RuleMaxLength", + "RuleMaxItems", + "RuleOneOf", + "RuleFormat", + "RulePublic", + "RuleUnique", + "RuleExclusive", + "RuleDependsOn", + "RuleNotAllowed", + "RuleImmutable", + "RuleUnknown", + "RuleDuplicate", + "RuleType", + "RuleReference", + "RuleUnverified", + "RuleUnsupported", + "RuleMismatch" + ] + }, + "validation.Unit": { + "enum": [ + "characters", + "bytes" + ], + "type": "string", + "x-enum-varnames": [ + "UnitCharacters", + "UnitBytes" + ] + }, + "validation.Violation": { + "properties": { + "detail": { + "example": "must be between 1000 and 30000", + "type": "string" + }, + "params": { + "$ref": "#/components/schemas/validation.Params" + }, + "pointer": { + "example": "/http/timeoutMs", + "type": "string" + }, + "rule": { + "allOf": [ + { + "$ref": "#/components/schemas/validation.Rule" + } + ], + "example": "range" + } + }, + "required": [ + "detail", + "pointer", + "rule" + ], + "type": "object" + } + } + }, + "info": { + "contact": { + "email": "jan@jetlio.com", + "name": "Jan Švábík" + }, + "description": "Uptime, SSL certificate and domain expiry monitoring.", + "title": "Norcube Monitor API", + "version": "" + }, + "openapi": "3.0.3", + "paths": { + "/alert-channels": { + "get": { + "description": "The organization's alert channels, newest first. Credentials are never returned.", + "operationId": "listAlertChannels", + "parameters": [ + { + "in": "query", + "name": "cursor", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "maximum": 100, + "minimum": 1, + "type": "integer" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/response.APIResponseWithPagination" + }, + { + "properties": { + "list": { + "items": { + "$ref": "#/components/schemas/dto.AlertChannel" + }, + "type": "array" + } + }, + "type": "object" + } + ] + } + } + }, + "description": "OK" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + } + }, + "summary": "List alert channels", + "tags": [ + "Alert channels" + ], + "x-norcube-scopes": [ + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" + ] + }, + "post": { + "description": "Creates a channel. A webhook's signing secret (Standard Webhooks, whsec_…) is returned this once; SMS channels get no alerts until their number is verified. Voice-call channels can't be created, nor SMS channels where no SMS provider is configured: 400 with reason CHANNEL_TYPE_UNAVAILABLE.", + "operationId": "createAlertChannel", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.AlertChannelCreate" + } + } + }, + "description": "Channel", + "required": true, + "x-originalParamName": "payload" + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.AlertChannelWithSecret" + } + } + }, + "description": "Created" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Invalid fields (VALIDATION_FAILED), reason CHANNEL_TYPE_UNAVAILABLE when the kind isn't offered" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Forbidden, or channel limit reached (LIMIT_REACHED), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + } + }, + "summary": "Create an alert channel", + "tags": [ + "Alert channels" + ], + "x-norcube-scopes": [ + "monitor.channels" + ] + } + }, + "/alert-channels/{id}": { + "delete": { + "description": "Deletes the channel and removes it from every monitor's alert settings. Pending alerts to it are dropped.", + "operationId": "deleteAlertChannel", + "parameters": [ + { + "description": "Channel ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" + } + }, + "summary": "Delete an alert channel", + "tags": [ + "Alert channels" + ], + "x-norcube-scopes": [ + "monitor.channels" + ] + }, + "get": { + "description": "One alert channel: kind, name, whether it is a default channel, enabled and verified, and its settings without credentials (a Slack or Discord URL as a hint, a webhook's signing secret never).", + "operationId": "getAlertChannel", + "parameters": [ + { + "description": "Channel ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.AlertChannel" + } + } + }, + "description": "OK" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" + } + }, + "summary": "Get an alert channel", + "tags": [ + "Alert channels" + ], + "x-norcube-scopes": [ + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" + ] + }, + "patch": { + "description": "Changes the given fields. signingSecret is returned when a webhook's secret was rotated or replaced. A voice channel can be renamed but not enabled or given settings (400, reason CHANNEL_TYPE_UNAVAILABLE).", + "operationId": "updateAlertChannel", + "parameters": [ + { + "description": "Channel ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.AlertChannelUpdate" + } + } + }, + "description": "Changes", + "required": true, + "x-originalParamName": "payload" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.AlertChannelWithSecret" + } + } + }, + "description": "OK" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" + } + }, + "summary": "Update an alert channel", + "tags": [ + "Alert channels" + ], + "x-norcube-scopes": [ + "monitor.channels" + ] + } + }, + "/alert-channels/{id}/deliveries": { + "get": { + "description": "Every alert given to this channel, newest first (kept 90 days): the event and monitor (and incident), status (pending: queued or waiting to retry; sent; dead: given up), attempts, the next attempt while pending, and the last error with URLs, email addresses, phone numbers and token-like strings removed. status=dead lists the failures nobody saw.", + "operationId": "listAlertChannelDeliveries", + "parameters": [ + { + "description": "Alert channel ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + }, + { + "in": "query", + "name": "cursor", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "maximum": 100, + "minimum": 1, + "type": "integer" + } + }, + { + "in": "query", + "name": "status", + "schema": { + "enum": [ + "pending", + "sent", + "dead" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/response.APIResponseWithPagination" + }, + { + "properties": { + "list": { + "items": { + "$ref": "#/components/schemas/dto.ChannelDelivery" + }, + "type": "array" + } + }, + "type": "object" + } + ] + } + } + }, + "description": "OK" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" + } + }, + "summary": "List a channel's deliveries", + "tags": [ + "Alert channels" + ], + "x-norcube-scopes": [ + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" + ] + } + }, + "/alert-channels/{id}/test": { + "post": { + "description": "Sends a test alert right away and returns the provider's reference. Rate limited; an SMS counts toward the daily SMS limit. Refused while the organization is blocked for unpaid invoices.", + "operationId": "testAlertChannel", + "parameters": [ + { + "description": "Channel ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.AlertChannelTestResult" + } + } + }, + "description": "OK" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "402": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Organization blocked for unpaid invoices" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" + }, + "409": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "The provider refused it, the contact isn't verified, or a voice channel (CHANNEL_TYPE_UNAVAILABLE)" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Too Many Requests" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "The provider didn't answer; retry" + } + }, + "summary": "Send a test alert", + "tags": [ + "Alert channels" + ], + "x-norcube-scopes": [ + "monitor.channels" + ] + } + }, + "/alert-channels/{id}/verify": { + "post": { + "description": "Texts (or, for an email-address channel, emails) a 6-digit code valid for 10 minutes. At most once a minute; an SMS counts toward the daily SMS limit.", + "operationId": "sendAlertChannelVerification", + "parameters": [ + { + "description": "Channel ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "402": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "ORG_BLOCKED: unpaid invoices" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" + }, + "409": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Nothing to verify, already verified, a code was just sent, or a voice channel (CHANNEL_TYPE_UNAVAILABLE)" + } + }, + "summary": "Send a verification code", + "tags": [ + "Alert channels" + ], + "x-norcube-scopes": [ + "monitor.channels" + ] + } + }, + "/alert-channels/{id}/verify/confirm": { + "post": { + "description": "Verifies the channel's number with the code sent. Five wrong codes (or an expired one) need a new code.", + "operationId": "confirmAlertChannelVerification", + "parameters": [ + { + "description": "Channel ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.AlertChannelVerifyConfirm" + } + } + }, + "description": "Code", + "required": true, + "x-originalParamName": "payload" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.AlertChannel" + } + } + }, + "description": "OK" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Wrong code" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" + }, + "409": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Expired, or too many attempts" + } + }, + "summary": "Confirm a verification code", + "tags": [ + "Alert channels" + ], + "x-norcube-scopes": [ + "monitor.channels" + ] + } + }, + "/incidents": { + "get": { + "description": "The organization's incidents: open ones first (critical, then warning), then resolved ones, newest first within each. Filter by status (open, resolved), monitor, severity (an open incident's current severity, a resolved one's peak), aspect, acknowledged, q (part of the monitor's name or target, any case, at most 100 characters) and when it started (from inclusive, to exclusive). Every filter given must match. Rows carry the monitor's name, type, variant and target. An invalid filter is a VALIDATION_FAILED problem with the parameter's pointer (\"/severity\").", + "operationId": "listIncidents", + "parameters": [ + { + "description": "Acknowledged: true for incidents someone acknowledged, false for\nthe others.", + "in": "query", + "name": "acknowledged", + "schema": { + "enum": [ + "true", + "false" + ], + "type": "string" + } + }, + { + "description": "Aspect is what the incident is about.", + "in": "query", + "name": "aspect", + "schema": { + "enum": [ + "availability", + "certificate", + "domain" + ], + "type": "string" + } + }, + { + "in": "query", + "name": "cursor", + "schema": { + "type": "string" + } + }, + { + "description": "From and To bound when the incident started: from inclusive, to\nexclusive (RFC 3339).", + "in": "query", + "name": "from", + "schema": { + "format": "date-time", + "type": "string" + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "maximum": 100, + "minimum": 1, + "type": "integer" + } + }, + { + "in": "query", + "name": "monitorId", + "schema": { + "format": "uuid", + "type": "string" + } + }, + { + "description": "Q is part of the monitor's name or target, any case.", + "in": "query", + "name": "q", + "schema": { + "maxLength": 100, + "type": "string" + } + }, + { + "description": "Severity matches an open incident's current severity and a resolved\none's peak severity (how bad it got).", + "in": "query", + "name": "severity", + "schema": { + "enum": [ + "warning", + "critical" + ], + "type": "string" + } + }, + { + "in": "query", + "name": "status", + "schema": { + "enum": [ + "open", + "resolved" + ], + "type": "string" + } + }, + { + "in": "query", + "name": "to", + "schema": { + "format": "date-time", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/response.APIResponseWithPagination" + }, + { + "properties": { + "list": { + "items": { + "$ref": "#/components/schemas/dto.Incident" + }, + "type": "array" + } + }, + "type": "object" + } + ] + } + } + }, + "description": "OK" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + } + }, + "summary": "List incidents", + "tags": [ + "Incidents" + ], + "x-norcube-scopes": [ + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" + ] + } + }, + "/incidents/summary": { + "get": { + "description": "The organization's incidents at a glance, for a page header: open incidents by current severity and those nobody acknowledged, incidents resolved in the last 7 days, and the mean time to resolve (opened to resolved) of incidents resolved in the last 30 days. Takes no filters: it describes the organization, not a list view.", + "operationId": "getIncidentSummary", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.IncidentSummary" + } + } + }, + "description": "OK" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + } + }, + "summary": "Summarize incidents", + "tags": [ + "Incidents" + ], + "x-norcube-scopes": [ + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" + ] + } + }, + "/incidents/{id}": { + "get": { + "description": "An incident with its timeline and every alert sent for it (with delivery status, so a failing channel shows here).", + "operationId": "getIncident", + "parameters": [ + { + "description": "Incident ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.IncidentDetail" + } + } + }, + "description": "OK" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" + } + }, + "summary": "Get an incident", + "tags": [ + "Incidents" + ], + "x-norcube-scopes": [ + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" + ] + } + }, + "/incidents/{id}/acknowledge": { + "post": { + "description": "Marks an open incident as being handled: its reminders stop. Idempotent; a resolved incident is returned unchanged.", + "operationId": "acknowledgeIncident", + "parameters": [ + { + "description": "Incident ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.IncidentDetail" + } + } + }, + "description": "OK" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" + } + }, + "summary": "Acknowledge an incident", + "tags": [ + "Incidents" + ], + "x-norcube-scopes": [ + "monitor.write" + ] + } + }, + "/monitors": { + "get": { + "description": "The organization's monitors with their current status, by default ordered by status severity (critical, warning, pending, ok, paused) then name; `sort` picks another order, and a cursor only continues the sort it came from. `status` is the severity of the last conclusive check (an inconclusive one, such as a failed registry lookup, never moves it) and `condition` its reason with facts (days left for SSL and domain monitors). Rows of HTTP monitors have `last24h` (checks by severity, uptime and warning share, approximate p50/p95 over the last 24 full hours plus the current one; no data is absent, not 100%). `include=history` adds each row's newest 60 results (`history`, newest first) for a heartbeat strip. Rows carry no settings; `variant` names what each monitor does (`keyword` for an HTTP monitor that looks for a keyword).", + "operationId": "listMonitors", + "parameters": [ + { + "in": "query", + "name": "cursor", + "schema": { + "type": "string" + } + }, + { + "description": "Include is a comma-separated list of optional row parts: history\nadds each row's last 60 check results.", + "in": "query", + "name": "include", + "schema": { + "enum": [ + "history" + ], + "type": "string" + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "maximum": 100, + "minimum": 1, + "type": "integer" + } + }, + { + "in": "query", + "name": "q", + "schema": { + "type": "string" + } + }, + { + "description": "Sort: status (default, by overall status: critical, warning,\npending, ok, paused, then name), name (A to Z), lastChecked (most recent first), uptime\n(lowest over last24h first; no data, and SSL and domain monitors,\nlast), created (newest first).\nA cursor only continues the sort it came from.", + "in": "query", + "name": "sort", + "schema": { + "enum": [ + "status", + "name", + "lastChecked", + "uptime", + "created" + ], + "type": "string" + } + }, + { + "description": "Status matches the overall status (the worst of the monitor's status\nand its watched aspects').", + "in": "query", + "name": "status", + "schema": { + "enum": [ + "pending", + "ok", + "warning", + "critical", + "paused" + ], + "type": "string" + } + }, + { + "in": "query", + "name": "type", + "schema": { + "enum": [ + "http", + "ssl", + "domain" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/response.APIResponseWithPagination" + }, + { + "properties": { + "list": { + "items": { + "$ref": "#/components/schemas/dto.Monitor" + }, + "type": "array" + } + }, + "type": "object" + } + ] + } + } + }, + "description": "OK" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + } + }, + "summary": "List monitors", + "tags": [ + "Monitors" + ], + "x-norcube-scopes": [ + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" + ] + }, + "post": { + "description": "Creates an enabled monitor; its first check runs right away. Every check setting is required.", + "operationId": "createMonitor", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.MonitorCreate" + } + } + }, + "description": "Monitor", + "required": true, + "x-originalParamName": "payload" + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.Monitor" + } + } + }, + "description": "Created" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "402": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Organization blocked for unpaid invoices" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Forbidden, or monitor limit reached (LIMIT_REACHED), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Service Unavailable" + } + }, + "summary": "Create a monitor", + "tags": [ + "Monitors" + ], + "x-norcube-scopes": [ + "monitor.write" + ] + } + }, + "/monitors/bulk": { + "post": { + "description": "Applies one action to up to 100 monitors, each exactly as its own request would (pause closes its open incident, resume checks soon, delete refuses a linked monitor with MANAGED_RESOURCE) after an IAM check on that monitor (UpdateMonitor for pause/resume, DeleteMonitor for delete). Not atomic: the answer has one item per id, in request order, ok or the problem code that monitor's own request would have had (NOT_FOUND, FORBIDDEN, MANAGED_RESOURCE, UNAVAILABLE, INTERNAL_ERROR). The request itself fails only when invalid (an unknown action, no ids, more than 100, a malformed or repeated id) or when permissions can't be checked (503). Shares the on-demand check budget (one unit per request).", + "operationId": "applyMonitorBulkAction", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.MonitorBulkRequest" + } + } + }, + "description": "Action and monitors", + "required": true, + "x-originalParamName": "payload" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.MonitorBulkResult" + } + } + }, + "description": "OK" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Too Many Requests" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Service Unavailable" + } + }, + "summary": "Pause, resume or delete many monitors", + "tags": [ + "Monitors" + ], + "x-norcube-scopes": [ + "monitor.write" + ] + } + }, + "/monitors/{id}": { + "delete": { + "description": "Deletes the monitor and its whole check history. A monitor that belongs to a resource of another service (parentResource set) is refused with 409 MANAGED_RESOURCE: remove it there.", + "operationId": "deleteMonitor", + "parameters": [ + { + "description": "Monitor ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "401": { "content": { "application/json": { "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/response.APIResponseWithPagination" - }, - { - "properties": { - "list": { - "items": { - "$ref": "#/components/schemas/dto.AlertChannel" - }, - "type": "array" - } - }, - "type": "object" - } - ] + "$ref": "#/components/schemas/response.Problem" } } }, - "description": "OK" + "description": "Missing, invalid or expired token (UNAUTHORIZED)" }, - "400": { + "403": { "content": { "application/json": { "schema": { @@ -2862,9 +5240,9 @@ } } }, - "description": "Bad Request" + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" }, - "401": { + "404": { "content": { "application/json": { "schema": { @@ -2872,9 +5250,9 @@ } } }, - "description": "Missing, invalid or expired token (UNAUTHORIZED)" + "description": "Not Found" }, - "403": { + "409": { "content": { "application/json": { "schema": { @@ -2882,47 +5260,44 @@ } } }, - "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + "description": "Managed by another service (MANAGED_RESOURCE)" } }, - "summary": "List alert channels", + "summary": "Delete a monitor", "tags": [ - "Alert channels" + "Monitors" ], "x-norcube-scopes": [ - "monitor.read", - "monitor.check", - "monitor.write", - "monitor.channels" + "monitor.write" ] }, - "post": { - "description": "Creates a channel. A webhook's signing secret (Standard Webhooks, whsec_…) is returned this once; SMS channels get no alerts until their number is verified. Voice-call channels can't be created, nor SMS channels where no SMS provider is configured: 400 with reason CHANNEL_TYPE_UNAVAILABLE.", - "operationId": "createAlertChannel", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/dto.AlertChannelCreate" - } + "get": { + "description": "A monitor with its settings and current status. Secret header values are never returned.", + "operationId": "getMonitor", + "parameters": [ + { + "description": "Monitor ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" } - }, - "description": "Channel", - "required": true, - "x-originalParamName": "payload" - }, + } + ], "responses": { - "201": { + "200": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.AlertChannelWithSecret" + "$ref": "#/components/schemas/dto.Monitor" } } }, - "description": "Created" + "description": "OK" }, - "400": { + "401": { "content": { "application/json": { "schema": { @@ -2930,9 +5305,9 @@ } } }, - "description": "Invalid fields (VALIDATION_FAILED), reason CHANNEL_TYPE_UNAVAILABLE when the kind isn't offered" + "description": "Missing, invalid or expired token (UNAUTHORIZED)" }, - "401": { + "403": { "content": { "application/json": { "schema": { @@ -2940,9 +5315,9 @@ } } }, - "description": "Missing, invalid or expired token (UNAUTHORIZED)" + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" }, - "403": { + "404": { "content": { "application/json": { "schema": { @@ -2950,25 +5325,27 @@ } } }, - "description": "Forbidden, or channel limit reached (LIMIT_REACHED), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + "description": "Not Found" } }, - "summary": "Create an alert channel", + "summary": "Get a monitor", "tags": [ - "Alert channels" + "Monitors" ], "x-norcube-scopes": [ - "monitor.channels" + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" ] - } - }, - "/alert-channels/{id}": { - "delete": { - "description": "Deletes the channel and removes it from every monitor's alert settings. Pending alerts to it are dropped.", - "operationId": "deleteAlertChannel", + }, + "patch": { + "description": "Changes the given fields. A settings object replaces the settings as a whole; omit a secret header's value to keep the stored one. The type can't change, nor the domain of a monitor that belongs to another service's resource.", + "operationId": "updateMonitor", "parameters": [ { - "description": "Channel ID", + "description": "Monitor ID", "in": "path", "name": "id", "required": true, @@ -2978,9 +5355,38 @@ } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.MonitorUpdate" + } + } + }, + "description": "Changes", + "required": true, + "x-originalParamName": "payload" + }, "responses": { - "204": { - "description": "No Content" + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.Monitor" + } + } + }, + "description": "OK" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" }, "401": { "content": { @@ -3011,22 +5417,34 @@ } }, "description": "Not Found" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Service Unavailable" } }, - "summary": "Delete an alert channel", + "summary": "Update a monitor", "tags": [ - "Alert channels" + "Monitors" ], "x-norcube-scopes": [ - "monitor.channels" + "monitor.write" ] - }, + } + }, + "/monitors/{id}/alerts": { "get": { - "description": "One alert channel: kind, name, whether it is a default channel, enabled and verified, and its settings without credentials (a Slack or Discord URL as a hint, a webhook's signing secret never).", - "operationId": "getAlertChannel", + "description": "How the monitor alerts. useDefaults: alerts go to the organization's default channels (or, with none, its members by email) on down, expiring, expired and recovered, with the default confirmations shown. applicableEvents lists the events monitors of this type can send.", + "operationId": "getMonitorAlerts", "parameters": [ { - "description": "Channel ID", + "description": "Monitor ID", "in": "path", "name": "id", "required": true, @@ -3041,7 +5459,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.AlertChannel" + "$ref": "#/components/schemas/dto.MonitorAlerts" } } }, @@ -3078,23 +5496,24 @@ "description": "Not Found" } }, - "summary": "Get an alert channel", + "summary": "Get a monitor's alert settings", "tags": [ - "Alert channels" + "Monitors" ], "x-norcube-scopes": [ "monitor.read", "monitor.check", "monitor.write", - "monitor.channels" + "monitor.channels", + "monitor.statuspages" ] }, - "patch": { - "description": "Changes the given fields. signingSecret is returned when a webhook's secret was rotated or replaced. A voice channel can be renamed but not enabled or given settings (400, reason CHANNEL_TYPE_UNAVAILABLE).", - "operationId": "updateAlertChannel", + "put": { + "description": "Replaces how the monitor alerts: confirmations (failures before an incident opens, successes before it resolves), reminder interval (0: none) and which events go to which channels. An empty routes list sends no alerts. useDefaults: true returns to the organization defaults.", + "operationId": "setMonitorAlerts", "parameters": [ { - "description": "Channel ID", + "description": "Monitor ID", "in": "path", "name": "id", "required": true, @@ -3108,11 +5527,11 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.AlertChannelUpdate" + "$ref": "#/components/schemas/dto.MonitorAlertsUpdate" } } }, - "description": "Changes", + "description": "Alert settings", "required": true, "x-originalParamName": "payload" }, @@ -3121,7 +5540,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.AlertChannelWithSecret" + "$ref": "#/components/schemas/dto.MonitorAlerts" } } }, @@ -3168,22 +5587,22 @@ "description": "Not Found" } }, - "summary": "Update an alert channel", + "summary": "Set a monitor's alert settings", "tags": [ - "Alert channels" + "Monitors" ], "x-norcube-scopes": [ - "monitor.channels" + "monitor.write" ] } }, - "/alert-channels/{id}/deliveries": { + "/monitors/{id}/availability": { "get": { - "description": "Every alert given to this channel, newest first (kept 90 days): the event and monitor (and incident), status (pending: queued or waiting to retry; sent; dead: given up), attempts, the next attempt while pending, and the last error with URLs, email addresses, phone numbers and token-like strings removed. status=dead lists the failures nobody saw.", - "operationId": "listAlertChannelDeliveries", + "description": "One entry per UTC day, oldest first, for the `days` days ending today (default and maximum 90): check counts by severity, uptime % ((ok + warning) / conclusive checks) and an estimate of the minutes spent down (HTTP monitors; absent and 0 for SSL and domain monitors), and noData for a day without checks (draw it gray: it is never 100%). Today is refreshed every few minutes.", + "operationId": "getMonitorAvailability", "parameters": [ { - "description": "Alert channel ID", + "description": "Monitor ID", "in": "path", "name": "id", "required": true, @@ -3193,32 +5612,14 @@ } }, { + "description": "Days is how many UTC days, ending today, the bar covers (default 90).", "in": "query", - "name": "cursor", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "limit", + "name": "days", "schema": { - "maximum": 100, + "maximum": 90, "minimum": 1, "type": "integer" } - }, - { - "in": "query", - "name": "status", - "schema": { - "enum": [ - "pending", - "sent", - "dead" - ], - "type": "string" - } } ], "responses": { @@ -3226,22 +5627,7 @@ "content": { "application/json": { "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/response.APIResponseWithPagination" - }, - { - "properties": { - "list": { - "items": { - "$ref": "#/components/schemas/dto.ChannelDelivery" - }, - "type": "array" - } - }, - "type": "object" - } - ] + "$ref": "#/components/schemas/dto.Availability" } } }, @@ -3288,25 +5674,26 @@ "description": "Not Found" } }, - "summary": "List a channel's deliveries", + "summary": "Get daily availability", "tags": [ - "Alert channels" + "Monitors" ], "x-norcube-scopes": [ "monitor.read", "monitor.check", "monitor.write", - "monitor.channels" + "monitor.channels", + "monitor.statuspages" ] - } - }, - "/alert-channels/{id}/test": { - "post": { - "description": "Sends a test alert right away and returns the provider's reference. Rate limited; an SMS counts toward the daily SMS limit. Refused while the organization is blocked for unpaid invoices.", - "operationId": "testAlertChannel", + } + }, + "/monitors/{id}/certificate": { + "get": { + "description": "The newest certificate an SSL or HTTPS monitor saw: subject, issuer, SANs, validity, serial, the presented chain and whether it verifies, days left counted from now, and (SSL monitors) the expiry thresholds with the alert window and the next threshold to be crossed. 404 when no check has seen a certificate (plain HTTP and domain monitors never do).", + "operationId": "getMonitorCertificate", "parameters": [ { - "description": "Channel ID", + "description": "Monitor ID", "in": "path", "name": "id", "required": true, @@ -3321,7 +5708,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.AlertChannelTestResult" + "$ref": "#/components/schemas/dto.MonitorCertificate" } } }, @@ -3337,16 +5724,6 @@ }, "description": "Missing, invalid or expired token (UNAUTHORIZED)" }, - "402": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Organization blocked for unpaid invoices" - }, "403": { "content": { "application/json": { @@ -3366,54 +5743,28 @@ } }, "description": "Not Found" - }, - "409": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "The provider refused it, the contact isn't verified, or a voice channel (CHANNEL_TYPE_UNAVAILABLE)" - }, - "429": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Too Many Requests" - }, - "503": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "The provider didn't answer; retry" } }, - "summary": "Send a test alert", + "summary": "Get the latest certificate", "tags": [ - "Alert channels" + "Monitors" ], "x-norcube-scopes": [ - "monitor.channels" + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" ] } }, - "/alert-channels/{id}/verify": { + "/monitors/{id}/check": { "post": { - "description": "Texts (or, for an email-address channel, emails) a 6-digit code valid for 10 minutes. At most once a minute; an SMS counts toward the daily SMS limit.", - "operationId": "sendAlertChannelVerification", + "description": "Runs the monitor's check immediately (paused monitors too) and returns the stored result. Billed like a scheduled check; rate limited.", + "operationId": "runMonitorCheck", "parameters": [ { - "description": "Channel ID", + "description": "Monitor ID", "in": "path", "name": "id", "required": true, @@ -3424,8 +5775,15 @@ } ], "responses": { - "204": { - "description": "No Content" + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.CheckResult" + } + } + }, + "description": "OK" }, "401": { "content": { @@ -3445,7 +5803,7 @@ } } }, - "description": "ORG_BLOCKED: unpaid invoices" + "description": "Organization blocked for unpaid invoices" }, "403": { "content": { @@ -3467,7 +5825,7 @@ }, "description": "Not Found" }, - "409": { + "429": { "content": { "application/json": { "schema": { @@ -3475,25 +5833,26 @@ } } }, - "description": "Nothing to verify, already verified, a code was just sent, or a voice channel (CHANNEL_TYPE_UNAVAILABLE)" + "description": "Too Many Requests" } }, - "summary": "Send a verification code", + "summary": "Run a check now", "tags": [ - "Alert channels" + "Monitors" ], "x-norcube-scopes": [ - "monitor.channels" + "monitor.check", + "monitor.write" ] } }, - "/alert-channels/{id}/verify/confirm": { + "/monitors/{id}/pause": { "post": { - "description": "Verifies the channel's number with the code sent. Five wrong codes (or an expired one) need a new code.", - "operationId": "confirmAlertChannelVerification", + "description": "Stops scheduled checks. Idempotent.", + "operationId": "pauseMonitor", "parameters": [ { - "description": "Channel ID", + "description": "Monitor ID", "in": "path", "name": "id", "required": true, @@ -3503,39 +5862,17 @@ } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/dto.AlertChannelVerifyConfirm" - } - } - }, - "description": "Code", - "required": true, - "x-originalParamName": "payload" - }, "responses": { "200": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.AlertChannel" + "$ref": "#/components/schemas/dto.Monitor" } } }, "description": "OK" }, - "400": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Wrong code" - }, "401": { "content": { "application/json": { @@ -3565,54 +5902,29 @@ } }, "description": "Not Found" - }, - "409": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Expired, or too many attempts" } }, - "summary": "Confirm a verification code", + "summary": "Pause a monitor", "tags": [ - "Alert channels" + "Monitors" ], "x-norcube-scopes": [ - "monitor.channels" + "monitor.write" ] } }, - "/incidents": { + "/monitors/{id}/results": { "get": { - "description": "The organization's incidents: open ones first (critical, then warning), then resolved ones, newest first within each. Filter by status (open, resolved), monitor, severity (an open incident's current severity, a resolved one's peak), aspect, acknowledged, q (part of the monitor's name or target, any case, at most 100 characters) and when it started (from inclusive, to exclusive). Every filter given must match. Rows carry the monitor's name, type, variant and target. An invalid filter is a VALIDATION_FAILED problem with the parameter's pointer (\"/severity\").", - "operationId": "listIncidents", + "description": "The monitor's check history in [from, to), newest first. Defaults to the last 24 hours. Raw results are kept at least 30 days (whole months are dropped once entirely past retention).", + "operationId": "listMonitorResults", "parameters": [ { - "description": "Acknowledged: true for incidents someone acknowledged, false for\nthe others.", - "in": "query", - "name": "acknowledged", - "schema": { - "enum": [ - "true", - "false" - ], - "type": "string" - } - }, - { - "description": "Aspect is what the incident is about.", - "in": "query", - "name": "aspect", + "description": "Monitor ID", + "in": "path", + "name": "id", + "required": true, "schema": { - "enum": [ - "availability", - "certificate", - "domain" - ], + "format": "uuid", "type": "string" } }, @@ -3624,7 +5936,6 @@ } }, { - "description": "From and To bound when the incident started: from inclusive, to\nexclusive (RFC 3339).", "in": "query", "name": "from", "schema": { @@ -3636,51 +5947,11 @@ "in": "query", "name": "limit", "schema": { - "maximum": 100, + "maximum": 200, "minimum": 1, "type": "integer" } }, - { - "in": "query", - "name": "monitorId", - "schema": { - "format": "uuid", - "type": "string" - } - }, - { - "description": "Q is part of the monitor's name or target, any case.", - "in": "query", - "name": "q", - "schema": { - "maxLength": 100, - "type": "string" - } - }, - { - "description": "Severity matches an open incident's current severity and a resolved\none's peak severity (how bad it got).", - "in": "query", - "name": "severity", - "schema": { - "enum": [ - "warning", - "critical" - ], - "type": "string" - } - }, - { - "in": "query", - "name": "status", - "schema": { - "enum": [ - "open", - "resolved" - ], - "type": "string" - } - }, { "in": "query", "name": "to", @@ -3703,7 +5974,7 @@ "properties": { "list": { "items": { - "$ref": "#/components/schemas/dto.Incident" + "$ref": "#/components/schemas/dto.CheckResult" }, "type": "array" } @@ -3745,46 +6016,8 @@ } }, "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" - } - }, - "summary": "List incidents", - "tags": [ - "Incidents" - ], - "x-norcube-scopes": [ - "monitor.read", - "monitor.check", - "monitor.write", - "monitor.channels" - ] - } - }, - "/incidents/summary": { - "get": { - "description": "The organization's incidents at a glance, for a page header: open incidents by current severity and those nobody acknowledged, incidents resolved in the last 7 days, and the mean time to resolve (opened to resolved) of incidents resolved in the last 30 days. Takes no filters: it describes the organization, not a list view.", - "operationId": "getIncidentSummary", - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/dto.IncidentSummary" - } - } - }, - "description": "OK" - }, - "401": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Missing, invalid or expired token (UNAUTHORIZED)" }, - "403": { + "404": { "content": { "application/json": { "schema": { @@ -3792,28 +6025,29 @@ } } }, - "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + "description": "Not Found" } }, - "summary": "Summarize incidents", + "summary": "List check results", "tags": [ - "Incidents" + "Monitors" ], "x-norcube-scopes": [ "monitor.read", "monitor.check", "monitor.write", - "monitor.channels" + "monitor.channels", + "monitor.statuspages" ] } }, - "/incidents/{id}": { - "get": { - "description": "An incident with its timeline and every alert sent for it (with delivery status, so a failing channel shows here).", - "operationId": "getIncident", + "/monitors/{id}/resume": { + "post": { + "description": "Restarts scheduled checks; the next one runs right away. Idempotent.", + "operationId": "resumeMonitor", "parameters": [ { - "description": "Incident ID", + "description": "Monitor ID", "in": "path", "name": "id", "required": true, @@ -3828,7 +6062,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.IncidentDetail" + "$ref": "#/components/schemas/dto.Monitor" } } }, @@ -3865,25 +6099,22 @@ "description": "Not Found" } }, - "summary": "Get an incident", + "summary": "Resume a monitor", "tags": [ - "Incidents" + "Monitors" ], "x-norcube-scopes": [ - "monitor.read", - "monitor.check", - "monitor.write", - "monitor.channels" + "monitor.write" ] } }, - "/incidents/{id}/acknowledge": { - "post": { - "description": "Marks an open incident as being handled: its reminders stop. Idempotent; a resolved incident is returned unchanged.", - "operationId": "acknowledgeIncident", + "/monitors/{id}/stats": { + "get": { + "description": "Uptime %, latency and a bucketed series for the range ending now (hourly up to 7d, daily beyond). Uptime is (ok + warning) / (ok + warning + critical), HTTP monitors only. Refreshed every few minutes.", + "operationId": "getMonitorStats", "parameters": [ { - "description": "Incident ID", + "description": "Monitor ID", "in": "path", "name": "id", "required": true, @@ -3891,6 +6122,20 @@ "format": "uuid", "type": "string" } + }, + { + "in": "query", + "name": "range", + "required": true, + "schema": { + "enum": [ + "24h", + "7d", + "30d", + "90d" + ], + "type": "string" + } } ], "responses": { @@ -3898,12 +6143,22 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.IncidentDetail" + "$ref": "#/components/schemas/dto.MonitorStats" } } }, "description": "OK" }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" + }, "401": { "content": { "application/json": { @@ -3935,35 +6190,38 @@ "description": "Not Found" } }, - "summary": "Acknowledge an incident", + "summary": "Get uptime stats", "tags": [ - "Incidents" + "Monitors" ], "x-norcube-scopes": [ - "monitor.write" + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" ] } }, - "/monitors": { + "/monitors/{id}/status-changes": { "get": { - "description": "The organization's monitors with their current status, by default ordered by status severity (critical, warning, pending, ok, paused) then name; `sort` picks another order, and a cursor only continues the sort it came from. `status` is the severity of the last conclusive check (an inconclusive one, such as a failed registry lookup, never moves it) and `condition` its reason with facts (days left for SSL and domain monitors). Rows of HTTP monitors have `last24h` (checks by severity, uptime and warning share, approximate p50/p95 over the last 24 full hours plus the current one; no data is absent, not 100%). `include=history` adds each row's newest 60 results (`history`, newest first) for a heartbeat strip. Rows carry no settings; `variant` names what each monitor does (`keyword` for an HTTP monitor that looks for a keyword).", - "operationId": "listMonitors", + "description": "Every time a check moved the monitor to another status, newest first: from, to, when, how long it lasted (endedAt absent and the duration running until now for the newest), and what the check said (condition, statusCode, message). Inconclusive checks never change the status. Each change carries `events`: what else happened while its status lasted, newest first (`certificate_renewed` with the previous and the new certificate, for SSL monitors and HTTP monitors that watch their certificate; no alert is sent for it). Kept a year. Pausing is not a status change (see the audit log).", + "operationId": "listMonitorStatusChanges", "parameters": [ { - "in": "query", - "name": "cursor", + "description": "Monitor ID", + "in": "path", + "name": "id", + "required": true, "schema": { + "format": "uuid", "type": "string" } }, { - "description": "Include is a comma-separated list of optional row parts: history\nadds each row's last 60 check results.", "in": "query", - "name": "include", + "name": "cursor", "schema": { - "enum": [ - "history" - ], "type": "string" } }, @@ -3975,55 +6233,6 @@ "minimum": 1, "type": "integer" } - }, - { - "in": "query", - "name": "q", - "schema": { - "type": "string" - } - }, - { - "description": "Sort: status (default, by overall status: critical, warning,\npending, ok, paused, then name), name (A to Z), lastChecked (most recent first), uptime\n(lowest over last24h first; no data, and SSL and domain monitors,\nlast), created (newest first).\nA cursor only continues the sort it came from.", - "in": "query", - "name": "sort", - "schema": { - "enum": [ - "status", - "name", - "lastChecked", - "uptime", - "created" - ], - "type": "string" - } - }, - { - "description": "Status matches the overall status (the worst of the monitor's status\nand its watched aspects').", - "in": "query", - "name": "status", - "schema": { - "enum": [ - "pending", - "ok", - "warning", - "critical", - "paused" - ], - "type": "string" - } - }, - { - "in": "query", - "name": "type", - "schema": { - "enum": [ - "http", - "ssl", - "domain" - ], - "type": "string" - } } ], "responses": { @@ -4039,7 +6248,7 @@ "properties": { "list": { "items": { - "$ref": "#/components/schemas/dto.Monitor" + "$ref": "#/components/schemas/dto.StatusChange" }, "type": "array" } @@ -4081,9 +6290,19 @@ } }, "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" } }, - "summary": "List monitors", + "summary": "List status changes", "tags": [ "Monitors" ], @@ -4091,34 +6310,67 @@ "monitor.read", "monitor.check", "monitor.write", - "monitor.channels" + "monitor.channels", + "monitor.statuspages" ] - }, - "post": { - "description": "Creates an enabled monitor; its first check runs right away. Every check setting is required.", - "operationId": "createMonitor", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/dto.MonitorCreate" - } + } + }, + "/status-pages": { + "get": { + "description": "The organization's status pages, newest first. With monitorId, the pages that show that monitor instead (at most 50, not paginated).", + "operationId": "listStatusPages", + "parameters": [ + { + "in": "query", + "name": "cursor", + "schema": { + "type": "string" } }, - "description": "Monitor", - "required": true, - "x-originalParamName": "payload" - }, + { + "in": "query", + "name": "limit", + "schema": { + "maximum": 100, + "minimum": 1, + "type": "integer" + } + }, + { + "description": "MonitorID lists the pages that show this monitor instead (at most 50,\nnot paginated).", + "in": "query", + "name": "monitorId", + "schema": { + "format": "uuid", + "type": "string" + } + } + ], "responses": { - "201": { + "200": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.Monitor" + "allOf": [ + { + "$ref": "#/components/schemas/response.APIResponseWithPagination" + }, + { + "properties": { + "list": { + "items": { + "$ref": "#/components/schemas/dto.StatusPage" + }, + "type": "array" + } + }, + "type": "object" + } + ] } } }, - "description": "Created" + "description": "OK" }, "400": { "content": { @@ -4140,16 +6392,6 @@ }, "description": "Missing, invalid or expired token (UNAUTHORIZED)" }, - "402": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Organization blocked for unpaid invoices" - }, "403": { "content": { "application/json": { @@ -4158,54 +6400,46 @@ } } }, - "description": "Forbidden, or monitor limit reached (LIMIT_REACHED), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" - }, - "503": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Service Unavailable" + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" } }, - "summary": "Create a monitor", + "summary": "List status pages", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.write" + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" ] - } - }, - "/monitors/bulk": { + }, "post": { - "description": "Applies one action to up to 100 monitors, each exactly as its own request would (pause closes its open incident, resume checks soon, delete refuses a linked monitor with MANAGED_RESOURCE) after an IAM check on that monitor (UpdateMonitor for pause/resume, DeleteMonitor for delete). Not atomic: the answer has one item per id, in request order, ok or the problem code that monitor's own request would have had (NOT_FOUND, FORBIDDEN, MANAGED_RESOURCE, UNAVAILABLE, INTERNAL_ERROR). The request itself fails only when invalid (an unknown action, no ids, more than 100, a malformed or repeated id) or when permissions can't be checked (503). Shares the on-demand check budget (one unit per request).", - "operationId": "applyMonitorBulkAction", + "description": "Creates a page, unpublished: add components with PUT layout, check it with a preview link, then publish it. The slug is its public address and must be free: 409 with reason SLUG_TAKEN. Past the plan's limit: 403 with reason STATUS_PAGE_LIMIT. An organization with unpaid invoices: 402.", + "operationId": "createStatusPage", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.MonitorBulkRequest" + "$ref": "#/components/schemas/dto.StatusPageCreate" } } }, - "description": "Action and monitors", + "description": "The page", "required": true, - "x-originalParamName": "payload" + "x-originalParamName": "body" }, "responses": { - "200": { + "201": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.MonitorBulkResult" + "$ref": "#/components/schemas/dto.StatusPage" } } }, - "description": "OK" + "description": "Created" }, "400": { "content": { @@ -4227,7 +6461,7 @@ }, "description": "Missing, invalid or expired token (UNAUTHORIZED)" }, - "403": { + "402": { "content": { "application/json": { "schema": { @@ -4235,9 +6469,9 @@ } } }, - "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + "description": "Payment Required" }, - "429": { + "403": { "content": { "application/json": { "schema": { @@ -4245,9 +6479,9 @@ } } }, - "description": "Too Many Requests" + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" }, - "503": { + "409": { "content": { "application/json": { "schema": { @@ -4255,25 +6489,25 @@ } } }, - "description": "Service Unavailable" + "description": "Conflict" } }, - "summary": "Pause, resume or delete many monitors", + "summary": "Create a status page", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.write" + "monitor.statuspages" ] } }, - "/monitors/{id}": { + "/status-pages/{id}": { "delete": { - "description": "Deletes the monitor and its whole check history. A monitor that belongs to a resource of another service (parentResource set) is refused with 409 MANAGED_RESOURCE: remove it there.", - "operationId": "deleteMonitor", + "description": "Deletes a page with its layout and posted incidents, and takes it offline. The monitors stay.", + "operationId": "deleteStatusPage", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -4316,32 +6550,22 @@ } }, "description": "Not Found" - }, - "409": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Managed by another service (MANAGED_RESOURCE)" } }, - "summary": "Delete a monitor", + "summary": "Delete a status page", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.write" + "monitor.statuspages" ] }, "get": { - "description": "A monitor with its settings and current status. Secret header values are never returned.", - "operationId": "getMonitor", + "description": "One page with its settings and public address.", + "operationId": "getStatusPage", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -4356,7 +6580,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.Monitor" + "$ref": "#/components/schemas/dto.StatusPage" } } }, @@ -4393,23 +6617,24 @@ "description": "Not Found" } }, - "summary": "Get a monitor", + "summary": "Get a status page", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ "monitor.read", "monitor.check", "monitor.write", - "monitor.channels" + "monitor.channels", + "monitor.statuspages" ] }, "patch": { - "description": "Changes the given fields. A settings object replaces the settings as a whole; omit a secret header's value to keep the stored one. The type can't change, nor the domain of a monitor that belongs to another service's resource.", - "operationId": "updateMonitor", + "description": "Changes a page's address, name, description or settings; omitted fields stay. A published page that changes its slug redirects from the old address for 30 days.", + "operationId": "updateStatusPage", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -4423,20 +6648,20 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.MonitorUpdate" + "$ref": "#/components/schemas/dto.StatusPageUpdate" } } }, - "description": "Changes", + "description": "The changes", "required": true, - "x-originalParamName": "payload" + "x-originalParamName": "body" }, "responses": { "200": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.Monitor" + "$ref": "#/components/schemas/dto.StatusPage" } } }, @@ -4482,7 +6707,7 @@ }, "description": "Not Found" }, - "503": { + "409": { "content": { "application/json": { "schema": { @@ -4490,25 +6715,25 @@ } } }, - "description": "Service Unavailable" + "description": "Conflict" } }, - "summary": "Update a monitor", + "summary": "Update a status page", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.write" + "monitor.statuspages" ] } }, - "/monitors/{id}/alerts": { + "/status-pages/{id}/incidents": { "get": { - "description": "How the monitor alerts. useDefaults: alerts go to the organization's default channels (or, with none, its members by email) on down, expiring, expired and recovered, with the default confirmations shown. applicableEvents lists the events monitors of this type can send.", - "operationId": "getMonitorAlerts", + "description": "The incidents posted on this page, newest first, with their updates. These are public posts, not the monitors' own incidents.", + "operationId": "listStatusPageIncidents", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -4516,6 +6741,34 @@ "format": "uuid", "type": "string" } + }, + { + "in": "query", + "name": "cursor", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "maximum": 100, + "minimum": 1, + "type": "integer" + } + }, + { + "description": "Status filters on open or resolved.", + "in": "query", + "name": "status", + "schema": { + "enum": [ + "open", + "resolved" + ], + "type": "string" + } } ], "responses": { @@ -4523,12 +6776,37 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.MonitorAlerts" + "allOf": [ + { + "$ref": "#/components/schemas/response.APIResponseWithPagination" + }, + { + "properties": { + "list": { + "items": { + "$ref": "#/components/schemas/dto.StatusPageIncident" + }, + "type": "array" + } + }, + "type": "object" + } + ] } } }, "description": "OK" }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" + }, "401": { "content": { "application/json": { @@ -4560,23 +6838,24 @@ "description": "Not Found" } }, - "summary": "Get a monitor's alert settings", + "summary": "List a status page's posted incidents", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ "monitor.read", "monitor.check", "monitor.write", - "monitor.channels" + "monitor.channels", + "monitor.statuspages" ] }, - "put": { - "description": "Replaces how the monitor alerts: confirmations (failures before an incident opens, successes before it resolves), reminder interval (0: none) and which events go to which channels. An empty routes list sends no alerts. useDefaults: true returns to the organization defaults.", - "operationId": "setMonitorAlerts", + "post": { + "description": "Posts an incident with its first update. Public as soon as it is posted (within a minute) when the page is published. While it is open, the components it names show the status it gives them.", + "operationId": "createStatusPageIncident", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -4590,24 +6869,24 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.MonitorAlertsUpdate" + "$ref": "#/components/schemas/dto.StatusPageIncidentCreate" } } }, - "description": "Alert settings", + "description": "The post", "required": true, - "x-originalParamName": "payload" + "x-originalParamName": "body" }, "responses": { - "200": { + "201": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.MonitorAlerts" + "$ref": "#/components/schemas/dto.StatusPageIncident" } } }, - "description": "OK" + "description": "Created" }, "400": { "content": { @@ -4650,22 +6929,22 @@ "description": "Not Found" } }, - "summary": "Set a monitor's alert settings", + "summary": "Post an incident on a status page", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.write" + "monitor.statuspages" ] } }, - "/monitors/{id}/availability": { + "/status-pages/{id}/incidents/{incidentId}": { "get": { - "description": "One entry per UTC day, oldest first, for the `days` days ending today (default and maximum 90): check counts by severity, uptime % ((ok + warning) / conclusive checks) and an estimate of the minutes spent down (HTTP monitors; absent and 0 for SSL and domain monitors), and noData for a day without checks (draw it gray: it is never 100%). Today is refreshed every few minutes.", - "operationId": "getMonitorAvailability", + "description": "One post with its updates, the components it affects and the monitor incidents it links to.", + "operationId": "getStatusPageIncident", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -4675,13 +6954,13 @@ } }, { - "description": "Days is how many UTC days, ending today, the bar covers (default 90).", - "in": "query", - "name": "days", + "description": "Posted incident ID", + "in": "path", + "name": "incidentId", + "required": true, "schema": { - "maximum": 90, - "minimum": 1, - "type": "integer" + "format": "uuid", + "type": "string" } } ], @@ -4690,7 +6969,98 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.Availability" + "$ref": "#/components/schemas/dto.StatusPageIncident" + } + } + }, + "description": "OK" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Missing, invalid or expired token (UNAUTHORIZED)" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "No permission for this (FORBIDDEN), or the token's scopes don't allow this (reason INSUFFICIENT_SCOPE)" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Not Found" + } + }, + "summary": "Get a posted incident", + "tags": [ + "Status pages" + ], + "x-norcube-scopes": [ + "monitor.read", + "monitor.check", + "monitor.write", + "monitor.channels", + "monitor.statuspages" + ] + }, + "patch": { + "description": "Corrects the title, impact, start, affected components or links; omitted fields stay. The status moves by posting an update.", + "operationId": "updateStatusPageIncident", + "parameters": [ + { + "description": "Status page ID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + }, + { + "description": "Posted incident ID", + "in": "path", + "name": "incidentId", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.StatusPageIncidentUpdate" + } + } + }, + "description": "The corrections", + "required": true, + "x-originalParamName": "body" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.StatusPageIncident" } } }, @@ -4737,25 +7107,22 @@ "description": "Not Found" } }, - "summary": "Get daily availability", + "summary": "Correct a posted incident", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.read", - "monitor.check", - "monitor.write", - "monitor.channels" + "monitor.statuspages" ] } }, - "/monitors/{id}/certificate": { - "get": { - "description": "The newest certificate an SSL or HTTPS monitor saw: subject, issuer, SANs, validity, serial, the presented chain and whether it verifies, days left counted from now, and (SSL monitors) the expiry thresholds with the alert window and the next threshold to be crossed. 404 when no check has seen a certificate (plain HTTP and domain monitors never do).", - "operationId": "getMonitorCertificate", + "/status-pages/{id}/incidents/{incidentId}/updates": { + "post": { + "description": "Adds an update; its status becomes the incident's, and resolved ends the incident. A resolved incident takes no more updates: 409 with reason INCIDENT_RESOLVED.", + "operationId": "createStatusPageIncidentUpdate", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -4763,18 +7130,50 @@ "format": "uuid", "type": "string" } + }, + { + "description": "Posted incident ID", + "in": "path", + "name": "incidentId", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.StatusPageIncidentPost" + } + } + }, + "description": "The update", + "required": true, + "x-originalParamName": "body" + }, "responses": { - "200": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.StatusPageIncident" + } + } + }, + "description": "Created" + }, + "400": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.MonitorCertificate" + "$ref": "#/components/schemas/response.Problem" } } }, - "description": "OK" + "description": "Bad Request" }, "401": { "content": { @@ -4805,27 +7204,34 @@ } }, "description": "Not Found" + }, + "409": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Conflict" } }, - "summary": "Get the latest certificate", + "summary": "Post an update on an incident", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.read", - "monitor.check", - "monitor.write", - "monitor.channels" + "monitor.statuspages" ] } }, - "/monitors/{id}/check": { - "post": { - "description": "Runs the monitor's check immediately (paused monitors too) and returns the stored result. Billed like a scheduled check; rate limited.", - "operationId": "runMonitorCheck", + "/status-pages/{id}/layout": { + "get": { + "description": "What the page shows, in order: the components outside any group, then the groups.", + "operationId": "getStatusPageLayout", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -4840,7 +7246,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.CheckResult" + "$ref": "#/components/schemas/dto.StatusPageLayout" } } }, @@ -4856,16 +7262,6 @@ }, "description": "Missing, invalid or expired token (UNAUTHORIZED)" }, - "402": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Organization blocked for unpaid invoices" - }, "403": { "content": { "application/json": { @@ -4885,35 +7281,26 @@ } }, "description": "Not Found" - }, - "429": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Too Many Requests" } }, - "summary": "Run a check now", + "summary": "Get a status page's layout", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ + "monitor.read", "monitor.check", - "monitor.write" + "monitor.write", + "monitor.channels", + "monitor.statuspages" ] - } - }, - "/monitors/{id}/pause": { - "post": { - "description": "Stops scheduled checks. Idempotent.", - "operationId": "pauseMonitor", + }, + "put": { + "description": "Replaces the layout as a whole, in the order given. Send a row's id to keep it (posted incidents name components by id); leave it out for a new one; rows left out are removed. Adding a monitor publishes its status, so you must be able to read every monitor you name. A public name is required; the monitor's name and target are never shown.", + "operationId": "setStatusPageLayout", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -4923,17 +7310,39 @@ } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dto.StatusPageLayout" + } + } + }, + "description": "The whole layout", + "required": true, + "x-originalParamName": "body" + }, "responses": { "200": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.Monitor" + "$ref": "#/components/schemas/dto.StatusPageLayout" } } }, "description": "OK" }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Bad Request" + }, "401": { "content": { "application/json": { @@ -4965,22 +7374,22 @@ "description": "Not Found" } }, - "summary": "Pause a monitor", + "summary": "Replace a status page's layout", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.write" + "monitor.statuspages" ] } }, - "/monitors/{id}/results": { + "/status-pages/{id}/preview": { "get": { - "description": "The monitor's check history in [from, to), newest first. Defaults to the last 24 hours. Raw results are kept at least 30 days (whole months are dropped once entirely past retention).", - "operationId": "listMonitorResults", + "description": "Exactly what the public would get for this page right now, published or not: the page snapshot and the incident history.", + "operationId": "previewStatusPage", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -4988,38 +7397,6 @@ "format": "uuid", "type": "string" } - }, - { - "in": "query", - "name": "cursor", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "from", - "schema": { - "format": "date-time", - "type": "string" - } - }, - { - "in": "query", - "name": "limit", - "schema": { - "maximum": 200, - "minimum": 1, - "type": "integer" - } - }, - { - "in": "query", - "name": "to", - "schema": { - "format": "date-time", - "type": "string" - } } ], "responses": { @@ -5027,37 +7404,12 @@ "content": { "application/json": { "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/response.APIResponseWithPagination" - }, - { - "properties": { - "list": { - "items": { - "$ref": "#/components/schemas/dto.CheckResult" - }, - "type": "array" - } - }, - "type": "object" - } - ] + "$ref": "#/components/schemas/dto.PublicStatusPreview" } } }, "description": "OK" }, - "400": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Bad Request" - }, "401": { "content": { "application/json": { @@ -5089,25 +7441,26 @@ "description": "Not Found" } }, - "summary": "List check results", + "summary": "Preview a status page's data", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ "monitor.read", "monitor.check", "monitor.write", - "monitor.channels" + "monitor.channels", + "monitor.statuspages" ] } }, - "/monitors/{id}/resume": { + "/status-pages/{id}/preview-link": { "post": { - "description": "Restarts scheduled checks; the next one runs right away. Idempotent.", - "operationId": "resumeMonitor", + "description": "A link to the rendered page that works for 15 minutes, published or not. Anyone with the link can open it while it works.", + "operationId": "createStatusPagePreviewLink", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -5122,7 +7475,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.Monitor" + "$ref": "#/components/schemas/dto.StatusPagePreviewLink" } } }, @@ -5159,22 +7512,22 @@ "description": "Not Found" } }, - "summary": "Resume a monitor", + "summary": "Create a preview link", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.write" + "monitor.statuspages" ] } }, - "/monitors/{id}/stats": { - "get": { - "description": "Uptime %, latency and a bucketed series for the range ending now (hourly up to 7d, daily beyond). Uptime is (ok + warning) / (ok + warning + critical), HTTP monitors only. Refreshed every few minutes.", - "operationId": "getMonitorStats", + "/status-pages/{id}/publish": { + "post": { + "description": "Makes the page public at its address, within a minute. It needs at least one component: 409 otherwise. Publishing a published page changes nothing.", + "operationId": "publishStatusPage", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -5182,20 +7535,6 @@ "format": "uuid", "type": "string" } - }, - { - "in": "query", - "name": "range", - "required": true, - "schema": { - "enum": [ - "24h", - "7d", - "30d", - "90d" - ], - "type": "string" - } } ], "responses": { @@ -5203,13 +7542,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/dto.MonitorStats" + "$ref": "#/components/schemas/dto.StatusPage" } } }, "description": "OK" }, - "400": { + "401": { "content": { "application/json": { "schema": { @@ -5217,9 +7556,9 @@ } } }, - "description": "Bad Request" + "description": "Missing, invalid or expired token (UNAUTHORIZED)" }, - "401": { + "402": { "content": { "application/json": { "schema": { @@ -5227,7 +7566,7 @@ } } }, - "description": "Missing, invalid or expired token (UNAUTHORIZED)" + "description": "Payment Required" }, "403": { "content": { @@ -5248,27 +7587,34 @@ } }, "description": "Not Found" + }, + "409": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/response.Problem" + } + } + }, + "description": "Conflict" } }, - "summary": "Get uptime stats", + "summary": "Publish a status page", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.read", - "monitor.check", - "monitor.write", - "monitor.channels" + "monitor.statuspages" ] } }, - "/monitors/{id}/status-changes": { - "get": { - "description": "Every time a check moved the monitor to another status, newest first: from, to, when, how long it lasted (endedAt absent and the duration running until now for the newest), and what the check said (condition, statusCode, message). Inconclusive checks never change the status. Each change carries `events`: what else happened while its status lasted, newest first (`certificate_renewed` with the previous and the new certificate, for SSL monitors and HTTP monitors that watch their certificate; no alert is sent for it). Kept a year. Pausing is not a status change (see the audit log).", - "operationId": "listMonitorStatusChanges", + "/status-pages/{id}/unpublish": { + "post": { + "description": "Takes the page offline; its address answers 404 within a minute. Everything on it stays, and publishing brings it back.", + "operationId": "unpublishStatusPage", "parameters": [ { - "description": "Monitor ID", + "description": "Status page ID", "in": "path", "name": "id", "required": true, @@ -5276,22 +7622,6 @@ "format": "uuid", "type": "string" } - }, - { - "in": "query", - "name": "cursor", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "limit", - "schema": { - "maximum": 100, - "minimum": 1, - "type": "integer" - } } ], "responses": { @@ -5299,37 +7629,12 @@ "content": { "application/json": { "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/response.APIResponseWithPagination" - }, - { - "properties": { - "list": { - "items": { - "$ref": "#/components/schemas/dto.StatusChange" - }, - "type": "array" - } - }, - "type": "object" - } - ] + "$ref": "#/components/schemas/dto.StatusPage" } } }, "description": "OK" }, - "400": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/response.Problem" - } - } - }, - "description": "Bad Request" - }, "401": { "content": { "application/json": { @@ -5361,15 +7666,12 @@ "description": "Not Found" } }, - "summary": "List status changes", + "summary": "Unpublish a status page", "tags": [ - "Monitors" + "Status pages" ], "x-norcube-scopes": [ - "monitor.read", - "monitor.check", - "monitor.write", - "monitor.channels" + "monitor.statuspages" ] } }