helpers

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Create                            = "create"
	Read                              = "read"
	Update                            = "update"
	Delete                            = "delete"
	List                              = "list"
	ClientError                       = "Client Error"
	ResourceError                     = "Resource Error"
	DataSourceError                   = "Data Source Error"
	UnexpectedImportIdentifier        = "Unexpected Import Identifier"
	UnexpectedResourceConfigureType   = "Unexpected Resource Configure Type"
	UnexpectedDataSourceConfigureType = "Unexpected DataSource Configure Type"
)

define constant for error management.

Variables

View Source
var ErrDataNotFound = errors.New("data source not found")

Functions

func DataSourceConfigure added in v1.5.0

DataSourceConfigure is a helper function to set the client for a specific data source.

func ErrDataNotFoundError added in v1.5.0

func ErrDataNotFoundError(kind, field, search string) error

func ImportStatePassthroughIntID added in v1.5.0

func ImportStatePassthroughIntID(ctx context.Context, attrPath path.Path, req resource.ImportStateRequest, resp *resource.ImportStateResponse)

ImportStatePassthroughIntID is a helper function to set the import identifier to a given state attribute path. The attribute must accept a int value. extends https://github.com/hashicorp/terraform-plugin-framework/blob/main/resource/import_state.go.

func ParseClientError added in v1.5.0

func ParseClientError(action, name string, err error) string

func ReadFields added in v1.5.0

func ReadFields(ctx context.Context, fieldContainer interface{}, fieldLists Fields) []*readarr.Field

ReadFields takes in input a field container and populates a readarr.Field slice.

func ResourceConfigure added in v1.5.0

ResourceConfigure is a helper function to set the client for a specific resource.

func WriteFields added in v1.5.0

func WriteFields(ctx context.Context, fieldContainer interface{}, fields []*readarr.Field, fieldLists Fields)

WriteFields takes in input a readarr.Field slice and populate the relevant container fields.

Types

type Fields added in v1.5.0

type Fields struct {
	Bools                  []string
	BoolsExceptions        []string
	Ints                   []string
	IntsExceptions         []string
	Strings                []string
	StringsExceptions      []string
	Floats                 []string
	FloatsExceptions       []string
	IntSlices              []string
	IntSlicesExceptions    []string
	StringSlices           []string
	StringSlicesExceptions []string
	Sensitive              []string
}

Fields contains all the field lists of a specific resource per type.

Jump to

Keyboard shortcuts

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