v0.7.0 d244a03

server.connect.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4//
5// Source: ermite/server.proto
6
7package ermiteconnect
8
9import (
10	ermite "bnema.dev/ermite-api/gen/ermite"
11	connect "connectrpc.com/connect"
12	context "context"
13	errors "errors"
14	http "net/http"
15	strings "strings"
16)
17
18// This is a compile-time assertion to ensure that this generated file and the connect package are
19// compatible. If you get a compiler error that this constant is not defined, this code was
20// generated with a version of connect newer than the one compiled into your binary. You can fix the
21// problem by either regenerating this code with an older version of connect or updating the connect
22// version compiled into your binary.
23const _ = connect.IsAtLeastVersion1_13_0
24
25const (
26	// ServerServiceName is the fully-qualified name of the ServerService service.
27	ServerServiceName = "ermite.ServerService"
28)
29
30// These constants are the fully-qualified names of the RPCs defined in this package. They're
31// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32//
33// Note that these are different from the fully-qualified method names used by
34// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36// period.
37const (
38	// ServerServiceGetVersionProcedure is the fully-qualified name of the ServerService's GetVersion
39	// RPC.
40	ServerServiceGetVersionProcedure = "/ermite.ServerService/GetVersion"
41	// ServerServiceGetSigningKeyProcedure is the fully-qualified name of the ServerService's
42	// GetSigningKey RPC.
43	ServerServiceGetSigningKeyProcedure = "/ermite.ServerService/GetSigningKey"
44	// ServerServiceRotateOIDCKeyProcedure is the fully-qualified name of the ServerService's
45	// RotateOIDCKey RPC.
46	ServerServiceRotateOIDCKeyProcedure = "/ermite.ServerService/RotateOIDCKey"
47)
48
49// ServerServiceClient is a client for the ermite.ServerService service.
50type ServerServiceClient interface {
51	// GetVersion returns the server version and the optional capabilities of the
52	// contract it implements. It needs no authentication, so a client can call
53	// it first to check compatibility.
54	GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error)
55	// GetSigningKey returns the public key with which the server signs the
56	// commits it creates (squash merges, see MergeMode). It needs no
57	// authentication: the key is public, and anyone verifying a commit needs it.
58	// Servers that implement it list "signing_key" in
59	// GetVersionResponse.features.
60	GetSigningKey(context.Context, *connect.Request[ermite.GetSigningKeyRequest]) (*connect.Response[ermite.GetSigningKeyResponse], error)
61	// RotateOIDCKey replaces the key with which the server signs the OIDC ID
62	// tokens of CI jobs (Job.id_token_url) by a new one. The previous key stops
63	// signing at once but stays in the server's JWKS
64	// ("/-/oidc/.well-known/jwks") for 24 hours, so that tokens it signed still
65	// verify until they expire. It needs owner rights: the admin token, the
66	// owner's session, or a token with every scope and no repository list or
67	// branch prefixes (permission_denied otherwise). It fails with
68	// failed_precondition when the server issues no ID tokens (it has no
69	// secrets key to seal the key with). Servers that implement it list
70	// "ci.oidc" in GetVersionResponse.features.
71	RotateOIDCKey(context.Context, *connect.Request[ermite.RotateOIDCKeyRequest]) (*connect.Response[ermite.RotateOIDCKeyResponse], error)
72}
73
74// NewServerServiceClient constructs a client for the ermite.ServerService service. By default, it
75// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
76// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
77// connect.WithGRPCWeb() options.
78//
79// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
80// http://api.acme.com or https://acme.com/grpc).
81func NewServerServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ServerServiceClient {
82	baseURL = strings.TrimRight(baseURL, "/")
83	serverServiceMethods := ermite.File_ermite_server_proto.Services().ByName("ServerService").Methods()
84	return &serverServiceClient{
85		getVersion: connect.NewClient[ermite.GetVersionRequest, ermite.GetVersionResponse](
86			httpClient,
87			baseURL+ServerServiceGetVersionProcedure,
88			connect.WithSchema(serverServiceMethods.ByName("GetVersion")),
89			connect.WithClientOptions(opts...),
90		),
91		getSigningKey: connect.NewClient[ermite.GetSigningKeyRequest, ermite.GetSigningKeyResponse](
92			httpClient,
93			baseURL+ServerServiceGetSigningKeyProcedure,
94			connect.WithSchema(serverServiceMethods.ByName("GetSigningKey")),
95			connect.WithClientOptions(opts...),
96		),
97		rotateOIDCKey: connect.NewClient[ermite.RotateOIDCKeyRequest, ermite.RotateOIDCKeyResponse](
98			httpClient,
99			baseURL+ServerServiceRotateOIDCKeyProcedure,
100			connect.WithSchema(serverServiceMethods.ByName("RotateOIDCKey")),
101			connect.WithClientOptions(opts...),
102		),
103	}
104}
105
106// serverServiceClient implements ServerServiceClient.
107type serverServiceClient struct {
108	getVersion    *connect.Client[ermite.GetVersionRequest, ermite.GetVersionResponse]
109	getSigningKey *connect.Client[ermite.GetSigningKeyRequest, ermite.GetSigningKeyResponse]
110	rotateOIDCKey *connect.Client[ermite.RotateOIDCKeyRequest, ermite.RotateOIDCKeyResponse]
111}
112
113// GetVersion calls ermite.ServerService.GetVersion.
114func (c *serverServiceClient) GetVersion(ctx context.Context, req *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error) {
115	return c.getVersion.CallUnary(ctx, req)
116}
117
118// GetSigningKey calls ermite.ServerService.GetSigningKey.
119func (c *serverServiceClient) GetSigningKey(ctx context.Context, req *connect.Request[ermite.GetSigningKeyRequest]) (*connect.Response[ermite.GetSigningKeyResponse], error) {
120	return c.getSigningKey.CallUnary(ctx, req)
121}
122
123// RotateOIDCKey calls ermite.ServerService.RotateOIDCKey.
124func (c *serverServiceClient) RotateOIDCKey(ctx context.Context, req *connect.Request[ermite.RotateOIDCKeyRequest]) (*connect.Response[ermite.RotateOIDCKeyResponse], error) {
125	return c.rotateOIDCKey.CallUnary(ctx, req)
126}
127
128// ServerServiceHandler is an implementation of the ermite.ServerService service.
129type ServerServiceHandler interface {
130	// GetVersion returns the server version and the optional capabilities of the
131	// contract it implements. It needs no authentication, so a client can call
132	// it first to check compatibility.
133	GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error)
134	// GetSigningKey returns the public key with which the server signs the
135	// commits it creates (squash merges, see MergeMode). It needs no
136	// authentication: the key is public, and anyone verifying a commit needs it.
137	// Servers that implement it list "signing_key" in
138	// GetVersionResponse.features.
139	GetSigningKey(context.Context, *connect.Request[ermite.GetSigningKeyRequest]) (*connect.Response[ermite.GetSigningKeyResponse], error)
140	// RotateOIDCKey replaces the key with which the server signs the OIDC ID
141	// tokens of CI jobs (Job.id_token_url) by a new one. The previous key stops
142	// signing at once but stays in the server's JWKS
143	// ("/-/oidc/.well-known/jwks") for 24 hours, so that tokens it signed still
144	// verify until they expire. It needs owner rights: the admin token, the
145	// owner's session, or a token with every scope and no repository list or
146	// branch prefixes (permission_denied otherwise). It fails with
147	// failed_precondition when the server issues no ID tokens (it has no
148	// secrets key to seal the key with). Servers that implement it list
149	// "ci.oidc" in GetVersionResponse.features.
150	RotateOIDCKey(context.Context, *connect.Request[ermite.RotateOIDCKeyRequest]) (*connect.Response[ermite.RotateOIDCKeyResponse], error)
151}
152
153// NewServerServiceHandler builds an HTTP handler from the service implementation. It returns the
154// path on which to mount the handler and the handler itself.
155//
156// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
157// and JSON codecs. They also support gzip compression.
158func NewServerServiceHandler(svc ServerServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
159	serverServiceMethods := ermite.File_ermite_server_proto.Services().ByName("ServerService").Methods()
160	serverServiceGetVersionHandler := connect.NewUnaryHandler(
161		ServerServiceGetVersionProcedure,
162		svc.GetVersion,
163		connect.WithSchema(serverServiceMethods.ByName("GetVersion")),
164		connect.WithHandlerOptions(opts...),
165	)
166	serverServiceGetSigningKeyHandler := connect.NewUnaryHandler(
167		ServerServiceGetSigningKeyProcedure,
168		svc.GetSigningKey,
169		connect.WithSchema(serverServiceMethods.ByName("GetSigningKey")),
170		connect.WithHandlerOptions(opts...),
171	)
172	serverServiceRotateOIDCKeyHandler := connect.NewUnaryHandler(
173		ServerServiceRotateOIDCKeyProcedure,
174		svc.RotateOIDCKey,
175		connect.WithSchema(serverServiceMethods.ByName("RotateOIDCKey")),
176		connect.WithHandlerOptions(opts...),
177	)
178	return "/ermite.ServerService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
179		switch r.URL.Path {
180		case ServerServiceGetVersionProcedure:
181			serverServiceGetVersionHandler.ServeHTTP(w, r)
182		case ServerServiceGetSigningKeyProcedure:
183			serverServiceGetSigningKeyHandler.ServeHTTP(w, r)
184		case ServerServiceRotateOIDCKeyProcedure:
185			serverServiceRotateOIDCKeyHandler.ServeHTTP(w, r)
186		default:
187			http.NotFound(w, r)
188		}
189	})
190}
191
192// UnimplementedServerServiceHandler returns CodeUnimplemented from all methods.
193type UnimplementedServerServiceHandler struct{}
194
195func (UnimplementedServerServiceHandler) GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error) {
196	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ServerService.GetVersion is not implemented"))
197}
198
199func (UnimplementedServerServiceHandler) GetSigningKey(context.Context, *connect.Request[ermite.GetSigningKeyRequest]) (*connect.Response[ermite.GetSigningKeyResponse], error) {
200	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ServerService.GetSigningKey is not implemented"))
201}
202
203func (UnimplementedServerServiceHandler) RotateOIDCKey(context.Context, *connect.Request[ermite.RotateOIDCKeyRequest]) (*connect.Response[ermite.RotateOIDCKeyResponse], error) {
204	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ServerService.RotateOIDCKey is not implemented"))
205}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 18

↑↓ moveenter openesc close