secrethub

package
v0.44.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 75 Imported by: 0

Documentation

Overview

Package secrethub provides the SecretHub CLI application.

Index

Constants

View Source
const (
	WaitTimeout = 10 * time.Minute
	WaitDelta   = 2 * time.Second
)

Constants that define the waiting periods for polling the server to check whether the credential is added.

View Source
const (
	// ApplicationName is the name of the command-line application.
	ApplicationName = "secrethub"
)
View Source
const DefaultAWSServiceDescription = "AWS role <role-name>"

Variables

View Source
var (
	ErrCredentialNotGenerated      = errMain.Code("credential_not_generated").Error("Generate a device credential first. Use the command without --continue to do so.")
	ErrCredentialAlreadyAuthorized = errMain.Code("credential_already_authorized").ErrorPref("Already started initializing for %s. Use the command with --continue to continue.")
	ErrAddCredentialTimeout        = errMain.Code("add_credential_timeout").Error("Timed out. Run again with --continue to continue initializing your account.")
	ErrAccountAlreadyInitialized   = errMain.Code("account_already_initialized").Error("This account has already been initialized. We currently do not support using an account on multiple devices.")
	ErrAccountAlreadyConnected     = errMain.Code("account_already_connected").ErrorPref("Already connected as initialized account %s.")
)

Errors

View Source
var (
	ErrParseError = errio.Namespace("cli").Code("parse_error")

	ErrMustBeUser        = errMain.Code("must_be_user").Error("you must be a user to perform this command")
	ErrCannotFindHomeDir = errMain.Code("cannot_find_home_dir").ErrorPref(
		"cannot find your home directory: %s\n\n" +
			fmt.Sprintf(
				"Usually this means your home directory is on a different volume/disk, which is common for e.g. managed workstations. "+
					"The CLI automatically attempts to create a %s config directory in your home folder. "+
					"Use the --config-dir flag or %s_CONFIG_DIR environment variable to place the configuration files in a custom location.",
				defaultProfileDirName,
				strings.ToUpper(ApplicationName),
			),
	)
	ErrInvalidConfigDirFlag       = errMain.Code("invalid_config_dir").Errorf("the path to the SecretHub configuration directory must be an absolute path and is configured with the --config-dir flag or %s_CONFIG_DIR environment variable", strings.ToUpper(ApplicationName))
	ErrRepoNameTooShort           = errMain.Code("repo_name_too_short").Error("repository names should be at least 3 characters long")
	ErrOtherNamespaceNotSupported = errMain.Code("other_namespace_not_supported").Error("creating a repository for another namespace is not yet supported")
	ErrMissingFlags               = errMain.Code("missing_flags").Error("force flag set but not all required flags set")
	ErrForceWithoutPipe           = errMain.Code("force_without_pipe").Error("force flag can only be used in conjunction with piped input")
	ErrCannotDoWithoutForce       = errMain.Code("cannot_do_without_force").Error(
		"cannot perform this action without confirmation or a --force flag.\n\n" +
			"This usually happens when you run the command in a non-Unix terminal and pipe either the input or output of the command. " +
			"If you are sure you want to perform this action, run the same command with the --force or -f flag.")
	ErrSecretAlreadyExists      = errMain.Code("already_exists").Error("the secret already exists. To overwrite it, run the same command with the --force or -f flag")
	ErrSecretNotFound           = errMain.Code("secret_not_found").ErrorPref("the secret %s does not exist")
	ErrSecretVersionNotFound    = errMain.Code("version_not_found").ErrorPref("version %s of secret %s does not exist")
	ErrResourceNotFound         = errMain.Code("resource_not_found").ErrorPref("the resource at path %s does not exist")
	ErrCannotAuditSecretVersion = errMain.Code("cannot_audit_version").Error("auditing a specific version of a secret is not yet supported")
	ErrCannotAuditDir           = errMain.Code("cannot_audit_dir").Error("auditing a specific directory is not yet supported")
	ErrInvalidAuditActor        = errMain.Code("invalid_audit_actor").Error("received an invalid audit actor")
	ErrInvalidAuditSubject      = errMain.Code("invalid_audit_subject").Error("received an invalid audit subject")
	ErrNoValidRepoOrDirPath     = errMain.Code("no_repo_or_dir").Error("no valid path to a repository or a directory was given")
	ErrNoValidRepoOrSecretPath  = errMain.Code("no_repo_or_secret").Error("no valid path to a repository or a secret was given")
	ErrCannotWrite              = errMain.Code("cannot_write").ErrorPref("cannot write to file at %s: %s")
	ErrCannotGetWorkingDir      = errMain.Code("cannot_get_working_dir").ErrorPref("cannot get the working directory: %s")
	ErrNoDataOnStdin            = errMain.Code("no_data_on_stdin").Error("expected data on stdin but none found")
	ErrFlagsConflict            = errMain.Code("flags_conflict").ErrorPref("these flags cannot be used together: %s")
	ErrFileAlreadyExists        = errMain.Code("file_already_exists").Error("file already exists")
)

Errors

View Source
var (

	// ErrInvalidRandLength is returned when an invalid length is given.
	ErrInvalidRandLength         = errGenerate.Code("invalid_rand_length").Error("The secret length must be larger than 0")
	ErrCannotUseLengthArgAndFlag = errGenerate.Code("length_arg_and_flag").Error("length cannot be provided as an argument and a flag at the same time")
	ErrCouldNotFindCharSet       = errGenerate.Code("charset_not_found").ErrorPref("could not find charset: %s")
	ErrMinFlagInvalidInteger     = errGenerate.Code("min_flag_invalid_int").ErrorPref("second part of --min flag is not an integer: %s")
	ErrInvalidMinFlag            = errGenerate.Code("min_flag_invalid").ErrorPref("min flag must be of the form <charset name>:<minimum count>, invalid min flag: %s")
)
View Source
var (
	ErrUnknownTemplateVersion = errMain.Code("unknown_template_version").ErrorPref("unknown template version: '%s' supported versions are 1, 2 and latest")
	ErrReadFile               = errMain.Code("in_file_read_error").ErrorPref("could not read the input file %s: %s")
)

Errors

View Source
var (
	ErrKeyringItemNotFound           = errMain.Code("keyring_not_found").Error("item not found in keyring")
	ErrCannotGetKeyringItem          = errMain.Code("cannot_get_keyring").ErrorPref("cannot get passphrase from keyring: %s")
	ErrCannotSetKeyringItem          = errMain.Code("cannot_set_keyring").ErrorPref("cannot set passphrase in keyring: %s")
	ErrCannotDeleteKeyringItem       = errMain.Code("cannot_delete_keyring").ErrorPref("cannot delete passphrase from keyring: %s")
	ErrCannotClearExpiredKeyringItem = errMain.Code("cannot_clear_expired_keyring_item").ErrorPref("cannot clear expired keyring item: %s")
	ErrPassphraseFlagNotSet          = errMain.Code("passphrase_not_set").Error(
		fmt.Sprintf(
			"required --key-passphrase, -p flag has not been set.\n\n"+
				"When input or output is piped, the --key-passphrase flag (or %s_KEY_PASSPHRASE env var) is required. "+
				"Please only use this if you know what you're doing and ensure your passphrase doesn't end up in bash history.",
			strings.ToUpper(ApplicationName),
		),
	)
)

Errors

