helper

package
v2.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MPL-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootPassMinimumCharacters     = 11
	RootPassMaximumCharacters     = 128
	DefaultFrameworkRebootTimeout = 600
)
View Source
const (
	APILoggerSubsystem = "linodego-requests"
	EnvAPILogger       = "TF_LOG_PROVIDER_LINODE_REQUESTS"
)
View Source
const DefaultLinodeURL = "https://api.linode.com"

DefaultLinodeURL is the Linode APIv4 URL to use.

View Source
const TIME_FORMAT = "2006-01-02T15:04:05Z"
View Source
const UAEnvVar = "TF_APPEND_USER_AGENT"

Variables

View Source
var APILogLevel = hclog.LevelFromString(os.Getenv(EnvAPILogger))
View Source
var UpdateObjectType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"day_of_week":   types.StringType,
		"duration":      types.Int64Type,
		"frequency":     types.StringType,
		"hour_of_day":   types.Int64Type,
		"week_of_month": types.Int64Type,
	},
}
View Source
var ValidDatabaseTypes = []string{"postgresql", "mysql"}

Functions

func AnySliceToTyped

func AnySliceToTyped[T any](obj []any) []T

func ApplyAllRetryConditions added in v2.14.0

func ApplyAllRetryConditions(client *linodego.Client)

func AttemptWarnEarlyAccessFramework

func AttemptWarnEarlyAccessFramework(config *FrameworkProviderModel) diag.Diagnostics

AttemptWarnEarlyAccessFramework will raise a warning if a Framework early access resource is being used without the v4beta API version.

func AttemptWarnEarlyAccessSDKv2

func AttemptWarnEarlyAccessSDKv2(providerMeta *ProviderMeta)

AttemptWarnEarlyAccessSDKv2 will raise a warning if an SDKv2 early access resource is being used without the v4beta API version.

func BuildObjectStorageObjectID

func BuildObjectStorageObjectID(d *schema.ResourceData) string

func CompareIPv6Ranges

func CompareIPv6Ranges(i, v string) (bool, error)

func CompareRFC3339TimeStrings

func CompareRFC3339TimeStrings(t1, t2 string) bool

func CompareScopes

func CompareScopes(s1, s2 string) bool

func CompareTimeStrings

func CompareTimeStrings(t1, t2, timeFormat string) bool

func CompareTimeWithTimeString

func CompareTimeWithTimeString(t1 *time.Time, t2 string, timeFormat string) bool

func ComputeS3Endpoint

func ComputeS3Endpoint(ctx context.Context, d *schema.ResourceData, meta interface{}) (string, error)

func ComputeS3EndpointFromBucket

func ComputeS3EndpointFromBucket(ctx context.Context, bucket linodego.ObjectStorageBucket) string

func CreateDatabaseEngineSlug

func CreateDatabaseEngineSlug(engine, version string) string

func CreateRandomRootPassword

func CreateRandomRootPassword() (string, error)

func Database502Retry

func Database502Retry() func(response *resty.Response, err error) bool

Workaround for intermittent 5xx errors when retrieving a database from the API

func DeleteAllObjectVersionsAndDeleteMarkers added in v2.11.0

func DeleteAllObjectVersionsAndDeleteMarkers(ctx context.Context, client *s3.Client, bucket, key string, bypassRetention, ignoreNotFound bool) error

deleteAllObjectVersions deletes all versions of a given object

func DeleteAllObjects added in v2.11.0

func DeleteAllObjects(
	ctx context.Context,
	s3client *s3.Client,
	bucketName string,
	bypassRetention bool,
) error

Send delete requests for every objects. Versioned objects will get a deletion marker instead of being fully purged.

func DomainSecondsDiffSuppressor

func DomainSecondsDiffSuppressor() schema.SchemaDiffSuppressFunc

func EmptySetDefault

func EmptySetDefault(elemType attr.Type) defaults.Set

func ExpandConfigInterface

func ExpandConfigInterface(ifaceMap map[string]interface{}) linodego.InstanceConfigInterfaceCreateOptions

func ExpandConfigInterfaces added in v2.14.0

