Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing annotation should not return partial results #42

Open
YifeiZhuang opened this issue Nov 22, 2024 · 1 comment
Open

Parsing annotation should not return partial results #42

YifeiZhuang opened this issue Nov 22, 2024 · 1 comment
Assignees

Comments

@YifeiZhuang
Copy link

Parsing annotation should not return partial results, needs to be fixed to something like:

if err := json.Unmarshal(); err != nil { return InterfaceStatusAnnotation{}, err }
return ret, nil

func ParseNodeNetworkAnnotation(annotation string) (NodeNetworkAnnotation, error) {
ret := &NodeNetworkAnnotation{}
err := json.Unmarshal([]byte(annotation), ret)
return *ret, err
}
// ParsePodIPsAnnotation parses the given annotation to PodIPsAnnotation.
func ParsePodIPsAnnotation(annotation string) (PodIPsAnnotation, error) {
ret := &PodIPsAnnotation{}
err := json.Unmarshal([]byte(annotation), ret)
return *ret, err
}
// ParseMultiNetworkAnnotation parses given annotation to MultiNetworkAnnotation.
func ParseMultiNetworkAnnotation(annotation string) (MultiNetworkAnnotation, error) {
ret := &MultiNetworkAnnotation{}
err := json.Unmarshal([]byte(annotation), ret)
return *ret, err
}
// ParseNorthInterfacesAnnotation parses given annotation to NorthInterfacesAnnotation.
func ParseNorthInterfacesAnnotation(annotation string) (NorthInterfacesAnnotation, error) {
ret := &NorthInterfacesAnnotation{}
err := json.Unmarshal([]byte(annotation), ret)
return *ret, err
}
// ParseNICInfoAnnotation parses given annotation to NicInfoAnnotation
func ParseNICInfoAnnotation(annotation string) (NICInfoAnnotation, error) {
ret := &NICInfoAnnotation{}
err := json.Unmarshal([]byte(annotation), ret)
return *ret, err
}
// ParseInterfaceStatusAnnotation parses the given annotation to InterfaceStatusAnnotation
func ParseInterfaceStatusAnnotation(annotation string) (InterfaceStatusAnnotation, error) {
ret := &InterfaceStatusAnnotation{}
err := json.Unmarshal([]byte(annotation), ret)
return *ret, err
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants