hcloudutil

package
v1.65.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

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

func APIErrorIsNotFound(err error) bool

APIErrorIsNotFound check whether the error is an API request Not Found error.

func ActionErrorDiagnostic added in v1.57.0

func ActionErrorDiagnostic(action *hcloud.Action) diag.Diagnostic

func ActionWaitTimeoutDiagnostic added in v1.57.0

func ActionWaitTimeoutDiagnostic(actions ...*hcloud.Action) diag.Diagnostic

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 GetFirst added in v1.65.0

func GetFirst[T any](items []*T, details ...DetailsOption) (*T, diag.Diagnostic)

GetFirst verifies that at least one item is present in the list and returns the first item.

func GetOne added in v1.65.0

func GetOne[T any](items []*T, details ...DetailsOption) (*T, diag.Diagnostic)

GetOne verifies that exactly one item is present in the list and returns that item.

func NotFoundDiagnostic added in v1.48.0

func NotFoundDiagnostic(resourceName string, values ...any) diag.Diagnostic

func SettleActions added in v1.57.0

func SettleActions(ctx context.Context, client ActionWaiter, actions ...*hcloud.Action) (diags diag.Diagnostics)

func TerraformLabelsToHCloud

func TerraformLabelsToHCloud(ctx context.Context, inputLabels types.Map, outputLabels *map[string]string) diag.Diagnostics

Types

type ActionWaiter added in v1.57.0

type ActionWaiter interface {
	WaitForFunc(ctx context.Context, handleUpdate func(update *hcloud.Action) error, actions ...*hcloud.Action) error
}

type Details added in v1.65.0

type Details struct {
	// contains filtered or unexported fields
}

func NewDetails added in v1.65.0

func NewDetails(opts ...DetailsOption) *Details

func (*Details) MoreThanOne added in v1.65.0

func (d *Details) MoreThanOne() string

func (*Details) NotFound added in v1.65.0

func (d *Details) NotFound() string

type DetailsOption added in v1.65.0

type DetailsOption func(o *Details)

func WithListOpts added in v1.65.0

func WithListOpts(opts WithValues) DetailsOption

WithListOpts adds the query params to the details.

func WithResourceName added in v1.65.0

func WithResourceName(name string) DetailsOption

WithResourceName adds the resource name to the details.

func WithUsing added in v1.65.0

func WithUsing(name string, value any) DetailsOption

WithUsing adds a hint about which data in particular was used for the query. For example `label selector` or `name`.

type WithValues added in v1.65.0

type WithValues interface {
	Values() url.Values
}

Jump to

Keyboard shortcuts

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