providers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package providers is the read-only provider catalog, ported from the spec/ registry parts of v1's provider registry. It resolves a provider name to a ProviderSpec - category, host, keys URL, CLI, token env - which powers list/view/audit labels and `list --type`. The deploy/credential adapter behavior is not ported here (that lands in a later wave); this is the catalog only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSpecs

func AllSpecs(providersFile string) map[string]Spec

AllSpecs returns every known provider spec by name: built-ins, then the catalog (user file else embedded default) overriding. Mirrors registry.all_specs.

func CategoryOf

func CategoryOf(name, providersFile string) string

CategoryOf maps a provider name to its category. An empty or unknown name falls back to "server" - the generic-SSH category, matching registry.resolve().

func DefaultCatalog

func DefaultCatalog() []byte

DefaultCatalog returns the embedded shipped catalog bytes (for `providers --export`).

Types

type DeployOutcome

type DeployOutcome struct {
	Method   string // ssh-copy-id | github-gh | gitlab-glab | <name>-api | manual
	Verified bool   // true == confirmed on the target
	Detail   string
	Error    bool // true == an automated deploy was attempted and FAILED
}

DeployOutcome is the result of a deploy attempt. Mirrors base.DeployOutcome.

type GenericSSH

type GenericSSH struct {
	// contains filtered or unexported fields
}

GenericSSH is the universal fallback: ssh-copy-id / authorized_keys on any reachable server. Ports providers.ssh_generic.GenericSSH.

func (GenericSSH) Category

func (g GenericSSH) Category() string

func (GenericSSH) Deploy

func (g GenericSSH) Deploy(t Target) DeployOutcome

func (GenericSSH) ListDeployed

func (g GenericSSH) ListDeployed(t Target) []string

func (GenericSSH) ManageURL

func (g GenericSSH) ManageURL(Target) string

func (GenericSSH) Name

func (g GenericSSH) Name() string

func (GenericSSH) Remove

func (g GenericSSH) Remove(t Target) bool

func (GenericSSH) Rename

func (GenericSSH) Rename(Target, string) bool

func (GenericSSH) Verify

func (g GenericSSH) Verify(t Target) bool

type GitHub

type GitHub struct {
	// contains filtered or unexported fields
}

GitHub manages account keys via the gh CLI (github.com and GHES). Ports providers.github.GitHub.

func (GitHub) Category

func (g GitHub) Category() string

func (GitHub) Deploy

func (g GitHub) Deploy(t Target) DeployOutcome

func (GitHub) ListDeployed

func (g GitHub) ListDeployed(t Target) []string

func (GitHub) ManageURL

func (g GitHub) ManageURL(Target) string

func (GitHub) Name

func (g GitHub) Name() string

func (GitHub) Remove

func (g GitHub) Remove(t Target) bool

func (GitHub) Rename

func (GitHub) Rename(Target, string) bool

func (GitHub) Verify

func (g GitHub) Verify(t Target) bool

Verify confirms the key is on the account and, where both can be read, that GitHub authenticates it as that same account.

The account check matters for a machine user: the key is added with whatever token token_env names, and a token for the wrong account (a personal one left in GH_TOKEN_SIMTABI) would add it there and still pass a "key is listed" check - the alias would then push as the wrong identity. So when the API login and the ssh greeting are both available they must agree. Either one missing (no network for ssh, no API) falls back to the check that remains.

type GitLab

type GitLab struct {
	// contains filtered or unexported fields
}

GitLab manages account keys via the glab CLI. Ports providers.gitlab.GitLab.

func (GitLab) Category

func (g GitLab) Category() string

func (GitLab) Deploy

func (g GitLab) Deploy(t Target) DeployOutcome

func (GitLab) ListDeployed

func (g GitLab) ListDeployed(t Target) []string

func (GitLab) ManageURL

func (g GitLab) ManageURL(Target) string

func (GitLab) Name

func (g GitLab) Name() string

func (GitLab) Remove

func (g GitLab) Remove(t Target) bool

func (GitLab) Rename

func (GitLab) Rename(Target, string) bool

func (GitLab) Verify

func (g GitLab) Verify(t Target) bool

type Info

type Info struct {
	Name         string
	Kind         string
	Category     string
	TokenEnv     string
	TokenPresent bool
}

Info is a configured provider and whether its credential is present right now. Mirrors facade.ProviderInfo.

func List

func List(providersFile string, getenv func(string) string) []Info

List returns every configured provider, sorted by name, with live credential presence resolved via getenv (pass os.Getenv). Mirrors facade.list_providers.

type Provider

type Provider interface {
	Deploy(Target) DeployOutcome
	Verify(Target) bool
	ListDeployed(Target) []string
	Remove(Target) bool
	Rename(Target, string) bool
	ManageURL(Target) string // "" == none
	Name() string
	Category() string
}

Provider installs / verifies / revokes a public key on a target. Mirrors the providers.base.Provider strategy interface.

func Resolve

func Resolve(name, providersFile string) Provider

Resolve resolves a provider name to an adapter instance for its spec. An empty or unknown name yields the generic-SSH fallback. Mirrors registry.resolve.

type RemoteKey

type RemoteKey struct {
	ID, Name, Body string
}

RemoteKey is one key as listed by a provider's API.

type Spec

type Spec struct {
	Name     string
	Kind     string // github | gitlab | gitea | web-panel | ssh | rest | ...
	Category string // vcs | panel | server | vps | generic
	Host     string
	APIBase  string
	KeysURL  string // explicit override; else derived from kind+host
	CLI      string // gh | glab
	TokenEnv string
	Rest     map[string]any // generic REST config (kind 'rest')
}

Spec is one provider instance: a service (cloud or self-hosted) a public key can be deployed to. Mirrors providers.base.ProviderSpec.

func (Spec) ResolvedKeysURL

func (s Spec) ResolvedKeysURL() string

ResolvedKeysURL is the best-effort "add an SSH key" page (explicit, else derived).

type Target

type Target struct {
	Alias        string
	Hostname     string
	User         string
	PubkeyPath   string
	PubkeyText   string
	Port         int
	TokenEnv     string // "" == none
	IdentityPath string // private key for verify; "" == none
	// IdentityAgent is the agent holding the key when IdentityPath is a public
	// key (a key kept in 1Password); "" == the key is a file.
	IdentityAgent string
	KnownHosts    string // per-profile known_hosts; "" == none
	// Unattended is set when nobody can answer a prompt - a deploy started
	// from the web UI. ssh and ssh-copy-id then run with stdin closed and
	// BatchMode=yes, so a password prompt fails at once instead of reaching
	// the terminal sshmgr serve was started from, and their output goes
	// here. nil keeps the terminal, where a password can be typed (W12).
	Unattended io.Writer
}

Target is everything a provider needs to act on one host (resolved from the manifest). Mirrors providers.base.Target.

func (Target) SSHDest

func (t Target) SSHDest() string

SSHDest is user@hostname.

Jump to

Keyboard shortcuts

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