Documentation ¶
Index ¶
- func APIErrorDiagnostics(err error) diag.Diagnostics
- func APIErrorIsNotFound(err error) bool
- func ConfigureClient(providerData any) (*hcloud.Client, diag.Diagnostics)
- func ErrorToDiag(err error) diag.Diagnostics
- func TerraformLabelsToHCloud(ctx context.Context, inputLabels types.Map, outputLabels *map[string]string) diag.Diagnostics
- func WaitForAction(ctx context.Context, w ProgressWatcher, a *hcloud.Action) error
- func WaitForActions(ctx context.Context, w ProgressWatcher, a []*hcloud.Action) error
- type MockProgressWatcher
- func (m *MockProgressWatcher) MockWatchOverallProgress(ctx context.Context, a []*hcloud.Action, err error) <-chan struct{}
- func (m *MockProgressWatcher) MockWatchProgress(ctx context.Context, a *hcloud.Action, err error) <-chan struct{}
- func (m *MockProgressWatcher) WatchOverallProgress(ctx context.Context, a []*hcloud.Action) (<-chan int, <-chan error)
- func (m *MockProgressWatcher) WatchProgress(ctx context.Context, a *hcloud.Action) (<-chan int, <-chan error)
- type ProgressWatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIErrorDiagnostics ¶
func APIErrorDiagnostics(err error) diag.Diagnostics
APIErrorDiagnostics creates diagnostics from the errors that occurred during an API requests.
func APIErrorIsNotFound ¶
APIErrorIsNotFound check whether the error is an API request Not Found error.
func ConfigureClient ¶
func ConfigureClient(providerData any) (*hcloud.Client, diag.Diagnostics)
func ErrorToDiag ¶
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 TerraformLabelsToHCloud ¶
func WaitForAction ¶
WaitForAction uses ProgressWatcher to wait for the completion of a.
func WaitForActions ¶
WaitForActions uses ProgressWatcher to wait for the completion of all actions.
Types ¶
type MockProgressWatcher ¶
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 ¶
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 ¶
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.