func ExpandConfigInterfaces(ctx context.Context, ifaces []any) []linodego.InstanceConfigInterfaceCreateOptions

func ExpandDayOfWeek

func ExpandDayOfWeek(day string) (linodego.DatabaseDayOfWeek, error)

func ExpandIntList

func ExpandIntList(list []interface{}) []int

func ExpandIntSet

func ExpandIntSet(set *schema.Set) []int

func ExpandInterfaceIPv4

func ExpandInterfaceIPv4(ipv4 any) *linodego.VPCIPv4

func ExpandMaintenanceWindow

func ExpandMaintenanceWindow(window map[string]interface{}) (linodego.DatabaseMaintenanceWindow, error)

func ExpandStringList

func ExpandStringList(list []interface{}) []string

func ExpandStringSet

func ExpandStringSet(set *schema.Set) []string

func FilterTypeBool

func FilterTypeBool(value string) (interface{}, error)

func FilterTypeInt

func FilterTypeInt(value string) (interface{}, error)

func FilterTypeString

func FilterTypeString(value string) (interface{}, error)

func FlattenDatabaseMaintenanceWindow

func FlattenDatabaseMaintenanceWindow(ctx context.Context, maintenance linodego.DatabaseMaintenanceWindow) (
	*basetypes.ListValue, diag.Diagnostics,
)

func FlattenDayOfWeek

func FlattenDayOfWeek(day linodego.DatabaseDayOfWeek) string

func FlattenInterface

func FlattenInterface(iface linodego.InstanceConfigInterface) map[string]any

func FlattenInterfaceIPv4

func FlattenInterfaceIPv4(ipv4 *linodego.VPCIPv4) []map[string]any

func FlattenInterfaces

func FlattenInterfaces(interfaces []linodego.InstanceConfigInterface) []map[string]any

func FlattenMaintenanceWindow

func FlattenMaintenanceWindow(window linodego.MySQLDatabaseMaintenanceWindow) map[string]interface{}

func FlattenToInterfaceSlice

func FlattenToInterfaceSlice[T any](list []T) []interface{}

func Float64PointerValueWithDefault

func Float64PointerValueWithDefault(value *float64) basetypes.Float64Value

returns a Float64Value with default value 0 if nil or a known value.

func FrameworkAttemptRemoveResourceForEmptyID

func FrameworkAttemptRemoveResourceForEmptyID(
	ctx context.Context,
	id types.String,
	resp *resource.ReadResponse,
) bool

FrameworkAttemptRemoveResourceForEmptyID implements a temporary workaround for a Crossplane/Upjet issue (TPT-2408). Returns true if the resource was removed from state, else false.

func FrameworkCreateRandomRootPassword added in v2.17.0

func FrameworkCreateRandomRootPassword(diags *fwdiag.Diagnostics) string

func FrameworkRebootInstance added in v2.11.0

func FrameworkRebootInstance(
	ctx context.Context,
	linodeID int,
	client *linodego.Client,
	bootConfig int,
) fwdiag.Diagnostics

func FrameworkSafeFloat64ToInt added in v2.17.0

func FrameworkSafeFloat64ToInt(number float64, diags *diag.Diagnostics) int

func FrameworkSafeInt64ToInt

func FrameworkSafeInt64ToInt(number int64, diags *diag.Diagnostics) int

func FrameworkSafeStringToInt added in v2.15.0

func FrameworkSafeStringToInt(val string, d *diag.Diagnostics) int

func FrameworkSliceToString added in v2.11.0

func FrameworkSliceToString(val []types.String) []string

FrameworkSliceToString converts the given Framework slice into a slice of strings.

func GenericRetryCondition added in v2.14.0

func GenericRetryCondition(statusCode int, pathPattern *regexp.Regexp) func(response *resty.Response, err error) bool

func GenericSliceToFramework added in v2.19.0

func GenericSliceToFramework[T any, U attr.Value](
	val []T, converter SafeFwValueConverter[T, U],
) []U

GenericSliceToFramework converts the given generic slice into a framework-compatible slice of attr.Value.

