Skip to content

Commit

Permalink
update egctl mesh service command
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyingjie committed Apr 14, 2021
1 parent 7b27164 commit 13db235
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions cmd/client/command/mesh_service_observability.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func updateServiceCanaryCmd() *cobra.Command {
if len(args) != 1 {
return errors.New("requires one service name to be updated")
}

return nil
},
Run: func(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -136,9 +135,15 @@ func updateServiceResilienceCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update",
Short: "Update an service resilience from a yaml file or stdin",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("requires one service name to be updated")
}
return nil
},
Run: func(cmd *cobra.Command, args []string) {
buff, name := readFromFileOrStdin(specFile, cmd)
handleRequest(http.MethodPut, makeURL(MeshServiceResilienceURL, name), buff, cmd)
buff, _ := readFromFileOrStdin(specFile, cmd)
handleRequest(http.MethodPut, makeURL(MeshServiceResilienceURL, args[0]), buff, cmd)
},
}

Expand Down Expand Up @@ -224,9 +229,15 @@ func updateServiceLoadbalanceCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update",
Short: "Update an service loadbalance from a yaml file or stdin",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("requires one service name to be updated")
}
return nil
},
Run: func(cmd *cobra.Command, args []string) {
buff, name := readFromFileOrStdin(specFile, cmd)
handleRequest(http.MethodPut, makeURL(MeshServiceLoadBalanceURL, name), buff, cmd)
buff, _ := readFromFileOrStdin(specFile, cmd)
handleRequest(http.MethodPut, makeURL(MeshServiceLoadBalanceURL, args[0]), buff, cmd)
},
}

Expand Down Expand Up @@ -312,9 +323,15 @@ func updateServiceOutputserverCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update",
Short: "Update an service outputserver from a yaml file or stdin",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("requires one service name to be updated")
}
return nil
},
Run: func(cmd *cobra.Command, args []string) {
buff, name := readFromFileOrStdin(specFile, cmd)
handleRequest(http.MethodPut, makeURL(MeshServiceOutputServerURL, name), buff, cmd)
buff, _ := readFromFileOrStdin(specFile, cmd)
handleRequest(http.MethodPut, makeURL(MeshServiceOutputServerURL, args[0]), buff, cmd)
},
}

Expand Down Expand Up @@ -400,9 +417,15 @@ func updateServiceTracingCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update",
Short: "Update an service tracings from a yaml file or stdin",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("requires one service name to be updated")
}
return nil
},
Run: func(cmd *cobra.Command, args []string) {
buff, name := readFromFileOrStdin(specFile, cmd)
handleRequest(http.MethodPut, makeURL(MeshServiceTracingsURL, name), buff, cmd)
buff, _ := readFromFileOrStdin(specFile, cmd)
handleRequest(http.MethodPut, makeURL(MeshServiceTracingsURL, args[0]), buff, cmd)
},
}

Expand Down

0 comments on commit 13db235

Please sign in to comment.