instance

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInstanceFileResource

func NewInstanceFileResource() resource.Resource

NewInstanceFileResource returns a new instance file resource.

func NewInstanceResource

func NewInstanceResource() resource.Resource

NewInstanceResource returns a new instance resource.

func NewInstanceSnapshotResource

func NewInstanceSnapshotResource() resource.Resource

NewInstanceSnapshotResource returns a new instance snapshot resource.

func ToProfileList

func ToProfileList(ctx context.Context, profileList types.List) ([]string, diag.Diagnostics)

ToProfileList converts profiles of type types.List into []string.

If profiles are null, use "default" profile. If profiles lengeth is 0, no profiles are applied.

func ToProfileListType

func ToProfileListType(ctx context.Context, profiles []string) (types.List, diag.Diagnostics)

ToProfileListType converts []string into profiles of type types.List.

Types

type InstanceFileModel

type InstanceFileModel struct {
	ResourceID types.String `tfsdk:"resource_id"` // Computed.
	Instance   types.String `tfsdk:"instance"`
	Project    types.String `tfsdk:"project"`
	Remote     types.String `tfsdk:"remote"`

	// common.InstanceFileModel
	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"`
}

InstanceFileModel

This model should embed common.IncusFileMode, but terraform-framework does not yet support unmarshaling of embedded structs. https://github.com/hashicorp/terraform-plugin-framework/issues/242

type InstanceFileResource

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

InstanceFileResource represent incus instance file resource.

func (*InstanceFileResource) Configure

func (InstanceFileResource) Create

func (InstanceFileResource) Delete

func (InstanceFileResource) Metadata

func (InstanceFileResource) Read

func (InstanceFileResource) Schema

func (InstanceFileResource) Update

type InstanceModel

type InstanceModel struct {
	Name           types.String `tfsdk:"name"`
	Description    types.String `tfsdk:"description"`
	Type           types.String `tfsdk:"type"`
	Image          types.String `tfsdk:"image"`
	Ephemeral      types.Bool   `tfsdk:"ephemeral"`
	Running        types.Bool   `tfsdk:"running"`
	WaitForNetwork types.Bool   `tfsdk:"wait_for_network"`
	Profiles       types.List   `tfsdk:"profiles"`
	Devices        types.Set    `tfsdk:"device"`
	Files          types.Set    `tfsdk:"file"`
	Limits         types.Map    `tfsdk:"limits"`
	Config         types.Map    `tfsdk:"config"`
	Project        types.String `tfsdk:"project"`
	Remote         types.String `tfsdk:"remote"`
	Target         types.String `tfsdk:"target"`

	// Computed.
	IPv4   types.String `tfsdk:"ipv4_address"`
	IPv6   types.String `tfsdk:"ipv6_address"`
	MAC    types.String `tfsdk:"mac_address"`
	Status types.String `tfsdk:"status"`
}

func (InstanceModel) ComputedKeys

func (_ InstanceModel) ComputedKeys() []string

ComputedKeys returns list of computed config keys.

type InstanceResource

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

InstanceResource represent Incus instance resource.

func (*InstanceResource) Configure

func (InstanceResource) Create

func (InstanceResource) Delete

func (*InstanceResource) ImportState

func (InstanceResource) Metadata

func (*InstanceResource) ModifyPlan

func (InstanceResource) Read

func (InstanceResource) Schema

func (InstanceResource) SyncState

SyncState fetches the server's current state for an instance and updates the provided model. It then applies this updated model as the new state in Terraform.

func (InstanceResource) Update

Update updates the instance in the following order: - Ensure instance state (stopped/running) - Update configuration (config, limits, devices, profiles) - Upload files - Run exec commands

func (InstanceResource) ValidateConfig

type InstanceSnapshotModel

type InstanceSnapshotModel struct {
	Name     types.String `tfsdk:"name"`
	Instance types.String `tfsdk:"instance"`
	Stateful types.Bool   `tfsdk:"stateful"`
	Project  types.String `tfsdk:"project"`
	Remote   types.String `tfsdk:"remote"`

	// Computed.
	CreatedAt types.Int64 `tfsdk:"created_at"`
}

type InstanceSnapshotResource

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

InstanceSnapshotResource represent Incus instance snapshot resource.

func (*InstanceSnapshotResource) Configure

func (InstanceSnapshotResource) Create

func (InstanceSnapshotResource) Delete

func (InstanceSnapshotResource) Metadata

func (InstanceSnapshotResource) Read

func (InstanceSnapshotResource) Schema

func (InstanceSnapshotResource) SyncState

SyncState fetches the server's current state for an instance snapshot and updates the provided model. It then applies this updated model as the new state in Terraform.

func (InstanceSnapshotResource) Update

Jump to

Keyboard shortcuts

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