Documentation ¶
Index ¶
- func ListAll[T1 any, T2 any](ctx context.Context, ...) error
- type EnumFlag
- func (e *EnumFlag[T]) CompletionFunc() func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)
- func (e *EnumFlag[T]) Names() []string
- func (e *EnumFlag[T]) Set(s string) error
- func (e *EnumFlag[T]) String() string
- func (e *EnumFlag[T]) Type() string
- func (e *EnumFlag[T]) Value() T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListAll ¶
func ListAll[T1 any, T2 any](ctx context.Context, list func(context.Context, *connect.Request[T1]) (*connect.Response[T2], error), f1 func(string) *T1, f2 func(*T2), f3 func(*T2) string) error
ListAll is a helper function to list all items from a paginated API.
list is the function to call to list items. (e.g. kev1alpha.KeService.ListCluster) f1 is the function to create the request object. It takes a page token as input and returns the request message (e.g. func(string) *kev1alpha.ListClusterRequest) f2 is the function to process the response object. It takes the response message as input. (e.g. func(*kev1alpha.ListClusterResponse)) f3 is the function to retrieve the next page token from the response object. It takes the response message as input and returns the next page token. (e.g. func(*kev1alpha.ListClusterResponse) string)
The page token is used to retrieve the next page of results. If it is empty, the first page will be retrieved. The page token is retrieved from the response object using the GetNextPageToken() method. If the token is empty, the last page has been reached and the function will return.
Types ¶
type EnumFlag ¶
type EnumFlag[T ~int32] struct { // contains filtered or unexported fields }
EnumFlag implements pflag.Value for proto enum T.
func NewEnumFlag ¶
func (*EnumFlag[T]) CompletionFunc ¶
func (e *EnumFlag[T]) CompletionFunc() func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)
CompletionFunc returns a completion function for the flag. https://github.com/spf13/cobra/blob/main/shell_completions.md#completions-for-flags