rpc.pb.gw.go 79 KB

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