func (c *FlinkClient) TriggerSavepoint(
	apiBaseURL string, jobID string, dir string) (SavepointTriggerID, error) {
	var url = fmt.Sprintf("%s/jobs/%s/savepoints", apiBaseURL, jobID)
	var jsonStr = fmt.Sprintf(`{
		"target-directory" : "%s",
		"cancel-job" : false
	}`, dir)
	var triggerID = SavepointTriggerID{}
	var err = c.HTTPClient.Post(url, []byte(jsonStr), &triggerID)
	return triggerID, err
}
TriggerSavepoint triggers an async savepoint operation.
package flinkclient
import (
	"encoding/json"
	"fmt"
	"time"
	"github.com/go-logr/logr"
)
const (
	savepointStateInProgress = "IN_PROGRESS"
	savepointStateCompleted  = "COMPLETED"
)
type FlinkClient struct {
	Log        logr.Logger
	HTTPClient HTTPClient
}
type JobStatus struct {
	ID     string
	Status string
}
type JobStatusList struct {
	Jobs []JobStatus
}
type SavepointTriggerID struct {
	RequestID string `json:"request-id"`
}
type SavepointFailureCause struct {
	ExceptionClass string `json:"class"`
	StackTrace     string `json:"stack-trace"`
}
type SavepointStateID struct {
	ID string `json:"id"`
}
type SavepointStatus struct {
	JobID string
	TriggerID string
	Completed bool
	Location string
	FailureCause SavepointFailureCause
}
func (s *SavepointStatus) IsSuccessful() bool {
	return s.Completed && s.FailureCause.StackTrace == ""
}
func (s *SavepointStatus) IsFailed() bool {
	return s.Completed && s.FailureCause.StackTrace != ""
}
func (c *FlinkClient) GetJobStatusList(
	apiBaseURL string, jobStatusList *JobStatusList) error {
	return c.HTTPClient.Get(apiBaseURL+"/jobs", jobStatusList)
}
func (c *FlinkClient) StopJob(
	apiBaseURL string, jobID string) error {
	var resp = struct{}{}
	return c.HTTPClient.Patch(
		fmt.Sprintf("%s/jobs/%s?mode=cancel", apiBaseURL, jobID), []byte{}, &resp)
}