From d752e2fa4fd69204e2c5989c8adceeb19963f2d4 Mon Sep 17 00:00:00 2001 From: Simon Behar Date: Thu, 5 Nov 2020 07:22:06 -0600 Subject: [PATCH] feat: Add resume/suspend endpoints for CronWorkflows (#4457) Signed-off-by: Simon Behar --- api/openapi-spec/swagger.json | 98 +++ cmd/argo/commands/cron/resume.go | 9 +- cmd/argo/commands/cron/suspend.go | 8 +- .../argo-kube-cron-workflow-service-client.go | 8 + .../cronworkflow/cron-workflow.pb.go | 633 ++++++++++++++++-- .../cronworkflow/cron-workflow.pb.gw.go | 272 ++++++++ .../cronworkflow/cron-workflow.proto | 32 +- ...ranslating-cron-workflow-service-client.go | 16 + server/cronworkflow/cron_workflow_server.go | 17 + test/e2e/argo_server_test.go | 19 + .../cron-workflow-details.tsx | 15 +- .../shared/services/cron-workflow-service.ts | 8 + 12 files changed, 1063 insertions(+), 72 deletions(-) diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index 27cf01a269ec..c1c91eb5cf14 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -658,6 +658,82 @@ } } }, + "/api/v1/cron-workflows/{namespace}/{name}/resume": { + "put": { + "tags": [ + "CronWorkflowService" + ], + "operationId": "ResumeCronWorkflow", + "parameters": [ + { + "type": "string", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/io.argoproj.workflow.v1alpha1.CronWorkflowResumeRequest" + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/io.argoproj.workflow.v1alpha1.CronWorkflow" + } + } + } + } + }, + "/api/v1/cron-workflows/{namespace}/{name}/suspend": { + "put": { + "tags": [ + "CronWorkflowService" + ], + "operationId": "SuspendCronWorkflow", + "parameters": [ + { + "type": "string", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/io.argoproj.workflow.v1alpha1.CronWorkflowSuspendRequest" + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/io.argoproj.workflow.v1alpha1.CronWorkflow" + } + } + } + } + }, "/api/v1/events/{namespace}/{discriminator}": { "post": { "tags": [ @@ -2453,6 +2529,17 @@ } } }, + "io.argoproj.workflow.v1alpha1.CronWorkflowResumeRequest": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + } + } + }, "io.argoproj.workflow.v1alpha1.CronWorkflowSpec": { "description": "CronWorkflowSpec is the specification of a CronWorkflow", "type": "object", @@ -2531,6 +2618,17 @@ } } }, + "io.argoproj.workflow.v1alpha1.CronWorkflowSuspendRequest": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + } + } + }, "io.argoproj.workflow.v1alpha1.DAGTask": { "description": "DAGTask represents a node in the graph during DAG execution", "type": "object", diff --git a/cmd/argo/commands/cron/resume.go b/cmd/argo/commands/cron/resume.go index c308b45a403f..7f151e3fe3b4 100644 --- a/cmd/argo/commands/cron/resume.go +++ b/cmd/argo/commands/cron/resume.go @@ -20,18 +20,11 @@ func NewResumeCommand() *cobra.Command { serviceClient := apiClient.NewCronWorkflowServiceClient() namespace := client.Namespace() for _, name := range args { - cronWf, err := serviceClient.GetCronWorkflow(ctx, &cronworkflowpkg.GetCronWorkflowRequest{ + _, err := serviceClient.ResumeCronWorkflow(ctx, &cronworkflowpkg.CronWorkflowResumeRequest{ Name: name, Namespace: namespace, }) errors.CheckError(err) - cronWf.Spec.Suspend = false - _, err = serviceClient.UpdateCronWorkflow(ctx, &cronworkflowpkg.UpdateCronWorkflowRequest{ - Name: cronWf.Name, - Namespace: cronWf.Namespace, - CronWorkflow: cronWf, - }) - errors.CheckError(err) fmt.Printf("CronWorkflow '%s' resumed\n", name) } }, diff --git a/cmd/argo/commands/cron/suspend.go b/cmd/argo/commands/cron/suspend.go index 1a141f71855a..05c5fac7403e 100644 --- a/cmd/argo/commands/cron/suspend.go +++ b/cmd/argo/commands/cron/suspend.go @@ -20,18 +20,12 @@ func NewSuspendCommand() *cobra.Command { serviceClient := apiClient.NewCronWorkflowServiceClient() namespace := client.Namespace() for _, name := range args { - cronWf, err := serviceClient.GetCronWorkflow(ctx, &cronworkflowpkg.GetCronWorkflowRequest{ + cronWf, err := serviceClient.SuspendCronWorkflow(ctx, &cronworkflowpkg.CronWorkflowSuspendRequest{ Name: name, Namespace: namespace, }) errors.CheckError(err) cronWf.Spec.Suspend = true - _, err = serviceClient.UpdateCronWorkflow(ctx, &cronworkflowpkg.UpdateCronWorkflowRequest{ - Name: name, - Namespace: namespace, - CronWorkflow: cronWf, - }) - errors.CheckError(err) fmt.Printf("CronWorkflow '%s' suspended\n", name) } }, diff --git a/pkg/apiclient/argo-kube-cron-workflow-service-client.go b/pkg/apiclient/argo-kube-cron-workflow-service-client.go index 655a9c5b1fd0..d91e78b020ac 100644 --- a/pkg/apiclient/argo-kube-cron-workflow-service-client.go +++ b/pkg/apiclient/argo-kube-cron-workflow-service-client.go @@ -38,3 +38,11 @@ func (c *argoKubeCronWorkflowServiceClient) UpdateCronWorkflow(ctx context.Conte func (c *argoKubeCronWorkflowServiceClient) DeleteCronWorkflow(ctx context.Context, req *cronworkflowpkg.DeleteCronWorkflowRequest, _ ...grpc.CallOption) (*cronworkflowpkg.CronWorkflowDeletedResponse, error) { return c.delegate.DeleteCronWorkflow(ctx, req) } + +func (c *argoKubeCronWorkflowServiceClient) ResumeCronWorkflow(ctx context.Context, req *cronworkflowpkg.CronWorkflowResumeRequest, _ ...grpc.CallOption) (*v1alpha1.CronWorkflow, error) { + return c.delegate.ResumeCronWorkflow(ctx, req) +} + +func (c *argoKubeCronWorkflowServiceClient) SuspendCronWorkflow(ctx context.Context, req *cronworkflowpkg.CronWorkflowSuspendRequest, _ ...grpc.CallOption) (*v1alpha1.CronWorkflow, error) { + return c.delegate.SuspendCronWorkflow(ctx, req) +} diff --git a/pkg/apiclient/cronworkflow/cron-workflow.pb.go b/pkg/apiclient/cronworkflow/cron-workflow.pb.go index 54c30bb9d1b4..2ab1c4cb68ca 100644 --- a/pkg/apiclient/cronworkflow/cron-workflow.pb.go +++ b/pkg/apiclient/cronworkflow/cron-workflow.pb.go @@ -432,6 +432,116 @@ func (m *CronWorkflowDeletedResponse) XXX_DiscardUnknown() { var xxx_messageInfo_CronWorkflowDeletedResponse proto.InternalMessageInfo +type CronWorkflowSuspendRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CronWorkflowSuspendRequest) Reset() { *m = CronWorkflowSuspendRequest{} } +func (m *CronWorkflowSuspendRequest) String() string { return proto.CompactTextString(m) } +func (*CronWorkflowSuspendRequest) ProtoMessage() {} +func (*CronWorkflowSuspendRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_257f310938c448f8, []int{7} +} +func (m *CronWorkflowSuspendRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CronWorkflowSuspendRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CronWorkflowSuspendRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CronWorkflowSuspendRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CronWorkflowSuspendRequest.Merge(m, src) +} +func (m *CronWorkflowSuspendRequest) XXX_Size() int { + return m.Size() +} +func (m *CronWorkflowSuspendRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CronWorkflowSuspendRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CronWorkflowSuspendRequest proto.InternalMessageInfo + +func (m *CronWorkflowSuspendRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *CronWorkflowSuspendRequest) GetNamespace() string { + if m != nil { + return m.Namespace + } + return "" +} + +type CronWorkflowResumeRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CronWorkflowResumeRequest) Reset() { *m = CronWorkflowResumeRequest{} } +func (m *CronWorkflowResumeRequest) String() string { return proto.CompactTextString(m) } +func (*CronWorkflowResumeRequest) ProtoMessage() {} +func (*CronWorkflowResumeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_257f310938c448f8, []int{8} +} +func (m *CronWorkflowResumeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CronWorkflowResumeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CronWorkflowResumeRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CronWorkflowResumeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CronWorkflowResumeRequest.Merge(m, src) +} +func (m *CronWorkflowResumeRequest) XXX_Size() int { + return m.Size() +} +func (m *CronWorkflowResumeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CronWorkflowResumeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CronWorkflowResumeRequest proto.InternalMessageInfo + +func (m *CronWorkflowResumeRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *CronWorkflowResumeRequest) GetNamespace() string { + if m != nil { + return m.Namespace + } + return "" +} + func init() { proto.RegisterType((*LintCronWorkflowRequest)(nil), "cronworkflow.LintCronWorkflowRequest") proto.RegisterType((*CreateCronWorkflowRequest)(nil), "cronworkflow.CreateCronWorkflowRequest") @@ -440,6 +550,8 @@ func init() { proto.RegisterType((*UpdateCronWorkflowRequest)(nil), "cronworkflow.UpdateCronWorkflowRequest") proto.RegisterType((*DeleteCronWorkflowRequest)(nil), "cronworkflow.DeleteCronWorkflowRequest") proto.RegisterType((*CronWorkflowDeletedResponse)(nil), "cronworkflow.CronWorkflowDeletedResponse") + proto.RegisterType((*CronWorkflowSuspendRequest)(nil), "cronworkflow.CronWorkflowSuspendRequest") + proto.RegisterType((*CronWorkflowResumeRequest)(nil), "cronworkflow.CronWorkflowResumeRequest") } func init() { @@ -447,49 +559,54 @@ func init() { } var fileDescriptor_257f310938c448f8 = []byte{ - // 666 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x75, 0x29, 0x42, 0xf4, 0x95, 0x0a, 0x38, 0xa4, 0x92, 0x9a, 0x52, 0x55, 0x56, 0xa1, - 0x6d, 0xa0, 0x67, 0x92, 0x74, 0x40, 0x6c, 0x6d, 0x8a, 0xba, 0x44, 0x02, 0xb9, 0x42, 0xa8, 0x6c, - 0x57, 0xe7, 0x70, 0x4c, 0x9c, 0x3b, 0x63, 0x5f, 0x53, 0x21, 0xd4, 0x85, 0x9d, 0x89, 0x11, 0xc4, - 0xcc, 0xc2, 0x0f, 0x31, 0x20, 0xfe, 0x04, 0x46, 0x24, 0xfe, 0x01, 0x14, 0xf1, 0x5f, 0xb0, 0x20, - 0x5f, 0xe2, 0xc4, 0x76, 0x62, 0xd5, 0xd0, 0x20, 0xb1, 0x9d, 0x7d, 0xf7, 0xbe, 0xef, 0x73, 0xef, - 0x3d, 0x7d, 0x75, 0x40, 0xbc, 0x96, 0x6d, 0x50, 0xcf, 0x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, 0x00, 0x00, - 0xff, 0xff, 0x8b, 0x9e, 0x82, 0xdc, 0xaa, 0x09, 0x00, 0x00, + // 752 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0xcd, 0x4f, 0xd4, 0x4e, + 0x18, 0xc7, 0x33, 0xcb, 0x2f, 0xbf, 0x84, 0x07, 0x89, 0x3a, 0x24, 0xb8, 0x54, 0x24, 0xa4, 0x41, + 0x81, 0x55, 0xa6, 0x2c, 0xa0, 0x31, 0xe8, 0x85, 0x17, 0xc3, 0x05, 0x5f, 0xb2, 0xc4, 0x18, 0xbc, + 0x95, 0xee, 0x58, 0x2a, 0xdd, 0x99, 0xda, 0x99, 0x5d, 0x62, 0x0c, 0x17, 0xef, 0x9e, 0x3c, 0x6a, + 0x3c, 0x7b, 0xf1, 0xe5, 0xa2, 0xf1, 0x62, 0xe2, 0xd1, 0xa3, 0x89, 0xff, 0x80, 0x21, 0xfe, 0x17, + 0x5e, 0x4c, 0x67, 0xdf, 0x3a, 0xdd, 0xad, 0x14, 0x58, 0x13, 0x6f, 0xd3, 0xed, 0x3c, 0xcf, 0x7c, + 0x9e, 0xef, 0xf3, 0xec, 0xb7, 0x03, 0x24, 0xd8, 0x71, 0x2d, 0x3b, 0xf0, 0x1c, 0xdf, 0xa3, 0x4c, + 0x5a, 0x4e, 0xc8, 0xd9, 0x2e, 0x0f, 0x77, 0x1e, 0xf8, 0x7c, 0x57, 0x3d, 0xcc, 0x34, 0x9f, 0x48, + 0x10, 0x72, 0xc9, 0xf1, 0x89, 0xf8, 0x0e, 0x63, 0xd4, 0xe5, 0xdc, 0xf5, 0x69, 0x94, 0xc0, 0xb2, + 0x19, 0xe3, 0xd2, 0x96, 0x1e, 0x67, 0xa2, 0xbe, 0xd7, 0x58, 0xd8, 0xb9, 0x2a, 0x88, 0xc7, 0xa3, + 0xb7, 0x15, 0xdb, 0xd9, 0xf6, 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f4, 0x75, 0x7f, 0x0c, 0x7d, 0xdb, 0x1f, 0x43, + 0x3f, 0xf6, 0xc7, 0xd0, 0xfd, 0xf9, 0x83, 0x2e, 0xbf, 0x5d, 0xee, 0xe9, 0x5b, 0xff, 0xab, 0x3b, + 0xef, 0xfc, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x34, 0x33, 0x8d, 0x2b, 0xcc, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -510,6 +627,8 @@ type CronWorkflowServiceClient interface { GetCronWorkflow(ctx context.Context, in *GetCronWorkflowRequest, opts ...grpc.CallOption) (*v1alpha1.CronWorkflow, error) UpdateCronWorkflow(ctx context.Context, in *UpdateCronWorkflowRequest, opts ...grpc.CallOption) (*v1alpha1.CronWorkflow, error) DeleteCronWorkflow(ctx context.Context, in *DeleteCronWorkflowRequest, opts ...grpc.CallOption) (*CronWorkflowDeletedResponse, error) + ResumeCronWorkflow(ctx context.Context, in *CronWorkflowResumeRequest, opts ...grpc.CallOption) (*v1alpha1.CronWorkflow, error) + SuspendCronWorkflow(ctx context.Context, in *CronWorkflowSuspendRequest, opts ...grpc.CallOption) (*v1alpha1.CronWorkflow, error) } type cronWorkflowServiceClient struct { @@ -574,6 +693,24 @@ func (c *cronWorkflowServiceClient) DeleteCronWorkflow(ctx context.Context, in * return out, nil } +func (c *cronWorkflowServiceClient) ResumeCronWorkflow(ctx context.Context, in *CronWorkflowResumeRequest, opts ...grpc.CallOption) (*v1alpha1.CronWorkflow, error) { + out := new(v1alpha1.CronWorkflow) + err := c.cc.Invoke(ctx, "/cronworkflow.CronWorkflowService/ResumeCronWorkflow", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cronWorkflowServiceClient) SuspendCronWorkflow(ctx context.Context, in *CronWorkflowSuspendRequest, opts ...grpc.CallOption) (*v1alpha1.CronWorkflow, error) { + out := new(v1alpha1.CronWorkflow) + err := c.cc.Invoke(ctx, "/cronworkflow.CronWorkflowService/SuspendCronWorkflow", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // CronWorkflowServiceServer is the server API for CronWorkflowService service. type CronWorkflowServiceServer interface { LintCronWorkflow(context.Context, *LintCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) @@ -582,6 +719,8 @@ type CronWorkflowServiceServer interface { GetCronWorkflow(context.Context, *GetCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) UpdateCronWorkflow(context.Context, *UpdateCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) DeleteCronWorkflow(context.Context, *DeleteCronWorkflowRequest) (*CronWorkflowDeletedResponse, error) + ResumeCronWorkflow(context.Context, *CronWorkflowResumeRequest) (*v1alpha1.CronWorkflow, error) + SuspendCronWorkflow(context.Context, *CronWorkflowSuspendRequest) (*v1alpha1.CronWorkflow, error) } // UnimplementedCronWorkflowServiceServer can be embedded to have forward compatible implementations. @@ -606,6 +745,12 @@ func (*UnimplementedCronWorkflowServiceServer) UpdateCronWorkflow(ctx context.Co func (*UnimplementedCronWorkflowServiceServer) DeleteCronWorkflow(ctx context.Context, req *DeleteCronWorkflowRequest) (*CronWorkflowDeletedResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DeleteCronWorkflow not implemented") } +func (*UnimplementedCronWorkflowServiceServer) ResumeCronWorkflow(ctx context.Context, req *CronWorkflowResumeRequest) (*v1alpha1.CronWorkflow, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumeCronWorkflow not implemented") +} +func (*UnimplementedCronWorkflowServiceServer) SuspendCronWorkflow(ctx context.Context, req *CronWorkflowSuspendRequest) (*v1alpha1.CronWorkflow, error) { + return nil, status.Errorf(codes.Unimplemented, "method SuspendCronWorkflow not implemented") +} func RegisterCronWorkflowServiceServer(s *grpc.Server, srv CronWorkflowServiceServer) { s.RegisterService(&_CronWorkflowService_serviceDesc, srv) @@ -719,6 +864,42 @@ func _CronWorkflowService_DeleteCronWorkflow_Handler(srv interface{}, ctx contex return interceptor(ctx, in, info, handler) } +func _CronWorkflowService_ResumeCronWorkflow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CronWorkflowResumeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CronWorkflowServiceServer).ResumeCronWorkflow(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cronworkflow.CronWorkflowService/ResumeCronWorkflow", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CronWorkflowServiceServer).ResumeCronWorkflow(ctx, req.(*CronWorkflowResumeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CronWorkflowService_SuspendCronWorkflow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CronWorkflowSuspendRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CronWorkflowServiceServer).SuspendCronWorkflow(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cronworkflow.CronWorkflowService/SuspendCronWorkflow", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CronWorkflowServiceServer).SuspendCronWorkflow(ctx, req.(*CronWorkflowSuspendRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _CronWorkflowService_serviceDesc = grpc.ServiceDesc{ ServiceName: "cronworkflow.CronWorkflowService", HandlerType: (*CronWorkflowServiceServer)(nil), @@ -747,6 +928,14 @@ var _CronWorkflowService_serviceDesc = grpc.ServiceDesc{ MethodName: "DeleteCronWorkflow", Handler: _CronWorkflowService_DeleteCronWorkflow_Handler, }, + { + MethodName: "ResumeCronWorkflow", + Handler: _CronWorkflowService_ResumeCronWorkflow_Handler, + }, + { + MethodName: "SuspendCronWorkflow", + Handler: _CronWorkflowService_SuspendCronWorkflow_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "pkg/apiclient/cronworkflow/cron-workflow.proto", @@ -1088,6 +1277,88 @@ func (m *CronWorkflowDeletedResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *CronWorkflowSuspendRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CronWorkflowSuspendRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CronWorkflowSuspendRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Namespace) > 0 { + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarintCronWorkflow(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintCronWorkflow(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CronWorkflowResumeRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CronWorkflowResumeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CronWorkflowResumeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Namespace) > 0 { + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarintCronWorkflow(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintCronWorkflow(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintCronWorkflow(dAtA []byte, offset int, v uint64) int { offset -= sovCronWorkflow(v) base := offset @@ -1247,6 +1518,46 @@ func (m *CronWorkflowDeletedResponse) Size() (n int) { return n } +func (m *CronWorkflowSuspendRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovCronWorkflow(uint64(l)) + } + l = len(m.Namespace) + if l > 0 { + n += 1 + l + sovCronWorkflow(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CronWorkflowResumeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovCronWorkflow(uint64(l)) + } + l = len(m.Namespace) + if l > 0 { + n += 1 + l + sovCronWorkflow(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovCronWorkflow(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2171,6 +2482,242 @@ func (m *CronWorkflowDeletedResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *CronWorkflowSuspendRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCronWorkflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CronWorkflowSuspendRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CronWorkflowSuspendRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCronWorkflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCronWorkflow + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCronWorkflow + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCronWorkflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCronWorkflow + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCronWorkflow + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCronWorkflow(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCronWorkflow + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCronWorkflow + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CronWorkflowResumeRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCronWorkflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CronWorkflowResumeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CronWorkflowResumeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCronWorkflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCronWorkflow + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCronWorkflow + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCronWorkflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCronWorkflow + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCronWorkflow + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCronWorkflow(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCronWorkflow + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCronWorkflow + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipCronWorkflow(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/pkg/apiclient/cronworkflow/cron-workflow.pb.gw.go b/pkg/apiclient/cronworkflow/cron-workflow.pb.gw.go index afef86397a2c..0a230a2ad1ba 100644 --- a/pkg/apiclient/cronworkflow/cron-workflow.pb.gw.go +++ b/pkg/apiclient/cronworkflow/cron-workflow.pb.gw.go @@ -514,6 +514,190 @@ func local_request_CronWorkflowService_DeleteCronWorkflow_0(ctx context.Context, } +func request_CronWorkflowService_ResumeCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, client CronWorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CronWorkflowResumeRequest + 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); 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) + } + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.ResumeCronWorkflow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_CronWorkflowService_ResumeCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, server CronWorkflowServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CronWorkflowResumeRequest + 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); 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) + } + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.ResumeCronWorkflow(ctx, &protoReq) + return msg, metadata, err + +} + +func request_CronWorkflowService_SuspendCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, client CronWorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CronWorkflowSuspendRequest + 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); 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) + } + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.SuspendCronWorkflow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_CronWorkflowService_SuspendCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, server CronWorkflowServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CronWorkflowSuspendRequest + 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); 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) + } + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.SuspendCronWorkflow(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. @@ -639,6 +823,46 @@ func RegisterCronWorkflowServiceHandlerServer(ctx context.Context, mux *runtime. }) + mux.Handle("PUT", pattern_CronWorkflowService_ResumeCronWorkflow_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_ResumeCronWorkflow_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_ResumeCronWorkflow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_CronWorkflowService_SuspendCronWorkflow_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_SuspendCronWorkflow_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_SuspendCronWorkflow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -800,6 +1024,46 @@ func RegisterCronWorkflowServiceHandlerClient(ctx context.Context, mux *runtime. }) + mux.Handle("PUT", pattern_CronWorkflowService_ResumeCronWorkflow_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_ResumeCronWorkflow_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_ResumeCronWorkflow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_CronWorkflowService_SuspendCronWorkflow_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_SuspendCronWorkflow_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_SuspendCronWorkflow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -815,6 +1079,10 @@ var ( pattern_CronWorkflowService_UpdateCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"api", "v1", "cron-workflows", "namespace", "name"}, "", runtime.AssumeColonVerbOpt(true))) pattern_CronWorkflowService_DeleteCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"api", "v1", "cron-workflows", "namespace", "name"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_CronWorkflowService_ResumeCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"api", "v1", "cron-workflows", "namespace", "name", "resume"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_CronWorkflowService_SuspendCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"api", "v1", "cron-workflows", "namespace", "name", "suspend"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -829,4 +1097,8 @@ var ( forward_CronWorkflowService_UpdateCronWorkflow_0 = runtime.ForwardResponseMessage forward_CronWorkflowService_DeleteCronWorkflow_0 = runtime.ForwardResponseMessage + + forward_CronWorkflowService_ResumeCronWorkflow_0 = runtime.ForwardResponseMessage + + forward_CronWorkflowService_SuspendCronWorkflow_0 = runtime.ForwardResponseMessage ) diff --git a/pkg/apiclient/cronworkflow/cron-workflow.proto b/pkg/apiclient/cronworkflow/cron-workflow.proto index b0a6b5b6026f..d6b05672af72 100644 --- a/pkg/apiclient/cronworkflow/cron-workflow.proto +++ b/pkg/apiclient/cronworkflow/cron-workflow.proto @@ -11,34 +11,50 @@ message LintCronWorkflowRequest { string namespace = 1; github.com.argoproj.argo.pkg.apis.workflow.v1alpha1.CronWorkflow cronWorkflow = 2; } + message CreateCronWorkflowRequest { string namespace = 1; github.com.argoproj.argo.pkg.apis.workflow.v1alpha1.CronWorkflow cronWorkflow = 2; k8s.io.apimachinery.pkg.apis.meta.v1.CreateOptions createOptions = 3; } + message ListCronWorkflowsRequest { string namespace = 1; k8s.io.apimachinery.pkg.apis.meta.v1.ListOptions listOptions = 2; } + message GetCronWorkflowRequest { string name = 1; string namespace = 2; k8s.io.apimachinery.pkg.apis.meta.v1.GetOptions getOptions = 3; } + message UpdateCronWorkflowRequest { // DEPRECATED: This field is ignored. string name = 1 [deprecated=true]; string namespace = 2; github.com.argoproj.argo.pkg.apis.workflow.v1alpha1.CronWorkflow cronWorkflow = 3; } + message DeleteCronWorkflowRequest { string name = 1; string namespace = 2; k8s.io.apimachinery.pkg.apis.meta.v1.DeleteOptions deleteOptions = 3; } + message CronWorkflowDeletedResponse { } +message CronWorkflowSuspendRequest { + string name = 1; + string namespace = 2; +} + +message CronWorkflowResumeRequest { + string name = 1; + string namespace = 2; +} + service CronWorkflowService { rpc LintCronWorkflow (LintCronWorkflowRequest) returns (github.com.argoproj.argo.pkg.apis.workflow.v1alpha1.CronWorkflow) { option (google.api.http) = { @@ -71,4 +87,18 @@ service CronWorkflowService { rpc DeleteCronWorkflow (DeleteCronWorkflowRequest) returns (CronWorkflowDeletedResponse) { option (google.api.http).delete = "/api/v1/cron-workflows/{namespace}/{name}"; } -} \ No newline at end of file + + rpc ResumeCronWorkflow (CronWorkflowResumeRequest) returns (github.com.argoproj.argo.pkg.apis.workflow.v1alpha1.CronWorkflow) { + option (google.api.http) = { + put: "/api/v1/cron-workflows/{namespace}/{name}/resume" + body: "*" + }; + } + + rpc SuspendCronWorkflow (CronWorkflowSuspendRequest) returns (github.com.argoproj.argo.pkg.apis.workflow.v1alpha1.CronWorkflow) { + option (google.api.http) = { + put: "/api/v1/cron-workflows/{namespace}/{name}/suspend" + body: "*" + }; + } +} diff --git a/pkg/apiclient/error-translating-cron-workflow-service-client.go b/pkg/apiclient/error-translating-cron-workflow-service-client.go index d126333014a3..d4a969148036 100644 --- a/pkg/apiclient/error-translating-cron-workflow-service-client.go +++ b/pkg/apiclient/error-translating-cron-workflow-service-client.go @@ -63,3 +63,19 @@ func (c *errorTranslatingCronWorkflowServiceClient) DeleteCronWorkflow(ctx conte } return workflow, err } + +func (c *errorTranslatingCronWorkflowServiceClient) ResumeCronWorkflow(ctx context.Context, req *cronworkflowpkg.CronWorkflowResumeRequest, _ ...grpc.CallOption) (*v1alpha1.CronWorkflow, error) { + workflow, err := c.delegate.ResumeCronWorkflow(ctx, req) + if err != nil { + return nil, grpcutil.TranslateError(err) + } + return workflow, nil +} + +func (c *errorTranslatingCronWorkflowServiceClient) SuspendCronWorkflow(ctx context.Context, req *cronworkflowpkg.CronWorkflowSuspendRequest, _ ...grpc.CallOption) (*v1alpha1.CronWorkflow, error) { + workflow, err := c.delegate.SuspendCronWorkflow(ctx, req) + if err != nil { + return nil, grpcutil.TranslateError(err) + } + return workflow, nil +} diff --git a/server/cronworkflow/cron_workflow_server.go b/server/cronworkflow/cron_workflow_server.go index a9de4194b66d..60c8f5a34ea2 100644 --- a/server/cronworkflow/cron_workflow_server.go +++ b/server/cronworkflow/cron_workflow_server.go @@ -90,6 +90,23 @@ func (c *cronWorkflowServiceServer) DeleteCronWorkflow(ctx context.Context, req return &cronworkflowpkg.CronWorkflowDeletedResponse{}, nil } +func (c *cronWorkflowServiceServer) ResumeCronWorkflow(ctx context.Context, req *cronworkflowpkg.CronWorkflowResumeRequest) (*v1alpha1.CronWorkflow, error) { + return c.setCronWorkflowSuspend(false, req.Namespace, req.Name, ctx) +} + +func (c *cronWorkflowServiceServer) SuspendCronWorkflow(ctx context.Context, req *cronworkflowpkg.CronWorkflowSuspendRequest) (*v1alpha1.CronWorkflow, error) { + return c.setCronWorkflowSuspend(true, req.Namespace, req.Name, ctx) +} + +func (c *cronWorkflowServiceServer) setCronWorkflowSuspend(setTo bool, namespace, name string, ctx context.Context) (*v1alpha1.CronWorkflow, error) { + cwf, err := c.getCronWorkflowAndValidate(ctx, namespace, name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + cwf.Spec.Suspend = setTo + return auth.GetWfClient(ctx).ArgoprojV1alpha1().CronWorkflows(namespace).Update(cwf) +} + func (c *cronWorkflowServiceServer) getCronWorkflowAndValidate(ctx context.Context, namespace string, name string, options metav1.GetOptions) (*v1alpha1.CronWorkflow, error) { wfClient := auth.GetWfClient(ctx) cronWf, err := wfClient.ArgoprojV1alpha1().CronWorkflows(namespace).Get(name, options) diff --git a/test/e2e/argo_server_test.go b/test/e2e/argo_server_test.go index 964de53ac903..a0f5b73a496f 100644 --- a/test/e2e/argo_server_test.go +++ b/test/e2e/argo_server_test.go @@ -898,6 +898,25 @@ func (s *ArgoServerSuite) TestCronWorkflowService() { Status(200) }) + s.Run("Suspend", func() { + s.e().PUT("/api/v1/cron-workflows/argo/test/suspend"). + Expect(). + Status(200). + JSON(). + Path("$.spec.suspend"). + Equal(true) + }) + + s.Run("Resume", func() { + s.e().PUT("/api/v1/cron-workflows/argo/test/resume"). + Expect(). + Status(200). + JSON(). + Path("$.spec"). + Object(). + NotContainsKey("suspend") + }) + s.Run("List", func() { // make sure list options work correctly s.Given(). diff --git a/ui/src/app/cron-workflows/components/cron-workflow-details/cron-workflow-details.tsx b/ui/src/app/cron-workflows/components/cron-workflow-details/cron-workflow-details.tsx index a25234205f6e..048ac62c1496 100644 --- a/ui/src/app/cron-workflows/components/cron-workflow-details/cron-workflow-details.tsx +++ b/ui/src/app/cron-workflows/components/cron-workflow-details/cron-workflow-details.tsx @@ -9,7 +9,6 @@ import {Loading} from '../../../shared/components/loading'; import {services} from '../../../shared/services'; import {CronWorkflowSummaryPanel} from '../cron-workflow-summary-panel'; -const jsonMergePatch = require('json-merge-patch'); require('../../../workflows/components/workflow-details/workflow-details.scss'); interface State { @@ -135,13 +134,8 @@ export class CronWorkflowDetails extends BasePage, Stat } private suspendCronWorkflow() { - const wf = JSON.parse(JSON.stringify(this.state.cronWorkflow)); - wf.spec.suspend = true; - const patch = jsonMergePatch.generate(this.state.cronWorkflow, wf) || {}; services.cronWorkflows - .get(this.name, this.namespace) - .then(latest => jsonMergePatch.apply(latest, patch)) - .then(patched => services.cronWorkflows.update(patched, this.name, this.namespace)) + .suspend(this.name, this.namespace) .then((updated: CronWorkflow) => this.setState({cronWorkflow: updated})) .catch(e => { this.appContext.apis.notifications.show({ @@ -152,13 +146,8 @@ export class CronWorkflowDetails extends BasePage, Stat } private resumeCronWorkflow() { - const wf = JSON.parse(JSON.stringify(this.state.cronWorkflow)); - wf.spec.suspend = undefined; - const patch = jsonMergePatch.generate(this.state.cronWorkflow, wf) || {}; services.cronWorkflows - .get(this.name, this.namespace) - .then(latest => jsonMergePatch.apply(latest, patch)) - .then(patched => services.cronWorkflows.update(patched, this.name, this.namespace)) + .resume(this.name, this.namespace) .then((updated: CronWorkflow) => this.setState({cronWorkflow: updated})) .catch(e => { this.appContext.apis.notifications.show({ diff --git a/ui/src/app/shared/services/cron-workflow-service.ts b/ui/src/app/shared/services/cron-workflow-service.ts index 4ca8dac227ce..874b5f8e6c34 100644 --- a/ui/src/app/shared/services/cron-workflow-service.ts +++ b/ui/src/app/shared/services/cron-workflow-service.ts @@ -30,4 +30,12 @@ export class CronWorkflowService { public delete(name: string, namespace: string) { return requests.delete(`api/v1/cron-workflows/${namespace}/${name}`); } + + public suspend(name: string, namespace: string) { + return requests.put(`api/v1/cron-workflows/${namespace}/${name}/suspend`).then(res => res.body as CronWorkflow); + } + + public resume(name: string, namespace: string) { + return requests.put(`api/v1/cron-workflows/${namespace}/${name}/resume`).then(res => res.body as CronWorkflow); + } }