Update api to implement runners (fixes #1)

This commit is contained in:
2023-01-09 00:56:52 -07:00
parent 027d707f07
commit ead0aeff2e
7 changed files with 374 additions and 26 deletions
@@ -0,0 +1,86 @@
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: api/v2/release_runner.proto
package apiv2connect
import (
context "context"
errors "errors"
v2 "git.ohea.xyz/cursorius/pipeline-api/go/api/v2"
connect_go "github.com/bufbuild/connect-go"
http "net/http"
strings "strings"
)
// This is a compile-time assertion to ensure that this generated file and the connect package are
// compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of connect newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of connect or updating the connect
// version compiled into your binary.
const _ = connect_go.IsAtLeastVersion0_1_0
const (
// ReleaseRunnerServiceName is the fully-qualified name of the ReleaseRunnerService service.
ReleaseRunnerServiceName = "api.v2.ReleaseRunnerService"
)
// ReleaseRunnerServiceClient is a client for the api.v2.ReleaseRunnerService service.
type ReleaseRunnerServiceClient interface {
ReleaseRunner(context.Context, *connect_go.Request[v2.ReleaseRunnerRequest]) (*connect_go.Response[v2.ReleaseRunnerResponse], error)
}
// NewReleaseRunnerServiceClient constructs a client for the api.v2.ReleaseRunnerService service. By
// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
// connect.WithGRPC() or connect.WithGRPCWeb() options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewReleaseRunnerServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ReleaseRunnerServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
return &releaseRunnerServiceClient{
releaseRunner: connect_go.NewClient[v2.ReleaseRunnerRequest, v2.ReleaseRunnerResponse](
httpClient,
baseURL+"/api.v2.ReleaseRunnerService/ReleaseRunner",
opts...,
),
}
}
// releaseRunnerServiceClient implements ReleaseRunnerServiceClient.
type releaseRunnerServiceClient struct {
releaseRunner *connect_go.Client[v2.ReleaseRunnerRequest, v2.ReleaseRunnerResponse]
}
// ReleaseRunner calls api.v2.ReleaseRunnerService.ReleaseRunner.
func (c *releaseRunnerServiceClient) ReleaseRunner(ctx context.Context, req *connect_go.Request[v2.ReleaseRunnerRequest]) (*connect_go.Response[v2.ReleaseRunnerResponse], error) {
return c.releaseRunner.CallUnary(ctx, req)
}
// ReleaseRunnerServiceHandler is an implementation of the api.v2.ReleaseRunnerService service.
type ReleaseRunnerServiceHandler interface {
ReleaseRunner(context.Context, *connect_go.Request[v2.ReleaseRunnerRequest]) (*connect_go.Response[v2.ReleaseRunnerResponse], error)
}
// NewReleaseRunnerServiceHandler builds an HTTP handler from the service implementation. It returns
// the path on which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewReleaseRunnerServiceHandler(svc ReleaseRunnerServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {
mux := http.NewServeMux()
mux.Handle("/api.v2.ReleaseRunnerService/ReleaseRunner", connect_go.NewUnaryHandler(
"/api.v2.ReleaseRunnerService/ReleaseRunner",
svc.ReleaseRunner,
opts...,
))
return "/api.v2.ReleaseRunnerService/", mux
}
// UnimplementedReleaseRunnerServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedReleaseRunnerServiceHandler struct{}
func (UnimplementedReleaseRunnerServiceHandler) ReleaseRunner(context.Context, *connect_go.Request[v2.ReleaseRunnerRequest]) (*connect_go.Response[v2.ReleaseRunnerResponse], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("api.v2.ReleaseRunnerService.ReleaseRunner is not implemented"))
}
+206
View File
@@ -0,0 +1,206 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc (unknown)
// source: api/v2/release_runner.proto
package apiv2
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ReleaseRunnerRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *ReleaseRunnerRequest) Reset() {
*x = ReleaseRunnerRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_release_runner_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReleaseRunnerRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReleaseRunnerRequest) ProtoMessage() {}
func (x *ReleaseRunnerRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_release_runner_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReleaseRunnerRequest.ProtoReflect.Descriptor instead.
func (*ReleaseRunnerRequest) Descriptor() ([]byte, []int) {
return file_api_v2_release_runner_proto_rawDescGZIP(), []int{0}
}
func (x *ReleaseRunnerRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
type ReleaseRunnerResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ReleaseRunnerResponse) Reset() {
*x = ReleaseRunnerResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_release_runner_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReleaseRunnerResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReleaseRunnerResponse) ProtoMessage() {}
func (x *ReleaseRunnerResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_release_runner_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReleaseRunnerResponse.ProtoReflect.Descriptor instead.
func (*ReleaseRunnerResponse) Descriptor() ([]byte, []int) {
return file_api_v2_release_runner_proto_rawDescGZIP(), []int{1}
}
var File_api_v2_release_runner_proto protoreflect.FileDescriptor
var file_api_v2_release_runner_proto_rawDesc = []byte{
0x0a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65,
0x5f, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x61,
0x70, 0x69, 0x2e, 0x76, 0x32, 0x22, 0x26, 0x0a, 0x14, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65,
0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x17, 0x0a,
0x15, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x66, 0x0a, 0x14, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73,
0x65, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4e,
0x0a, 0x0d, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x12,
0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65,
0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x75,
0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x35,
0x5a, 0x33, 0x67, 0x69, 0x74, 0x2e, 0x6f, 0x68, 0x65, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2f, 0x63,
0x75, 0x72, 0x73, 0x6f, 0x72, 0x69, 0x75, 0x73, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e,
0x65, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b,
0x61, 0x70, 0x69, 0x76, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_api_v2_release_runner_proto_rawDescOnce sync.Once
file_api_v2_release_runner_proto_rawDescData = file_api_v2_release_runner_proto_rawDesc
)
func file_api_v2_release_runner_proto_rawDescGZIP() []byte {
file_api_v2_release_runner_proto_rawDescOnce.Do(func() {
file_api_v2_release_runner_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v2_release_runner_proto_rawDescData)
})
return file_api_v2_release_runner_proto_rawDescData
}
var file_api_v2_release_runner_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_api_v2_release_runner_proto_goTypes = []interface{}{
(*ReleaseRunnerRequest)(nil), // 0: api.v2.ReleaseRunnerRequest
(*ReleaseRunnerResponse)(nil), // 1: api.v2.ReleaseRunnerResponse
}
var file_api_v2_release_runner_proto_depIdxs = []int32{
0, // 0: api.v2.ReleaseRunnerService.ReleaseRunner:input_type -> api.v2.ReleaseRunnerRequest
1, // 1: api.v2.ReleaseRunnerService.ReleaseRunner:output_type -> api.v2.ReleaseRunnerResponse
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_api_v2_release_runner_proto_init() }
func file_api_v2_release_runner_proto_init() {
if File_api_v2_release_runner_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_api_v2_release_runner_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReleaseRunnerRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_api_v2_release_runner_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReleaseRunnerResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_v2_release_runner_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_api_v2_release_runner_proto_goTypes,
DependencyIndexes: file_api_v2_release_runner_proto_depIdxs,
MessageInfos: file_api_v2_release_runner_proto_msgTypes,
}.Build()
File_api_v2_release_runner_proto = out.File
file_api_v2_release_runner_proto_rawDesc = nil
file_api_v2_release_runner_proto_goTypes = nil
file_api_v2_release_runner_proto_depIdxs = nil
}
+29 -20
View File
@@ -25,8 +25,9 @@ type RunCommandRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Command string `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Command string `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"`
Args []string `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"`
}
func (x *RunCommandRequest) Reset() {
@@ -75,6 +76,13 @@ func (x *RunCommandRequest) GetCommand() string {
return ""
}
func (x *RunCommandRequest) GetArgs() []string {
if x != nil {
return x.Args
}
return nil
}
type RunCommandResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -143,27 +151,28 @@ var File_api_v2_run_command_proto protoreflect.FileDescriptor
var file_api_v2_run_command_proto_rawDesc = []byte{
0x0a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x75, 0x6e, 0x5f, 0x63, 0x6f, 0x6d,
0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x61, 0x70, 0x69, 0x2e,
0x76, 0x32, 0x22, 0x3d, 0x0a, 0x11, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
0x76, 0x32, 0x22, 0x51, 0x0a, 0x11, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x64, 0x22, 0x65, 0x0a, 0x12, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72,
0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65,
0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x6f,
0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74,
0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x32, 0x5a, 0x0a, 0x11, 0x52, 0x75, 0x6e, 0x43,
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x45, 0x0a,
0x0a, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x19, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x2e, 0x6f, 0x68, 0x65, 0x61,
0x2e, 0x78, 0x79, 0x7a, 0x2f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x69, 0x75, 0x73, 0x2f, 0x70,
0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x61,
0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52,
0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x65, 0x0a, 0x12, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d,
0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x72,
0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06,
0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74,
0x64, 0x6f, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x32, 0x5a, 0x0a, 0x11,
0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x45, 0x0a, 0x0a, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12,
0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d,
0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x76, 0x32, 0x2e, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x2e,
0x6f, 0x68, 0x65, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x69,
0x75, 0x73, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x2d, 0x61, 0x70, 0x69, 0x2f,
0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (