-
Notifications
You must be signed in to change notification settings - Fork 0
/
library_manager_http.pb.go
235 lines (215 loc) · 9 KB
/
library_manager_http.pb.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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
// Code generated by protoc-gen-go-http. DO NOT EDIT.
// versions:
// - protoc-gen-go-http v2.6.3
// - protoc v4.23.4
// source: library_manager.proto
package v1
import (
context "context"
http "github.com/go-kratos/kratos/v2/transport/http"
binding "github.com/go-kratos/kratos/v2/transport/http/binding"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the kratos package it is being compiled against.
var _ = new(context.Context)
var _ = binding.EncodeURL
const _ = http.SupportPackageIsVersion1
const OperationLibraryManagementCreateLibraryManager = "/v1.LibraryManagement/CreateLibraryManager"
const OperationLibraryManagementDeleteLibraryManager = "/v1.LibraryManagement/DeleteLibraryManager"
const OperationLibraryManagementGetLibraryManager = "/v1.LibraryManagement/GetLibraryManager"
const OperationLibraryManagementListLibraryManagers = "/v1.LibraryManagement/ListLibraryManagers"
const OperationLibraryManagementUpdateLibraryManager = "/v1.LibraryManagement/UpdateLibraryManager"
type LibraryManagementHTTPServer interface {
CreateLibraryManager(context.Context, *CreateLibraryManagerParams) (*LibraryManagerObject, error)
DeleteLibraryManager(context.Context, *ResourceKey) (*emptypb.Empty, error)
GetLibraryManager(context.Context, *ResourceKey) (*LibraryManagerObject, error)
ListLibraryManagers(context.Context, *ResourceKey) (*LibraryManagersReply, error)
UpdateLibraryManager(context.Context, *UpdateLibraryManagerParams) (*LibraryManagerObject, error)
}
func RegisterLibraryManagementHTTPServer(s *http.Server, srv LibraryManagementHTTPServer) {
r := s.Route("/")
r.GET("/api/v1/library_managers", _LibraryManagement_ListLibraryManagers0_HTTP_Handler(srv))
r.GET("/api/v1/library_managers/{name}", _LibraryManagement_GetLibraryManager0_HTTP_Handler(srv))
r.POST("/api/v1/library_managers", _LibraryManagement_CreateLibraryManager0_HTTP_Handler(srv))
r.PUT("/api/v1/library_managers/{resource_key.name}", _LibraryManagement_UpdateLibraryManager0_HTTP_Handler(srv))
r.DELETE("/api/v1/library_managers/{name}", _LibraryManagement_DeleteLibraryManager0_HTTP_Handler(srv))
}
func _LibraryManagement_ListLibraryManagers0_HTTP_Handler(srv LibraryManagementHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in ResourceKey
if err := ctx.BindQuery(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationLibraryManagementListLibraryManagers)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.ListLibraryManagers(ctx, req.(*ResourceKey))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*LibraryManagersReply)
return ctx.Result(200, reply)
}
}
func _LibraryManagement_GetLibraryManager0_HTTP_Handler(srv LibraryManagementHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in ResourceKey
if err := ctx.BindQuery(&in); err != nil {
return err
}
if err := ctx.BindVars(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationLibraryManagementGetLibraryManager)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.GetLibraryManager(ctx, req.(*ResourceKey))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*LibraryManagerObject)
return ctx.Result(200, reply)
}
}
func _LibraryManagement_CreateLibraryManager0_HTTP_Handler(srv LibraryManagementHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in CreateLibraryManagerParams
if err := ctx.Bind(&in.Spec); err != nil {
return err
}
if err := ctx.BindQuery(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationLibraryManagementCreateLibraryManager)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.CreateLibraryManager(ctx, req.(*CreateLibraryManagerParams))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*LibraryManagerObject)
return ctx.Result(200, reply)
}
}
func _LibraryManagement_UpdateLibraryManager0_HTTP_Handler(srv LibraryManagementHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in UpdateLibraryManagerParams
if err := ctx.Bind(&in.Spec); err != nil {
return err
}
if err := ctx.BindQuery(&in); err != nil {
return err
}
if err := ctx.BindVars(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationLibraryManagementUpdateLibraryManager)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.UpdateLibraryManager(ctx, req.(*UpdateLibraryManagerParams))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*LibraryManagerObject)
return ctx.Result(200, reply)
}
}
func _LibraryManagement_DeleteLibraryManager0_HTTP_Handler(srv LibraryManagementHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in ResourceKey
if err := ctx.BindQuery(&in); err != nil {
return err
}
if err := ctx.BindVars(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationLibraryManagementDeleteLibraryManager)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.DeleteLibraryManager(ctx, req.(*ResourceKey))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*emptypb.Empty)
return ctx.Result(200, reply)
}
}
type LibraryManagementHTTPClient interface {
CreateLibraryManager(ctx context.Context, req *CreateLibraryManagerParams, opts ...http.CallOption) (rsp *LibraryManagerObject, err error)
DeleteLibraryManager(ctx context.Context, req *ResourceKey, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
GetLibraryManager(ctx context.Context, req *ResourceKey, opts ...http.CallOption) (rsp *LibraryManagerObject, err error)
ListLibraryManagers(ctx context.Context, req *ResourceKey, opts ...http.CallOption) (rsp *LibraryManagersReply, err error)
UpdateLibraryManager(ctx context.Context, req *UpdateLibraryManagerParams, opts ...http.CallOption) (rsp *LibraryManagerObject, err error)
}
type LibraryManagementHTTPClientImpl struct {
cc *http.Client
}
func NewLibraryManagementHTTPClient(client *http.Client) LibraryManagementHTTPClient {
return &LibraryManagementHTTPClientImpl{client}
}
func (c *LibraryManagementHTTPClientImpl) CreateLibraryManager(ctx context.Context, in *CreateLibraryManagerParams, opts ...http.CallOption) (*LibraryManagerObject, error) {
var out LibraryManagerObject
pattern := "/api/v1/library_managers"
path := binding.EncodeURL(pattern, in, false)
opts = append(opts, http.Operation(OperationLibraryManagementCreateLibraryManager))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "POST", path, in.Spec, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}
func (c *LibraryManagementHTTPClientImpl) DeleteLibraryManager(ctx context.Context, in *ResourceKey, opts ...http.CallOption) (*emptypb.Empty, error) {
var out emptypb.Empty
pattern := "/api/v1/library_managers/{name}"
path := binding.EncodeURL(pattern, in, true)
opts = append(opts, http.Operation(OperationLibraryManagementDeleteLibraryManager))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}
func (c *LibraryManagementHTTPClientImpl) GetLibraryManager(ctx context.Context, in *ResourceKey, opts ...http.CallOption) (*LibraryManagerObject, error) {
var out LibraryManagerObject
pattern := "/api/v1/library_managers/{name}"
path := binding.EncodeURL(pattern, in, true)
opts = append(opts, http.Operation(OperationLibraryManagementGetLibraryManager))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}
func (c *LibraryManagementHTTPClientImpl) ListLibraryManagers(ctx context.Context, in *ResourceKey, opts ...http.CallOption) (*LibraryManagersReply, error) {
var out LibraryManagersReply
pattern := "/api/v1/library_managers"
path := binding.EncodeURL(pattern, in, true)
opts = append(opts, http.Operation(OperationLibraryManagementListLibraryManagers))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}
func (c *LibraryManagementHTTPClientImpl) UpdateLibraryManager(ctx context.Context, in *UpdateLibraryManagerParams, opts ...http.CallOption) (*LibraryManagerObject, error) {
var out LibraryManagerObject
pattern := "/api/v1/library_managers/{resource_key.name}"
path := binding.EncodeURL(pattern, in, false)
opts = append(opts, http.Operation(OperationLibraryManagementUpdateLibraryManager))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "PUT", path, in.Spec, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}