common

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: MPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VolumeTypeStandard is a VolumeType enum value
	VolumeTypeStandard = "standard"

	// VolumeTypeIo1 is a VolumeType enum value
	VolumeTypeIo1 = "io1"

	// VolumeTypeGp2 is a VolumeType enum value
	VolumeTypeGp2 = "gp2"

	// VolumeTypeSc1 is a VolumeType enum value
	VolumeTypeSc1 = "sc1"

	// VolumeTypeSt1 is a VolumeType enum value
	VolumeTypeSt1 = "st1"
)
View Source
const (
	RunSourceVmBSUExpectedRootDevice = "ebs"
)

Variables

View Source
var TemplateFuncs = template.FuncMap{
	"clean_resource_name": templateCleanResourceName,
}

Functions

func CreateTags

func CreateTags(conn *oapi.Client, resourceID string, ui packer.Ui, tags OAPITags) error

func SSHHost

func SSHHost(e oapiDescriber, sshInterface string) func(multistep.StateBag) (string, error)

SSHHost returns a function that can be given to the SSH communicator for determining the SSH address based on the vm DNS name.

func WaitUntilImageAvailable

func WaitUntilImageAvailable(conn *oapi.Client, imageID string) error

func WaitUntilSnapshotCompleted

func WaitUntilSnapshotCompleted(conn *oapi.Client, id string) error

func WaitUntilSnapshotDone

func WaitUntilSnapshotDone(conn *oapi.Client, snapshotID string) error

func WaitUntilVolumeAvailable

func WaitUntilVolumeAvailable(conn *oapi.Client, volumeID string) error

func WaitUntilVolumeIsLinked

func WaitUntilVolumeIsLinked(conn *oapi.Client, volumeID string) error

func WaitUntilVolumeIsUnlinked

func WaitUntilVolumeIsUnlinked(conn *oapi.Client, volumeID string) error

Types

type AccessConfig

type AccessConfig struct {
	AccessKey             string `mapstructure:"access_key"`
	CustomEndpointOAPI    string `mapstructure:"custom_endpoint_oapi"`
	InsecureSkipTLSVerify bool   `mapstructure:"insecure_skip_tls_verify"`
	MFACode               string `mapstructure:"mfa_code"`
	ProfileName           string `mapstructure:"profile"`
	RawRegion             string `mapstructure:"region"`
	SecretKey             string `mapstructure:"secret_key"`
	SkipValidation        bool   `mapstructure:"skip_region_validation"`
	SkipMetadataApiCheck  bool   `mapstructure:"skip_metadata_api_check"`
	Token                 string `mapstructure:"token"`
	// contains filtered or unexported fields
}

AccessConfig is for common configuration related to Outscale API access

func (*AccessConfig) Config

func (c *AccessConfig) Config() (*oapi.Config, error)

Config returns a valid oapi.Config object for access to Outscale services, or an error if the authentication and region couldn't be resolved

func (*AccessConfig) NewOAPIConnection

func (c *AccessConfig) NewOAPIConnection() (oapi.OAPIClient, error)

func (*AccessConfig) Prepare

func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error

func (*AccessConfig) ValidateRegion

func (c *AccessConfig) ValidateRegion(regions ...string) error

ValidateRegion returns true if the supplied region is a valid Outscale region and false if it's not.

type Artifact

type Artifact struct {
	// A map of regions to OMI IDs.
	Omis map[string]string

	// BuilderId is the unique ID for the builder that created this OMI
	BuilderIdValue string

	// OAPI connection for performing API stuff.
	Config *oapi.Config
}

Artifact is an artifact implementation that contains built OMIs.

func (*Artifact) BuilderId

func (a *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

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

func (*Artifact) String

func (a *Artifact) String() string

type BlockDevice

type BlockDevice struct {
	DeleteOnVmDeletion bool   `mapstructure:"delete_on_vm_deletion"`
	DeviceName         string `mapstructure:"device_name"`
	IOPS               int64  `mapstructure:"iops"`
	NoDevice           bool   `mapstructure:"no_device"`
	SnapshotId         string `mapstructure:"snapshot_id"`
	VirtualName        string `mapstructure:"virtual_name"`
	VolumeType         string `mapstructure:"volume_type"`
	VolumeSize         int64  `mapstructure:"volume_size"`
}

BlockDevice

func (*BlockDevice) Prepare

func (b *BlockDevice) Prepare(ctx *interpolate.Context) error

type BlockDevices

type BlockDevices struct {
	OMIBlockDevices    `mapstructure:",squash"`
	LaunchBlockDevices `mapstructure:",squash"`
}

func (*BlockDevices) Prepare

func (b *BlockDevices) Prepare(ctx *interpolate.Context) (errs []error)

type BuildInfoTemplate

type BuildInfoTemplate struct {
	BuildRegion   string
	SourceOMI     string
	SourceOMIName string
	SourceOMITags map[string]string
}

type LaunchBlockDevices

type LaunchBlockDevices struct {
	LaunchMappings []BlockDevice `mapstructure:"launch_block_device_mappings"`
}

func (*LaunchBlockDevices) BuildLaunchDevices

func (b *LaunchBlockDevices) BuildLaunchDevices() []oapi.BlockDeviceMappingVmCreation

type NetFilterOptions

type NetFilterOptions struct {
	Filters map[string]string
}

func (*NetFilterOptions) Empty

func (d *NetFilterOptions) Empty() bool

type OAPITags

type OAPITags []oapi.ResourceTag

func (OAPITags) Report

func (t OAPITags) Report(ui packer.Ui)

type OMIBlockDevices

type OMIBlockDevices struct {
	OMIMappings []BlockDevice `mapstructure:"omi_block_device_mappings"`
}

func (*OMIBlockDevices) BuildOMIDevices

func (b *OMIBlockDevices) BuildOMIDevices() []oapi.BlockDeviceMappingImage

type OMIConfig

type OMIConfig struct {
	OMIName                 string   `mapstructure:"omi_name"`
	OMIDescription          string   `mapstructure:"omi_description"`
	OMIVirtType             string   `mapstructure:"omi_virtualization_type"`
	OMIAccountIDs           []string `mapstructure:"omi_account_ids"`
	OMIGroups               []string `mapstructure:"omi_groups"`
	OMIProductCodes         []string `mapstructure:"omi_product_codes"`
	OMIRegions              []string `mapstructure:"omi_regions"`
	OMISkipRegionValidation bool     `mapstructure:"skip_region_validation"`
	OMITags                 TagMap   `mapstructure:"tags"`
	OMIForceDeregister      bool     `mapstructure:"force_deregister"`
	OMIForceDeleteSnapshot  bool     `mapstructure:"force_delete_snapshot"`
	SnapshotTags            TagMap   `mapstructure:"snapshot_tags"`
	SnapshotAccountIDs      []string `mapstructure:"snapshot_account_ids"`
	SnapshotGroups          []string `mapstructure:"snapshot_groups"`
}

OMIConfig is for common configuration related to creating OMIs.

func (*OMIConfig) Prepare

func (c *OMIConfig) Prepare(accessConfig *AccessConfig, ctx *interpolate.Context) []error

type OmiFilterOptions

type OmiFilterOptions struct {
	Filters    map[string]string
	Owners     []string
	MostRecent bool `mapstructure:"most_recent"`
}

func (*OmiFilterOptions) Empty

func (d *OmiFilterOptions) Empty() bool

func (*OmiFilterOptions) NoOwner

func (d *OmiFilterOptions) NoOwner() bool

type RunConfig

type RunConfig struct {
	AssociatePublicIpAddress    bool                       `mapstructure:"associate_public_ip_address"`
	Subregion                   string                     `mapstructure:"subregion_name"`
	BlockDurationMinutes        int64                      `mapstructure:"block_duration_minutes"`
	DisableStopVm               bool                       `mapstructure:"disable_stop_vm"`
	BsuOptimized                bool                       `mapstructure:"bsu_optimized"`
	EnableT2Unlimited           bool                       `mapstructure:"enable_t2_unlimited"`
	IamVmProfile                string                     `mapstructure:"iam_vm_profile"`
	VmInitiatedShutdownBehavior string                     `mapstructure:"shutdown_behavior"`
	VmType                      string                     `mapstructure:"vm_type"`
	SecurityGroupFilter         SecurityGroupFilterOptions `mapstructure:"security_group_filter"`
	RunTags                     map[string]string          `mapstructure:"run_tags"`
	SecurityGroupId             string                     `mapstructure:"security_group_id"`
	SecurityGroupIds            []string                   `mapstructure:"security_group_ids"`
	SourceOmi                   string                     `mapstructure:"source_omi"`
	SourceOmiFilter             OmiFilterOptions           `mapstructure:"source_omi_filter"`
	SpotPrice                   string                     `mapstructure:"spot_price"`
	SpotPriceAutoProduct        string                     `mapstructure:"spot_price_auto_product"`
	SpotTags                    map[string]string          `mapstructure:"spot_tags"`
	SubnetFilter                SubnetFilterOptions        `mapstructure:"subnet_filter"`
	SubnetId                    string                     `mapstructure:"subnet_id"`
	TemporaryKeyPairName        string                     `mapstructure:"temporary_key_pair_name"`
	TemporarySGSourceCidr       string                     `mapstructure:"temporary_security_group_source_cidr"`
	UserData                    string                     `mapstructure:"user_data"`
	UserDataFile                string                     `mapstructure:"user_data_file"`
	NetFilter                   NetFilterOptions           `mapstructure:"net_filter"`
	NetId                       string                     `mapstructure:"net_id"`
	WindowsPasswordTimeout      time.Duration              `mapstructure:"windows_password_timeout"`

	// Communicator settings
	Comm         communicator.Config `mapstructure:",squash"`
	SSHInterface string              `mapstructure:"ssh_interface"`
}

RunConfig contains configuration for running an vm from a source AMI and details on how to access that launched image.

func (*RunConfig) IsSpotVm

func (c *RunConfig) IsSpotVm() bool

func (*RunConfig) Prepare

func (c *RunConfig) Prepare(ctx *interpolate.Context) []error

type SecurityGroupFilterOptions

type SecurityGroupFilterOptions struct {
	Filters map[string]string
}

func (*SecurityGroupFilterOptions) Empty

func (d *SecurityGroupFilterOptions) Empty() bool

type StepCleanupVolumes

type StepCleanupVolumes struct {
	BlockDevices BlockDevices
}

stepCleanupVolumes cleans up any orphaned volumes that were not designated to remain after termination of the vm. These volumes are typically ones that are marked as "delete on terminate:false" in the source_ami of a build.

func (*StepCleanupVolumes) Cleanup

func (s *StepCleanupVolumes) Cleanup(state multistep.StateBag)

func (*StepCleanupVolumes) Run

type StepCreateTags

type StepCreateTags struct {
	Tags         TagMap
	SnapshotTags TagMap
	Ctx          interpolate.Context
}

func (*StepCreateTags) Cleanup

func (s *StepCreateTags) Cleanup(state multistep.StateBag)

func (*StepCreateTags) Run

type StepDeregisterOMI

type StepDeregisterOMI struct {
	AccessConfig        *AccessConfig
	ForceDeregister     bool
	ForceDeleteSnapshot bool
	OMIName             string
	Regions             []string
}

func (*StepDeregisterOMI) Cleanup

func (s *StepDeregisterOMI) Cleanup(state multistep.StateBag)

func (*StepDeregisterOMI) Run

type StepGetPassword

type StepGetPassword struct {
	Debug     bool
	Comm      *communicator.Config
	Timeout   time.Duration
	BuildName string
}

StepGetPassword reads the password from a Windows server and sets it on the WinRM config.

func (*StepGetPassword) Cleanup

func (s *StepGetPassword) Cleanup(multistep.StateBag)

func (*StepGetPassword) Run

type StepKeyPair

type StepKeyPair struct {
	Debug        bool
	Comm         *communicator.Config
	DebugKeyPath string
	// contains filtered or unexported fields
}

func (*StepKeyPair) Cleanup

func (s *StepKeyPair) Cleanup(state multistep.StateBag)

func (*StepKeyPair) Run

type StepNetworkInfo

type StepNetworkInfo struct {
	NetId               string
	NetFilter           NetFilterOptions
	SubnetId            string
	SubnetFilter        SubnetFilterOptions
	SubregionName       string
	SecurityGroupIds    []string
	SecurityGroupFilter SecurityGroupFilterOptions
}

StepNetworkInfo queries OUTSCALE for information about NET's and Subnets that is used throughout the OMI creation process.

Produces (adding them to the state bag):

vpc_id string - the NET ID
subnet_id string - the Subnet ID
availability_zone string - the Subregion name

func (*StepNetworkInfo) Cleanup

func (s *StepNetworkInfo) Cleanup(multistep.StateBag)

func (*StepNetworkInfo) Run

type StepPreValidate

type StepPreValidate struct {
	DestOmiName     string
	ForceDeregister bool
}

StepPreValidate provides an opportunity to pre-validate any configuration for the build before actually doing any time consuming work

func (*StepPreValidate) Cleanup

func (s *StepPreValidate) Cleanup(multistep.StateBag)

func (*StepPreValidate) Run

type StepRunSourceVm

type StepRunSourceVm struct {
	AssociatePublicIpAddress    bool
	BlockDevices                BlockDevices
	Comm                        *communicator.Config
	Ctx                         interpolate.Context
	Debug                       bool
	BsuOptimized                bool
	EnableT2Unlimited           bool
	ExpectedRootDevice          string
	IamVmProfile                string
	VmInitiatedShutdownBehavior string
	VmType                      string
	IsRestricted                bool
	SourceOMI                   string
	Tags                        TagMap
	UserData                    string
	UserDataFile                string
	VolumeTags                  TagMap
	// contains filtered or unexported fields
}

func (*StepRunSourceVm) Cleanup

func (s *StepRunSourceVm) Cleanup(state multistep.StateBag)

func (*StepRunSourceVm) Run

type StepSecurityGroup

type StepSecurityGroup struct {
	CommConfig            *communicator.Config
	SecurityGroupFilter   SecurityGroupFilterOptions
	SecurityGroupIds      []string
	TemporarySGSourceCidr string
	// contains filtered or unexported fields
}

func (*StepSecurityGroup) Cleanup

func (s *StepSecurityGroup) Cleanup(state multistep.StateBag)

func (*StepSecurityGroup) Run

type StepSourceOMIInfo

type StepSourceOMIInfo struct {
	SourceOmi   string
	OMIVirtType string
	OmiFilters  OmiFilterOptions
}

StepSourceOMIInfo extracts critical information from the source OMI that is used throughout the OMI creation process.

Produces:

source_image *oapi.Image - the source OMI info

func (*StepSourceOMIInfo) Cleanup

func (s *StepSourceOMIInfo) Cleanup(multistep.StateBag)

func (*StepSourceOMIInfo) Run

type StepStopBSUBackedVm

type StepStopBSUBackedVm struct {
	Skip          bool
	DisableStopVm bool
}

func (*StepStopBSUBackedVm) Cleanup

func (*StepStopBSUBackedVm) Run

type StepUpdateBSUBackedVm

type StepUpdateBSUBackedVm struct {
	EnableAMIENASupport      *bool
	EnableAMISriovNetSupport bool
}

func (*StepUpdateBSUBackedVm) Cleanup

func (s *StepUpdateBSUBackedVm) Cleanup(state multistep.StateBag)

func (*StepUpdateBSUBackedVm) Run

type StepUpdateOMIAttributes

type StepUpdateOMIAttributes struct {
	AccountIds         []string
	SnapshotAccountIds []string
	Ctx                interpolate.Context
}

func (*StepUpdateOMIAttributes) Cleanup

func (s *StepUpdateOMIAttributes) Cleanup(state multistep.StateBag)

func (*StepUpdateOMIAttributes) Run

type SubnetFilterOptions

type SubnetFilterOptions struct {
	Filters  map[string]string
	MostFree bool `mapstructure:"most_free"`
	Random   bool `mapstructure:"random"`
}

func (*SubnetFilterOptions) Empty

func (d *SubnetFilterOptions) Empty() bool

type TagMap

type TagMap map[string]string

func (TagMap) IsSet

func (t TagMap) IsSet() bool

func (TagMap) OAPITags

func (t TagMap) OAPITags(ctx interpolate.Context, region string, state multistep.StateBag) (OAPITags, error)

Jump to

Keyboard shortcuts

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