Ejemplo n.º 1
0
// GetResourceWithOptions returns a function that handles retrieving a single resource from a rest.Storage object.
func GetResourceWithOptions(r rest.GetterWithOptions, scope RequestScope) restful.RouteFunction {
	return getResourceHandler(scope,
		func(ctx api.Context, name string, req *restful.Request) (runtime.Object, error) {
			opts, subpath, subpathKey := r.NewGetOptions()
			if err := getRequestOptions(req, scope, opts, subpath, subpathKey); err != nil {
				return nil, err
			}
			return r.Get(ctx, name, opts)
		})
}