updatestatus

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "update-status",
	Short: "Update job status",
	Long:  `Update job status of an existing job`,
	Example: `
wfxctl job update-status --id=1 --client-id=client42 --state=DOWNLOAD
`,
	Run: func(cmd *cobra.Command, _ []string) {
		baseCmd := flags.NewBaseCmd()
		req := model.JobStatus{
			ClientID: flags.Koanf.String(clientIDFlag),
			State:    flags.Koanf.String(stateFlag),
			Progress: int32(flags.Koanf.Int(progressFlag)),
			Message:  flags.Koanf.String(messageFlag),
		}

		cli := errutil.Must(baseCmd.CreateHTTPClient())

		params := jobs.NewPutJobsIDStatusParams().
			WithHTTPClient(cli).
			WithID(flags.Koanf.String(idFlag)).
			WithNewJobStatus(&req)

		var c *client.WorkflowExecutor
		if strings.ToUpper(flags.Koanf.String(actorFlag)) == string(model.EligibleEnumCLIENT) {
			c = baseCmd.CreateClient()
		} else {
			c = baseCmd.CreateMgmtClient()
		}
		resp, err := c.Jobs.PutJobsIDStatus(params)
		if err != nil {
			errutil.ProcessErrorResponse(cmd.OutOrStderr(), err)
			log.Fatal().Msg("Failed to update job")
		}

		log.Info().Str("id", params.ID).Str("state", req.State).Msg("Updated job status")
		if err := baseCmd.DumpResponse(cmd.OutOrStdout(), resp.GetPayload()); err != nil {
			log.Fatal().Err(err).Msg("Failed to dump response")
		}
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL