|
|
@@ -563,7 +563,37 @@ type SuspendWorkflowParams struct {
|
|
|
|
|
|
// SuspendWorkflow 挂起工作流
|
|
|
func (c *Client) SuspendWorkflow(params SuspendWorkflowParams) error {
|
|
|
- return nil
|
|
|
+ responseMap := make(map[string]any)
|
|
|
+
|
|
|
+ resp, err := c.restyClient.R().
|
|
|
+ SetHeader("Content-Type", "application/json").
|
|
|
+ SetAuthToken(c.token).
|
|
|
+ SetPathParams(map[string]string{
|
|
|
+ "namespace": params.Namespace,
|
|
|
+ "name": params.Name,
|
|
|
+ }).
|
|
|
+ SetBody(map[string]any{
|
|
|
+ "namespace": params.Namespace,
|
|
|
+ "name": params.Name,
|
|
|
+ }).
|
|
|
+ SetResult(&responseMap).
|
|
|
+ SetError(&responseMap).
|
|
|
+ Put(suspendWorkflowRelativeUrl)
|
|
|
+ if err != nil {
|
|
|
+ return errors.New(err.Error())
|
|
|
+ }
|
|
|
+
|
|
|
+ switch resp.StatusCode() {
|
|
|
+ case http.StatusOK:
|
|
|
+ return nil
|
|
|
+ default:
|
|
|
+ message, ok := responseMap["message"]
|
|
|
+ if !ok {
|
|
|
+ return errors.Errorf("%v", resp.Status())
|
|
|
+ }
|
|
|
+
|
|
|
+ return errors.Errorf("%v, %v", resp.Status(), message)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
type ResumeWorkflowParams struct {
|
|
|
@@ -574,7 +604,37 @@ type ResumeWorkflowParams struct {
|
|
|
|
|
|
// ResumeWorkflow 恢复被挂起的工作流
|
|
|
func (c *Client) ResumeWorkflow(params ResumeWorkflowParams) error {
|
|
|
- return nil
|
|
|
+ responseMap := make(map[string]any)
|
|
|
+
|
|
|
+ resp, err := c.restyClient.R().
|
|
|
+ SetHeader("Content-Type", "application/json").
|
|
|
+ SetAuthToken(c.token).
|
|
|
+ SetPathParams(map[string]string{
|
|
|
+ "namespace": params.Namespace,
|
|
|
+ "name": params.Name,
|
|
|
+ }).
|
|
|
+ SetBody(map[string]any{
|
|
|
+ "namespace": params.Namespace,
|
|
|
+ "name": params.Name,
|
|
|
+ }).
|
|
|
+ SetResult(&responseMap).
|
|
|
+ SetError(&responseMap).
|
|
|
+ Put(resumeWorkflowRelativeUrl)
|
|
|
+ if err != nil {
|
|
|
+ return errors.New(err.Error())
|
|
|
+ }
|
|
|
+
|
|
|
+ switch resp.StatusCode() {
|
|
|
+ case http.StatusOK:
|
|
|
+ return nil
|
|
|
+ default:
|
|
|
+ message, ok := responseMap["message"]
|
|
|
+ if !ok {
|
|
|
+ return errors.Errorf("%v", resp.Status())
|
|
|
+ }
|
|
|
+
|
|
|
+ return errors.Errorf("%v, %v", resp.Status(), message)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
type EventCallback func(event map[string]any, eventErr error) error
|