Implement 'fission route update'

"fission route update" can now be used to update a route to point to a
different function.
This commit is contained in:
Soam Vasani
2017-01-05 15:59:39 -08:00
parent 5829552c3b
commit e73242f85c
2 changed files with 17 additions and 1 deletions
+16
View File
@@ -99,6 +99,22 @@ func htGet(c *cli.Context) error {
}
func htUpdate(c *cli.Context) error {
client := getClient(c.GlobalString("server"))
htName := c.String("name")
if len(htName) == 0 {
fatal("Need name of trigger, use --name")
}
ht, err := client.HTTPTriggerGet(&fission.Metadata{Name: htName})
checkErr(err, "get HTTP trigger")
newUid := c.String("uid")
ht.Function.Uid = newUid
_, err = client.HTTPTriggerUpdate(ht)
checkErr(err, "update HTTP trigger")
fmt.Printf("trigger '%v' updated\n", htName)
return nil
}
+1 -1
View File
@@ -57,7 +57,7 @@ func main() {
htSubcommands := []cli.Command{
{Name: "create", Aliases: []string{"add"}, Usage: "Create HTTP trigger", Flags: []cli.Flag{htMethodFlag, htUrlFlag, htFnNameFlag, htFnUidFlag}, Action: htCreate},
{Name: "get", Usage: "Get HTTP trigger", Flags: []cli.Flag{htMethodFlag, htUrlFlag}, Action: htGet},
{Name: "update", Usage: "Update HTTP trigger", Flags: []cli.Flag{htMethodFlag, htUrlFlag, htFnNameFlag, htFnUidFlag}, Action: htUpdate},
{Name: "update", Usage: "Update HTTP trigger", Flags: []cli.Flag{htNameFlag, htFnNameFlag, htFnUidFlag}, Action: htUpdate},
{Name: "delete", Usage: "Delete HTTP trigger", Flags: []cli.Flag{htNameFlag}, Action: htDelete},
{Name: "list", Usage: "List HTTP triggers", Flags: []cli.Flag{}, Action: htList},
}