Documentation
¶
Index ¶
- Variables
- func FileExtensionCompletions(extension ...string) ...
- func GetArgs(fields ...CompletionArgumentType) ...
- func GetCaveatContext(cmd *cobra.Command) (*structpb.Struct, error)
- func InjectRequestID(cmd *cobra.Command, _ []string) error
- func ParseCaveatContext(contextString string) (*structpb.Struct, error)
- func ParseSubject(s string) (namespace, id, relation string, err error)
- func ParseType(s string) (namespace, relation string)
- func PrettyProto(m proto.Message) ([]byte, error)
- func ReadSchema(ctx context.Context, client client.Client) (string, error)
- func RegisterPermissionCmd(rootCmd *cobra.Command) *cobra.Command
- func RegisterRelationshipCmd(rootCmd *cobra.Command) *cobra.Command
- func RegisterSchemaCmd(rootCmd *cobra.Command) *cobra.Command
- func RegisterWatchCmd(rootCmd *cobra.Command) *cobra.Command
- func RegisterWatchRelationshipCmd(parentCmd *cobra.Command) *cobra.Command
- func StdinOrExactArgs(n int) cobra.PositionalArgs
- type CompletionArgumentType
- type RelationshipParser
Constants ¶
This section is empty.
Variables ¶
var ErrExhaustedRelationships = errors.New("exhausted all relationships")
ErrExhaustedRelationships signals that the last producible value of a RelationshipParser has already been consumed. Functions should return this error to signal a graceful end of input.
var ErrMultipleConsistencies = errors.New("provided multiple consistency flags")
Functions ¶
func FileExtensionCompletions ¶ added in v0.16.4
func GetArgs ¶ added in v0.16.0
func GetArgs(fields ...CompletionArgumentType) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
func GetCaveatContext ¶
GetCaveatContext returns the entered caveat caveat, if any.
func InjectRequestID ¶ added in v0.17.1
InjectRequestID adds the value of the --request-id flag to the context of the given command.
func ParseCaveatContext ¶
ParseCaveatContext parses the given context JSON string into caveat context, if valid.
func ParseSubject ¶
ParseSubject parses the given subject string into its namespace, object ID and relation, if valid.
func PrettyProto ¶
PrettyProto returns the given protocol buffer formatted into pretty text.
func ReadSchema ¶
ReadSchema calls read schema for the client and returns the schema found.
func RegisterWatchCmd ¶ added in v0.10.0
func RegisterWatchRelationshipCmd ¶ added in v0.16.5
func StdinOrExactArgs ¶ added in v0.16.0
func StdinOrExactArgs(n int) cobra.PositionalArgs
Types ¶
type CompletionArgumentType ¶ added in v0.16.0
type CompletionArgumentType int
const ( ResourceType CompletionArgumentType = iota ResourceID Permission SubjectType SubjectID SubjectTypeWithOptionalRelation )
type RelationshipParser ¶ added in v0.12.0
type RelationshipParser func() (*v1.Relationship, error)
RelationshipParser is a closure that can produce relationships. When there are no more relationships, it will return ErrExhaustedRelationships.
func FileRelationshipParser ¶ added in v0.12.0
func FileRelationshipParser(f *os.File) RelationshipParser
func SliceRelationshipParser ¶ added in v0.12.0
func SliceRelationshipParser(args []string) RelationshipParser