Path: blob/main/components/supervisor-api/go/info.pb.gw.go
2500 views
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.5// source: info.proto67/*8Package api is a reverse proxy.910It translates gRPC into RESTful JSON APIs.11*/12package api1314import (15"context"16"io"17"net/http"1819"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"20"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"21"google.golang.org/grpc"22"google.golang.org/grpc/codes"23"google.golang.org/grpc/grpclog"24"google.golang.org/grpc/metadata"25"google.golang.org/grpc/status"26"google.golang.org/protobuf/proto"27)2829// Suppress "imported and not used" errors30var _ codes.Code31var _ io.Reader32var _ status.Status33var _ = runtime.String34var _ = utilities.NewDoubleArray35var _ = metadata.Join3637func request_InfoService_WorkspaceInfo_0(ctx context.Context, marshaler runtime.Marshaler, client InfoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {38var protoReq WorkspaceInfoRequest39var metadata runtime.ServerMetadata4041msg, err := client.WorkspaceInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))42return msg, metadata, err4344}4546func local_request_InfoService_WorkspaceInfo_0(ctx context.Context, marshaler runtime.Marshaler, server InfoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {47var protoReq WorkspaceInfoRequest48var metadata runtime.ServerMetadata4950msg, err := server.WorkspaceInfo(ctx, &protoReq)51return msg, metadata, err5253}5455// RegisterInfoServiceHandlerServer registers the http handlers for service InfoService to "mux".56// UnaryRPC :call InfoServiceServer 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 RegisterInfoServiceHandlerFromEndpoint instead.59func RegisterInfoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InfoServiceServer) error {6061mux.Handle("GET", pattern_InfoService_WorkspaceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {62ctx, cancel := context.WithCancel(req.Context())63defer cancel()64var stream runtime.ServerTransportStream65ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)66inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)67var err error68var annotatedContext context.Context69annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/supervisor.InfoService/WorkspaceInfo", runtime.WithHTTPPathPattern("/v1/info/workspace"))70if err != nil {71runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)72return73}74resp, md, err := local_request_InfoService_WorkspaceInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)75md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())76annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)77if err != nil {78runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)79return80}8182forward_InfoService_WorkspaceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)8384})8586return nil87}8889// RegisterInfoServiceHandlerFromEndpoint is same as RegisterInfoServiceHandler but90// automatically dials to "endpoint" and closes the connection when "ctx" gets done.91func RegisterInfoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {92conn, err := grpc.Dial(endpoint, opts...)93if err != nil {94return err95}96defer func() {97if err != nil {98if cerr := conn.Close(); cerr != nil {99grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)100}101return102}103go func() {104<-ctx.Done()105if cerr := conn.Close(); cerr != nil {106grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)107}108}()109}()110111return RegisterInfoServiceHandler(ctx, mux, conn)112}113114// RegisterInfoServiceHandler registers the http handlers for service InfoService to "mux".115// The handlers forward requests to the grpc endpoint over "conn".116func RegisterInfoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {117return RegisterInfoServiceHandlerClient(ctx, mux, NewInfoServiceClient(conn))118}119120// RegisterInfoServiceHandlerClient registers the http handlers for service InfoService121// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "InfoServiceClient".122// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "InfoServiceClient"123// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in124// "InfoServiceClient" to call the correct interceptors.125func RegisterInfoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InfoServiceClient) error {126127mux.Handle("GET", pattern_InfoService_WorkspaceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {128ctx, cancel := context.WithCancel(req.Context())129defer cancel()130inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)131var err error132var annotatedContext context.Context133annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/supervisor.InfoService/WorkspaceInfo", runtime.WithHTTPPathPattern("/v1/info/workspace"))134if err != nil {135runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)136return137}138resp, md, err := request_InfoService_WorkspaceInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)139annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)140if err != nil {141runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)142return143}144145forward_InfoService_WorkspaceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)146147})148149return nil150}151152var (153pattern_InfoService_WorkspaceInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "info", "workspace"}, ""))154)155156var (157forward_InfoService_WorkspaceInfo_0 = runtime.ForwardResponseMessage158)159160161