diff --git a/Makefile b/Makefile index cf7c5fb79..43e82ba99 100644 --- a/Makefile +++ b/Makefile @@ -99,6 +99,7 @@ generate-proto: buf.gen.yaml buf.lock $(shell git ls-files '**/*.proto') _protoc $(BUF) mod update $(BUF) generate $(GOFUMPT) -w internal/proto/*.pb.* + $(GOFUMPT) -w internal/proto/workflow/v2/*.pb.* .PHONY: generate generate: generate-proto generate-go generate-manifests ## Generate code, manifests etc. diff --git a/internal/agent/transport/grpc.go b/internal/agent/transport/grpc.go new file mode 100644 index 000000000..c2bc8db49 --- /dev/null +++ b/internal/agent/transport/grpc.go @@ -0,0 +1,226 @@ +package transport + +import ( + "context" + "errors" + "fmt" + "io" + "sync" + + "github.com/go-logr/logr" + "github.com/tinkerbell/tink/internal/agent/event" + "github.com/tinkerbell/tink/internal/agent/workflow" + workflowproto "github.com/tinkerbell/tink/internal/proto/workflow/v2" +) + +var _ event.Recorder = &GRPC{} + +func NewGRPC(log logr.Logger, client workflowproto.WorkflowServiceClient) *GRPC { + return &GRPC{ + log: log, + client: client, + } +} + +type GRPC struct { + log logr.Logger + client workflowproto.WorkflowServiceClient +} + +func (g *GRPC) Start(ctx context.Context, agentID string, handler WorkflowHandler) error { + stream, err := g.client.StreamWorkflows(ctx, &workflowproto.StreamWorkflowsRequest{ + AgentId: agentID, + }) + if err != nil { + return err + } + + log := g.log + var idx workflowIndex + + for { + request, err := stream.Recv() + switch { + case errors.Is(err, io.EOF): + // TODO(chrisdoherty4) Think about cancelling + return nil + case err != nil: + return err + } + + switch request.GetCmd().(type) { + case *workflowproto.StreamWorkflowsResponse_StartWorkflow_: + grpcWorkflow := request.GetStartWorkflow().GetWorkflow() + + if err := validateGRPCWorkflow(grpcWorkflow); err != nil { + log.Info("Dropping invalid workflow", "error", err) + continue + } + + wflw := toWorkflow(grpcWorkflow) + + // Start a new execution context so we can cancel it as needed. + ctx, err := idx.Insert(stream.Context(), wflw.ID) + if err != nil { + // Handle already excuting workflow. Perhaps this needs to be an agent concern + // so that multiple transports benefit from the same handling. Or, given its + // already running, perhaps we just log we were asked to run the same workflow + // twice. + _ = err + } + + go func(ctx context.Context, wflw workflow.Workflow) { + if err := handler.HandleWorkflow(ctx, wflw, g); err != nil { + log.Info("Failed to handle workflow", "error", err) + } + + // Stop the execution context so we're no longer tracking the workflow. + idx.Cancel(wflw.ID) + }(ctx, wflw) + + case *workflowproto.StreamWorkflowsResponse_StopWorkflow_: + req := request.GetStopWorkflow() + // TODO: Validate workflow ID + idx.Cancel(req.WorkflowId) + } + } +} + +func (g *GRPC) RecordEvent(ctx context.Context, e event.Event) { + evnt, err := toGRPC(e) + if err != nil { + g.log.Error(err, "convert event to gRPC payload", "event", e) + return + } + + _, err = g.client.PublishEvent(ctx, &workflowproto.PublishEventRequest{ + Event: evnt, + }) + if err != nil { + g.log.Error(err, "publishing event", "event", evnt) + return + } +} + +func validateGRPCWorkflow(wflw *workflowproto.Workflow) error { + if wflw == nil { + return errors.New("workflow must not be nil") + } + + for _, action := range wflw.Actions { + if action == nil { + return errors.New("workflow actions must not be nil") + } + } + + return nil +} + +func toWorkflow(wflw *workflowproto.Workflow) workflow.Workflow { + return workflow.Workflow{ + ID: wflw.WorkflowId, + Actions: toActions(wflw.GetActions()), + } +} + +func toActions(a []*workflowproto.Workflow_Action) []workflow.Action { + var actions []workflow.Action + for _, action := range a { + actions = append(actions, workflow.Action{ + ID: action.GetId(), + Name: action.GetName(), + Image: action.GetImage(), + Cmd: action.GetCmd(), + Args: action.GetArgs(), + Env: action.GetEnv(), + Volumes: action.GetVolumes(), + NetworkNamespace: action.GetNetworkNamespace(), + }) + } + return actions +} + +func toGRPC(e event.Event) (*workflowproto.Event, error) { + switch v := e.(type) { + case event.ActionStarted: + return &workflowproto.Event{ + WorkflowId: v.WorkflowID, + Event: &workflowproto.Event_ActionStarted_{ + ActionStarted: &workflowproto.Event_ActionStarted{ + ActionId: v.ActionID, + }, + }, + }, nil + case event.ActionSucceeded: + return &workflowproto.Event{ + WorkflowId: v.WorkflowID, + Event: &workflowproto.Event_ActionSucceeded_{ + ActionSucceeded: &workflowproto.Event_ActionSucceeded{ + ActionId: v.ActionID, + }, + }, + }, nil + case event.ActionFailed: + return &workflowproto.Event{ + WorkflowId: v.WorkflowID, + Event: &workflowproto.Event_ActionFailed_{ + ActionFailed: &workflowproto.Event_ActionFailed{ + ActionId: v.ActionID, + FailureReason: &v.Reason, + FailureMessage: &v.Message, + }, + }, + }, nil + case event.WorkflowRejected: + return &workflowproto.Event{ + WorkflowId: v.ID, + Event: &workflowproto.Event_WorkflowRejected_{ + WorkflowRejected: &workflowproto.Event_WorkflowRejected{ + Message: v.Message, + }, + }, + }, nil + } + + return nil, fmt.Errorf("grpc: %w", event.IncompatibleError{ + Event: e, + }) +} + +type workflowIndex struct { + cancellers map[string]context.CancelFunc + mtx sync.Mutex +} + +func (c *workflowIndex) Insert(ctx context.Context, id string) (context.Context, error) { + c.mtx.Lock() + defer c.mtx.Unlock() + + if c.cancellers == nil { + c.cancellers = map[string]context.CancelFunc{} + } + + if _, ok := c.cancellers[id]; ok { + return nil, fmt.Errorf("workflow is already tracked (%v)", id) + } + + // Create a new cancellation function and add it to the c + ctx, cancel := context.WithCancel(ctx) + c.cancellers[id] = cancel + return ctx, nil +} + +func (c *workflowIndex) Cancel(id string) { + c.mtx.Lock() + defer c.mtx.Unlock() + + if c.cancellers == nil { + return + } + + if cancel, ok := c.cancellers[id]; ok { + cancel() + } + + delete(c.cancellers, id) +} diff --git a/internal/agent/transport/handler.go b/internal/agent/transport/handler.go new file mode 100644 index 000000000..c8da2a9e3 --- /dev/null +++ b/internal/agent/transport/handler.go @@ -0,0 +1,16 @@ +package transport + +import ( + "context" + + "github.com/tinkerbell/tink/internal/agent/event" + "github.com/tinkerbell/tink/internal/agent/workflow" +) + +// WorkflowHandler is responsible for handling workflow execution. +type WorkflowHandler interface { + // HandleWorkflow begins executing the given workflow. The event recorder can be used to + // indicate the progress of a workflow. If the given context becomes cancelled, the workflow + // handler should stop workflow execution. + HandleWorkflow(context.Context, workflow.Workflow, event.Recorder) error +} diff --git a/internal/proto/workflow/v2/workflow.pb.go b/internal/proto/workflow/v2/workflow.pb.go new file mode 100644 index 000000000..d9e5f578e --- /dev/null +++ b/internal/proto/workflow/v2/workflow.pb.go @@ -0,0 +1,1270 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: internal/proto/workflow/v2/workflow.proto + +package workflow + +import ( + reflect "reflect" + sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +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 StreamWorkflowsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` +} + +func (x *StreamWorkflowsRequest) Reset() { + *x = StreamWorkflowsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamWorkflowsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamWorkflowsRequest) ProtoMessage() {} + +func (x *StreamWorkflowsRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_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 StreamWorkflowsRequest.ProtoReflect.Descriptor instead. +func (*StreamWorkflowsRequest) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{0} +} + +func (x *StreamWorkflowsRequest) GetAgentId() string { + if x != nil { + return x.AgentId + } + return "" +} + +type StreamWorkflowsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Cmd: + // + // *StreamWorkflowsResponse_StartWorkflow_ + // *StreamWorkflowsResponse_StopWorkflow_ + Cmd isStreamWorkflowsResponse_Cmd `protobuf_oneof:"cmd"` +} + +func (x *StreamWorkflowsResponse) Reset() { + *x = StreamWorkflowsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamWorkflowsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamWorkflowsResponse) ProtoMessage() {} + +func (x *StreamWorkflowsResponse) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_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 StreamWorkflowsResponse.ProtoReflect.Descriptor instead. +func (*StreamWorkflowsResponse) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{1} +} + +func (m *StreamWorkflowsResponse) GetCmd() isStreamWorkflowsResponse_Cmd { + if m != nil { + return m.Cmd + } + return nil +} + +func (x *StreamWorkflowsResponse) GetStartWorkflow() *StreamWorkflowsResponse_StartWorkflow { + if x, ok := x.GetCmd().(*StreamWorkflowsResponse_StartWorkflow_); ok { + return x.StartWorkflow + } + return nil +} + +func (x *StreamWorkflowsResponse) GetStopWorkflow() *StreamWorkflowsResponse_StopWorkflow { + if x, ok := x.GetCmd().(*StreamWorkflowsResponse_StopWorkflow_); ok { + return x.StopWorkflow + } + return nil +} + +type isStreamWorkflowsResponse_Cmd interface { + isStreamWorkflowsResponse_Cmd() +} + +type StreamWorkflowsResponse_StartWorkflow_ struct { + StartWorkflow *StreamWorkflowsResponse_StartWorkflow `protobuf:"bytes,1,opt,name=start_workflow,json=startWorkflow,proto3,oneof"` +} + +type StreamWorkflowsResponse_StopWorkflow_ struct { + StopWorkflow *StreamWorkflowsResponse_StopWorkflow `protobuf:"bytes,2,opt,name=stop_workflow,json=stopWorkflow,proto3,oneof"` +} + +func (*StreamWorkflowsResponse_StartWorkflow_) isStreamWorkflowsResponse_Cmd() {} + +func (*StreamWorkflowsResponse_StopWorkflow_) isStreamWorkflowsResponse_Cmd() {} + +type PublishEventRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Event *Event `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"` +} + +func (x *PublishEventRequest) Reset() { + *x = PublishEventRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublishEventRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublishEventRequest) ProtoMessage() {} + +func (x *PublishEventRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[2] + 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 PublishEventRequest.ProtoReflect.Descriptor instead. +func (*PublishEventRequest) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{2} +} + +func (x *PublishEventRequest) GetEvent() *Event { + if x != nil { + return x.Event + } + return nil +} + +type PublishEventResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PublishEventResponse) Reset() { + *x = PublishEventResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublishEventResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublishEventResponse) ProtoMessage() {} + +func (x *PublishEventResponse) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[3] + 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 PublishEventResponse.ProtoReflect.Descriptor instead. +func (*PublishEventResponse) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{3} +} + +type Workflow struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A unique identifier for a workflow. + WorkflowId string `protobuf:"bytes,1,opt,name=workflow_id,json=workflowId,proto3" json:"workflow_id,omitempty"` + // The actions that make up the workflow. + Actions []*Workflow_Action `protobuf:"bytes,2,rep,name=actions,proto3" json:"actions,omitempty"` +} + +func (x *Workflow) Reset() { + *x = Workflow{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Workflow) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Workflow) ProtoMessage() {} + +func (x *Workflow) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[4] + 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 Workflow.ProtoReflect.Descriptor instead. +func (*Workflow) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{4} +} + +func (x *Workflow) GetWorkflowId() string { + if x != nil { + return x.WorkflowId + } + return "" +} + +func (x *Workflow) GetActions() []*Workflow_Action { + if x != nil { + return x.Actions + } + return nil +} + +type Event struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A unique identifier for a workflow. + WorkflowId string `protobuf:"bytes,1,opt,name=workflow_id,json=workflowId,proto3" json:"workflow_id,omitempty"` + // Additional data that compliments the event type. + // + // Types that are assignable to Event: + // + // *Event_ActionStarted_ + // *Event_ActionSucceeded_ + // *Event_ActionFailed_ + // *Event_WorkflowRejected_ + Event isEvent_Event `protobuf_oneof:"event"` +} + +func (x *Event) Reset() { + *x = Event{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Event) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event) ProtoMessage() {} + +func (x *Event) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[5] + 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 Event.ProtoReflect.Descriptor instead. +func (*Event) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{5} +} + +func (x *Event) GetWorkflowId() string { + if x != nil { + return x.WorkflowId + } + return "" +} + +func (m *Event) GetEvent() isEvent_Event { + if m != nil { + return m.Event + } + return nil +} + +func (x *Event) GetActionStarted() *Event_ActionStarted { + if x, ok := x.GetEvent().(*Event_ActionStarted_); ok { + return x.ActionStarted + } + return nil +} + +func (x *Event) GetActionSucceeded() *Event_ActionSucceeded { + if x, ok := x.GetEvent().(*Event_ActionSucceeded_); ok { + return x.ActionSucceeded + } + return nil +} + +func (x *Event) GetActionFailed() *Event_ActionFailed { + if x, ok := x.GetEvent().(*Event_ActionFailed_); ok { + return x.ActionFailed + } + return nil +} + +func (x *Event) GetWorkflowRejected() *Event_WorkflowRejected { + if x, ok := x.GetEvent().(*Event_WorkflowRejected_); ok { + return x.WorkflowRejected + } + return nil +} + +type isEvent_Event interface { + isEvent_Event() +} + +type Event_ActionStarted_ struct { + ActionStarted *Event_ActionStarted `protobuf:"bytes,2,opt,name=action_started,json=actionStarted,proto3,oneof"` +} + +type Event_ActionSucceeded_ struct { + ActionSucceeded *Event_ActionSucceeded `protobuf:"bytes,3,opt,name=action_succeeded,json=actionSucceeded,proto3,oneof"` +} + +type Event_ActionFailed_ struct { + ActionFailed *Event_ActionFailed `protobuf:"bytes,4,opt,name=action_failed,json=actionFailed,proto3,oneof"` +} + +type Event_WorkflowRejected_ struct { + WorkflowRejected *Event_WorkflowRejected `protobuf:"bytes,5,opt,name=workflow_rejected,json=workflowRejected,proto3,oneof"` +} + +func (*Event_ActionStarted_) isEvent_Event() {} + +func (*Event_ActionSucceeded_) isEvent_Event() {} + +func (*Event_ActionFailed_) isEvent_Event() {} + +func (*Event_WorkflowRejected_) isEvent_Event() {} + +type PublishResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PublishResponse) Reset() { + *x = PublishResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublishResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublishResponse) ProtoMessage() {} + +func (x *PublishResponse) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[6] + 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 PublishResponse.ProtoReflect.Descriptor instead. +func (*PublishResponse) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{6} +} + +type StreamWorkflowsResponse_StartWorkflow struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Workflow *Workflow `protobuf:"bytes,1,opt,name=workflow,proto3" json:"workflow,omitempty"` +} + +func (x *StreamWorkflowsResponse_StartWorkflow) Reset() { + *x = StreamWorkflowsResponse_StartWorkflow{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamWorkflowsResponse_StartWorkflow) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamWorkflowsResponse_StartWorkflow) ProtoMessage() {} + +func (x *StreamWorkflowsResponse_StartWorkflow) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[7] + 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 StreamWorkflowsResponse_StartWorkflow.ProtoReflect.Descriptor instead. +func (*StreamWorkflowsResponse_StartWorkflow) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *StreamWorkflowsResponse_StartWorkflow) GetWorkflow() *Workflow { + if x != nil { + return x.Workflow + } + return nil +} + +type StreamWorkflowsResponse_StopWorkflow struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WorkflowId string `protobuf:"bytes,1,opt,name=workflow_id,json=workflowId,proto3" json:"workflow_id,omitempty"` +} + +func (x *StreamWorkflowsResponse_StopWorkflow) Reset() { + *x = StreamWorkflowsResponse_StopWorkflow{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamWorkflowsResponse_StopWorkflow) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamWorkflowsResponse_StopWorkflow) ProtoMessage() {} + +func (x *StreamWorkflowsResponse_StopWorkflow) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[8] + 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 StreamWorkflowsResponse_StopWorkflow.ProtoReflect.Descriptor instead. +func (*StreamWorkflowsResponse_StopWorkflow) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{1, 1} +} + +func (x *StreamWorkflowsResponse_StopWorkflow) GetWorkflowId() string { + if x != nil { + return x.WorkflowId + } + return "" +} + +type Workflow_Action struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A unique identifier for an action in the context of a workflow. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The name of the action. This can be used to identify actions in logging. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The image to run. + Image string `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"` + // The command to execute when launching the image. When using Docker as the action runtime + // it is used as the entrypoint. + Cmd *string `protobuf:"bytes,4,opt,name=cmd,proto3,oneof" json:"cmd,omitempty"` + // Arguments to pass to the container. + Args []string `protobuf:"bytes,5,rep,name=args,proto3" json:"args,omitempty"` + // Environment variables to configure when launching the container. + Env map[string]string `protobuf:"bytes,6,rep,name=env,proto3" json:"env,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Volumes to mount when launching the container. + Volumes []string `protobuf:"bytes,7,rep,name=volumes,proto3" json:"volumes,omitempty"` + // The network namespace to launch the container in. + NetworkNamespace *string `protobuf:"bytes,8,opt,name=network_namespace,json=networkNamespace,proto3,oneof" json:"network_namespace,omitempty"` +} + +func (x *Workflow_Action) Reset() { + *x = Workflow_Action{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Workflow_Action) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Workflow_Action) ProtoMessage() {} + +func (x *Workflow_Action) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[9] + 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 Workflow_Action.ProtoReflect.Descriptor instead. +func (*Workflow_Action) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{4, 0} +} + +func (x *Workflow_Action) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Workflow_Action) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Workflow_Action) GetImage() string { + if x != nil { + return x.Image + } + return "" +} + +func (x *Workflow_Action) GetCmd() string { + if x != nil && x.Cmd != nil { + return *x.Cmd + } + return "" +} + +func (x *Workflow_Action) GetArgs() []string { + if x != nil { + return x.Args + } + return nil +} + +func (x *Workflow_Action) GetEnv() map[string]string { + if x != nil { + return x.Env + } + return nil +} + +func (x *Workflow_Action) GetVolumes() []string { + if x != nil { + return x.Volumes + } + return nil +} + +func (x *Workflow_Action) GetNetworkNamespace() string { + if x != nil && x.NetworkNamespace != nil { + return *x.NetworkNamespace + } + return "" +} + +type Event_ActionStarted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A unique identifier for an action in the context of a workflow. + ActionId string `protobuf:"bytes,1,opt,name=action_id,json=actionId,proto3" json:"action_id,omitempty"` +} + +func (x *Event_ActionStarted) Reset() { + *x = Event_ActionStarted{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Event_ActionStarted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event_ActionStarted) ProtoMessage() {} + +func (x *Event_ActionStarted) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[11] + 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 Event_ActionStarted.ProtoReflect.Descriptor instead. +func (*Event_ActionStarted) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *Event_ActionStarted) GetActionId() string { + if x != nil { + return x.ActionId + } + return "" +} + +type Event_ActionSucceeded struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A unique identifier for an action in the context of a workflow. + ActionId string `protobuf:"bytes,1,opt,name=action_id,json=actionId,proto3" json:"action_id,omitempty"` +} + +func (x *Event_ActionSucceeded) Reset() { + *x = Event_ActionSucceeded{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Event_ActionSucceeded) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event_ActionSucceeded) ProtoMessage() {} + +func (x *Event_ActionSucceeded) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[12] + 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 Event_ActionSucceeded.ProtoReflect.Descriptor instead. +func (*Event_ActionSucceeded) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{5, 1} +} + +func (x *Event_ActionSucceeded) GetActionId() string { + if x != nil { + return x.ActionId + } + return "" +} + +type Event_ActionFailed struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A unique identifier for an action in the context of a workflow. + ActionId string `protobuf:"bytes,1,opt,name=action_id,json=actionId,proto3" json:"action_id,omitempty"` + // A UpperCamelCase word or phrase concisly describing why an action failed. It is typically + // provided by the action itself. + FailureReason *string `protobuf:"bytes,2,opt,name=failure_reason,json=failureReason,proto3,oneof" json:"failure_reason,omitempty"` + // A free-form human readable string elaborating on the reason for failure. It is typically + // provided by the action itself. + FailureMessage *string `protobuf:"bytes,3,opt,name=failure_message,json=failureMessage,proto3,oneof" json:"failure_message,omitempty"` +} + +func (x *Event_ActionFailed) Reset() { + *x = Event_ActionFailed{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Event_ActionFailed) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event_ActionFailed) ProtoMessage() {} + +func (x *Event_ActionFailed) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[13] + 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 Event_ActionFailed.ProtoReflect.Descriptor instead. +func (*Event_ActionFailed) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{5, 2} +} + +func (x *Event_ActionFailed) GetActionId() string { + if x != nil { + return x.ActionId + } + return "" +} + +func (x *Event_ActionFailed) GetFailureReason() string { + if x != nil && x.FailureReason != nil { + return *x.FailureReason + } + return "" +} + +func (x *Event_ActionFailed) GetFailureMessage() string { + if x != nil && x.FailureMessage != nil { + return *x.FailureMessage + } + return "" +} + +type Event_WorkflowRejected struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A message describing why the workflow was rejected. + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *Event_WorkflowRejected) Reset() { + *x = Event_WorkflowRejected{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Event_WorkflowRejected) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event_WorkflowRejected) ProtoMessage() {} + +func (x *Event_WorkflowRejected) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_workflow_v2_workflow_proto_msgTypes[14] + 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 Event_WorkflowRejected.ProtoReflect.Descriptor instead. +func (*Event_WorkflowRejected) Descriptor() ([]byte, []int) { + return file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP(), []int{5, 3} +} + +func (x *Event_WorkflowRejected) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +var File_internal_proto_workflow_v2_workflow_proto protoreflect.FileDescriptor + +var file_internal_proto_workflow_v2_workflow_proto_rawDesc = []byte{ + 0x0a, 0x29, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x76, 0x32, 0x2f, 0x77, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, + 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x22, 0x33, 0x0a, 0x16, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0xf9, 0x02, 0x0a, + 0x17, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x41, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x57, 0x6f, 0x72, 0x6b, + 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x67, 0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x70, 0x5f, 0x77, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x77, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x57, + 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x48, 0x00, 0x52, + 0x0c, 0x73, 0x74, 0x6f, 0x70, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x1a, 0x51, 0x0a, + 0x0d, 0x53, 0x74, 0x61, 0x72, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x40, + 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x57, 0x6f, + 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x1a, 0x2f, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x70, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, + 0x64, 0x42, 0x05, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x22, 0x4e, 0x0a, 0x13, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x73, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x37, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x16, 0x0a, 0x14, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x73, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xcc, 0x03, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1f, 0x0a, + 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x45, + 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2b, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x57, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0xd7, 0x02, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x15, 0x0a, 0x03, 0x63, 0x6d, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x88, 0x01, + 0x01, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x46, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, + 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x45, 0x6e, 0x76, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x65, 0x6e, 0x76, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, + 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x11, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x01, 0x52, 0x10, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x4e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x88, 0x01, 0x01, 0x1a, 0x36, 0x0a, 0x08, 0x45, 0x6e, 0x76, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x63, 0x6d, 0x64, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, + 0xe0, 0x05, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x58, 0x0a, 0x0e, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x72, + 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x65, 0x64, 0x12, 0x5e, 0x0a, 0x10, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, + 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, + 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, + 0x64, 0x48, 0x00, 0x52, 0x0f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x75, 0x63, 0x63, 0x65, + 0x65, 0x64, 0x65, 0x64, 0x12, 0x55, 0x0a, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, + 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x77, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0c, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x61, 0x0a, 0x11, 0x77, + 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, + 0x6f, 0x77, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x10, 0x77, 0x6f, + 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x1a, 0x2c, + 0x0a, 0x0d, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, + 0x1b, 0x0a, 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x1a, 0x2e, 0x0a, 0x0f, + 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x12, + 0x1b, 0x0a, 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x1a, 0xac, 0x01, 0x0a, + 0x0c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x0e, 0x66, 0x61, + 0x69, 0x6c, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, + 0x73, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x0f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, + 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x01, 0x52, 0x0e, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x88, 0x01, 0x01, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, + 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x66, 0x61, 0x69, 0x6c, + 0x75, 0x72, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x2c, 0x0a, 0x10, 0x57, + 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, + 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x22, 0x11, 0x0a, 0x0f, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x86, 0x02, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, + 0x6f, 0x77, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7e, 0x0a, 0x0f, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x12, 0x32, 0x2e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x77, 0x6f, + 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x33, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x73, 0x0a, 0x0c, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x73, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x2e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, + 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x40, + 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x69, 0x6e, + 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2f, 0x74, 0x69, 0x6e, 0x6b, 0x2f, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x77, 0x6f, 0x72, 0x6b, + 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x76, 0x32, 0x3b, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_internal_proto_workflow_v2_workflow_proto_rawDescOnce sync.Once + file_internal_proto_workflow_v2_workflow_proto_rawDescData = file_internal_proto_workflow_v2_workflow_proto_rawDesc +) + +func file_internal_proto_workflow_v2_workflow_proto_rawDescGZIP() []byte { + file_internal_proto_workflow_v2_workflow_proto_rawDescOnce.Do(func() { + file_internal_proto_workflow_v2_workflow_proto_rawDescData = protoimpl.X.CompressGZIP(file_internal_proto_workflow_v2_workflow_proto_rawDescData) + }) + return file_internal_proto_workflow_v2_workflow_proto_rawDescData +} + +var ( + file_internal_proto_workflow_v2_workflow_proto_msgTypes = make([]protoimpl.MessageInfo, 15) + file_internal_proto_workflow_v2_workflow_proto_goTypes = []interface{}{ + (*StreamWorkflowsRequest)(nil), // 0: internal.proto.workflow.v2.StreamWorkflowsRequest + (*StreamWorkflowsResponse)(nil), // 1: internal.proto.workflow.v2.StreamWorkflowsResponse + (*PublishEventRequest)(nil), // 2: internal.proto.workflow.v2.PublishEventRequest + (*PublishEventResponse)(nil), // 3: internal.proto.workflow.v2.PublishEventResponse + (*Workflow)(nil), // 4: internal.proto.workflow.v2.Workflow + (*Event)(nil), // 5: internal.proto.workflow.v2.Event + (*PublishResponse)(nil), // 6: internal.proto.workflow.v2.PublishResponse + (*StreamWorkflowsResponse_StartWorkflow)(nil), // 7: internal.proto.workflow.v2.StreamWorkflowsResponse.StartWorkflow + (*StreamWorkflowsResponse_StopWorkflow)(nil), // 8: internal.proto.workflow.v2.StreamWorkflowsResponse.StopWorkflow + (*Workflow_Action)(nil), // 9: internal.proto.workflow.v2.Workflow.Action + nil, // 10: internal.proto.workflow.v2.Workflow.Action.EnvEntry + (*Event_ActionStarted)(nil), // 11: internal.proto.workflow.v2.Event.ActionStarted + (*Event_ActionSucceeded)(nil), // 12: internal.proto.workflow.v2.Event.ActionSucceeded + (*Event_ActionFailed)(nil), // 13: internal.proto.workflow.v2.Event.ActionFailed + (*Event_WorkflowRejected)(nil), // 14: internal.proto.workflow.v2.Event.WorkflowRejected + } +) +var file_internal_proto_workflow_v2_workflow_proto_depIdxs = []int32{ + 7, // 0: internal.proto.workflow.v2.StreamWorkflowsResponse.start_workflow:type_name -> internal.proto.workflow.v2.StreamWorkflowsResponse.StartWorkflow + 8, // 1: internal.proto.workflow.v2.StreamWorkflowsResponse.stop_workflow:type_name -> internal.proto.workflow.v2.StreamWorkflowsResponse.StopWorkflow + 5, // 2: internal.proto.workflow.v2.PublishEventRequest.event:type_name -> internal.proto.workflow.v2.Event + 9, // 3: internal.proto.workflow.v2.Workflow.actions:type_name -> internal.proto.workflow.v2.Workflow.Action + 11, // 4: internal.proto.workflow.v2.Event.action_started:type_name -> internal.proto.workflow.v2.Event.ActionStarted + 12, // 5: internal.proto.workflow.v2.Event.action_succeeded:type_name -> internal.proto.workflow.v2.Event.ActionSucceeded + 13, // 6: internal.proto.workflow.v2.Event.action_failed:type_name -> internal.proto.workflow.v2.Event.ActionFailed + 14, // 7: internal.proto.workflow.v2.Event.workflow_rejected:type_name -> internal.proto.workflow.v2.Event.WorkflowRejected + 4, // 8: internal.proto.workflow.v2.StreamWorkflowsResponse.StartWorkflow.workflow:type_name -> internal.proto.workflow.v2.Workflow + 10, // 9: internal.proto.workflow.v2.Workflow.Action.env:type_name -> internal.proto.workflow.v2.Workflow.Action.EnvEntry + 0, // 10: internal.proto.workflow.v2.WorkflowService.StreamWorkflows:input_type -> internal.proto.workflow.v2.StreamWorkflowsRequest + 2, // 11: internal.proto.workflow.v2.WorkflowService.PublishEvent:input_type -> internal.proto.workflow.v2.PublishEventRequest + 1, // 12: internal.proto.workflow.v2.WorkflowService.StreamWorkflows:output_type -> internal.proto.workflow.v2.StreamWorkflowsResponse + 3, // 13: internal.proto.workflow.v2.WorkflowService.PublishEvent:output_type -> internal.proto.workflow.v2.PublishEventResponse + 12, // [12:14] is the sub-list for method output_type + 10, // [10:12] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_internal_proto_workflow_v2_workflow_proto_init() } +func file_internal_proto_workflow_v2_workflow_proto_init() { + if File_internal_proto_workflow_v2_workflow_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_internal_proto_workflow_v2_workflow_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamWorkflowsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamWorkflowsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PublishEventRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PublishEventResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Workflow); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Event); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PublishResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamWorkflowsResponse_StartWorkflow); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamWorkflowsResponse_StopWorkflow); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Workflow_Action); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Event_ActionStarted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Event_ActionSucceeded); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Event_ActionFailed); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Event_WorkflowRejected); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*StreamWorkflowsResponse_StartWorkflow_)(nil), + (*StreamWorkflowsResponse_StopWorkflow_)(nil), + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[5].OneofWrappers = []interface{}{ + (*Event_ActionStarted_)(nil), + (*Event_ActionSucceeded_)(nil), + (*Event_ActionFailed_)(nil), + (*Event_WorkflowRejected_)(nil), + } + file_internal_proto_workflow_v2_workflow_proto_msgTypes[9].OneofWrappers = []interface{}{} + file_internal_proto_workflow_v2_workflow_proto_msgTypes[13].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_internal_proto_workflow_v2_workflow_proto_rawDesc, + NumEnums: 0, + NumMessages: 15, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_internal_proto_workflow_v2_workflow_proto_goTypes, + DependencyIndexes: file_internal_proto_workflow_v2_workflow_proto_depIdxs, + MessageInfos: file_internal_proto_workflow_v2_workflow_proto_msgTypes, + }.Build() + File_internal_proto_workflow_v2_workflow_proto = out.File + file_internal_proto_workflow_v2_workflow_proto_rawDesc = nil + file_internal_proto_workflow_v2_workflow_proto_goTypes = nil + file_internal_proto_workflow_v2_workflow_proto_depIdxs = nil +} diff --git a/internal/proto/workflow/v2/workflow.proto b/internal/proto/workflow/v2/workflow.proto new file mode 100644 index 000000000..84c67d4c1 --- /dev/null +++ b/internal/proto/workflow/v2/workflow.proto @@ -0,0 +1,118 @@ +syntax = "proto3"; + +package internal.proto.workflow.v2; + +option go_package = "github.com/tinkerbell/tink/internal/proto/workflow/v2;workflow"; + +service WorkflowService { + // Stream creates a stream that will receive workflows intended for the agent identified + // by the StreamWorkflowsRequest.agent_id. + rpc StreamWorkflows(StreamWorkflowsRequest) returns (stream StreamWorkflowsResponse) {} + + // PublishEvent publishes a workflow event. + rpc PublishEvent(PublishEventRequest) returns (PublishEventResponse) {} +} + +message StreamWorkflowsRequest { + string agent_id = 1; +} + +message StreamWorkflowsResponse { + oneof cmd { + StartWorkflow start_workflow = 1; + StopWorkflow stop_workflow = 2; + } + + message StartWorkflow { + Workflow workflow = 1; + } + + message StopWorkflow { + string workflow_id = 1; + } +} + +message PublishEventRequest { + Event event = 1; +} + +message PublishEventResponse {} + +message Workflow { + // A unique identifier for a workflow. + string workflow_id = 1; + + // The actions that make up the workflow. + repeated Action actions = 2; + + message Action { + // A unique identifier for an action in the context of a workflow. + string id = 1; + + // The name of the action. This can be used to identify actions in logging. + string name = 2; + + // The image to run. + string image = 3; + + // The command to execute when launching the image. When using Docker as the action runtime + // it is used as the entrypoint. + optional string cmd = 4; + + // Arguments to pass to the container. + repeated string args = 5; + + // Environment variables to configure when launching the container. + map env = 6; + + // Volumes to mount when launching the container. + repeated string volumes = 7; + + // The network namespace to launch the container in. + optional string network_namespace = 8; + } +} + +message Event { + // A unique identifier for a workflow. + string workflow_id = 1; + + // Additional data that compliments the event type. + oneof event { + ActionStarted action_started = 2; + ActionSucceeded action_succeeded = 3; + ActionFailed action_failed = 4; + WorkflowRejected workflow_rejected = 5; + } + + message ActionStarted { + // A unique identifier for an action in the context of a workflow. + string action_id = 1; + } + + message ActionSucceeded { + // A unique identifier for an action in the context of a workflow. + string action_id = 1; + } + + message ActionFailed { + // A unique identifier for an action in the context of a workflow. + string action_id = 1; + + // A UpperCamelCase word or phrase concisly describing why an action failed. It is typically + // provided by the action itself. + optional string failure_reason = 2; + + // A free-form human readable string elaborating on the reason for failure. It is typically + // provided by the action itself. + optional string failure_message = 3; + + } + + message WorkflowRejected { + // A message describing why the workflow was rejected. + string message = 2; + } +} + +message PublishResponse {} \ No newline at end of file diff --git a/internal/proto/workflow/v2/workflow_grpc.pb.go b/internal/proto/workflow/v2/workflow_grpc.pb.go new file mode 100644 index 000000000..dee9c80e4 --- /dev/null +++ b/internal/proto/workflow/v2/workflow_grpc.pb.go @@ -0,0 +1,174 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc (unknown) +// source: internal/proto/workflow/v2/workflow.proto + +package workflow + +import ( + context "context" + + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// WorkflowServiceClient is the client API for WorkflowService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type WorkflowServiceClient interface { + // Stream creates a stream that will receive workflows intended for the agent identified + // by the StreamWorkflowsRequest.agent_id. + StreamWorkflows(ctx context.Context, in *StreamWorkflowsRequest, opts ...grpc.CallOption) (WorkflowService_StreamWorkflowsClient, error) + // PublishEvent publishes a workflow event. + PublishEvent(ctx context.Context, in *PublishEventRequest, opts ...grpc.CallOption) (*PublishEventResponse, error) +} + +type workflowServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewWorkflowServiceClient(cc grpc.ClientConnInterface) WorkflowServiceClient { + return &workflowServiceClient{cc} +} + +func (c *workflowServiceClient) StreamWorkflows(ctx context.Context, in *StreamWorkflowsRequest, opts ...grpc.CallOption) (WorkflowService_StreamWorkflowsClient, error) { + stream, err := c.cc.NewStream(ctx, &WorkflowService_ServiceDesc.Streams[0], "/internal.proto.workflow.v2.WorkflowService/StreamWorkflows", opts...) + if err != nil { + return nil, err + } + x := &workflowServiceStreamWorkflowsClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type WorkflowService_StreamWorkflowsClient interface { + Recv() (*StreamWorkflowsResponse, error) + grpc.ClientStream +} + +type workflowServiceStreamWorkflowsClient struct { + grpc.ClientStream +} + +func (x *workflowServiceStreamWorkflowsClient) Recv() (*StreamWorkflowsResponse, error) { + m := new(StreamWorkflowsResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *workflowServiceClient) PublishEvent(ctx context.Context, in *PublishEventRequest, opts ...grpc.CallOption) (*PublishEventResponse, error) { + out := new(PublishEventResponse) + err := c.cc.Invoke(ctx, "/internal.proto.workflow.v2.WorkflowService/PublishEvent", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WorkflowServiceServer is the server API for WorkflowService service. +// All implementations should embed UnimplementedWorkflowServiceServer +// for forward compatibility +type WorkflowServiceServer interface { + // Stream creates a stream that will receive workflows intended for the agent identified + // by the StreamWorkflowsRequest.agent_id. + StreamWorkflows(*StreamWorkflowsRequest, WorkflowService_StreamWorkflowsServer) error + // PublishEvent publishes a workflow event. + PublishEvent(context.Context, *PublishEventRequest) (*PublishEventResponse, error) +} + +// UnimplementedWorkflowServiceServer should be embedded to have forward compatible implementations. +type UnimplementedWorkflowServiceServer struct{} + +func (UnimplementedWorkflowServiceServer) StreamWorkflows(*StreamWorkflowsRequest, WorkflowService_StreamWorkflowsServer) error { + return status.Errorf(codes.Unimplemented, "method StreamWorkflows not implemented") +} + +func (UnimplementedWorkflowServiceServer) PublishEvent(context.Context, *PublishEventRequest) (*PublishEventResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PublishEvent not implemented") +} + +// UnsafeWorkflowServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WorkflowServiceServer will +// result in compilation errors. +type UnsafeWorkflowServiceServer interface { + mustEmbedUnimplementedWorkflowServiceServer() +} + +func RegisterWorkflowServiceServer(s grpc.ServiceRegistrar, srv WorkflowServiceServer) { + s.RegisterService(&WorkflowService_ServiceDesc, srv) +} + +func _WorkflowService_StreamWorkflows_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(StreamWorkflowsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WorkflowServiceServer).StreamWorkflows(m, &workflowServiceStreamWorkflowsServer{stream}) +} + +type WorkflowService_StreamWorkflowsServer interface { + Send(*StreamWorkflowsResponse) error + grpc.ServerStream +} + +type workflowServiceStreamWorkflowsServer struct { + grpc.ServerStream +} + +func (x *workflowServiceStreamWorkflowsServer) Send(m *StreamWorkflowsResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _WorkflowService_PublishEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PublishEventRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WorkflowServiceServer).PublishEvent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/internal.proto.workflow.v2.WorkflowService/PublishEvent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WorkflowServiceServer).PublishEvent(ctx, req.(*PublishEventRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// WorkflowService_ServiceDesc is the grpc.ServiceDesc for WorkflowService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var WorkflowService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "internal.proto.workflow.v2.WorkflowService", + HandlerType: (*WorkflowServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "PublishEvent", + Handler: _WorkflowService_PublishEvent_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamWorkflows", + Handler: _WorkflowService_StreamWorkflows_Handler, + ServerStreams: true, + }, + }, + Metadata: "internal/proto/workflow/v2/workflow.proto", +}