-
Notifications
You must be signed in to change notification settings - Fork 4
/
oas_server_gen.go
102 lines (97 loc) · 3.04 KB
/
oas_server_gen.go
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
// Code generated by ogen, DO NOT EDIT.
package promapi
import (
"context"
)
// Handler handles operations described by OpenAPI v3 specification.
type Handler interface {
// GetLabelValues implements getLabelValues operation.
//
// GET /api/v1/label/{label}/values
GetLabelValues(ctx context.Context, params GetLabelValuesParams) (*LabelValuesResponse, error)
// GetLabels implements getLabels operation.
//
// GET /api/v1/labels
GetLabels(ctx context.Context, params GetLabelsParams) (*LabelsResponse, error)
// GetMetadata implements getMetadata operation.
//
// GET /api/v1/metadata
GetMetadata(ctx context.Context, params GetMetadataParams) (*MetadataResponse, error)
// GetQuery implements getQuery operation.
//
// Query Prometheus.
//
// GET /api/v1/query
GetQuery(ctx context.Context, params GetQueryParams) (*QueryResponse, error)
// GetQueryExemplars implements getQueryExemplars operation.
//
// Query Prometheus.
//
// GET /api/v1/query_exemplars
GetQueryExemplars(ctx context.Context, params GetQueryExemplarsParams) (*QueryExemplarsResponse, error)
// GetQueryRange implements getQueryRange operation.
//
// Query Prometheus.
//
// GET /api/v1/query_range
GetQueryRange(ctx context.Context, params GetQueryRangeParams) (*QueryResponse, error)
// GetRules implements getRules operation.
//
// GET /api/v1/rules
GetRules(ctx context.Context, params GetRulesParams) (*RulesResponse, error)
// GetSeries implements getSeries operation.
//
// Query Prometheus.
//
// GET /api/v1/series
GetSeries(ctx context.Context, params GetSeriesParams) (*SeriesResponse, error)
// PostLabels implements postLabels operation.
//
// POST /api/v1/labels
PostLabels(ctx context.Context, req *LabelsForm) (*LabelsResponse, error)
// PostQuery implements postQuery operation.
//
// Query Prometheus.
//
// POST /api/v1/query
PostQuery(ctx context.Context, req *QueryForm) (*QueryResponse, error)
// PostQueryExemplars implements postQueryExemplars operation.
//
// Query Prometheus.
//
// POST /api/v1/query_exemplars
PostQueryExemplars(ctx context.Context, req *ExemplarsForm) (*QueryExemplarsResponse, error)
// PostQueryRange implements postQueryRange operation.
//
// Query Prometheus.
//
// POST /api/v1/query_range
PostQueryRange(ctx context.Context, req *QueryRangeForm) (*QueryResponse, error)
// PostSeries implements postSeries operation.
//
// Query Prometheus.
//
// POST /api/v1/series
PostSeries(ctx context.Context, req *SeriesForm) (*SeriesResponse, error)
// NewError creates *FailStatusCode from error returned by handler.
//
// Used for common default response.
NewError(ctx context.Context, err error) *FailStatusCode
}
// Server implements http server based on OpenAPI v3 specification and
// calls Handler to handle requests.
type Server struct {
h Handler
baseServer
}
// NewServer creates new Server.
func NewServer(h Handler, opts ...ServerOption) (*Server, error) {
s, err := newServerConfig(opts...).baseServer()
if err != nil {
return nil, err
}
return &Server{
h: h,
baseServer: s,
}, nil
}