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 ¶
- func AllSpecs(providersFile string) map[string]Spec
- func CategoryOf(name, providersFile string) string
- func DefaultCatalog() []byte
- type DeployOutcome
- type GenericSSH
- func (g GenericSSH) Category() string
- func (g GenericSSH) Deploy(t Target) DeployOutcome
- func (g GenericSSH) ListDeployed(t Target) []string
- func (g GenericSSH) ManageURL(Target) string
- func (g GenericSSH) Name() string
- func (g GenericSSH) Remove(t Target) bool
- func (GenericSSH) Rename(Target, string) bool
- func (g GenericSSH) Verify(t Target) bool
- type GitHub
- func (g GitHub) Category() string
- func (g GitHub) Deploy(t Target) DeployOutcome
- func (g GitHub) ListDeployed(t Target) []string
- func (g GitHub) ManageURL(Target) string
- func (g GitHub) Name() string
- func (g GitHub) Remove(t Target) bool
- func (GitHub) Rename(Target, string) bool
- func (g GitHub) Verify(t Target) bool
- type GitLab
- func (g GitLab) Category() string
- func (g GitLab) Deploy(t Target) DeployOutcome
- func (g GitLab) ListDeployed(t Target) []string
- func (g GitLab) ManageURL(Target) string
- func (g GitLab) Name() string
- func (g GitLab) Remove(t Target) bool
- func (GitLab) Rename(Target, string) bool
- func (g GitLab) Verify(t Target) bool
- type Info
- type Provider
- type RemoteKey
- type Spec
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllSpecs ¶
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 ¶
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) 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) Deploy ¶
func (g GitHub) Deploy(t Target) DeployOutcome
func (GitHub) ListDeployed ¶
func (GitHub) Verify ¶
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) Deploy ¶
func (g GitLab) Deploy(t Target) DeployOutcome
func (GitLab) ListDeployed ¶
type Info ¶
Info is a configured provider and whether its credential is present right now. Mirrors facade.ProviderInfo.
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.
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 ¶
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.