Documentation
¶
Overview ¶
Package devenv provides development environment management commands. This includes backup and restore functionality for AWS, GCP, Azure, Docker, Kubernetes, and SSH configurations.
Index ¶
- func NewDevEnvCmd(appCtx *app.AppContext) *cobra.Command
- func RegisterDevEnvCmd(appCtx *app.AppContext)
- type AWSProfile
- type AWSProfileManager
- type AWSSwitcher
- type AzureSubscription
- type AzureSubscriptionManager
- type AzureSwitcher
- type BaseCommand
- func (bc *BaseCommand) CreateListCommand() *cobra.Command
- func (bc *BaseCommand) CreateLoadCommand() *cobra.Command
- func (bc *BaseCommand) CreateMainCommand() *cobra.Command
- func (bc *BaseCommand) CreateSaveCommand() *cobra.Command
- func (bc *BaseCommand) DefaultOptions() *BaseOptions
- func (bc *BaseCommand) ListConfigs(opts *BaseOptions) error
- func (bc *BaseCommand) LoadConfig(opts *BaseOptions) error
- func (bc *BaseCommand) SaveConfig(opts *BaseOptions) error
- type BaseOptions
- type ConfigMetadata
- type DockerSwitcher
- type EnhancedSSHCommand
- func (c *EnhancedSSHCommand) CreateEnhancedListCommand() *cobra.Command
- func (c *EnhancedSSHCommand) CreateEnhancedLoadCommand() *cobra.Command
- func (c *EnhancedSSHCommand) CreateEnhancedSaveCommand() *cobra.Command
- func (c *EnhancedSSHCommand) CreateInstallKeyCommand() *cobra.Command
- func (c *EnhancedSSHCommand) CreateInstallKeySimpleCommand() *cobra.Command
- func (c *EnhancedSSHCommand) CreateListKeysCommand() *cobra.Command
- func (c *EnhancedSSHCommand) DefaultEnhancedOptions() *EnhancedSSHOptions
- func (c *EnhancedSSHCommand) ListEnhancedConfigs(opts *EnhancedSSHOptions) error
- func (c *EnhancedSSHCommand) LoadEnhancedConfig(opts *EnhancedSSHOptions) error
- func (c *EnhancedSSHCommand) SaveEnhancedConfig(opts *EnhancedSSHOptions) error
- type EnhancedSSHMetadata
- type EnhancedSSHOptions
- type GCPConfiguration
- type GCPProject
- type GCPProjectManager
- type GCPServiceAccount
- type GCPServiceAccountKey
- type GCPServiceAccountManager
- type GCPSwitcher
- type InstallOptions
- type InstallResult
- type KubernetesSwitcher
- func (k *KubernetesSwitcher) GetCurrentState(ctx context.Context) (interface{}, error)
- func (k *KubernetesSwitcher) Name() string
- func (k *KubernetesSwitcher) Rollback(ctx context.Context, previousState interface{}) error
- func (k *KubernetesSwitcher) Switch(ctx context.Context, config interface{}) error
- type ParsedSSHConfig
- type SSHConfigParser
- type SSHKeyInstaller
- type SSHSwitcher
- type SimpleSSHInstaller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDevEnvCmd ¶
func NewDevEnvCmd(appCtx *app.AppContext) *cobra.Command
NewDevEnvCmd creates the development environment command.
func RegisterDevEnvCmd ¶
func RegisterDevEnvCmd(appCtx *app.AppContext)
Types ¶
type AWSProfile ¶
type AWSProfile struct { Name string `json:"name"` Region string `json:"region"` Output string `json:"output"` SourceProfile string `json:"sourceProfile,omitempty"` RoleArn string `json:"roleArn,omitempty"` MFASerial string `json:"mfaSerial,omitempty"` SSOStartURL string `json:"ssoStartUrl,omitempty"` SSORoleName string `json:"ssoRoleName,omitempty"` SSOAccountID string `json:"ssoAccountId,omitempty"` SSORegion string `json:"ssoRegion,omitempty"` CredentialProcess string `json:"credentialProcess,omitempty"` ExternalID string `json:"externalId,omitempty"` DurationSeconds int `json:"durationSeconds,omitempty"` Tags map[string]string `json:"tags,omitempty"` LastUsed *time.Time `json:"lastUsed,omitempty"` IsActive bool `json:"isActive"` }
AWSProfile represents an AWS profile configuration.
type AWSProfileManager ¶
type AWSProfileManager struct {
// contains filtered or unexported fields
}
AWSProfileManager manages AWS profiles.
func NewAWSProfileManager ¶
func NewAWSProfileManager(ctx context.Context) (*AWSProfileManager, error)
NewAWSProfileManager creates a new AWS profile manager.
func (*AWSProfileManager) GetProfile ¶
func (m *AWSProfileManager) GetProfile(name string) (*AWSProfile, error)
GetProfile returns a specific profile.
func (*AWSProfileManager) ListProfiles ¶
func (m *AWSProfileManager) ListProfiles() []*AWSProfile
ListProfiles returns all AWS profiles.
func (*AWSProfileManager) LoginSSO ¶
func (m *AWSProfileManager) LoginSSO(profileName string) error
LoginSSO performs SSO login for a profile.
func (*AWSProfileManager) SwitchProfile ¶
func (m *AWSProfileManager) SwitchProfile(profileName string) error
SwitchProfile switches to a different AWS profile.
type AWSSwitcher ¶
type AWSSwitcher struct{}
AWSSwitcher implements ServiceSwitcher for AWS.
func (*AWSSwitcher) GetCurrentState ¶
func (a *AWSSwitcher) GetCurrentState(ctx context.Context) (interface{}, error)
func (*AWSSwitcher) Name ¶
func (a *AWSSwitcher) Name() string
type AzureSubscription ¶
type AzureSubscription struct { ID string `json:"id"` DisplayName string `json:"displayName"` Name string `json:"name"` State string `json:"state"` TenantID string `json:"tenantId"` TenantDisplayName string `json:"tenantDisplayName"` User string `json:"user"` IsDefault bool `json:"isDefault"` IsActive bool `json:"isActive"` LastUsed *time.Time `json:"lastUsed,omitempty"` Tags map[string]string `json:"tags,omitempty"` ResourceGroups []string `json:"resourceGroups,omitempty"` Regions []string `json:"regions,omitempty"` EnvironmentName string `json:"environmentName"` HomeTenantID string `json:"homeTenantId"` ManagedByTenants []string `json:"managedByTenants,omitempty"` }
AzureSubscription represents an Azure subscription configuration.
type AzureSubscriptionManager ¶
type AzureSubscriptionManager struct {
// contains filtered or unexported fields
}
AzureSubscriptionManager manages Azure subscriptions and configurations.
func NewAzureSubscriptionManager ¶
func NewAzureSubscriptionManager(ctx context.Context) (*AzureSubscriptionManager, error)
NewAzureSubscriptionManager creates a new Azure subscription manager.
type AzureSwitcher ¶
type AzureSwitcher struct{}
AzureSwitcher implements ServiceSwitcher for Azure.
func (*AzureSwitcher) GetCurrentState ¶
func (a *AzureSwitcher) GetCurrentState(ctx context.Context) (interface{}, error)
func (*AzureSwitcher) Name ¶
func (a *AzureSwitcher) Name() string
type BaseCommand ¶
type BaseCommand struct {
// contains filtered or unexported fields
}
BaseCommand provides common functionality for dev-env commands.
func NewBaseCommand ¶
func NewBaseCommand(serviceName, configFileName, defaultConfig, description string, examples []string) *BaseCommand
NewBaseCommand creates a new base command instance.
func (*BaseCommand) CreateListCommand ¶
func (bc *BaseCommand) CreateListCommand() *cobra.Command
CreateListCommand creates the list subcommand.
func (*BaseCommand) CreateLoadCommand ¶
func (bc *BaseCommand) CreateLoadCommand() *cobra.Command
CreateLoadCommand creates the load subcommand.
func (*BaseCommand) CreateMainCommand ¶
func (bc *BaseCommand) CreateMainCommand() *cobra.Command
CreateMainCommand creates the main command for the service.
func (*BaseCommand) CreateSaveCommand ¶
func (bc *BaseCommand) CreateSaveCommand() *cobra.Command
CreateSaveCommand creates the save subcommand.
func (*BaseCommand) DefaultOptions ¶
func (bc *BaseCommand) DefaultOptions() *BaseOptions
DefaultOptions returns default options for the service.
func (*BaseCommand) ListConfigs ¶
func (bc *BaseCommand) ListConfigs(opts *BaseOptions) error
ListConfigs lists saved configurations.
func (*BaseCommand) LoadConfig ¶
func (bc *BaseCommand) LoadConfig(opts *BaseOptions) error
LoadConfig loads a saved configuration.
func (*BaseCommand) SaveConfig ¶
func (bc *BaseCommand) SaveConfig(opts *BaseOptions) error
SaveConfig saves the current configuration.
type BaseOptions ¶
type BaseOptions struct { Name string Description string ConfigPath string StorePath string Force bool ListAll bool }
BaseOptions represents common options for dev-env commands.
type ConfigMetadata ¶
type ConfigMetadata struct { Description string `json:"description"` SavedAt time.Time `json:"saved_at"` SourcePath string `json:"source_path"` }
ConfigMetadata represents metadata for saved configurations.
type DockerSwitcher ¶
type DockerSwitcher struct{}
DockerSwitcher implements ServiceSwitcher for Docker.
func (*DockerSwitcher) GetCurrentState ¶
func (d *DockerSwitcher) GetCurrentState(ctx context.Context) (interface{}, error)
func (*DockerSwitcher) Name ¶
func (d *DockerSwitcher) Name() string
type EnhancedSSHCommand ¶
type EnhancedSSHCommand struct{}
EnhancedSSHCommand provides enhanced SSH configuration management
func NewEnhancedSSHCommand ¶
func NewEnhancedSSHCommand() *EnhancedSSHCommand
NewEnhancedSSHCommand creates a new enhanced SSH command instance
func (*EnhancedSSHCommand) CreateEnhancedListCommand ¶
func (c *EnhancedSSHCommand) CreateEnhancedListCommand() *cobra.Command
CreateEnhancedListCommand creates the enhanced list command
func (*EnhancedSSHCommand) CreateEnhancedLoadCommand ¶
func (c *EnhancedSSHCommand) CreateEnhancedLoadCommand() *cobra.Command
CreateEnhancedLoadCommand creates the enhanced load command
func (*EnhancedSSHCommand) CreateEnhancedSaveCommand ¶
func (c *EnhancedSSHCommand) CreateEnhancedSaveCommand() *cobra.Command
CreateEnhancedSaveCommand creates the enhanced save command
func (*EnhancedSSHCommand) CreateInstallKeyCommand ¶
func (c *EnhancedSSHCommand) CreateInstallKeyCommand() *cobra.Command
CreateInstallKeyCommand creates the install-key command for SSH
func (*EnhancedSSHCommand) CreateInstallKeySimpleCommand ¶
func (c *EnhancedSSHCommand) CreateInstallKeySimpleCommand() *cobra.Command
CreateInstallKeySimpleCommand creates a simple install-key command using system SSH
func (*EnhancedSSHCommand) CreateListKeysCommand ¶
func (c *EnhancedSSHCommand) CreateListKeysCommand() *cobra.Command
CreateListKeysCommand creates the list-keys command to show available keys
func (*EnhancedSSHCommand) DefaultEnhancedOptions ¶
func (c *EnhancedSSHCommand) DefaultEnhancedOptions() *EnhancedSSHOptions
DefaultEnhancedOptions returns default options for enhanced SSH commands
func (*EnhancedSSHCommand) ListEnhancedConfigs ¶
func (c *EnhancedSSHCommand) ListEnhancedConfigs(opts *EnhancedSSHOptions) error
ListEnhancedConfigs lists saved SSH configurations
func (*EnhancedSSHCommand) LoadEnhancedConfig ¶
func (c *EnhancedSSHCommand) LoadEnhancedConfig(opts *EnhancedSSHOptions) error
LoadEnhancedConfig loads a saved SSH configuration
func (*EnhancedSSHCommand) SaveEnhancedConfig ¶
func (c *EnhancedSSHCommand) SaveEnhancedConfig(opts *EnhancedSSHOptions) error
SaveEnhancedConfig saves the SSH configuration with includes and keys
type EnhancedSSHMetadata ¶
type EnhancedSSHMetadata struct { Description string `json:"description"` SavedAt time.Time `json:"saved_at"` SourcePath string `json:"source_path"` IncludeFiles []string `json:"include_files"` PrivateKeys []string `json:"private_keys"` PublicKeys []string `json:"public_keys"` HasIncludes bool `json:"has_includes"` HasKeys bool `json:"has_keys"` }
EnhancedSSHMetadata represents metadata for saved SSH configurations
type EnhancedSSHOptions ¶
type EnhancedSSHOptions struct { Name string Description string ConfigPath string StorePath string Force bool ListAll bool IncludeKeys bool IncludePublic bool }
EnhancedSSHOptions represents options for enhanced SSH commands
type GCPConfiguration ¶
type GCPConfiguration struct { Name string `json:"name"` Project string `json:"project"` Account string `json:"account"` Region string `json:"region"` Zone string `json:"zone"` IsActive bool `json:"isActive"` PropertiesPath string `json:"propertiesPath"` }
GCPConfiguration represents a gcloud configuration.
type GCPProject ¶
type GCPProject struct { ID string `json:"id"` Name string `json:"name"` Number string `json:"number"` LifecycleState string `json:"lifecycleState"` Account string `json:"account"` Region string `json:"region"` Zone string `json:"zone"` Configuration string `json:"configuration"` ServiceAccount string `json:"serviceAccount,omitempty"` BillingAccount string `json:"billingAccount,omitempty"` IsActive bool `json:"isActive"` LastUsed *time.Time `json:"lastUsed,omitempty"` Tags map[string]string `json:"tags,omitempty"` EnabledAPIs []string `json:"enabledApis,omitempty"` IAMPermissions []string `json:"iamPermissions,omitempty"` }
GCPProject represents a GCP project configuration.
type GCPProjectManager ¶
type GCPProjectManager struct {
// contains filtered or unexported fields
}
GCPProjectManager manages GCP projects and configurations.
func NewGCPProjectManager ¶
func NewGCPProjectManager(ctx context.Context) (*GCPProjectManager, error)
NewGCPProjectManager creates a new GCP project manager.
type GCPServiceAccount ¶
type GCPServiceAccount struct { Email string `json:"email"` Name string `json:"name"` DisplayName string `json:"displayName"` ProjectID string `json:"projectId"` UniqueID string `json:"uniqueId"` Description string `json:"description"` Disabled bool `json:"disabled"` OAuth2ClientID string `json:"oauth2ClientId"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` KeyCount int `json:"keyCount"` IsActive bool `json:"isActive"` }
GCPServiceAccount represents a GCP service account.
type GCPServiceAccountKey ¶
type GCPServiceAccountKey struct { Name string `json:"name"` PrivateKeyType string `json:"privateKeyType"` KeyAlgorithm string `json:"keyAlgorithm"` PrivateKeyData string `json:"privateKeyData"` ValidAfterTime time.Time `json:"validAfterTime"` ValidBeforeTime time.Time `json:"validBeforeTime"` KeyOrigin string `json:"keyOrigin"` KeyType string `json:"keyType"` }
GCPServiceAccountKey represents a service account key.
type GCPServiceAccountManager ¶
type GCPServiceAccountManager struct {
// contains filtered or unexported fields
}
GCPServiceAccountManager manages service accounts.
func NewGCPServiceAccountManager ¶
func NewGCPServiceAccountManager(ctx context.Context, projectID string) (*GCPServiceAccountManager, error)
NewGCPServiceAccountManager creates a new service account manager.
type GCPSwitcher ¶
type GCPSwitcher struct{}
GCPSwitcher implements ServiceSwitcher for GCP.
func (*GCPSwitcher) GetCurrentState ¶
func (g *GCPSwitcher) GetCurrentState(ctx context.Context) (interface{}, error)
func (*GCPSwitcher) Name ¶
func (g *GCPSwitcher) Name() string
type InstallOptions ¶
type InstallOptions struct { Host string Port string User string PublicKeyPath string PrivateKeyPath string Password string Force bool DryRun bool }
InstallOptions represents options for installing SSH keys
type InstallResult ¶
InstallResult represents the result of a key installation
type KubernetesSwitcher ¶
type KubernetesSwitcher struct{}
KubernetesSwitcher implements ServiceSwitcher for Kubernetes.
func (*KubernetesSwitcher) GetCurrentState ¶
func (k *KubernetesSwitcher) GetCurrentState(ctx context.Context) (interface{}, error)
func (*KubernetesSwitcher) Name ¶
func (k *KubernetesSwitcher) Name() string
type ParsedSSHConfig ¶
type ParsedSSHConfig struct { MainConfigPath string IncludeFiles []string PrivateKeys []string PublicKeys []string }
ParsedSSHConfig represents a parsed SSH configuration
type SSHConfigParser ¶
type SSHConfigParser struct {
// contains filtered or unexported fields
}
SSHConfigParser handles parsing SSH config files and extracting includes and keys
func NewSSHConfigParser ¶
func NewSSHConfigParser(configPath string) *SSHConfigParser
NewSSHConfigParser creates a new SSH config parser
func (*SSHConfigParser) Parse ¶
func (p *SSHConfigParser) Parse() (*ParsedSSHConfig, error)
Parse parses the SSH config and returns all related files
type SSHKeyInstaller ¶
type SSHKeyInstaller struct {
// contains filtered or unexported fields
}
SSHKeyInstaller handles installing public keys to remote servers
func NewSSHKeyInstaller ¶
func NewSSHKeyInstaller() *SSHKeyInstaller
NewSSHKeyInstaller creates a new SSH key installer
func (*SSHKeyInstaller) InstallKeysFromConfig ¶
func (installer *SSHKeyInstaller) InstallKeysFromConfig(configName, host, user string, opts *InstallOptions) ([]*InstallResult, error)
InstallKeysFromConfig installs all keys from a saved SSH configuration
func (*SSHKeyInstaller) InstallPublicKey ¶
func (installer *SSHKeyInstaller) InstallPublicKey(opts *InstallOptions) (*InstallResult, error)
InstallPublicKey installs a public key to a remote server
func (*SSHKeyInstaller) SetVerbose ¶
func (installer *SSHKeyInstaller) SetVerbose(verbose bool)
SetVerbose sets the verbose mode for the installer
type SSHSwitcher ¶
type SSHSwitcher struct{}
SSHSwitcher implements ServiceSwitcher for SSH.
func (*SSHSwitcher) GetCurrentState ¶
func (s *SSHSwitcher) GetCurrentState(ctx context.Context) (interface{}, error)
func (*SSHSwitcher) Name ¶
func (s *SSHSwitcher) Name() string
type SimpleSSHInstaller ¶
type SimpleSSHInstaller struct{}
SimpleSSHInstaller uses system SSH command for installation
func NewSimpleSSHInstaller ¶
func NewSimpleSSHInstaller() *SimpleSSHInstaller
NewSimpleSSHInstaller creates a new simple SSH installer
func (*SimpleSSHInstaller) InstallPublicKeySimple ¶
func (installer *SimpleSSHInstaller) InstallPublicKeySimple(host, user, publicKeyPath string) error
InstallPublicKeySimple installs a public key using system SSH
Source Files
¶
- aws.go
- aws_credentials.go
- aws_profile.go
- azure_subscription.go
- base_command.go
- dev_env.go
- doc.go
- docker.go
- gcloud.go
- gcloud_credentials.go
- gcp_project.go
- gcp_service_account.go
- kubeconfig.go
- register.go
- service_switchers.go
- ssh.go
- ssh_enhanced.go
- ssh_install_key.go
- ssh_key_installer.go
- ssh_parser.go
- ssh_simple_installer.go
- status.go
- switch_all.go
- tui.go