View Source
var (
	ErrCannotRemoveDir     = errMain.Code("cannot_remove_dir").Error("cannot remove directory. Use the -r flag to remove directories.")
	ErrCannotRemoveRootDir = errMain.Code("cannot_remove_root_dir").Errorf(
		"cannot remove root directory. Use the repo rm command to remove a repository",
	)
)

Errors

View Source
var (
	ErrStartFailed            = errRun.Code("start_failed").ErrorPref("error while starting process: %s")
	ErrSignalFailed           = errRun.Code("signal_failed").ErrorPref("error while propagating signal to process: %s")
	ErrReadEnvDir             = errRun.Code("env_dir_read_error").ErrorPref("could not read the environment directory: %s")
	ErrReadEnvFile            = errRun.Code("env_file_read_error").ErrorPref("could not read the environment file %s: %s")
	ErrReadDefaultEnvFile     = errRun.Code("default_env_file_read_error").ErrorPref("could not read default run env-file %s: %s")
	ErrTemplate               = errRun.Code("invalid_template").ErrorPref("could not parse template at line %d: %s")
	ErrParsingTemplate        = errRun.Code("template_parsing_failed").ErrorPref("error while processing template file '%s': %s")
	ErrInvalidTemplateVar     = errRun.Code("invalid_template_var").ErrorPref("template variable '%s' is invalid: template variables may only contain uppercase letters, digits, and the '_' (underscore) and are not allowed to start with a number")
	ErrSecretsNotAllowedInKey = errRun.Code("secret_in_key").Error("secrets are not allowed in run template keys")
)

Errors

View Source
var (
	ErrInvalidAWSRegion      = errMain.Code("invalid_region").Error("invalid AWS region")
	ErrInvalidPermissionPath = errMain.Code("invalid_permission_path").ErrorPref("invalid permission path: %s")
	ErrMissingRegion         = errMain.Code("missing_region").Error("could not find AWS region. Supply using the --region flag or in the AWS configuration. See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html for the AWS configuration files")
)

Errors

View Source
var (
	ErrNoValueProvided = errService.Code("no_value_provided").Error("request value was not provided")

	ErrUnknownGroupDocker = errService.Code("unknown_group_docker").Error("could not find the user group docker. Make sure Docker is installed.")
	ErrUserNotRoot        = errService.Code("not_root").Error("this command can only be executed as root")
	ErrChownFailed        = errService.Code("chown_failed").ErrorPref("cannot change owner of %s: %s")

	ErrUnknownAuthType      = errService.Code("unknown_auth_type").Error("authentication type must be basic or cert")
	ErrCouldNotReadCA       = errService.Code("ca_read_error").ErrorPref("could not read CA file: %s")
	ErrCouldNotReadCert     = errService.Code("cert_read_error").ErrorPref("could not read Cert file: %s")
	ErrCouldNotReadKey      = errService.Code("key_read_error").ErrorPref("could not read Key file: %s")
	ErrIncorrectWinRMScheme = errService.Code("incorrect_winrm_scheme").ErrorPref("Only http or https allowed. The scheme supplied: %s")
)

Errors

View Source
var (
	ErrFileNotFound      = errMain.Code("file_not_found").ErrorPref("configuration file `%s` does not exist")
	ErrCannotReadFile    = errMain.Code("cannot_read_file").ErrorPref("cannot read file at %s: %v")
	ErrSecretsNotCleared = errMain.Code("secrets_not_cleared").Error("exiting without having cleared all secrets")
	ErrNoSourcesInSpec   = errMain.Code("no_sources_in_spec").Error("cannot find any sources in the .yml spec file")
)

Errors

View Source
var (
	Version string
	Commit  string
)

These variables are set at compile-time using ldflags when creating a build.

View Source
var DefaultServiceConfigFilemode os.FileMode = 0440

DefaultServiceConfigFilemode configures the filemode used for writing service configuration files. When changing this, make sure to update the description and default values of the flags.

View Source
var (
	ErrConfigUpgradeDropped = errMain.Code("config_upgrade_dropped").Error("This command no longer exists. config update-passphrase can be used to change the passphrase of your credential. To upgrade old configuration files, use a CLI with a version <= v0.25")
)

Errors

View Source
var (
	ErrCredentialNotExist = errMain.Code("credential_not_configured").Error("could not find credential. Go to https://signup.secrethub.io/ to create a personal account. To use the CLI as a service account, set the SECRETHUB_CREDENTIAL or SECRETHUB_IDENTITY_PROVIDER environment variable.")
)

Errors

View Source
var (
	ErrExportAlreadyExists = errMain.Code("export_file_already_exists").Error("the export file already exists")
)

Error

View Source
var ErrInspectResourceNotSupported = errMain.Code("inspect_resource_not_supported").Error("currently only inspecting repositories or secrets is supported")

ErrInspectResourceNotSupported is an error that is thrown when the inspect command is called with a path as argument that is not a repository- or secret-path.

View Source
var (
	ErrLocalAccountFound = errMain.Code("local_account_found").Error("found a local account configuration. To overwrite it, run the same command with the --force or -f flag.")
)

Errors

View Source
var (
	ErrMkDirOnRootDir = errMain.Code("mkdir_on_root_dir").Error("You cannot create a directory on the repo path. You can create subdirectories :owner/:repo_name/:directory_name.")
)

Errors

View Source
var (
	ErrUnknownIdentityProvider = errMain.Code("unknown_identity_provider").ErrorPref("%s is not a supported identity provider. Valid options are `aws`, `gcp` and `key`.")
)

Errors

Functions

func NewPassphraseReader

func NewPassphraseReader(io ui.IO, credentialPassphrase string, credentialPassphraseTTL time.Duration) credentials.Reader

NewPassphraseReader constructs a new PassphraseReader using values in the CLI.

func RegisterColorFlag

func RegisterColorFlag(app *cli.App)

RegisterColorFlag registers a color flag that configures whether colored output is used.

func RegisterDebugFlag

func RegisterDebugFlag(app *cli.App, logger cli.Logger)

RegisterDebugFlag registers a debug flag that changes the log level of the given logger to DEBUG.

func RegisterMlockFlag

func RegisterMlockFlag(app *cli.App)

RegisterMlockFlag registers a mlock flag that enables memory locking when set to true.

Types

type ACLCheckCommand

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

ACLCheckCommand prints the access level(s) on a given directory.

func NewACLCheckCommand

func NewACLCheckCommand(io ui.IO, newClient newClientFunc) *ACLCheckCommand

NewACLCheckCommand creates a new ACLCheckCommand.

func (*ACLCheckCommand) Register

func (cmd *ACLCheckCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ACLCheckCommand) Run

func (cmd *ACLCheckCommand) Run() error

Run prints the access level(s) on the given directory.

type ACLCommand

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

ACLCommand handles operations on access rules.

func NewACLCommand

func NewACLCommand(io ui.IO, newClient newClientFunc) *ACLCommand

NewACLCommand creates a new ACLCommand.

func (*ACLCommand) Register

