Skip to content

Allow retrieving resource metadata from CLI #3434

Closed as not planned
Closed as not planned

Description

@dwahler

#2989 added support for showing resource metadata in the web UI. Implement the corresponding functionality in the CLI, to make it easier to use metadata items like API keys.

Proposed syntax:

  • coder metadata <workspace> to list all items, with sensitive values obscured by a placeholder
  • coder metadata --all <workspace> to list all items
  • coder metadata --get <workspace> <resource> <key> to print just the value of a specific key, without formatting or headers (for scripts)

Activity

  1. ammario commented on Aug 10, 2022

    @ammario
    Member
    • coder metadata <workspace> to list all items, with sensitive values obscured by a placeholder
    • coder metadata --all <workspace> to list all items

    What's the difference between --all and the first invokation?

    • coder metadata --get <workspace> <resource> <key> to print just the value of a specific key, without formatting or headers (for scripts)

    Why use --get here instead of inferring the operation from the number of arguments?

  2. dwahler commented on Aug 10, 2022

    @dwahler
    ContributorAuthor

    What's the difference between --all and the first invokation?

    The only difference is by default the values of sensitive fields are obscured (for consistency with the web UI) and --all would cause them to be shown. Open to suggestions for a better name for this. I also considered something like --include-sensitive-values but it seems unnecessarily verbose.

    Why use --get here instead of inferring the operation from the number of arguments?

    There are a couple of reasons I think it makes sense to do it this way:

    • I think of "present a formatted, human-readable table" and "fetch the exact value of a single item" as conceptually different operations. So at least one of them should have a name that distinguishes it from the other, as opposed to just being two unnamed modes of the same command
    • The main use case for fetching a single value is likely to be scripting (e.g. fetching an API key in .bashrc and using it to populate an environment variable) and in a non-interactive situation, it's better to be as explicit as possible
  3. github-actions commented on Oct 10, 2022

    @github-actions
    Contributor

    This issue is becoming stale. In order to keep the tracker readable and actionable, I'm going close to this issue in 7 days if there isn't more activity.

  4. github-actions commented on Dec 18, 2022

    @github-actions
    Contributor

    This issue is becoming stale. In order to keep the tracker readable and actionable, I'm going close to this issue in 7 days if there isn't more activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliArea: CLIstaleThis issue is like stale bread.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions