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