forked from matoski/services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusage.pb.micro.go
221 lines (189 loc) · 8.25 KB
/
usage.pb.micro.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/usage.proto
package usage
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
_ "google.golang.org/protobuf/types/known/structpb"
math "math"
)
import (
context "context"
api "github.com/micro/micro/v3/service/api"
client "github.com/micro/micro/v3/service/client"
server "github.com/micro/micro/v3/service/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Usage service
func NewUsageEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Usage service
type UsageService interface {
// Returns the usage across all APIs historically, detail response includes at endpoint level. Powers the UI
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
Sweep(ctx context.Context, in *SweepRequest, opts ...client.CallOption) (*SweepResponse, error)
DeleteCustomer(ctx context.Context, in *DeleteCustomerRequest, opts ...client.CallOption) (*DeleteCustomerResponse, error)
SaveEvent(ctx context.Context, in *SaveEventRequest, opts ...client.CallOption) (*SaveEventResponse, error)
ListEvents(ctx context.Context, in *ListEventsRequest, opts ...client.CallOption) (*ListEventsResponse, error)
// Returns the ranking of top 10 users for each API
ListAPIRanks(ctx context.Context, in *ListAPIRanksRequest, opts ...client.CallOption) (*ListAPIRanksResponse, error)
// Returns the usage for this month. Detail response breaks down across all endpoints
ReadMonthlyTotal(ctx context.Context, in *ReadMonthlyTotalRequest, opts ...client.CallOption) (*ReadMonthlyTotalResponse, error)
// Returns monthly usage per specified endpoints, used by V1 api
ReadMonthly(ctx context.Context, in *ReadMonthlyRequest, opts ...client.CallOption) (*ReadMonthlyResponse, error)
}
type usageService struct {
c client.Client
name string
}
func NewUsageService(name string, c client.Client) UsageService {
return &usageService{
c: c,
name: name,
}
}
func (c *usageService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
req := c.c.NewRequest(c.name, "Usage.Read", in)
out := new(ReadResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *usageService) Sweep(ctx context.Context, in *SweepRequest, opts ...client.CallOption) (*SweepResponse, error) {
req := c.c.NewRequest(c.name, "Usage.Sweep", in)
out := new(SweepResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *usageService) DeleteCustomer(ctx context.Context, in *DeleteCustomerRequest, opts ...client.CallOption) (*DeleteCustomerResponse, error) {
req := c.c.NewRequest(c.name, "Usage.DeleteCustomer", in)
out := new(DeleteCustomerResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *usageService) SaveEvent(ctx context.Context, in *SaveEventRequest, opts ...client.CallOption) (*SaveEventResponse, error) {
req := c.c.NewRequest(c.name, "Usage.SaveEvent", in)
out := new(SaveEventResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *usageService) ListEvents(ctx context.Context, in *ListEventsRequest, opts ...client.CallOption) (*ListEventsResponse, error) {
req := c.c.NewRequest(c.name, "Usage.ListEvents", in)
out := new(ListEventsResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *usageService) ListAPIRanks(ctx context.Context, in *ListAPIRanksRequest, opts ...client.CallOption) (*ListAPIRanksResponse, error) {
req := c.c.NewRequest(c.name, "Usage.ListAPIRanks", in)
out := new(ListAPIRanksResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *usageService) ReadMonthlyTotal(ctx context.Context, in *ReadMonthlyTotalRequest, opts ...client.CallOption) (*ReadMonthlyTotalResponse, error) {
req := c.c.NewRequest(c.name, "Usage.ReadMonthlyTotal", in)
out := new(ReadMonthlyTotalResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *usageService) ReadMonthly(ctx context.Context, in *ReadMonthlyRequest, opts ...client.CallOption) (*ReadMonthlyResponse, error) {
req := c.c.NewRequest(c.name, "Usage.ReadMonthly", in)
out := new(ReadMonthlyResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Usage service
type UsageHandler interface {
// Returns the usage across all APIs historically, detail response includes at endpoint level. Powers the UI
Read(context.Context, *ReadRequest, *ReadResponse) error
Sweep(context.Context, *SweepRequest, *SweepResponse) error
DeleteCustomer(context.Context, *DeleteCustomerRequest, *DeleteCustomerResponse) error
SaveEvent(context.Context, *SaveEventRequest, *SaveEventResponse) error
ListEvents(context.Context, *ListEventsRequest, *ListEventsResponse) error
// Returns the ranking of top 10 users for each API
ListAPIRanks(context.Context, *ListAPIRanksRequest, *ListAPIRanksResponse) error
// Returns the usage for this month. Detail response breaks down across all endpoints
ReadMonthlyTotal(context.Context, *ReadMonthlyTotalRequest, *ReadMonthlyTotalResponse) error
// Returns monthly usage per specified endpoints, used by V1 api
ReadMonthly(context.Context, *ReadMonthlyRequest, *ReadMonthlyResponse) error
}
func RegisterUsageHandler(s server.Server, hdlr UsageHandler, opts ...server.HandlerOption) error {
type usage interface {
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
Sweep(ctx context.Context, in *SweepRequest, out *SweepResponse) error
DeleteCustomer(ctx context.Context, in *DeleteCustomerRequest, out *DeleteCustomerResponse) error
SaveEvent(ctx context.Context, in *SaveEventRequest, out *SaveEventResponse) error
ListEvents(ctx context.Context, in *ListEventsRequest, out *ListEventsResponse) error
ListAPIRanks(ctx context.Context, in *ListAPIRanksRequest, out *ListAPIRanksResponse) error
ReadMonthlyTotal(ctx context.Context, in *ReadMonthlyTotalRequest, out *ReadMonthlyTotalResponse) error
ReadMonthly(ctx context.Context, in *ReadMonthlyRequest, out *ReadMonthlyResponse) error
}
type Usage struct {
usage
}
h := &usageHandler{hdlr}
return s.Handle(s.NewHandler(&Usage{h}, opts...))
}
type usageHandler struct {
UsageHandler
}
func (h *usageHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
return h.UsageHandler.Read(ctx, in, out)
}
func (h *usageHandler) Sweep(ctx context.Context, in *SweepRequest, out *SweepResponse) error {
return h.UsageHandler.Sweep(ctx, in, out)
}
func (h *usageHandler) DeleteCustomer(ctx context.Context, in *DeleteCustomerRequest, out *DeleteCustomerResponse) error {
return h.UsageHandler.DeleteCustomer(ctx, in, out)
}
func (h *usageHandler) SaveEvent(ctx context.Context, in *SaveEventRequest, out *SaveEventResponse) error {
return h.UsageHandler.SaveEvent(ctx, in, out)
}
func (h *usageHandler) ListEvents(ctx context.Context, in *ListEventsRequest, out *ListEventsResponse) error {
return h.UsageHandler.ListEvents(ctx, in, out)
}
func (h *usageHandler) ListAPIRanks(ctx context.Context, in *ListAPIRanksRequest, out *ListAPIRanksResponse) error {
return h.UsageHandler.ListAPIRanks(ctx, in, out)
}
func (h *usageHandler) ReadMonthlyTotal(ctx context.Context, in *ReadMonthlyTotalRequest, out *ReadMonthlyTotalResponse) error {
return h.UsageHandler.ReadMonthlyTotal(ctx, in, out)
}
func (h *usageHandler) ReadMonthly(ctx context.Context, in *ReadMonthlyRequest, out *ReadMonthlyResponse) error {
return h.UsageHandler.ReadMonthly(ctx, in, out)
}