cvm

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: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Bangkok       = Region("ap-bangkok")
	Beijing       = Region("ap-beijing")
	Chengdu       = Region("ap-chengdu")
	Chongqing     = Region("ap-chongqing")
	Guangzhou     = Region("ap-guangzhou")
	GuangzhouOpen = Region("ap-guangzhou-open")
	Hongkong      = Region("ap-hongkong")
	Mumbai        = Region("ap-mumbai")
	Seoul         = Region("ap-seoul")
	Shanghai      = Region("ap-shanghai")
	ShanghaiFsi   = Region("ap-shanghai-fsi")
	ShenzhenFsi   = Region("ap-shenzhen-fsi")
	Singapore     = Region("ap-singapore")
	Tokyo         = Region("ap-tokyo")
	Frankfurt     = Region("eu-frankfurt")
	Moscow        = Region("eu-moscow")
	Ashburn       = Region("na-ashburn")
	Siliconvalley = Region("na-siliconvalley")
	Toronto       = Region("na-toronto")
)

below would be moved to tencentcloud sdk git repo

View Source
const BuilderId = "tencent.cloud"
View Source
const DefaultWaitForInterval = 5

Variables

View Source
var ValidCBSType = []string{
	"LOCAL_BASIC", "LOCAL_SSD", "CLOUD_BASIC", "CLOUD_SSD", "CLOUD_PREMIUM",
}

Functions

func CheckResourceIdFormat

func CheckResourceIdFormat(resource string, id string) bool

func MessageClean

func MessageClean(state multistep.StateBag, module string)

func SSHHost

func SSHHost(pubilcIp bool) func(multistep.StateBag) (string, error)

SSHHost returns a function that can be given to the SSH communicator

func WaitForImageReady

func WaitForImageReady(client *cvm.Client, imageName string, status string, timeout int) error

func WaitForInstance

func WaitForInstance(client *cvm.Client, instanceId string, status string, timeout int) error

Types

type Artifact

type Artifact struct {
	TencentCloudImages map[string]string
	BuilderIdValue     string
	Client             *cvm.Client
}

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 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

type Config struct {
	common.PackerConfig      `mapstructure:",squash"`
	TencentCloudAccessConfig `mapstructure:",squash"`
	TencentCloudImageConfig  `mapstructure:",squash"`
	TencentCloudRunConfig    `mapstructure:",squash"`
	// contains filtered or unexported fields
}

type Region

type Region string

type TencentCloudAccessConfig

type TencentCloudAccessConfig struct {
	// Tencentcloud secret id. You should set it directly,
	// or set the TENCENTCLOUD_ACCESS_KEY environment variable.
	SecretId string `mapstructure:"secret_id" required:"true"`
	// Tencentcloud secret key. You should set it directly,
	// or set the TENCENTCLOUD_SECRET_KEY environment variable.
	SecretKey string `mapstructure:"secret_key" required:"true"`
	// The region where your cvm will be launch. You should
	// reference Region and Zone
	//  for parameter taking.
	Region string `mapstructure:"region" required:"true"`
	// The zone where your cvm will be launch. You should
	// reference Region and Zone
	//  for parameter taking.
	Zone string `mapstructure:"zone" required:"true"`
	// Do not check region and zone when validate.
	SkipValidation bool `mapstructure:"skip_region_validation" required:"false"`
}

func (*TencentCloudAccessConfig) Client

func (cf *TencentCloudAccessConfig) Client() (*cvm.Client, *vpc.Client, error)

func (*TencentCloudAccessConfig) Config

func (cf *TencentCloudAccessConfig) Config() error

func (*TencentCloudAccessConfig) Prepare

func (cf *TencentCloudAccessConfig) Prepare(ctx *interpolate.Context) []error

type TencentCloudImageConfig

type TencentCloudImageConfig struct {
	// The name you want to create your customize image,
	// it should be composed of no more than 20 characters, of letters, numbers
	// or minus sign.
	ImageName string `mapstructure:"image_name" required:"true"`
	// Image description.
	ImageDescription string `mapstructure:"image_description" required:"false"`
	// Whether shutdown cvm to create Image. Default value is
	// false.
	Reboot bool `mapstructure:"reboot" required:"false"`
	// Whether to force power off cvm when create image.
	// Default value is false.
	ForcePoweroff bool `mapstructure:"force_poweroff" required:"false"`
	// Whether enable Sysprep during creating windows image.
	Sysprep          bool `mapstructure:"sysprep" required:"false"`
	ImageForceDelete bool `mapstructure:"image_force_delete"`
	// regions that will be copied to after
	// your image created.
	ImageCopyRegions []string `mapstructure:"image_copy_regions" required:"false"`
	// accounts that will be shared to
	// after your image created.
	ImageShareAccounts []string `mapstructure:"image_share_accounts" required:"false"`
	// Do not check region and zone when validate.
	SkipValidation bool `mapstructure:"skip_region_validation" required:"false"`
}