func GenericSliceToFrameworkWithDiags added in v2.19.0

func GenericSliceToFrameworkWithDiags[T any, U attr.Value](
	val []T, converter FwValueConverter[T, U], diags *diag.Diagnostics,
) []U

GenericSliceToFrameworkWithDiags converts the given generic slice into a framework-compatible slice of attr.Value with a converter and diag.Diagnostics for recording any error occurred.

func GenericSliceToList added in v2.19.0

func GenericSliceToList[T any, U attr.Value](
	val []T, elementType attr.Type, converter FwValueConverter[T, U], diags *diag.Diagnostics,
) types.List

GenericSliceToList converts the given generic slice into a framework-compatible value of types.List with a FwValueConverter.

func GetCurrentBootedConfig

func GetCurrentBootedConfig(ctx context.Context, client *linodego.Client, instID int) (int, error)

GetCurrentBootedConfig gets the config a linode instance is current booted to

func GetDeadlineSeconds

func GetDeadlineSeconds(ctx context.Context, d *schema.ResourceData) int

GetDeadlineSeconds gets the seconds remaining until deadline is met.

func GetFrameworkVersion added in v2.16.0

func GetFrameworkVersion() string

func GetLatestEvent

func GetLatestEvent(ctx context.Context, client *linodego.Client,
	entityID int, entityType linodego.EntityType, action linodego.EventAction,
) (*linodego.Event, error)

GetLatestEvent returns the latest Linode event with the given arguments.

func GetSDKv2Version added in v2.16.0

func GetSDKv2Version() string

func GetStringPtrWithDefault

func GetStringPtrWithDefault(val *string, def string) types.String

GetStringPtrWithDefault returns a types.StringValue if the given pointer is not null, else it returns the provided default value.

func GetValueIfNotNull

func GetValueIfNotNull(val string) basetypes.StringValue

GetValueIfNotNull - assign StringNull() safely without throwing error. e.g. new value: .rev_note: was null, but now cty.StringVal("")

func IDTypeConverterInt64 added in v2.15.0

func IDTypeConverterInt64(value string) (any, diag.Diagnostics)

func IDTypeConverterString added in v2.15.0

func IDTypeConverterString(value string) (any, diag.Diagnostics)

func ImageUpload500Retry

func ImageUpload500Retry() func(response *resty.Response, err error) bool

ImageUpload500Retry for [500] error when uploading an image

func ImportStatePassthroughInt64ID

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

ImportStatePassthroughInt64ID allows for the automatic importing of resources through an int64 ID attribute. This is necessary as many Linode resources use integers rather than strings as unique identifiers.

func ImportStateWithMultipleIDs added in v2.15.0

func ImportStateWithMultipleIDs(
	ctx context.Context,
	req resource.ImportStateRequest,
	resp *resource.ImportStateResponse,
	idFields []ImportableID,
)

ImportStateWithMultipleIDs allows framework resources with multiple IDs (e.g. `child_id, parent_id`) be imported.

func IntPointerValueWithDefault

func IntPointerValueWithDefault(value *int) basetypes.Int64Value

returns an Int64Value with default value 0 if nil or a known value.

func IntSliceToFramework

func IntSliceToFramework(val []int) []types.Int64

IntSliceToFramework converts the given int slice into a framework-compatible slice of types.String.

func IsInstanceInBootedState

func IsInstanceInBootedState(status linodego.InstanceStatus) bool

IsInstanceInBootedState checks whether an instance is in a booted or booting state

func IsObjNotFoundErr added in v2.11.0

func IsObjNotFoundErr(err error) bool

func KeepOrUpdateBool added in v2.11.0

func KeepOrUpdateBool(original types.Bool, updated bool, preserveKnown bool) types.Bool

func KeepOrUpdateBoolPointer added in v2.14.0

func KeepOrUpdateBoolPointer(original types.Bool, updated *bool, preserveKnown bool) types.Bool

func KeepOrUpdateInt64 added in v2.11.0

func KeepOrUpdateInt64(original types.Int64, updated int64, preserveKnown bool) types.Int64

func KeepOrUpdateInt64Pointer added in v2.14.0

func KeepOrUpdateInt64Pointer(original types.Int64, updated *int64, preserveKnown bool) types.Int64

func KeepOrUpdateIntPointer added in v2.14.0

func KeepOrUpdateIntPointer(original types.Int64, updated *int, preserveKnown bool) types.Int64

func KeepOrUpdateSet added in v2.15.0

func KeepOrUpdateSet(
	elementType attr.Type, original types.Set, updated []attr.Value, preserveKnown bool, diags *diag.Diagnostics,
) types.Set

func KeepOrUpdateString added in v2.11.0

func KeepOrUpdateString(original types.String, updated string, preserveKnown bool) types.String

func KeepOrUpdateStringPointer added in v2.14.0

func KeepOrUpdateStringPointer(original types.String, updated *string, preserveKnown bool) types.String

func KeepOrUpdateStringSet added in v2.15.0

func KeepOrUpdateStringSet(
	original types.Set, updated []string, preserveKnown bool, diags *diag.Diagnostics,
) types.Set

func KeepOrUpdateValue added in v2.11.0

func KeepOrUpdateValue[T attr.Value](original T, updated T, preserveKnown bool) T

func LinodeInstance500Retry

func LinodeInstance500Retry() func(response *resty.Response, err error) bool

func ListResultToInterface

func ListResultToInterface[T any](list []T, err error) ([]interface{}, error)

func MapToSingleObjList added in v2.20.0

func MapToSingleObjList(
	objectType types.ObjectType, valuesMap map[string]attr.Value, diags *diag.Diagnostics,
) types.List

Given a map, returning a Terraform List value containing a single Terraform Object value.

func PurgeAllObjects added in v2.11.0

func PurgeAllObjects(
	ctx context.Context,
	bucket string,
	s3client *s3.Client,
	bypassRetention,
	ignoreNotFound bool,
) error

Purge all objects, wiping out all versions and delete markers for versioned objects.

func RebootInstance

func RebootInstance(ctx context.Context, d *schema.ResourceData, linodeID int,
	meta interface{}, bootConfig int,
) diag.Diagnostics

set bootConfig = 0 if using existing boot config

func RegexMatches added in v2.11.0

func RegexMatches(pattern string, errorMessage string) validator.String

func ResolveValidDBEngine

func ResolveValidDBEngine(
	ctx context.Context, client linodego.Client, engine string,
) (*linodego.DatabaseEngine, error)

func RunBatch added in v2.19.0

func RunBatch(ctx context.Context, toExecute ...BatchFunction) error

RunBatch is intended to simplify executing functions concurrently. This is handy for running certain non-sequential API requests in parallel.

func S3Connection

func S3Connection(ctx context.Context, endpoint, accessKey, secretKey string) (*s3.Client, error)

func S3ConnectionFromData

func S3ConnectionFromData(
	ctx context.Context,
	d *schema.ResourceData,
	meta interface{},
	accessKey, secretKey string,
) (*s3.Client, error)

S3ConnectionFromData requires endpoint in the data. If endpoint is empty a bucket and cluster are required.

func SDKv2ObjectCannedACLValidator added in v2.11.0

func SDKv2ObjectCannedACLValidator(i any, p cty.Path) diag.Diagnostics

func SDKv2ValidateIPv4Range

func SDKv2ValidateIPv4Range(i any, path cty.Path) diag.Diagnostics

func SDKv2ValidateIPv6Range

func SDKv2ValidateIPv6Range(i any, path cty.Path) diag.Diagnostics

func SafeFloat64ToInt

func SafeFloat64ToInt(number float64) (int, error)

func SafeInt64ToInt

func SafeInt64ToInt(number int64) (int, error)

func SafeIntToInt32 added in v2.11.0

func SafeIntToInt32(number int) (int32, error)

func SetLogFieldBulk

func SetLogFieldBulk(ctx context.Context, fields map[string]any) context.Context

SetLogFieldBulk allows for setting multiple logger fields at a time.

func StringAliasSliceToStringSlice added in v2.11.0

func StringAliasSliceToStringSlice[T ~string](obj []T) ([]string, error)

func StringListElementsEqual

func StringListElementsEqual(a, b []string) bool

Check if two string lists contain the same elements regardless of order

func StringSliceToFramework

func StringSliceToFramework(val []string) []types.String

StringSliceToFramework converts the given string slice into a framework-compatible slice of types.String.

func StringSliceToFrameworkValueSlice added in v2.15.0

func StringSliceToFrameworkValueSlice(val []string) []attr.Value

StringSliceToFrameworkValueSlice converts the given string slice into a framework-compatible slice of attr.Value.

func StringToInt

func StringToInt(s string, diags *diag.Diagnostics) int

func StringToInt64

func StringToInt64(s string, diags *diag.Diagnostics) int64

func StringToRegex added in v2.11.0

func StringToRegex(pattern string) (regExp *regexp.Regexp)

func StringValue added in v2.11.0

func StringValue(v *string) string

func TypedSliceToAny

func TypedSliceToAny[T any](obj []T) []any

func WaitForDatabaseUpdated

func WaitForDatabaseUpdated(ctx context.Context, client linodego.Client, dbID int,
	dbType linodego.DatabaseEngineType, minStart *time.Time, timeoutSeconds int,
) error

Types

type APILoggerTransport

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

APILoggerTransport injects a configured API request logger subsystem into the context of the current API request.

func NewAPILoggerTransport

func NewAPILoggerTransport(transport http.RoundTripper) *APILoggerTransport

NewAPILoggerTransport is a RoundTripper used to inject a subsystem logger at request-time.

func (*APILoggerTransport) RoundTrip

func (t *APILoggerTransport) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip injects the API logger subsystem into the context of an API request. This allows us to configure the logger without creating a new logger in each implementation.

type BaseDataSource

type BaseDataSource struct {
	Config BaseDataSourceConfig
	Meta   *FrameworkProviderMeta
}

BaseDataSource contains various re-usable fields and methods intended for use in data source implementations by composition.

func NewBaseDataSource

func NewBaseDataSource(cfg BaseDataSourceConfig) BaseDataSource

NewBaseDataSource returns a new instance of the BaseDataSource struct for cleaner initialization.

func (*BaseDataSource) Configure

func (*BaseDataSource) Metadata

func (*BaseDataSource) Schema

type BaseDataSourceConfig

type BaseDataSourceConfig struct {
	Name string

	// Optional
	Schema        *schema.Schema
	IsEarlyAccess bool
}

BaseDataSourceConfig contains all configurable base resource fields.

type BaseResource

type BaseResource struct {
	Config BaseResourceConfig
	Meta   *FrameworkProviderMeta
}

BaseResource contains various re-usable fields and methods intended for use in resource implementations by composition.

func NewBaseResource

func NewBaseResource(cfg BaseResourceConfig) BaseResource

NewBaseResource returns a new instance of the BaseResource struct for cleaner initialization.

func (*BaseResource) Configure

func (*BaseResource) ImportState

ImportState should be overridden for resources with complex read logic (e.g. parent ID).

func (*BaseResource) Metadata

func (*BaseResource) Schema

type BaseResourceConfig

type BaseResourceConfig struct {
	Name   string
	IDAttr string
	IDType attr.Type

	// Optional
	Schema        *schema.Schema
	TimeoutOpts   *timeouts.Opts
	IsEarlyAccess bool
}

BaseResourceConfig contains all configurable base resource fields.

type BatchFunction added in v2.19.0

type BatchFunction func(ctx context.Context) error

type Config

type Config struct {
	AccessToken string
	APIURL      string
	APIVersion  string
	UAPrefix    string

	ConfigPath    string
	ConfigProfile string

	TerraformVersion string

	SkipInstanceReadyPoll        bool
	SkipInstanceDeletePoll       bool
	SkipImplicitReboots          bool
	DisableInternalCache         bool
	MinRetryDelayMilliseconds    int
	MaxRetryDelayMilliseconds    int
	EventPollMilliseconds        int
	LKEEventPollMilliseconds     int
	LKENodeReadyPollMilliseconds int

	ObjAccessKey   string
	ObjSecretKey   string
	ObjUseTempKeys bool
}

