Merge pull request #68 from fission/cli-route-update
Implement 'fission route update'
This commit is contained in:
@@ -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
@@ -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},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user