Skip to content

feat(cli): allow owner to create workspace for another user #7493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matifali opened this issue May 11, 2023 · 3 comments · Fixed by #8481
Closed

feat(cli): allow owner to create workspace for another user #7493

matifali opened this issue May 11, 2023 · 3 comments · Fixed by #8481
Assignees

Comments

@matifali
Copy link
Member

From the dashboard, an owner can create a workspace for any user. How can we do that from cli?
coder create --help does not show any option to specify the owner

Usage: coder create [flags] [name]

Create a workspace

Options
      --parameter-file string, $CODER_PARAMETER_FILE
          Specify a file path with parameter values.

      --rich-parameter-file string, $CODER_RICH_PARAMETER_FILE
          Specify a file path with values for rich parameters defined in the
          template.

      --start-at string, $CODER_WORKSPACE_START_AT
          Specify the workspace autostart schedule. Check coder schedule start
          --help for the syntax.

      --stop-after duration, $CODER_WORKSPACE_STOP_AFTER
          Specify a duration after which the workspace should shut down (e.g.
          8h).

  -t, --template string, $CODER_TEMPLATE_NAME
          Specify a template name.

  -y, --yes bool
          Bypass prompts.
@alexander-dammeier
Copy link

To stop and update workspaces, the name of the workspace can be given as user/workspace-name. Maybe that could also be used to create workspaces? Something like coder create -t templateName user/workspace-name?

@Emyrk
Copy link
Member

Emyrk commented Jul 10, 2023

Currently this is hard-coded to Me

workspace, err := client.CreateWorkspace(inv.Context(), organization.ID, codersdk.Me, codersdk.CreateWorkspaceRequest{

I think an owner flag is appropriate 👍


@alexander-dammeier that is an interesting idea 🤔.

@Emyrk Emyrk self-assigned this Jul 10, 2023
@matifali
Copy link
Member Author

matifali commented Jul 10, 2023

Or instead of using --create flag, we can use user/workspace notation for the workspace name, if no user is provided, then default to using me as suggested by @alexander-dammeier

@matifali matifali changed the title feat(cli): add --owner flag to coder create feat(cli): create workspace for another user Jul 12, 2023
@matifali matifali changed the title feat(cli): create workspace for another user feat(cli): allow owner to create workspace for another user Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants