Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for GetFromStructPath (0.25 sec)

  1. operator/pkg/tpath/struct.go

    	"istio.io/istio/operator/pkg/util"
    )
    
    // GetFromStructPath returns the value at path from the given node, or false if the path does not exist.
    func GetFromStructPath(node any, path string) (any, bool, error) {
    	return getFromStructPath(node, util.PathFromString(path))
    }
    
    // getFromStructPath is the internal implementation of GetFromStructPath which recurses through a tree of Go structs
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 4.4K bytes
    - Viewed (0)
  2. operator/pkg/tpath/struct_test.go

    			path:      "c.d.e",
    			wantFound: false,
    			wantErr:   "getFromStructPath path e, unsupported type string",
    		},
    	}
    
    	for _, tt := range tests {
    		t.Run(tt.desc, func(t *testing.T) {
    			rnode := make(map[string]any)
    			if err := yaml.Unmarshal([]byte(tt.nodeYAML), &rnode); err != nil {
    				t.Fatal(err)
    			}
    			GotOut, GotFound, gotErr := GetFromStructPath(rnode, tt.path)
    			if GotFound != tt.wantFound {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 2.7K bytes
    - Viewed (0)
  3. operator/pkg/translate/translate_common.go

    	componentNodeI, found, err := tpath.GetFromStructPath(controlPlaneSpec, "Components."+string(componentName)+".Enabled")
    	if err != nil {
    		return false, fmt.Errorf("error in IsComponentEnabledInSpec GetFromStructPath componentEnabled for component=%s: %s",
    			componentName, err)
    	}
    	if !found || componentNodeI == nil {
    		return false, nil
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Sun Apr 21 17:42:54 UTC 2024
    - 4.5K bytes
    - Viewed (0)
  4. operator/pkg/name/name.go

    	defaultNamespace := iop.Namespace(controlPlaneSpec)
    
    	componentNodeI, found, err := tpath.GetFromStructPath(controlPlaneSpec, "Components."+string(componentName)+".Namespace")
    	if err != nil {
    		return "", fmt.Errorf("error in Namespace GetFromStructPath componentNamespace for component=%s: %s", componentName, err)
    	}
    	if !found {
    		return defaultNamespace, nil
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 14 19:23:44 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  5. operator/pkg/translate/translate_test.go

    			assert.NoError(t, err)
    			val := obj.UnstructuredObject().Object["spec"].(map[string]interface{})["ports"].([]interface{})[0]
    			apVal, found, _ := tpath.GetFromStructPath(val, "appProtocol")
    			if !tt.expectExist {
    				assert.Equal(t, found, false)
    			} else {
    				if apVal != nil {
    					assert.Equal(t, apVal.(string), tt.expectValue)
    				} else {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Feb 12 19:43:09 UTC 2024
    - 5.1K bytes
    - Viewed (0)
  6. operator/pkg/validate/validate.go

    	return Validate2(DefaultValidations, is)
    }
    
    func Validate2(validations map[string]ValidatorFunc, iop *v1alpha1.IstioOperatorSpec) (errs util.Errors) {
    	for path, validator := range validations {
    		v, f, _ := tpath.GetFromStructPath(iop, path)
    		if f {
    			errs = append(errs, validator(util.PathFromString(path), v)...)
    		}
    	}
    	return
    }
    
    // Validate function below is used by third party for integrations and has to be public
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Jan 12 16:04:15 UTC 2023
    - 7.7K bytes
    - Viewed (0)
Back to top