This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request vitessio#7575 from tinyspeck/am_vtctld_workflows
Note (@rafael): This one required a bunch of manual intervention [vtctld] Add v0 GetWorkflows rpc and workflow/vexec packages Signed-off-by: Rafael Chacon <[email protected]>
- Loading branch information
1 parent
31d5ee1
commit 71b359e
Showing
20 changed files
with
3,452 additions
and
727 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
Copyright 2021 The Vitess Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package command | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"vitess.io/vitess/go/cmd/vtctldclient/cli" | ||
|
||
vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" | ||
) | ||
|
||
var ( | ||
// GetWorkflows makes a GetWorkflows gRPC call to a vtctld. | ||
GetWorkflows = &cobra.Command{ | ||
Use: "GetWorkflows <keyspace>", | ||
Args: cobra.ExactArgs(1), | ||
RunE: commandGetWorkflows, | ||
} | ||
) | ||
|
||
var getWorkflowsOptions = struct { | ||
ShowAll bool | ||
}{} | ||
|
||
func commandGetWorkflows(cmd *cobra.Command, args []string) error { | ||
cli.FinishedParsing(cmd) | ||
|
||
ks := cmd.Flags().Arg(0) | ||
|
||
resp, err := client.GetWorkflows(commandCtx, &vtctldatapb.GetWorkflowsRequest{ | ||
Keyspace: ks, | ||
ActiveOnly: !getWorkflowsOptions.ShowAll, | ||
}) | ||
|
||
if err != nil { | ||
return err | ||
} | ||
|
||
data, err := cli.MarshalJSON(resp) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Printf("%s\n", data) | ||
|
||
return nil | ||
} | ||
|
||
func init() { | ||
GetWorkflows.Flags().BoolVarP(&getWorkflowsOptions.ShowAll, "show-all", "a", false, "Show all workflows instead of just active workflows") | ||
Root.AddCommand(GetWorkflows) | ||
} |
Oops, something went wrong.