Documentation
¶
Index ¶
- Constants
- func NamespaceKeyFunc(ctx context.Context, name string) (types.NamespacedName, error)
- func NewTableConverter(resource schema.GroupResource, cells TableConvertorCellFn, ...) rest.TableConvertor
- func NoNamespaceKeyFunc(ctx context.Context, name string) (types.NamespacedName, error)
- type Store
- func (r *Store) Categories() []string
- func (r *Store) CompleteWithOptions(options *generic.StoreOptions) error
- func (r *Store) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error)
- func (r *Store) Create(ctx context.Context, obj runtime.Object, ...) (runtime.Object, error)
- func (r *Store) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, ...) (runtime.Object, bool, error)
- func (r *Store) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, ...) (runtime.Object, error)
- func (r *Store) Destroy()
- func (r *Store) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)
- func (e *Store) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set
- func (r *Store) GetSingularName() string
- func (r *Store) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error)
- func (r *Store) NamespaceScoped() bool
- func (r *Store) New() runtime.Object
- func (r *Store) NewList() runtime.Object
- func (r *Store) ShortNames() []string
- func (r *Store) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, ...) (runtime.Object, bool, error)
- func (r *Store) Watch(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
- type TableConvertorCellFn
Constants ¶
const (
OptimisticLockErrorMsg = "the object has been modified; please apply your changes to the latest version and try again"
)
Variables ¶
This section is empty.
Functions ¶
func NamespaceKeyFunc ¶
NamespaceKeyFunc is the default function for constructing storage paths to a resource relative to the given prefix enforcing namespace rules. If the context does not contain a namespace, it errors.
func NewTableConverter ¶
func NewTableConverter( resource schema.GroupResource, cells TableConvertorCellFn, columns []metav1.TableColumnDefinition, ) rest.TableConvertor
func NoNamespaceKeyFunc ¶
NoNamespaceKeyFunc is the default function for constructing storage paths to a resource relative to the given prefix without a namespace.
Types ¶
type Store ¶
type Store struct { Tracer trace.Tracer // NewFunc returns a new instance of the type this registry returns for a // GET of a single object, e.g.: // // curl GET /apis/group/version/namespaces/my-ns/myresource/name-of-object NewFunc func() runtime.Object // NewListFunc returns a new list of the type this registry; it is the // type returned when the resource is listed, e.g.: // // curl GET /apis/group/version/namespaces/my-ns/myresource NewListFunc func() runtime.Object // DefaultQualifiedResource is the pluralized name of the resource. // This field is used if there is no request info present in the context. // See qualifiedResourceFromContext for details. DefaultQualifiedResource schema.GroupResource // SingularQualifiedResource is the singular name of the resource. SingularQualifiedResource schema.GroupResource // KeyFunc returns the key for a specific object in the collection. // KeyFunc is called for Create/Update/Get/Delete. Note that 'namespace' // can be gotten from ctx. KeyFunc func(ctx context.Context, name string) (types.NamespacedName, error) // ObjectNameFunc returns the name of an object or an error. ObjectNameFunc func(obj runtime.Object) (string, error) // PredicateFunc returns a matcher corresponding to the provided labels // and fields. The SelectionPredicate returned should return true if the // object matches the given field and label selectors. PredicateFunc func(label labels.Selector, field fields.Selector) storage.SelectionPredicate // EnableGarbageCollection affects the handling of Update and Delete // requests. Enabling garbage collection allows finalizers to do work to // finalize this object before the store deletes it. // // If any store has garbage collection enabled, it must also be enabled in // the kube-controller-manager. EnableGarbageCollection bool // DeleteCollectionWorkers is the maximum number of workers in a single // DeleteCollection call. Delete requests for the items in a collection // are issued in parallel. DeleteCollectionWorkers int // GetStrategy implements resource-specific behavior during get. GetStrategy reststore.RESTGetStrategy // ListStrategy implements resource-specific behavior during list. ListStrategy reststore.RESTListStrategy // CreateStrategy implements resource-specific behavior during creation. CreateStrategy reststore.RESTCreateStrategy // UpdateStrategy implements resource-specific behavior during updates. UpdateStrategy reststore.RESTUpdateStrategy // DeleteStrategy implements resource-specific behavior during deletion. DeleteStrategy reststore.RESTDeleteStrategy WatchStrategy reststore.RESTWatchStrategy // ReturnDeletedObject determines whether the Store returns the object // that was deleted. Otherwise, return a generic success status response. ReturnDeletedObject bool // TableConvertor is an optional interface for transforming items or lists // of items into tabular output. If unset, the default will be used. TableConvertor rest.TableConvertor // ResetFieldsStrategy provides the fields reset by the strategy that // should not be modified by the user. ResetFieldsStrategy rest.ResetFieldsStrategy // DestroyFunc cleans up clients used by the underlying Storage; optional. // If set, DestroyFunc has to be implemented in thread-safe way and // be prepared for being called more than once. DestroyFunc func() ShortNameList []string CategoryList []string Storage storebackend.Storer[runtime.Object] }
func (*Store) Categories ¶
func (*Store) CompleteWithOptions ¶
func (r *Store) CompleteWithOptions(options *generic.StoreOptions) error
CompleteWithOptions updates the store with the provided options and defaults common fields.
func (*Store) ConvertToTable ¶
func (*Store) Delete ¶
func (r *Store) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions) (runtime.Object, bool, error)
Delete removes the item from storage. options can be mutated by rest.BeforeDelete due to a graceful deletion strategy.
func (*Store) DeleteCollection ¶
func (r *Store) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions, listOptions *metainternalversion.ListOptions) (runtime.Object, error)
DeleteCollection removes all items returned by List with a given ListOptions from storage.
DeleteCollection is currently NOT atomic. It can happen that only subset of objects will be deleted from storage, and then an error will be returned. In case of success, the list of deleted objects will be returned.
func (*Store) GetResetFields ¶
func (e *Store) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set
GetResetFields implements rest.ResetFieldsStrategy
func (*Store) GetSingularName ¶
func (*Store) List ¶
func (r *Store) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error)
List returns a list of items matching labels and field according to the store's PredicateFunc.
func (*Store) NamespaceScoped ¶
NamespaceScoped indicates whether the resource is namespaced
func (*Store) ShortNames ¶
func (*Store) Update ¶
func (r *Store) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error)
Update performs an atomic update and set of the object. Returns the result of the update or an error. If the registry allows create-on-update, the create flow will be executed. A bool is returned along with the object and any errors, to indicate object creation.
func (*Store) Watch ¶
func (r *Store) Watch(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error)