Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/supervisor-api/go/control.pb.gw.go
2496 views
1
// Copyright (c) 2024 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: control.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_ControlService_CreateSSHKeyPair_0(ctx context.Context, marshaler runtime.Marshaler, client ControlServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
39
var protoReq CreateSSHKeyPairRequest
40
var metadata runtime.ServerMetadata
41
42
msg, err := client.CreateSSHKeyPair(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
43
return msg, metadata, err
44
45
}
46
47
func local_request_ControlService_CreateSSHKeyPair_0(ctx context.Context, marshaler runtime.Marshaler, server ControlServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
48
var protoReq CreateSSHKeyPairRequest
49
var metadata runtime.ServerMetadata
50
51
msg, err := server.CreateSSHKeyPair(ctx, &protoReq)
52
return msg, metadata, err
53
54
}
55
56
func request_ControlService_SendHeartBeat_0(ctx context.Context, marshaler runtime.Marshaler, client ControlServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
57
var protoReq SendHeartBeatRequest
58
var metadata runtime.ServerMetadata
59
60
msg, err := client.SendHeartBeat(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
61
return msg, metadata, err
62
63
}
64
65
func local_request_ControlService_SendHeartBeat_0(ctx context.Context, marshaler runtime.Marshaler, server ControlServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
66
var protoReq SendHeartBeatRequest
67
var metadata runtime.ServerMetadata
68
69
msg, err := server.SendHeartBeat(ctx, &protoReq)
70
return msg, metadata, err
71
72
}
73
74
// RegisterControlServiceHandlerServer registers the http handlers for service ControlService to "mux".
75
// UnaryRPC :call ControlServiceServer directly.
76
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
77
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterControlServiceHandlerFromEndpoint instead.
78
func RegisterControlServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ControlServiceServer) error {
79
80
mux.Handle("GET", pattern_ControlService_CreateSSHKeyPair_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
81
ctx, cancel := context.WithCancel(req.Context())
82
defer cancel()
83
var stream runtime.ServerTransportStream
84
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
85
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
86
var err error
87
var annotatedContext context.Context
88
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/supervisor.ControlService/CreateSSHKeyPair", runtime.WithHTTPPathPattern("/v1/ssh_keys/create"))
89
if err != nil {
90
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
91
return
92
}
93
resp, md, err := local_request_ControlService_CreateSSHKeyPair_0(annotatedContext, inboundMarshaler, server, req, pathParams)
94
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
95
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
96
if err != nil {
97
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
98
return
99
}
100
101
forward_ControlService_CreateSSHKeyPair_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
102
103
})
104
105
mux.Handle("GET", pattern_ControlService_SendHeartBeat_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
106
ctx, cancel := context.WithCancel(req.Context())
107
defer cancel()
108
var stream runtime.ServerTransportStream
109
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
110
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
111
var err error
112
var annotatedContext context.Context
113
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/supervisor.ControlService/SendHeartBeat", runtime.WithHTTPPathPattern("/v1/send_heartbeat"))
114
if err != nil {
115
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
116
return
117
}
118
resp, md, err := local_request_ControlService_SendHeartBeat_0(annotatedContext, inboundMarshaler, server, req, pathParams)
119
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
120
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
121
if err != nil {
122
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
123
return
124
}
125
126
forward_ControlService_SendHeartBeat_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
127
128
})
129
130
return nil
131
}
132
133
// RegisterControlServiceHandlerFromEndpoint is same as RegisterControlServiceHandler but
134
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
135
func RegisterControlServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
136
conn, err := grpc.Dial(endpoint, opts...)
137
if err != nil {
138
return err
139
}
140
defer func() {
141
if err != nil {
142
if cerr := conn.Close(); cerr != nil {
143
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
144
}
145
return
146
}
147
go func() {
148
<-ctx.Done()
149
if cerr := conn.Close(); cerr != nil {
150
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
151
}
152
}()
153
}()
154
155
return RegisterControlServiceHandler(ctx, mux, conn)
156
}
157
158
// RegisterControlServiceHandler registers the http handlers for service ControlService to "mux".
159
// The handlers forward requests to the grpc endpoint over "conn".
160
func RegisterControlServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
161
return RegisterControlServiceHandlerClient(ctx, mux, NewControlServiceClient(conn))
162
}
163
164
// RegisterControlServiceHandlerClient registers the http handlers for service ControlService
165
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ControlServiceClient".
166
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ControlServiceClient"
167
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
168
// "ControlServiceClient" to call the correct interceptors.
169
func RegisterControlServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ControlServiceClient) error {
170
171
mux.Handle("GET", pattern_ControlService_CreateSSHKeyPair_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
172
ctx, cancel := context.WithCancel(req.Context())
173
defer cancel()
174
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
175
var err error
176
var annotatedContext context.Context
177
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/supervisor.ControlService/CreateSSHKeyPair", runtime.WithHTTPPathPattern("/v1/ssh_keys/create"))
178
if err != nil {
179
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
180
return
181
}
182
resp, md, err := request_ControlService_CreateSSHKeyPair_0(annotatedContext, inboundMarshaler, client, req, pathParams)
183
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
184
if err != nil {
185
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
186
return
187
}
188
189
forward_ControlService_CreateSSHKeyPair_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
190
191
})
192
193
mux.Handle("GET", pattern_ControlService_SendHeartBeat_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
194
ctx, cancel := context.WithCancel(req.Context())
195
defer cancel()
196
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
197
var err error
198
var annotatedContext context.Context
199
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/supervisor.ControlService/SendHeartBeat", runtime.WithHTTPPathPattern("/v1/send_heartbeat"))
200
if err != nil {
201
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
202
return
203
}
204
resp, md, err := request_ControlService_SendHeartBeat_0(annotatedContext, inboundMarshaler, client, req, pathParams)
205
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
206
if err != nil {
207
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
208
return
209
}
210
211
forward_ControlService_SendHeartBeat_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
212
213
})
214
215
return nil
216
}
217
218
var (
219
pattern_ControlService_CreateSSHKeyPair_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "ssh_keys", "create"}, ""))
220
221
pattern_ControlService_SendHeartBeat_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "send_heartbeat"}, ""))
222
)
223
224
var (
225
forward_ControlService_CreateSSHKeyPair_0 = runtime.ForwardResponseMessage
226
227
forward_ControlService_SendHeartBeat_0 = runtime.ForwardResponseMessage
228
)
229
230