Path: blob/main/components/supervisor-api/go/control.pb.gw.go
2496 views
// Copyright (c) 2024 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: control.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_ControlService_CreateSSHKeyPair_0(ctx context.Context, marshaler runtime.Marshaler, client ControlServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {38var protoReq CreateSSHKeyPairRequest39var metadata runtime.ServerMetadata4041msg, err := client.CreateSSHKeyPair(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))42return msg, metadata, err4344}4546func 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) {47var protoReq CreateSSHKeyPairRequest48var metadata runtime.ServerMetadata4950msg, err := server.CreateSSHKeyPair(ctx, &protoReq)51return msg, metadata, err5253}5455func request_ControlService_SendHeartBeat_0(ctx context.Context, marshaler runtime.Marshaler, client ControlServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {56var protoReq SendHeartBeatRequest57var metadata runtime.ServerMetadata5859msg, err := client.SendHeartBeat(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))60return msg, metadata, err6162}6364func 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) {65var protoReq SendHeartBeatRequest66var metadata runtime.ServerMetadata6768msg, err := server.SendHeartBeat(ctx, &protoReq)69return msg, metadata, err7071}7273// RegisterControlServiceHandlerServer registers the http handlers for service ControlService to "mux".74// UnaryRPC :call ControlServiceServer directly.75// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.76// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterControlServiceHandlerFromEndpoint instead.77func RegisterControlServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ControlServiceServer) error {7879mux.Handle("GET", pattern_ControlService_CreateSSHKeyPair_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {80ctx, cancel := context.WithCancel(req.Context())81defer cancel()82var stream runtime.ServerTransportStream83ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)84inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)85var err error86var annotatedContext context.Context87annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/supervisor.ControlService/CreateSSHKeyPair", runtime.WithHTTPPathPattern("/v1/ssh_keys/create"))88if err != nil {89runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)90return91}92resp, md, err := local_request_ControlService_CreateSSHKeyPair_0(annotatedContext, inboundMarshaler, server, req, pathParams)93md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())94annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)95if err != nil {96runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)97return98}99100forward_ControlService_CreateSSHKeyPair_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)101102})103104mux.Handle("GET", pattern_ControlService_SendHeartBeat_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {105ctx, cancel := context.WithCancel(req.Context())106defer cancel()107var stream runtime.ServerTransportStream108ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)109inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)110var err error111var annotatedContext context.Context112annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/supervisor.ControlService/SendHeartBeat", runtime.WithHTTPPathPattern("/v1/send_heartbeat"))113if err != nil {114runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)115return116}117resp, md, err := local_request_ControlService_SendHeartBeat_0(annotatedContext, inboundMarshaler, server, req, pathParams)118md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())119annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)120if err != nil {121runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)122return123}124125forward_ControlService_SendHeartBeat_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)126127})128129return nil130}131132// RegisterControlServiceHandlerFromEndpoint is same as RegisterControlServiceHandler but133// automatically dials to "endpoint" and closes the connection when "ctx" gets done.134func RegisterControlServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {135conn, err := grpc.Dial(endpoint, opts...)136if err != nil {137return err138}139defer func() {140if err != nil {141if cerr := conn.Close(); cerr != nil {142grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)143}144return145}146go func() {147<-ctx.Done()148if cerr := conn.Close(); cerr != nil {149grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)150}151}()152}()153154return RegisterControlServiceHandler(ctx, mux, conn)155}156157// RegisterControlServiceHandler registers the http handlers for service ControlService to "mux".158// The handlers forward requests to the grpc endpoint over "conn".159func RegisterControlServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {160return RegisterControlServiceHandlerClient(ctx, mux, NewControlServiceClient(conn))161}162163// RegisterControlServiceHandlerClient registers the http handlers for service ControlService164// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ControlServiceClient".165// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ControlServiceClient"166// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in167// "ControlServiceClient" to call the correct interceptors.168func RegisterControlServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ControlServiceClient) error {169170mux.Handle("GET", pattern_ControlService_CreateSSHKeyPair_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {171ctx, cancel := context.WithCancel(req.Context())172defer cancel()173inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)174var err error175var annotatedContext context.Context176annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/supervisor.ControlService/CreateSSHKeyPair", runtime.WithHTTPPathPattern("/v1/ssh_keys/create"))177if err != nil {178runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)179return180}181resp, md, err := request_ControlService_CreateSSHKeyPair_0(annotatedContext, inboundMarshaler, client, req, pathParams)182annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)183if err != nil {184runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)185return186}187188forward_ControlService_CreateSSHKeyPair_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)189190})191192mux.Handle("GET", pattern_ControlService_SendHeartBeat_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {193ctx, cancel := context.WithCancel(req.Context())194defer cancel()195inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)196var err error197var annotatedContext context.Context198annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/supervisor.ControlService/SendHeartBeat", runtime.WithHTTPPathPattern("/v1/send_heartbeat"))199if err != nil {200runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)201return202}203resp, md, err := request_ControlService_SendHeartBeat_0(annotatedContext, inboundMarshaler, client, req, pathParams)204annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)205if err != nil {206runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)207return208}209210forward_ControlService_SendHeartBeat_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)211212})213214return nil215}216217var (218pattern_ControlService_CreateSSHKeyPair_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "ssh_keys", "create"}, ""))219220pattern_ControlService_SendHeartBeat_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "send_heartbeat"}, ""))221)222223var (224forward_ControlService_CreateSSHKeyPair_0 = runtime.ForwardResponseMessage225226forward_ControlService_SendHeartBeat_0 = runtime.ForwardResponseMessage227)228229230