// GetResourceWithOptions returns a function that handles retrieving a single resource from a rest.Storage object. func GetResourceWithOptions(r rest.GetterWithOptions, scope RequestScope, getOptionsKind string, subpath bool, subpathKey string) restful.RouteFunction { return getResourceHandler(scope, func(ctx api.Context, name string, req *restful.Request) (runtime.Object, error) { opts, err := getRequestOptions(req, scope, getOptionsKind, subpath, subpathKey) if err != nil { return nil, err } return r.Get(ctx, name, opts) }) }
// GetResourceWithOptions returns a function that handles retrieving a single resource from a rest.Storage object. func GetResourceWithOptions(r rest.GetterWithOptions, e rest.Exporter, scope RequestScope, internalKind, externalKind unversioned.GroupVersionKind, subpath bool, subpathKey string) restful.RouteFunction { return getResourceHandler(scope, func(ctx api.Context, name string, req *restful.Request) (runtime.Object, error) { opts, err := getRequestOptions(req, scope, internalKind, externalKind, subpath, subpathKey) if err != nil { return nil, err } exportOpts := unversioned.ExportOptions{} if err := scope.Codec.DecodeParametersInto(req.Request.URL.Query(), &exportOpts); err != nil { return nil, err } if exportOpts.Export { return nil, errors.NewBadRequest("export unsupported") } return r.Get(ctx, name, opts) }) }