commands

package
v0.0.0-...-a7f1bfa Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetApiInfo

func GetApiInfo(serverUrl string, caCerts []string, skipTlsValidation bool, httpTimeout *time.Duration) (*server.Info, error)

func MarkTokensAsRevokedInConfig

func MarkTokensAsRevokedInConfig(cfg *config.Config)

func ParseOperations

func ParseOperations(operations string) []string

func PrintVersion

func PrintVersion() error

func PrintWarnings

func PrintWarnings(serverUrl string, skipTlsValidation bool) error

func ReadOrGetCaCerts

func ReadOrGetCaCerts(caCerts []string) ([]string, error)

func RevokeTokenIfNecessary

func RevokeTokenIfNecessary(cfg config.Config) error

Types

type ApiCommand

type ApiCommand struct {
	Server            ApiPositionalArgs `positional-args:"yes" env:"CREDHUB_SERVER"`
	ServerFlagUrl     string            `short:"s" long:"server" description:"URI of API server to target" env:"CREDHUB_SERVER"`
	CaCerts           []string          `` /* 126-byte string literal not displayed */
	SkipTlsValidation bool              `long:"skip-tls-validation" description:"Skip certificate validation of the API endpoint. Not recommended!"`
	ConfigCommand
}

func (*ApiCommand) Execute

func (c *ApiCommand) Execute([]string) error

type ApiPositionalArgs

type ApiPositionalArgs struct {
	ServerUrl string `positional-arg-name:"SERVER" description:"URI of API server to target"`
}

type BulkRegenerateCommand

type BulkRegenerateCommand struct {
	SignedBy   string `required:"yes" long:"signed-by" description:"Selects the credential whose children should recursively be regenerated"`
	OutputJSON bool   `short:"j" long:"output-json" description:"Return response in JSON format"`
	ClientCommand
}

func (*BulkRegenerateCommand) Execute

func (c *BulkRegenerateCommand) Execute([]string) error

type CaAndIndex

type CaAndIndex struct {
	Ca    string
	Index int
}

type ClientCommand

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

func (*ClientCommand) SetClient

func (n *ClientCommand) SetClient(client *credhub.CredHub)

type ConfigCommand

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

func (*ConfigCommand) SetConfig

func (n *ConfigCommand) SetConfig(config config.Config)

type CredhubCommand

type CredhubCommand struct {
	API              ApiCommand              `` /* 352-byte string literal not displayed */
	Delete           DeleteCommand           `` /* 153-byte string literal not displayed */
	Export           ExportCommand           `command:"export"     alias:"e" description:"Export all credentials" long-description:"Export all credentials"`
	Find             FindCommand             `` /* 191-byte string literal not displayed */
	Generate         GenerateCommand         `` /* 459-byte string literal not displayed */
	Get              GetCommand              `command:"get"        alias:"g" description:"Get a credential value" long-description:"Get a credential value by name or ID"`
	Import           ImportCommand           `` /* 300-byte string literal not displayed */
	Interpolate      InterpolateCommand      `` /* 1226-byte string literal not displayed */
	Login            LoginCommand            `` /* 318-byte string literal not displayed */
	Logout           LogoutCommand           `` /* 193-byte string literal not displayed */
	Regenerate       RegenerateCommand       `` /* 231-byte string literal not displayed */
	BulkRegenerate   BulkRegenerateCommand   `` /* 208-byte string literal not displayed */
	Set              SetCommand              `` /* 421-byte string literal not displayed */
	Curl             CurlCommand             `` /* 168-byte string literal not displayed */
	SetPermission    SetPermissionCommand    `` /* 148-byte string literal not displayed */
	GetPermission    GetPermissionCommand    `` /* 148-byte string literal not displayed */
	DeletePermission DeletePermissionCommand `` /* 157-byte string literal not displayed */

	HttpTimeout *time.Duration `` /* 134-byte string literal not displayed */

	Version func() `long:"version" description:"Version of CLI and targeted CredHub API"`
	Token   func() `long:"token" description:"Return your current CredHub authentication token"`
}
var CredHub CredhubCommand

