41 lines
901 B
Go
41 lines
901 B
Go
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
package mocks
|
|
|
|
import (
|
|
"context"
|
|
_ "gopkg.in/yaml.v3"
|
|
)
|
|
|
|
type MockResource struct {
|
|
InjectURI func() string
|
|
InjectType func() string
|
|
InjectResolveId func(ctx context.Context) string
|
|
InjectLoadDecl func(string) error
|
|
InjectApply func() error
|
|
InjectRead func(context.Context) ([]byte, error)
|
|
}
|
|
|
|
func (m *MockResource) URI() string {
|
|
return m.InjectURI()
|
|
}
|
|
|
|
func (m *MockResource) ResolveId(ctx context.Context) string {
|
|
return m.ResolveId(ctx)
|
|
}
|
|
|
|
func (m *MockResource) LoadDecl(yamlResourceDeclaration string) error {
|
|
return m.InjectLoadDecl(yamlResourceDeclaration)
|
|
}
|
|
|
|
func (m *MockResource) Apply() error {
|
|
return m.InjectApply()
|
|
}
|
|
|
|
func (m *MockResource) Read(ctx context.Context) ([]byte, error) {
|
|
return m.InjectRead(ctx)
|
|
}
|
|
|
|
func (m *MockResource) Type() string {
|
|
return m.InjectType()
|
|
}
|