Documentation ¶
Overview ¶
Package datum is our cobra/viper cli implementation
Index ¶
- Variables
- func Execute()
- func GetInviteStatusEnum(status string) (enums.InviteStatus, error)
- func GetKeyring() (keyring.Keyring, error)
- func GetRoleEnum(role string) (enums.Role, error)
- func GetTokenFromKeyring(ctx context.Context) (*oauth2.Token, string, error)
- func JSONPrint(s []byte) error
- func ParseBytes(v []byte) (map[string]interface{}, error)
- func ParseJSON(v string) (map[string]interface{}, error)
- func StoreSession(session string) error
- func StoreSessionCookies(client *datumclient.Client)
- func StoreToken(token *oauth2.Token) error
- func ViperBindFlag(name string, flag *pflag.Flag)
- type CLI
- type RequiredFieldMissingError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTokenRequired is returned when no authentication token is provided ErrTokenRequired = errors.New("DATUM_ACCESS_TOKEN not set") // ErrInvalidRole is returned when an invalid role is provided for a member ErrInvalidRole = errors.New("invalid role, only member and admin are allowed") // ErrInvalidInviteStatus is returned when an invalid status is provided for an invite ErrInvalidInviteStatus = errors.New("invalid status, only sent, required, accepted, expired are allowed") // ErrUnsupportedProvider is returned when an invalid provider is specified during login ErrUnsupportedProvider = errors.New("invalid provider, only Github and Google are supported") // ErrNotFound is returned when a resource is not found ErrNotFound = errors.New("resource not found") )
var ( OutputFormat string Logger *zap.SugaredLogger )
var ( // DatumHost contains the root url for the Datum API DatumHost string // GraphAPIHost contains the url for the Datum graph api GraphAPIHost string )
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 GetInviteStatusEnum ¶ added in v0.2.6
func GetInviteStatusEnum(status string) (enums.InviteStatus, error)
GetInviteStatusEnum returns the invitation status if valid, otherwise returns an error
func GetKeyring ¶
GetKeyring will return the already loaded keyring so that we don't prompt users for passwords multiple times
func GetRoleEnum ¶ added in v0.2.5
GetRoleEnum returns the Role if valid, otherwise returns an error
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 ParseBytes ¶ added in v0.5.0
ParseBytes parses buffered bytes into a map
func StoreSession ¶ added in v0.2.5
StoreSession in local keyring
func StoreSessionCookies ¶ added in v0.2.5
func StoreSessionCookies(client *datumclient.Client)
StoreSessionCookies gets the session cookie from the cookie jar and stores it in the keychain for future requests
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 datumapitokens is our cobra/viper cli for api token endpoints
|
Package datumapitokens is our cobra/viper cli for api token endpoints |
Package datumgroup is our cobra/viper cli for group endpoints
|
Package datumgroup is our cobra/viper cli for group endpoints |
Package datumgroupmembers is our cobra/viper cli for group member endpoints
|
Package datumgroupmembers is our cobra/viper cli for group member endpoints |
Package datumgroupsetting provides commands for managing group settings
|
Package datumgroupsetting provides commands for managing group settings |
Package datuminvite creates invitation emails + tokens for external users to join a Datum organization
|
Package datuminvite creates invitation emails + tokens for external users to join a Datum organization |
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 datumorgmembers is our cobra/viper cli for org member endpoints
|
Package datumorgmembers is our cobra/viper cli for org member endpoints |
Package datumorgsetting provides commands for managing organization settings
|
Package datumorgsetting provides commands for managing organization settings |
Package datumtokens is our cobra/viper cli for token endpoints
|
Package datumtokens is our cobra/viper cli for token endpoints |
Package register allows user registration
|
Package register allows user registration |
Package reset allows user password reset
|
Package reset allows user password reset |
Package datumsubscribers is our cobra/viper cli for subscriber endpoints
|
Package datumsubscribers is our cobra/viper cli for subscriber endpoints |
Package datumswitch provides a basic interface to switch between oragnization contexts
|
Package datumswitch provides a basic interface to switch between oragnization contexts |
Package datumuser is our cobra/viper cli for user endpoints
|
Package datumuser is our cobra/viper cli for user endpoints |
Package datumusersetting is our cobra/viper cli for user setting endpoints
|
Package datumusersetting is our cobra/viper cli for user setting endpoints |
Package version contains the version information for the CLI
|
Package version contains the version information for the CLI |