Versions in this module Expand all Collapse all v0 v0.0.16 Jul 2, 2024 Changes in this version + var AuthHandlers = make(map[string]AuthHandler) + var Client *gentleman.Client + var ErrCannotUnmarshal = errors.New("Unable to unmarshal response") + var PreRun func(cmd *cobra.Command, args []string) error + var Root *cobra.Command + var Stderr io.Writer = os.Stderr + var Stdout io.Writer = os.Stdout + func AddFlag(path, name, short, description string, defaultValue interface{}) + func BuildHelpConfigCommand(appName string) *cobra.Command + func BuildHelpInputCommand() *cobra.Command + func BuildSecretsCommands() (cmd *cobra.Command) + func BuildSettingsCommands() (configCommand *cobra.Command) + func DeepAssign(target, source map[string]interface{}) + func GetBody(mediaType string, args []string) (string, error) + func GetMatchValue(ctx *context.Context, selector string, reqParams map[string]interface{}, ...) (interface{}, error) + func HandleAfter(path string, params *viper.Viper, resp *gentleman.Response, data interface{}) interface + func HandleBefore(path string, params *viper.Viper, r *gentleman.Request) + func Init(config *Config) + func InitConfiguration(envPrefix, settingsFilePath, secretsFilePath string, globalFlags []GlobalFlag) (err error) + func LogMiddleware(useColor bool) + func Markdown(content string) string + func Match(test string, expected json.RawMessage, actual interface{}) (bool, error) + func RegisterAfter(path string, handler AfterHandlerFunc) + func RegisterAfterAll(handler AfterHandlerFunc) + func RegisterBefore(path string, handler BeforeHandlerFunc) + func RegisterBeforeAll(handler BeforeHandlerFunc) + func SetCustomFlags(cmd *cobra.Command) + func UnmarshalRequest(ctx *context.Context, s interface{}) error + func UnmarshalResponse(resp *gentleman.Response, s interface{}) error + func UseAuth(typeName string, handler AuthHandler) + func UserAgentMiddleware(appName string) + type AfterHandlerFunc func(string, *viper.Viper, *gentleman.Response, interface{}) interface + type Applications struct + CLI CLI + type AuthHandler interface + ExecuteFlow func(log *zerolog.Logger) (*oauth2.Token, error) + OnRequest func(log *zerolog.Logger, request *http.Request) error + ProfileKeys func() []string + type AuthServer struct + ClientID string + Issuer string + Keys []string + ListKeys []string + Scopes []string + type BeforeHandlerFunc func(string, *viper.Viper, *gentleman.Request) + func MakeAddHeaders(config ClientConfiguration) BeforeHandlerFunc + type CLI struct + OutputFormat string + Query string + Raw bool + Verbosity VerbosityType + func (c CLI) ZeroLogLevel() zerolog.Level + type ClientConfiguration struct + Secrets Secrets + Settings Settings + var RunConfig ClientConfiguration + func LoadConfiguration(envPrefix, settingsFilePath, secretsFilePath string, globalFlags []GlobalFlag) (config ClientConfiguration, err error) + func (cc *ClientConfiguration) UpdateCredentialsToken(credentialsName string, token *oauth2.Token) error + func (cc ClientConfiguration) GetAuthServer() AuthServer + func (cc ClientConfiguration) GetCredentials() Credentials + func (cc ClientConfiguration) GetProfile() Profile + func (cc ClientConfiguration) WriteSecrets(updates map[string]interface{}) (err error) + func (cc ClientConfiguration) WriteSettings(updates map[string]interface{}) (err error) + type Config struct + AppName string + EnvPrefix string + Version string + type ConsoleWriter struct + NoColor bool + Out io.Writer + func (w ConsoleWriter) Write(p []byte) (n int, err error) + type Credentials struct + TokenPayload TokenPayload + type DefaultFormatter struct + func NewDefaultFormatter(tty bool) *DefaultFormatter + func (f *DefaultFormatter) Format(data interface{}) error + type GlobalFlag struct + UseDefault bool + func MakeAndParseGlobalFlags(defaults GlobalFlagDefaults) (globalFlags []GlobalFlag, flagSet *pflag.FlagSet, err error) + type GlobalFlagDefaults struct + ApiURL string + AuthServerName string + CredentialsName string + Headers []string + OutputFormat string + ProfileName string + Raw bool + Verbosity string + func NewGlobalFlagDefaults(apiURL string) GlobalFlagDefaults + type OAuthHandler interface + NewToken func() (token *oauth2.Token, err error) + type Profile struct + ApiURL string + AuthServerName string + CredentialsName string + Extra map[string]interface{} + Headers []string + func (p Profile) ToProfileViperKeys(profileName, apiURL string) map[string]interface{} + type ResponseFormatter interface + Format func(interface{}) error + var Formatter ResponseFormatter + type Secrets struct + Credentials map[string]Credentials + type Settings struct + AuthServers map[string]AuthServer + ProfileName string + Profiles map[string]Profile + type TokenPayload struct + AccessToken string + ExpiresIn int + IDToken string + RefreshToken string + Scope string + TokenType string + func (tp TokenPayload) ExpiresAt() (time.Time, error) + func (tp TokenPayload) ParseClaimsUnverified() (jwt.MapClaims, error) + func (tp TokenPayload) ToMap() map[string]interface{} + type VerbosityType string + const VerbosityTypeDebug + const VerbosityTypeError + const VerbosityTypeFatal + const VerbosityTypeInfo + const VerbosityTypePanic + const VerbosityTypeWarn