type CurlCommand

type CurlCommand struct {
	Path          string `short:"p" long:"path" description:"The server endpoint to make the request against"`
	Fail          bool   `short:"f" long:"fail" description:"Fail silently (no output at all) on HTTP errors"`
	Method        string `short:"X" description:"HTTP method (default: GET)"`
	Data          string `short:"d" description:"HTTP data to include in the request body"`
	IncludeHeader bool   `short:"i" description:"Include the response headers in the output"`
	ClientCommand
}

func (*CurlCommand) Execute

func (c *CurlCommand) Execute([]string) error

type DeleteCommand

type DeleteCommand struct {
	CredentialIdentifier string `short:"n" long:"name" description:"Name of the credential to delete"`
	CredentialPath       string `short:"p" long:"path" description:"Path of the credentials to delete"`
	Quiet                bool   `short:"q" long:"quiet" description:"Disable real-time status of delete by path"`
	ClientCommand
}

func (*DeleteCommand) Execute

func (c *DeleteCommand) Execute([]string) error

type DeleteFailedCredential

type DeleteFailedCredential struct {
	Name string
	Err  string
}

type DeletePermissionCommand

type DeletePermissionCommand struct {
	Actor string `short:"a" long:"actor" required:"yes" description:"Name of the actor to grant permissions for"`
	Path  string `short:"p" long:"path" required:"yes" description:"Name of path to grant permissions for"`
	ClientCommand
}

func (*DeletePermissionCommand) DeletePermission

func (c *DeletePermissionCommand) DeletePermission(uuid string) error

func (*DeletePermissionCommand) Execute

func (c *DeletePermissionCommand) Execute([]string) error

type ErrorInfo

type ErrorInfo struct {
	Successful   int
	Failed       int
	ImportErrors []string
}

type ExportCommand

type ExportCommand struct {
	Path       string `short:"p" long:"path" description:"Path of credentials to export" required:"false"`
	File       string `short:"f" long:"file" description:"File in which to write credentials" required:"false"`
	OutputJSON bool   `short:"j" long:"output-json" description:"Return response in JSON format"`
}

func (ExportCommand) Execute

func (cmd ExportCommand) Execute([]string) error

type FindCommand

type FindCommand struct {
	PartialCredentialIdentifier string `short:"n" long:"name-like" description:"Find credentials whose name contains the query string"`
	PathIdentifier              string `short:"p" long:"path" description:"Find credentials that exist under the provided path"`
	OutputJSON                  bool   `short:"j" long:"output-json" description:"Return response in JSON format"`
	ClientCommand
}

func (*FindCommand) Execute

func (c *FindCommand) Execute([]string) error

type GenerateCommand

