1// SPDX-License-Identifier: MIT
2
3// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4//
5// Source: ermite/ci_settings.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 // SecretServiceName is the fully-qualified name of the SecretService service.
27 SecretServiceName = "ermite.SecretService"
28 // VariableServiceName is the fully-qualified name of the VariableService service.
29 VariableServiceName = "ermite.VariableService"
30 // EnvironmentServiceName is the fully-qualified name of the EnvironmentService service.
31 EnvironmentServiceName = "ermite.EnvironmentService"
32)
33
34// These constants are the fully-qualified names of the RPCs defined in this package. They're
35// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
36//
37// Note that these are different from the fully-qualified method names used by
38// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
39// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
40// period.
41const (
42 // SecretServiceSetSecretProcedure is the fully-qualified name of the SecretService's SetSecret RPC.
43 SecretServiceSetSecretProcedure = "/ermite.SecretService/SetSecret"
44 // SecretServiceListSecretsProcedure is the fully-qualified name of the SecretService's ListSecrets
45 // RPC.
46 SecretServiceListSecretsProcedure = "/ermite.SecretService/ListSecrets"
47 // SecretServiceDeleteSecretProcedure is the fully-qualified name of the SecretService's
48 // DeleteSecret RPC.
49 SecretServiceDeleteSecretProcedure = "/ermite.SecretService/DeleteSecret"
50 // VariableServiceSetVariableProcedure is the fully-qualified name of the VariableService's
51 // SetVariable RPC.
52 VariableServiceSetVariableProcedure = "/ermite.VariableService/SetVariable"
53 // VariableServiceGetVariableProcedure is the fully-qualified name of the VariableService's
54 // GetVariable RPC.
55 VariableServiceGetVariableProcedure = "/ermite.VariableService/GetVariable"
56 // VariableServiceListVariablesProcedure is the fully-qualified name of the VariableService's
57 // ListVariables RPC.
58 VariableServiceListVariablesProcedure = "/ermite.VariableService/ListVariables"
59 // VariableServiceDeleteVariableProcedure is the fully-qualified name of the VariableService's
60 // DeleteVariable RPC.
61 VariableServiceDeleteVariableProcedure = "/ermite.VariableService/DeleteVariable"
62 // EnvironmentServiceCreateEnvironmentProcedure is the fully-qualified name of the
63 // EnvironmentService's CreateEnvironment RPC.
64 EnvironmentServiceCreateEnvironmentProcedure = "/ermite.EnvironmentService/CreateEnvironment"
65 // EnvironmentServiceListEnvironmentsProcedure is the fully-qualified name of the
66 // EnvironmentService's ListEnvironments RPC.
67 EnvironmentServiceListEnvironmentsProcedure = "/ermite.EnvironmentService/ListEnvironments"
68 // EnvironmentServiceDeleteEnvironmentProcedure is the fully-qualified name of the
69 // EnvironmentService's DeleteEnvironment RPC.
70 EnvironmentServiceDeleteEnvironmentProcedure = "/ermite.EnvironmentService/DeleteEnvironment"
71)
72
73// SecretServiceClient is a client for the ermite.SecretService service.
74type SecretServiceClient interface {
75 // SetSecret creates the secret or replaces its value. Fails with
76 // invalid_argument if the name is not valid, if the value is empty or longer
77 // than 48 KiB (49,152 bytes), or if scope is not set, with not_found if the
78 // environment of the scope does not exist, and with failed_precondition if
79 // the server has no encryption key.
80 SetSecret(context.Context, *connect.Request[ermite.SetSecretRequest]) (*connect.Response[ermite.SetSecretResponse], error)
81 // ListSecrets lists the secrets of one scope, ordered by name. It lists only
82 // the secrets set in that scope, not the ones the scope inherits. It never
83 // returns values.
84 ListSecrets(context.Context, *connect.Request[ermite.ListSecretsRequest]) (*connect.Response[ermite.ListSecretsResponse], error)
85 // DeleteSecret deletes a secret. Fails with not_found if it does not exist.
86 DeleteSecret(context.Context, *connect.Request[ermite.DeleteSecretRequest]) (*connect.Response[ermite.DeleteSecretResponse], error)
87}
88
89// NewSecretServiceClient constructs a client for the ermite.SecretService service. By default, it
90// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
91// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
92// connect.WithGRPCWeb() options.
93//
94// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
95// http://api.acme.com or https://acme.com/grpc).
96func NewSecretServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) SecretServiceClient {
97 baseURL = strings.TrimRight(baseURL, "/")
98 secretServiceMethods := ermite.File_ermite_ci_settings_proto.Services().ByName("SecretService").Methods()
99 return &secretServiceClient{
100 setSecret: connect.NewClient[ermite.SetSecretRequest, ermite.SetSecretResponse](
101 httpClient,
102 baseURL+SecretServiceSetSecretProcedure,
103 connect.WithSchema(secretServiceMethods.ByName("SetSecret")),
104 connect.WithClientOptions(opts...),
105 ),
106 listSecrets: connect.NewClient[ermite.ListSecretsRequest, ermite.ListSecretsResponse](
107 httpClient,
108 baseURL+SecretServiceListSecretsProcedure,
109 connect.WithSchema(secretServiceMethods.ByName("ListSecrets")),
110 connect.WithClientOptions(opts...),
111 ),
112 deleteSecret: connect.NewClient[ermite.DeleteSecretRequest, ermite.DeleteSecretResponse](
113 httpClient,
114 baseURL+SecretServiceDeleteSecretProcedure,
115 connect.WithSchema(secretServiceMethods.ByName("DeleteSecret")),
116 connect.WithClientOptions(opts...),
117 ),
118 }
119}
120
121// secretServiceClient implements SecretServiceClient.
122type secretServiceClient struct {
123 setSecret *connect.Client[ermite.SetSecretRequest, ermite.SetSecretResponse]
124 listSecrets *connect.Client[ermite.ListSecretsRequest, ermite.ListSecretsResponse]
125 deleteSecret *connect.Client[ermite.DeleteSecretRequest, ermite.DeleteSecretResponse]
126}
127
128// SetSecret calls ermite.SecretService.SetSecret.
129func (c *secretServiceClient) SetSecret(ctx context.Context, req *connect.Request[ermite.SetSecretRequest]) (*connect.Response[ermite.SetSecretResponse], error) {
130 return c.setSecret.CallUnary(ctx, req)
131}
132
133// ListSecrets calls ermite.SecretService.ListSecrets.
134func (c *secretServiceClient) ListSecrets(ctx context.Context, req *connect.Request[ermite.ListSecretsRequest]) (*connect.Response[ermite.ListSecretsResponse], error) {
135 return c.listSecrets.CallUnary(ctx, req)
136}
137
138// DeleteSecret calls ermite.SecretService.DeleteSecret.
139func (c *secretServiceClient) DeleteSecret(ctx context.Context, req *connect.Request[ermite.DeleteSecretRequest]) (*connect.Response[ermite.DeleteSecretResponse], error) {
140 return c.deleteSecret.CallUnary(ctx, req)
141}
142
143// SecretServiceHandler is an implementation of the ermite.SecretService service.
144type SecretServiceHandler interface {
145 // SetSecret creates the secret or replaces its value. Fails with
146 // invalid_argument if the name is not valid, if the value is empty or longer
147 // than 48 KiB (49,152 bytes), or if scope is not set, with not_found if the
148 // environment of the scope does not exist, and with failed_precondition if
149 // the server has no encryption key.
150 SetSecret(context.Context, *connect.Request[ermite.SetSecretRequest]) (*connect.Response[ermite.SetSecretResponse], error)
151 // ListSecrets lists the secrets of one scope, ordered by name. It lists only
152 // the secrets set in that scope, not the ones the scope inherits. It never
153 // returns values.
154 ListSecrets(context.Context, *connect.Request[ermite.ListSecretsRequest]) (*connect.Response[ermite.ListSecretsResponse], error)
155 // DeleteSecret deletes a secret. Fails with not_found if it does not exist.
156 DeleteSecret(context.Context, *connect.Request[ermite.DeleteSecretRequest]) (*connect.Response[ermite.DeleteSecretResponse], error)
157}
158
159// NewSecretServiceHandler builds an HTTP handler from the service implementation. It returns the
160// path on which to mount the handler and the handler itself.
161//
162// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
163// and JSON codecs. They also support gzip compression.
164func NewSecretServiceHandler(svc SecretServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
165 secretServiceMethods := ermite.File_ermite_ci_settings_proto.Services().ByName("SecretService").Methods()
166 secretServiceSetSecretHandler := connect.NewUnaryHandler(
167 SecretServiceSetSecretProcedure,
168 svc.SetSecret,
169 connect.WithSchema(secretServiceMethods.ByName("SetSecret")),
170 connect.WithHandlerOptions(opts...),
171 )
172 secretServiceListSecretsHandler := connect.NewUnaryHandler(
173 SecretServiceListSecretsProcedure,
174 svc.ListSecrets,
175 connect.WithSchema(secretServiceMethods.ByName("ListSecrets")),
176 connect.WithHandlerOptions(opts...),
177 )
178 secretServiceDeleteSecretHandler := connect.NewUnaryHandler(
179 SecretServiceDeleteSecretProcedure,
180 svc.DeleteSecret,
181 connect.WithSchema(secretServiceMethods.ByName("DeleteSecret")),
182 connect.WithHandlerOptions(opts...),
183 )
184 return "/ermite.SecretService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
185 switch r.URL.Path {
186 case SecretServiceSetSecretProcedure:
187 secretServiceSetSecretHandler.ServeHTTP(w, r)
188 case SecretServiceListSecretsProcedure:
189 secretServiceListSecretsHandler.ServeHTTP(w, r)
190 case SecretServiceDeleteSecretProcedure:
191 secretServiceDeleteSecretHandler.ServeHTTP(w, r)
192 default:
193 http.NotFound(w, r)
194 }
195 })
196}
197
198// UnimplementedSecretServiceHandler returns CodeUnimplemented from all methods.
199type UnimplementedSecretServiceHandler struct{}
200
201func (UnimplementedSecretServiceHandler) SetSecret(context.Context, *connect.Request[ermite.SetSecretRequest]) (*connect.Response[ermite.SetSecretResponse], error) {
202 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.SecretService.SetSecret is not implemented"))
203}
204
205func (UnimplementedSecretServiceHandler) ListSecrets(context.Context, *connect.Request[ermite.ListSecretsRequest]) (*connect.Response[ermite.ListSecretsResponse], error) {
206 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.SecretService.ListSecrets is not implemented"))
207}
208
209func (UnimplementedSecretServiceHandler) DeleteSecret(context.Context, *connect.Request[ermite.DeleteSecretRequest]) (*connect.Response[ermite.DeleteSecretResponse], error) {
210 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.SecretService.DeleteSecret is not implemented"))
211}
212
213// VariableServiceClient is a client for the ermite.VariableService service.
214type VariableServiceClient interface {
215 // SetVariable creates the variable or replaces its value. Fails with
216 // invalid_argument if the name is not valid, if the value is longer than 48
217 // KiB (49,152 bytes) or if scope is not set, and with not_found if the
218 // environment of the scope does not exist. An empty value is allowed.
219 SetVariable(context.Context, *connect.Request[ermite.SetVariableRequest]) (*connect.Response[ermite.SetVariableResponse], error)
220 // GetVariable returns one variable of one scope, with its value. Fails with
221 // not_found if it does not exist in that scope.
222 GetVariable(context.Context, *connect.Request[ermite.GetVariableRequest]) (*connect.Response[ermite.GetVariableResponse], error)
223 // ListVariables lists the variables of one scope, ordered by name, with
224 // their values. It lists only the variables set in that scope.
225 ListVariables(context.Context, *connect.Request[ermite.ListVariablesRequest]) (*connect.Response[ermite.ListVariablesResponse], error)
226 // DeleteVariable deletes a variable. Fails with not_found if it does not
227 // exist.
228 DeleteVariable(context.Context, *connect.Request[ermite.DeleteVariableRequest]) (*connect.Response[ermite.DeleteVariableResponse], error)
229}
230
231// NewVariableServiceClient constructs a client for the ermite.VariableService service. By default,
232// it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and
233// sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC()
234// or connect.WithGRPCWeb() options.
235//
236// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
237// http://api.acme.com or https://acme.com/grpc).
238func NewVariableServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) VariableServiceClient {
239 baseURL = strings.TrimRight(baseURL, "/")
240 variableServiceMethods := ermite.File_ermite_ci_settings_proto.Services().ByName("VariableService").Methods()
241 return &variableServiceClient{
242 setVariable: connect.NewClient[ermite.SetVariableRequest, ermite.SetVariableResponse](
243 httpClient,
244 baseURL+VariableServiceSetVariableProcedure,
245 connect.WithSchema(variableServiceMethods.ByName("SetVariable")),
246 connect.WithClientOptions(opts...),
247 ),
248 getVariable: connect.NewClient[ermite.GetVariableRequest, ermite.GetVariableResponse](
249 httpClient,
250 baseURL+VariableServiceGetVariableProcedure,
251 connect.WithSchema(variableServiceMethods.ByName("GetVariable")),
252 connect.WithClientOptions(opts...),
253 ),
254 listVariables: connect.NewClient[ermite.ListVariablesRequest, ermite.ListVariablesResponse](
255 httpClient,
256 baseURL+VariableServiceListVariablesProcedure,
257 connect.WithSchema(variableServiceMethods.ByName("ListVariables")),
258 connect.WithClientOptions(opts...),
259 ),
260 deleteVariable: connect.NewClient[ermite.DeleteVariableRequest, ermite.DeleteVariableResponse](
261 httpClient,
262 baseURL+VariableServiceDeleteVariableProcedure,
263 connect.WithSchema(variableServiceMethods.ByName("DeleteVariable")),
264 connect.WithClientOptions(opts...),
265 ),
266 }
267}
268
269// variableServiceClient implements VariableServiceClient.
270type variableServiceClient struct {
271 setVariable *connect.Client[ermite.SetVariableRequest, ermite.SetVariableResponse]
272 getVariable *connect.Client[ermite.GetVariableRequest, ermite.GetVariableResponse]
273 listVariables *connect.Client[ermite.ListVariablesRequest, ermite.ListVariablesResponse]
274 deleteVariable *connect.Client[ermite.DeleteVariableRequest, ermite.DeleteVariableResponse]
275}
276
277// SetVariable calls ermite.VariableService.SetVariable.
278func (c *variableServiceClient) SetVariable(ctx context.Context, req *connect.Request[ermite.SetVariableRequest]) (*connect.Response[ermite.SetVariableResponse], error) {
279 return c.setVariable.CallUnary(ctx, req)
280}
281
282// GetVariable calls ermite.VariableService.GetVariable.
283func (c *variableServiceClient) GetVariable(ctx context.Context, req *connect.Request[ermite.GetVariableRequest]) (*connect.Response[ermite.GetVariableResponse], error) {
284 return c.getVariable.CallUnary(ctx, req)
285}
286
287// ListVariables calls ermite.VariableService.ListVariables.
288func (c *variableServiceClient) ListVariables(ctx context.Context, req *connect.Request[ermite.ListVariablesRequest]) (*connect.Response[ermite.ListVariablesResponse], error) {
289 return c.listVariables.CallUnary(ctx, req)
290}
291
292// DeleteVariable calls ermite.VariableService.DeleteVariable.
293func (c *variableServiceClient) DeleteVariable(ctx context.Context, req *connect.Request[ermite.DeleteVariableRequest]) (*connect.Response[ermite.DeleteVariableResponse], error) {
294 return c.deleteVariable.CallUnary(ctx, req)
295}
296
297// VariableServiceHandler is an implementation of the ermite.VariableService service.
298type VariableServiceHandler interface {
299 // SetVariable creates the variable or replaces its value. Fails with
300 // invalid_argument if the name is not valid, if the value is longer than 48
301 // KiB (49,152 bytes) or if scope is not set, and with not_found if the
302 // environment of the scope does not exist. An empty value is allowed.
303 SetVariable(context.Context, *connect.Request[ermite.SetVariableRequest]) (*connect.Response[ermite.SetVariableResponse], error)
304 // GetVariable returns one variable of one scope, with its value. Fails with
305 // not_found if it does not exist in that scope.
306 GetVariable(context.Context, *connect.Request[ermite.GetVariableRequest]) (*connect.Response[ermite.GetVariableResponse], error)
307 // ListVariables lists the variables of one scope, ordered by name, with
308 // their values. It lists only the variables set in that scope.
309 ListVariables(context.Context, *connect.Request[ermite.ListVariablesRequest]) (*connect.Response[ermite.ListVariablesResponse], error)
310 // DeleteVariable deletes a variable. Fails with not_found if it does not
311 // exist.
312 DeleteVariable(context.Context, *connect.Request[ermite.DeleteVariableRequest]) (*connect.Response[ermite.DeleteVariableResponse], error)
313}
314
315// NewVariableServiceHandler builds an HTTP handler from the service implementation. It returns the
316// path on which to mount the handler and the handler itself.
317//
318// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
319// and JSON codecs. They also support gzip compression.
320func NewVariableServiceHandler(svc VariableServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
321 variableServiceMethods := ermite.File_ermite_ci_settings_proto.Services().ByName("VariableService").Methods()
322 variableServiceSetVariableHandler := connect.NewUnaryHandler(
323 VariableServiceSetVariableProcedure,
324 svc.SetVariable,
325 connect.WithSchema(variableServiceMethods.ByName("SetVariable")),
326 connect.WithHandlerOptions(opts...),
327 )
328 variableServiceGetVariableHandler := connect.NewUnaryHandler(
329 VariableServiceGetVariableProcedure,
330 svc.GetVariable,
331 connect.WithSchema(variableServiceMethods.ByName("GetVariable")),
332 connect.WithHandlerOptions(opts...),
333 )
334 variableServiceListVariablesHandler := connect.NewUnaryHandler(
335 VariableServiceListVariablesProcedure,
336 svc.ListVariables,
337 connect.WithSchema(variableServiceMethods.ByName("ListVariables")),
338 connect.WithHandlerOptions(opts...),
339 )
340 variableServiceDeleteVariableHandler := connect.NewUnaryHandler(
341 VariableServiceDeleteVariableProcedure,
342 svc.DeleteVariable,
343 connect.WithSchema(variableServiceMethods.ByName("DeleteVariable")),
344 connect.WithHandlerOptions(opts...),
345 )
346 return "/ermite.VariableService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
347 switch r.URL.Path {
348 case VariableServiceSetVariableProcedure:
349 variableServiceSetVariableHandler.ServeHTTP(w, r)
350 case VariableServiceGetVariableProcedure:
351 variableServiceGetVariableHandler.ServeHTTP(w, r)
352 case VariableServiceListVariablesProcedure:
353 variableServiceListVariablesHandler.ServeHTTP(w, r)
354 case VariableServiceDeleteVariableProcedure:
355 variableServiceDeleteVariableHandler.ServeHTTP(w, r)
356 default:
357 http.NotFound(w, r)
358 }
359 })
360}
361
362// UnimplementedVariableServiceHandler returns CodeUnimplemented from all methods.
363type UnimplementedVariableServiceHandler struct{}
364
365func (UnimplementedVariableServiceHandler) SetVariable(context.Context, *connect.Request[ermite.SetVariableRequest]) (*connect.Response[ermite.SetVariableResponse], error) {
366 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.VariableService.SetVariable is not implemented"))
367}
368
369func (UnimplementedVariableServiceHandler) GetVariable(context.Context, *connect.Request[ermite.GetVariableRequest]) (*connect.Response[ermite.GetVariableResponse], error) {
370 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.VariableService.GetVariable is not implemented"))
371}
372
373func (UnimplementedVariableServiceHandler) ListVariables(context.Context, *connect.Request[ermite.ListVariablesRequest]) (*connect.Response[ermite.ListVariablesResponse], error) {
374 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.VariableService.ListVariables is not implemented"))
375}
376
377func (UnimplementedVariableServiceHandler) DeleteVariable(context.Context, *connect.Request[ermite.DeleteVariableRequest]) (*connect.Response[ermite.DeleteVariableResponse], error) {
378 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.VariableService.DeleteVariable is not implemented"))
379}
380
381// EnvironmentServiceClient is a client for the ermite.EnvironmentService service.
382type EnvironmentServiceClient interface {
383 // CreateEnvironment creates an environment. It succeeds and changes nothing
384 // if the environment already exists (without regard to case), as GitHub's
385 // create-or-update does. Fails with invalid_argument if the name is not
386 // valid and with not_found if the repository does not exist.
387 CreateEnvironment(context.Context, *connect.Request[ermite.CreateEnvironmentRequest]) (*connect.Response[ermite.CreateEnvironmentResponse], error)
388 // ListEnvironments lists the environments of a repository, ordered by name.
389 ListEnvironments(context.Context, *connect.Request[ermite.ListEnvironmentsRequest]) (*connect.Response[ermite.ListEnvironmentsResponse], error)
390 // DeleteEnvironment deletes an environment with its secrets and variables.
391 // Fails with not_found if it does not exist.
392 DeleteEnvironment(context.Context, *connect.Request[ermite.DeleteEnvironmentRequest]) (*connect.Response[ermite.DeleteEnvironmentResponse], error)
393}
394
395// NewEnvironmentServiceClient constructs a client for the ermite.EnvironmentService service. By
396// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
397// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
398// connect.WithGRPC() or connect.WithGRPCWeb() options.
399//
400// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
401// http://api.acme.com or https://acme.com/grpc).
402func NewEnvironmentServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) EnvironmentServiceClient {
403 baseURL = strings.TrimRight(baseURL, "/")
404 environmentServiceMethods := ermite.File_ermite_ci_settings_proto.Services().ByName("EnvironmentService").Methods()
405 return &environmentServiceClient{
406 createEnvironment: connect.NewClient[ermite.CreateEnvironmentRequest, ermite.CreateEnvironmentResponse](
407 httpClient,
408 baseURL+EnvironmentServiceCreateEnvironmentProcedure,
409 connect.WithSchema(environmentServiceMethods.ByName("CreateEnvironment")),
410 connect.WithClientOptions(opts...),
411 ),
412 listEnvironments: connect.NewClient[ermite.ListEnvironmentsRequest, ermite.ListEnvironmentsResponse](
413 httpClient,
414 baseURL+EnvironmentServiceListEnvironmentsProcedure,
415 connect.WithSchema(environmentServiceMethods.ByName("ListEnvironments")),
416 connect.WithClientOptions(opts...),
417 ),
418 deleteEnvironment: connect.NewClient[ermite.DeleteEnvironmentRequest, ermite.DeleteEnvironmentResponse](
419 httpClient,
420 baseURL+EnvironmentServiceDeleteEnvironmentProcedure,
421 connect.WithSchema(environmentServiceMethods.ByName("DeleteEnvironment")),
422 connect.WithClientOptions(opts...),
423 ),
424 }
425}
426
427// environmentServiceClient implements EnvironmentServiceClient.
428type environmentServiceClient struct {
429 createEnvironment *connect.Client[ermite.CreateEnvironmentRequest, ermite.CreateEnvironmentResponse]
430 listEnvironments *connect.Client[ermite.ListEnvironmentsRequest, ermite.ListEnvironmentsResponse]
431 deleteEnvironment *connect.Client[ermite.DeleteEnvironmentRequest, ermite.DeleteEnvironmentResponse]
432}
433
434// CreateEnvironment calls ermite.EnvironmentService.CreateEnvironment.
435func (c *environmentServiceClient) CreateEnvironment(ctx context.Context, req *connect.Request[ermite.CreateEnvironmentRequest]) (*connect.Response[ermite.CreateEnvironmentResponse], error) {
436 return c.createEnvironment.CallUnary(ctx, req)
437}
438
439// ListEnvironments calls ermite.EnvironmentService.ListEnvironments.
440func (c *environmentServiceClient) ListEnvironments(ctx context.Context, req *connect.Request[ermite.ListEnvironmentsRequest]) (*connect.Response[ermite.ListEnvironmentsResponse], error) {
441 return c.listEnvironments.CallUnary(ctx, req)
442}
443
444// DeleteEnvironment calls ermite.EnvironmentService.DeleteEnvironment.
445func (c *environmentServiceClient) DeleteEnvironment(ctx context.Context, req *connect.Request[ermite.DeleteEnvironmentRequest]) (*connect.Response[ermite.DeleteEnvironmentResponse], error) {
446 return c.deleteEnvironment.CallUnary(ctx, req)
447}
448
449// EnvironmentServiceHandler is an implementation of the ermite.EnvironmentService service.
450type EnvironmentServiceHandler interface {
451 // CreateEnvironment creates an environment. It succeeds and changes nothing
452 // if the environment already exists (without regard to case), as GitHub's
453 // create-or-update does. Fails with invalid_argument if the name is not
454 // valid and with not_found if the repository does not exist.
455 CreateEnvironment(context.Context, *connect.Request[ermite.CreateEnvironmentRequest]) (*connect.Response[ermite.CreateEnvironmentResponse], error)
456 // ListEnvironments lists the environments of a repository, ordered by name.
457 ListEnvironments(context.Context, *connect.Request[ermite.ListEnvironmentsRequest]) (*connect.Response[ermite.ListEnvironmentsResponse], error)
458 // DeleteEnvironment deletes an environment with its secrets and variables.
459 // Fails with not_found if it does not exist.
460 DeleteEnvironment(context.Context, *connect.Request[ermite.DeleteEnvironmentRequest]) (*connect.Response[ermite.DeleteEnvironmentResponse], error)
461}
462
463// NewEnvironmentServiceHandler builds an HTTP handler from the service implementation. It returns
464// the path on which to mount the handler and the handler itself.
465//
466// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
467// and JSON codecs. They also support gzip compression.
468func NewEnvironmentServiceHandler(svc EnvironmentServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
469 environmentServiceMethods := ermite.File_ermite_ci_settings_proto.Services().ByName("EnvironmentService").Methods()
470 environmentServiceCreateEnvironmentHandler := connect.NewUnaryHandler(
471 EnvironmentServiceCreateEnvironmentProcedure,
472 svc.CreateEnvironment,
473 connect.WithSchema(environmentServiceMethods.ByName("CreateEnvironment")),
474 connect.WithHandlerOptions(opts...),
475 )
476 environmentServiceListEnvironmentsHandler := connect.NewUnaryHandler(
477 EnvironmentServiceListEnvironmentsProcedure,
478 svc.ListEnvironments,
479 connect.WithSchema(environmentServiceMethods.ByName("ListEnvironments")),
480 connect.WithHandlerOptions(opts...),
481 )
482 environmentServiceDeleteEnvironmentHandler := connect.NewUnaryHandler(
483 EnvironmentServiceDeleteEnvironmentProcedure,
484 svc.DeleteEnvironment,
485 connect.WithSchema(environmentServiceMethods.ByName("DeleteEnvironment")),
486 connect.WithHandlerOptions(opts...),
487 )
488 return "/ermite.EnvironmentService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
489 switch r.URL.Path {
490 case EnvironmentServiceCreateEnvironmentProcedure:
491 environmentServiceCreateEnvironmentHandler.ServeHTTP(w, r)
492 case EnvironmentServiceListEnvironmentsProcedure:
493 environmentServiceListEnvironmentsHandler.ServeHTTP(w, r)
494 case EnvironmentServiceDeleteEnvironmentProcedure:
495 environmentServiceDeleteEnvironmentHandler.ServeHTTP(w, r)
496 default:
497 http.NotFound(w, r)
498 }
499 })
500}
501
502// UnimplementedEnvironmentServiceHandler returns CodeUnimplemented from all methods.
503type UnimplementedEnvironmentServiceHandler struct{}
504
505func (UnimplementedEnvironmentServiceHandler) CreateEnvironment(context.Context, *connect.Request[ermite.CreateEnvironmentRequest]) (*connect.Response[ermite.CreateEnvironmentResponse], error) {
506 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.EnvironmentService.CreateEnvironment is not implemented"))
507}
508
509func (UnimplementedEnvironmentServiceHandler) ListEnvironments(context.Context, *connect.Request[ermite.ListEnvironmentsRequest]) (*connect.Response[ermite.ListEnvironmentsResponse], error) {
510 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.EnvironmentService.ListEnvironments is not implemented"))
511}
512
513func (UnimplementedEnvironmentServiceHandler) DeleteEnvironment(context.Context, *connect.Request[ermite.DeleteEnvironmentRequest]) (*connect.Response[ermite.DeleteEnvironmentResponse], error) {
514 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.EnvironmentService.DeleteEnvironment is not implemented"))
515}