Documentation
¶
Index ¶
- func NewInstanceFileResource() resource.Resource
- func NewInstanceResource() resource.Resource
- func NewInstanceSnapshotResource() resource.Resource
- func ToProfileList(ctx context.Context, profileList types.List) ([]string, diag.Diagnostics)
- func ToProfileListType(ctx context.Context, profiles []string) (types.List, diag.Diagnostics)
- type InstanceFileModel
- type InstanceFileResource
- func (r *InstanceFileResource) Configure(_ context.Context, req resource.ConfigureRequest, ...)
- func (r InstanceFileResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
- func (r InstanceFileResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
- func (r InstanceFileResource) Metadata(_ context.Context, req resource.MetadataRequest, ...)
- func (r InstanceFileResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
- func (r InstanceFileResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
- func (r InstanceFileResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
- type InstanceModel
- type InstanceResource
- func (r *InstanceResource) Configure(_ context.Context, req resource.ConfigureRequest, ...)
- func (r InstanceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
- func (r InstanceResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
- func (r *InstanceResource) ImportState(ctx context.Context, req resource.ImportStateRequest, ...)
- func (r InstanceResource) Metadata(_ context.Context, req resource.MetadataRequest, ...)
- func (r *InstanceResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, ...)
- func (r InstanceResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
- func (r InstanceResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
- func (r InstanceResource) SyncState(ctx context.Context, tfState *tfsdk.State, server incus.InstanceServer, ...) diag.Diagnostics
- func (r InstanceResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
- func (r InstanceResource) ValidateConfig(ctx context.Context, req resource.ValidateConfigRequest, ...)
- type InstanceSnapshotModel
- type InstanceSnapshotResource
- func (r *InstanceSnapshotResource) Configure(_ context.Context, req resource.ConfigureRequest, ...)
- func (r InstanceSnapshotResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
- func (r InstanceSnapshotResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
- func (r InstanceSnapshotResource) Metadata(_ context.Context, req resource.MetadataRequest, ...)
- func (r InstanceSnapshotResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
- func (r InstanceSnapshotResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
- func (r InstanceSnapshotResource) SyncState(ctx context.Context, tfState *tfsdk.State, server incus.InstanceServer, ...) diag.Diagnostics
- func (r InstanceSnapshotResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewInstanceFileResource ¶
NewInstanceFileResource returns a new instance file resource.
func NewInstanceResource ¶
NewInstanceResource returns a new instance resource.
func NewInstanceSnapshotResource ¶
NewInstanceSnapshotResource returns a new instance snapshot resource.
func ToProfileList ¶
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 ¶
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 (r *InstanceFileResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
func (InstanceFileResource) Create ¶
func (r InstanceFileResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
func (InstanceFileResource) Delete ¶
func (r InstanceFileResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
func (InstanceFileResource) Metadata ¶
func (r InstanceFileResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
func (InstanceFileResource) Read ¶
func (r InstanceFileResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
func (InstanceFileResource) Schema ¶
func (r InstanceFileResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
func (InstanceFileResource) Update ¶
func (r InstanceFileResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
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 (r *InstanceResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
func (InstanceResource) Create ¶
func (r InstanceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
func (InstanceResource) Delete ¶
func (r InstanceResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
func (*InstanceResource) ImportState ¶
func (r *InstanceResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse)
func (InstanceResource) Metadata ¶
func (r InstanceResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
func (*InstanceResource) ModifyPlan ¶
func (r *InstanceResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse)
func (InstanceResource) Read ¶
func (r InstanceResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
func (InstanceResource) Schema ¶
func (r InstanceResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
func (InstanceResource) SyncState ¶
func (r InstanceResource) SyncState(ctx context.Context, tfState *tfsdk.State, server incus.InstanceServer, m InstanceModel) diag.Diagnostics
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 ¶
func (r InstanceResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
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 ¶
func (r InstanceResource) ValidateConfig(ctx context.Context, req resource.ValidateConfigRequest, resp *resource.ValidateConfigResponse)
type InstanceSnapshotModel ¶
type InstanceSnapshotResource ¶
type InstanceSnapshotResource struct {
// contains filtered or unexported fields
}
InstanceSnapshotResource represent Incus instance snapshot resource.
func (*InstanceSnapshotResource) Configure ¶
func (r *InstanceSnapshotResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
func (InstanceSnapshotResource) Create ¶
func (r InstanceSnapshotResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
func (InstanceSnapshotResource) Delete ¶
func (r InstanceSnapshotResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
func (InstanceSnapshotResource) Metadata ¶
func (r InstanceSnapshotResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
func (InstanceSnapshotResource) Read ¶
func (r InstanceSnapshotResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
func (InstanceSnapshotResource) Schema ¶
func (r InstanceSnapshotResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
func (InstanceSnapshotResource) SyncState ¶
func (r InstanceSnapshotResource) SyncState(ctx context.Context, tfState *tfsdk.State, server incus.InstanceServer, m InstanceSnapshotModel) diag.Diagnostics
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 ¶
func (r InstanceSnapshotResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)