MCPcopy Index your code
hub / github.com/coder/coder / statusWorkspaceSharing

Method statusWorkspaceSharing

cli/sharing.go:37–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35}
36
37func (r *RootCmd) statusWorkspaceSharing() *serpent.Command {
38 cmd := &serpent.Command{
39 Use: "status <workspace>",
40 Short: "List all users and groups the given Workspace is shared with.",
41 Aliases: []string{"list"},
42 Middleware: serpent.Chain(
43 serpent.RequireNArgs(1),
44 ),
45 Handler: func(inv *serpent.Invocation) error {
46 client, err := r.InitClient(inv)
47 if err != nil {
48 return err
49 }
50
51 workspace, err := client.ResolveWorkspace(inv.Context(), inv.Args[0])
52 if err != nil {
53 return xerrors.Errorf("unable to fetch Workspace %s: %w", inv.Args[0], err)
54 }
55
56 acl, err := client.WorkspaceACL(inv.Context(), workspace.ID)
57 if err != nil {
58 return xerrors.Errorf("unable to fetch ACL for Workspace: %w", err)
59 }
60
61 out, err := workspaceACLToTable(inv.Context(), &acl)
62 if err != nil {
63 return err
64 }
65
66 _, err = fmt.Fprintln(inv.Stdout, out)
67 return err
68 },
69 }
70
71 return cmd
72}
73
74func (r *RootCmd) shareWorkspace() *serpent.Command {
75 var (

Callers 1

sharingMethod · 0.95

Calls 6

InitClientMethod · 0.95
workspaceACLToTableFunction · 0.85
ResolveWorkspaceMethod · 0.80
WorkspaceACLMethod · 0.80
ContextMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected