Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrnorm committed Oct 25, 2024
1 parent 3901d34 commit 3cb3fa9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/cli/command/workflow/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ var listCommand = cli.Command{
}

client := newResourceClient(cfg)
// the Common Fate API doesn't currently expose a ListAccessWorkflows method, so we use the
// QueryResources API.
res, err := client.QueryResources(ctx, connect.NewRequest(&resourcev1alpha1.QueryResourcesRequest{
Type: "Access::Workflow",
}))
if err != nil {
return err
}

workflows := AllWorkflows{Workflows: []workflow{}}
workflows := allWorkflows{Workflows: []workflow{}}

for _, w := range res.Msg.Resources {
workflows.Workflows = append(workflows.Workflows, workflow{
Expand All @@ -48,7 +50,10 @@ var listCommand = cli.Command{
},
}

type AllWorkflows struct {
// allWorkflows is used to ensure the output of the `cf workflows list`
// command remains stable, even if the API that we call changes from
// QueryResources to something else in future (such as ListAccessWorkflows).
type allWorkflows struct {
Workflows []workflow `json:"workflows"`
}

Expand Down

0 comments on commit 3cb3fa9

Please sign in to comment.