type GenerateCommand struct {
	CredentialIdentifier string   `short:"n" required:"yes" long:"name" description:"Name of the credential to generate"`
	CredentialType       string   `` /* 145-byte string literal not displayed */
	NoOverwrite          bool     `short:"O" long:"no-overwrite" description:"Credential is not modified if stored value already exists"`
	OutputJSON           bool     `short:"j" long:"output-json" description:"Return response in JSON format"`
	Username             string   `short:"z" long:"username" description:"[User] Sets the username value of the credential"`
	Length               int      `short:"l" long:"length" description:"[Password, User] Length of the generated value (Default: 30)"`
	IncludeSpecial       bool     `short:"S" long:"include-special" description:"[Password, User] Include special characters in the generated value"`
	ExcludeNumber        bool     `short:"N" long:"exclude-number" description:"[Password, User] Exclude number characters from the generated value"`
	ExcludeUpper         bool     `short:"U" long:"exclude-upper" description:"[Password, User] Exclude upper alpha characters from the generated value"`
	ExcludeLower         bool     `short:"L" long:"exclude-lower" description:"[Password, User] Exclude lower alpha characters from the generated value"`
	SSHComment           string   `short:"m" long:"ssh-comment" description:"[SSH] Comment appended to public key to help identify in environment"`
	KeyLength            int      `short:"k" long:"key-length" description:"[Certificate, SSH, RSA] Bit length of the generated key (Default: 2048)"`
	Duration             int      `short:"d" long:"duration" description:"[Certificate] Valid duration (in days) of the generated certificate (Default: 365)"`
	CommonName           string   `short:"c" long:"common-name" description:"[Certificate] Common name of the generated certificate"`
	Organization         string   `short:"o" long:"organization" description:"[Certificate] Organization of the generated certificate"`
	OrganizationUnit     string   `short:"u" long:"organization-unit" description:"[Certificate] Organization unit of the generated certificate"`
	Locality             string   `short:"i" long:"locality" description:"[Certificate] Locality/city of the generated certificate"`
	State                string   `short:"s" long:"state" description:"[Certificate] State/province of the generated certificate"`
	Country              string   `short:"y" long:"country" description:"[Certificate] Country of the generated certificate"`
	AlternativeName      []string `` /* 151-byte string literal not displayed */
	KeyUsage             []string `` /* 139-byte string literal not displayed */
	ExtendedKeyUsage     []string `` /* 152-byte string literal not displayed */
	Ca                   string   `long:"ca" description:"[Certificate] Name of CA used to sign the generated certificate"`
	IsCA                 bool     `long:"is-ca" description:"[Certificate] The generated certificate is a certificate authority"`
	SelfSign             bool     `long:"self-sign" description:"[Certificate] The generated certificate will be self-signed"`
	Metadata             string   `long:"metadata" description:"[JSON] Sets additional metadata on the credential"`
	ClientCommand
}

func (GenerateCommand) Execute

func (c GenerateCommand) Execute([]string) error

type GetCommand

type GetCommand struct {
	Name             string `short:"n" long:"name" description:"Name of the credential to retrieve"`
	ID               string `long:"id" description:"ID of the credential to retrieve"`
	NumberOfVersions int    `long:"versions" description:"Number of versions of the credential to retrieve"`
	OutputJSON       bool   `short:"j" long:"output-json" description:"Return response in JSON format"`
	Quiet            bool   `short:"q" long:"quiet" description:"Return value of credential without metadata"`
	Key              string `short:"k" long:"key" description:"Return only the specified field of the requested credential"`
	ClientCommand
}

func (*GetCommand) Execute

func (c *GetCommand) Execute([]string) error

type GetPermissionCommand

type GetPermissionCommand struct {
	Actor      string `short:"a" long:"actor" required:"yes" description:"Name of the actor to grant permissions for"`
	Path       string `short:"p" long:"path" required:"yes" description:"Name of path to grant permissions for"`
	OutputJSON bool   `short:"j" long:"output-json" description:"Return response in JSON format"`
	ClientCommand
}

func (*GetPermissionCommand) Execute

func (c *GetPermissionCommand) Execute([]string) error

func (*GetPermissionCommand) GetPermission

func (c *GetPermissionCommand) GetPermission() error

type ImportCommand

type ImportCommand struct {
	File       string `short:"f" long:"file" description:"File containing credentials to import" required:"true"`
	ImportJSON bool   `short:"j" long:"import-json" description:"File to import is of type JSON"`
	ClientCommand
}

func (*ImportCommand) Execute

func (c *ImportCommand) Execute([]string) error

type InterpolateCommand

type InterpolateCommand struct {
	File              string `short:"f" long:"file"   description:"Path to the file to interpolate"`
	Prefix            string `` /* 128-byte string literal not displayed */
	SkipMissingParams bool   `short:"s" long:"skip-missing" description:"allow skipping missing params"`
	ClientCommand
}

