Path: blob/main/components/public-api/go/v1/v1connect/ssh.connect.go
2501 views
// Copyright (c) 2025 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-connect-go. DO NOT EDIT.5//6// Source: gitpod/v1/ssh.proto78package v1connect910import (11context "context"12errors "errors"13connect_go "github.com/bufbuild/connect-go"14v1 "github.com/gitpod-io/gitpod/components/public-api/go/v1"15http "net/http"16strings "strings"17)1819// This is a compile-time assertion to ensure that this generated file and the connect package are20// compatible. If you get a compiler error that this constant is not defined, this code was21// generated with a version of connect newer than the one compiled into your binary. You can fix the22// problem by either regenerating this code with an older version of connect or updating the connect23// version compiled into your binary.24const _ = connect_go.IsAtLeastVersion0_1_02526const (27// SSHServiceName is the fully-qualified name of the SSHService service.28SSHServiceName = "gitpod.v1.SSHService"29)3031// SSHServiceClient is a client for the gitpod.v1.SSHService service.32type SSHServiceClient interface {33// ListSSHPublicKeys returns all the ssh public keys for the34// authenticated user.35ListSSHPublicKeys(context.Context, *connect_go.Request[v1.ListSSHPublicKeysRequest]) (*connect_go.Response[v1.ListSSHPublicKeysResponse], error)36// CreateSSHPublicKeys creates an ssh public key for the37// authenticated user.38CreateSSHPublicKey(context.Context, *connect_go.Request[v1.CreateSSHPublicKeyRequest]) (*connect_go.Response[v1.CreateSSHPublicKeyResponse], error)39// DeleteSSHPublicKeys deletes an ssh public key for the40// authenticated user.41DeleteSSHPublicKey(context.Context, *connect_go.Request[v1.DeleteSSHPublicKeyRequest]) (*connect_go.Response[v1.DeleteSSHPublicKeyResponse], error)42}4344// NewSSHServiceClient constructs a client for the gitpod.v1.SSHService service. By default, it uses45// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends46// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or47// connect.WithGRPCWeb() options.48//49// The URL supplied here should be the base URL for the Connect or gRPC server (for example,50// http://api.acme.com or https://acme.com/grpc).51func NewSSHServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SSHServiceClient {52baseURL = strings.TrimRight(baseURL, "/")53return &sSHServiceClient{54listSSHPublicKeys: connect_go.NewClient[v1.ListSSHPublicKeysRequest, v1.ListSSHPublicKeysResponse](55httpClient,56baseURL+"/gitpod.v1.SSHService/ListSSHPublicKeys",57opts...,58),59createSSHPublicKey: connect_go.NewClient[v1.CreateSSHPublicKeyRequest, v1.CreateSSHPublicKeyResponse](60httpClient,61baseURL+"/gitpod.v1.SSHService/CreateSSHPublicKey",62opts...,63),64deleteSSHPublicKey: connect_go.NewClient[v1.DeleteSSHPublicKeyRequest, v1.DeleteSSHPublicKeyResponse](65httpClient,66baseURL+"/gitpod.v1.SSHService/DeleteSSHPublicKey",67opts...,68),69}70}7172// sSHServiceClient implements SSHServiceClient.73type sSHServiceClient struct {74listSSHPublicKeys *connect_go.Client[v1.ListSSHPublicKeysRequest, v1.ListSSHPublicKeysResponse]75createSSHPublicKey *connect_go.Client[v1.CreateSSHPublicKeyRequest, v1.CreateSSHPublicKeyResponse]76deleteSSHPublicKey *connect_go.Client[v1.DeleteSSHPublicKeyRequest, v1.DeleteSSHPublicKeyResponse]77}7879// ListSSHPublicKeys calls gitpod.v1.SSHService.ListSSHPublicKeys.80func (c *sSHServiceClient) ListSSHPublicKeys(ctx context.Context, req *connect_go.Request[v1.ListSSHPublicKeysRequest]) (*connect_go.Response[v1.ListSSHPublicKeysResponse], error) {81return c.listSSHPublicKeys.CallUnary(ctx, req)82}8384// CreateSSHPublicKey calls gitpod.v1.SSHService.CreateSSHPublicKey.85func (c *sSHServiceClient) CreateSSHPublicKey(ctx context.Context, req *connect_go.Request[v1.CreateSSHPublicKeyRequest]) (*connect_go.Response[v1.CreateSSHPublicKeyResponse], error) {86return c.createSSHPublicKey.CallUnary(ctx, req)87}8889// DeleteSSHPublicKey calls gitpod.v1.SSHService.DeleteSSHPublicKey.90func (c *sSHServiceClient) DeleteSSHPublicKey(ctx context.Context, req *connect_go.Request[v1.DeleteSSHPublicKeyRequest]) (*connect_go.Response[v1.DeleteSSHPublicKeyResponse], error) {91return c.deleteSSHPublicKey.CallUnary(ctx, req)92}9394// SSHServiceHandler is an implementation of the gitpod.v1.SSHService service.95type SSHServiceHandler interface {96// ListSSHPublicKeys returns all the ssh public keys for the97// authenticated user.98ListSSHPublicKeys(context.Context, *connect_go.Request[v1.ListSSHPublicKeysRequest]) (*connect_go.Response[v1.ListSSHPublicKeysResponse], error)99// CreateSSHPublicKeys creates an ssh public key for the100// authenticated user.101CreateSSHPublicKey(context.Context, *connect_go.Request[v1.CreateSSHPublicKeyRequest]) (*connect_go.Response[v1.CreateSSHPublicKeyResponse], error)102// DeleteSSHPublicKeys deletes an ssh public key for the103// authenticated user.104DeleteSSHPublicKey(context.Context, *connect_go.Request[v1.DeleteSSHPublicKeyRequest]) (*connect_go.Response[v1.DeleteSSHPublicKeyResponse], error)105}106107// NewSSHServiceHandler builds an HTTP handler from the service implementation. It returns the path108// on which to mount the handler and the handler itself.109//110// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf111// and JSON codecs. They also support gzip compression.112func NewSSHServiceHandler(svc SSHServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {113mux := http.NewServeMux()114mux.Handle("/gitpod.v1.SSHService/ListSSHPublicKeys", connect_go.NewUnaryHandler(115"/gitpod.v1.SSHService/ListSSHPublicKeys",116svc.ListSSHPublicKeys,117opts...,118))119mux.Handle("/gitpod.v1.SSHService/CreateSSHPublicKey", connect_go.NewUnaryHandler(120"/gitpod.v1.SSHService/CreateSSHPublicKey",121svc.CreateSSHPublicKey,122opts...,123))124mux.Handle("/gitpod.v1.SSHService/DeleteSSHPublicKey", connect_go.NewUnaryHandler(125"/gitpod.v1.SSHService/DeleteSSHPublicKey",126svc.DeleteSSHPublicKey,127opts...,128))129return "/gitpod.v1.SSHService/", mux130}131132// UnimplementedSSHServiceHandler returns CodeUnimplemented from all methods.133type UnimplementedSSHServiceHandler struct{}134135func (UnimplementedSSHServiceHandler) ListSSHPublicKeys(context.Context, *connect_go.Request[v1.ListSSHPublicKeysRequest]) (*connect_go.Response[v1.ListSSHPublicKeysResponse], error) {136return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SSHService.ListSSHPublicKeys is not implemented"))137}138139func (UnimplementedSSHServiceHandler) CreateSSHPublicKey(context.Context, *connect_go.Request[v1.CreateSSHPublicKeyRequest]) (*connect_go.Response[v1.CreateSSHPublicKeyResponse], error) {140return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SSHService.CreateSSHPublicKey is not implemented"))141}142143func (UnimplementedSSHServiceHandler) DeleteSSHPublicKey(context.Context, *connect_go.Request[v1.DeleteSSHPublicKeyRequest]) (*connect_go.Response[v1.DeleteSSHPublicKeyResponse], error) {144return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SSHService.DeleteSSHPublicKey is not implemented"))145}146147148