Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for IsListType (0.12 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/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)
  3. 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)
  4. 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)
  5. 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)
  6. staging/src/k8s.io/cli-runtime/pkg/printers/tableprinter.go

    		Cells:  []interface{}{status.Status, status.Reason, status.Message},
    	}}, nil
    }
    
    func printObjectMeta(obj runtime.Object, options PrintOptions) ([]metav1.TableRow, error) {
    	if meta.IsListType(obj) {
    		rows := make([]metav1.TableRow, 0, 16)
    		err := meta.EachListItem(obj, func(obj runtime.Object) error {
    			nestedRows, err := printObjectMeta(obj, options)
    			if err != nil {
    				return err
    			}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Oct 30 15:08:43 UTC 2022
    - 16.7K bytes
    - Viewed (0)
Back to top