Documentation ¶
Overview ¶
The alicloud contains a packersdk.Builder implementation that builds ecs images for alicloud.
Index ¶
- Constants
- Variables
- func ContainsInArray(arr []string, value string) bool
- func SSHHost(e alicloudSSHHelper, private bool) func(multistep.StateBag) (string, error)
- type AlicloudAccessConfig
- type AlicloudDiskDevice
- type AlicloudDiskDevices
- type AlicloudImageConfig
- type Artifact
- type Builder
- type ClientWrapper
- func (c *ClientWrapper) EvalCouldRetryResponse(evalErrors []string, evalErrorType EvalErrorType) func(response responses.AcsResponse, err error) WaitForExpectEvalResult
- func (c *ClientWrapper) WaitForExpected(args *WaitForExpectArgs) (responses.AcsResponse, error)
- func (c *ClientWrapper) WaitForImageStatus(regionId string, imageId string, expectedStatus string, timeout time.Duration) (responses.AcsResponse, error)
- func (c *ClientWrapper) WaitForInstanceStatus(regionId string, instanceId string, expectedStatus string) (responses.AcsResponse, error)
- func (c *ClientWrapper) WaitForSnapshotStatus(regionId string, snapshotId string, expectedStatus string, ...) (responses.AcsResponse, error)
- type Config
- type EvalErrorType
- type FlatAlicloudDiskDevice
- type FlatConfig
- type InstanceNetWork
- type RunConfig
- type WaitForExpectArgs
- type WaitForExpectEvalResult
Constants ¶
const ( ALICLOUD_DEFAULT_SHORT_TIMEOUT = 180 ALICLOUD_DEFAULT_TIMEOUT = 1800 ALICLOUD_DEFAULT_LONG_TIMEOUT = 3600 )
const ( InstanceStatusRunning = "Running" InstanceStatusStarting = "Starting" InstanceStatusStopped = "Stopped" InstanceStatusStopping = "Stopping" )
const ( ImageStatusWaiting = "Waiting" ImageStatusCreating = "Creating" ImageStatusCreateFailed = "CreateFailed" ImageStatusAvailable = "Available" )
const ( SnapshotStatusAll = "all" SnapshotStatusProgressing = "progressing" SnapshotStatusAccomplished = "accomplished" SnapshotStatusFailed = "failed" )
const ( DiskStatusInUse = "In_use" DiskStatusAvailable = "Available" DiskStatusAttaching = "Attaching" DiskStatusDetaching = "Detaching" DiskStatusCreating = "Creating" DiskStatusReIniting = "ReIniting" )
const ( VpcStatusPending = "Pending" VpcStatusAvailable = "Available" )
const ( VSwitchStatusPending = "Pending" VSwitchStatusAvailable = "Available" )
const ( EipStatusAssociating = "Associating" EipStatusUnassociating = "Unassociating" EipStatusInUse = "InUse" EipStatusAvailable = "Available" )
const ( ImageOwnerSystem = "system" ImageOwnerSelf = "self" ImageOwnerOthers = "others" ImageOwnerMarketplace = "marketplace" )
const ( IOOptimizedNone = "none" IOOptimizedOptimized = "optimized" )
const ( InstanceNetworkClassic = "classic" InstanceNetworkVpc = "vpc" )
const ( DiskTypeSystem = "system" DiskTypeData = "data" )
const ( TagResourceImage = "image" TagResourceInstance = "instance" TagResourceSnapshot = "snapshot" TagResourceDisk = "disk" )
const ( IpProtocolAll = "all" IpProtocolTCP = "tcp" IpProtocolUDP = "udp" IpProtocolICMP = "icmp" IpProtocolGRE = "gre" )
const ( NicTypeInternet = "internet" NicTypeIntranet = "intranet" )
const ( DefaultPortRange = "-1/-1" DefaultCidrIp = "0.0.0.0/0" DefaultCidrBlock = "172.16.0.0/24" )
const ( EvalRetryErrorType = EvalErrorType(true) EvalNotRetryErrorType = EvalErrorType(false) )
const BuilderId = "alibaba.alicloud"
The unique ID for this builder
const DefaultRequestReadTimeout = 10 * time.Second
const Packer = "HashiCorp-Packer"
Variables ¶
var ( WaitForExpectSuccess = WaitForExpectEvalResult{ // contains filtered or unexported fields } WaitForExpectToRetry = WaitForExpectEvalResult{ // contains filtered or unexported fields } WaitForExpectFailToStop = WaitForExpectEvalResult{ // contains filtered or unexported fields } )
var ImageStatusQueried = fmt.Sprintf("%s,%s,%s,%s", ImageStatusWaiting, ImageStatusCreating, ImageStatusCreateFailed, ImageStatusAvailable)
Functions ¶
func ContainsInArray ¶
Types ¶
type AlicloudAccessConfig ¶
type AlicloudAccessConfig struct { // Alicloud access key must be provided unless `profile` is set, but it can // also be sourced from the `ALICLOUD_ACCESS_KEY` environment variable. AlicloudAccessKey string `mapstructure:"access_key" required:"true"` // Alicloud secret key must be provided unless `profile` is set, but it can // also be sourced from the `ALICLOUD_SECRET_KEY` environment variable. AlicloudSecretKey string `mapstructure:"secret_key" required:"true"` // Alicloud region must be provided unless `profile` is set, but it can // also be sourced from the `ALICLOUD_REGION` environment variable. AlicloudRegion string `mapstructure:"region" required:"true"` // Alicloud RamRole must be provided for EcsRamRole mode unless `profile` is set. AlicloudRamRole string `mapstructure:"ram_role_name" required:"true"` // Alicloud RamRoleArn must be provided for RamRoleArn mode unless `profile` is set. AlicloudRamRoleArn string `mapstructure:"ram_role_arn" required:"true"` // Alicloud RamSessionName must be provided for RamRoleArn mode unless `profile` is set. AlicloudRamSessionName string `mapstructure:"ram_session_name" required:"true"` // The region validation can be skipped if this value is true, the default // value is false. AlicloudSkipValidation bool `mapstructure:"skip_region_validation" required:"false"` // The image validation can be skipped if this value is true, the default // value is false. AlicloudSkipImageValidation bool `mapstructure:"skip_image_validation" required:"false"` // Alicloud profile must be set unless `access_key` is set; it can also be // sourced from the `ALICLOUD_PROFILE` environment variable. AlicloudProfile string `mapstructure:"profile" required:"false"` // secret keys will be read from this file. AlicloudSharedCredentialsFile string `mapstructure:"shared_credentials_file" required:"false"` // STS access token, can be set through template or by exporting as // environment variable such as `export SECURITY_TOKEN=value`. SecurityToken string `mapstructure:"security_token" required:"false"` // This option is useful if you use a cloud provider whose API is // compatible with aliyun ECS. Specify another endpoint with this option. CustomEndpointEcs string `mapstructure:"custom_endpoint_ecs" required:"false"` // contains filtered or unexported fields }
Config of alicloud
func (*AlicloudAccessConfig) Client ¶
func (c *AlicloudAccessConfig) Client() (*ClientWrapper, error)
Client for AlicloudClient
func (*AlicloudAccessConfig) Config ¶
func (c *AlicloudAccessConfig) Config() error
func (*AlicloudAccessConfig) Prepare ¶
func (c *AlicloudAccessConfig) Prepare(ctx *interpolate.Context) []error
func (*AlicloudAccessConfig) ValidateRegion ¶
func (c *AlicloudAccessConfig) ValidateRegion(region string) error
type AlicloudDiskDevice ¶
type AlicloudDiskDevice struct { // The value of disk name is blank by default. [2, // 128] English or Chinese characters, must begin with an // uppercase/lowercase letter or Chinese character. Can contain numbers, // ., _ and -. The disk name will appear on the console. It cannot // begin with `http://` or `https://`. DiskName string `mapstructure:"disk_name" required:"false"` // Category of the system disk. Optional values are: // - cloud - general cloud disk // - cloud_efficiency - efficiency cloud disk // - cloud_ssd - cloud SSD // - cloud_essd - cloud ESSD DiskCategory string `mapstructure:"disk_category" required:"false"` // Size of the system disk, measured in GiB. Value // range: [20, 500]. The specified value must be equal to or greater // than max{20, ImageSize}. Default value: max{40, ImageSize}. DiskSize int `mapstructure:"disk_size" required:"false"` // Snapshots are used to create the data // disk After this parameter is specified, Size is ignored. The actual // size of the created disk is the size of the specified snapshot. // This field is only used in the ECSImagesDiskMappings option, not // the ECSSystemDiskMapping option. SnapshotId string `mapstructure:"disk_snapshot_id" required:"false"` // The value of disk description is blank by // default. [2, 256] characters. The disk description will appear on the // console. It cannot begin with `http://` or `https://`. Description string `mapstructure:"disk_description" required:"false"` // Whether or not the disk is // released along with the instance: DeleteWithInstance bool `mapstructure:"disk_delete_with_instance" required:"false"` // Device information of the related instance: // such as /dev/xvdb It is null unless the Status is In_use. Device string `mapstructure:"disk_device" required:"false"` // Whether or not to encrypt the data disk. // If this option is set to true, the data disk will be encryped and // corresponding snapshot in the target image will also be encrypted. By // default, if this is an extra data disk, Packer will not encrypt the // data disk. Otherwise, Packer will keep the encryption setting to what // it was in the source image. Please refer to Introduction of ECS disk // encryption for more details. Encrypted config.Trilean `mapstructure:"disk_encrypted" required:"false"` }
The "AlicloudDiskDevice" object us used for the `ECSSystemDiskMapping` and `ECSImagesDiskMappings` options, and contains the following fields:
func (*AlicloudDiskDevice) FlatMapstructure ¶
func (*AlicloudDiskDevice) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatAlicloudDiskDevice. FlatAlicloudDiskDevice is an auto-generated flat version of AlicloudDiskDevice. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type AlicloudDiskDevices ¶
type AlicloudDiskDevices struct { // Image disk mapping for the system disk. // See the [disk device configuration](#disk-devices-configuration) section // for more information on options. // Usage example: // // “`json // "builders": [{ // "type":"alicloud-ecs", // "system_disk_mapping": { // "disk_size": 50, // "disk_name": "mydisk" // }, // ... // } // “` ECSSystemDiskMapping AlicloudDiskDevice `mapstructure:"system_disk_mapping" required:"false"` // Add one or more data disks to the image. // See the [disk device configuration](#disk-devices-configuration) section // for more information on options. // Usage example: // // “`json // "builders": [{ // "type":"alicloud-ecs", // "image_disk_mappings": [ // { // "disk_snapshot_id": "someid", // "disk_device": "dev/xvdb" // } // ], // ... // } // “` ECSImagesDiskMappings []AlicloudDiskDevice `mapstructure:"image_disk_mappings" required:"false"` }
The "AlicloudDiskDevices" object is used to define disk mappings for your instance.
type AlicloudImageConfig ¶
type AlicloudImageConfig struct { // The name of the user-defined image, [2, 128] English or Chinese // characters. It must begin with an uppercase/lowercase letter or a // Chinese character, and may contain numbers, `_` or `-`. It cannot begin // with `http://` or `https://`. AlicloudImageName string `mapstructure:"image_name" required:"true"` // The version number of the image, with a length limit of 1 to 40 English // characters. AlicloudImageVersion string `mapstructure:"image_version" required:"false"` // The description of the image, with a length limit of 0 to 256 // characters. Leaving it blank means null, which is the default value. It // cannot begin with `http://` or `https://`. AlicloudImageDescription string `mapstructure:"image_description" required:"false"` // The ID of the resource group to which to assign the custom image. // If you do not specify this parameter, the image is assigned to the default resource group. AlicloudResourceGroupId string `mapstructure:"resource_group_id" required:"false"` // The IDs of to-be-added Aliyun accounts to which the image is shared. The // number of accounts is 1 to 10. If number of accounts is greater than 10, // this parameter is ignored. // Copy to the destination regionIds. AlicloudImageDestinationRegions []string `mapstructure:"image_copy_regions" required:"false"` // The name of the destination image, [2, 128] English or Chinese // characters. It must begin with an uppercase/lowercase letter or a // Chinese character, and may contain numbers, _ or -. It cannot begin with // `http://` or `https://`. AlicloudImageDestinationNames []string `mapstructure:"image_copy_names" required:"false"` // Whether or not to encrypt the target images, including those // copied if image_copy_regions is specified. If this option is set to // true, a temporary image will be created from the provisioned instance in // the main region and an encrypted copy will be generated in the same // region. By default, Packer will keep the encryption setting to what it // was in the source image. ImageEncrypted config.Trilean `mapstructure:"image_encrypted" required:"false"` // If this value is true, when the target image names including those // copied are duplicated with existing images, it will delete the existing // images and then create the target images, otherwise, the creation will // fail. The default value is false. Check `image_name` and // `image_copy_names` options for names of target images. If // [-force](/packer/docs/commands/build#force) option is provided in `build` // command, this option can be omitted and taken as true. AlicloudImageForceDelete bool `mapstructure:"image_force_delete" required:"false"` // If this value is true, when delete the duplicated existing images, the // source snapshots of those images will be delete either. If // [-force](/packer/docs/commands/build#force) option is provided in `build` // command, this option can be omitted and taken as true. AlicloudImageForceDeleteSnapshots bool `mapstructure:"image_force_delete_snapshots" required:"false"` AlicloudImageForceDeleteInstances bool `mapstructure:"image_force_delete_instances"` // If this value is true, the image created will not include any snapshot // of data disks. This option would be useful for any circumstance that // default data disks with instance types are not concerned. The default // value is false. AlicloudImageIgnoreDataDisks bool `mapstructure:"image_ignore_data_disks" required:"false"` // Key/value pair tags applied to the destination image and relevant // snapshots. AlicloudImageTags map[string]string `mapstructure:"tags" required:"false"` // Same as [`tags`](#tags) but defined as a singular repeatable block // containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/packer/docs/templates/hcl_templates/expressions#dynamic-blocks) // will allow you to create those programatically. AlicloudImageTag config.KeyValues `mapstructure:"tag" required:"false"` AlicloudDiskDevices `mapstructure:",squash"` // The image family of the user-defined image, [2, 128] English or Chinese // characters. It must begin with an uppercase/lowercase letter or a // Chinese character, and may contain numbers, `_` or `-`. It cannot begin // with `aliyun`, `acs:`, `http://` or `https://`. AlicloudTargetImageFamily string `mapstructure:"target_image_family" required:"false"` // The boot mode of the user-defined image, it should to be one of 'BIOS', 'UEFI' or 'UEFI-Preferred'. AlicloudBootMode string `mapstructure:"boot_mode" required:"false"` }
func (*AlicloudImageConfig) Prepare ¶
func (c *AlicloudImageConfig) Prepare(ctx *interpolate.Context) []error
type Artifact ¶
type Artifact struct { // A map of regions to alicloud image IDs. AlicloudImages map[string]string // BuilderId is the unique ID for the builder that created this alicloud image BuilderIdValue string // Alcloud connection for performing API stuff. Client *ClientWrapper }
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) ConfigSpec ¶
func (b *Builder) ConfigSpec() hcldec.ObjectSpec
type ClientWrapper ¶
func (*ClientWrapper) EvalCouldRetryResponse ¶
func (c *ClientWrapper) EvalCouldRetryResponse(evalErrors []string, evalErrorType EvalErrorType) func(response responses.AcsResponse, err error) WaitForExpectEvalResult
func (*ClientWrapper) WaitForExpected ¶
func (c *ClientWrapper) WaitForExpected(args *WaitForExpectArgs) (responses.AcsResponse, error)
func (*ClientWrapper) WaitForImageStatus ¶
func (c *ClientWrapper) WaitForImageStatus(regionId string, imageId string, expectedStatus string, timeout time.Duration) (responses.AcsResponse, error)
func (*ClientWrapper) WaitForInstanceStatus ¶
func (c *ClientWrapper) WaitForInstanceStatus(regionId string, instanceId string, expectedStatus string) (responses.AcsResponse, error)
func (*ClientWrapper) WaitForSnapshotStatus ¶
func (c *ClientWrapper) WaitForSnapshotStatus(regionId string, snapshotId string, expectedStatus string, timeout time.Duration) (responses.AcsResponse, error)
type Config ¶
type Config struct { common.PackerConfig `mapstructure:",squash"` AlicloudAccessConfig `mapstructure:",squash"` AlicloudImageConfig `mapstructure:",squash"` RunConfig `mapstructure:",squash"` // contains filtered or unexported fields }
type EvalErrorType ¶
type EvalErrorType bool
type FlatAlicloudDiskDevice ¶
type FlatAlicloudDiskDevice struct { DiskName *string `mapstructure:"disk_name" required:"false" cty:"disk_name" hcl:"disk_name"` DiskCategory *string `mapstructure:"disk_category" required:"false" cty:"disk_category" hcl:"disk_category"` DiskSize *int `mapstructure:"disk_size" required:"false" cty:"disk_size" hcl:"disk_size"` SnapshotId *string `mapstructure:"disk_snapshot_id" required:"false" cty:"disk_snapshot_id" hcl:"disk_snapshot_id"` Description *string `mapstructure:"disk_description" required:"false" cty:"disk_description" hcl:"disk_description"` DeleteWithInstance *bool `mapstructure:"disk_delete_with_instance" required:"false" cty:"disk_delete_with_instance" hcl:"disk_delete_with_instance"` Device *string `mapstructure:"disk_device" required:"false" cty:"disk_device" hcl:"disk_device"` Encrypted *bool `mapstructure:"disk_encrypted" required:"false" cty:"disk_encrypted" hcl:"disk_encrypted"` }
FlatAlicloudDiskDevice is an auto-generated flat version of AlicloudDiskDevice. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatAlicloudDiskDevice) HCL2Spec ¶
func (*FlatAlicloudDiskDevice) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a AlicloudDiskDevice. This spec is used by HCL to read the fields of AlicloudDiskDevice. The decoded values from this spec will then be applied to a FlatAlicloudDiskDevice.
type FlatConfig ¶
type FlatConfig struct { PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"` PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"` PackerCoreVersion *string `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"` PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"` PackerForce *bool `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"` PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"` PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"` PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"` AlicloudAccessKey *string `mapstructure:"access_key" required:"true" cty:"access_key" hcl:"access_key"` AlicloudSecretKey *string `mapstructure:"secret_key" required:"true" cty:"secret_key" hcl:"secret_key"` AlicloudRegion *string `mapstructure:"region" required:"true" cty:"region" hcl:"region"` AlicloudRamRole *string `mapstructure:"ram_role_name" required:"true" cty:"ram_role_name" hcl:"ram_role_name"` AlicloudRamRoleArn *string `mapstructure:"ram_role_arn" required:"true" cty:"ram_role_arn" hcl:"ram_role_arn"` AlicloudRamSessionName *string `mapstructure:"ram_session_name" required:"true" cty:"ram_session_name" hcl:"ram_session_name"` AlicloudSkipValidation *bool `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation" hcl:"skip_region_validation"` AlicloudSkipImageValidation *bool `mapstructure:"skip_image_validation" required:"false" cty:"skip_image_validation" hcl:"skip_image_validation"` AlicloudProfile *string `mapstructure:"profile" required:"false" cty:"profile" hcl:"profile"` SecurityToken *string `mapstructure:"security_token" required:"false" cty:"security_token" hcl:"security_token"` CustomEndpointEcs *string `mapstructure:"custom_endpoint_ecs" required:"false" cty:"custom_endpoint_ecs" hcl:"custom_endpoint_ecs"` AlicloudImageName *string `mapstructure:"image_name" required:"true" cty:"image_name" hcl:"image_name"` AlicloudImageVersion *string `mapstructure:"image_version" required:"false" cty:"image_version" hcl:"image_version"` AlicloudImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description" hcl:"image_description"` AlicloudResourceGroupId *string `mapstructure:"resource_group_id" required:"false" cty:"resource_group_id" hcl:"resource_group_id"` AlicloudImageDestinationRegions []string `mapstructure:"image_copy_regions" required:"false" cty:"image_copy_regions" hcl:"image_copy_regions"` AlicloudImageDestinationNames []string `mapstructure:"image_copy_names" required:"false" cty:"image_copy_names" hcl:"image_copy_names"` ImageEncrypted *bool `mapstructure:"image_encrypted" required:"false" cty:"image_encrypted" hcl:"image_encrypted"` AlicloudImageForceDelete *bool `mapstructure:"image_force_delete" required:"false" cty:"image_force_delete" hcl:"image_force_delete"` AlicloudImageForceDeleteSnapshots *bool `` /* 130-byte string literal not displayed */ AlicloudImageForceDeleteInstances *bool `mapstructure:"image_force_delete_instances" cty:"image_force_delete_instances" hcl:"image_force_delete_instances"` AlicloudImageIgnoreDataDisks *bool `mapstructure:"image_ignore_data_disks" required:"false" cty:"image_ignore_data_disks" hcl:"image_ignore_data_disks"` AlicloudImageTags map[string]string `mapstructure:"tags" required:"false" cty:"tags" hcl:"tags"` AlicloudImageTag []config.FlatKeyValue `mapstructure:"tag" required:"false" cty:"tag" hcl:"tag"` ECSSystemDiskMapping *FlatAlicloudDiskDevice `mapstructure:"system_disk_mapping" required:"false" cty:"system_disk_mapping" hcl:"system_disk_mapping"` ECSImagesDiskMappings []FlatAlicloudDiskDevice `mapstructure:"image_disk_mappings" required:"false" cty:"image_disk_mappings" hcl:"image_disk_mappings"` AlicloudTargetImageFamily *string `mapstructure:"target_image_family" required:"false" cty:"target_image_family" hcl:"target_image_family"` AlicloudBootMode *string `mapstructure:"boot_mode" required:"false" cty:"boot_mode" hcl:"boot_mode"` AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" cty:"associate_public_ip_address" hcl:"associate_public_ip_address"` ZoneId *string `mapstructure:"zone_id" required:"false" cty:"zone_id" hcl:"zone_id"` IOOptimized *bool `mapstructure:"io_optimized" required:"false" cty:"io_optimized" hcl:"io_optimized"` InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type" hcl:"instance_type"` Description *string `mapstructure:"description" cty:"description" hcl:"description"` AlicloudSourceImage *string `mapstructure:"source_image" required:"true" cty:"source_image" hcl:"source_image"` AlicloudImageFamily *string `mapstructure:"image_family" required:"true" cty:"image_family" hcl:"image_family"` ForceStopInstance *bool `mapstructure:"force_stop_instance" required:"false" cty:"force_stop_instance" hcl:"force_stop_instance"` DisableStopInstance *bool `mapstructure:"disable_stop_instance" required:"false" cty:"disable_stop_instance" hcl:"disable_stop_instance"` RamRoleName *string `mapstructure:"ecs_ram_role_name" required:"false" cty:"ecs_ram_role_name" hcl:"ecs_ram_role_name"` RunTags map[string]string `mapstructure:"run_tags" required:"false" cty:"run_tags" hcl:"run_tags"` SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id" hcl:"security_group_id"` SecurityGroupName *string `mapstructure:"security_group_name" required:"false" cty:"security_group_name" hcl:"security_group_name"` SecurityEnhancementStrategy *string `` /* 133-byte string literal not displayed */ UserData *string `mapstructure:"user_data" required:"false" cty:"user_data" hcl:"user_data"` UserDataFile *string `mapstructure:"user_data_file" required:"false" cty:"user_data_file" hcl:"user_data_file"` VpcId *string `mapstructure:"vpc_id" required:"false" cty:"vpc_id" hcl:"vpc_id"` VpcName *string `mapstructure:"vpc_name" required:"false" cty:"vpc_name" hcl:"vpc_name"` CidrBlock *string `mapstructure:"vpc_cidr_block" required:"false" cty:"vpc_cidr_block" hcl:"vpc_cidr_block"` VSwitchId *string `mapstructure:"vswitch_id" required:"false" cty:"vswitch_id" hcl:"vswitch_id"` VSwitchName *string `mapstructure:"vswitch_name" required:"false" cty:"vswitch_name" hcl:"vswitch_name"` EIPId *string `mapstructure:"eip_id" required:"false" cty:"eip_id" hcl:"eip_id"` InstanceName *string `mapstructure:"instance_name" required:"false" cty:"instance_name" hcl:"instance_name"` InternetChargeType *string `mapstructure:"internet_charge_type" required:"false" cty:"internet_charge_type" hcl:"internet_charge_type"` InternetMaxBandwidthOut *int `mapstructure:"internet_max_bandwidth_out" required:"false" cty:"internet_max_bandwidth_out" hcl:"internet_max_bandwidth_out"` WaitSnapshotReadyTimeout *int `` /* 127-byte string literal not displayed */ WaitCopyingImageReadyTimeout *int `` /* 142-byte string literal not displayed */ Type *string `mapstructure:"communicator" cty:"communicator" hcl:"communicator"` PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting" hcl:"pause_before_connecting"` SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host" hcl:"ssh_host"` SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port" hcl:"ssh_port"` SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username" hcl:"ssh_username"` SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password" hcl:"ssh_password"` SSHKeyPairName *string `mapstructure:"ssh_keypair_name" undocumented:"true" cty:"ssh_keypair_name" hcl:"ssh_keypair_name"` SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" undocumented:"true" cty:"temporary_key_pair_name" hcl:"temporary_key_pair_name"` SSHTemporaryKeyPairType *string `mapstructure:"temporary_key_pair_type" cty:"temporary_key_pair_type" hcl:"temporary_key_pair_type"` SSHTemporaryKeyPairBits *int `mapstructure:"temporary_key_pair_bits" cty:"temporary_key_pair_bits" hcl:"temporary_key_pair_bits"` SSHCiphers []string `mapstructure:"ssh_ciphers" cty:"ssh_ciphers" hcl:"ssh_ciphers"` SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys" hcl:"ssh_clear_authorized_keys"` SSHKEXAlgos []string `mapstructure:"ssh_key_exchange_algorithms" cty:"ssh_key_exchange_algorithms" hcl:"ssh_key_exchange_algorithms"` SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" undocumented:"true" cty:"ssh_private_key_file" hcl:"ssh_private_key_file"` SSHCertificateFile *string `mapstructure:"ssh_certificate_file" cty:"ssh_certificate_file" hcl:"ssh_certificate_file"` SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty" hcl:"ssh_pty"` SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout" hcl:"ssh_timeout"` SSHWaitTimeout *string `mapstructure:"ssh_wait_timeout" undocumented:"true" cty:"ssh_wait_timeout" hcl:"ssh_wait_timeout"` SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" undocumented:"true" cty:"ssh_agent_auth" hcl:"ssh_agent_auth"` SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding" hcl:"ssh_disable_agent_forwarding"` SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts" hcl:"ssh_handshake_attempts"` SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host" hcl:"ssh_bastion_host"` SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port" hcl:"ssh_bastion_port"` SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth" hcl:"ssh_bastion_agent_auth"` SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username" hcl:"ssh_bastion_username"` SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password" hcl:"ssh_bastion_password"` SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive" hcl:"ssh_bastion_interactive"` SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file" hcl:"ssh_bastion_private_key_file"` SSHBastionCertificateFile *string `mapstructure:"ssh_bastion_certificate_file" cty:"ssh_bastion_certificate_file" hcl:"ssh_bastion_certificate_file"` SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method" hcl:"ssh_file_transfer_method"` SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host" hcl:"ssh_proxy_host"` SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port" hcl:"ssh_proxy_port"` SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username" hcl:"ssh_proxy_username"` SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password" hcl:"ssh_proxy_password"` SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval" hcl:"ssh_keep_alive_interval"` SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout" hcl:"ssh_read_write_timeout"` SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels" hcl:"ssh_remote_tunnels"` SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels" hcl:"ssh_local_tunnels"` SSHPublicKey []byte `mapstructure:"ssh_public_key" undocumented:"true" cty:"ssh_public_key" hcl:"ssh_public_key"` SSHPrivateKey []byte `mapstructure:"ssh_private_key" undocumented:"true" cty:"ssh_private_key" hcl:"ssh_private_key"` WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username" hcl:"winrm_username"` WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password" hcl:"winrm_password"` WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host" hcl:"winrm_host"` WinRMNoProxy *bool `mapstructure:"winrm_no_proxy" cty:"winrm_no_proxy" hcl:"winrm_no_proxy"` WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port" hcl:"winrm_port"` WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout" hcl:"winrm_timeout"` WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl" hcl:"winrm_use_ssl"` WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure" hcl:"winrm_insecure"` WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm" hcl:"winrm_use_ntlm"` SSHPrivateIp *bool `mapstructure:"ssh_private_ip" required:"false" cty:"ssh_private_ip" hcl:"ssh_private_ip"` SkipCreateImage *bool `mapstructure:"skip_create_image" required:"false" cty:"skip_create_image" hcl:"skip_create_image"` }
FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type InstanceNetWork ¶
type InstanceNetWork string
type RunConfig ¶
type RunConfig struct { AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address"` // ID of the zone to which the disk belongs. ZoneId string `mapstructure:"zone_id" required:"false"` // Whether an ECS instance is I/O optimized or not. If this option is not // provided, the value will be determined by product API according to what // `instance_type` is used. IOOptimized config.Trilean `mapstructure:"io_optimized" required:"false"` // Type of the instance. For values, see [Instance Type // Table](https://www.alibabacloud.com/help/doc-detail/25378.htm?spm=a3c0i.o25499en.a3.9.14a36ac8iYqKRA). // You can also obtain the latest instance type table by invoking the // [Querying Instance Type // Table](https://intl.aliyun.com/help/doc-detail/25620.htm?spm=a3c0i.o25499en.a3.6.Dr1bik) // interface. InstanceType string `mapstructure:"instance_type" required:"true"` Description string `mapstructure:"description"` // This is the base image id which you want to // create your customized images. AlicloudSourceImage string `mapstructure:"source_image" required:"true"` // The name of the image family. Customer can set this parameter to choose the latest available custom image from // the specified image family to create the instance. AlicloudImageFamily string `mapstructure:"image_family" required:"true"` // Whether to force shutdown upon device // restart. The default value is `false`. // // If it is set to `false`, the system is shut down normally; if it is set to // `true`, the system is forced to shut down. ForceStopInstance bool `mapstructure:"force_stop_instance" required:"false"` // If this option is set to true, Packer // will not stop the instance for you, and you need to make sure the instance // will be stopped in the final provisioner command. Otherwise, Packer will // timeout while waiting the instance to be stopped. This option is provided // for some specific scenarios that you want to stop the instance by yourself. // E.g., Sysprep a windows which may shutdown the instance within its command. // The default value is false. DisableStopInstance bool `mapstructure:"disable_stop_instance" required:"false"` // Ram Role to apply when launching the instance. RamRoleName string `mapstructure:"ecs_ram_role_name" required:"false"` // Key/value pair tags to apply to the instance that is *launched* // to create the image. RunTags map[string]string `mapstructure:"run_tags" required:"false"` // ID of the security group to which a newly // created instance belongs. Mutual access is allowed between instances in one // security group. If not specified, the newly created instance will be added // to the default security group. If the default group doesn’t exist, or the // number of instances in it has reached the maximum limit, a new security // group will be created automatically. SecurityGroupId string `mapstructure:"security_group_id" required:"false"` // The security group name. The default value // is blank. [2, 128] English or Chinese characters, must begin with an // uppercase/lowercase letter or Chinese character. Can contain numbers, ., // _ or -. It cannot begin with `http://` or `https://`. SecurityGroupName string `mapstructure:"security_group_name" required:"false"` // Specifies whether to enable security hardening. Valid values: // Active: enables security hardening. This value is applicable only to public images. // Deactive: does not enable security hardening. This value is applicable to all image types. SecurityEnhancementStrategy string `mapstructure:"security_enhancement_strategy" required:"false"` // User data to apply when launching the instance. Note // that you need to be careful about escaping characters due to the templates // being JSON. It is often more convenient to use user_data_file, instead. // 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 instance. UserDataFile string `mapstructure:"user_data_file" required:"false"` // VPC ID allocated by the system. VpcId string `mapstructure:"vpc_id" required:"false"` // The VPC name. The default value is blank. [2, 128] // English or Chinese characters, must begin with an uppercase/lowercase // letter or Chinese character. Can contain numbers, _ and -. The disk // description will appear on the console. Cannot begin with `http://` or // `https://`. VpcName string `mapstructure:"vpc_name" required:"false"` // Value options: 192.168.0.0/16 and // 172.16.0.0/16. When not specified, the default value is 172.16.0.0/16. CidrBlock string `mapstructure:"vpc_cidr_block" required:"false"` // The ID of the VSwitch to be used. VSwitchId string `mapstructure:"vswitch_id" required:"false"` // The ID of the VSwitch to be used. VSwitchName string `mapstructure:"vswitch_name" required:"false"` //The ID of the EIP to be used as public ip for the instance EIPId string `mapstructure:"eip_id" required:"false"` // Display name of the instance, which is a string of 2 to 128 Chinese or // English characters. It must begin with an uppercase/lowercase letter or // a Chinese character and can contain numerals, `.`, `_`, or `-`. The // instance name is displayed on the Alibaba Cloud console. If this // parameter is not specified, the default value is InstanceId of the // instance. It cannot begin with `http://` or `https://`. InstanceName string `mapstructure:"instance_name" required:"false"` // Internet charge type, which can be // `PayByTraffic` or `PayByBandwidth`. Optional values: // - `PayByBandwidth` // - `PayByTraffic` // // If this parameter is not specified, the default value is `PayByBandwidth`. // For the regions out of China, currently only support `PayByTraffic`, you // must set it manfully. InternetChargeType string `mapstructure:"internet_charge_type" required:"false"` // Maximum outgoing bandwidth to the // public network, measured in Mbps (Mega bits per second). // // Value range: // - `PayByBandwidth`: \[0, 100\]. If this parameter is not specified, API // automatically sets it to 0 Mbps. // - `PayByTraffic`: \[1, 100\]. If this parameter is not specified, an // error is returned. InternetMaxBandwidthOut int `mapstructure:"internet_max_bandwidth_out" required:"false"` // Timeout of creating snapshot(s). // The default timeout is 3600 seconds if this option is not set or is set // to 0. For those disks containing lots of data, it may require a higher // timeout value. WaitSnapshotReadyTimeout int `mapstructure:"wait_snapshot_ready_timeout" required:"false"` // Timeout of copying image. // The default timeout is 3600 seconds if this option is not set or is set // to 0. WaitCopyingImageReadyTimeout int `mapstructure:"wait_copying_image_ready_timeout" required:"false"` // Communicator settings Comm communicator.Config `mapstructure:",squash"` // If this value is true, packer will connect to // the ECS created through private ip instead of allocating a public ip or an // EIP. The default value is false. SSHPrivateIp bool `mapstructure:"ssh_private_ip" required:"false"` //If true, Packer will not create a final image. Defaults to `false`. SkipCreateImage bool `mapstructure:"skip_create_image" required:"false"` }
type WaitForExpectArgs ¶
type WaitForExpectArgs struct { RequestFunc func() (responses.AcsResponse, error) EvalFunc func(response responses.AcsResponse, err error) WaitForExpectEvalResult RetryInterval time.Duration RetryTimes int RetryTimeout time.Duration }
type WaitForExpectEvalResult ¶
type WaitForExpectEvalResult struct {
// contains filtered or unexported fields
}
Source Files ¶
- access_config.go
- artifact.go
- builder.go
- builder.hcl2spec.go
- client.go
- image_config.go
- packer_helper.go
- run_config.go
- ssh_helper.go
- step_attach_keypair.go
- step_check_image_family.go
- step_check_source_image.go
- step_config_eip.go
- step_config_key_pair.go
- step_config_public_ip.go
- step_config_security_group.go
- step_config_vpc.go
- step_config_vswitch.go
- step_create_image.go
- step_create_instance.go
- step_create_snapshot.go
- step_create_tags.go
- step_delete_images_snapshots.go
- step_pre_validate.go
- step_region_copy_image.go
- step_run_instance.go
- step_share_image.go
- step_stop_instance.go