digitalocean

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "pearkes.digitalocean"

The unique id for the builder

Variables

This section is empty.

Functions

func WaitForImageState added in v1.3.5

func WaitForImageState(
	desiredState string, imageId, actionId int,
	client *godo.Client, timeout time.Duration) error

WaitForImageState simply blocks until the image action is in a state we expect, while eventually timing out.

Types

type Artifact

type Artifact struct {
	// The name of the snapshot
	SnapshotName string

	// The ID of the image
	SnapshotId int

	// The name of the region
	RegionNames []string

	// The client for making API calls
	Client *godo.Client
}

func (*Artifact) BuilderId

func (*Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (*Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State added in v0.7.2

func (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type Builder

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

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) ([]string, error)

func (*Builder) Run

func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error)

type Config added in v0.8.0

type Config struct {
	common.PackerConfig `mapstructure:",squash"`
	Comm                communicator.Config `mapstructure:",squash"`
	// The client TOKEN to use to access your account. It
	// can also be specified via environment variable DIGITALOCEAN_API_TOKEN, if
	// set.
	APIToken string `mapstructure:"api_token" required:"true"`
	// Non standard api endpoint URL. Set this if you are
	// using a DigitalOcean API compatible service. It can also be specified via
	// environment variable DIGITALOCEAN_API_URL.
	APIURL string `mapstructure:"api_url" required:"false"`
	// The name (or slug) of the region to launch the droplet
	// in. Consequently, this is the region where the snapshot will be available.
	// See
	// https://developers.digitalocean.com/documentation/v2/#list-all-regions
	// for the accepted region names/slugs.
	Region string `mapstructure:"region" required:"true"`
	// The name (or slug) of the droplet size to use. See
	// https://developers.digitalocean.com/documentation/v2/#list-all-sizes
	// for the accepted size names/slugs.
	Size string `mapstructure:"size" required:"true"`
	// The name (or slug) of the base image to use. This is the
	// image that will be used to launch a new droplet and provision it. See
	// https://developers.digitalocean.com/documentation/v2/#list-all-images
	// for details on how to get a list of the accepted image names/slugs.
	Image string `mapstructure:"image" required:"true"`
	// Set to true to enable private networking
	// for the droplet being created. This defaults to false, or not enabled.
	PrivateNetworking bool `mapstructure:"private_networking" required:"false"`
	// Set to true to enable monitoring for the droplet
	// being created. This defaults to false, or not enabled.
	Monitoring bool `mapstructure:"monitoring" required:"false"`
	// Set to true to enable ipv6 for the droplet being
	// created. This defaults to false, or not enabled.
	IPv6 bool `mapstructure:"ipv6" required:"false"`
	// The name of the resulting snapshot that will
	// appear in your account. Defaults to "packer-{{timestamp}}" (see
	// configuration templates for more info).
	SnapshotName string `mapstructure:"snapshot_name" required:"false"`
	// The regions of the resulting
	// snapshot that will appear in your account.
	SnapshotRegions []string `mapstructure:"snapshot_regions" required:"false"`
	// The time to wait, as a duration string, for a
	// droplet to enter a desired state (such as "active") before timing out. The
	// default state timeout is "6m".
	StateTimeout time.Duration `mapstructure:"state_timeout" required:"false"`
	// How long to wait for an image to be published to the shared image
	// gallery before timing out. If your Packer build is failing on the
	// Publishing to Shared Image Gallery step with the error `Original Error:
	// context deadline exceeded`, but the image is present when you check your
	// Azure dashboard, then you probably need to increase this timeout from
	// its default of "60m" (valid time units include `s` for seconds, `m` for
	// minutes, and `h` for hours.)
	SnapshotTimeout time.Duration `mapstructure:"snapshot_timeout" required:"false"`
	// The name assigned to the droplet. DigitalOcean
	// sets the hostname of the machine to this value.
	DropletName string `mapstructure:"droplet_name" required:"false"`
	// User data to launch with the Droplet. Packer will
	// not automatically wait for a user script to finish before shutting down the
	// instance this must be handled in a provisioner.
	UserData string `mapstructure:"user_data" required:"false"`
	// Path to a file that will be used for the user
	// data when launching the Droplet.
	UserDataFile string `mapstructure:"user_data_file" required:"false"`
	// Tags to apply to the droplet when it is created
	Tags []string `mapstructure:"tags" required:"false"`
	// contains filtered or unexported fields
}

func NewConfig added in v0.8.0

func NewConfig(raws ...interface{}) (*Config, []string, error)

Jump to

Keyboard shortcuts

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