Documentation
¶
Overview ¶
Package datum is our cobra/viper cli implementation
Index ¶
- Variables
- func Execute()
- func GetKeyring() (keyring.Keyring, error)
- func GetTokenFromKeyring(ctx context.Context) (*oauth2.Token, error)
- func JSONPrint(s []byte) error
- func StoreToken(token *oauth2.Token) error
- func ViperBindFlag(name string, flag *pflag.Flag)
- type CLI
- type RequiredFieldMissingError
Constants ¶
This section is empty.
Variables ¶
var ( // DatumHost contains the root url for the Datum API DatumHost string // GraphAPIHost contains the url for the Datum graph api GraphAPIHost string )
var ( // ErrTokenRequired is returned when no authentication token is provided ErrTokenRequired = errors.New("DATUM_ACCESS_TOKEN not set") )
var (
Logger *zap.SugaredLogger
)
var RootCmd = &cobra.Command{
Use: appName,
Short: "the datum cli",
}
RootCmd represents the base command when called without any subcommands
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func GetKeyring ¶
GetKeyring will return the already loaded keyring so that we don't prompt users for passwords multiple times
func GetTokenFromKeyring ¶
GetTokenFromKeyring will return the oauth token from the keyring if the token is expired, but the refresh token is still valid, the token will be refreshed
func ViperBindFlag ¶
ViperBindFlag provides a wrapper around the viper bindings that panics if an error occurs
Types ¶
type CLI ¶
type CLI struct {
Client datumclient.DatumClient
Interceptor clientv2.RequestInterceptor
AccessToken string
}
type RequiredFieldMissingError ¶
type RequiredFieldMissingError struct {
// Field contains the required field that was missing from the input
Field string
}
RequiredFieldMissingError is returned when a field is required but not provided
func NewRequiredFieldMissingError ¶
func NewRequiredFieldMissingError(f string) *RequiredFieldMissingError
NewRequiredFieldMissingError returns an error for a missing required field
func (*RequiredFieldMissingError) Error ¶
func (e *RequiredFieldMissingError) Error() string
Error returns the RequiredFieldMissingError in string format
Directories
¶
| Path | Synopsis |
|---|---|
|
Package datumgroup is our cobra/viper cli for group endpoints
|
Package datumgroup is our cobra/viper cli for group endpoints |
|
Package datumlogin is our cobra/viper cli for authentication endpoints
|
Package datumlogin is our cobra/viper cli for authentication endpoints |
|
Package datumorg is our cobra/viper cli for organization endpoints
|
Package datumorg is our cobra/viper cli for organization endpoints |
|
Package register allows user registration
|
Package register allows user registration |
|
Package reset allows user password reset
|
Package reset allows user password reset |
|
Package datumtokens is our cobra/viper cli for token endpoints
|
Package datumtokens is our cobra/viper cli for token endpoints |
|
Package datumuser is our cobra/viper cli for user endpoints
|
Package datumuser is our cobra/viper cli for user endpoints |