github.com/argoproj/argo-cd@v1.8.7/pkg/apiclient/session/session.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: server/session/session.proto 3 4 /* 5 Package session is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package session 10 11 import ( 12 "context" 13 "io" 14 "net/http" 15 16 "github.com/golang/protobuf/descriptor" 17 "github.com/golang/protobuf/proto" 18 "github.com/grpc-ecosystem/grpc-gateway/runtime" 19 "github.com/grpc-ecosystem/grpc-gateway/utilities" 20 "google.golang.org/grpc" 21 "google.golang.org/grpc/codes" 22 "google.golang.org/grpc/grpclog" 23 "google.golang.org/grpc/status" 24 ) 25 26 // Suppress "imported and not used" errors 27 var _ codes.Code 28 var _ io.Reader 29 var _ status.Status 30 var _ = runtime.String 31 var _ = utilities.NewDoubleArray 32 var _ = descriptor.ForMessage 33 34 func request_SessionService_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 35 var protoReq GetUserInfoRequest 36 var metadata runtime.ServerMetadata 37 38 msg, err := client.GetUserInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 39 return msg, metadata, err 40 41 } 42 43 func local_request_SessionService_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, server SessionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 44 var protoReq GetUserInfoRequest 45 var metadata runtime.ServerMetadata 46 47 msg, err := server.GetUserInfo(ctx, &protoReq) 48 return msg, metadata, err 49 50 } 51 52 func request_SessionService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 53 var protoReq SessionCreateRequest 54 var metadata runtime.ServerMetadata 55 56 newReader, berr := utilities.IOReaderFactory(req.Body) 57 if berr != nil { 58 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 59 } 60 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { 61 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 62 } 63 64 msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 65 return msg, metadata, err 66 67 } 68 69 func local_request_SessionService_Create_0(ctx context.Context, marshaler runtime.Marshaler, server SessionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 70 var protoReq SessionCreateRequest 71 var metadata runtime.ServerMetadata 72 73 newReader, berr := utilities.IOReaderFactory(req.Body) 74 if berr != nil { 75 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 76 } 77 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { 78 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 79 } 80 81 msg, err := server.Create(ctx, &protoReq) 82 return msg, metadata, err 83 84 } 85 86 func request_SessionService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 87 var protoReq SessionDeleteRequest 88 var metadata runtime.ServerMetadata 89 90 msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 91 return msg, metadata, err 92 93 } 94 95 func local_request_SessionService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, server SessionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 96 var protoReq SessionDeleteRequest 97 var metadata runtime.ServerMetadata 98 99 msg, err := server.Delete(ctx, &protoReq) 100 return msg, metadata, err 101 102 } 103 104 // RegisterSessionServiceHandlerServer registers the http handlers for service SessionService to "mux". 105 // UnaryRPC :call SessionServiceServer directly. 106 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 107 func RegisterSessionServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SessionServiceServer) error { 108 109 mux.Handle("GET", pattern_SessionService_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 110 ctx, cancel := context.WithCancel(req.Context()) 111 defer cancel() 112 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 113 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 114 if err != nil { 115 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 116 return 117 } 118 resp, md, err := local_request_SessionService_GetUserInfo_0(rctx, inboundMarshaler, server, req, pathParams) 119 ctx = runtime.NewServerMetadataContext(ctx, md) 120 if err != nil { 121 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 122 return 123 } 124 125 forward_SessionService_GetUserInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 126 127 }) 128 129 mux.Handle("POST", pattern_SessionService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 130 ctx, cancel := context.WithCancel(req.Context()) 131 defer cancel() 132 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 133 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 134 if err != nil { 135 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 136 return 137 } 138 resp, md, err := local_request_SessionService_Create_0(rctx, inboundMarshaler, server, req, pathParams) 139 ctx = runtime.NewServerMetadataContext(ctx, md) 140 if err != nil { 141 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 142 return 143 } 144 145 forward_SessionService_Create_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 146 147 }) 148 149 mux.Handle("DELETE", pattern_SessionService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 150 ctx, cancel := context.WithCancel(req.Context()) 151 defer cancel() 152 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 153 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 154 if err != nil { 155 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 156 return 157 } 158 resp, md, err := local_request_SessionService_Delete_0(rctx, inboundMarshaler, server, req, pathParams) 159 ctx = runtime.NewServerMetadataContext(ctx, md) 160 if err != nil { 161 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 162 return 163 } 164 165 forward_SessionService_Delete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 166 167 }) 168 169 return nil 170 } 171 172 // RegisterSessionServiceHandlerFromEndpoint is same as RegisterSessionServiceHandler but 173 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 174 func RegisterSessionServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 175 conn, err := grpc.Dial(endpoint, opts...) 176 if err != nil { 177 return err 178 } 179 defer func() { 180 if err != nil { 181 if cerr := conn.Close(); cerr != nil { 182 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 183 } 184 return 185 } 186 go func() { 187 <-ctx.Done() 188 if cerr := conn.Close(); cerr != nil { 189 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 190 } 191 }() 192 }() 193 194 return RegisterSessionServiceHandler(ctx, mux, conn) 195 } 196 197 // RegisterSessionServiceHandler registers the http handlers for service SessionService to "mux". 198 // The handlers forward requests to the grpc endpoint over "conn". 199 func RegisterSessionServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 200 return RegisterSessionServiceHandlerClient(ctx, mux, NewSessionServiceClient(conn)) 201 } 202 203 // RegisterSessionServiceHandlerClient registers the http handlers for service SessionService 204 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SessionServiceClient". 205 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SessionServiceClient" 206 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 207 // "SessionServiceClient" to call the correct interceptors. 208 func RegisterSessionServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SessionServiceClient) error { 209 210 mux.Handle("GET", pattern_SessionService_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 211 ctx, cancel := context.WithCancel(req.Context()) 212 defer cancel() 213 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 214 rctx, err := runtime.AnnotateContext(ctx, mux, req) 215 if err != nil { 216 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 217 return 218 } 219 resp, md, err := request_SessionService_GetUserInfo_0(rctx, inboundMarshaler, client, req, pathParams) 220 ctx = runtime.NewServerMetadataContext(ctx, md) 221 if err != nil { 222 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 223 return 224 } 225 226 forward_SessionService_GetUserInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 227 228 }) 229 230 mux.Handle("POST", pattern_SessionService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 231 ctx, cancel := context.WithCancel(req.Context()) 232 defer cancel() 233 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 234 rctx, err := runtime.AnnotateContext(ctx, mux, req) 235 if err != nil { 236 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 237 return 238 } 239 resp, md, err := request_SessionService_Create_0(rctx, inboundMarshaler, client, req, pathParams) 240 ctx = runtime.NewServerMetadataContext(ctx, md) 241 if err != nil { 242 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 243 return 244 } 245 246 forward_SessionService_Create_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 247 248 }) 249 250 mux.Handle("DELETE", pattern_SessionService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 251 ctx, cancel := context.WithCancel(req.Context()) 252 defer cancel() 253 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 254 rctx, err := runtime.AnnotateContext(ctx, mux, req) 255 if err != nil { 256 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 257 return 258 } 259 resp, md, err := request_SessionService_Delete_0(rctx, inboundMarshaler, client, req, pathParams) 260 ctx = runtime.NewServerMetadataContext(ctx, md) 261 if err != nil { 262 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 263 return 264 } 265 266 forward_SessionService_Delete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 267 268 }) 269 270 return nil 271 } 272 273 var ( 274 pattern_SessionService_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "session", "userinfo"}, "", runtime.AssumeColonVerbOpt(true))) 275 276 pattern_SessionService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "session"}, "", runtime.AssumeColonVerbOpt(true))) 277 278 pattern_SessionService_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "session"}, "", runtime.AssumeColonVerbOpt(true))) 279 ) 280 281 var ( 282 forward_SessionService_GetUserInfo_0 = runtime.ForwardResponseMessage 283 284 forward_SessionService_Create_0 = runtime.ForwardResponseMessage 285 286 forward_SessionService_Delete_0 = runtime.ForwardResponseMessage 287 )