hcclient

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorToDiag added in v1.27.1

func ErrorToDiag(err error) diag.Diagnostics

ErrorToDiag creates a terraform diag When some hcloud errors are passed it enriches the default Error() function from them with a few more details to make them more understandable for users

func WaitForAction

func WaitForAction(ctx context.Context, w ProgressWatcher, a *hcloud.Action) error

WaitForAction uses ProgressWatcher to wait for the completion of a.

func WaitForActions added in v1.25.0

func WaitForActions(ctx context.Context, w ProgressWatcher, a []*hcloud.Action) error

WaitForActions uses ProgressWatcher to wait for the completion of all actions.

Types

type MockProgressWatcher

type MockProgressWatcher struct {
	mock.Mock
}

MockProgressWatcher provides a mock implementation of the ProgressWatcher interface.

func NewMockProgressWatcher

func NewMockProgressWatcher(t *testing.T) *MockProgressWatcher

NewMockProgressWatcher creates a new mock progress watcher.

func (*MockProgressWatcher) MockWatchOverallProgress added in v1.25.0

func (m *MockProgressWatcher) MockWatchOverallProgress(ctx context.Context, a []*hcloud.Action, err error) <-chan struct{}

MockWatchProgress mocks WatchProgress to return a progress and an error channel. A Go routine is started, which closes the channels and sends err into the error channel if not nil.

func (*MockProgressWatcher) MockWatchProgress

func (m *MockProgressWatcher) MockWatchProgress(ctx context.Context, a *hcloud.Action, err error) <-chan struct{}

MockWatchProgress mocks WatchProgress to return a progress and an error channel. A Go routine is started, which closes the channels and sends err into the error channel if not nil.

func (*MockProgressWatcher) WatchOverallProgress added in v1.25.0

func (m *MockProgressWatcher) WatchOverallProgress(ctx context.Context, a []*hcloud.Action) (<-chan int, <-chan error)

WatchProgress is a mock implementation of the ProgressWatcher.WatchProgress method.

func (*MockProgressWatcher) WatchProgress

func (m *MockProgressWatcher) WatchProgress(ctx context.Context, a *hcloud.Action) (<-chan int, <-chan error)

WatchProgress is a mock implementation of the ProgressWatcher.WatchProgress method.

type ProgressWatcher

type ProgressWatcher interface {
	WatchProgress(context.Context, *hcloud.Action) (<-chan int, <-chan error)
	WatchOverallProgress(ctx context.Context, actions []*hcloud.Action) (<-chan int, <-chan error)
}

ProgressWatcher encapsulates the Hetzner Cloud Action Client's WatchProgress method for easier testing.

Jump to

Keyboard shortcuts

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