Documentation ¶
Index ¶
- Constants
- Variables
- func AnySliceToTyped[T any](obj []any) []T
- func ApplyAllRetryConditions(client *linodego.Client)
- func AttemptWarnEarlyAccessFramework(config *FrameworkProviderModel) diag.Diagnostics
- func AttemptWarnEarlyAccessSDKv2(providerMeta *ProviderMeta)
- func BuildObjectStorageObjectID(d *schema.ResourceData) string
- func CompareIPv6Ranges(i, v string) (bool, error)
- func CompareRFC3339TimeStrings(t1, t2 string) bool
- func CompareScopes(s1, s2 string) bool
- func CompareTimeStrings(t1, t2, timeFormat string) bool
- func CompareTimeWithTimeString(t1 *time.Time, t2 string, timeFormat string) bool
- func ComputeS3Endpoint(ctx context.Context, d *schema.ResourceData, meta interface{}) (string, error)
- func ComputeS3EndpointFromBucket(ctx context.Context, bucket linodego.ObjectStorageBucket) string
- func CreateDatabaseEngineSlug(engine, version string) string
- func CreateRandomRootPassword() (string, error)
- func Database502Retry() func(response *resty.Response, err error) bool
- func DeleteAllObjectVersionsAndDeleteMarkers(ctx context.Context, client *s3.Client, bucket, key string, ...) error
- func DeleteAllObjects(ctx context.Context, s3client *s3.Client, bucketName string, ...) error
- func DomainSecondsDiffSuppressor() schema.SchemaDiffSuppressFunc
- func EmptySetDefault(elemType attr.Type) defaults.Set
- func ExpandConfigInterface(ifaceMap map[string]interface{}) linodego.InstanceConfigInterfaceCreateOptions
- func ExpandConfigInterfaces(ctx context.Context, ifaces []any) []linodego.InstanceConfigInterfaceCreateOptions
- func ExpandDayOfWeek(day string) (linodego.DatabaseDayOfWeek, error)
- func ExpandIntList(list []interface{}) []int
- func ExpandIntSet(set *schema.Set) []int
- func ExpandInterfaceIPv4(ipv4 any) *linodego.VPCIPv4
- func ExpandMaintenanceWindow(window map[string]interface{}) (linodego.DatabaseMaintenanceWindow, error)
- func ExpandStringList(list []interface{}) []string
- func ExpandStringSet(set *schema.Set) []string
- func FilterTypeBool(value string) (interface{}, error)
- func FilterTypeInt(value string) (interface{}, error)
- func FilterTypeString(value string) (interface{}, error)
- func FlattenDatabaseMaintenanceWindow(ctx context.Context, maintenance linodego.DatabaseMaintenanceWindow) (*basetypes.ListValue, diag.Diagnostics)
- func FlattenDayOfWeek(day linodego.DatabaseDayOfWeek) string
- func FlattenInterface(iface linodego.InstanceConfigInterface) map[string]any
- func FlattenInterfaceIPv4(ipv4 *linodego.VPCIPv4) []map[string]any
- func FlattenInterfaces(interfaces []linodego.InstanceConfigInterface) []map[string]any
- func FlattenMaintenanceWindow(window linodego.MySQLDatabaseMaintenanceWindow) map[string]interface{}
- func FlattenToInterfaceSlice[T any](list []T) []interface{}
- func Float64PointerValueWithDefault(value *float64) basetypes.Float64Value
- func FrameworkAttemptRemoveResourceForEmptyID(ctx context.Context, id types.String, resp *resource.ReadResponse) bool
- func FrameworkCreateRandomRootPassword(diags *fwdiag.Diagnostics) string
- func FrameworkRebootInstance(ctx context.Context, linodeID int, client *linodego.Client, bootConfig int) fwdiag.Diagnostics
- func FrameworkSafeFloat64ToInt(number float64, diags *diag.Diagnostics) int
- func FrameworkSafeInt64ToInt(number int64, diags *diag.Diagnostics) int
- func FrameworkSafeStringToInt(val string, d *diag.Diagnostics) int
- func FrameworkSliceToString(val []types.String) []string
- func GenericRetryCondition(statusCode int, pathPattern *regexp.Regexp) func(response *resty.Response, err error) bool
- func GenericSliceToFramework[T any, U attr.Value](val []T, converter SafeFwValueConverter[T, U]) []U
- func GenericSliceToFrameworkWithDiags[T any, U attr.Value](val []T, converter FwValueConverter[T, U], diags *diag.Diagnostics) []U
- func GenericSliceToList[T any, U attr.Value](val []T, elementType attr.Type, converter FwValueConverter[T, U], ...) types.List
- func GetCurrentBootedConfig(ctx context.Context, client *linodego.Client, instID int) (int, error)
- func GetDeadlineSeconds(ctx context.Context, d *schema.ResourceData) int
- func GetFrameworkVersion() string
- func GetLatestEvent(ctx context.Context, client *linodego.Client, entityID int, ...) (*linodego.Event, error)
- func GetSDKv2Version() string
- func GetStringPtrWithDefault(val *string, def string) types.String
- func GetValueIfNotNull(val string) basetypes.StringValue
- func IDTypeConverterInt64(value string) (any, diag.Diagnostics)
- func IDTypeConverterString(value string) (any, diag.Diagnostics)
- func ImageUpload500Retry() func(response *resty.Response, err error) bool
- func ImportStatePassthroughInt64ID(ctx context.Context, attrPath path.Path, req resource.ImportStateRequest, ...)
- func ImportStateWithMultipleIDs(ctx context.Context, req resource.ImportStateRequest, ...)
- func IntPointerValueWithDefault(value *int) basetypes.Int64Value
- func IntSliceToFramework(val []int) []types.Int64
- func IsInstanceInBootedState(status linodego.InstanceStatus) bool
- func IsObjNotFoundErr(err error) bool
- func KeepOrUpdateBool(original types.Bool, updated bool, preserveKnown bool) types.Bool
- func KeepOrUpdateBoolPointer(original types.Bool, updated *bool, preserveKnown bool) types.Bool
- func KeepOrUpdateInt64(original types.Int64, updated int64, preserveKnown bool) types.Int64
- func KeepOrUpdateInt64Pointer(original types.Int64, updated *int64, preserveKnown bool) types.Int64
- func KeepOrUpdateIntPointer(original types.Int64, updated *int, preserveKnown bool) types.Int64
- func KeepOrUpdateSet(elementType attr.Type, original types.Set, updated []attr.Value, ...) types.Set
- func KeepOrUpdateString(original types.String, updated string, preserveKnown bool) types.String
- func KeepOrUpdateStringPointer(original types.String, updated *string, preserveKnown bool) types.String
- func KeepOrUpdateStringSet(original types.Set, updated []string, preserveKnown bool, ...) types.Set
- func KeepOrUpdateValue[T attr.Value](original T, updated T, preserveKnown bool) T
- func LinodeInstance500Retry() func(response *resty.Response, err error) bool
- func ListResultToInterface[T any](list []T, err error) ([]interface{}, error)
- func MapToSingleObjList(objectType types.ObjectType, valuesMap map[string]attr.Value, ...) types.List
- func PurgeAllObjects(ctx context.Context, bucket string, s3client *s3.Client, ...) error
- func RebootInstance(ctx context.Context, d *schema.ResourceData, linodeID int, meta interface{}, ...) diag.Diagnostics
- func RegexMatches(pattern string, errorMessage string) validator.String
- func ResolveValidDBEngine(ctx context.Context, client linodego.Client, engine string) (*linodego.DatabaseEngine, error)
- func RunBatch(ctx context.Context, toExecute ...BatchFunction) error
- func S3Connection(ctx context.Context, endpoint, accessKey, secretKey string) (*s3.Client, error)
- func S3ConnectionFromData(ctx context.Context, d *schema.ResourceData, meta interface{}, ...) (*s3.Client, error)
- func SDKv2ObjectCannedACLValidator(i any, p cty.Path) diag.Diagnostics
- func SDKv2ValidateIPv4Range(i any, path cty.Path) diag.Diagnostics
- func SDKv2ValidateIPv6Range(i any, path cty.Path) diag.Diagnostics
- func SafeFloat64ToInt(number float64) (int, error)
- func SafeInt64ToInt(number int64) (int, error)
- func SafeIntToInt32(number int) (int32, error)
- func SetLogFieldBulk(ctx context.Context, fields map[string]any) context.Context
- func StringAliasSliceToStringSlice[T ~string](obj []T) ([]string, error)
- func StringListElementsEqual(a, b []string) bool
- func StringSliceToFramework(val []string) []types.String
- func StringSliceToFrameworkValueSlice(val []string) []attr.Value
- func StringToInt(s string, diags *diag.Diagnostics) int
- func StringToInt64(s string, diags *diag.Diagnostics) int64
- func StringToRegex(pattern string) (regExp *regexp.Regexp)
- func StringValue(v *string) string
- func TypedSliceToAny[T any](obj []T) []any
- func WaitForDatabaseUpdated(ctx context.Context, client linodego.Client, dbID int, ...) error
- type APILoggerTransport
- type BaseDataSource
- type BaseDataSourceConfig
- type BaseResource
- func (r *BaseResource) Configure(ctx context.Context, req resource.ConfigureRequest, ...)
- func (r *BaseResource) ImportState(ctx context.Context, req resource.ImportStateRequest, ...)
- func (r *BaseResource) Metadata(ctx context.Context, req resource.MetadataRequest, ...)
- func (r *BaseResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse)
- type BaseResourceConfig
- type BatchFunction
- type Config
- type FilterAttribute
- type FilterConfig
- func (f FilterConfig) ConstructFilterString(d *schema.ResourceData) (string, error)
- func (f FilterConfig) FilterDataSource(ctx context.Context, d *schema.ResourceData, meta interface{}, ...) ([]map[string]interface{}, error)
- func (f FilterConfig) FilterLatest(d *schema.ResourceData, items []map[string]interface{}) []map[string]interface{}
- func (f FilterConfig) FilterLatestVersion(d *schema.ResourceData, items []map[string]interface{}) ([]map[string]interface{}, error)
- func (f FilterConfig) FilterResults(d *schema.ResourceData, items []interface{}) ([]map[string]interface{}, error)
- func (f FilterConfig) FilterSchema() *schema.Schema
- func (f FilterConfig) GetFilterID(d *schema.ResourceData) (string, error)
- func (f FilterConfig) GetLatestCreated(data []map[string]interface{}) map[string]interface{}
- func (f FilterConfig) GetLatestVersion(data []map[string]interface{}) (map[string]interface{}, error)
- func (f FilterConfig) GetValidFilters(apiOnly bool) []string
- func (f FilterConfig) OrderBySchema() *schema.Schema
- func (f FilterConfig) OrderSchema() *schema.Schema
- func (f FilterConfig) ValidateDiagFunc(apiOnly bool) schema.SchemaValidateDiagFunc
- type FilterFlattenFunc
- type FilterListFunc
- type FilterTypeFunc
- type FrameworkProviderMeta
- type FrameworkProviderModel
- type FwValueConverter
- type IDTypeConverter
- type ImportableID
- type ProviderMeta
- type SafeFwValueConverter
Constants ¶
const ( RootPassMinimumCharacters = 11 RootPassMaximumCharacters = 128 DefaultFrameworkRebootTimeout = 600 )
const ( APILoggerSubsystem = "linodego-requests" EnvAPILogger = "TF_LOG_PROVIDER_LINODE_REQUESTS" )
const DefaultLinodeURL = "https://api.linode.com"
DefaultLinodeURL is the Linode APIv4 URL to use.
const TIME_FORMAT = "2006-01-02T15:04:05Z"
const UAEnvVar = "TF_APPEND_USER_AGENT"
Variables ¶
var APILogLevel = hclog.LevelFromString(os.Getenv(EnvAPILogger))
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, }, }
var ValidDatabaseTypes = []string{"postgresql", "mysql"}
Functions ¶
func AnySliceToTyped ¶
func ApplyAllRetryConditions ¶ added in v2.14.0
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 CompareScopes ¶
func CompareTimeStrings ¶
func ComputeS3Endpoint ¶
func ComputeS3EndpointFromBucket ¶
func ComputeS3EndpointFromBucket(ctx context.Context, bucket linodego.ObjectStorageBucket) string
func Database502Retry ¶
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 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 ExpandInterfaceIPv4 ¶
func ExpandMaintenanceWindow ¶
func ExpandMaintenanceWindow(window map[string]interface{}) (linodego.DatabaseMaintenanceWindow, error)
func ExpandStringList ¶
func ExpandStringList(list []interface{}) []string
func ExpandStringSet ¶
func FilterTypeBool ¶
func FilterTypeInt ¶
func FilterTypeString ¶
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 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 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
FrameworkSliceToString converts the given Framework slice into a slice of strings.
func GenericRetryCondition ¶ added in v2.14.0
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 ¶
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 ¶
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 ¶
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 ¶
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 KeepOrUpdateBool ¶ added in v2.11.0
func KeepOrUpdateBoolPointer ¶ added in v2.14.0
func KeepOrUpdateInt64 ¶ added in v2.11.0
func KeepOrUpdateInt64Pointer ¶ added in v2.14.0
func KeepOrUpdateIntPointer ¶ added in v2.14.0
func KeepOrUpdateSet ¶ added in v2.15.0
func KeepOrUpdateString ¶ added in v2.11.0
func KeepOrUpdateStringPointer ¶ added in v2.14.0
func KeepOrUpdateStringSet ¶ added in v2.15.0
func KeepOrUpdateValue ¶ added in v2.11.0
func LinodeInstance500Retry ¶
func ListResultToInterface ¶
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 ResolveValidDBEngine ¶
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. NOTE: This should NOT be used until linodego has been confirmed to be thread-safe.
func S3Connection ¶
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 SafeInt64ToInt ¶
func SafeIntToInt32 ¶ added in v2.11.0
func SetLogFieldBulk ¶
SetLogFieldBulk allows for setting multiple logger fields at a time.
func StringAliasSliceToStringSlice ¶ added in v2.11.0
func StringListElementsEqual ¶
Check if two string lists contain the same elements regardless of order
func StringSliceToFramework ¶
StringSliceToFramework converts the given string slice into a framework-compatible slice of types.String.
func StringSliceToFrameworkValueSlice ¶ added in v2.15.0
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 StringValue ¶ added in v2.11.0
func TypedSliceToAny ¶
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.
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 (r *BaseDataSource) Configure( ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse, )
func (*BaseDataSource) Metadata ¶
func (r *BaseDataSource) Metadata( ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse, )
func (*BaseDataSource) Schema ¶
func (r *BaseDataSource) Schema( ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse, )
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 (r *BaseResource) Configure( ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse, )
func (*BaseResource) ImportState ¶
func (r *BaseResource) ImportState( ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse, )
ImportState should be overridden for resources with complex read logic (e.g. parent ID).
func (*BaseResource) Metadata ¶
func (r *BaseResource) Metadata( ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse, )
func (*BaseResource) Schema ¶
func (r *BaseResource) Schema( ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse, )
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 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.
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 ¶
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 }
func GetDataSourceMeta ¶
func GetDataSourceMeta( req datasource.ConfigureRequest, resp *datasource.ConfigureResponse, ) *FrameworkProviderMeta
func GetResourceMeta ¶
func GetResourceMeta( req resource.ConfigureRequest, resp *resource.ConfigureResponse, ) *FrameworkProviderMeta
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 SafeFwValueConverter ¶ added in v2.19.0
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
Source Files ¶
- batch.go
- compare.go
- config.go
- constant.go
- conversion.go
- database.go
- default_value.go
- domain.go
- earlyaccess.go
- events.go
- expand.go
- filter.go
- framework_conversion.go
- framework_converter.go
- framework_data.go
- framework_datasource_base.go
- framework_import.go
- framework_provider_model.go
- framework_resource_base.go
- framework_schema.go
- framework_util.go
- instance.go
- logging.go
- normalize.go
- objects.go
- regex.go
- resource_datasource_config.go
- retry.go
- sdkv2_validators.go
- version.go