func (*TencentCloudImageConfig) Prepare

func (cf *TencentCloudImageConfig) Prepare(ctx *interpolate.Context) []error

type TencentCloudRunConfig

type TencentCloudRunConfig struct {
	// Whether allocate public ip to your cvm.
	// Default value is false.
	AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address" required:"false"`
	// The base image id of Image you want to create
	// your customized image from.
	SourceImageId string `mapstructure:"source_image_id" required:"true"`
	// The instance type your cvm will be launched by.
	// You should reference Instace Type
	//  for parameter taking.
	InstanceType string `mapstructure:"instance_type" required:"true"`
	// Instance name.
	InstanceName string `mapstructure:"instance_name" required:"false"`
	// Root disk type your cvm will be launched by. you could
	// reference Disk Type
	// for parameter taking.
	DiskType string `mapstructure:"disk_type" required:"false"`
	// Root disk size your cvm will be launched by. values range(in GB):
	DiskSize int64 `mapstructure:"disk_size" required:"false"`
	// Add one or more data disks to the instance before creating the image.
	// Note that if the source image has data disk snapshots, this argument
	// will be ignored, and the running instance will use source image data
	// disk settings, in such case, `disk_type` argument will be used as disk
	// type for all data disks, and each data disk size will use the origin
	// value in source image.
	// The data disks allow for the following argument:
	// -  `disk_type` - Type of the data disk. Valid choices: `CLOUD_BASIC`, `CLOUD_PREMIUM` and `CLOUD_SSD`.
	// -  `disk_size` - Size of the data disk.
	// -  `disk_snapshot_id` - Id of the snapshot for a data disk.
	DataDisks []tencentCloudDataDisk `mapstructure:"data_disks"`
	// Specify vpc your cvm will be launched by.
	VpcId string `mapstructure:"vpc_id" required:"false"`
	// Specify vpc name you will create. if vpc_id is not set, packer will
	// create a vpc for you named this parameter.
	VpcName string `mapstructure:"vpc_name" required:"false"`
	VpcIp   string `mapstructure:"vpc_ip"`
	// Specify subnet your cvm will be launched by.
	SubnetId string `mapstructure:"subnet_id" required:"false"`
	// Specify subnet name you will create. if subnet_id is not set, packer will
	// create a subnet for you named this parameter.
	SubnetName string `mapstructure:"subnet_name" required:"false"`
	// Specify cider block of the vpc you will create if vpc_id not set
	CidrBlock string `mapstructure:"cidr_block" required:"false"` // 10.0.0.0/16(default), 172.16.0.0/12, 192.168.0.0/16
	// Specify cider block of the subnet you will create if
	// subnet_id not set
	SubnectCidrBlock   string `mapstructure:"subnect_cidr_block" required:"false"`
	InternetChargeType string `mapstructure:"internet_charge_type"`
	// Max bandwidth out your cvm will be launched by(in MB).
	// values can be set between 1 ~ 100.
	InternetMaxBandwidthOut int64 `mapstructure:"internet_max_bandwidth_out" required:"false"`
	// Specify security group your cvm will be launched by.
	SecurityGroupId string `mapstructure:"security_group_id" required:"false"`
	// Specify security name you will create if security_group_id not set.
	SecurityGroupName string `mapstructure:"security_group_name" required:"false"`
	// userdata.
	UserData string `mapstructure:"user_data" required:"false"`
	// userdata file.
	UserDataFile string `mapstructure:"user_data_file" required:"false"`
	// host name.
	HostName string `mapstructure:"host_name" required:"false"`
	// Tags to apply to the instance that is *launched* to create the image.
	// These tags are *not* applied to the resulting image.
	RunTags map[string]string `mapstructure:"run_tags" required:"false"`

	// Communicator settings
	Comm         communicator.Config `mapstructure:",squash"`
	SSHPrivateIp bool                `mapstructure:"ssh_private_ip"`
}

func (*TencentCloudRunConfig) Prepare

func (cf *TencentCloudRunConfig) Prepare(ctx *interpolate.Context) []error

Jump to

Keyboard shortcuts

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