Documentation
¶
Index ¶
- func APIErrorDiagnostics(err error) diag.Diagnostics
- func APIErrorIsNotFound(err error) bool
- func ActionErrorDiagnostic(action *hcloud.Action) diag.Diagnostic
- func ActionWaitTimeoutDiagnostic(actions ...*hcloud.Action) diag.Diagnostic
- func ConfigureClient(providerData any) (*hcloud.Client, diag.Diagnostics)
- func ErrorToDiag(err error) diag.Diagnostics
- func GetFirst[T any](items []*T, details ...DetailsOption) (*T, diag.Diagnostic)
- func GetOne[T any](items []*T, details ...DetailsOption) (*T, diag.Diagnostic)
- func NotFoundDiagnostic(resourceName string, values ...any) diag.Diagnostic
- func SettleActions(ctx context.Context, client ActionWaiter, actions ...*hcloud.Action) (diags diag.Diagnostics)
- func TerraformLabelsToHCloud(ctx context.Context, inputLabels types.Map, outputLabels *map[string]string) diag.Diagnostics
- type ActionWaiter
- type Details
- type DetailsOption
- type WithValues
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 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 ¶
Types ¶
type ActionWaiter ¶ added in v1.57.0
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
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`.