mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Unified v1/event NewREST function with other
This commit is contained in:
parent
8fb2b901ad
commit
8d09083101
@ -35,12 +35,6 @@ type REST struct {
|
||||
|
||||
// NewREST returns a RESTStorage object that will work against events.
|
||||
func NewREST(optsGetter generic.RESTOptionsGetter, ttl uint64) (*REST, error) {
|
||||
resource := api.Resource("events")
|
||||
opts, err := optsGetter.GetRESTOptions(resource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
store := &genericregistry.Store{
|
||||
NewFunc: func() runtime.Object { return &api.Event{} },
|
||||
NewListFunc: func() runtime.Object { return &api.EventList{} },
|
||||
@ -48,7 +42,7 @@ func NewREST(optsGetter generic.RESTOptionsGetter, ttl uint64) (*REST, error) {
|
||||
TTLFunc: func(runtime.Object, uint64, bool) (uint64, error) {
|
||||
return ttl, nil
|
||||
},
|
||||
DefaultQualifiedResource: resource,
|
||||
DefaultQualifiedResource: api.Resource("events"),
|
||||
|
||||
CreateStrategy: event.Strategy,
|
||||
UpdateStrategy: event.Strategy,
|
||||
@ -56,7 +50,7 @@ func NewREST(optsGetter generic.RESTOptionsGetter, ttl uint64) (*REST, error) {
|
||||
|
||||
TableConvertor: printerstorage.TableConvertor{TableGenerator: printers.NewTableGenerator().With(printersinternal.AddHandlers)},
|
||||
}
|
||||
options := &generic.StoreOptions{RESTOptions: opts, AttrFunc: event.GetAttrs} // Pass in opts to use UndecoratedStorage
|
||||
options := &generic.StoreOptions{RESTOptions: optsGetter, AttrFunc: event.GetAttrs}
|
||||
if err := store.CompleteWithOptions(options); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user