func (cmd *ACLCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type ACLListCommand

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

ACLListCommand prints access rules for the given directory.

func NewACLListCommand

func NewACLListCommand(io ui.IO, newClient newClientFunc) *ACLListCommand

NewACLListCommand creates a new ACLListCommand.

func (*ACLListCommand) Register

func (cmd *ACLListCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ACLListCommand) Run

func (cmd *ACLListCommand) Run() error

Run prints access rules for the given directory.

type ACLRmCommand

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

ACLRmCommand handles removing an access rule.

func NewACLRmCommand

func NewACLRmCommand(io ui.IO, newClient newClientFunc) *ACLRmCommand

NewACLRmCommand creates a new ACLRmCommand.

func (*ACLRmCommand) Register

func (cmd *ACLRmCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ACLRmCommand) Run

func (cmd *ACLRmCommand) Run() error

Run removes the access rule.

type ACLSetCommand

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

ACLSetCommand is a command to set access rules.

func NewACLSetCommand

func NewACLSetCommand(io ui.IO, newClient newClientFunc) *ACLSetCommand

NewACLSetCommand creates a new ACLSetCommand.

func (*ACLSetCommand) Register

func (cmd *ACLSetCommand) Register(r cli.Registerer)

Register adds a CommandClause and it's args and flags to a Registerer. Register adds args and flags.

func (*ACLSetCommand) Run

func (cmd *ACLSetCommand) Run() error

Run handles the command with the options as specified in the command.

type AccountCommand

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

AccountCommand handles operations on SecretHub accounts.

func NewAccountCommand

func NewAccountCommand(io ui.IO, newClient newClientFunc, credentialStore CredentialConfig) *AccountCommand

NewAccountCommand creates a new AccountCommand.

func (*AccountCommand) Register

func (cmd *AccountCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type AccountEmailVerifyCommand

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

AccountEmailVerifyCommand is a command to inspect account details.

func NewAccountEmailVerifyCommand

func NewAccountEmailVerifyCommand(io ui.IO, newClient newClientFunc) *AccountEmailVerifyCommand

NewAccountEmailVerifyCommand creates a new AccountEmailVerifyCommand.

func (*AccountEmailVerifyCommand) Register

func (cmd *AccountEmailVerifyCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*AccountEmailVerifyCommand) Run

func (cmd *AccountEmailVerifyCommand) Run() error

Run handles the command with the options as specified in the command.

type AccountInitCommand

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

AccountInitCommand creates, stores and outputs a credential.

func NewAccountInitCommand

func NewAccountInitCommand(io ui.IO, newClient newClientFunc, credentialStore CredentialConfig) *AccountInitCommand

NewAccountInitCommand creates a new AccountInitCommand.

func (*AccountInitCommand) Register

func (cmd *AccountInitCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*AccountInitCommand) Run

func (cmd *AccountInitCommand) Run() error

Run creates a credential for this CLI and an account key for the credential.

type AccountInspectCommand

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

AccountInspectCommand is a command to inspect account details.

func NewAccountInspectCommand

func NewAccountInspectCommand(io ui.IO, newClient newClientFunc) *AccountInspectCommand

NewAccountInspectCommand creates a new AccountInspectCommand.

func (*AccountInspectCommand) Register

func (cmd *AccountInspectCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*AccountInspectCommand) Run

func (cmd *AccountInspectCommand) Run() error

Run handles the command with the options as specified in the command.

type App

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

App is the secrethub command-line application.

func NewApp

func NewApp() *App

NewApp creates a new command-line application.

func (*App) Run

func (app *App) Run() error

Run builds the command-line application, parses the arguments, configures global behavior and executes the command given by the args.

func (*App) Version

func (app *App) Version(version string, commit string) *App

Version adds a flag for displaying the application version number.

type AuditCommand

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

AuditCommand is a command to audit a repo or a secret.

func NewAuditCommand

func NewAuditCommand(io ui.IO, newClient newClientFunc) *AuditCommand

NewAuditCommand creates a new audit command.

func (*AuditCommand) Register

func (cmd *AuditCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*AuditCommand) Run

func (cmd *AuditCommand) Run() error

Run prints all audit events for the given repository or secret.

type ClearClipboardCommand

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

ClearClipboardCommand is a command to clear the contents of the clipboard after some time passed.

func NewClearClipboardCommand

func NewClearClipboardCommand() *ClearClipboardCommand

NewClearClipboardCommand creates a new ClearClipboardCommand.

func (*ClearClipboardCommand) Register

func (cmd *ClearClipboardCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ClearClipboardCommand) Run

func (cmd *ClearClipboardCommand) Run() error

Run handles the command with the options as specified in the command.

type ClearCommand

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

ClearCommand clears the secrets from the system.

func NewClearCommand

func NewClearCommand(io ui.IO) *ClearCommand

NewClearCommand creates a new ClearCommand.

func (*ClearCommand) Register

func (cmd *ClearCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ClearCommand) Run

func (cmd *ClearCommand) Run() error

Run clears the secrets from the system.

type ClientFactory

type ClientFactory interface {
	// NewClient returns a new SecretHub client.
	NewClient() (secrethub.ClientInterface, error)
	NewClientWithCredentials(credentials.Provider) (secrethub.ClientInterface, error)
	Register(app *cli.App)
}

ClientFactory handles creating a new client with the configured options.

func NewClientFactory

func NewClientFactory(store CredentialConfig) ClientFactory

NewClientFactory creates a new ClientFactory.

type ClipboardWriter added in v0.42.1

type ClipboardWriter interface {
	Write(data []byte) error
}

type ClipboardWriterAutoClear added in v0.42.1

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

func (*ClipboardWriterAutoClear) Write added in v0.42.1

func (clipWriter *ClipboardWriterAutoClear) Write(data []byte) error

Write writes data to the clipboard and clears it after the timeout.

type CompletionCommand added in v0.42.0

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

func NewCompletionCommand added in v0.42.0

func NewCompletionCommand() *CompletionCommand

NewCompletionCommand is a command that, when executed, generates a completion script for a specific shell, based on the argument it is provided with. It is able to generate completions for Bash, ZSh, Fish and PowerShell.

func (*CompletionCommand) Register added in v0.42.0

func (cmd *CompletionCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

type ConfigCommand

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

ConfigCommand handles operations on the SecretHub configuration.

func NewConfigCommand

func NewConfigCommand(io ui.IO, store CredentialConfig) *ConfigCommand

NewConfigCommand creates a new ConfigCommand.

func (*ConfigCommand) Register

func (cmd *ConfigCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type ConfigDir added in v0.26.0

type ConfigDir struct {
	configdir.Dir
}

func (*ConfigDir) Set added in v0.26.0

func (c *ConfigDir) Set(value string) error

func (*ConfigDir) String added in v0.26.0

func (c *ConfigDir) String() string

func (*ConfigDir) Type added in v0.42.0

func (c *ConfigDir) Type() string

type ConfigUpgradeCommand

type ConfigUpgradeCommand struct{}

func NewConfigUpgradeCommand

func NewConfigUpgradeCommand() *ConfigUpgradeCommand

func (*ConfigUpgradeCommand) Register

func (cmd *ConfigUpgradeCommand) Register(r cli.Registerer)

func (*ConfigUpgradeCommand) Run

func (cmd *ConfigUpgradeCommand) Run() error

type CredentialBackupCommand added in v0.33.0

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

CredentialBackupCommand creates a backup code to restore a credential from a code.

func NewCredentialBackupCommand added in v0.33.0

func NewCredentialBackupCommand(io ui.IO, newClient newClientFunc) *CredentialBackupCommand

NewAccountInitCommand creates a new AccountInitCommand.

func (*CredentialBackupCommand) Register added in v0.33.0

func (cmd *CredentialBackupCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*CredentialBackupCommand) Run added in v0.33.0

func (cmd *CredentialBackupCommand) Run() error

Run creates a backup code for the currently authenticated account.

type CredentialCommand added in v0.33.0

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

CredentialCommand handles operations on SecretHub credentials.

func NewCredentialCommand added in v0.33.0

func NewCredentialCommand(io ui.IO, clientFactory ClientFactory, credentialStore CredentialConfig) *CredentialCommand

NewCredentialCommand creates a new CredentialCommand.

func (*CredentialCommand) Register added in v0.33.0

func (cmd *CredentialCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type CredentialConfig added in v0.26.0

type CredentialConfig interface {
	IsPassphraseSet() bool
	Provider() credentials.Provider
	Import() (credentials.Key, error)
	ConfigDir() configdir.Dir
	PassphraseReader() credentials.Reader

	Register(app *cli.App)
}

CredentialConfig handles the configuration necessary for local credentials.

func NewCredentialConfig added in v0.26.0

func NewCredentialConfig(io ui.IO) CredentialConfig

NewCredentialConfig creates a new CredentialConfig.

type CredentialDisableCommand added in v0.33.0

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

CredentialDisableCommand is a command that allows to disable an existing credential.

func NewCredentialDisableCommand added in v0.33.0

func NewCredentialDisableCommand(io ui.IO, newClient newClientFunc) *CredentialDisableCommand

NewCredentialDisableCommand creates a new command for disabling credentials.

func (*CredentialDisableCommand) Register added in v0.33.0

func (cmd *CredentialDisableCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*CredentialDisableCommand) Run added in v0.33.0

func (cmd *CredentialDisableCommand) Run() error

Run disables an existing credential.

type CredentialListCommand added in v0.33.0

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

CredentialListCommand creates a backup code to restore a credential from a code.

func NewCredentialListCommand added in v0.33.0

func NewCredentialListCommand(io ui.IO, newClient newClientFunc) *CredentialListCommand

NewAccountInitCommand creates a new CredentialListCommand.

func (*CredentialListCommand) Register added in v0.33.0

func (cmd *CredentialListCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*CredentialListCommand) Run added in v0.33.0

func (cmd *CredentialListCommand) Run() error

Run lists all the currently authenticated account's credentials.

type CredentialUpdatePassphraseCommand added in v0.42.0

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

func NewCredentialUpdatePassphraseCommand added in v0.42.0

func NewCredentialUpdatePassphraseCommand(io ui.IO, credentialStore CredentialConfig) *CredentialUpdatePassphraseCommand

NewCredentialUpdatePassphraseCommand creates a new CredentialUpdatePassphraseCommand.

func (*CredentialUpdatePassphraseCommand) Register added in v0.42.0

Register registers the command, arguments and flags on the provided Registerer.

func (*CredentialUpdatePassphraseCommand) Run added in v0.42.0

Run upgrades the configuration in the profile directory to the new version.

type EnvCommand added in v0.36.0

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

EnvCommand handles operations regarding environment variables.

func NewEnvCommand added in v0.36.0

func NewEnvCommand(io ui.IO, newClient newClientFunc) *EnvCommand

NewEnvCommand creates a new EnvCommand.

func (*EnvCommand) Register added in v0.36.0

func (cmd *EnvCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type EnvDir

type EnvDir map[string]value

EnvDir defines environment variables sourced from files in a directory.

func NewEnvDir

func NewEnvDir(path string) (EnvDir, error)

NewEnvDir sources environment variables from files in a given directory, using the file name as key and contents as value.

type EnvFile added in v0.24.0

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

EnvFile contains an environment that is read from a file.

func ReadEnvFile added in v0.24.0

func ReadEnvFile(filepath string, reader io.Reader, varReader tpl.VariableReader, parser tpl.Parser) (EnvFile, error)

ReadEnvFile reads and parses a .env file.

type EnvFlags

type EnvFlags map[string]string

EnvFlags defines environment variables sourced from command-line flags.

func NewEnvFlags

func NewEnvFlags(flags map[string]string) (EnvFlags, error)

NewEnvFlags parses a map of flag values.

type EnvListCommand added in v0.36.0

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

EnvListCommand is a command to list all environment variable keys set in the process of `secrethub run`.

func NewEnvListCommand added in v0.36.0

func NewEnvListCommand(io ui.IO, newClient newClientFunc) *EnvListCommand

NewEnvListCommand creates a new EnvListCommand.

func (*EnvListCommand) Register added in v0.36.0

func (cmd *EnvListCommand) Register(r cli.Registerer)

Register adds a CommandClause and it's args and flags to a Registerer.

func (*EnvListCommand) Run added in v0.36.0

func (cmd *EnvListCommand) Run() error

Run executes the command.

type EnvReadCommand added in v0.36.0

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

EnvReadCommand is a command to read the value of a single environment variable.

func NewEnvReadCommand added in v0.36.0

func NewEnvReadCommand(io ui.IO, newClient newClientFunc) *EnvReadCommand

NewEnvReadCommand creates a new EnvReadCommand.

func (*EnvReadCommand) Register added in v0.36.0

func (cmd *EnvReadCommand) Register(r cli.Registerer)

Register adds a CommandClause and it's args and flags to a Registerer.

func (*EnvReadCommand) Run added in v0.36.0

func (cmd *EnvReadCommand) Run() error

Run executes the command.

type EnvSource

type EnvSource interface {
	// contains filtered or unexported methods
}

EnvSource defines a method of reading environment variables from a source.

func NewEnv added in v0.24.0

func NewEnv(filepath string, r io.Reader, varReader tpl.VariableReader, parser tpl.Parser) (EnvSource, error)

NewEnv loads an environment of key-value pairs from a string. The format of the string can be `key: value` or `key=value` pairs.

type GenerateSecretCommand

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

GenerateSecretCommand generates a new secret and writes to the output path.

func NewGenerateSecretCommand

func NewGenerateSecretCommand(io ui.IO, newClient newClientFunc) *GenerateSecretCommand

NewGenerateSecretCommand creates a new GenerateSecretCommand.

func (*GenerateSecretCommand) Register

func (cmd *GenerateSecretCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*GenerateSecretCommand) Run

func (cmd *GenerateSecretCommand) Run() error

Run generates a new secret and writes to the output path.

type InitCommand added in v0.33.0

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

InitCommand configures the user's SecretHub account for use on this machine.

func NewInitCommand added in v0.33.0

func NewInitCommand(io ui.IO, newClientWithCredentials func(credentials.Provider) (secrethub.ClientInterface, error), credentialStore CredentialConfig) *InitCommand

NewInitCommand creates a new InitCommand.

func (*InitCommand) Register added in v0.33.0

func (cmd *InitCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*InitCommand) Run added in v0.33.0

func (cmd *InitCommand) Run() error

Run configures the user's SecretHub account for use on this machine. If an account was already configured, the user is prompted for confirmation to overwrite it.

type InitMode added in v0.33.0

type InitMode int
const (
	InitModeBackupCode InitMode = iota + 1
	InitModeSetupCode
)

type InjectCommand

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

InjectCommand is a command to read a secret.

func NewInjectCommand

func NewInjectCommand(io ui.IO, newClient newClientFunc) *InjectCommand

NewInjectCommand creates a new InjectCommand.

func (*InjectCommand) Register

func (cmd *InjectCommand) Register(r cli.Registerer)

Register adds a CommandClause and it's args and flags to a cli.App. Register adds args and flags.

func (*InjectCommand) Run

func (cmd *InjectCommand) Run() error

Run handles the command with the options as specified in the command.

type InspectCommand

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

InspectCommand prints information about a repository or a secret.

func NewInspectCommand

func NewInspectCommand(io ui.IO, newClient newClientFunc) *InspectCommand

NewInspectCommand creates a new InspectCommand.

func (*InspectCommand) Register

func (cmd *InspectCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*InspectCommand) Run

func (cmd *InspectCommand) Run() error

Run inspects a repository or a secret

type InspectSecretCommand

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

InspectSecretCommand prints out a secret's details.

func NewInspectSecretCommand

func NewInspectSecretCommand(path api.SecretPath, io ui.IO, newClient newClientFunc) *InspectSecretCommand

NewInspectSecretCommand crates a new InspectSecretCommand

func (*InspectSecretCommand) Run

func (cmd *InspectSecretCommand) Run() error

Run prints out a secret's details.

type InspectSecretVersionCommand

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

InspectSecretVersionCommand prints out the details of a secret version in JSON format.

func NewInspectSecretVersionCommand

func NewInspectSecretVersionCommand(path api.SecretPath, io ui.IO, newClient newClientFunc) *InspectSecretVersionCommand

NewInspectSecretVersionCommand creates a new InspectSecretVersionCommand.

func (*InspectSecretVersionCommand) Run

Run prints out the details of a secret version.

type Keyring

type Keyring interface {
	IsAvailable() bool
	Get() (*KeyringItem, error)
	Set(item *KeyringItem) error
	Delete() error
}

Keyring is an OS-agnostic interface for setting, getting and deleting secrets from the system keyring.

func NewKeyring

func NewKeyring() Keyring

NewKeyring returns a new Keyring KeyRing only supports usernames up to 20 characters to ensure the maximum input for the macOS keyring is not achieved. There is also a limited on the maximum length of password about 900 characters, but this is ridiculously long. It is very unlikely that it is hit, and hard to fix for a system up for replacement.

type KeyringCleaner

type KeyringCleaner interface {
	// Cleanup removes an item from the keyring when it expires.
	Cleanup() error
}

KeyringCleaner is used to remove items from a keyring.

func NewKeyringCleaner

func NewKeyringCleaner() KeyringCleaner

NewKeyringCleaner returns a new KeyringCleaner.

type KeyringClearCommand

type KeyringClearCommand struct{}

KeyringClearCommand waits for the keyring item store to expire and clears it. If the process receives a kill signal it will delete the keyring item and stop.

func NewKeyringClearCommand

func NewKeyringClearCommand() *KeyringClearCommand

NewKeyringClearCommand creates a new KeyringClearCommand.

func (*KeyringClearCommand) Register

func (cmd *KeyringClearCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*KeyringClearCommand) Run

func (cmd *KeyringClearCommand) Run() error

Run waits for the keyringItem store to expire and clears it. If the process receives a kill signal it will delete the keyringItem and stop.

type KeyringItem

type KeyringItem struct {
	RunningCleanupProcess bool      `json:"running_cleanup_process,omitempty"`
	ExpiresAt             time.Time `json:"expires_at"`
	Passphrase            []byte    `json:"passphrase"`
}

KeyringItem wraps a passphrase with metadata to be stored the keyring.

func (KeyringItem) IsExpired

func (ki KeyringItem) IsExpired() bool

IsExpired returns true when the item has expired.

type LsCommand

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

LsCommand lists a repo, secret or namespace.

func NewLsCommand

func NewLsCommand(io ui.IO, newClient newClientFunc) *LsCommand

NewLsCommand creates a new LsCommand.

func (*LsCommand) Register

func (cmd *LsCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*LsCommand) Run

func (cmd *LsCommand) Run() error

Run lists a repo, secret or namespace.

type MigrateApplyCommand added in v0.42.0

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

func NewMigrateApplyCommand added in v0.42.0

func NewMigrateApplyCommand(io ui.IO, newClient newClientFunc) *MigrateApplyCommand

func (*MigrateApplyCommand) Register added in v0.42.0

func (cmd *MigrateApplyCommand) Register(r cli.Registerer)

func (*MigrateApplyCommand) Run added in v0.42.0

func (cmd *MigrateApplyCommand) Run() error

type MigrateCommand added in v0.42.0

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

func NewMigrateCommand added in v0.42.0

func NewMigrateCommand(io ui.IO, newClient newClientFunc) *MigrateCommand

func (*MigrateCommand) Register added in v0.42.0

func (cmd *MigrateCommand) Register(r cli.Registerer)

type MigrateConfigCommand added in v0.42.0

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

func NewMigrateConfigCommand added in v0.42.0

func NewMigrateConfigCommand(io ui.IO) *MigrateConfigCommand

func (*MigrateConfigCommand) Register added in v0.42.0

func (cmd *MigrateConfigCommand) Register(r cli.Registerer)

type MigrateConfigEnvfileCommand added in v0.43.0

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

func NewMigrateConfigEnvfileCommand added in v0.43.0

func NewMigrateConfigEnvfileCommand(io ui.IO) *MigrateConfigEnvfileCommand

func (*MigrateConfigEnvfileCommand) Register added in v0.43.0

func (cmd *MigrateConfigEnvfileCommand) Register(r cli.Registerer)

func (*MigrateConfigEnvfileCommand) Run added in v0.43.0

type MigrateConfigK8sCommand added in v0.42.0

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

func NewMigrateConfigK8sCommand added in v0.42.0

func NewMigrateConfigK8sCommand(io ui.IO) *MigrateConfigK8sCommand

func (*MigrateConfigK8sCommand) Register added in v0.42.0

func (cmd *MigrateConfigK8sCommand) Register(r cli.Registerer)

func (*MigrateConfigK8sCommand) Run added in v0.42.0

func (cmd *MigrateConfigK8sCommand) Run() error

type MigrateConfigReferencesCommand added in v0.43.0

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

func NewMigrateConfigReferencesCommand added in v0.43.0

func NewMigrateConfigReferencesCommand(io ui.IO) *MigrateConfigReferencesCommand

func (*MigrateConfigReferencesCommand) Register added in v0.43.0

func (*MigrateConfigReferencesCommand) Run added in v0.43.0

type MigrateConfigTemplatesCommand added in v0.43.0

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

func NewMigrateConfigTemplatesCommand added in v0.43.0

func NewMigrateConfigTemplatesCommand(io ui.IO) *MigrateConfigTemplatesCommand

func (*MigrateConfigTemplatesCommand) Register added in v0.43.0

func (cmd *MigrateConfigTemplatesCommand) Register(r cli.Registerer)

func (*MigrateConfigTemplatesCommand) Run added in v0.43.0

type MigratePlanCommand added in v0.42.0

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

func NewMigratePlanCommand added in v0.42.0

func NewMigratePlanCommand(io ui.IO, newClient newClientFunc) *MigratePlanCommand

func (*MigratePlanCommand) Register added in v0.42.0

func (cmd *MigratePlanCommand) Register(r cli.Registerer)

func (*MigratePlanCommand) Run added in v0.42.0

func (cmd *MigratePlanCommand) Run() error

type MkDirCommand

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

MkDirCommand creates a new directory inside a repository.

func NewMkDirCommand

func NewMkDirCommand(io ui.IO, newClient newClientFunc) *MkDirCommand

NewMkDirCommand returns a new command.

func (*MkDirCommand) Register

func (cmd *MkDirCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*MkDirCommand) Run

func (cmd *MkDirCommand) Run() error

Run executes the command.

type OrgCommand

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

OrgCommand handles operations on organizations.

func NewOrgCommand

func NewOrgCommand(io ui.IO, newClient newClientFunc) *OrgCommand

NewOrgCommand creates a new OrgCommand.

func (*OrgCommand) Register

func (cmd *OrgCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type OrgInitCommand

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

OrgInitCommand handles creating an organization.

func NewOrgInitCommand

func NewOrgInitCommand(io ui.IO, newClient newClientFunc) *OrgInitCommand

NewOrgInitCommand creates a new OrgInitCommand.

func (*OrgInitCommand) Register

func (cmd *OrgInitCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*OrgInitCommand) Run

func (cmd *OrgInitCommand) Run() error

Run creates an organization.

type OrgInspectCommand

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

OrgInspectCommand handles printing out the details of an organization in a JSON format.

func NewOrgInspectCommand

func NewOrgInspectCommand(io ui.IO, newClient newClientFunc) *OrgInspectCommand

NewOrgInspectCommand creates a new OrgInspectCommand.

func (*OrgInspectCommand) Register

func (cmd *OrgInspectCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*OrgInspectCommand) Run

func (cmd *OrgInspectCommand) Run() error

Run prints out the details of an organization.

type OrgInspectOutput

type OrgInspectOutput struct {
	Name        string
	Description string
	CreatedAt   string
	MemberCount int
	Members     []OrgMemberOutput
	RepoCount   int
	Repos       []api.RepoPath
}

OrgInspectOutput is the json format to print out with all the details of an organization.

type OrgInviteCommand

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

OrgInviteCommand handles inviting a user to an organization.

func NewOrgInviteCommand

func NewOrgInviteCommand(io ui.IO, newClient newClientFunc) *OrgInviteCommand

NewOrgInviteCommand creates a new OrgInviteCommand.

func (*OrgInviteCommand) Register

func (cmd *OrgInviteCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*OrgInviteCommand) Run

func (cmd *OrgInviteCommand) Run() error

Run invites a user to an organization and gives them a certain role.

type OrgListUsersCommand

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

OrgListUsersCommand handles listing the users of an organization.

func NewOrgListUsersCommand

func NewOrgListUsersCommand(io ui.IO, newClient newClientFunc) *OrgListUsersCommand

NewOrgListUsersCommand creates a new OrgListUsersCommand.

func (*OrgListUsersCommand) Register

func (cmd *OrgListUsersCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*OrgListUsersCommand) Run

func (cmd *OrgListUsersCommand) Run() error

Run lists the users of an organization.

type OrgLsCommand

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

OrgLsCommand handles listing all organisations a user is a member of.

func NewOrgLsCommand

func NewOrgLsCommand(io ui.IO, newClient newClientFunc) *OrgLsCommand

NewOrgLsCommand creates a new OrgLsCommand.

func (*OrgLsCommand) Register

func (cmd *OrgLsCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*OrgLsCommand) Run

func (cmd *OrgLsCommand) Run() error

Run lists all organizations a user is a member of.

type OrgMemberOutput

type OrgMemberOutput struct {
	Username      string
	Role          string
	CreatedAt     string
	LastChangedAt string
}

OrgMemberOutput is the json format to print out an org member.

type OrgPurchaseCommand added in v0.22.0

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

OrgPurchaseCommand prints instructions on purchasing a SecretHub subscription.

func NewOrgPurchaseCommand added in v0.22.0

func NewOrgPurchaseCommand(io ui.IO) *OrgPurchaseCommand

NewOrgPurchaseCommand creates a new OrgPurchaseCommand.

func (*OrgPurchaseCommand) Register added in v0.22.0

func (cmd *OrgPurchaseCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (OrgPurchaseCommand) Run added in v0.22.0

func (cmd OrgPurchaseCommand) Run() error

Run prints instructions on purchasing a SecretHub subscription.

type OrgRevokeCommand

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

OrgRevokeCommand handles revoking a member from an organization.

func NewOrgRevokeCommand

func NewOrgRevokeCommand(io ui.IO, newClient newClientFunc) *OrgRevokeCommand

NewOrgRevokeCommand creates a new OrgRevokeCommand.

func (*OrgRevokeCommand) Register

func (cmd *OrgRevokeCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*OrgRevokeCommand) Run

func (cmd *OrgRevokeCommand) Run() error

Run revokes an organization member.

type OrgRmCommand

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

OrgRmCommand deletes an organization, prompting the user for confirmation. It is not possible to force this command as it will not be scripted.

func NewOrgRmCommand

func NewOrgRmCommand(io ui.IO, newClient newClientFunc) *OrgRmCommand

NewOrgRmCommand creates a new OrgRmCommand.

func (*OrgRmCommand) Register

func (cmd *OrgRmCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*OrgRmCommand) Run

func (cmd *OrgRmCommand) Run() error

Run deletes an organization, prompting the user for confirmation.

type OrgSetRoleCommand

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

OrgSetRoleCommand handles updating the role of an organization member.

func NewOrgSetRoleCommand

func NewOrgSetRoleCommand(io ui.IO, newClient newClientFunc) *OrgSetRoleCommand

NewOrgSetRoleCommand creates a new OrgSetRoleCommand.

func (*OrgSetRoleCommand) Register

func (cmd *OrgSetRoleCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*OrgSetRoleCommand) Run

func (cmd *OrgSetRoleCommand) Run() error

Run updates the role of an organization member.

type PassphraseCache

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

PassphraseCache caches passphrases in a keyring for a given time to live.

func NewPassphraseCache

func NewPassphraseCache(ttl time.Duration, cleaner KeyringCleaner, keyring Keyring) *PassphraseCache

NewPassphraseCache returns a PassphraseCache initialised with the given arguments.

func (PassphraseCache) Delete

func (c PassphraseCache) Delete() error

Delete tries delete the stored passphrase for a given username.

func (PassphraseCache) ExpiresAt

func (c PassphraseCache) ExpiresAt() time.Time

ExpiresAt returns a timestamp to expire a keyring item at.

func (PassphraseCache) Get

func (c PassphraseCache) Get() (string, error)

Get returns a passphrase for the given username if it was cached. Every call to Get resets the time to live of the passphrase.

func (PassphraseCache) IsEnabled

func (c PassphraseCache) IsEnabled() bool

IsEnabled determines whether passphrases can be cached.

func (PassphraseCache) Set

func (c PassphraseCache) Set(passphrase string) error

Set caches the passphrase for the configured time to live.

type PassphraseReader

type PassphraseReader interface {
	Get(username string) ([]byte, error)
	IncorrectPassphrase(username string) error
}

PassphraseReader can retrieve a password and be instructed if the password is incorrect. The implementation can determine to do some clean up if the password is incorrect.

type PrintEnvCommand

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

PrintEnvCommand prints out debug statements about all environment variables.

func NewPrintEnvCommand

func NewPrintEnvCommand(app *cli.App, io ui.IO) *PrintEnvCommand

NewPrintEnvCommand creates a new PrintEnvCommand.

func (*PrintEnvCommand) Register

func (cmd *PrintEnvCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*PrintEnvCommand) Run

func (cmd *PrintEnvCommand) Run() error

Run prints out debug statements about all environment variables.

type ProfileDir

type ProfileDir string

ProfileDir points to the account's directory used for storing credentials and configuration.

func NewProfileDir

func NewProfileDir(path string) (ProfileDir, error)

NewProfileDir constructs the account's profile directory location, defaulting to ~/.secrethub when no path is given. Given paths must be absolute. Note that while the returned path is absolute, it is not guaranteed that the returned path actually exists.

func (ProfileDir) CredentialFileMode

func (d ProfileDir) CredentialFileMode() os.FileMode

CredentialFileMode returns the file mode used for credential files.

func (ProfileDir) CredentialPath

func (d ProfileDir) CredentialPath() string

CredentialPath returns the path to the credential file.

func (ProfileDir) FileMode

func (d ProfileDir) FileMode() os.FileMode

FileMode returns the file mode used for the profile directory.

func (ProfileDir) IsOldConfiguration

func (d ProfileDir) IsOldConfiguration() bool

IsOldConfiguration detects whether an old configuration exists in the profile directory.

func (ProfileDir) String

func (d ProfileDir) String() string

type ReadCommand

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

ReadCommand is a command to read a secret.

func NewReadCommand

func NewReadCommand(io ui.IO, newClient newClientFunc) *ReadCommand

NewReadCommand creates a new ReadCommand.

func (*ReadCommand) Register

func (cmd *ReadCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ReadCommand) Run

func (cmd *ReadCommand) Run() error

Run handles the command with the options as specified in the command.

type RepoCommand

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

RepoCommand handles operations on repositories.

func NewRepoCommand

func NewRepoCommand(io ui.IO, newClient newClientFunc) *RepoCommand

NewRepoCommand creates a new RepoCommand.

func (*RepoCommand) Register

func (cmd *RepoCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type RepoExportCommand

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

RepoExportCommand exports a repo to a zip file.

func NewRepoExportCommand

func NewRepoExportCommand(io ui.IO, newClient newClientFunc) *RepoExportCommand

NewRepoExportCommand creates a new RepoExportCommand.

func (*RepoExportCommand) Register

func (cmd *RepoExportCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*RepoExportCommand) Run

func (cmd *RepoExportCommand) Run() error

Run exports a repo to a zip file

type RepoInitCommand

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

RepoInitCommand handles creating new repositories.

func NewRepoInitCommand

func NewRepoInitCommand(io ui.IO, newClient newClientFunc) *RepoInitCommand

NewRepoInitCommand creates a new RepoInitCommand

func (*RepoInitCommand) Register

func (cmd *RepoInitCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*RepoInitCommand) Run

func (cmd *RepoInitCommand) Run() error

Run creates a new repository.

type RepoInspectCommand

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

RepoInspectCommand handles printing out the details of a repo in a JSON format.

func NewRepoInspectCommand

func NewRepoInspectCommand(io ui.IO, newClient newClientFunc) *RepoInspectCommand

NewRepoInspectCommand creates a new RepoInspectCommand.

func (*RepoInspectCommand) Register

func (cmd *RepoInspectCommand) Register(r cli.Registerer)

Register registers the command, args, and flags on the provided registerer.

func (*RepoInspectCommand) Run

func (cmd *RepoInspectCommand) Run() error

Run prints out the details of a repo.

type RepoInviteCommand

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

RepoInviteCommand handles inviting a user to collaborate on a repository.

func NewRepoInviteCommand

func NewRepoInviteCommand(io ui.IO, newClient newClientFunc) *RepoInviteCommand

NewRepoInviteCommand creates a new RepoInviteCommand.

func (*RepoInviteCommand) Register

func (cmd *RepoInviteCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*RepoInviteCommand) Run

func (cmd *RepoInviteCommand) Run() error

Run invites the configured user to collaborate on the repo.

type RepoLSCommand

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

RepoLSCommand lists repositories.

func NewRepoLSCommand

func NewRepoLSCommand(io ui.IO, newClient newClientFunc) *RepoLSCommand

NewRepoLSCommand creates a new RepoLSCommand.

func (*RepoLSCommand) Register

func (cmd *RepoLSCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*RepoLSCommand) Run

func (cmd *RepoLSCommand) Run() error

Run lists the repositories a user has access to.

type RepoRevokeCommand

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

RepoRevokeCommand handles revoking an account access to a repository.

func NewRepoRevokeCommand

func NewRepoRevokeCommand(io ui.IO, newClient newClientFunc) *RepoRevokeCommand

NewRepoRevokeCommand creates a new RepoRevokeCommand.

func (*RepoRevokeCommand) Register

func (cmd *RepoRevokeCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*RepoRevokeCommand) Run

func (cmd *RepoRevokeCommand) Run() error

Run removes and revokes access to an account from a repo if possible.

type RepoRmCommand

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

RepoRmCommand handles removing a repo.

func NewRepoRmCommand

func NewRepoRmCommand(io ui.IO, newClient newClientFunc) *RepoRmCommand

NewRepoRmCommand creates a new RepoRmCommand.

func (*RepoRmCommand) Register

func (cmd *RepoRmCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*RepoRmCommand) Run

func (cmd *RepoRmCommand) Run() error

Run removes the repository.

type RmCommand

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

RmCommand handles removing a resource.

func NewRmCommand

func NewRmCommand(io ui.IO, newClient newClientFunc) *RmCommand

NewRmCommand creates a new RmCommand.

func (*RmCommand) Register

func (cmd *RmCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*RmCommand) Run

func (cmd *RmCommand) Run() error

Run removes the resource at the given path. Removes a secret, secret-version or directory. To remove a directory the -r flag must be set.

type RunCommand

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

RunCommand runs a program and passes environment variables to it that are defined with --envar or --env-file flags and secrets.yml files. The yml files write to .secretsenv/<env-name> when running the set command.

func NewRunCommand

func NewRunCommand(io ui.IO, newClient newClientFunc) *RunCommand

NewRunCommand creates a new RunCommand.

func (*RunCommand) Register

func (cmd *RunCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*RunCommand) Run

func (cmd *RunCommand) Run() error

Run reads files from the .secretsenv/<env-name> directory, sets them as environment variables and runs the given command. Note that the environment variables are only passed to the child process and not exported globally, which is nice.

type ServiceAWSCommand added in v0.26.0

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

ServiceAWSCommand handles AWS services.

func NewServiceAWSCommand added in v0.26.0

func NewServiceAWSCommand(io ui.IO, newClient newClientFunc) *ServiceAWSCommand

NewServiceAWSCommand creates a new ServiceAWSCommand.

func (*ServiceAWSCommand) Register added in v0.26.0

func (cmd *ServiceAWSCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type ServiceAWSInitCommand added in v0.26.0

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

ServiceAWSInitCommand initializes a service for AWS.

func NewServiceAWSInitCommand added in v0.26.0

func NewServiceAWSInitCommand(io ui.IO, newClient newClientFunc) *ServiceAWSInitCommand

NewServiceAWSInitCommand creates a new ServiceAWSInitCommand.

func (*ServiceAWSInitCommand) Register added in v0.26.0

func (cmd *ServiceAWSInitCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ServiceAWSInitCommand) Run added in v0.26.0

func (cmd *ServiceAWSInitCommand) Run() error

Run initializes an AWS service.

type ServiceCommand

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

ServiceCommand handles operations on services.

func NewServiceCommand

func NewServiceCommand(io ui.IO, newClient newClientFunc) *ServiceCommand

NewServiceCommand creates a new ServiceCommand.

func (*ServiceCommand) Register

func (cmd *ServiceCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type ServiceDeployCommand

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

ServiceDeployCommand handles deploying a service.

func NewServiceDeployCommand

func NewServiceDeployCommand(io ui.IO) *ServiceDeployCommand

NewServiceDeployCommand creates a new ServiceDeployCommand.

func (*ServiceDeployCommand) Register

func (cmd *ServiceDeployCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type ServiceDeployWinRmCommand

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

ServiceDeployWinRmCommand creates a service and installs the configuration using WinRM.

func NewServiceDeployWinRmCommand

func NewServiceDeployWinRmCommand(io ui.IO) *ServiceDeployWinRmCommand

NewServiceDeployWinRmCommand creates a new ServiceDeployWinRmCommand.

func (*ServiceDeployWinRmCommand) Register

func (cmd *ServiceDeployWinRmCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ServiceDeployWinRmCommand) Run

func (cmd *ServiceDeployWinRmCommand) Run() error

Run creates a service and installs the configuration using WinRM.

type ServiceGCPCommand added in v0.39.0

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

ServiceGCPCommand handles GCP services.

func NewServiceGCPCommand added in v0.39.0

func NewServiceGCPCommand(io ui.IO, newClient newClientFunc) *ServiceGCPCommand

NewServiceGCPCommand creates a new ServiceGCPCommand.

func (*ServiceGCPCommand) Register added in v0.39.0

func (cmd *ServiceGCPCommand) Register(r cli.Registerer)

Register registers the command and its sub-commands on the provided Registerer.

type ServiceGCPDeleteLinkCommand added in v0.40.0

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

ServiceGCPDeleteLinkCommand deletes the link between a SecretHub namespace and a GCP project.

func NewServiceGCPDeleteLinkCommand added in v0.40.0

func NewServiceGCPDeleteLinkCommand(io ui.IO, newClient newClientFunc) *ServiceGCPDeleteLinkCommand

func (*ServiceGCPDeleteLinkCommand) Register added in v0.40.0

func (cmd *ServiceGCPDeleteLinkCommand) Register(r cli.Registerer)

func (*ServiceGCPDeleteLinkCommand) Run added in v0.40.0

type ServiceGCPInitCommand added in v0.39.0

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

ServiceGCPInitCommand initializes a service for GCP.

func NewServiceGCPInitCommand added in v0.39.0

func NewServiceGCPInitCommand(io ui.IO, newClient newClientFunc) *ServiceGCPInitCommand

NewServiceGCPInitCommand creates a new ServiceGCPInitCommand.

func (*ServiceGCPInitCommand) Register added in v0.39.0

func (cmd *ServiceGCPInitCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ServiceGCPInitCommand) Run added in v0.39.0

func (cmd *ServiceGCPInitCommand) Run() error

Run initializes an GCP service.

type ServiceGCPLinkCommand added in v0.40.0

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

ServiceGCPLinkCommand create a new link between a SecretHub namespace and a GCP project.

func NewServiceGCPLinkCommand added in v0.40.0

func NewServiceGCPLinkCommand(io ui.IO, newClient newClientFunc) *ServiceGCPLinkCommand

NewServiceGCPLinkCommand creates a new ServiceGCPLinkCommand.

func (*ServiceGCPLinkCommand) Register added in v0.40.0

func (cmd *ServiceGCPLinkCommand) Register(r cli.Registerer)

func (*ServiceGCPLinkCommand) Run added in v0.40.0

func (cmd *ServiceGCPLinkCommand) Run() error

type ServiceGCPListLinksCommand added in v0.40.0

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

ServiceGCPListLinksCommand lists all existing links between the given namespace and GCP projects

func NewServiceGCPListLinksCommand added in v0.40.0

func NewServiceGCPListLinksCommand(io ui.IO, newClient newClientFunc) *ServiceGCPListLinksCommand

func (*ServiceGCPListLinksCommand) Register added in v0.40.0

func (cmd *ServiceGCPListLinksCommand) Register(r cli.Registerer)

func (*ServiceGCPListLinksCommand) Run added in v0.40.0

func (cmd *ServiceGCPListLinksCommand) Run() error

type ServiceInitCommand

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

ServiceInitCommand initializes a service and writes the generated config to stdout.

func NewServiceInitCommand

func NewServiceInitCommand(io ui.IO, newClient newClientFunc) *ServiceInitCommand

NewServiceInitCommand creates a new ServiceInitCommand.

func (*ServiceInitCommand) Register

func (cmd *ServiceInitCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ServiceInitCommand) Run

func (cmd *ServiceInitCommand) Run() error

Run initializes a service and writes the generated config to stdout.

type ServiceLsCommand added in v0.25.0

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

ServiceLsCommand lists all service accounts in a given repository.

func NewServiceAWSLsCommand added in v0.26.0

func NewServiceAWSLsCommand(io ui.IO, newClient newClientFunc) *ServiceLsCommand

func NewServiceGCPLsCommand added in v0.39.0

func NewServiceGCPLsCommand(io ui.IO, newClient newClientFunc) *ServiceLsCommand

func NewServiceLsCommand added in v0.25.0

func NewServiceLsCommand(io ui.IO, newClient newClientFunc) *ServiceLsCommand

NewServiceLsCommand creates a new ServiceLsCommand.

func (*ServiceLsCommand) Register added in v0.25.0

func (cmd *ServiceLsCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*ServiceLsCommand) Run added in v0.25.0

func (cmd *ServiceLsCommand) Run() error

Run lists all service accounts in a given repository. Run lists all service accounts in a given repository.

type SetCommand

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

SetCommand parses a secret spec file and presents secrets on the system.

func NewSetCommand

func NewSetCommand(io ui.IO, newClient newClientFunc) *SetCommand

NewSetCommand creates a new SetCommand.

func (*SetCommand) Register

func (cmd *SetCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*SetCommand) Run

func (cmd *SetCommand) Run() error

Run parses a secret spec file and presents secrets on the system.

type SignUpCommand

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

SignUpCommand signs up a new user and configures his account for use on this machine.

func NewSignUpCommand

func NewSignUpCommand(io ui.IO) *SignUpCommand

NewSignUpCommand creates a new SignUpCommand.

func (*SignUpCommand) Register

func (cmd *SignUpCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*SignUpCommand) Run

func (cmd *SignUpCommand) Run() error

Run signs up a new user and configures his account for use on this machine. If an account was already configured, the user is prompted for confirmation to overwrite it.

type TimeFormatter

type TimeFormatter interface {
	Format(t time.Time) string
}

TimeFormatter can format a time to a string.

func NewTimeFormatter

func NewTimeFormatter(timestamps bool) TimeFormatter

NewTimeFormatter creates a new timeFormatter.

func NewTimestampFormatter

func NewTimestampFormatter() TimeFormatter

NewTimestampFormatter is a convenience function to create a TimeFormatter that uses timestamps.

type TreeCommand

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

TreeCommand lists the contents of a directory at a given path in a tree-like format.

func NewTreeCommand

func NewTreeCommand(io ui.IO, clientFactory newClientFunc) *TreeCommand

NewTreeCommand creates a new TreeCommand.

func (*TreeCommand) Register

func (cmd *TreeCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*TreeCommand) Run

func (cmd *TreeCommand) Run() error

Run prints the contents of a directory at a given path in a tree-like format.

type WriteCommand

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

WriteCommand is a command to write content to a secret.

func NewWriteCommand

func NewWriteCommand(io ui.IO, newClient newClientFunc) *WriteCommand

NewWriteCommand creates a new WriteCommand.

func (*WriteCommand) Register

func (cmd *WriteCommand) Register(r cli.Registerer)

Register registers the command, arguments and flags on the provided Registerer.

func (*WriteCommand) Run

func (cmd *WriteCommand) Run() error

Run handles the command with the options as specified in the command.

Directories

Path Synopsis
tpl

Jump to

Keyboard shortcuts

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