mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-25 22:40:22 +08:00
Adding Create endpoint for Cron Workflow.
- Re-using the WorkflowExecution message, since Cron Workflow will use that information to figure out the Workflow to execute.
This commit is contained in:
288
api/cron_workflow.pb.go
Normal file
288
api/cron_workflow.pb.go
Normal file
@@ -0,0 +1,288 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: cron_workflow.proto
|
||||||
|
|
||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
fmt "fmt"
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
_ "github.com/golang/protobuf/ptypes/empty"
|
||||||
|
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
math "math"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
|
type CreateWorkflowRequest struct {
|
||||||
|
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
|
||||||
|
CronWorkflow *CronWorkflow `protobuf:"bytes,2,opt,name=cronWorkflow,proto3" json:"cronWorkflow,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CreateWorkflowRequest) Reset() { *m = CreateWorkflowRequest{} }
|
||||||
|
func (m *CreateWorkflowRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CreateWorkflowRequest) ProtoMessage() {}
|
||||||
|
func (*CreateWorkflowRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_989cccaad551a50c, []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CreateWorkflowRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CreateWorkflowRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CreateWorkflowRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CreateWorkflowRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *CreateWorkflowRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CreateWorkflowRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *CreateWorkflowRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CreateWorkflowRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CreateWorkflowRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CreateWorkflowRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CreateWorkflowRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CreateWorkflowRequest) GetNamespace() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Namespace
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CreateWorkflowRequest) GetCronWorkflow() *CronWorkflow {
|
||||||
|
if m != nil {
|
||||||
|
return m.CronWorkflow
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type CronWorkflow struct {
|
||||||
|
Schedule string `protobuf:"bytes,1,opt,name=schedule,proto3" json:"schedule,omitempty"`
|
||||||
|
Timezone string `protobuf:"bytes,2,opt,name=timezone,proto3" json:"timezone,omitempty"`
|
||||||
|
Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty"`
|
||||||
|
ConcurrencyPolicy string `protobuf:"bytes,4,opt,name=concurrencyPolicy,proto3" json:"concurrencyPolicy,omitempty"`
|
||||||
|
StartingDeadlineSeconds string `protobuf:"bytes,5,opt,name=startingDeadlineSeconds,proto3" json:"startingDeadlineSeconds,omitempty"`
|
||||||
|
SuccessfulJobsHistoryLimit string `protobuf:"bytes,6,opt,name=successfulJobsHistoryLimit,proto3" json:"successfulJobsHistoryLimit,omitempty"`
|
||||||
|
FailedJobsHistoryLimit string `protobuf:"bytes,7,opt,name=failedJobsHistoryLimit,proto3" json:"failedJobsHistoryLimit,omitempty"`
|
||||||
|
WorkflowExecution *WorkflowExecution `protobuf:"bytes,8,opt,name=workflowExecution,proto3" json:"workflowExecution,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CronWorkflow) Reset() { *m = CronWorkflow{} }
|
||||||
|
func (m *CronWorkflow) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CronWorkflow) ProtoMessage() {}
|
||||||
|
func (*CronWorkflow) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_989cccaad551a50c, []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CronWorkflow) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CronWorkflow.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CronWorkflow) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CronWorkflow.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *CronWorkflow) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CronWorkflow.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *CronWorkflow) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CronWorkflow.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CronWorkflow) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CronWorkflow.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CronWorkflow proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CronWorkflow) GetSchedule() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Schedule
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CronWorkflow) GetTimezone() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Timezone
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CronWorkflow) GetSuspend() bool {
|
||||||
|
if m != nil {
|
||||||
|
return m.Suspend
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CronWorkflow) GetConcurrencyPolicy() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ConcurrencyPolicy
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CronWorkflow) GetStartingDeadlineSeconds() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.StartingDeadlineSeconds
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CronWorkflow) GetSuccessfulJobsHistoryLimit() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.SuccessfulJobsHistoryLimit
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CronWorkflow) GetFailedJobsHistoryLimit() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.FailedJobsHistoryLimit
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CronWorkflow) GetWorkflowExecution() *WorkflowExecution {
|
||||||
|
if m != nil {
|
||||||
|
return m.WorkflowExecution
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*CreateWorkflowRequest)(nil), "api.CreateWorkflowRequest")
|
||||||
|
proto.RegisterType((*CronWorkflow)(nil), "api.CronWorkflow")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("cron_workflow.proto", fileDescriptor_989cccaad551a50c) }
|
||||||
|
|
||||||
|
var fileDescriptor_989cccaad551a50c = []byte{
|
||||||
|
// 433 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0x4f, 0x6f, 0xd3, 0x30,
|
||||||
|
0x18, 0xc6, 0x95, 0x15, 0xb6, 0xd6, 0x54, 0x48, 0xf5, 0xc4, 0x66, 0x85, 0x1d, 0xaa, 0x5e, 0xe8,
|
||||||
|
0x01, 0x35, 0xda, 0x10, 0x7f, 0x84, 0x04, 0x97, 0x0d, 0x09, 0x21, 0x0e, 0x28, 0x3b, 0xec, 0x38,
|
||||||
|
0x39, 0xce, 0x9b, 0x62, 0xe1, 0xd8, 0xc6, 0x7f, 0x36, 0x02, 0xe2, 0xb2, 0x03, 0x5f, 0x80, 0x1b,
|
||||||
|
0x5f, 0x8b, 0xaf, 0xc0, 0x07, 0x41, 0x71, 0x93, 0xd2, 0x10, 0xca, 0xf1, 0xc9, 0xef, 0x7d, 0x6c,
|
||||||
|
0xe5, 0x7d, 0x1e, 0xa3, 0x7d, 0x66, 0x94, 0xbc, 0xbc, 0x56, 0xe6, 0x43, 0x21, 0xd4, 0xf5, 0x42,
|
||||||
|
0x1b, 0xe5, 0x14, 0x1e, 0x50, 0xcd, 0xe3, 0xa3, 0xa5, 0x52, 0x4b, 0x01, 0x09, 0xd5, 0x3c, 0xa1,
|
||||||
|
0x52, 0x2a, 0x47, 0x1d, 0x57, 0xd2, 0xae, 0x46, 0xe2, 0xfb, 0x0d, 0x0d, 0x2a, 0xf3, 0x45, 0x02,
|
||||||
|
0xa5, 0x76, 0x55, 0x03, 0x0f, 0xdb, 0xf3, 0x2e, 0x1d, 0x94, 0x5a, 0x50, 0x07, 0x0d, 0xb8, 0xdb,
|
||||||
|
0xbd, 0x28, 0x1e, 0x97, 0xe0, 0x0c, 0x67, 0x2b, 0x35, 0x13, 0xe8, 0xde, 0xa9, 0x01, 0xea, 0xe0,
|
||||||
|
0xa2, 0x99, 0x4a, 0xe1, 0xa3, 0x07, 0xeb, 0xf0, 0x11, 0x1a, 0x49, 0x5a, 0x82, 0xd5, 0x94, 0x01,
|
||||||
|
0x89, 0xa6, 0xd1, 0x7c, 0x94, 0xfe, 0xf9, 0x80, 0x1f, 0xa3, 0x71, 0xfd, 0x13, 0xad, 0x89, 0xec,
|
||||||
|
0x4c, 0xa3, 0xf9, 0x9d, 0x93, 0xc9, 0x82, 0x6a, 0xbe, 0x38, 0xdd, 0x00, 0x69, 0x67, 0x6c, 0xf6,
|
||||||
|
0x6d, 0x80, 0xc6, 0x9b, 0x18, 0xc7, 0x68, 0x68, 0xd9, 0x7b, 0xc8, 0xbd, 0x68, 0x2f, 0x59, 0xeb,
|
||||||
|
0x9a, 0x39, 0x5e, 0xc2, 0x67, 0x25, 0x21, 0x9c, 0x3f, 0x4a, 0xd7, 0x1a, 0x13, 0xb4, 0x67, 0xbd,
|
||||||
|
0xd5, 0x20, 0x73, 0x32, 0x98, 0x46, 0xf3, 0x61, 0xda, 0x4a, 0xfc, 0x10, 0x4d, 0x98, 0x92, 0xcc,
|
||||||
|
0x1b, 0x03, 0x92, 0x55, 0xef, 0x94, 0xe0, 0xac, 0x22, 0xb7, 0x82, 0xbd, 0x0f, 0xf0, 0x33, 0x74,
|
||||||
|
0x68, 0x1d, 0x35, 0x8e, 0xcb, 0xe5, 0x19, 0xd0, 0x5c, 0x70, 0x09, 0xe7, 0xc0, 0x94, 0xcc, 0x2d,
|
||||||
|
0xb9, 0x1d, 0x3c, 0xdb, 0x30, 0x7e, 0x89, 0x62, 0xeb, 0x19, 0x03, 0x6b, 0x0b, 0x2f, 0xde, 0xa8,
|
||||||
|
0xcc, 0xbe, 0xe6, 0xd6, 0x29, 0x53, 0xbd, 0xe5, 0x25, 0x77, 0x64, 0x37, 0x98, 0xff, 0x33, 0x81,
|
||||||
|
0x9f, 0xa0, 0x83, 0x82, 0x72, 0x01, 0x79, 0xcf, 0xbb, 0x17, 0xbc, 0x5b, 0x28, 0x3e, 0x43, 0x93,
|
||||||
|
0x36, 0xd0, 0x57, 0x9f, 0x80, 0xf9, 0xba, 0x20, 0x64, 0x18, 0xd6, 0x7f, 0x10, 0xd6, 0x7f, 0xf1,
|
||||||
|
0x37, 0x4d, 0xfb, 0x86, 0x93, 0x1f, 0x11, 0xda, 0xdf, 0x0c, 0xe2, 0x1c, 0xcc, 0x15, 0x67, 0x80,
|
||||||
|
0x6f, 0x22, 0x84, 0x57, 0x7d, 0xe8, 0xc6, 0xd4, 0x04, 0xfb, 0x8f, 0xa2, 0xc4, 0xfd, 0xd0, 0x67,
|
||||||
|
0x2f, 0x6e, 0x7e, 0xfe, 0xfa, 0xbe, 0xf3, 0x74, 0xf6, 0xa0, 0x2e, 0xb2, 0x4d, 0xae, 0x8e, 0x33,
|
||||||
|
0x70, 0xf4, 0x38, 0xf9, 0xb2, 0xee, 0xcf, 0xd7, 0xa4, 0xf3, 0x04, 0x9e, 0x77, 0x5a, 0x92, 0xed,
|
||||||
|
0x86, 0x6a, 0x3e, 0xfa, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x11, 0xff, 0xbe, 0x28, 0x03, 0x00,
|
||||||
|
0x00,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ context.Context
|
||||||
|
var _ grpc.ClientConnInterface
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
const _ = grpc.SupportPackageIsVersion6
|
||||||
|
|
||||||
|
// CronWorkflowServiceClient is the client API for CronWorkflowService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||||
|
type CronWorkflowServiceClient interface {
|
||||||
|
CreateCronWorkflow(ctx context.Context, in *CreateWorkflowRequest, opts ...grpc.CallOption) (*CronWorkflow, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type cronWorkflowServiceClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCronWorkflowServiceClient(cc grpc.ClientConnInterface) CronWorkflowServiceClient {
|
||||||
|
return &cronWorkflowServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cronWorkflowServiceClient) CreateCronWorkflow(ctx context.Context, in *CreateWorkflowRequest, opts ...grpc.CallOption) (*CronWorkflow, error) {
|
||||||
|
out := new(CronWorkflow)
|
||||||
|
err := c.cc.Invoke(ctx, "/api.CronWorkflowService/CreateCronWorkflow", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronWorkflowServiceServer is the server API for CronWorkflowService service.
|
||||||
|
type CronWorkflowServiceServer interface {
|
||||||
|
CreateCronWorkflow(context.Context, *CreateWorkflowRequest) (*CronWorkflow, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedCronWorkflowServiceServer can be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedCronWorkflowServiceServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UnimplementedCronWorkflowServiceServer) CreateCronWorkflow(ctx context.Context, req *CreateWorkflowRequest) (*CronWorkflow, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method CreateCronWorkflow not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterCronWorkflowServiceServer(s *grpc.Server, srv CronWorkflowServiceServer) {
|
||||||
|
s.RegisterService(&_CronWorkflowService_serviceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _CronWorkflowService_CreateCronWorkflow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CreateWorkflowRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(CronWorkflowServiceServer).CreateCronWorkflow(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/api.CronWorkflowService/CreateCronWorkflow",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(CronWorkflowServiceServer).CreateCronWorkflow(ctx, req.(*CreateWorkflowRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _CronWorkflowService_serviceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "api.CronWorkflowService",
|
||||||
|
HandlerType: (*CronWorkflowServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "CreateCronWorkflow",
|
||||||
|
Handler: _CronWorkflowService_CreateCronWorkflow_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "cron_workflow.proto",
|
||||||
|
}
|
||||||
199
api/cron_workflow.pb.gw.go
Normal file
199
api/cron_workflow.pb.gw.go
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||||
|
// source: cron_workflow.proto
|
||||||
|
|
||||||
|
/*
|
||||||
|
Package api is a reverse proxy.
|
||||||
|
|
||||||
|
It translates gRPC into RESTful JSON APIs.
|
||||||
|
*/
|
||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/descriptor"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Suppress "imported and not used" errors
|
||||||
|
var _ codes.Code
|
||||||
|
var _ io.Reader
|
||||||
|
var _ status.Status
|
||||||
|
var _ = runtime.String
|
||||||
|
var _ = utilities.NewDoubleArray
|
||||||
|
var _ = descriptor.ForMessage
|
||||||
|
|
||||||
|
func request_CronWorkflowService_CreateCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, client CronWorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq CreateWorkflowRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||||
|
if berr != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||||
|
}
|
||||||
|
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.CronWorkflow); err != nil && err != io.EOF {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
val string
|
||||||
|
ok bool
|
||||||
|
err error
|
||||||
|
_ = err
|
||||||
|
)
|
||||||
|
|
||||||
|
val, ok = pathParams["namespace"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
|
||||||
|
}
|
||||||
|
|
||||||
|
protoReq.Namespace, err = runtime.String(val)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := client.CreateCronWorkflow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_CronWorkflowService_CreateCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, server CronWorkflowServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq CreateWorkflowRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||||
|
if berr != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||||
|
}
|
||||||
|
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.CronWorkflow); err != nil && err != io.EOF {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
val string
|
||||||
|
ok bool
|
||||||
|
err error
|
||||||
|
_ = err
|
||||||
|
)
|
||||||
|
|
||||||
|
val, ok = pathParams["namespace"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
|
||||||
|
}
|
||||||
|
|
||||||
|
protoReq.Namespace, err = runtime.String(val)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := server.CreateCronWorkflow(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCronWorkflowServiceHandlerServer registers the http handlers for service CronWorkflowService to "mux".
|
||||||
|
// UnaryRPC :call CronWorkflowServiceServer directly.
|
||||||
|
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||||
|
func RegisterCronWorkflowServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CronWorkflowServiceServer) error {
|
||||||
|
|
||||||
|
mux.Handle("POST", pattern_CronWorkflowService_CreateCronWorkflow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_CronWorkflowService_CreateCronWorkflow_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_CronWorkflowService_CreateCronWorkflow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCronWorkflowServiceHandlerFromEndpoint is same as RegisterCronWorkflowServiceHandler but
|
||||||
|
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||||
|
func RegisterCronWorkflowServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||||
|
conn, err := grpc.Dial(endpoint, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if err != nil {
|
||||||
|
if cerr := conn.Close(); cerr != nil {
|
||||||
|
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
if cerr := conn.Close(); cerr != nil {
|
||||||
|
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}()
|
||||||
|
|
||||||
|
return RegisterCronWorkflowServiceHandler(ctx, mux, conn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCronWorkflowServiceHandler registers the http handlers for service CronWorkflowService to "mux".
|
||||||
|
// The handlers forward requests to the grpc endpoint over "conn".
|
||||||
|
func RegisterCronWorkflowServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||||
|
return RegisterCronWorkflowServiceHandlerClient(ctx, mux, NewCronWorkflowServiceClient(conn))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCronWorkflowServiceHandlerClient registers the http handlers for service CronWorkflowService
|
||||||
|
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CronWorkflowServiceClient".
|
||||||
|
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CronWorkflowServiceClient"
|
||||||
|
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||||
|
// "CronWorkflowServiceClient" to call the correct interceptors.
|
||||||
|
func RegisterCronWorkflowServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CronWorkflowServiceClient) error {
|
||||||
|
|
||||||
|
mux.Handle("POST", pattern_CronWorkflowService_CreateCronWorkflow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_CronWorkflowService_CreateCronWorkflow_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_CronWorkflowService_CreateCronWorkflow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
pattern_CronWorkflowService_CreateCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "cron_workflow"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
forward_CronWorkflowService_CreateCronWorkflow_0 = runtime.ForwardResponseMessage
|
||||||
|
)
|
||||||
@@ -5,8 +5,31 @@ package api;
|
|||||||
import "google/api/annotations.proto";
|
import "google/api/annotations.proto";
|
||||||
import "google/protobuf/empty.proto";
|
import "google/protobuf/empty.proto";
|
||||||
import "workflow_template.proto";
|
import "workflow_template.proto";
|
||||||
|
import "workflow.proto";
|
||||||
import "metric.proto";
|
import "metric.proto";
|
||||||
|
|
||||||
service CronWorkflowService {
|
service CronWorkflowService {
|
||||||
|
rpc CreateCronWorkflow (CreateWorkflowRequest) returns (CronWorkflow) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/apis/v1beta1/{namespace}/cron_workflow"
|
||||||
|
body: "cronWorkflow"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateWorkflowRequest {
|
||||||
|
string namespace = 1;
|
||||||
|
CronWorkflow cronWorkflow = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CronWorkflow {
|
||||||
|
string schedule = 1;
|
||||||
|
string timezone = 2;
|
||||||
|
bool suspend = 3;
|
||||||
|
string concurrencyPolicy = 4;
|
||||||
|
string startingDeadlineSeconds = 5;
|
||||||
|
string successfulJobsHistoryLimit = 6;
|
||||||
|
string failedJobsHistoryLimit = 7;
|
||||||
|
|
||||||
|
WorkflowExecution workflowExecution = 8;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user