options

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthKind

type AuthKind int

AuthKind names the credential a command authenticates with. It is the single command-level declaration of "this command authenticates this way", replacing the config.KeyType literals that were spread across every call site and the RequireTeam guards duplicated in each management command.

const (
	// AuthConfig uses a Configuration API key (X-Honeycomb-Team) for the v1
	// Configuration API: boards, columns, SLOs, triggers, queries, etc.
	AuthConfig AuthKind = iota
	// AuthIngest uses an Ingest API key (X-Honeycomb-Team) for sending events.
	AuthIngest
	// AuthManagement uses a Management v2 key (id:secret bearer) for the
	// Management API: environments and keys. Management commands operate on a
	// team, so this kind requires a team slug.
	AuthManagement
	// AuthMCPOAuth names the OAuth path the mcp commands use to reach the
	// OAuth-protected Honeycomb MCP server through the mcp package's OAuth
	// transport, not ClientFor. It has no keyring API key and cannot build a REST
	// client, so ClientFor rejects it and AuthKinds excludes it from the
	// login/status machinery. It exists to make the auth taxonomy complete; no
	// command passes it to ClientFor.
	AuthMCPOAuth
)

func AuthKinds

func AuthKinds() []AuthKind

AuthKinds returns every AuthKind that authenticates with a stored API key, in the order auth status reports them. AuthMCPOAuth is excluded: its credential is an OAuth token set, not a verifiable API key, and stays out of the login/status machinery.

func (AuthKind) KeyType

func (k AuthKind) KeyType() config.KeyType

KeyType returns the config.KeyType backing a key-based AuthKind. It is only valid for kinds with a keyring-stored credential (everything except AuthMCPOAuth) and is used by auth status to enumerate the credentials it verifies.

type RootOptions

type RootOptions struct {
	IOStreams *iostreams.IOStreams
	Config    *config.Config

	NoInteractive bool
	Format        string
	APIUrl        string
	MCPUrl        string
	Profile       string
	ConfigPath    string
}

func (*RootOptions) ActiveProfile

func (o *RootOptions) ActiveProfile() string

func (*RootOptions) Client

Client builds an API client with auth for the given key type baked in via a request editor, so call sites issue requests without threading an editor argument through every WithResponse call.

func (*RootOptions) ClientFor

func (o *RootOptions) ClientFor(team *string, kind AuthKind) (*api.ClientWithResponses, error)

ClientFor builds an API client for the declared auth kind. For team-scoped kinds (AuthManagement) it first resolves the team slug into *team, folding the per-command RequireTeam guard into one place, then bakes the matching credential's request editor into the client.

Pass the command's --team flag pointer for team-scoped kinds; pass nil for kinds that do not operate on a team.

func (*RootOptions) KeyEditor

func (o *RootOptions) KeyEditor(kt config.KeyType) (api.RequestEditorFn, error)

func (*RootOptions) OutputWriter

func (o *RootOptions) OutputWriter() *output.Writer

func (*RootOptions) OutputWriterList

func (o *RootOptions) OutputWriterList() *output.Writer

func (*RootOptions) RequireKey

func (o *RootOptions) RequireKey(kt config.KeyType) (string, error)

func (*RootOptions) RequireTeam

func (o *RootOptions) RequireTeam(flag *string) error

RequireTeam resolves the team slug a management command operates on, writing the result back into *flag. Precedence:

  1. An explicit --team flag is used as-is.
  2. Otherwise the active profile's stored team is inferred, but only when exactly one team is known. A management key can span multiple teams, so inference is deliberately limited to the single-team case the profile records; with zero (or, in the future, more than one) known teams the required-flag error stands.

func (*RootOptions) ResolveAPIUrl

func (o *RootOptions) ResolveAPIUrl() string

func (*RootOptions) ResolveConfigPath

func (o *RootOptions) ResolveConfigPath() string

func (*RootOptions) ResolveMCPUrl

func (o *RootOptions) ResolveMCPUrl() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL