Documentation
¶
Index ¶
- Variables
- func AssetName() string
- func DownloadAndInstall(ctx context.Context, binaryURL, checksumURL, installPath string, ...) error
- func NewManager(logger logr.Logger, installPath string, checkInterval time.Duration, ...) (*managerImpl, error)
- type DeployOptions
- type DownloadOptions
- type GitHubRelease
- type Manager
- type MockManager
- func (_mock *MockManager) Deploy(ctx context.Context, repoPath string, namespace string, opts DeployOptions) error
- func (_mock *MockManager) Describe(ctx context.Context, name string, namespace string) (functions.Instance, error)
- func (_m *MockManager) EXPECT() *MockManager_Expecter
- func (_mock *MockManager) GetCurrentVersion(ctx context.Context) (string, error)
- func (_mock *MockManager) GetLatestMiddlewareVersion(ctx context.Context, runtime string, invoke string) (string, error)
- func (_mock *MockManager) GetMiddlewareVersion(ctx context.Context, name string, namespace string) (string, error)
- func (_mock *MockManager) Run(ctx context.Context, dir string, args ...string) (string, error)
- type MockManager_Deploy_Call
- type MockManager_Describe_Call
- func (_c *MockManager_Describe_Call) Return(instance functions.Instance, err error) *MockManager_Describe_Call
- func (_c *MockManager_Describe_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockManager_Describe_Call
- func (_c *MockManager_Describe_Call) RunAndReturn(...) *MockManager_Describe_Call
- type MockManager_Expecter
- func (_e *MockManager_Expecter) Deploy(ctx interface{}, repoPath interface{}, namespace interface{}, opts interface{}) *MockManager_Deploy_Call
- func (_e *MockManager_Expecter) Describe(ctx interface{}, name interface{}, namespace interface{}) *MockManager_Describe_Call
- func (_e *MockManager_Expecter) GetCurrentVersion(ctx interface{}) *MockManager_GetCurrentVersion_Call
- func (_e *MockManager_Expecter) GetLatestMiddlewareVersion(ctx interface{}, runtime interface{}, invoke interface{}) *MockManager_GetLatestMiddlewareVersion_Call
- func (_e *MockManager_Expecter) GetMiddlewareVersion(ctx interface{}, name interface{}, namespace interface{}) *MockManager_GetMiddlewareVersion_Call
- func (_e *MockManager_Expecter) Run(ctx interface{}, dir interface{}, args ...interface{}) *MockManager_Run_Call
- type MockManager_GetCurrentVersion_Call
- func (_c *MockManager_GetCurrentVersion_Call) Return(s string, err error) *MockManager_GetCurrentVersion_Call
- func (_c *MockManager_GetCurrentVersion_Call) Run(run func(ctx context.Context)) *MockManager_GetCurrentVersion_Call
- func (_c *MockManager_GetCurrentVersion_Call) RunAndReturn(run func(ctx context.Context) (string, error)) *MockManager_GetCurrentVersion_Call
- type MockManager_GetLatestMiddlewareVersion_Call
- func (_c *MockManager_GetLatestMiddlewareVersion_Call) Return(s string, err error) *MockManager_GetLatestMiddlewareVersion_Call
- func (_c *MockManager_GetLatestMiddlewareVersion_Call) Run(run func(ctx context.Context, runtime string, invoke string)) *MockManager_GetLatestMiddlewareVersion_Call
- func (_c *MockManager_GetLatestMiddlewareVersion_Call) RunAndReturn(run func(ctx context.Context, runtime string, invoke string) (string, error)) *MockManager_GetLatestMiddlewareVersion_Call
- type MockManager_GetMiddlewareVersion_Call
- func (_c *MockManager_GetMiddlewareVersion_Call) Return(s string, err error) *MockManager_GetMiddlewareVersion_Call
- func (_c *MockManager_GetMiddlewareVersion_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockManager_GetMiddlewareVersion_Call
- func (_c *MockManager_GetMiddlewareVersion_Call) RunAndReturn(run func(ctx context.Context, name string, namespace string) (string, error)) *MockManager_GetMiddlewareVersion_Call
- type MockManager_Run_Call
- func (_c *MockManager_Run_Call) Return(s string, err error) *MockManager_Run_Call
- func (_c *MockManager_Run_Call) Run(run func(ctx context.Context, dir string, args ...string)) *MockManager_Run_Call
- func (_c *MockManager_Run_Call) RunAndReturn(run func(ctx context.Context, dir string, args ...string) (string, error)) *MockManager_Run_Call
Constants ¶
This section is empty.
Variables ¶
var ErrFunctionNotFound = fmt.Errorf("function not found")
Functions ¶
func AssetName ¶ added in v0.3.1
func AssetName() string
AssetName returns the func CLI asset name for the current platform (e.g. "func_linux_amd64").
func DownloadAndInstall ¶ added in v0.3.1
func DownloadAndInstall(ctx context.Context, binaryURL, checksumURL, installPath string, opts *DownloadOptions) error
DownloadAndInstall downloads a func CLI binary from binaryURL, verifies its SHA256 checksum against the checksums.txt at checksumURL, and atomically installs it to installPath. The parent directory of installPath must exist.
Types ¶
type DeployOptions ¶
type DownloadOptions ¶ added in v0.3.1
type DownloadOptions struct {
// HTTPClient is the HTTP client to use for downloading.
// If nil, a default client with a 30-second timeout is used.
HTTPClient *http.Client
}
DownloadOptions configures the binary download behavior.
type GitHubRelease ¶
type GitHubRelease struct {
Name string `json:"name"`
Assets []struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
} `json:"assets"`
}
GitHubRelease represents the GitHub API response for a release
type Manager ¶
type Manager interface {
Run(ctx context.Context, dir string, args ...string) (string, error)
Describe(ctx context.Context, name, namespace string) (funcfn.Instance, error)
Deploy(ctx context.Context, repoPath string, namespace string, opts DeployOptions) error
GetCurrentVersion(ctx context.Context) (string, error)
GetLatestMiddlewareVersion(ctx context.Context, runtime, invoke string) (string, error)
GetMiddlewareVersion(ctx context.Context, name, namespace string) (string, error)
}
type MockManager ¶
MockManager is an autogenerated mock type for the Manager type
func NewMockManager ¶
func NewMockManager(t interface {
mock.TestingT
Cleanup(func())
}) *MockManager
NewMockManager creates a new instance of MockManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockManager) Deploy ¶
func (_mock *MockManager) Deploy(ctx context.Context, repoPath string, namespace string, opts DeployOptions) error
Deploy provides a mock function for the type MockManager
func (*MockManager) Describe ¶
func (_mock *MockManager) Describe(ctx context.Context, name string, namespace string) (functions.Instance, error)
Describe provides a mock function for the type MockManager
func (*MockManager) EXPECT ¶
func (_m *MockManager) EXPECT() *MockManager_Expecter
func (*MockManager) GetCurrentVersion ¶
func (_mock *MockManager) GetCurrentVersion(ctx context.Context) (string, error)
GetCurrentVersion provides a mock function for the type MockManager
func (*MockManager) GetLatestMiddlewareVersion ¶
func (_mock *MockManager) GetLatestMiddlewareVersion(ctx context.Context, runtime string, invoke string) (string, error)
GetLatestMiddlewareVersion provides a mock function for the type MockManager
func (*MockManager) GetMiddlewareVersion ¶
func (_mock *MockManager) GetMiddlewareVersion(ctx context.Context, name string, namespace string) (string, error)
GetMiddlewareVersion provides a mock function for the type MockManager
type MockManager_Deploy_Call ¶
MockManager_Deploy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Deploy'
func (*MockManager_Deploy_Call) Return ¶
func (_c *MockManager_Deploy_Call) Return(err error) *MockManager_Deploy_Call
func (*MockManager_Deploy_Call) Run ¶
func (_c *MockManager_Deploy_Call) Run(run func(ctx context.Context, repoPath string, namespace string, opts DeployOptions)) *MockManager_Deploy_Call
func (*MockManager_Deploy_Call) RunAndReturn ¶
func (_c *MockManager_Deploy_Call) RunAndReturn(run func(ctx context.Context, repoPath string, namespace string, opts DeployOptions) error) *MockManager_Deploy_Call
type MockManager_Describe_Call ¶
MockManager_Describe_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Describe'
func (*MockManager_Describe_Call) Return ¶
func (_c *MockManager_Describe_Call) Return(instance functions.Instance, err error) *MockManager_Describe_Call
func (*MockManager_Describe_Call) Run ¶
func (_c *MockManager_Describe_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockManager_Describe_Call
func (*MockManager_Describe_Call) RunAndReturn ¶
func (_c *MockManager_Describe_Call) RunAndReturn(run func(ctx context.Context, name string, namespace string) (functions.Instance, error)) *MockManager_Describe_Call
type MockManager_Expecter ¶
type MockManager_Expecter struct {
// contains filtered or unexported fields
}
func (*MockManager_Expecter) Deploy ¶
func (_e *MockManager_Expecter) Deploy(ctx interface{}, repoPath interface{}, namespace interface{}, opts interface{}) *MockManager_Deploy_Call
Deploy is a helper method to define mock.On call
- ctx context.Context
- repoPath string
- namespace string
- opts DeployOptions
func (*MockManager_Expecter) Describe ¶
func (_e *MockManager_Expecter) Describe(ctx interface{}, name interface{}, namespace interface{}) *MockManager_Describe_Call
Describe is a helper method to define mock.On call
- ctx context.Context
- name string
- namespace string
func (*MockManager_Expecter) GetCurrentVersion ¶
func (_e *MockManager_Expecter) GetCurrentVersion(ctx interface{}) *MockManager_GetCurrentVersion_Call
GetCurrentVersion is a helper method to define mock.On call
- ctx context.Context
func (*MockManager_Expecter) GetLatestMiddlewareVersion ¶
func (_e *MockManager_Expecter) GetLatestMiddlewareVersion(ctx interface{}, runtime interface{}, invoke interface{}) *MockManager_GetLatestMiddlewareVersion_Call
GetLatestMiddlewareVersion is a helper method to define mock.On call
- ctx context.Context
- runtime string
- invoke string
func (*MockManager_Expecter) GetMiddlewareVersion ¶
func (_e *MockManager_Expecter) GetMiddlewareVersion(ctx interface{}, name interface{}, namespace interface{}) *MockManager_GetMiddlewareVersion_Call
GetMiddlewareVersion is a helper method to define mock.On call
- ctx context.Context
- name string
- namespace string
func (*MockManager_Expecter) Run ¶
func (_e *MockManager_Expecter) Run(ctx interface{}, dir interface{}, args ...interface{}) *MockManager_Run_Call
Run is a helper method to define mock.On call
- ctx context.Context
- dir string
- args ...string
type MockManager_GetCurrentVersion_Call ¶
MockManager_GetCurrentVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCurrentVersion'
func (*MockManager_GetCurrentVersion_Call) Return ¶
func (_c *MockManager_GetCurrentVersion_Call) Return(s string, err error) *MockManager_GetCurrentVersion_Call
func (*MockManager_GetCurrentVersion_Call) Run ¶
func (_c *MockManager_GetCurrentVersion_Call) Run(run func(ctx context.Context)) *MockManager_GetCurrentVersion_Call
func (*MockManager_GetCurrentVersion_Call) RunAndReturn ¶
func (_c *MockManager_GetCurrentVersion_Call) RunAndReturn(run func(ctx context.Context) (string, error)) *MockManager_GetCurrentVersion_Call
type MockManager_GetLatestMiddlewareVersion_Call ¶
MockManager_GetLatestMiddlewareVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestMiddlewareVersion'
func (*MockManager_GetLatestMiddlewareVersion_Call) Return ¶
func (_c *MockManager_GetLatestMiddlewareVersion_Call) Return(s string, err error) *MockManager_GetLatestMiddlewareVersion_Call
func (*MockManager_GetLatestMiddlewareVersion_Call) Run ¶
func (_c *MockManager_GetLatestMiddlewareVersion_Call) Run(run func(ctx context.Context, runtime string, invoke string)) *MockManager_GetLatestMiddlewareVersion_Call
func (*MockManager_GetLatestMiddlewareVersion_Call) RunAndReturn ¶
func (_c *MockManager_GetLatestMiddlewareVersion_Call) RunAndReturn(run func(ctx context.Context, runtime string, invoke string) (string, error)) *MockManager_GetLatestMiddlewareVersion_Call
type MockManager_GetMiddlewareVersion_Call ¶
MockManager_GetMiddlewareVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMiddlewareVersion'
func (*MockManager_GetMiddlewareVersion_Call) Return ¶
func (_c *MockManager_GetMiddlewareVersion_Call) Return(s string, err error) *MockManager_GetMiddlewareVersion_Call
func (*MockManager_GetMiddlewareVersion_Call) Run ¶
func (_c *MockManager_GetMiddlewareVersion_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockManager_GetMiddlewareVersion_Call
func (*MockManager_GetMiddlewareVersion_Call) RunAndReturn ¶
func (_c *MockManager_GetMiddlewareVersion_Call) RunAndReturn(run func(ctx context.Context, name string, namespace string) (string, error)) *MockManager_GetMiddlewareVersion_Call
type MockManager_Run_Call ¶
MockManager_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run'
func (*MockManager_Run_Call) Return ¶
func (_c *MockManager_Run_Call) Return(s string, err error) *MockManager_Run_Call
func (*MockManager_Run_Call) Run ¶
func (_c *MockManager_Run_Call) Run(run func(ctx context.Context, dir string, args ...string)) *MockManager_Run_Call
func (*MockManager_Run_Call) RunAndReturn ¶
func (_c *MockManager_Run_Call) RunAndReturn(run func(ctx context.Context, dir string, args ...string) (string, error)) *MockManager_Run_Call