Documentation ¶
Index ¶
- Variables
- func IsValidPathSegmentName(name string) []string
- func NoNamespaceKeyFunc(_ context.Context, prefix string, uid string) (string, error)
- func StorageFactory() decorator.StorageDecorator
- type AfterCreateFunc
- type AfterDeleteFunc
- type AfterUpdateFunc
- type BeginCreateFunc
- type BeginUpdateFunc
- type DryRunnableStorage
- func (s *DryRunnableStorage) Count(key string) (int64, error)
- func (s *DryRunnableStorage) Create(ctx context.Context, key string, obj, out runtime.Object, ttl uint64, ...) error
- func (s *DryRunnableStorage) Delete(ctx context.Context, key string, out runtime.Object, preconditions interface{}, ...) error
- func (s *DryRunnableStorage) Get(ctx context.Context, key string, opts meta.GetOptions, objPtr runtime.Object) error
- func (s *DryRunnableStorage) GetList(ctx context.Context, key string, opts meta.ListOptions, listObj runtime.Object) error
- func (s *DryRunnableStorage) GuaranteedUpdate(ctx context.Context, key string, destination runtime.Object, ...) error
- func (s *DryRunnableStorage) Versioner() storage.Versioner
- func (s *DryRunnableStorage) Watch(ctx context.Context, key string, opts meta.ListOptions) (watch.Interface, error)
- type FinishFunc
- type RequestScope
- type Store
- func (e *Store) CompleteWithOptions(options *options.StoreOptions) error
- func (e *Store) Create(ctx context.Context, obj runtime.Object, ...) (runtime.Object, error)
- func (e *Store) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, ...) (runtime.Object, bool, error)
- func (e *Store) Destroy()
- func (e *Store) Get(ctx context.Context, name string, options *meta.GetOptions) (runtime.Object, error)
- func (e *Store) GetCreateStrategy() rest.RESTCreateStrategy
- func (e *Store) GetDeleteStrategy() rest.RESTDeleteStrategy
- func (e *Store) GetUpdateStrategy() rest.RESTUpdateStrategy
- func (e *Store) List(ctx context.Context, options *meta.ListOptions) (runtime.Object, error)
- func (e *Store) ListPredicate(ctx context.Context, p meta.SelectionPredicate, options *meta.ListOptions) (runtime.Object, error)
- func (e *Store) New() runtime.Object
- func (e *Store) NewList() runtime.Object
- func (e *Store) NewListStruct() interface{}
- func (e *Store) NewStruct() interface{}
- func (e *Store) ProducesMIMETypes(_ string) []string
- func (e *Store) ProducesObject(verb string) interface{}
- func (e *Store) Update(ctx context.Context, name string, objInfo runtime.Object, ...) (runtime.Object, bool, error)
- func (e *Store) Watch(ctx context.Context, options *meta.ListOptions) (watch.Interface, error)
- func (e *Store) WatchPredicate(ctx context.Context, p meta.SelectionPredicate, resourceVersion string, ...) (watch.Interface, error)
Constants ¶
This section is empty.
Variables ¶
var NameMayNotBe = []string{".", ".."}
NameMayNotBe specifies strings that cannot be used as names specified as path segments (like the REST API or etcd store)
var NameMayNotContain = []string{"/", "%"}
NameMayNotContain specifies substrings that cannot be used in names specified as path segments (like the REST API or etcd store)
Functions ¶
func IsValidPathSegmentName ¶
IsValidPathSegmentName validates the name can be safely encoded as a path segment
func NoNamespaceKeyFunc ¶
NoNamespaceKeyFunc is the default function for constructing storage paths to a resource relative to the given prefix without a namespace.
func StorageFactory ¶
func StorageFactory() decorator.StorageDecorator
Types ¶
type AfterCreateFunc ¶
type AfterCreateFunc func(obj runtime.Object, options *meta.CreateOptions)
AfterCreateFunc is the type used for the Store.AfterCreate hook.
type AfterDeleteFunc ¶
type AfterDeleteFunc func(obj runtime.Object, options *meta.DeleteOptions)
AfterDeleteFunc is the type used for the Store.AfterDelete hook.
type AfterUpdateFunc ¶
type AfterUpdateFunc func(obj runtime.Object, options *meta.UpdateOptions)
AfterUpdateFunc is the type used for the Store.AfterUpdate hook.
type BeginCreateFunc ¶
type BeginCreateFunc func(ctx context.Context, obj runtime.Object, options *meta.CreateOptions) (FinishFunc, error)
BeginCreateFunc is the type used for the Store.BeginCreate hook.
type BeginUpdateFunc ¶
type BeginUpdateFunc func(ctx context.Context, obj, old runtime.Object, options *meta.UpdateOptions) (FinishFunc, error)
BeginUpdateFunc is the type used for the Store.BeginUpdate hook.
type DryRunnableStorage ¶
func (*DryRunnableStorage) Get ¶
func (s *DryRunnableStorage) Get(ctx context.Context, key string, opts meta.GetOptions, objPtr runtime.Object) error
func (*DryRunnableStorage) GetList ¶
func (s *DryRunnableStorage) GetList(ctx context.Context, key string, opts meta.ListOptions, listObj runtime.Object) error
func (*DryRunnableStorage) GuaranteedUpdate ¶
func (*DryRunnableStorage) Versioner ¶
func (s *DryRunnableStorage) Versioner() storage.Versioner
type FinishFunc ¶
FinishFunc is a function returned by Begin hooks to complete an operation.
type RequestScope ¶
type RequestScope struct { Serializer runtime.NegotiatedSerializer // StandardSerializers, if set, restricts which serializers can be used when // we aren't transforming the output (into Table or PartialObjectMetadata). // Used only by CRDs which do not yet support Protobuf. StandardSerializers []runtime.SerializerInfo Resource schema.GroupVersionResource Kind schema.GroupVersionKind Verb string Subresource string MetaGroupVersion schema.GroupVersion // HubGroupVersion indicates what version objects read from etcd or incoming requests should be converted to for in-memory handling. HubGroupVersion schema.GroupVersion MaxRequestBodyBytes int64 }
RequestScope encapsulates common fields across all RESTFul handler methods.
func NewRequestScope ¶
func NewRequestScope(verb, resource, subresource string) *RequestScope
func (*RequestScope) AllowsMediaTypeTransform ¶
func (scope *RequestScope) AllowsMediaTypeTransform(mimeType, mimeSubType string, gvk *schema.GroupVersionKind) bool
func (*RequestScope) AllowsServerVersion ¶
func (scope *RequestScope) AllowsServerVersion(version string) bool
func (*RequestScope) AllowsStreamSchema ¶
func (scope *RequestScope) AllowsStreamSchema(s string) bool
type Store ¶
type Store struct { // 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 // NewStructFunc return struct NewStructFunc func() interface{} // NewListStructFunc return struct NewListStructFunc func() interface{} // 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 // KeyRootFunc returns the root etcd key for this resource; should not // include trailing "/". This is used for operations that work on the // entire collection (listing and watching). // // KeyRootFunc and KeyFunc must be supplied together or not at all. KeyRootFunc func(ctx context.Context) string // 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 and KeyRootFunc must be supplied together or not at all. KeyFunc func(ctx context.Context, uid string) (string, error) // ObjectUIDFunc returns the uid of an object or an error. ObjectUIDFunc func(obj runtime.Object) (string, error) // TTLFunc returns the TTL (time to live) that objects should be persisted // with. The existing parameter is the current TTL or the default for this // operation. The update parameter indicates whether this is an operation // against an existing object. // // Objects that are persisted with a TTL are evicted once the TTL expires. TTLFunc func(obj runtime.Object, existing uint64, update bool) (uint64, 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 string, field string) meta.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 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 // Decorator is an optional exit hook on an object returned from the // underlying storage. The returned object could be an individual object // (e.g. Stage) or a list type (e.g. StageList). Decorator is intended for // integrations that are above storage and should only be used for // specific cases where storage of the value is not appropriate, since // they cannot be watched. Decorator func(runtime.Object) // CreateStrategy implements resource-specific behavior during creation. CreateStrategy rest.RESTCreateStrategy // BeginCreate is an optional hook that returns a "transaction-like" // commit/revert function which will be called at the end of the operation, // but before AfterCreate and Decorator, indicating via the argument // whether the operation succeeded. If this returns an error, the function // is not called. Almost nobody should use this hook. BeginCreate BeginCreateFunc // AfterCreate implements a further operation to run after a resource is // created and before it is decorated, optional. AfterCreate AfterCreateFunc // UpdateStrategy implements resource-specific behavior during updates. UpdateStrategy rest.RESTUpdateStrategy // BeginUpdate is an optional hook that returns a "transaction-like" // commit/revert function which will be called at the end of the operation, // but before AfterUpdate and Decorator, indicating via the argument // whether the operation succeeded. If this returns an error, the function // is not called. Almost nobody should use this hook. BeginUpdate BeginUpdateFunc // AfterUpdate implements a further operation to run after a resource is // updated and before it is decorated, optional. AfterUpdate AfterUpdateFunc // DeleteStrategy implements resource-specific behavior during deletion. DeleteStrategy rest.RESTDeleteStrategy // AfterDelete implements a further operation to run after a resource is // deleted and before it is decorated, optional. AfterDelete AfterDeleteFunc // ResetFieldsStrategy provides the fields reset by the strategy that // should not be modified by the user. ResetFieldsStrategy rest.ResetFieldsStrategy // Storage is the interface for the underlying storage for the // resource. It is wrapped into a "DryRunnableStorage" that will // either pass through or simply dry-run. Storage DryRunnableStorage // StorageVersioner outputs the <group/version/kind> an object will be // converted to before persisted in etcd, given a list of possible // kinds of the object. // If the StorageVersioner is nil, apiserver will leave the // storageVersionHash as empty in the discovery document. StorageVersioner runtime.GroupVersioner // 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() }
func (*Store) CompleteWithOptions ¶
func (e *Store) CompleteWithOptions(options *options.StoreOptions) error
CompleteWithOptions updates the store with the provided options and defaults common fields.
func (*Store) GetCreateStrategy ¶
func (e *Store) GetCreateStrategy() rest.RESTCreateStrategy
GetCreateStrategy implements GenericStore.
func (*Store) GetDeleteStrategy ¶
func (e *Store) GetDeleteStrategy() rest.RESTDeleteStrategy
GetDeleteStrategy implements GenericStore.
func (*Store) GetUpdateStrategy ¶
func (e *Store) GetUpdateStrategy() rest.RESTUpdateStrategy
GetUpdateStrategy implements GenericStore.
func (*Store) List ¶
List returns a list of items matching labels and field according to the store's PredicateFunc.
func (*Store) ListPredicate ¶
func (e *Store) ListPredicate(ctx context.Context, p meta.SelectionPredicate, options *meta.ListOptions) (runtime.Object, error)
ListPredicate returns a list of all the items matching the given SelectionPredicate.
func (*Store) NewListStruct ¶
func (e *Store) NewListStruct() interface{}
NewListStruct implements rest.Lister.
func (*Store) ProducesMIMETypes ¶
ProducesMIMETypes implements rest.StorageMetadata.
func (*Store) ProducesObject ¶
ProducesObject implements rest.StorageMetadata.