Repository navigation
Expand file tree
/
Copy pathinterface.go
More file actions
107 lines (96 loc) · 5.1 KB
/
Copy pathinterface.go
File metadata and controls
107 lines (96 loc) · 5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// Copyright (c) 2026 Develeap
// SPDX-License-Identifier: MIT
package hyperping
import (
"context"
"iter"
)
// MonitorAPI defines the interface for monitor operations.
// This interface enables mocking in unit tests.
type MonitorAPI interface {
ListMonitors(ctx context.Context) ([]Monitor, error)
GetMonitor(ctx context.Context, uuid string) (*Monitor, error)
CreateMonitor(ctx context.Context, req CreateMonitorRequest) (*Monitor, error)
UpdateMonitor(ctx context.Context, uuid string, req UpdateMonitorRequest) (*Monitor, error)
DeleteMonitor(ctx context.Context, uuid string) error
PauseMonitor(ctx context.Context, uuid string) (*Monitor, error)
ResumeMonitor(ctx context.Context, uuid string) (*Monitor, error)
IterMonitors(ctx context.Context) iter.Seq2[Monitor, error]
}
// IncidentAPI defines the interface for incident operations.
// This interface enables mocking in unit tests.
type IncidentAPI interface {
ListIncidents(ctx context.Context) ([]Incident, error)
GetIncident(ctx context.Context, id string) (*Incident, error)
CreateIncident(ctx context.Context, req CreateIncidentRequest) (*Incident, error)
UpdateIncident(ctx context.Context, id string, req UpdateIncidentRequest) (*Incident, error)
DeleteIncident(ctx context.Context, id string) error
AddIncidentUpdate(ctx context.Context, uuid string, req AddIncidentUpdateRequest) (*Incident, error)
ResolveIncident(ctx context.Context, uuid string, message string) (*Incident, error)
IterIncidents(ctx context.Context) iter.Seq2[Incident, error]
}
// MaintenanceAPI defines the interface for maintenance operations.
// This interface enables mocking in unit tests.
type MaintenanceAPI interface {
ListMaintenance(ctx context.Context) ([]Maintenance, error)
GetMaintenance(ctx context.Context, id string) (*Maintenance, error)
CreateMaintenance(ctx context.Context, req CreateMaintenanceRequest) (*Maintenance, error)
UpdateMaintenance(ctx context.Context, id string, req UpdateMaintenanceRequest) (*Maintenance, error)
DeleteMaintenance(ctx context.Context, id string) error
}
// ReportsAPI defines the interface for reporting operations.
// This interface enables mocking in unit tests.
type ReportsAPI interface {
GetMonitorReport(ctx context.Context, uuid string, from, to string) (*MonitorReport, error)
ListMonitorReports(ctx context.Context, from, to string) ([]MonitorReport, error)
}
// OutageAPI defines the interface for outage operations.
// This interface enables mocking in unit tests.
type OutageAPI interface {
GetOutage(ctx context.Context, uuid string) (*Outage, error)
ListOutages(ctx context.Context, opts ...OutageListOption) ([]Outage, error)
CreateOutage(ctx context.Context, req CreateOutageRequest) (*Outage, error)
AcknowledgeOutage(ctx context.Context, uuid string) (*OutageAction, error)
UnacknowledgeOutage(ctx context.Context, uuid string) (*OutageAction, error)
ResolveOutage(ctx context.Context, uuid string) (*OutageAction, error)
EscalateOutage(ctx context.Context, uuid string) (*OutageAction, error)
DeleteOutage(ctx context.Context, uuid string) error
}
// HealthcheckAPI defines the interface for healthcheck operations.
// This interface enables mocking in unit tests.
type HealthcheckAPI interface {
GetHealthcheck(ctx context.Context, uuid string) (*Healthcheck, error)
ListHealthchecks(ctx context.Context) ([]Healthcheck, error)
CreateHealthcheck(ctx context.Context, req CreateHealthcheckRequest) (*Healthcheck, error)
UpdateHealthcheck(ctx context.Context, uuid string, req UpdateHealthcheckRequest) (*Healthcheck, error)
DeleteHealthcheck(ctx context.Context, uuid string) error
PauseHealthcheck(ctx context.Context, uuid string) (*HealthcheckAction, error)
ResumeHealthcheck(ctx context.Context, uuid string) (*HealthcheckAction, error)
}
// StatusPageAPI defines the interface for status page operations.
// This interface enables mocking in unit tests.
type StatusPageAPI interface {
ListStatusPages(ctx context.Context, page *int, search *string) (*StatusPagePaginatedResponse, error)
GetStatusPage(ctx context.Context, uuid string) (*StatusPage, error)
CreateStatusPage(ctx context.Context, req CreateStatusPageRequest) (*StatusPage, error)
UpdateStatusPage(ctx context.Context, uuid string, req UpdateStatusPageRequest) (*StatusPage, error)
DeleteStatusPage(ctx context.Context, uuid string) error
ListSubscribers(ctx context.Context, uuid string, page *int, subscriberType *string) (*SubscriberPaginatedResponse, error)
GetSubscriber(ctx context.Context, statuspageID string, subscriberID int) (*StatusPageSubscriber, error)
AddSubscriber(ctx context.Context, uuid string, req AddSubscriberRequest) (*StatusPageSubscriber, error)
DeleteSubscriber(ctx context.Context, uuid string, subscriberID int) error
IterStatusPages(ctx context.Context, search *string) iter.Seq2[StatusPage, error]
}
// HyperpingAPI combines all API interfaces for the Hyperping client.
// This is the primary interface used by the provider resources.
type HyperpingAPI interface {
MonitorAPI
IncidentAPI
MaintenanceAPI
ReportsAPI
OutageAPI
HealthcheckAPI
StatusPageAPI
}
// Ensure Client implements HyperpingAPI at compile time.
var _ HyperpingAPI = (*Client)(nil)