Documentation
¶
Index ¶
- Constants
- func GetAPIKey() (string, error)
- func GetClientOptions() ([]option.RequestOption, error)
- func GetConfigPath() (string, error)
- func GetOrCreateSSHKey(vmID string, client *vers.Client, apiCtx context.Context) (string, error)
- func GetVersUrl() (*url.URL, error)
- func HasAPIKey() (bool, error)
- func PromptForLogin() error
- func SaveAPIKey(apiKey string) error
- func SaveConfig(config *Config) error
- type Config
- type SSHKeyResponse
Constants ¶
const DEFAULT_VERS_URL_STR = "https://api.vers.sh"
Variables ¶
This section is empty.
Functions ¶
func GetClientOptions ¶
func GetClientOptions() ([]option.RequestOption, error)
GetClientOptions returns the options for the SDK client
func GetConfigPath ¶
GetConfigPath returns the path to the .versrc file in the user's home directory
func GetOrCreateSSHKey ¶
GetOrCreateSSHKey retrieves the path to an SSH key, fetching and saving it if necessary. It returns the path to the key file and an error if any occurred.
func GetVersUrl ¶
GetVersUrl returns the full URL with protocol validation
func PromptForLogin ¶
func PromptForLogin() error
PromptForLogin creates a helper function that checks for API key and prompts for login if not found
func SaveAPIKey ¶
SaveAPIKey saves the API key to the config file
func SaveConfig ¶
SaveConfig saves the configuration to the .versrc file
Types ¶
type Config ¶
type Config struct {
APIKey string `json:"apiKey"`
}
Config represents the structure of the .versrc file
func LoadConfig ¶
LoadConfig loads the configuration from the .versrc file
type SSHKeyResponse ¶ added in v0.5.0
type SSHKeyResponse struct {
SSHPrivateKey string `json:"ssh_private_key"`
SSHPort int `json:"ssh_port"`
}
SSHKeyResponse represents the API response for VM SSH key