disk

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDataSource

func NewDataSource() datasource.DataSource

NewDataSource is a helper function to simplify the provider implementation.

func NewResource

func NewResource() resource.Resource

NewResource is a helper function to simplify the provider implementation.

Types

type DataSource

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

DataSource is the data source implementation.

func (*DataSource) Configure

Configure adds the provider configured client to the data source.

func (*DataSource) Metadata

Metadata sets the resource type name.

func (*DataSource) Read

Read refreshes the Terraform state with the latest data.

func (*DataSource) Schema

Schema defines the schema for the data source.

type DataSourceModel

type DataSourceModel struct {
	ID           types.String          `tfsdk:"id"`
	Name         types.String          `tfsdk:"name"`
	Description  types.String          `tfsdk:"description"`
	BlockSize    types.Int64           `tfsdk:"block_size"`
	DevicePath   types.String          `tfsdk:"device_path"`
	ProjectName  types.String          `tfsdk:"project_name"`
	ProjectID    types.String          `tfsdk:"project_id"`
	Size         types.Int64           `tfsdk:"size"`
	State        *StateDataSourceModel `tfsdk:"state"`
	ImageID      types.String          `tfsdk:"image_id"`
	SnapshotID   types.String          `tfsdk:"snapshot_id"`
	DiskType     types.String          `tfsdk:"disk_type"`
	ReadOnly     types.Bool            `tfsdk:"read_only"`
	TimeCreated  types.String          `tfsdk:"time_created"`
	TimeModified types.String          `tfsdk:"time_modified"`
	Timeouts     timeouts.Value        `tfsdk:"timeouts"`
}

DataSourceModel are the attributes that are supported on this data source.

type LocalSourceValidator

type LocalSourceValidator struct{}

LocalSourceValidator validates that source-related fields are not set when disk_type is "local".

func (*LocalSourceValidator) Description

func (v *LocalSourceValidator) Description(_ context.Context) string

func (*LocalSourceValidator) MarkdownDescription

func (v *LocalSourceValidator) MarkdownDescription(ctx context.Context) string

func (*LocalSourceValidator) ValidateResource

type ReadOnlySourceValidator

type ReadOnlySourceValidator struct{}

ReadOnlySourceValidator validates that one of source_image_id or source_snapshot_id is set when read_only is set.

func (*ReadOnlySourceValidator) Description

func (v *ReadOnlySourceValidator) Description(_ context.Context) string

func (*ReadOnlySourceValidator) MarkdownDescription

func (v *ReadOnlySourceValidator) MarkdownDescription(ctx context.Context) string

func (*ReadOnlySourceValidator) ValidateResource

type Resource

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

Resource is the resource implementation.

func (*Resource) ConfigValidators

func (r *Resource) ConfigValidators(_ context.Context) []resource.ConfigValidator

ConfigValidators returns the config validators for the resource.

func (*Resource) Configure

Configure adds the provider configured client to the data source.

func (*Resource) Create

func (r *Resource) Create(
	ctx context.Context,
	req resource.CreateRequest,
	resp *resource.CreateResponse,
)

Create creates the resource and sets the initial Terraform state.

func (*Resource) Delete

func (r *Resource) Delete(
	ctx context.Context,
	req resource.DeleteRequest,
	resp *resource.DeleteResponse,
)

Delete deletes the resource and removes the Terraform state on success.

func (*Resource) ImportState

func (r *Resource) ImportState(
	ctx context.Context,
	req resource.ImportStateRequest,
	resp *resource.ImportStateResponse,
)

ImportState imports an existing disk resource into Terraform state.

func (*Resource) Metadata

Metadata returns the resource type name.

func (*Resource) Read

func (r *Resource) Read(
	ctx context.Context,
	req resource.ReadRequest,
	resp *resource.ReadResponse,
)

Read refreshes the Terraform state with the latest data.

func (*Resource) Schema

Schema defines the schema for the resource.

func (*Resource) Update

func (r *Resource) Update(
	ctx context.Context,
	req resource.UpdateRequest,
	resp *resource.UpdateResponse,
)

Update updates the resource and sets the updated Terraform state on success.

type ResourceModel

type ResourceModel struct {
	BlockSize        types.Int64    `tfsdk:"block_size"`
	Description      types.String   `tfsdk:"description"`
	DevicePath       types.String   `tfsdk:"device_path"`
	DiskType         types.String   `tfsdk:"disk_type"`
	ID               types.String   `tfsdk:"id"`
	SourceImageID    types.String   `tfsdk:"source_image_id"`
	Name             types.String   `tfsdk:"name"`
	ProjectID        types.String   `tfsdk:"project_id"`
	Size             types.Int64    `tfsdk:"size"`
	SourceSnapshotID types.String   `tfsdk:"source_snapshot_id"`
	ReadOnly         types.Bool     `tfsdk:"read_only"`
	TimeCreated      types.String   `tfsdk:"time_created"`
	TimeModified     types.String   `tfsdk:"time_modified"`
	Timeouts         timeouts.Value `tfsdk:"timeouts"`
}

type StateDataSourceModel

type StateDataSourceModel struct {
	State    types.String `tfsdk:"state"`
	Instance types.String `tfsdk:"instance"`
}

StateDataSourceModel are the attributes for the disk state.

Jump to

Keyboard shortcuts

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