-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cli skeleton for kando chronicle push (#6178)
* Add cli skeleton for kando chronicle push * Update go/src/github.com/kanisterio/kanister/pkg/kando/chronicle_push.go
- Loading branch information
Showing
5 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package chronicle | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
type PushParams struct { | ||
ProfilePath string | ||
ArtifactPath string | ||
Frequency time.Duration | ||
EnvDir string | ||
Command []string | ||
} | ||
|
||
func (p PushParams) Validate() error { | ||
return nil | ||
} | ||
|
||
func Push(p PushParams) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package kando | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func newChronicleCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "chronicle <command>", | ||
Short: "Manage periodic output streams in object storage", | ||
} | ||
cmd.AddCommand(newChroniclePushCommand()) | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package kando | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/kanisterio/kanister/pkg/chronicle" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
const ( | ||
profilePathFlagName = "profile-path" | ||
artifactPathFlagName = "artifact-path" | ||
frequencyFlagName = "frequency" | ||
envDirFlagName = "env-dir" | ||
) | ||
|
||
func newChroniclePushCommand() *cobra.Command { | ||
params := chronicle.PushParams{} | ||
cmd := &cobra.Command{ | ||
Use: "push <command>", | ||
Short: "Periodically push the output of a command to object storage", | ||
Args: cobra.MinimumNArgs(1), | ||
RunE: func(c *cobra.Command, args []string) error { | ||
if err := params.Validate(); err != nil { | ||
return err | ||
} | ||
params.Command = args | ||
return chronicle.Push(params) | ||
}, | ||
} | ||
cmd.PersistentFlags().StringVarP(¶ms.ProfilePath, profilePathFlagName, "s", "", "Specify a path suffix (optional)") | ||
cmd.MarkPersistentFlagRequired(profilePathFlagName) | ||
cmd.PersistentFlags().StringVarP(¶ms.ArtifactPath, artifactPathFlagName, "p", "", "Path to a Profile as a JSON string (required)") | ||
cmd.PersistentFlags().StringVarP(¶ms.EnvDir, envDirFlagName, "e", "", "Get environment variables from a (optional)") | ||
cmd.PersistentFlags().DurationVarP(¶ms.Frequency, frequencyFlagName, "f", time.Minute, "The Frequency to push to object storage ") | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters