image

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Oxide API URL (e.g., `https://oxide.sys.example.com`). If not specified,
	// this defaults to the value of the `OXIDE_HOST` environment variable. When
	// specified, `token` must be specified. Conflicts with `profile`.
	Host string `mapstructure:"host" required:"false"`

	// Oxide API token. If not specified, this defaults to the value of the
	// `OXIDE_TOKEN` environment variable. When specified, `host` must be specified.
	// Conflicts with `profile`.
	Token string `mapstructure:"token" required:"false"`

	// Oxide credentials profile. If not specified, this defaults to the value of
	// the `OXIDE_PROFILE` environment variable. Conflicts with `host` and `token`.
	Profile string `mapstructure:"profile" required:"false"`

	// Name of the image to fetch.
	Name string `mapstructure:"name" required:"true"`

	// Name or ID of the project containing the image to fetch. Leave blank to fetch
	// a silo image instead of a project image.
	Project string `mapstructure:"project"`
}

The configuration arguments for the data source. Arguments can either be required or optional.

func (*Config) FlatMapstructure

func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

type Datasource

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

The `oxide-image` data source fetches [Oxide](https://oxide.computer) image information for use in a Packer build. The image can be a project image or silo image.

func (*Datasource) ConfigSpec

func (d *Datasource) ConfigSpec() hcldec.ObjectSpec

ConfigSpec returns the HCL specification that Packer uses to validate and configure this plugin component.

func (*Datasource) Configure

func (d *Datasource) Configure(args ...any) error

Configure decodes the configuration for this plugin component, checks whether the configuration is valid, and stores any necessary state for future methods to use during execution.

func (*Datasource) Execute

func (d *Datasource) Execute() (cty.Value, error)

Execute fetches image information from the Oxide API and returns that information in the format specified by [OutputSpec].

func (*Datasource) OutputSpec

func (d *Datasource) OutputSpec() hcldec.ObjectSpec

OutputSpec returns the HCL specification that Packer uses to populate output values for this plugin component.

type DatasourceOutput

type DatasourceOutput struct {
	// ID of the image that was fetched.
	ImageID string `mapstructure:"image_id"`
}

The outputs returned by this data source component.

func (*DatasourceOutput) FlatMapstructure

func (*DatasourceOutput) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

FlatMapstructure returns a new FlatDatasourceOutput. FlatDatasourceOutput is an auto-generated flat version of DatasourceOutput. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

type FlatConfig

type FlatConfig struct {
	Host    *string `mapstructure:"host" required:"false" cty:"host" hcl:"host"`
	Token   *string `mapstructure:"token" required:"false" cty:"token" hcl:"token"`
	Profile *string `mapstructure:"profile" required:"false" cty:"profile" hcl:"profile"`
	Name    *string `mapstructure:"name" required:"true" cty:"name" hcl:"name"`
	Project *string `mapstructure:"project" cty:"project" hcl:"project"`
}

FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatConfig) HCL2Spec

func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a Config. This spec is used by HCL to read the fields of Config. The decoded values from this spec will then be applied to a FlatConfig.

type FlatDatasourceOutput

type FlatDatasourceOutput struct {
	ImageID *string `mapstructure:"image_id" cty:"image_id" hcl:"image_id"`
}

FlatDatasourceOutput is an auto-generated flat version of DatasourceOutput. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatDatasourceOutput) HCL2Spec

func (*FlatDatasourceOutput) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a DatasourceOutput. This spec is used by HCL to read the fields of DatasourceOutput. The decoded values from this spec will then be applied to a FlatDatasourceOutput.

Jump to

Keyboard shortcuts

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