rpc.pb.gw.go 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911
  1. // Code generated by protoc-gen-grpc-gateway
  2. // source: etcdserver/etcdserverpb/rpc.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package etcdserverpb is a reverse proxy.
  6. It translates gRPC into RESTful JSON APIs.
  7. */
  8. package etcdserverpb
  9. import (
  10. "io"
  11. "net/http"
  12. "github.com/golang/protobuf/proto"
  13. "github.com/grpc-ecosystem/grpc-gateway/runtime"
  14. "github.com/grpc-ecosystem/grpc-gateway/utilities"
  15. "golang.org/x/net/context"
  16. "google.golang.org/grpc"
  17. "google.golang.org/grpc/codes"
  18. "google.golang.org/grpc/grpclog"
  19. )
  20. var _ codes.Code
  21. var _ io.Reader
  22. var _ = runtime.String
  23. var _ = utilities.NewDoubleArray
  24. func request_KV_Range_0(ctx context.Context, marshaler runtime.Marshaler, client KVClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  25. var protoReq RangeRequest
  26. var metadata runtime.ServerMetadata
  27. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  28. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  29. }
  30. msg, err := client.Range(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  31. return msg, metadata, err
  32. }
  33. func request_KV_Put_0(ctx context.Context, marshaler runtime.Marshaler, client KVClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  34. var protoReq PutRequest
  35. var metadata runtime.ServerMetadata
  36. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  37. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  38. }
  39. msg, err := client.Put(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  40. return msg, metadata, err
  41. }
  42. func request_KV_DeleteRange_0(ctx context.Context, marshaler runtime.Marshaler, client KVClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  43. var protoReq DeleteRangeRequest
  44. var metadata runtime.ServerMetadata
  45. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  46. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  47. }
  48. msg, err := client.DeleteRange(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  49. return msg, metadata, err
  50. }
  51. func request_KV_Txn_0(ctx context.Context, marshaler runtime.Marshaler, client KVClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  52. var protoReq TxnRequest
  53. var metadata runtime.ServerMetadata
  54. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  55. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  56. }
  57. msg, err := client.Txn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  58. return msg, metadata, err
  59. }
  60. func request_KV_Compact_0(ctx context.Context, marshaler runtime.Marshaler, client KVClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  61. var protoReq CompactionRequest
  62. var metadata runtime.ServerMetadata
  63. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  64. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  65. }
  66. msg, err := client.Compact(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  67. return msg, metadata, err
  68. }
  69. func request_Watch_Watch_0(ctx context.Context, marshaler runtime.Marshaler, client WatchClient, req *http.Request, pathParams map[string]string) (Watch_WatchClient, runtime.ServerMetadata, error) {
  70. var metadata runtime.ServerMetadata
  71. stream, err := client.Watch(ctx)
  72. if err != nil {
  73. grpclog.Printf("Failed to start streaming: %v", err)
  74. return nil, metadata, err
  75. }
  76. dec := marshaler.NewDecoder(req.Body)
  77. handleSend := func() error {
  78. var protoReq WatchRequest
  79. err = dec.Decode(&protoReq)
  80. if err == io.EOF {
  81. return err
  82. }
  83. if err != nil {
  84. grpclog.Printf("Failed to decode request: %v", err)
  85. return err
  86. }
  87. if err = stream.Send(&protoReq); err != nil {
  88. grpclog.Printf("Failed to send request: %v", err)
  89. return err
  90. }
  91. return nil
  92. }
  93. if err := handleSend(); err != nil {
  94. if cerr := stream.CloseSend(); cerr != nil {
  95. grpclog.Printf("Failed to terminate client stream: %v", cerr)
  96. }
  97. if err == io.EOF {
  98. return stream, metadata, nil
  99. }
  100. return nil, metadata, err
  101. }
  102. go func() {
  103. for {
  104. if err := handleSend(); err != nil {
  105. break
  106. }
  107. }
  108. if err := stream.CloseSend(); err != nil {
  109. grpclog.Printf("Failed to terminate client stream: %v", err)
  110. }
  111. }()
  112. header, err := stream.Header()
  113. if err != nil {
  114. grpclog.Printf("Failed to get header from client: %v", err)
  115. return nil, metadata, err
  116. }
  117. metadata.HeaderMD = header
  118. return stream, metadata, nil
  119. }
  120. func request_Lease_LeaseGrant_0(ctx context.Context, marshaler runtime.Marshaler, client LeaseClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  121. var protoReq LeaseGrantRequest
  122. var metadata runtime.ServerMetadata
  123. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  124. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  125. }
  126. msg, err := client.LeaseGrant(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  127. return msg, metadata, err
  128. }
  129. func request_Lease_LeaseRevoke_0(ctx context.Context, marshaler runtime.Marshaler, client LeaseClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  130. var protoReq LeaseRevokeRequest
  131. var metadata runtime.ServerMetadata
  132. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  133. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  134. }
  135. msg, err := client.LeaseRevoke(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  136. return msg, metadata, err
  137. }
  138. func request_Lease_LeaseKeepAlive_0(ctx context.Context, marshaler runtime.Marshaler, client LeaseClient, req *http.Request, pathParams map[string]string) (Lease_LeaseKeepAliveClient, runtime.ServerMetadata, error) {
  139. var metadata runtime.ServerMetadata
  140. stream, err := client.LeaseKeepAlive(ctx)
  141. if err != nil {
  142. grpclog.Printf("Failed to start streaming: %v", err)
  143. return nil, metadata, err
  144. }
  145. dec := marshaler.NewDecoder(req.Body)
  146. handleSend := func() error {
  147. var protoReq LeaseKeepAliveRequest
  148. err = dec.Decode(&protoReq)
  149. if err == io.EOF {
  150. return err
  151. }
  152. if err != nil {
  153. grpclog.Printf("Failed to decode request: %v", err)
  154. return err
  155. }
  156. if err = stream.Send(&protoReq); err != nil {
  157. grpclog.Printf("Failed to send request: %v", err)
  158. return err
  159. }
  160. return nil
  161. }
  162. if err := handleSend(); err != nil {
  163. if cerr := stream.CloseSend(); cerr != nil {
  164. grpclog.Printf("Failed to terminate client stream: %v", cerr)
  165. }
  166. if err == io.EOF {
  167. return stream, metadata, nil
  168. }
  169. return nil, metadata, err
  170. }
  171. go func() {
  172. for {
  173. if err := handleSend(); err != nil {
  174. break
  175. }
  176. }
  177. if err := stream.CloseSend(); err != nil {
  178. grpclog.Printf("Failed to terminate client stream: %v", err)
  179. }
  180. }()
  181. header, err := stream.Header()
  182. if err != nil {
  183. grpclog.Printf("Failed to get header from client: %v", err)
  184. return nil, metadata, err
  185. }
  186. metadata.HeaderMD = header
  187. return stream, metadata, nil
  188. }
  189. func request_Lease_LeaseTimeToLive_0(ctx context.Context, marshaler runtime.Marshaler, client LeaseClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  190. var protoReq LeaseTimeToLiveRequest
  191. var metadata runtime.ServerMetadata
  192. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  193. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  194. }
  195. msg, err := client.LeaseTimeToLive(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  196. return msg, metadata, err
  197. }
  198. func request_Cluster_MemberAdd_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  199. var protoReq MemberAddRequest
  200. var metadata runtime.ServerMetadata
  201. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  202. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  203. }
  204. msg, err := client.MemberAdd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  205. return msg, metadata, err
  206. }
  207. func request_Cluster_MemberRemove_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  208. var protoReq MemberRemoveRequest
  209. var metadata runtime.ServerMetadata
  210. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  211. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  212. }
  213. msg, err := client.MemberRemove(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  214. return msg, metadata, err
  215. }
  216. func request_Cluster_MemberUpdate_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  217. var protoReq MemberUpdateRequest
  218. var metadata runtime.ServerMetadata
  219. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  220. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  221. }
  222. msg, err := client.MemberUpdate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  223. return msg, metadata, err
  224. }
  225. func request_Cluster_MemberList_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  226. var protoReq MemberListRequest
  227. var metadata runtime.ServerMetadata
  228. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  229. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  230. }
  231. msg, err := client.MemberList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  232. return msg, metadata, err
  233. }
  234. func request_Maintenance_Alarm_0(ctx context.Context, marshaler runtime.Marshaler, client MaintenanceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  235. var protoReq AlarmRequest
  236. var metadata runtime.ServerMetadata
  237. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  238. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  239. }
  240. msg, err := client.Alarm(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  241. return msg, metadata, err
  242. }
  243. func request_Maintenance_Status_0(ctx context.Context, marshaler runtime.Marshaler, client MaintenanceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  244. var protoReq StatusRequest
  245. var metadata runtime.ServerMetadata
  246. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  247. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  248. }
  249. msg, err := client.Status(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  250. return msg, metadata, err
  251. }
  252. func request_Maintenance_Defragment_0(ctx context.Context, marshaler runtime.Marshaler, client MaintenanceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  253. var protoReq DefragmentRequest
  254. var metadata runtime.ServerMetadata
  255. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  256. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  257. }
  258. msg, err := client.Defragment(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  259. return msg, metadata, err
  260. }
  261. func request_Maintenance_Hash_0(ctx context.Context, marshaler runtime.Marshaler, client MaintenanceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  262. var protoReq HashRequest
  263. var metadata runtime.ServerMetadata
  264. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  265. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  266. }
  267. msg, err := client.Hash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  268. return msg, metadata, err
  269. }
  270. func request_Maintenance_Snapshot_0(ctx context.Context, marshaler runtime.Marshaler, client MaintenanceClient, req *http.Request, pathParams map[string]string) (Maintenance_SnapshotClient, runtime.ServerMetadata, error) {
  271. var protoReq SnapshotRequest
  272. var metadata runtime.ServerMetadata
  273. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  274. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  275. }
  276. stream, err := client.Snapshot(ctx, &protoReq)
  277. if err != nil {
  278. return nil, metadata, err
  279. }
  280. header, err := stream.Header()
  281. if err != nil {
  282. return nil, metadata, err
  283. }
  284. metadata.HeaderMD = header
  285. return stream, metadata, nil
  286. }
  287. func request_Auth_AuthEnable_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  288. var protoReq AuthEnableRequest
  289. var metadata runtime.ServerMetadata
  290. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  291. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  292. }
  293. msg, err := client.AuthEnable(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  294. return msg, metadata, err
  295. }
  296. func request_Auth_AuthDisable_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  297. var protoReq AuthDisableRequest
  298. var metadata runtime.ServerMetadata
  299. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  300. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  301. }
  302. msg, err := client.AuthDisable(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  303. return msg, metadata, err
  304. }
  305. func request_Auth_Authenticate_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  306. var protoReq AuthenticateRequest
  307. var metadata runtime.ServerMetadata
  308. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  309. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  310. }
  311. msg, err := client.Authenticate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  312. return msg, metadata, err
  313. }
  314. func request_Auth_UserAdd_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  315. var protoReq AuthUserAddRequest
  316. var metadata runtime.ServerMetadata
  317. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  318. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  319. }
  320. msg, err := client.UserAdd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  321. return msg, metadata, err
  322. }
  323. func request_Auth_UserGet_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  324. var protoReq AuthUserGetRequest
  325. var metadata runtime.ServerMetadata
  326. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  327. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  328. }
  329. msg, err := client.UserGet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  330. return msg, metadata, err
  331. }
  332. func request_Auth_UserList_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  333. var protoReq AuthUserListRequest
  334. var metadata runtime.ServerMetadata
  335. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  336. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  337. }
  338. msg, err := client.UserList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  339. return msg, metadata, err
  340. }
  341. func request_Auth_UserDelete_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  342. var protoReq AuthUserDeleteRequest
  343. var metadata runtime.ServerMetadata
  344. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  345. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  346. }
  347. msg, err := client.UserDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  348. return msg, metadata, err
  349. }
  350. func request_Auth_UserChangePassword_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  351. var protoReq AuthUserChangePasswordRequest
  352. var metadata runtime.ServerMetadata
  353. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  354. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  355. }
  356. msg, err := client.UserChangePassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  357. return msg, metadata, err
  358. }
  359. func request_Auth_UserGrantRole_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  360. var protoReq AuthUserGrantRoleRequest
  361. var metadata runtime.ServerMetadata
  362. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  363. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  364. }
  365. msg, err := client.UserGrantRole(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  366. return msg, metadata, err
  367. }
  368. func request_Auth_UserRevokeRole_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  369. var protoReq AuthUserRevokeRoleRequest
  370. var metadata runtime.ServerMetadata
  371. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  372. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  373. }
  374. msg, err := client.UserRevokeRole(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  375. return msg, metadata, err
  376. }
  377. func request_Auth_RoleAdd_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  378. var protoReq AuthRoleAddRequest
  379. var metadata runtime.ServerMetadata
  380. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  381. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  382. }
  383. msg, err := client.RoleAdd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  384. return msg, metadata, err
  385. }
  386. func request_Auth_RoleGet_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  387. var protoReq AuthRoleGetRequest
  388. var metadata runtime.ServerMetadata
  389. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  390. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  391. }
  392. msg, err := client.RoleGet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  393. return msg, metadata, err
  394. }
  395. func request_Auth_RoleList_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  396. var protoReq AuthRoleListRequest
  397. var metadata runtime.ServerMetadata
  398. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  399. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  400. }
  401. msg, err := client.RoleList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  402. return msg, metadata, err
  403. }
  404. func request_Auth_RoleDelete_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  405. var protoReq AuthRoleDeleteRequest
  406. var metadata runtime.ServerMetadata
  407. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  408. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  409. }
  410. msg, err := client.RoleDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  411. return msg, metadata, err
  412. }
  413. func request_Auth_RoleGrantPermission_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  414. var protoReq AuthRoleGrantPermissionRequest
  415. var metadata runtime.ServerMetadata
  416. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  417. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  418. }
  419. msg, err := client.RoleGrantPermission(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  420. return msg, metadata, err
  421. }
  422. func request_Auth_RoleRevokePermission_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  423. var protoReq AuthRoleRevokePermissionRequest
  424. var metadata runtime.ServerMetadata
  425. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
  426. return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
  427. }
  428. msg, err := client.RoleRevokePermission(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  429. return msg, metadata, err
  430. }
  431. // RegisterKVHandlerFromEndpoint is same as RegisterKVHandler but
  432. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
  433. func RegisterKVHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
  434. conn, err := grpc.Dial(endpoint, opts...)
  435. if err != nil {
  436. return err
  437. }
  438. defer func() {
  439. if err != nil {
  440. if cerr := conn.Close(); cerr != nil {
  441. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  442. }
  443. return
  444. }
  445. go func() {
  446. <-ctx.Done()
  447. if cerr := conn.Close(); cerr != nil {
  448. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  449. }
  450. }()
  451. }()
  452. return RegisterKVHandler(ctx, mux, conn)
  453. }
  454. // RegisterKVHandler registers the http handlers for service KV to "mux".
  455. // The handlers forward requests to the grpc endpoint over "conn".
  456. func RegisterKVHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
  457. client := NewKVClient(conn)
  458. mux.Handle("POST", pattern_KV_Range_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  459. ctx, cancel := context.WithCancel(ctx)
  460. defer cancel()
  461. if cn, ok := w.(http.CloseNotifier); ok {
  462. go func(done <-chan struct{}, closed <-chan bool) {
  463. select {
  464. case <-done:
  465. case <-closed:
  466. cancel()
  467. }
  468. }(ctx.Done(), cn.CloseNotify())
  469. }
  470. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  471. rctx, err := runtime.AnnotateContext(ctx, req)
  472. if err != nil {
  473. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  474. }
  475. resp, md, err := request_KV_Range_0(rctx, inboundMarshaler, client, req, pathParams)
  476. ctx = runtime.NewServerMetadataContext(ctx, md)
  477. if err != nil {
  478. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  479. return
  480. }
  481. forward_KV_Range_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  482. })
  483. mux.Handle("POST", pattern_KV_Put_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  484. ctx, cancel := context.WithCancel(ctx)
  485. defer cancel()
  486. if cn, ok := w.(http.CloseNotifier); ok {
  487. go func(done <-chan struct{}, closed <-chan bool) {
  488. select {
  489. case <-done:
  490. case <-closed:
  491. cancel()
  492. }
  493. }(ctx.Done(), cn.CloseNotify())
  494. }
  495. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  496. rctx, err := runtime.AnnotateContext(ctx, req)
  497. if err != nil {
  498. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  499. }
  500. resp, md, err := request_KV_Put_0(rctx, inboundMarshaler, client, req, pathParams)
  501. ctx = runtime.NewServerMetadataContext(ctx, md)
  502. if err != nil {
  503. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  504. return
  505. }
  506. forward_KV_Put_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  507. })
  508. mux.Handle("POST", pattern_KV_DeleteRange_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  509. ctx, cancel := context.WithCancel(ctx)
  510. defer cancel()
  511. if cn, ok := w.(http.CloseNotifier); ok {
  512. go func(done <-chan struct{}, closed <-chan bool) {
  513. select {
  514. case <-done:
  515. case <-closed:
  516. cancel()
  517. }
  518. }(ctx.Done(), cn.CloseNotify())
  519. }
  520. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  521. rctx, err := runtime.AnnotateContext(ctx, req)
  522. if err != nil {
  523. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  524. }
  525. resp, md, err := request_KV_DeleteRange_0(rctx, inboundMarshaler, client, req, pathParams)
  526. ctx = runtime.NewServerMetadataContext(ctx, md)
  527. if err != nil {
  528. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  529. return
  530. }
  531. forward_KV_DeleteRange_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  532. })
  533. mux.Handle("POST", pattern_KV_Txn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  534. ctx, cancel := context.WithCancel(ctx)
  535. defer cancel()
  536. if cn, ok := w.(http.CloseNotifier); ok {
  537. go func(done <-chan struct{}, closed <-chan bool) {
  538. select {
  539. case <-done:
  540. case <-closed:
  541. cancel()
  542. }
  543. }(ctx.Done(), cn.CloseNotify())
  544. }
  545. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  546. rctx, err := runtime.AnnotateContext(ctx, req)
  547. if err != nil {
  548. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  549. }
  550. resp, md, err := request_KV_Txn_0(rctx, inboundMarshaler, client, req, pathParams)
  551. ctx = runtime.NewServerMetadataContext(ctx, md)
  552. if err != nil {
  553. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  554. return
  555. }
  556. forward_KV_Txn_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  557. })
  558. mux.Handle("POST", pattern_KV_Compact_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  559. ctx, cancel := context.WithCancel(ctx)
  560. defer cancel()
  561. if cn, ok := w.(http.CloseNotifier); ok {
  562. go func(done <-chan struct{}, closed <-chan bool) {
  563. select {
  564. case <-done:
  565. case <-closed:
  566. cancel()
  567. }
  568. }(ctx.Done(), cn.CloseNotify())
  569. }
  570. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  571. rctx, err := runtime.AnnotateContext(ctx, req)
  572. if err != nil {
  573. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  574. }
  575. resp, md, err := request_KV_Compact_0(rctx, inboundMarshaler, client, req, pathParams)
  576. ctx = runtime.NewServerMetadataContext(ctx, md)
  577. if err != nil {
  578. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  579. return
  580. }
  581. forward_KV_Compact_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  582. })
  583. return nil
  584. }
  585. var (
  586. pattern_KV_Range_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "kv", "range"}, ""))
  587. pattern_KV_Put_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "kv", "put"}, ""))
  588. pattern_KV_DeleteRange_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "kv", "deleterange"}, ""))
  589. pattern_KV_Txn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "kv", "txn"}, ""))
  590. pattern_KV_Compact_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "kv", "compaction"}, ""))
  591. )
  592. var (
  593. forward_KV_Range_0 = runtime.ForwardResponseMessage
  594. forward_KV_Put_0 = runtime.ForwardResponseMessage
  595. forward_KV_DeleteRange_0 = runtime.ForwardResponseMessage
  596. forward_KV_Txn_0 = runtime.ForwardResponseMessage
  597. forward_KV_Compact_0 = runtime.ForwardResponseMessage
  598. )
  599. // RegisterWatchHandlerFromEndpoint is same as RegisterWatchHandler but
  600. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
  601. func RegisterWatchHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
  602. conn, err := grpc.Dial(endpoint, opts...)
  603. if err != nil {
  604. return err
  605. }
  606. defer func() {
  607. if err != nil {
  608. if cerr := conn.Close(); cerr != nil {
  609. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  610. }
  611. return
  612. }
  613. go func() {
  614. <-ctx.Done()
  615. if cerr := conn.Close(); cerr != nil {
  616. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  617. }
  618. }()
  619. }()
  620. return RegisterWatchHandler(ctx, mux, conn)
  621. }
  622. // RegisterWatchHandler registers the http handlers for service Watch to "mux".
  623. // The handlers forward requests to the grpc endpoint over "conn".
  624. func RegisterWatchHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
  625. client := NewWatchClient(conn)
  626. mux.Handle("POST", pattern_Watch_Watch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  627. ctx, cancel := context.WithCancel(ctx)
  628. defer cancel()
  629. if cn, ok := w.(http.CloseNotifier); ok {
  630. go func(done <-chan struct{}, closed <-chan bool) {
  631. select {
  632. case <-done:
  633. case <-closed:
  634. cancel()
  635. }
  636. }(ctx.Done(), cn.CloseNotify())
  637. }
  638. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  639. rctx, err := runtime.AnnotateContext(ctx, req)
  640. if err != nil {
  641. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  642. }
  643. resp, md, err := request_Watch_Watch_0(rctx, inboundMarshaler, client, req, pathParams)
  644. ctx = runtime.NewServerMetadataContext(ctx, md)
  645. if err != nil {
  646. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  647. return
  648. }
  649. forward_Watch_Watch_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
  650. })
  651. return nil
  652. }
  653. var (
  654. pattern_Watch_Watch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v3alpha", "watch"}, ""))
  655. )
  656. var (
  657. forward_Watch_Watch_0 = runtime.ForwardResponseStream
  658. )
  659. // RegisterLeaseHandlerFromEndpoint is same as RegisterLeaseHandler but
  660. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
  661. func RegisterLeaseHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
  662. conn, err := grpc.Dial(endpoint, opts...)
  663. if err != nil {
  664. return err
  665. }
  666. defer func() {
  667. if err != nil {
  668. if cerr := conn.Close(); cerr != nil {
  669. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  670. }
  671. return
  672. }
  673. go func() {
  674. <-ctx.Done()
  675. if cerr := conn.Close(); cerr != nil {
  676. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  677. }
  678. }()
  679. }()
  680. return RegisterLeaseHandler(ctx, mux, conn)
  681. }
  682. // RegisterLeaseHandler registers the http handlers for service Lease to "mux".
  683. // The handlers forward requests to the grpc endpoint over "conn".
  684. func RegisterLeaseHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
  685. client := NewLeaseClient(conn)
  686. mux.Handle("POST", pattern_Lease_LeaseGrant_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  687. ctx, cancel := context.WithCancel(ctx)
  688. defer cancel()
  689. if cn, ok := w.(http.CloseNotifier); ok {
  690. go func(done <-chan struct{}, closed <-chan bool) {
  691. select {
  692. case <-done:
  693. case <-closed:
  694. cancel()
  695. }
  696. }(ctx.Done(), cn.CloseNotify())
  697. }
  698. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  699. rctx, err := runtime.AnnotateContext(ctx, req)
  700. if err != nil {
  701. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  702. }
  703. resp, md, err := request_Lease_LeaseGrant_0(rctx, inboundMarshaler, client, req, pathParams)
  704. ctx = runtime.NewServerMetadataContext(ctx, md)
  705. if err != nil {
  706. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  707. return
  708. }
  709. forward_Lease_LeaseGrant_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  710. })
  711. mux.Handle("POST", pattern_Lease_LeaseRevoke_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  712. ctx, cancel := context.WithCancel(ctx)
  713. defer cancel()
  714. if cn, ok := w.(http.CloseNotifier); ok {
  715. go func(done <-chan struct{}, closed <-chan bool) {
  716. select {
  717. case <-done:
  718. case <-closed:
  719. cancel()
  720. }
  721. }(ctx.Done(), cn.CloseNotify())
  722. }
  723. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  724. rctx, err := runtime.AnnotateContext(ctx, req)
  725. if err != nil {
  726. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  727. }
  728. resp, md, err := request_Lease_LeaseRevoke_0(rctx, inboundMarshaler, client, req, pathParams)
  729. ctx = runtime.NewServerMetadataContext(ctx, md)
  730. if err != nil {
  731. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  732. return
  733. }
  734. forward_Lease_LeaseRevoke_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  735. })
  736. mux.Handle("POST", pattern_Lease_LeaseKeepAlive_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  737. ctx, cancel := context.WithCancel(ctx)
  738. defer cancel()
  739. if cn, ok := w.(http.CloseNotifier); ok {
  740. go func(done <-chan struct{}, closed <-chan bool) {
  741. select {
  742. case <-done:
  743. case <-closed:
  744. cancel()
  745. }
  746. }(ctx.Done(), cn.CloseNotify())
  747. }
  748. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  749. rctx, err := runtime.AnnotateContext(ctx, req)
  750. if err != nil {
  751. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  752. }
  753. resp, md, err := request_Lease_LeaseKeepAlive_0(rctx, inboundMarshaler, client, req, pathParams)
  754. ctx = runtime.NewServerMetadataContext(ctx, md)
  755. if err != nil {
  756. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  757. return
  758. }
  759. forward_Lease_LeaseKeepAlive_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
  760. })
  761. mux.Handle("POST", pattern_Lease_LeaseTimeToLive_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  762. ctx, cancel := context.WithCancel(ctx)
  763. defer cancel()
  764. if cn, ok := w.(http.CloseNotifier); ok {
  765. go func(done <-chan struct{}, closed <-chan bool) {
  766. select {
  767. case <-done:
  768. case <-closed:
  769. cancel()
  770. }
  771. }(ctx.Done(), cn.CloseNotify())
  772. }
  773. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  774. rctx, err := runtime.AnnotateContext(ctx, req)
  775. if err != nil {
  776. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  777. }
  778. resp, md, err := request_Lease_LeaseTimeToLive_0(rctx, inboundMarshaler, client, req, pathParams)
  779. ctx = runtime.NewServerMetadataContext(ctx, md)
  780. if err != nil {
  781. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  782. return
  783. }
  784. forward_Lease_LeaseTimeToLive_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  785. })
  786. return nil
  787. }
  788. var (
  789. pattern_Lease_LeaseGrant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "lease", "grant"}, ""))
  790. pattern_Lease_LeaseRevoke_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "kv", "lease", "revoke"}, ""))
  791. pattern_Lease_LeaseKeepAlive_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "lease", "keepalive"}, ""))
  792. pattern_Lease_LeaseTimeToLive_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "kv", "lease", "timetolive"}, ""))
  793. )
  794. var (
  795. forward_Lease_LeaseGrant_0 = runtime.ForwardResponseMessage
  796. forward_Lease_LeaseRevoke_0 = runtime.ForwardResponseMessage
  797. forward_Lease_LeaseKeepAlive_0 = runtime.ForwardResponseStream
  798. forward_Lease_LeaseTimeToLive_0 = runtime.ForwardResponseMessage
  799. )
  800. // RegisterClusterHandlerFromEndpoint is same as RegisterClusterHandler but
  801. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
  802. func RegisterClusterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
  803. conn, err := grpc.Dial(endpoint, opts...)
  804. if err != nil {
  805. return err
  806. }
  807. defer func() {
  808. if err != nil {
  809. if cerr := conn.Close(); cerr != nil {
  810. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  811. }
  812. return
  813. }
  814. go func() {
  815. <-ctx.Done()
  816. if cerr := conn.Close(); cerr != nil {
  817. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  818. }
  819. }()
  820. }()
  821. return RegisterClusterHandler(ctx, mux, conn)
  822. }
  823. // RegisterClusterHandler registers the http handlers for service Cluster to "mux".
  824. // The handlers forward requests to the grpc endpoint over "conn".
  825. func RegisterClusterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
  826. client := NewClusterClient(conn)
  827. mux.Handle("POST", pattern_Cluster_MemberAdd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  828. ctx, cancel := context.WithCancel(ctx)
  829. defer cancel()
  830. if cn, ok := w.(http.CloseNotifier); ok {
  831. go func(done <-chan struct{}, closed <-chan bool) {
  832. select {
  833. case <-done:
  834. case <-closed:
  835. cancel()
  836. }
  837. }(ctx.Done(), cn.CloseNotify())
  838. }
  839. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  840. rctx, err := runtime.AnnotateContext(ctx, req)
  841. if err != nil {
  842. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  843. }
  844. resp, md, err := request_Cluster_MemberAdd_0(rctx, inboundMarshaler, client, req, pathParams)
  845. ctx = runtime.NewServerMetadataContext(ctx, md)
  846. if err != nil {
  847. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  848. return
  849. }
  850. forward_Cluster_MemberAdd_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  851. })
  852. mux.Handle("POST", pattern_Cluster_MemberRemove_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  853. ctx, cancel := context.WithCancel(ctx)
  854. defer cancel()
  855. if cn, ok := w.(http.CloseNotifier); ok {
  856. go func(done <-chan struct{}, closed <-chan bool) {
  857. select {
  858. case <-done:
  859. case <-closed:
  860. cancel()
  861. }
  862. }(ctx.Done(), cn.CloseNotify())
  863. }
  864. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  865. rctx, err := runtime.AnnotateContext(ctx, req)
  866. if err != nil {
  867. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  868. }
  869. resp, md, err := request_Cluster_MemberRemove_0(rctx, inboundMarshaler, client, req, pathParams)
  870. ctx = runtime.NewServerMetadataContext(ctx, md)
  871. if err != nil {
  872. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  873. return
  874. }
  875. forward_Cluster_MemberRemove_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  876. })
  877. mux.Handle("POST", pattern_Cluster_MemberUpdate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  878. ctx, cancel := context.WithCancel(ctx)
  879. defer cancel()
  880. if cn, ok := w.(http.CloseNotifier); ok {
  881. go func(done <-chan struct{}, closed <-chan bool) {
  882. select {
  883. case <-done:
  884. case <-closed:
  885. cancel()
  886. }
  887. }(ctx.Done(), cn.CloseNotify())
  888. }
  889. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  890. rctx, err := runtime.AnnotateContext(ctx, req)
  891. if err != nil {
  892. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  893. }
  894. resp, md, err := request_Cluster_MemberUpdate_0(rctx, inboundMarshaler, client, req, pathParams)
  895. ctx = runtime.NewServerMetadataContext(ctx, md)
  896. if err != nil {
  897. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  898. return
  899. }
  900. forward_Cluster_MemberUpdate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  901. })
  902. mux.Handle("POST", pattern_Cluster_MemberList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  903. ctx, cancel := context.WithCancel(ctx)
  904. defer cancel()
  905. if cn, ok := w.(http.CloseNotifier); ok {
  906. go func(done <-chan struct{}, closed <-chan bool) {
  907. select {
  908. case <-done:
  909. case <-closed:
  910. cancel()
  911. }
  912. }(ctx.Done(), cn.CloseNotify())
  913. }
  914. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  915. rctx, err := runtime.AnnotateContext(ctx, req)
  916. if err != nil {
  917. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  918. }
  919. resp, md, err := request_Cluster_MemberList_0(rctx, inboundMarshaler, client, req, pathParams)
  920. ctx = runtime.NewServerMetadataContext(ctx, md)
  921. if err != nil {
  922. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  923. return
  924. }
  925. forward_Cluster_MemberList_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  926. })
  927. return nil
  928. }
  929. var (
  930. pattern_Cluster_MemberAdd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "cluster", "member", "add"}, ""))
  931. pattern_Cluster_MemberRemove_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "cluster", "member", "remove"}, ""))
  932. pattern_Cluster_MemberUpdate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "cluster", "member", "update"}, ""))
  933. pattern_Cluster_MemberList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "cluster", "member", "list"}, ""))
  934. )
  935. var (
  936. forward_Cluster_MemberAdd_0 = runtime.ForwardResponseMessage
  937. forward_Cluster_MemberRemove_0 = runtime.ForwardResponseMessage
  938. forward_Cluster_MemberUpdate_0 = runtime.ForwardResponseMessage
  939. forward_Cluster_MemberList_0 = runtime.ForwardResponseMessage
  940. )
  941. // RegisterMaintenanceHandlerFromEndpoint is same as RegisterMaintenanceHandler but
  942. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
  943. func RegisterMaintenanceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
  944. conn, err := grpc.Dial(endpoint, opts...)
  945. if err != nil {
  946. return err
  947. }
  948. defer func() {
  949. if err != nil {
  950. if cerr := conn.Close(); cerr != nil {
  951. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  952. }
  953. return
  954. }
  955. go func() {
  956. <-ctx.Done()
  957. if cerr := conn.Close(); cerr != nil {
  958. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  959. }
  960. }()
  961. }()
  962. return RegisterMaintenanceHandler(ctx, mux, conn)
  963. }
  964. // RegisterMaintenanceHandler registers the http handlers for service Maintenance to "mux".
  965. // The handlers forward requests to the grpc endpoint over "conn".
  966. func RegisterMaintenanceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
  967. client := NewMaintenanceClient(conn)
  968. mux.Handle("POST", pattern_Maintenance_Alarm_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  969. ctx, cancel := context.WithCancel(ctx)
  970. defer cancel()
  971. if cn, ok := w.(http.CloseNotifier); ok {
  972. go func(done <-chan struct{}, closed <-chan bool) {
  973. select {
  974. case <-done:
  975. case <-closed:
  976. cancel()
  977. }
  978. }(ctx.Done(), cn.CloseNotify())
  979. }
  980. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  981. rctx, err := runtime.AnnotateContext(ctx, req)
  982. if err != nil {
  983. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  984. }
  985. resp, md, err := request_Maintenance_Alarm_0(rctx, inboundMarshaler, client, req, pathParams)
  986. ctx = runtime.NewServerMetadataContext(ctx, md)
  987. if err != nil {
  988. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  989. return
  990. }
  991. forward_Maintenance_Alarm_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  992. })
  993. mux.Handle("POST", pattern_Maintenance_Status_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  994. ctx, cancel := context.WithCancel(ctx)
  995. defer cancel()
  996. if cn, ok := w.(http.CloseNotifier); ok {
  997. go func(done <-chan struct{}, closed <-chan bool) {
  998. select {
  999. case <-done:
  1000. case <-closed:
  1001. cancel()
  1002. }
  1003. }(ctx.Done(), cn.CloseNotify())
  1004. }
  1005. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1006. rctx, err := runtime.AnnotateContext(ctx, req)
  1007. if err != nil {
  1008. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1009. }
  1010. resp, md, err := request_Maintenance_Status_0(rctx, inboundMarshaler, client, req, pathParams)
  1011. ctx = runtime.NewServerMetadataContext(ctx, md)
  1012. if err != nil {
  1013. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1014. return
  1015. }
  1016. forward_Maintenance_Status_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1017. })
  1018. mux.Handle("POST", pattern_Maintenance_Defragment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1019. ctx, cancel := context.WithCancel(ctx)
  1020. defer cancel()
  1021. if cn, ok := w.(http.CloseNotifier); ok {
  1022. go func(done <-chan struct{}, closed <-chan bool) {
  1023. select {
  1024. case <-done:
  1025. case <-closed:
  1026. cancel()
  1027. }
  1028. }(ctx.Done(), cn.CloseNotify())
  1029. }
  1030. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1031. rctx, err := runtime.AnnotateContext(ctx, req)
  1032. if err != nil {
  1033. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1034. }
  1035. resp, md, err := request_Maintenance_Defragment_0(rctx, inboundMarshaler, client, req, pathParams)
  1036. ctx = runtime.NewServerMetadataContext(ctx, md)
  1037. if err != nil {
  1038. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1039. return
  1040. }
  1041. forward_Maintenance_Defragment_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1042. })
  1043. mux.Handle("POST", pattern_Maintenance_Hash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1044. ctx, cancel := context.WithCancel(ctx)
  1045. defer cancel()
  1046. if cn, ok := w.(http.CloseNotifier); ok {
  1047. go func(done <-chan struct{}, closed <-chan bool) {
  1048. select {
  1049. case <-done:
  1050. case <-closed:
  1051. cancel()
  1052. }
  1053. }(ctx.Done(), cn.CloseNotify())
  1054. }
  1055. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1056. rctx, err := runtime.AnnotateContext(ctx, req)
  1057. if err != nil {
  1058. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1059. }
  1060. resp, md, err := request_Maintenance_Hash_0(rctx, inboundMarshaler, client, req, pathParams)
  1061. ctx = runtime.NewServerMetadataContext(ctx, md)
  1062. if err != nil {
  1063. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1064. return
  1065. }
  1066. forward_Maintenance_Hash_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1067. })
  1068. mux.Handle("POST", pattern_Maintenance_Snapshot_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1069. ctx, cancel := context.WithCancel(ctx)
  1070. defer cancel()
  1071. if cn, ok := w.(http.CloseNotifier); ok {
  1072. go func(done <-chan struct{}, closed <-chan bool) {
  1073. select {
  1074. case <-done:
  1075. case <-closed:
  1076. cancel()
  1077. }
  1078. }(ctx.Done(), cn.CloseNotify())
  1079. }
  1080. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1081. rctx, err := runtime.AnnotateContext(ctx, req)
  1082. if err != nil {
  1083. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1084. }
  1085. resp, md, err := request_Maintenance_Snapshot_0(rctx, inboundMarshaler, client, req, pathParams)
  1086. ctx = runtime.NewServerMetadataContext(ctx, md)
  1087. if err != nil {
  1088. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1089. return
  1090. }
  1091. forward_Maintenance_Snapshot_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
  1092. })
  1093. return nil
  1094. }
  1095. var (
  1096. pattern_Maintenance_Alarm_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "maintenance", "alarm"}, ""))
  1097. pattern_Maintenance_Status_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "maintenance", "status"}, ""))
  1098. pattern_Maintenance_Defragment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "maintenance", "defragment"}, ""))
  1099. pattern_Maintenance_Hash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "maintenance", "hash"}, ""))
  1100. pattern_Maintenance_Snapshot_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "maintenance", "snapshot"}, ""))
  1101. )
  1102. var (
  1103. forward_Maintenance_Alarm_0 = runtime.ForwardResponseMessage
  1104. forward_Maintenance_Status_0 = runtime.ForwardResponseMessage
  1105. forward_Maintenance_Defragment_0 = runtime.ForwardResponseMessage
  1106. forward_Maintenance_Hash_0 = runtime.ForwardResponseMessage
  1107. forward_Maintenance_Snapshot_0 = runtime.ForwardResponseStream
  1108. )
  1109. // RegisterAuthHandlerFromEndpoint is same as RegisterAuthHandler but
  1110. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
  1111. func RegisterAuthHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
  1112. conn, err := grpc.Dial(endpoint, opts...)
  1113. if err != nil {
  1114. return err
  1115. }
  1116. defer func() {
  1117. if err != nil {
  1118. if cerr := conn.Close(); cerr != nil {
  1119. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  1120. }
  1121. return
  1122. }
  1123. go func() {
  1124. <-ctx.Done()
  1125. if cerr := conn.Close(); cerr != nil {
  1126. grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
  1127. }
  1128. }()
  1129. }()
  1130. return RegisterAuthHandler(ctx, mux, conn)
  1131. }
  1132. // RegisterAuthHandler registers the http handlers for service Auth to "mux".
  1133. // The handlers forward requests to the grpc endpoint over "conn".
  1134. func RegisterAuthHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
  1135. client := NewAuthClient(conn)
  1136. mux.Handle("POST", pattern_Auth_AuthEnable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1137. ctx, cancel := context.WithCancel(ctx)
  1138. defer cancel()
  1139. if cn, ok := w.(http.CloseNotifier); ok {
  1140. go func(done <-chan struct{}, closed <-chan bool) {
  1141. select {
  1142. case <-done:
  1143. case <-closed:
  1144. cancel()
  1145. }
  1146. }(ctx.Done(), cn.CloseNotify())
  1147. }
  1148. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1149. rctx, err := runtime.AnnotateContext(ctx, req)
  1150. if err != nil {
  1151. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1152. }
  1153. resp, md, err := request_Auth_AuthEnable_0(rctx, inboundMarshaler, client, req, pathParams)
  1154. ctx = runtime.NewServerMetadataContext(ctx, md)
  1155. if err != nil {
  1156. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1157. return
  1158. }
  1159. forward_Auth_AuthEnable_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1160. })
  1161. mux.Handle("POST", pattern_Auth_AuthDisable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1162. ctx, cancel := context.WithCancel(ctx)
  1163. defer cancel()
  1164. if cn, ok := w.(http.CloseNotifier); ok {
  1165. go func(done <-chan struct{}, closed <-chan bool) {
  1166. select {
  1167. case <-done:
  1168. case <-closed:
  1169. cancel()
  1170. }
  1171. }(ctx.Done(), cn.CloseNotify())
  1172. }
  1173. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1174. rctx, err := runtime.AnnotateContext(ctx, req)
  1175. if err != nil {
  1176. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1177. }
  1178. resp, md, err := request_Auth_AuthDisable_0(rctx, inboundMarshaler, client, req, pathParams)
  1179. ctx = runtime.NewServerMetadataContext(ctx, md)
  1180. if err != nil {
  1181. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1182. return
  1183. }
  1184. forward_Auth_AuthDisable_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1185. })
  1186. mux.Handle("POST", pattern_Auth_Authenticate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1187. ctx, cancel := context.WithCancel(ctx)
  1188. defer cancel()
  1189. if cn, ok := w.(http.CloseNotifier); ok {
  1190. go func(done <-chan struct{}, closed <-chan bool) {
  1191. select {
  1192. case <-done:
  1193. case <-closed:
  1194. cancel()
  1195. }
  1196. }(ctx.Done(), cn.CloseNotify())
  1197. }
  1198. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1199. rctx, err := runtime.AnnotateContext(ctx, req)
  1200. if err != nil {
  1201. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1202. }
  1203. resp, md, err := request_Auth_Authenticate_0(rctx, inboundMarshaler, client, req, pathParams)
  1204. ctx = runtime.NewServerMetadataContext(ctx, md)
  1205. if err != nil {
  1206. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1207. return
  1208. }
  1209. forward_Auth_Authenticate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1210. })
  1211. mux.Handle("POST", pattern_Auth_UserAdd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1212. ctx, cancel := context.WithCancel(ctx)
  1213. defer cancel()
  1214. if cn, ok := w.(http.CloseNotifier); ok {
  1215. go func(done <-chan struct{}, closed <-chan bool) {
  1216. select {
  1217. case <-done:
  1218. case <-closed:
  1219. cancel()
  1220. }
  1221. }(ctx.Done(), cn.CloseNotify())
  1222. }
  1223. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1224. rctx, err := runtime.AnnotateContext(ctx, req)
  1225. if err != nil {
  1226. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1227. }
  1228. resp, md, err := request_Auth_UserAdd_0(rctx, inboundMarshaler, client, req, pathParams)
  1229. ctx = runtime.NewServerMetadataContext(ctx, md)
  1230. if err != nil {
  1231. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1232. return
  1233. }
  1234. forward_Auth_UserAdd_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1235. })
  1236. mux.Handle("POST", pattern_Auth_UserGet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1237. ctx, cancel := context.WithCancel(ctx)
  1238. defer cancel()
  1239. if cn, ok := w.(http.CloseNotifier); ok {
  1240. go func(done <-chan struct{}, closed <-chan bool) {
  1241. select {
  1242. case <-done:
  1243. case <-closed:
  1244. cancel()
  1245. }
  1246. }(ctx.Done(), cn.CloseNotify())
  1247. }
  1248. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1249. rctx, err := runtime.AnnotateContext(ctx, req)
  1250. if err != nil {
  1251. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1252. }
  1253. resp, md, err := request_Auth_UserGet_0(rctx, inboundMarshaler, client, req, pathParams)
  1254. ctx = runtime.NewServerMetadataContext(ctx, md)
  1255. if err != nil {
  1256. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1257. return
  1258. }
  1259. forward_Auth_UserGet_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1260. })
  1261. mux.Handle("POST", pattern_Auth_UserList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1262. ctx, cancel := context.WithCancel(ctx)
  1263. defer cancel()
  1264. if cn, ok := w.(http.CloseNotifier); ok {
  1265. go func(done <-chan struct{}, closed <-chan bool) {
  1266. select {
  1267. case <-done:
  1268. case <-closed:
  1269. cancel()
  1270. }
  1271. }(ctx.Done(), cn.CloseNotify())
  1272. }
  1273. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1274. rctx, err := runtime.AnnotateContext(ctx, req)
  1275. if err != nil {
  1276. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1277. }
  1278. resp, md, err := request_Auth_UserList_0(rctx, inboundMarshaler, client, req, pathParams)
  1279. ctx = runtime.NewServerMetadataContext(ctx, md)
  1280. if err != nil {
  1281. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1282. return
  1283. }
  1284. forward_Auth_UserList_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1285. })
  1286. mux.Handle("POST", pattern_Auth_UserDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1287. ctx, cancel := context.WithCancel(ctx)
  1288. defer cancel()
  1289. if cn, ok := w.(http.CloseNotifier); ok {
  1290. go func(done <-chan struct{}, closed <-chan bool) {
  1291. select {
  1292. case <-done:
  1293. case <-closed:
  1294. cancel()
  1295. }
  1296. }(ctx.Done(), cn.CloseNotify())
  1297. }
  1298. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1299. rctx, err := runtime.AnnotateContext(ctx, req)
  1300. if err != nil {
  1301. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1302. }
  1303. resp, md, err := request_Auth_UserDelete_0(rctx, inboundMarshaler, client, req, pathParams)
  1304. ctx = runtime.NewServerMetadataContext(ctx, md)
  1305. if err != nil {
  1306. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1307. return
  1308. }
  1309. forward_Auth_UserDelete_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1310. })
  1311. mux.Handle("POST", pattern_Auth_UserChangePassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1312. ctx, cancel := context.WithCancel(ctx)
  1313. defer cancel()
  1314. if cn, ok := w.(http.CloseNotifier); ok {
  1315. go func(done <-chan struct{}, closed <-chan bool) {
  1316. select {
  1317. case <-done:
  1318. case <-closed:
  1319. cancel()
  1320. }
  1321. }(ctx.Done(), cn.CloseNotify())
  1322. }
  1323. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1324. rctx, err := runtime.AnnotateContext(ctx, req)
  1325. if err != nil {
  1326. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1327. }
  1328. resp, md, err := request_Auth_UserChangePassword_0(rctx, inboundMarshaler, client, req, pathParams)
  1329. ctx = runtime.NewServerMetadataContext(ctx, md)
  1330. if err != nil {
  1331. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1332. return
  1333. }
  1334. forward_Auth_UserChangePassword_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1335. })
  1336. mux.Handle("POST", pattern_Auth_UserGrantRole_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1337. ctx, cancel := context.WithCancel(ctx)
  1338. defer cancel()
  1339. if cn, ok := w.(http.CloseNotifier); ok {
  1340. go func(done <-chan struct{}, closed <-chan bool) {
  1341. select {
  1342. case <-done:
  1343. case <-closed:
  1344. cancel()
  1345. }
  1346. }(ctx.Done(), cn.CloseNotify())
  1347. }
  1348. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1349. rctx, err := runtime.AnnotateContext(ctx, req)
  1350. if err != nil {
  1351. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1352. }
  1353. resp, md, err := request_Auth_UserGrantRole_0(rctx, inboundMarshaler, client, req, pathParams)
  1354. ctx = runtime.NewServerMetadataContext(ctx, md)
  1355. if err != nil {
  1356. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1357. return
  1358. }
  1359. forward_Auth_UserGrantRole_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1360. })
  1361. mux.Handle("POST", pattern_Auth_UserRevokeRole_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1362. ctx, cancel := context.WithCancel(ctx)
  1363. defer cancel()
  1364. if cn, ok := w.(http.CloseNotifier); ok {
  1365. go func(done <-chan struct{}, closed <-chan bool) {
  1366. select {
  1367. case <-done:
  1368. case <-closed:
  1369. cancel()
  1370. }
  1371. }(ctx.Done(), cn.CloseNotify())
  1372. }
  1373. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1374. rctx, err := runtime.AnnotateContext(ctx, req)
  1375. if err != nil {
  1376. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1377. }
  1378. resp, md, err := request_Auth_UserRevokeRole_0(rctx, inboundMarshaler, client, req, pathParams)
  1379. ctx = runtime.NewServerMetadataContext(ctx, md)
  1380. if err != nil {
  1381. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1382. return
  1383. }
  1384. forward_Auth_UserRevokeRole_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1385. })
  1386. mux.Handle("POST", pattern_Auth_RoleAdd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1387. ctx, cancel := context.WithCancel(ctx)
  1388. defer cancel()
  1389. if cn, ok := w.(http.CloseNotifier); ok {
  1390. go func(done <-chan struct{}, closed <-chan bool) {
  1391. select {
  1392. case <-done:
  1393. case <-closed:
  1394. cancel()
  1395. }
  1396. }(ctx.Done(), cn.CloseNotify())
  1397. }
  1398. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1399. rctx, err := runtime.AnnotateContext(ctx, req)
  1400. if err != nil {
  1401. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1402. }
  1403. resp, md, err := request_Auth_RoleAdd_0(rctx, inboundMarshaler, client, req, pathParams)
  1404. ctx = runtime.NewServerMetadataContext(ctx, md)
  1405. if err != nil {
  1406. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1407. return
  1408. }
  1409. forward_Auth_RoleAdd_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1410. })
  1411. mux.Handle("POST", pattern_Auth_RoleGet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1412. ctx, cancel := context.WithCancel(ctx)
  1413. defer cancel()
  1414. if cn, ok := w.(http.CloseNotifier); ok {
  1415. go func(done <-chan struct{}, closed <-chan bool) {
  1416. select {
  1417. case <-done:
  1418. case <-closed:
  1419. cancel()
  1420. }
  1421. }(ctx.Done(), cn.CloseNotify())
  1422. }
  1423. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1424. rctx, err := runtime.AnnotateContext(ctx, req)
  1425. if err != nil {
  1426. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1427. }
  1428. resp, md, err := request_Auth_RoleGet_0(rctx, inboundMarshaler, client, req, pathParams)
  1429. ctx = runtime.NewServerMetadataContext(ctx, md)
  1430. if err != nil {
  1431. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1432. return
  1433. }
  1434. forward_Auth_RoleGet_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1435. })
  1436. mux.Handle("POST", pattern_Auth_RoleList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1437. ctx, cancel := context.WithCancel(ctx)
  1438. defer cancel()
  1439. if cn, ok := w.(http.CloseNotifier); ok {
  1440. go func(done <-chan struct{}, closed <-chan bool) {
  1441. select {
  1442. case <-done:
  1443. case <-closed:
  1444. cancel()
  1445. }
  1446. }(ctx.Done(), cn.CloseNotify())
  1447. }
  1448. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1449. rctx, err := runtime.AnnotateContext(ctx, req)
  1450. if err != nil {
  1451. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1452. }
  1453. resp, md, err := request_Auth_RoleList_0(rctx, inboundMarshaler, client, req, pathParams)
  1454. ctx = runtime.NewServerMetadataContext(ctx, md)
  1455. if err != nil {
  1456. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1457. return
  1458. }
  1459. forward_Auth_RoleList_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1460. })
  1461. mux.Handle("POST", pattern_Auth_RoleDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1462. ctx, cancel := context.WithCancel(ctx)
  1463. defer cancel()
  1464. if cn, ok := w.(http.CloseNotifier); ok {
  1465. go func(done <-chan struct{}, closed <-chan bool) {
  1466. select {
  1467. case <-done:
  1468. case <-closed:
  1469. cancel()
  1470. }
  1471. }(ctx.Done(), cn.CloseNotify())
  1472. }
  1473. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1474. rctx, err := runtime.AnnotateContext(ctx, req)
  1475. if err != nil {
  1476. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1477. }
  1478. resp, md, err := request_Auth_RoleDelete_0(rctx, inboundMarshaler, client, req, pathParams)
  1479. ctx = runtime.NewServerMetadataContext(ctx, md)
  1480. if err != nil {
  1481. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1482. return
  1483. }
  1484. forward_Auth_RoleDelete_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1485. })
  1486. mux.Handle("POST", pattern_Auth_RoleGrantPermission_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1487. ctx, cancel := context.WithCancel(ctx)
  1488. defer cancel()
  1489. if cn, ok := w.(http.CloseNotifier); ok {
  1490. go func(done <-chan struct{}, closed <-chan bool) {
  1491. select {
  1492. case <-done:
  1493. case <-closed:
  1494. cancel()
  1495. }
  1496. }(ctx.Done(), cn.CloseNotify())
  1497. }
  1498. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1499. rctx, err := runtime.AnnotateContext(ctx, req)
  1500. if err != nil {
  1501. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1502. }
  1503. resp, md, err := request_Auth_RoleGrantPermission_0(rctx, inboundMarshaler, client, req, pathParams)
  1504. ctx = runtime.NewServerMetadataContext(ctx, md)
  1505. if err != nil {
  1506. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1507. return
  1508. }
  1509. forward_Auth_RoleGrantPermission_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1510. })
  1511. mux.Handle("POST", pattern_Auth_RoleRevokePermission_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  1512. ctx, cancel := context.WithCancel(ctx)
  1513. defer cancel()
  1514. if cn, ok := w.(http.CloseNotifier); ok {
  1515. go func(done <-chan struct{}, closed <-chan bool) {
  1516. select {
  1517. case <-done:
  1518. case <-closed:
  1519. cancel()
  1520. }
  1521. }(ctx.Done(), cn.CloseNotify())
  1522. }
  1523. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  1524. rctx, err := runtime.AnnotateContext(ctx, req)
  1525. if err != nil {
  1526. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1527. }
  1528. resp, md, err := request_Auth_RoleRevokePermission_0(rctx, inboundMarshaler, client, req, pathParams)
  1529. ctx = runtime.NewServerMetadataContext(ctx, md)
  1530. if err != nil {
  1531. runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
  1532. return
  1533. }
  1534. forward_Auth_RoleRevokePermission_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  1535. })
  1536. return nil
  1537. }
  1538. var (
  1539. pattern_Auth_AuthEnable_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "auth", "enable"}, ""))
  1540. pattern_Auth_AuthDisable_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "auth", "disable"}, ""))
  1541. pattern_Auth_Authenticate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "auth", "authenticate"}, ""))
  1542. pattern_Auth_UserAdd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "add"}, ""))
  1543. pattern_Auth_UserGet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "get"}, ""))
  1544. pattern_Auth_UserList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "list"}, ""))
  1545. pattern_Auth_UserDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "delete"}, ""))
  1546. pattern_Auth_UserChangePassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "changepw"}, ""))
  1547. pattern_Auth_UserGrantRole_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "grant"}, ""))
  1548. pattern_Auth_UserRevokeRole_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "revoke"}, ""))
  1549. pattern_Auth_RoleAdd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "add"}, ""))
  1550. pattern_Auth_RoleGet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "get"}, ""))
  1551. pattern_Auth_RoleList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "list"}, ""))
  1552. pattern_Auth_RoleDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "delete"}, ""))
  1553. pattern_Auth_RoleGrantPermission_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "grant"}, ""))
  1554. pattern_Auth_RoleRevokePermission_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "revoke"}, ""))
  1555. )
  1556. var (
  1557. forward_Auth_AuthEnable_0 = runtime.ForwardResponseMessage
  1558. forward_Auth_AuthDisable_0 = runtime.ForwardResponseMessage
  1559. forward_Auth_Authenticate_0 = runtime.ForwardResponseMessage
  1560. forward_Auth_UserAdd_0 = runtime.ForwardResponseMessage
  1561. forward_Auth_UserGet_0 = runtime.ForwardResponseMessage
  1562. forward_Auth_UserList_0 = runtime.ForwardResponseMessage
  1563. forward_Auth_UserDelete_0 = runtime.ForwardResponseMessage
  1564. forward_Auth_UserChangePassword_0 = runtime.ForwardResponseMessage
  1565. forward_Auth_UserGrantRole_0 = runtime.ForwardResponseMessage
  1566. forward_Auth_UserRevokeRole_0 = runtime.ForwardResponseMessage
  1567. forward_Auth_RoleAdd_0 = runtime.ForwardResponseMessage
  1568. forward_Auth_RoleGet_0 = runtime.ForwardResponseMessage
  1569. forward_Auth_RoleList_0 = runtime.ForwardResponseMessage
  1570. forward_Auth_RoleDelete_0 = runtime.ForwardResponseMessage
  1571. forward_Auth_RoleGrantPermission_0 = runtime.ForwardResponseMessage
  1572. forward_Auth_RoleRevokePermission_0 = runtime.ForwardResponseMessage
  1573. )