Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 22 for PrintObj (0.37 sec)

  1. staging/src/k8s.io/cli-runtime/pkg/printers/jsonpath_test.go

    	expectedErrors := sets.NewString("emptyPodList", "nonEmptyPodList", "endpoints")
    
    	for oName, obj := range objects {
    		b := &bytes.Buffer{}
    		if err := jsonpathPrinter.PrintObj(obj, b); err != nil {
    			if expectedErrors.Has(oName) {
    				// expected error
    				continue
    			}
    			t.Errorf("JSONPathPrinter error object '%v'; error: '%v'", oName, err)
    		}
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 15 21:58:20 UTC 2020
    - 2.1K bytes
    - Viewed (0)
  2. staging/src/k8s.io/cli-runtime/pkg/printers/yaml.go

    // The input object is assumed to be in the internal version of an API and is converted
    // to the given version first.
    // If PrintObj() is called multiple times, objects are separated with a '---' separator.
    type YAMLPrinter struct {
    	printCount int64
    }
    
    // PrintObj prints the data as YAML.
    func (p *YAMLPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
    	// we use reflect.Indirect here in order to obtain the actual value from a pointer.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jun 02 14:15:25 UTC 2022
    - 2.5K bytes
    - Viewed (0)
  3. staging/src/k8s.io/cli-runtime/pkg/printers/managedfields_test.go

    	v1 "k8s.io/api/core/v1"
    	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    	"k8s.io/apimachinery/pkg/runtime"
    )
    
    type testResourcePrinter func(object runtime.Object, writer io.Writer) error
    
    func (p testResourcePrinter) PrintObj(o runtime.Object, w io.Writer) error {
    	return p(o, w)
    }
    
    func TestOmitManagedFieldsPrinter(t *testing.T) {
    	testCases := []struct {
    		name     string
    		object   runtime.Object
    		expected runtime.Object
    	}{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Feb 16 14:52:03 UTC 2021
    - 2.6K bytes
    - Viewed (0)
  4. staging/src/k8s.io/cli-runtime/pkg/genericclioptions/template_flags_test.go

    				}
    				return
    			}
    			if err != nil {
    				t.Fatalf("unexpected error: %v", err)
    			}
    
    			out := bytes.NewBuffer([]byte{})
    			err = p.PrintObj(testObject, out)
    			if err != nil {
    				t.Errorf("unexpected error: %v", err)
    			}
    
    			if len(out.String()) != len(tc.expectedOutput) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jun 02 09:47:52 UTC 2023
    - 5.9K bytes
    - Viewed (0)
  5. staging/src/k8s.io/cli-runtime/pkg/printers/template.go

    func (p *GoTemplatePrinter) AllowMissingKeys(allow bool) {
    	if allow {
    		p.template.Option("missingkey=default")
    	} else {
    		p.template.Option("missingkey=error")
    	}
    }
    
    // PrintObj formats the obj with the Go Template.
    func (p *GoTemplatePrinter) PrintObj(obj runtime.Object, w io.Writer) error {
    	if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
    		return fmt.Errorf(InternalObjectPrinterErr)
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 07 23:00:24 UTC 2019
    - 3.4K bytes
    - Viewed (0)
  6. staging/src/k8s.io/cli-runtime/pkg/printers/jsonpath.go

    	if err := j.Parse(tmpl); err != nil {
    		return nil, err
    	}
    	return &JSONPathPrinter{
    		rawTemplate: tmpl,
    		JSONPath:    j,
    	}, nil
    }
    
    // PrintObj formats the obj with the JSONPath Template.
    func (j *JSONPathPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
    	// we use reflect.Indirect here in order to obtain the actual value from a pointer.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Jun 25 16:23:43 UTC 2022
    - 4.3K bytes
    - Viewed (0)
  7. staging/src/k8s.io/cli-runtime/pkg/genericclioptions/jsonpath_flags_test.go

    				}
    				return
    			}
    			if err != nil {
    				t.Fatalf("unexpected error: %v", err)
    			}
    
    			out := bytes.NewBuffer([]byte{})
    			err = p.PrintObj(testObject, out)
    			if len(tc.expectedParseError) > 0 {
    				if err == nil || !strings.Contains(err.Error(), tc.expectedParseError) {
    					t.Errorf("expecting error %q, got %v", tc.expectedError, err)
    				}
    				return
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jun 02 09:47:52 UTC 2023
    - 6.7K bytes
    - Viewed (0)
  8. staging/src/k8s.io/cli-runtime/pkg/genericclioptions/print_flags_test.go

    	printer, err := printFlags.ToPrinter()
    	if err != nil {
    		t.Fatalf("unexpected err: %v", err)
    	}
    
    	for name, item := range tests {
    		buff := &bytes.Buffer{}
    		err := printer.PrintObj(item.obj, buff)
    		if err != nil {
    			t.Errorf("%v: unexpected err: %v", name, err)
    			continue
    		}
    		got := buff.String()
    		if item.expect != got {
    			t.Errorf("%v: expected %v, got %v", name, item.expect, got)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Oct 31 23:04:01 UTC 2019
    - 2K bytes
    - Viewed (0)
  9. staging/src/k8s.io/cli-runtime/pkg/genericclioptions/json_yaml_flags_test.go

    				t.Fatalf("expected to match template printer for output format %q", tc.outputFormat)
    			}
    			if err != nil {
    				t.Fatalf("unexpected error: %v", err)
    			}
    
    			out := bytes.NewBuffer([]byte{})
    			err = p.PrintObj(testObject, out)
    			if err != nil {
    				t.Errorf("unexpected error: %v", err)
    			}
    
    			if !strings.Contains(out.String(), tc.expectedOutput) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Aug 21 15:08:30 UTC 2018
    - 2.4K bytes
    - Viewed (0)
  10. staging/src/k8s.io/cli-runtime/pkg/genericclioptions/name_flags_test.go

    					t.Errorf("expecting error %q, got %v", tc.expectedError, err)
    				}
    				return
    			}
    			if err != nil {
    				t.Fatalf("unexpected error: %v", err)
    			}
    
    			out := bytes.NewBuffer([]byte{})
    			err = p.PrintObj(testObject, out)
    			if err != nil {
    				t.Errorf("unexpected error: %v", err)
    			}
    
    			if !strings.Contains(out.String(), tc.expectedOutput) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Aug 21 15:08:30 UTC 2018
    - 3.1K bytes
    - Viewed (0)
Back to top