idp_service.pb.gw.go 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
  2. // source: api/v1/idp_service.proto
  3. /*
  4. Package apiv1 is a reverse proxy.
  5. It translates gRPC into RESTful JSON APIs.
  6. */
  7. package apiv1
  8. import (
  9. "context"
  10. "errors"
  11. "io"
  12. "net/http"
  13. "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
  14. "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
  15. "google.golang.org/grpc"
  16. "google.golang.org/grpc/codes"
  17. "google.golang.org/grpc/grpclog"
  18. "google.golang.org/grpc/metadata"
  19. "google.golang.org/grpc/status"
  20. "google.golang.org/protobuf/proto"
  21. )
  22. // Suppress "imported and not used" errors
  23. var (
  24. _ codes.Code
  25. _ io.Reader
  26. _ status.Status
  27. _ = errors.New
  28. _ = runtime.String
  29. _ = utilities.NewDoubleArray
  30. _ = metadata.Join
  31. )
  32. func request_IdentityProviderService_ListIdentityProviders_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  33. var (
  34. protoReq ListIdentityProvidersRequest
  35. metadata runtime.ServerMetadata
  36. )
  37. msg, err := client.ListIdentityProviders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  38. return msg, metadata, err
  39. }
  40. func local_request_IdentityProviderService_ListIdentityProviders_0(ctx context.Context, marshaler runtime.Marshaler, server IdentityProviderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  41. var (
  42. protoReq ListIdentityProvidersRequest
  43. metadata runtime.ServerMetadata
  44. )
  45. msg, err := server.ListIdentityProviders(ctx, &protoReq)
  46. return msg, metadata, err
  47. }
  48. func request_IdentityProviderService_GetIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  49. var (
  50. protoReq GetIdentityProviderRequest
  51. metadata runtime.ServerMetadata
  52. err error
  53. )
  54. val, ok := pathParams["name"]
  55. if !ok {
  56. return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
  57. }
  58. protoReq.Name, err = runtime.String(val)
  59. if err != nil {
  60. return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
  61. }
  62. msg, err := client.GetIdentityProvider(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  63. return msg, metadata, err
  64. }
  65. func local_request_IdentityProviderService_GetIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, server IdentityProviderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  66. var (
  67. protoReq GetIdentityProviderRequest
  68. metadata runtime.ServerMetadata
  69. err error
  70. )
  71. val, ok := pathParams["name"]
  72. if !ok {
  73. return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
  74. }
  75. protoReq.Name, err = runtime.String(val)
  76. if err != nil {
  77. return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
  78. }
  79. msg, err := server.GetIdentityProvider(ctx, &protoReq)
  80. return msg, metadata, err
  81. }
  82. func request_IdentityProviderService_CreateIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  83. var (
  84. protoReq CreateIdentityProviderRequest
  85. metadata runtime.ServerMetadata
  86. )
  87. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.IdentityProvider); err != nil && !errors.Is(err, io.EOF) {
  88. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  89. }
  90. msg, err := client.CreateIdentityProvider(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  91. return msg, metadata, err
  92. }
  93. func local_request_IdentityProviderService_CreateIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, server IdentityProviderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  94. var (
  95. protoReq CreateIdentityProviderRequest
  96. metadata runtime.ServerMetadata
  97. )
  98. if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.IdentityProvider); err != nil && !errors.Is(err, io.EOF) {
  99. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  100. }
  101. msg, err := server.CreateIdentityProvider(ctx, &protoReq)
  102. return msg, metadata, err
  103. }
  104. var filter_IdentityProviderService_UpdateIdentityProvider_0 = &utilities.DoubleArray{Encoding: map[string]int{"identity_provider": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
  105. func request_IdentityProviderService_UpdateIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  106. var (
  107. protoReq UpdateIdentityProviderRequest
  108. metadata runtime.ServerMetadata
  109. err error
  110. )
  111. newReader, berr := utilities.IOReaderFactory(req.Body)
  112. if berr != nil {
  113. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
  114. }
  115. if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.IdentityProvider); err != nil && !errors.Is(err, io.EOF) {
  116. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  117. }
  118. if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
  119. if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.IdentityProvider); err != nil {
  120. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  121. } else {
  122. protoReq.UpdateMask = fieldMask
  123. }
  124. }
  125. val, ok := pathParams["identity_provider.name"]
  126. if !ok {
  127. return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "identity_provider.name")
  128. }
  129. err = runtime.PopulateFieldFromPath(&protoReq, "identity_provider.name", val)
  130. if err != nil {
  131. return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "identity_provider.name", err)
  132. }
  133. if err := req.ParseForm(); err != nil {
  134. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  135. }
  136. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_IdentityProviderService_UpdateIdentityProvider_0); err != nil {
  137. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  138. }
  139. msg, err := client.UpdateIdentityProvider(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  140. return msg, metadata, err
  141. }
  142. func local_request_IdentityProviderService_UpdateIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, server IdentityProviderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  143. var (
  144. protoReq UpdateIdentityProviderRequest
  145. metadata runtime.ServerMetadata
  146. err error
  147. )
  148. newReader, berr := utilities.IOReaderFactory(req.Body)
  149. if berr != nil {
  150. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
  151. }
  152. if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.IdentityProvider); err != nil && !errors.Is(err, io.EOF) {
  153. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  154. }
  155. if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
  156. if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.IdentityProvider); err != nil {
  157. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  158. } else {
  159. protoReq.UpdateMask = fieldMask
  160. }
  161. }
  162. val, ok := pathParams["identity_provider.name"]
  163. if !ok {
  164. return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "identity_provider.name")
  165. }
  166. err = runtime.PopulateFieldFromPath(&protoReq, "identity_provider.name", val)
  167. if err != nil {
  168. return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "identity_provider.name", err)
  169. }
  170. if err := req.ParseForm(); err != nil {
  171. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  172. }
  173. if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_IdentityProviderService_UpdateIdentityProvider_0); err != nil {
  174. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
  175. }
  176. msg, err := server.UpdateIdentityProvider(ctx, &protoReq)
  177. return msg, metadata, err
  178. }
  179. func request_IdentityProviderService_DeleteIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  180. var (
  181. protoReq DeleteIdentityProviderRequest
  182. metadata runtime.ServerMetadata
  183. err error
  184. )
  185. val, ok := pathParams["name"]
  186. if !ok {
  187. return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
  188. }
  189. protoReq.Name, err = runtime.String(val)
  190. if err != nil {
  191. return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
  192. }
  193. msg, err := client.DeleteIdentityProvider(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
  194. return msg, metadata, err
  195. }
  196. func local_request_IdentityProviderService_DeleteIdentityProvider_0(ctx context.Context, marshaler runtime.Marshaler, server IdentityProviderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
  197. var (
  198. protoReq DeleteIdentityProviderRequest
  199. metadata runtime.ServerMetadata
  200. err error
  201. )
  202. val, ok := pathParams["name"]
  203. if !ok {
  204. return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
  205. }
  206. protoReq.Name, err = runtime.String(val)
  207. if err != nil {
  208. return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
  209. }
  210. msg, err := server.DeleteIdentityProvider(ctx, &protoReq)
  211. return msg, metadata, err
  212. }
  213. // RegisterIdentityProviderServiceHandlerServer registers the http handlers for service IdentityProviderService to "mux".
  214. // UnaryRPC :call IdentityProviderServiceServer directly.
  215. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
  216. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterIdentityProviderServiceHandlerFromEndpoint instead.
  217. // GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
  218. func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server IdentityProviderServiceServer) error {
  219. mux.Handle(http.MethodGet, pattern_IdentityProviderService_ListIdentityProviders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  220. ctx, cancel := context.WithCancel(req.Context())
  221. defer cancel()
  222. var stream runtime.ServerTransportStream
  223. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  224. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  225. annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/ListIdentityProviders", runtime.WithHTTPPathPattern("/api/v1/identityProviders"))
  226. if err != nil {
  227. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  228. return
  229. }
  230. resp, md, err := local_request_IdentityProviderService_ListIdentityProviders_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  231. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  232. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  233. if err != nil {
  234. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  235. return
  236. }
  237. forward_IdentityProviderService_ListIdentityProviders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  238. })
  239. mux.Handle(http.MethodGet, pattern_IdentityProviderService_GetIdentityProvider_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  240. ctx, cancel := context.WithCancel(req.Context())
  241. defer cancel()
  242. var stream runtime.ServerTransportStream
  243. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  244. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  245. annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/GetIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identityProviders/*}"))
  246. if err != nil {
  247. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  248. return
  249. }
  250. resp, md, err := local_request_IdentityProviderService_GetIdentityProvider_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  251. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  252. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  253. if err != nil {
  254. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  255. return
  256. }
  257. forward_IdentityProviderService_GetIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  258. })
  259. mux.Handle(http.MethodPost, pattern_IdentityProviderService_CreateIdentityProvider_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  260. ctx, cancel := context.WithCancel(req.Context())
  261. defer cancel()
  262. var stream runtime.ServerTransportStream
  263. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  264. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  265. annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/CreateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/identityProviders"))
  266. if err != nil {
  267. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  268. return
  269. }
  270. resp, md, err := local_request_IdentityProviderService_CreateIdentityProvider_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  271. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  272. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  273. if err != nil {
  274. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  275. return
  276. }
  277. forward_IdentityProviderService_CreateIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  278. })
  279. mux.Handle(http.MethodPatch, pattern_IdentityProviderService_UpdateIdentityProvider_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  280. ctx, cancel := context.WithCancel(req.Context())
  281. defer cancel()
  282. var stream runtime.ServerTransportStream
  283. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  284. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  285. annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{identity_provider.name=identityProviders/*}"))
  286. if err != nil {
  287. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  288. return
  289. }
  290. resp, md, err := local_request_IdentityProviderService_UpdateIdentityProvider_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  291. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  292. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  293. if err != nil {
  294. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  295. return
  296. }
  297. forward_IdentityProviderService_UpdateIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  298. })
  299. mux.Handle(http.MethodDelete, pattern_IdentityProviderService_DeleteIdentityProvider_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  300. ctx, cancel := context.WithCancel(req.Context())
  301. defer cancel()
  302. var stream runtime.ServerTransportStream
  303. ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
  304. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  305. annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identityProviders/*}"))
  306. if err != nil {
  307. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  308. return
  309. }
  310. resp, md, err := local_request_IdentityProviderService_DeleteIdentityProvider_0(annotatedContext, inboundMarshaler, server, req, pathParams)
  311. md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
  312. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  313. if err != nil {
  314. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  315. return
  316. }
  317. forward_IdentityProviderService_DeleteIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  318. })
  319. return nil
  320. }
  321. // RegisterIdentityProviderServiceHandlerFromEndpoint is same as RegisterIdentityProviderServiceHandler but
  322. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
  323. func RegisterIdentityProviderServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
  324. conn, err := grpc.NewClient(endpoint, opts...)
  325. if err != nil {
  326. return err
  327. }
  328. defer func() {
  329. if err != nil {
  330. if cerr := conn.Close(); cerr != nil {
  331. grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
  332. }
  333. return
  334. }
  335. go func() {
  336. <-ctx.Done()
  337. if cerr := conn.Close(); cerr != nil {
  338. grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
  339. }
  340. }()
  341. }()
  342. return RegisterIdentityProviderServiceHandler(ctx, mux, conn)
  343. }
  344. // RegisterIdentityProviderServiceHandler registers the http handlers for service IdentityProviderService to "mux".
  345. // The handlers forward requests to the grpc endpoint over "conn".
  346. func RegisterIdentityProviderServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
  347. return RegisterIdentityProviderServiceHandlerClient(ctx, mux, NewIdentityProviderServiceClient(conn))
  348. }
  349. // RegisterIdentityProviderServiceHandlerClient registers the http handlers for service IdentityProviderService
  350. // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "IdentityProviderServiceClient".
  351. // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "IdentityProviderServiceClient"
  352. // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
  353. // "IdentityProviderServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
  354. func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client IdentityProviderServiceClient) error {
  355. mux.Handle(http.MethodGet, pattern_IdentityProviderService_ListIdentityProviders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  356. ctx, cancel := context.WithCancel(req.Context())
  357. defer cancel()
  358. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  359. annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/ListIdentityProviders", runtime.WithHTTPPathPattern("/api/v1/identityProviders"))
  360. if err != nil {
  361. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  362. return
  363. }
  364. resp, md, err := request_IdentityProviderService_ListIdentityProviders_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  365. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  366. if err != nil {
  367. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  368. return
  369. }
  370. forward_IdentityProviderService_ListIdentityProviders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  371. })
  372. mux.Handle(http.MethodGet, pattern_IdentityProviderService_GetIdentityProvider_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  373. ctx, cancel := context.WithCancel(req.Context())
  374. defer cancel()
  375. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  376. annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/GetIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identityProviders/*}"))
  377. if err != nil {
  378. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  379. return
  380. }
  381. resp, md, err := request_IdentityProviderService_GetIdentityProvider_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  382. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  383. if err != nil {
  384. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  385. return
  386. }
  387. forward_IdentityProviderService_GetIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  388. })
  389. mux.Handle(http.MethodPost, pattern_IdentityProviderService_CreateIdentityProvider_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  390. ctx, cancel := context.WithCancel(req.Context())
  391. defer cancel()
  392. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  393. annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/CreateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/identityProviders"))
  394. if err != nil {
  395. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  396. return
  397. }
  398. resp, md, err := request_IdentityProviderService_CreateIdentityProvider_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  399. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  400. if err != nil {
  401. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  402. return
  403. }
  404. forward_IdentityProviderService_CreateIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  405. })
  406. mux.Handle(http.MethodPatch, pattern_IdentityProviderService_UpdateIdentityProvider_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  407. ctx, cancel := context.WithCancel(req.Context())
  408. defer cancel()
  409. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  410. annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{identity_provider.name=identityProviders/*}"))
  411. if err != nil {
  412. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  413. return
  414. }
  415. resp, md, err := request_IdentityProviderService_UpdateIdentityProvider_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  416. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  417. if err != nil {
  418. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  419. return
  420. }
  421. forward_IdentityProviderService_UpdateIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  422. })
  423. mux.Handle(http.MethodDelete, pattern_IdentityProviderService_DeleteIdentityProvider_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
  424. ctx, cancel := context.WithCancel(req.Context())
  425. defer cancel()
  426. inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
  427. annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identityProviders/*}"))
  428. if err != nil {
  429. runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
  430. return
  431. }
  432. resp, md, err := request_IdentityProviderService_DeleteIdentityProvider_0(annotatedContext, inboundMarshaler, client, req, pathParams)
  433. annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
  434. if err != nil {
  435. runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
  436. return
  437. }
  438. forward_IdentityProviderService_DeleteIdentityProvider_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
  439. })
  440. return nil
  441. }
  442. var (
  443. pattern_IdentityProviderService_ListIdentityProviders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "identityProviders"}, ""))
  444. pattern_IdentityProviderService_GetIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identityProviders", "name"}, ""))
  445. pattern_IdentityProviderService_CreateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "identityProviders"}, ""))
  446. pattern_IdentityProviderService_UpdateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identityProviders", "identity_provider.name"}, ""))
  447. pattern_IdentityProviderService_DeleteIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identityProviders", "name"}, ""))
  448. )
  449. var (
  450. forward_IdentityProviderService_ListIdentityProviders_0 = runtime.ForwardResponseMessage
  451. forward_IdentityProviderService_GetIdentityProvider_0 = runtime.ForwardResponseMessage
  452. forward_IdentityProviderService_CreateIdentityProvider_0 = runtime.ForwardResponseMessage
  453. forward_IdentityProviderService_UpdateIdentityProvider_0 = runtime.ForwardResponseMessage
  454. forward_IdentityProviderService_DeleteIdentityProvider_0 = runtime.ForwardResponseMessage
  455. )