Documentation
¶
Index ¶
- Variables
- func DeleteConfigFile(path string) error
- func EditData(data []byte, saveFunc SaveFunc, startErr *errors.ApiError, retry bool) (edited []byte, runErr *errors.ApiError)
- func GetFilenameFromArgs(args []string) string
- func GetFlagVal(flag string, args []string) string
- func LookupConfigPath(dir string) string
- func SurveyOptionalCIDR(ans any) error
- func SurveyOptionalJSON(ans any) error
- func SurveyRequired(ans any) error
- func SurveyRequiredFile(ans any) error
- func SurveyRequiredInt(ans any) error
- func SurveyRequiredName(ans any) error
- func SurveyRequiredPath(ans any) error
- func SurveyRequiredPortNumber(ans any) error
- func SurveyRequiredProfileName(existingProfiles []string) func(ans any) error
- func SurveySelectAtLeastOne(ans any) error
- func SurveyTrimSpace(ans any) (newAns any)
- func ToFlagName(flag string) string
- func ValidateName(name string) error
- func ValidatePath(resource string) error
- func ValidateProfile(profile string) error
- func ValidateUsername(username string) error
- func ViperInit() error
- type CLI
- type ConfigFile
- func (cf *ConfigFile) Bytes() []byte
- func (cf *ConfigFile) Delete() error
- func (cf *ConfigFile) GetPath() string
- func (cf *ConfigFile) GetProfile(p string) (*Profile, bool)
- func (cf *ConfigFile) ListProfiles() []*Profile
- func (cf *ConfigFile) ListProfilesNames() []string
- func (cf *ConfigFile) RawUpdate(b []byte) error
- func (cf *ConfigFile) Read() error
- func (cf *ConfigFile) Save() error
- func (cf *ConfigFile) SetProfile(p *Profile)
- type Profile
- type SaveFunc
- type VaultCLIOption
- func WithAuthenticator(a auth.Authenticator) VaultCLIOption
- func WithEditFunc(f func(data []byte, save SaveFunc) (edited []byte, err *errors.ApiError)) VaultCLIOption
- func WithGraphQLClient(c requests.GraphClient) VaultCLIOption
- func WithHTTPClient(c requests.Client) VaultCLIOption
- func WithOutClient(c format.OutClient) VaultCLIOption
- func WithStore(s store.Store) VaultCLIOption
Constants ¶
This section is empty.
Variables ¶
var ErrFileNotFound = errors.New("configuration file not found")
Functions ¶
func DeleteConfigFile ¶
func GetFilenameFromArgs ¶
GetFilenameFromArgs tries to extract a filename from args. If args has a --data or -d flag and its value starts with an '@' followed by a filename, the function tries to capture that filename.
func GetFlagVal ¶
func LookupConfigPath ¶
func SurveyOptionalCIDR ¶
SurveyOptionalCIDR verifies that the answer is either empty or a valid CIDR.
func SurveyOptionalJSON ¶
SurveyOptionalJSON verifies that the answer is either empty or a valid JSON.
func SurveyRequired ¶
SurveyRequired verifies that there is some answer. Built-in function "survey.Required()" does not trim spaces.
func SurveyRequiredFile ¶
SurveyRequiredFile verifies that the answer is a valid path to a file.
func SurveyRequiredInt ¶
SurveyRequiredInt verifies that the answer is a valid integer number.
func SurveyRequiredPortNumber ¶
SurveyRequiredPortNumber verifies that the answer is a valid port number.
func SurveyRequiredProfileName ¶
SurveyRequiredProfileName checks profile name.
func SurveySelectAtLeastOne ¶
SurveySelectAtLeastOne requires the answer is a list with at least one item.
func ToFlagName ¶
func ValidateName ¶
func ValidatePath ¶
func ValidateProfile ¶
func ValidateUsername ¶
Types ¶
type CLI ¶
type CLI interface { HTTPClient() requests.Client GraphQLClient() requests.GraphClient Out() format.OutClient Edit(data []byte, saveFunc SaveFunc) (edited []byte, err *errors.ApiError) Authenticator() auth.Authenticator Store(t string) (store.Store, error) }
func NewWithOpts ¶
func NewWithOpts(opts ...VaultCLIOption) (CLI, error)
type ConfigFile ¶
type ConfigFile struct { DefaultProfile string // contains filtered or unexported fields }
func NewConfigFile ¶
func NewConfigFile(path string) (*ConfigFile, error)
func ReadConfigFile ¶
func ReadConfigFile(path string) (*ConfigFile, error)
func (*ConfigFile) Bytes ¶
func (cf *ConfigFile) Bytes() []byte
func (*ConfigFile) Delete ¶
func (cf *ConfigFile) Delete() error
func (*ConfigFile) GetPath ¶
func (cf *ConfigFile) GetPath() string
func (*ConfigFile) GetProfile ¶
func (cf *ConfigFile) GetProfile(p string) (*Profile, bool)
func (*ConfigFile) ListProfiles ¶
func (cf *ConfigFile) ListProfiles() []*Profile
func (*ConfigFile) ListProfilesNames ¶
func (cf *ConfigFile) ListProfilesNames() []string
func (*ConfigFile) RawUpdate ¶
func (cf *ConfigFile) RawUpdate(b []byte) error
func (*ConfigFile) Read ¶
func (cf *ConfigFile) Read() error
func (*ConfigFile) Save ¶
func (cf *ConfigFile) Save() error
func (*ConfigFile) SetProfile ¶
func (cf *ConfigFile) SetProfile(p *Profile)
type Profile ¶
type Profile struct { Name string // contains filtered or unexported fields }
func NewProfile ¶
type VaultCLIOption ¶
func WithAuthenticator ¶
func WithAuthenticator(a auth.Authenticator) VaultCLIOption
func WithEditFunc ¶
func WithGraphQLClient ¶
func WithGraphQLClient(c requests.GraphClient) VaultCLIOption
func WithHTTPClient ¶
func WithHTTPClient(c requests.Client) VaultCLIOption
func WithOutClient ¶
func WithOutClient(c format.OutClient) VaultCLIOption
func WithStore ¶
func WithStore(s store.Store) VaultCLIOption