convert

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(from types.Result, toVersion string) (types.Result, error)

Convert converts a CNI Result to the requested CNI specification version, or returns an error if the conversion could not be performed or failed

func Create

func Create(version string, bytes []byte) (types.Result, error)

Create creates a CNI Result using the given JSON, or an error if the creation could not be performed

func RegisterConverter

func RegisterConverter(fromVersion string, toVersions []string, convertFn ConvertFn)

RegisterConverter registers a CNI Result converter. SHOULD NOT BE CALLED EXCEPT FROM CNI ITSELF.

func RegisterCreator

func RegisterCreator(versions []string, createFn ResultFactoryFunc)

RegisterCreator registers a CNI Result creator. SHOULD NOT BE CALLED EXCEPT FROM CNI ITSELF.

Types

type ConvertFn

type ConvertFn func(from types.Result, toVersion string) (types.Result, error)

ConvertFn should convert from the given arbitrary Result type into a Result implementing CNI specification version passed in toVersion. The function is guaranteed to be passed a Result type matching the fromVersion it was registered with, and is guaranteed to be passed a toVersion matching one of the toVersions it was registered with.

type ResultFactoryFunc

type ResultFactoryFunc func([]byte) (types.Result, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL