Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/public-api/go/v1/v1connect/ssh.connect.go
2501 views
1
// Copyright (c) 2025 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-connect-go. DO NOT EDIT.
6
//
7
// Source: gitpod/v1/ssh.proto
8
9
package v1connect
10
11
import (
12
context "context"
13
errors "errors"
14
connect_go "github.com/bufbuild/connect-go"
15
v1 "github.com/gitpod-io/gitpod/components/public-api/go/v1"
16
http "net/http"
17
strings "strings"
18
)
19
20
// This is a compile-time assertion to ensure that this generated file and the connect package are
21
// compatible. If you get a compiler error that this constant is not defined, this code was
22
// generated with a version of connect newer than the one compiled into your binary. You can fix the
23
// problem by either regenerating this code with an older version of connect or updating the connect
24
// version compiled into your binary.
25
const _ = connect_go.IsAtLeastVersion0_1_0
26
27
const (
28
// SSHServiceName is the fully-qualified name of the SSHService service.
29
SSHServiceName = "gitpod.v1.SSHService"
30
)
31
32
// SSHServiceClient is a client for the gitpod.v1.SSHService service.
33
type SSHServiceClient interface {
34
// ListSSHPublicKeys returns all the ssh public keys for the
35
// authenticated user.
36
ListSSHPublicKeys(context.Context, *connect_go.Request[v1.ListSSHPublicKeysRequest]) (*connect_go.Response[v1.ListSSHPublicKeysResponse], error)
37
// CreateSSHPublicKeys creates an ssh public key for the
38
// authenticated user.
39
CreateSSHPublicKey(context.Context, *connect_go.Request[v1.CreateSSHPublicKeyRequest]) (*connect_go.Response[v1.CreateSSHPublicKeyResponse], error)
40
// DeleteSSHPublicKeys deletes an ssh public key for the
41
// authenticated user.
42
DeleteSSHPublicKey(context.Context, *connect_go.Request[v1.DeleteSSHPublicKeyRequest]) (*connect_go.Response[v1.DeleteSSHPublicKeyResponse], error)
43
}
44
45
// NewSSHServiceClient constructs a client for the gitpod.v1.SSHService service. By default, it uses
46
// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
47
// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
48
// connect.WithGRPCWeb() options.
49
//
50
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
51
// http://api.acme.com or https://acme.com/grpc).
52
func NewSSHServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SSHServiceClient {
53
baseURL = strings.TrimRight(baseURL, "/")
54
return &sSHServiceClient{
55
listSSHPublicKeys: connect_go.NewClient[v1.ListSSHPublicKeysRequest, v1.ListSSHPublicKeysResponse](
56
httpClient,
57
baseURL+"/gitpod.v1.SSHService/ListSSHPublicKeys",
58
opts...,
59
),
60
createSSHPublicKey: connect_go.NewClient[v1.CreateSSHPublicKeyRequest, v1.CreateSSHPublicKeyResponse](
61
httpClient,
62
baseURL+"/gitpod.v1.SSHService/CreateSSHPublicKey",
63
opts...,
64
),
65
deleteSSHPublicKey: connect_go.NewClient[v1.DeleteSSHPublicKeyRequest, v1.DeleteSSHPublicKeyResponse](
66
httpClient,
67
baseURL+"/gitpod.v1.SSHService/DeleteSSHPublicKey",
68
opts...,
69
),
70
}
71
}
72
73
// sSHServiceClient implements SSHServiceClient.
74
type sSHServiceClient struct {
75
listSSHPublicKeys *connect_go.Client[v1.ListSSHPublicKeysRequest, v1.ListSSHPublicKeysResponse]
76
createSSHPublicKey *connect_go.Client[v1.CreateSSHPublicKeyRequest, v1.CreateSSHPublicKeyResponse]
77
deleteSSHPublicKey *connect_go.Client[v1.DeleteSSHPublicKeyRequest, v1.DeleteSSHPublicKeyResponse]
78
}
79
80
// ListSSHPublicKeys calls gitpod.v1.SSHService.ListSSHPublicKeys.
81
func (c *sSHServiceClient) ListSSHPublicKeys(ctx context.Context, req *connect_go.Request[v1.ListSSHPublicKeysRequest]) (*connect_go.Response[v1.ListSSHPublicKeysResponse], error) {
82
return c.listSSHPublicKeys.CallUnary(ctx, req)
83
}
84
85
// CreateSSHPublicKey calls gitpod.v1.SSHService.CreateSSHPublicKey.
86
func (c *sSHServiceClient) CreateSSHPublicKey(ctx context.Context, req *connect_go.Request[v1.CreateSSHPublicKeyRequest]) (*connect_go.Response[v1.CreateSSHPublicKeyResponse], error) {
87
return c.createSSHPublicKey.CallUnary(ctx, req)
88
}
89
90
// DeleteSSHPublicKey calls gitpod.v1.SSHService.DeleteSSHPublicKey.
91
func (c *sSHServiceClient) DeleteSSHPublicKey(ctx context.Context, req *connect_go.Request[v1.DeleteSSHPublicKeyRequest]) (*connect_go.Response[v1.DeleteSSHPublicKeyResponse], error) {
92
return c.deleteSSHPublicKey.CallUnary(ctx, req)
93
}
94
95
// SSHServiceHandler is an implementation of the gitpod.v1.SSHService service.
96
type SSHServiceHandler interface {
97
// ListSSHPublicKeys returns all the ssh public keys for the
98
// authenticated user.
99
ListSSHPublicKeys(context.Context, *connect_go.Request[v1.ListSSHPublicKeysRequest]) (*connect_go.Response[v1.ListSSHPublicKeysResponse], error)
100
// CreateSSHPublicKeys creates an ssh public key for the
101
// authenticated user.
102
CreateSSHPublicKey(context.Context, *connect_go.Request[v1.CreateSSHPublicKeyRequest]) (*connect_go.Response[v1.CreateSSHPublicKeyResponse], error)
103
// DeleteSSHPublicKeys deletes an ssh public key for the
104
// authenticated user.
105
DeleteSSHPublicKey(context.Context, *connect_go.Request[v1.DeleteSSHPublicKeyRequest]) (*connect_go.Response[v1.DeleteSSHPublicKeyResponse], error)
106
}
107
108
// NewSSHServiceHandler builds an HTTP handler from the service implementation. It returns the path
109
// on which to mount the handler and the handler itself.
110
//
111
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
112
// and JSON codecs. They also support gzip compression.
113
func NewSSHServiceHandler(svc SSHServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {
114
mux := http.NewServeMux()
115
mux.Handle("/gitpod.v1.SSHService/ListSSHPublicKeys", connect_go.NewUnaryHandler(
116
"/gitpod.v1.SSHService/ListSSHPublicKeys",
117
svc.ListSSHPublicKeys,
118
opts...,
119
))
120
mux.Handle("/gitpod.v1.SSHService/CreateSSHPublicKey", connect_go.NewUnaryHandler(
121
"/gitpod.v1.SSHService/CreateSSHPublicKey",
122
svc.CreateSSHPublicKey,
123
opts...,
124
))
125
mux.Handle("/gitpod.v1.SSHService/DeleteSSHPublicKey", connect_go.NewUnaryHandler(
126
"/gitpod.v1.SSHService/DeleteSSHPublicKey",
127
svc.DeleteSSHPublicKey,
128
opts...,
129
))
130
return "/gitpod.v1.SSHService/", mux
131
}
132
133
// UnimplementedSSHServiceHandler returns CodeUnimplemented from all methods.
134
type UnimplementedSSHServiceHandler struct{}
135
136
func (UnimplementedSSHServiceHandler) ListSSHPublicKeys(context.Context, *connect_go.Request[v1.ListSSHPublicKeysRequest]) (*connect_go.Response[v1.ListSSHPublicKeysResponse], error) {
137
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SSHService.ListSSHPublicKeys is not implemented"))
138
}
139
140
func (UnimplementedSSHServiceHandler) CreateSSHPublicKey(context.Context, *connect_go.Request[v1.CreateSSHPublicKeyRequest]) (*connect_go.Response[v1.CreateSSHPublicKeyResponse], error) {
141
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SSHService.CreateSSHPublicKey is not implemented"))
142
}
143
144
func (UnimplementedSSHServiceHandler) DeleteSSHPublicKey(context.Context, *connect_go.Request[v1.DeleteSSHPublicKeyRequest]) (*connect_go.Response[v1.DeleteSSHPublicKeyResponse], error) {
145
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SSHService.DeleteSSHPublicKey is not implemented"))
146
}
147
148