github.com/argoproj/argo-cd/v2@v2.10.9/pkg/apiclient/version/version.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: server/version/version.proto 3 4 /* 5 Package version is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package version 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/metadata" 24 "google.golang.org/grpc/status" 25 "google.golang.org/protobuf/types/known/emptypb" 26 ) 27 28 // Suppress "imported and not used" errors 29 var _ codes.Code 30 var _ io.Reader 31 var _ status.Status 32 var _ = runtime.String 33 var _ = utilities.NewDoubleArray 34 var _ = descriptor.ForMessage 35 var _ = metadata.Join 36 37 func request_VersionService_Version_0(ctx context.Context, marshaler runtime.Marshaler, client VersionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 38 var protoReq emptypb.Empty 39 var metadata runtime.ServerMetadata 40 41 msg, err := client.Version(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 42 return msg, metadata, err 43 44 } 45 46 func local_request_VersionService_Version_0(ctx context.Context, marshaler runtime.Marshaler, server VersionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 47 var protoReq emptypb.Empty 48 var metadata runtime.ServerMetadata 49 50 msg, err := server.Version(ctx, &protoReq) 51 return msg, metadata, err 52 53 } 54 55 // RegisterVersionServiceHandlerServer registers the http handlers for service VersionService to "mux". 56 // UnaryRPC :call VersionServiceServer directly. 57 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 58 // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterVersionServiceHandlerFromEndpoint instead. 59 func RegisterVersionServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server VersionServiceServer) error { 60 61 mux.Handle("GET", pattern_VersionService_Version_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 62 ctx, cancel := context.WithCancel(req.Context()) 63 defer cancel() 64 var stream runtime.ServerTransportStream 65 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 66 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 67 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 68 if err != nil { 69 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 70 return 71 } 72 resp, md, err := local_request_VersionService_Version_0(rctx, inboundMarshaler, server, req, pathParams) 73 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 74 ctx = runtime.NewServerMetadataContext(ctx, md) 75 if err != nil { 76 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 77 return 78 } 79 80 forward_VersionService_Version_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 81 82 }) 83 84 return nil 85 } 86 87 // RegisterVersionServiceHandlerFromEndpoint is same as RegisterVersionServiceHandler but 88 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 89 func RegisterVersionServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 90 conn, err := grpc.Dial(endpoint, opts...) 91 if err != nil { 92 return err 93 } 94 defer func() { 95 if err != nil { 96 if cerr := conn.Close(); cerr != nil { 97 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 98 } 99 return 100 } 101 go func() { 102 <-ctx.Done() 103 if cerr := conn.Close(); cerr != nil { 104 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 105 } 106 }() 107 }() 108 109 return RegisterVersionServiceHandler(ctx, mux, conn) 110 } 111 112 // RegisterVersionServiceHandler registers the http handlers for service VersionService to "mux". 113 // The handlers forward requests to the grpc endpoint over "conn". 114 func RegisterVersionServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 115 return RegisterVersionServiceHandlerClient(ctx, mux, NewVersionServiceClient(conn)) 116 } 117 118 // RegisterVersionServiceHandlerClient registers the http handlers for service VersionService 119 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "VersionServiceClient". 120 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "VersionServiceClient" 121 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 122 // "VersionServiceClient" to call the correct interceptors. 123 func RegisterVersionServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client VersionServiceClient) error { 124 125 mux.Handle("GET", pattern_VersionService_Version_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 126 ctx, cancel := context.WithCancel(req.Context()) 127 defer cancel() 128 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 129 rctx, err := runtime.AnnotateContext(ctx, mux, req) 130 if err != nil { 131 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 132 return 133 } 134 resp, md, err := request_VersionService_Version_0(rctx, inboundMarshaler, client, req, pathParams) 135 ctx = runtime.NewServerMetadataContext(ctx, md) 136 if err != nil { 137 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 138 return 139 } 140 141 forward_VersionService_Version_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 142 143 }) 144 145 return nil 146 } 147 148 var ( 149 pattern_VersionService_Version_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "version"}, "", runtime.AssumeColonVerbOpt(true))) 150 ) 151 152 var ( 153 forward_VersionService_Version_0 = runtime.ForwardResponseMessage 154 )