Documentation ¶
Index ¶
- func GivenBundleController(fileName string) (*v1alpha1.PackageBundleController, error)
- func GivenPackage(fileName string) (*v1alpha1.Package, error)
- func GivenPackageBundle(filename string) (*v1alpha1.PackageBundle, error)
- func MustPackageBundleFromFilename(t *testing.T, filename string) (bundle *v1alpha1.PackageBundle)
- func ParseByteSlice(data []byte, clusterConfig KindAccessor) error
- type FileReader
- type KindAccessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GivenBundleController ¶
func GivenBundleController(fileName string) (*v1alpha1.PackageBundleController, error)
func GivenPackageBundle ¶
func GivenPackageBundle(filename string) (*v1alpha1.PackageBundle, error)
func MustPackageBundleFromFilename ¶
func MustPackageBundleFromFilename(t *testing.T, filename string) (bundle *v1alpha1.PackageBundle)
MustPackageBundleFromFilename is a helper to load a bundle or fail trying.
It is intended primarily for use in automated tests or utilities.
func ParseByteSlice ¶
func ParseByteSlice(data []byte, clusterConfig KindAccessor) error
Types ¶
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
func NewFileReader ¶
func NewFileReader(fileName string) *FileReader
func (*FileReader) Initialize ¶
func (reader *FileReader) Initialize(clusterConfig KindAccessor) error
func (*FileReader) Parse ¶
func (reader *FileReader) Parse(clusterConfig KindAccessor) error
type KindAccessor ¶
type KindAccessor interface { // MetaKind is the kind actually read when unmarshaling from a file. MetaKind() string // ExpectedKind is the kind we expect to read while unmarshaling. ExpectedKind() string }
KindAccessor exposes the Kind field for Cluster type.
The FileReader will compare the Kind field (accessed via MetaKind()) with the result of ExpectedKind() to ensure that the data we unmarshaled was meant for a struct of the correct type. That is, it prevents us from unmarshaling bytes meant for a Foo struct into a Bar struct.
Click to show internal directories.
Click to hide internal directories.