func (*InterpolateCommand) Execute

func (c *InterpolateCommand) Execute([]string) error

type LoginCommand

type LoginCommand struct {
	Username          string   `short:"u" long:"username" description:"Authentication username"`
	Password          string   `short:"p" long:"password" description:"Authentication password"`
	ClientName        string   `long:"client-name" description:"Client name for UAA client grant" env:"CREDHUB_CLIENT"`
	ClientSecret      string   `long:"client-secret" description:"Client secret for UAA client grant" env:"CREDHUB_SECRET"`
	ServerUrl         string   `short:"s" long:"server" description:"URI of API server to target" env:"CREDHUB_SERVER"`
	CaCerts           []string `long:"ca-cert" description:"Trusted CA for API and UAA TLS connections" env:"CREDHUB_CA_CERT"`
	SkipTlsValidation bool     `long:"skip-tls-validation" description:"Skip certificate validation of the API endpoint. Not recommended!"`
	SSO               bool     `long:"sso" description:"Prompt for a one-time passcode to login"`
	SSOPasscode       string   `long:"sso-passcode" description:"One-time passcode"`
	ConfigCommand
}

func (*LoginCommand) Execute

func (c *LoginCommand) Execute([]string) error

type LogoutCommand

type LogoutCommand struct {
	ConfigCommand
}

func (*LogoutCommand) Execute

func (c *LogoutCommand) Execute([]string) error

type RegenerateCommand

type RegenerateCommand struct {
	CredentialIdentifier string `required:"yes" short:"n" long:"name" description:"Selects the credential to regenerate"`
	Metadata             string `long:"metadata" description:"[JSON] Sets additional metadata on the credential"`
	OutputJSON           bool   `short:"j" long:"output-json" description:"Return response in JSON format"`
	ClientCommand
}

func (*RegenerateCommand) Execute

func (c *RegenerateCommand) Execute([]string) error

type SetCommand

type SetCommand struct {
	CredentialIdentifier string `short:"n" required:"yes" long:"name" description:"Name of the credential to set"`
	Type                 string `` /* 150-byte string literal not displayed */
	Value                string `short:"v" long:"value" description:"[Value, JSON] Sets the value for the credential"`
	CaName               string `short:"m" long:"ca-name" description:"[Certificate] Sets the root CA to a stored CA credential"`
	Root                 string `short:"r" long:"root" description:"[Certificate] Sets the root CA from file or value"`
	Certificate          string `short:"c" long:"certificate" description:"[Certificate] Sets the certificate from file or value"`
	Private              string `short:"p" long:"private" description:"[Certificate, SSH, RSA] Sets the private key from file or value"`
	Public               string `short:"u" long:"public" description:"[SSH, RSA] Sets the public key from file or value"`
	Username             string `short:"z" long:"username" description:"[User] Sets the username value of the credential"`
	Password             string `short:"w" long:"password" description:"[Password, User] Sets the password value of the credential"`
	OutputJSON           bool   `short:"j" long:"output-json" description:"Return response in JSON format"`
	Metadata             string `long:"metadata" description:"[JSON] Sets additional metadata on the credential"`
	ClientCommand
}

func (*SetCommand) Execute

func (c *SetCommand) Execute([]string) error

type SetPermissionCommand

type SetPermissionCommand struct {
	Actor      string `short:"a" long:"actor" required:"yes" description:"Name of the actor to grant permissions for"`
	Path       string `short:"p" long:"path" required:"yes" description:"Name of path to grant permissions for"`
	Operations string `short:"o" long:"operations" required:"yes" description:"Operations to actor is granted permissions for one path"`
	OutputJSON bool   `short:"j" long:"output-json" description:"Return response in JSON format"`
	ClientCommand
}

func (*SetPermissionCommand) Execute

func (c *SetPermissionCommand) Execute([]string) error

Jump to

Keyboard shortcuts

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