Config represents the Linode provider configuration.

func (*Config) Client

func (c *Config) Client(ctx context.Context) (*linodego.Client, error)

Client returns a fully initialized Linode client.

type FilterAttribute

type FilterAttribute struct {
	// Whether this field can be filtered on at an API level.
	// If false, this filter will be handled on the client.
	APIFilterable bool

	// Converts the filter string to the correct type.
	TypeFunc FilterTypeFunc
}

FilterAttribute stores various configuration options about a single filterable field.

type FilterConfig

type FilterConfig map[string]FilterAttribute

FilterConfig stores a map of FilterAttributes for a resource.

func (FilterConfig) ConstructFilterString

func (f FilterConfig) ConstructFilterString(d *schema.ResourceData) (string, error)

ConstructFilterString constructs a Linode filter JSON string from each filter element in the schema

func (FilterConfig) FilterDataSource

func (f FilterConfig) FilterDataSource(
	ctx context.Context,
	d *schema.ResourceData,
	meta interface{},
	listFunc FilterListFunc,
	flattenFunc FilterFlattenFunc,
) ([]map[string]interface{}, error)

FilterDataSource should be run from inside the ReadContext function of a data source.

func (FilterConfig) FilterLatest

func (f FilterConfig) FilterLatest(d *schema.ResourceData, items []map[string]interface{}) []map[string]interface{}

FilterLatest returns only the latest element in the given slice only if `latest` == true.

func (FilterConfig) FilterLatestVersion

func (f FilterConfig) FilterLatestVersion(d *schema.ResourceData,
	items []map[string]interface{},
) ([]map[string]interface{}, error)

FilterLatestVersion returns only the latest element in the given slice only if `latest` == true.

func (FilterConfig) FilterResults

func (f FilterConfig) FilterResults(
	d *schema.ResourceData,
	items []interface{},
) ([]map[string]interface{}, error)

FilterResults filters the given results on the client-side filters present in the resource.

func (FilterConfig) FilterSchema

func (f FilterConfig) FilterSchema() *schema.Schema

FilterSchema should be referenced in a schema configuration in order to enable filter functionality

func (FilterConfig) GetFilterID

func (f FilterConfig) GetFilterID(d *schema.ResourceData) (string, error)

GetFilterID creates a unique ID specific to the current filter data source

func (FilterConfig) GetLatestCreated

func (f FilterConfig) GetLatestCreated(data []map[string]interface{}) map[string]interface{}

GetLatestCreated returns only the latest element in the given slice.

func (FilterConfig) GetLatestVersion

func (f FilterConfig) GetLatestVersion(data []map[string]interface{}) (map[string]interface{}, error)

GetLatestVersion returns only the latest version string (e.g. `8.0.26`) in the given slice.

func (FilterConfig) GetValidFilters

func (f FilterConfig) GetValidFilters(apiOnly bool) []string

GetValidFilters returns a slice of valid filters for the filter config.

func (FilterConfig) OrderBySchema

func (f FilterConfig) OrderBySchema() *schema.Schema

OrderBySchema should be referenced in a schema configuration in order to enable filter ordering functionality

func (FilterConfig) OrderSchema

func (f FilterConfig) OrderSchema() *schema.Schema

func (FilterConfig) ValidateDiagFunc

func (f FilterConfig) ValidateDiagFunc(apiOnly bool) schema.SchemaValidateDiagFunc

ValidateDiagFunc should be plugged into the `filter` field of a filterable data source.

type FilterFlattenFunc

type FilterFlattenFunc func(object interface{}) map[string]interface{}

FilterFlattenFunc flattens an object into a map[string]interface{}.

type FilterListFunc

type FilterListFunc func(context.Context, *schema.ResourceData,
	*linodego.Client, *linodego.ListOptions) ([]interface{}, error)

FilterListFunc wraps a linodego list function.

type FilterTypeFunc

type FilterTypeFunc func(value string) (interface{}, error)

