Documentation ¶
Index ¶
- func InstanceFileDelete(server incus.InstanceServer, instanceName string, targetPath string) error
- func InstanceFileUpload(server incus.InstanceServer, instanceName string, file InstanceFileModel) error
- func MergeConfig(resConfig map[string]string, usrConfig map[string]string, ...) map[string]string
- func StripConfig(resConfig map[string]string, usrConfig map[string]string, ...) map[string]string
- func ToConfigMap(ctx context.Context, configMap types.Map) (map[string]string, diag.Diagnostics)
- func ToConfigMapType(ctx context.Context, config map[string]string) (types.Map, diag.Diagnostics)
- func ToDeviceMap(ctx context.Context, deviceSet types.Set) (map[string]map[string]string, diag.Diagnostics)
- func ToDeviceSetType(ctx context.Context, devices map[string]map[string]string) (types.Set, diag.Diagnostics)
- func ToFileMap(ctx context.Context, fileSet types.Set) (map[string]InstanceFileModel, diag.Diagnostics)
- func ToFileSetType(ctx context.Context, fileMap map[string]InstanceFileModel) (types.Set, diag.Diagnostics)
- type DeviceModel
- type ImportMetadata
- type InstanceFileModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstanceFileDelete ¶
func InstanceFileDelete(server incus.InstanceServer, instanceName string, targetPath string) error
InstanceFileDelete deletes a file from an instance.
func InstanceFileUpload ¶
func InstanceFileUpload(server incus.InstanceServer, instanceName string, file InstanceFileModel) error
InstanceFileUpload uploads a file to an instance.
func MergeConfig ¶
func MergeConfig(resConfig map[string]string, usrConfig map[string]string, computedKeys []string) map[string]string
MergeConfig merges resource (existing) configuration with user defined configuration. Non-empty resource config entries that are contained in the provided computed keys are inserted in the user config.
func StripConfig ¶
func StripConfig(resConfig map[string]string, usrConfig map[string]string, computedKeys []string) map[string]string
StripConfig removes any computed keys from the user-defined configuration file in order to be able to produce a consistent Terraform plan. If there is a non-computed-key entry, it will be retained in the configuration and will trigger an error.
func ToConfigMap ¶
ToConfigMap converts config of type types.Map into map[string]string.
func ToConfigMapType ¶
ToConfigMapType converts map[string]string into config of type types.Map.
func ToDeviceMap ¶
func ToDeviceMap(ctx context.Context, deviceSet types.Set) (map[string]map[string]string, diag.Diagnostics)
ToDeviceMap converts devices from types.Set into map[string]map[string]string.
func ToDeviceSetType ¶
func ToDeviceSetType(ctx context.Context, devices map[string]map[string]string) (types.Set, diag.Diagnostics)
ToDeviceSetType converts devices from map[string]map[string]string into types.Set.
func ToFileMap ¶
func ToFileMap(ctx context.Context, fileSet types.Set) (map[string]InstanceFileModel, diag.Diagnostics)
ToFileMap converts files from types.Set into map[string]IncusFileModel.
func ToFileSetType ¶
func ToFileSetType(ctx context.Context, fileMap map[string]InstanceFileModel) (types.Set, diag.Diagnostics)
ToFileSetType converts files from a map[string]IncusFileModel into types.Set.
Types ¶
type DeviceModel ¶
type ImportMetadata ¶
ImportMetadata defines import ID properties that are used when parsing values from an ID.
func (ImportMetadata) ParseImportID ¶
func (m ImportMetadata) ParseImportID(importId string) (map[string]string, diag.Diagnostic)
ParseImportID parses remote name, project name, required fields, and other allowed options from an import ID.
Remote is separated using colun "[remote:]". Project and other required fields are separated using slash "[project/]rf". If there are multiple required fields, first slash becomes mandatory "[project]/rf1/rf2". Options are separated using comma "rf[,opt1=value][,opt2=value]".
Expected format:
[remote:][project/]name[,optKey1=optVal1][,optKeyN=optValN]
Result is a map of key=value pairs:
map[string]string{ "remote": "local" "project": "test" "name": "myres" "image": "alpine" // option "optKey2": "value" // option }
type InstanceFileModel ¶
type InstanceFileModel struct { Content types.String `tfsdk:"content"` SourcePath types.String `tfsdk:"source_path"` TargetPath types.String `tfsdk:"target_path"` UserID types.Int64 `tfsdk:"uid"` GroupID types.Int64 `tfsdk:"gid"` Mode types.String `tfsdk:"mode"` CreateDirs types.Bool `tfsdk:"create_directories"` Append types.Bool `tfsdk:"append"` }