Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/supervisor-api/go/info.pb.gw.go
2500 views
1
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
6
// source: info.proto
7
8
/*
9
Package api is a reverse proxy.
10
11
It translates gRPC into RESTful JSON APIs.
12
*/
13
package api
14
15
import (
16
"context"
17
"io"
18
"net/http"
19
20
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
21
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
22
"google.golang.org/grpc"
23
"google.golang.org/grpc/codes"
24
"google.golang.org/grpc/grpclog"
25
"google.golang.org/grpc/metadata"
26
"google.golang.org/grpc/status"
27
"google.golang.org/protobuf/proto"
28
)
29
30
// Suppress "imported and not used" errors
31
var _ codes.Code
32
var _ io.Reader
33
var _ status.Status
34
var _ = runtime.String
35
var _ = utilities.NewDoubleArray
36
var _ = metadata.Join
37
38
func request_InfoService_WorkspaceInfo_0(ctx context.Context, marshaler runtime.Marshaler, client InfoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
39
var protoReq WorkspaceInfoRequest
40
var metadata runtime.ServerMetadata
41
42
msg, err := client.WorkspaceInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
43
return msg, metadata, err
44
45
}
46
47
func 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) {
48
var protoReq WorkspaceInfoRequest
49
var metadata runtime.ServerMetadata
50
51
msg, err := server.WorkspaceInfo(ctx, &protoReq)
52
return msg, metadata, err
53
54
}
55
56
// RegisterInfoServiceHandlerServer registers the http handlers for service InfoService to "mux".
57
// UnaryRPC :call InfoServiceServer directly.
58
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
59
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterInfoServiceHandlerFromEndpoint instead.
60
func RegisterInfoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InfoServiceServer) error {
61
62
mux.Handle("GET", pattern_InfoService_WorkspaceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
63
ctx, cancel := context.WithCancel(req.Context())
64
defer cancel()
65
var stream runtime.ServerTransportStream
66
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
67
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
68
var err error
69
var annotatedContext context.Context
70
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/supervisor.InfoService/WorkspaceInfo", runtime.WithHTTPPathPattern("/v1/info/workspace"))
71
if err != nil {
72
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
73
return
74
}
75
resp, md, err := local_request_InfoService_WorkspaceInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
76
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
77
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
78
if err != nil {
79
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
80
return
81
}
82
83
forward_InfoService_WorkspaceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
84
85
})
86
87
return nil
88
}
89
90
// RegisterInfoServiceHandlerFromEndpoint is same as RegisterInfoServiceHandler but
91
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
92
func RegisterInfoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
93
conn, err := grpc.Dial(endpoint, opts...)
94
if err != nil {
95
return err
96
}
97
defer func() {
98
if err != nil {
99
if cerr := conn.Close(); cerr != nil {
100
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
101
}
102
return
103
}
104
go func() {
105
<-ctx.Done()
106
if cerr := conn.Close(); cerr != nil {
107
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
108
}
109
}()
110
}()
111
112
return RegisterInfoServiceHandler(ctx, mux, conn)
113
}
114
115
// RegisterInfoServiceHandler registers the http handlers for service InfoService to "mux".
116
// The handlers forward requests to the grpc endpoint over "conn".
117
func RegisterInfoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
118
return RegisterInfoServiceHandlerClient(ctx, mux, NewInfoServiceClient(conn))
119
}
120
121
// RegisterInfoServiceHandlerClient registers the http handlers for service InfoService
122
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "InfoServiceClient".
123
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "InfoServiceClient"
124
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
125
// "InfoServiceClient" to call the correct interceptors.
126
func RegisterInfoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InfoServiceClient) error {
127
128
mux.Handle("GET", pattern_InfoService_WorkspaceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
129
ctx, cancel := context.WithCancel(req.Context())
130
defer cancel()
131
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
132
var err error
133
var annotatedContext context.Context
134
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/supervisor.InfoService/WorkspaceInfo", runtime.WithHTTPPathPattern("/v1/info/workspace"))
135
if err != nil {
136
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
137
return
138
}
139
resp, md, err := request_InfoService_WorkspaceInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
140
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
141
if err != nil {
142
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
143
return
144
}
145
146
forward_InfoService_WorkspaceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
147
148
})
149
150
return nil
151
}
152
153
var (
154
pattern_InfoService_WorkspaceInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "info", "workspace"}, ""))
155
)
156
157
var (
158
forward_InfoService_WorkspaceInfo_0 = runtime.ForwardResponseMessage
159
)
160
161