FilterTypeFunc is a function that takes in a filter name and value, and returns the value converted to the correct filter type.

type FrameworkProviderMeta

type FrameworkProviderMeta struct {
	Client *linodego.Client
	Config *FrameworkProviderModel
}

type FrameworkProviderModel

type FrameworkProviderModel struct {
	AccessToken types.String `tfsdk:"token"`
	APIURL      types.String `tfsdk:"url"`
	APIVersion  types.String `tfsdk:"api_version"`
	UAPrefix    types.String `tfsdk:"ua_prefix"`

	ConfigPath    types.String `tfsdk:"config_path"`
	ConfigProfile types.String `tfsdk:"config_profile"`

	SkipInstanceReadyPoll  types.Bool `tfsdk:"skip_instance_ready_poll"`
	SkipInstanceDeletePoll types.Bool `tfsdk:"skip_instance_delete_poll"`

	SkipImplicitReboots types.Bool `tfsdk:"skip_implicit_reboots"`

	DisableInternalCache types.Bool `tfsdk:"disable_internal_cache"`

	MinRetryDelayMilliseconds types.Int64 `tfsdk:"min_retry_delay_ms"`
	MaxRetryDelayMilliseconds types.Int64 `tfsdk:"max_retry_delay_ms"`

	EventPollMilliseconds    types.Int64 `tfsdk:"event_poll_ms"`
	LKEEventPollMilliseconds types.Int64 `tfsdk:"lke_event_poll_ms"`

	LKENodeReadyPollMilliseconds types.Int64 `tfsdk:"lke_node_ready_poll_ms"`

	ObjAccessKey   types.String `tfsdk:"obj_access_key"`
	ObjSecretKey   types.String `tfsdk:"obj_secret_key"`
	ObjUseTempKeys types.Bool   `tfsdk:"obj_use_temp_keys"`
}

func GetFrameworkProviderModelFromSDKv2ProviderConfig added in v2.15.0

func GetFrameworkProviderModelFromSDKv2ProviderConfig(config *Config) *FrameworkProviderModel

GetFrameworkProviderModelFromSDKv2ProviderConfig is used by crossplane-provider-linode to convert from SDKv2 to FrameworkModel

type FwValueConverter added in v2.19.0

type FwValueConverter[T any, U attr.Value] func(T) (U, diag.Diagnostics)

A function that converts something into a framework-compatible attr.Value with a diag.Diagnostics for recording any error occurred.

func FwValueEchoConverter added in v2.19.0

func FwValueEchoConverter() FwValueConverter[attr.Value, attr.Value]

Returns a converter that echos the framework value without any conversion

func GetBaseFwValueConverter added in v2.19.0

func GetBaseFwValueConverter[T any, U attr.Value](c FwValueConverter[T, U]) FwValueConverter[T, attr.Value]

Returns a converter that cast the result of the passed in converter to be base framework value (aka attr.Value)

type IDTypeConverter added in v2.15.0

type IDTypeConverter func(value string) (any, diag.Diagnostics)

IDTypeConverter represents a function that converts a given value into a given type

type ImportableID added in v2.15.0

type ImportableID struct {
	TypeConverter IDTypeConverter
	Name          string
}

ImportableID represents a single ID attribute importable

type ProviderMeta

type ProviderMeta struct {
	Client linodego.Client
	Config *Config
}

type SafeFwValueConverter added in v2.19.0

type SafeFwValueConverter[T any, U attr.Value] func(T) U

A function that converts something into a framework-compatible attr.Value

func GetBaseSafeFwValueConverter added in v2.19.0

func GetBaseSafeFwValueConverter[T any, U attr.Value](c SafeFwValueConverter[T, U]) SafeFwValueConverter[T, attr.Value]

Returns a converter that cast the result of the passed in converter to be base framework value (aka attr.Value) without diags.Diagnostics support

func SafeFwValueEchoConverter added in v2.19.0

func SafeFwValueEchoConverter() SafeFwValueConverter[attr.Value, attr.Value]

Returns a converter that echos the framework value without any conversion without diags.Diagnostics support

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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