Documentation
¶
Overview ¶
Package cli provides command-line interface utilities for ServiceRadar configuration management.
Index ¶
- Variables
- func ErrUnknownAdminResource(resource string) error
- func GenerateTLSCerts(cfg *CmdConfig) error
- func IsInputFromTerminal() bool
- func RunAdminNatsAccounts(cfg *CmdConfig) error
- func RunAdminNatsCommand(cfg *CmdConfig) error
- func RunAdminNatsGenerateBootstrapToken(cfg *CmdConfig) error
- func RunAdminNatsStatus(cfg *CmdConfig) error
- func RunBcryptNonInteractive(args []string) error
- func RunEdgeCommand(cfg *CmdConfig) error
- func RunEdgePackageCreate(cfg *CmdConfig) error
- func RunEdgePackageDownload(cfg *CmdConfig) error
- func RunEdgePackageList(cfg *CmdConfig) error
- func RunEdgePackageRevoke(cfg *CmdConfig) error
- func RunEdgePackageShow(cfg *CmdConfig) error
- func RunEdgePackageToken(cfg *CmdConfig) error
- func RunEnroll(cfg *CmdConfig) error
- func RunGenerateJWTKeys(cfg *CmdConfig) error
- func RunGenerateJWTKeysCmd(cfg *CmdConfig) error
- func RunGenerateTLS(cfg *CmdConfig) error
- func RunInteractive() error
- func RunNatsBootstrap(cfg *CmdConfig) error
- func RunSpireJoinToken(cfg *CmdConfig) error
- func RunUpdateConfig(configFile, adminHash, dbPasswordFile string) error
- func RunUpdateGateway(cfg *CmdConfig) error
- func ShowHelp()
- type AdminHandler
- type AdminNatsBootstrapTokenHandler
- type AdminNatsHandler
- type AgentConfig
- type CheckConfig
- type CmdConfig
- type EdgeHandler
- type EdgePackageDownloadHandler
- type EdgePackageRevokeHandler
- type EdgePackageTokenHandler
- type EnrollHandler
- type GatewayConfig
- type GenerateJWTKeysHandler
- type GenerateTLSHandler
- type NatsBootstrapHandler
- type SpireJoinTokenHandler
- type SubcommandHandler
- type UpdateConfigHandler
- type UpdateGatewayHandler
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidIPFormat indicates an invalid IP address format was provided. ErrInvalidIPFormat = errors.New("invalid IP address format") ErrRootCAExists = errors.New("root CA already exists") ErrInvalidIPAddress = errors.New("invalid IP address") ErrSettingOwnership = errors.New("failed to set ownership") ErrInvalidUIDGID = errors.New("failed to get UID/GID for user") ErrChownFailed = errors.New("failed to set file ownership") ErrCertNotFound = errors.New("no existing certificate found") ErrDecodeCertPEM = errors.New("failed to decode certificate PEM") ErrDecodeRootCAKeyPEM = errors.New("failed to decode root CA key PEM") )
Functions ¶
func ErrUnknownAdminResource ¶
ErrUnknownAdminResource returns a wrapped error for unknown admin resources.
func GenerateTLSCerts ¶
GenerateTLSCerts generates mTLS certificates for ServiceRadar components.
func IsInputFromTerminal ¶
func IsInputFromTerminal() bool
IsInputFromTerminal determines if input is coming from a terminal or being piped/redirected.
func RunAdminNatsAccounts ¶
RunAdminNatsAccounts lists all NATS accounts.
func RunAdminNatsCommand ¶
RunAdminNatsCommand dispatches admin nats subcommands.
func RunAdminNatsGenerateBootstrapToken ¶
RunAdminNatsGenerateBootstrapToken generates a new platform bootstrap token.
func RunAdminNatsStatus ¶
RunAdminNatsStatus retrieves the current NATS operator status.
func RunBcryptNonInteractive ¶
RunBcryptNonInteractive handles non-interactive bcrypt generation.
func RunEdgeCommand ¶
RunEdgeCommand dispatches multi-level `edge ...` invocations.
func RunEdgePackageCreate ¶
RunEdgePackageCreate provisions a new onboarding package via the Core API.
func RunEdgePackageDownload ¶
RunEdgePackageDownload calls the admin API to retrieve onboarding artifacts.
func RunEdgePackageList ¶
RunEdgePackageList retrieves package summaries from the Core API.
func RunEdgePackageRevoke ¶
RunEdgePackageRevoke calls the admin API to revoke an onboarding package.
func RunEdgePackageShow ¶
RunEdgePackageShow fetches a single package record.
func RunEdgePackageToken ¶
RunEdgePackageToken emits an edgepkg-v1 token for use as ONBOARDING_TOKEN.
func RunGenerateJWTKeys ¶
RunGenerateJWTKeys generates an RSA keypair and updates core.json auth config.
func RunGenerateJWTKeysCmd ¶
RunGenerateJWTKeys handles the generate-jwt-keys subcommand.
func RunGenerateTLS ¶
RunGenerateTLS handles the generate-tls subcommand.
func RunNatsBootstrap ¶
RunNatsBootstrap executes the NATS bootstrap process.
func RunSpireJoinToken ¶
RunSpireJoinToken executes the spire-join-token subcommand.
func RunUpdateConfig ¶
RunUpdateConfig handles the update-config subcommand.
func RunUpdateGateway ¶
RunUpdateGateway handles the update-gateway subcommand.
Types ¶
type AdminHandler ¶
type AdminHandler struct{}
AdminHandler handles multi-level `admin ...` commands.
type AdminNatsBootstrapTokenHandler ¶
type AdminNatsBootstrapTokenHandler struct{}
AdminNatsBootstrapTokenHandler handles generating a new bootstrap token.
type AdminNatsHandler ¶
type AdminNatsHandler struct{}
AdminNatsHandler handles multi-level `admin nats ...` commands.
type AgentConfig ¶
type AgentConfig struct {
Address string `json:"address"`
Checks []CheckConfig `json:"checks"`
Security json.RawMessage `json:"security,omitempty"`
}
AgentConfig represents a subset of agent configuration.
type CheckConfig ¶
type CheckConfig struct {
ServiceType string `json:"service_type"`
ServiceName string `json:"service_name"`
Details string `json:"details,omitempty"`
Port int32 `json:"port,omitempty"`
}
CheckConfig represents a service check configuration.
type CmdConfig ¶
type CmdConfig struct {
Help bool
SubCmd string
EdgeCommand string
ConfigFile string
AdminHash string
DBPasswordFile string
GatewayFile string
Action string
Agent string
ServiceType string
ServiceName string
ServiceDetails string
ServicePort int32
EnableAllOnInit bool
Args []string
IPS string
CertDir string
AddIPs bool
NonInteractive bool
Components []string
// JWT key generation
JWTKeyBits int
JWTKeyID string
JWTForce bool
CoreAPIURL string
APIKey string
BearerToken string
TLSSkipVerify bool
JoinTokenTTLSeconds int
AgentSPIFFEID string
DownstreamSPIFFEID string
DownstreamSelectors []string
DownstreamX509TTLSeconds int
DownstreamJWTTTLSeconds int
DownstreamAdmin bool
DownstreamStoreSVID bool
DownstreamDNSNames []string
DownstreamFederates []string
NoDownstream bool
JoinTokenOutput string
EdgePackageID string
EdgePackageDownloadToken string
EdgePackageOutput string
EdgePackageReason string
EdgePackageAction string
EdgePackageFormat string
EdgePackageLabel string
EdgePackageComponentID string
EdgePackageComponentType string
EdgePackageParentType string
EdgePackageParentID string
EdgePackageGatewayID string
EdgePackageSite string
EdgePackageSelectors []string
EdgePackageMetadata string
EdgePackageMetadataMap map[string]string
EdgePackageNotes string
EdgePackageCheckerKind string
EdgePackageCheckerConfig string
EdgePackageDataSvc string
EdgePackageDownstreamID string
EdgePackageLimit int
EdgePackageStatuses []string
EdgePackageTypes []string
EdgePackageComponentFilter string
EdgePackageParentFilter string
EdgePackageGatewayFilter string
EdgeOutputFormat string
EdgePackageReissueToken bool
EdgeJoinTTLSeconds int
EdgeDownloadTTLSeconds int
EnrollToken string
EnrollCoreURL string
EnrollHostIP string
EnrollConfigPath string
EnrollConfigDir string
EnrollConfigFile string
EnrollCertDir string
EnrollCredsDir string
EnrollForce bool
EnrollInsecure bool
EnrollCAFile string
// NATS bootstrap configuration
NATSBootstrapToken string
NATSOutputDir string
NATSOperatorName string
NATSImportSeed string
NATSVerifyMode bool
NATSConfigPath string
NATSNoSystemAccount bool
NATSJetStream bool
NATSJetStreamDir string
NATSTLSCert string
NATSTLSKey string
NATSTLSCA string
NATSNoTLS bool
NATSOutputFormat string
NATSBootstrapExpires string
NATSLocalBootstrap bool
NATSWriteSystemCreds bool
NATSWritePlatform bool
NATSPlatformAccount string
NATSPlatformUser string
NATSSystemUser string
NATSAccountLimit int
AdminNatsAction string
AdminCommand string
}
CmdConfig holds parsed command-line configuration.
func ParseFlags ¶
ParseFlags parses command-line flags and subcommands
type EdgePackageDownloadHandler ¶
type EdgePackageDownloadHandler struct{}
EdgePackageDownloadHandler handles flags for downloading onboarding artifacts.
type EdgePackageRevokeHandler ¶
type EdgePackageRevokeHandler struct{}
EdgePackageRevokeHandler handles flags for revoking onboarding packages.
type EdgePackageTokenHandler ¶
type EdgePackageTokenHandler struct{}
EdgePackageTokenHandler handles flags for emitting structured onboarding tokens.
type EnrollHandler ¶
type EnrollHandler struct{}
EnrollHandler handles flags for the enroll command.
type GatewayConfig ¶
type GatewayConfig struct {
Agents map[string]AgentConfig `json:"agents"`
CoreAddress string `json:"core_address"`
ListenAddr string `json:"listen_addr"`
PollInterval string `json:"poll_interval"`
GatewayID string `json:"gateway_id"`
Partition string `json:"partition"`
ServiceName string `json:"service_name"`
ServiceType string `json:"service_type"`
Security json.RawMessage `json:"security,omitempty"`
}
GatewayConfig represents a subset of the gateway configuration.
type GenerateJWTKeysHandler ¶
type GenerateJWTKeysHandler struct{}
GenerateJWTKeysHandler handles flags for the generate-jwt-keys subcommand.
type GenerateTLSHandler ¶
type GenerateTLSHandler struct{}
GenerateTLSHandler handles flags for the generate-tls subcommand
type NatsBootstrapHandler ¶
type NatsBootstrapHandler struct{}
NatsBootstrapHandler handles flags for the nats-bootstrap subcommand.
type SpireJoinTokenHandler ¶
type SpireJoinTokenHandler struct{}
SpireJoinTokenHandler handles flags for the spire-join-token subcommand.
type SubcommandHandler ¶
SubcommandHandler defines the interface for parsing subcommand flags.
type UpdateConfigHandler ¶
type UpdateConfigHandler struct{}
UpdateConfigHandler handles flags for the update-config subcommand.
type UpdateGatewayHandler ¶
type UpdateGatewayHandler struct{}
UpdateGatewayHandler handles flags for the update-gateway subcommand