Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for IsListType (0.21 sec)

  1. staging/src/k8s.io/apimachinery/pkg/api/meta/help.go

    )
    
    var (
    	// isListCache maintains a cache of types that are checked for lists
    	// which is used by IsListType.
    	// TODO: remove and replace with an interface check
    	isListCache = struct {
    		lock   sync.RWMutex
    		byType map[reflect.Type]bool
    	}{
    		byType: make(map[reflect.Type]bool, 1024),
    	}
    )
    
    // IsListType returns true if the provided Object has a slice called Items.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 29 16:25:43 UTC 2023
    - 9.8K bytes
    - Viewed (0)
  2. staging/src/k8s.io/cli-runtime/pkg/printers/managedfields.go

    func (p *OmitManagedFieldsPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
    	if obj == nil {
    		return p.Delegate.PrintObj(obj, w)
    	}
    	if meta.IsListType(obj) {
    		obj = obj.DeepCopyObject()
    		_ = meta.EachListItem(obj, func(item runtime.Object) error {
    			omitManagedFields(item)
    			return nil
    		})
    	} else if _, err := meta.Accessor(obj); err == nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Feb 16 14:52:03 UTC 2021
    - 1.6K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apimachinery/pkg/api/meta/table/table.go

    // each accessed item, with name and age being passed to each.
    func MetaToTableRow(obj runtime.Object, rowFn func(obj runtime.Object, m metav1.Object, name, age string) ([]interface{}, error)) ([]metav1.TableRow, error) {
    	if meta.IsListType(obj) {
    		rows := make([]metav1.TableRow, 0, 16)
    		err := meta.EachListItem(obj, func(obj runtime.Object) error {
    			nestedRows, err := MetaToTableRow(obj, rowFn)
    			if err != nil {
    				return err
    			}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Nov 26 18:18:18 UTC 2019
    - 2K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apiserver/pkg/registry/rest/table.go

    			Cells:  []interface{}{m.GetName(), m.GetCreationTimestamp().Time.UTC().Format(time.RFC3339)},
    			Object: runtime.RawExtension{Object: obj},
    		})
    		return nil
    	}
    	switch {
    	case meta.IsListType(object):
    		if err := meta.EachListItem(object, fn); err != nil {
    			return nil, err
    		}
    	default:
    		if err := fn(object); err != nil {
    			return nil, err
    		}
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Feb 14 17:25:12 UTC 2022
    - 3.4K bytes
    - Viewed (0)
  5. staging/src/k8s.io/cli-runtime/pkg/resource/visitor.go

    			return err
    		}
    		if info.Object == nil {
    			return fn(info, nil)
    		}
    		if !meta.IsListType(info.Object) {
    			return fn(info, nil)
    		}
    
    		items := []runtime.Object{}
    		itemsToProcess := []runtime.Object{info.Object}
    
    		for i := 0; i < len(itemsToProcess); i++ {
    			currObj := itemsToProcess[i]
    			if !meta.IsListType(currObj) {
    				items = append(items, currObj)
    				continue
    			}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jul 03 10:17:56 UTC 2023
    - 21.3K bytes
    - Viewed (0)
  6. staging/src/k8s.io/cli-runtime/pkg/printers/name.go

    	if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
    		return fmt.Errorf(InternalObjectPrinterErr)
    	}
    
    	if meta.IsListType(obj) {
    		// we allow unstructured lists for now because they always contain the GVK information.  We should chase down
    		// callers and stop them from passing unflattened lists
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jun 28 23:24:54 UTC 2019
    - 3.9K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/pkg/endpoints/handlers/response.go

    		return
    	}
    
    	// ensure that for empty lists we don't return <nil> items.
    	// This is safe to modify without deep-copying the object, as
    	// List objects themselves are never cached.
    	if meta.IsListType(result) && meta.LenList(result) == 0 {
    		if err := meta.SetList(result, []runtime.Object{}); err != nil {
    			scope.err(err, w, req)
    			return
    		}
    	}
    
    	var obj runtime.Object
    	do := func() {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Oct 18 09:07:03 UTC 2023
    - 16.5K bytes
    - Viewed (0)
  8. staging/src/k8s.io/cli-runtime/pkg/resource/result.go

    		}
    	}
    
    	if len(objects) == 1 {
    		if r.singleItemImplied {
    			return objects[0], nil
    		}
    		// if the item is a list already, don't create another list
    		if meta.IsListType(objects[0]) {
    			return objects[0], nil
    		}
    	}
    
    	version := ""
    	if len(versions) == 1 {
    		version = versions.List()[0]
    	}
    
    	return toV1List(objects, version), err
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 07 23:00:24 UTC 2019
    - 7.3K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/pkg/audit/request.go

    func copyWithoutManagedFields(obj runtime.Object) (runtime.Object, bool, error) {
    	isAccessor := true
    	if _, err := meta.Accessor(obj); err != nil {
    		isAccessor = false
    	}
    	isList := meta.IsListType(obj)
    	_, isTable := obj.(*metav1.Table)
    	if !isAccessor && !isList && !isTable {
    		return nil, false, nil
    	}
    
    	// TODO a deep copy isn't really needed here, figure out how we can reliably
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jul 03 16:16:51 UTC 2023
    - 9K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apimachinery/pkg/test/api_meta_help_test.go

    	tests := []struct {
    		obj    runtime.Object
    		isList bool
    	}{
    		{&testapigroup.CarpList{}, true},
    		{&testapigroup.Carp{}, false},
    	}
    	for _, item := range tests {
    		if e, a := item.isList, meta.IsListType(item.obj); e != a {
    			t.Errorf("%v: Expected %v, got %v", reflect.TypeOf(item.obj), e, a)
    		}
    	}
    }
    
    func TestExtractList(t *testing.T) {
    	list1 := []runtime.Object{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 12 15:46:12 UTC 2023
    - 8.5K bytes
    - Viewed (0)
Back to top