cvm

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MPL-2.0 Imports: 34 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PACKER_SECRET_ID                    = "TENCENTCLOUD_SECRET_ID"
	PACKER_SECRET_KEY                   = "TENCENTCLOUD_SECRET_KEY"
	PACKER_SECURITY_TOKEN               = "TENCENTCLOUD_SECURITY_TOKEN"
	PACKER_REGION                       = "TENCENTCLOUD_REGION"
	PACKER_ASSUME_ROLE_ARN              = "TENCENTCLOUD_ASSUME_ROLE_ARN"
	PACKER_ASSUME_ROLE_SESSION_NAME     = "TENCENTCLOUD_ASSUME_ROLE_SESSION_NAME"
	PACKER_ASSUME_ROLE_SESSION_DURATION = "TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION"
	PACKER_PROFILE                      = "TENCENTCLOUD_PROFILE"
	PACKER_SHARED_CREDENTIALS_DIR       = "TENCENTCLOUD_SHARED_CREDENTIALS_DIR"
	DEFAULT_PROFILE                     = "default"
)
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")
	Jakarta       = Region("ap-jakarta")
	Mumbai        = Region("ap-mumbai")
	Seoul         = Region("ap-seoul")
	Shanghai      = Region("ap-shanghai")
	Nanjing       = Region("ap-nanjing")
	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")
	SaoPaulo      = Region("sa-saopaulo")
)

below would be moved to tencentcloud sdk git repo

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

DefaultWaitForInterval is sleep interval when wait statue

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

CheckResourceIdFormat check resource id format

func Error

func Error(state multistep.StateBag, err error, prefix string)

Error print error message

func GetImageByName

func GetImageByName(ctx context.Context, client *cvm.Client, imageName string) (*cvm.Image, error)

GetImageByName get image by image name

func Halt

func Halt(state multistep.StateBag, err error, prefix string) multistep.StepAction

Halt print error message and exit

func IntUint64 added in v1.2.0

func IntUint64(i int) *uint64

func Message

func Message(state multistep.StateBag, message, prefix string)

Message print a message

func NewCvmClient

func NewCvmClient(cf *TencentCloudAccessConfig) (client *cvm.Client, err error)

NewCvmClient returns a new cvm client

func NewVpcClient

func NewVpcClient(cf *TencentCloudAccessConfig) (client *vpc.Client, err error)

NewVpcClient returns a new vpc client

func Retry

func Retry(ctx context.Context, fn func(context.Context) error) error

Retry do retry on api request

func SSHHost

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

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

func Say

func Say(state multistep.StateBag, message, prefix string)

Say tell you a message

func SayClean

func SayClean(state multistep.StateBag, module string)

SayClean tell you clean module message

func WaitForImageReady

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

WaitForImageReady wait for image reaches statue

func WaitForInstance

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

WaitForInstance wait for instance reaches statue

Types

type Artifact

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

	// StateData should store data such as GeneratedData
	// to be shared with post-processors
	StateData map[string]interface{}
}

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

func (b *Builder) ConfigSpec() hcldec.ObjectSpec

func (*Builder) Prepare

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

func (*Builder) Run

type Config

type Config struct {
	common.PackerConfig      `mapstructure:",squash"`
	TencentCloudAccessConfig `mapstructure:",squash"`
	TencentCloudImageConfig  `mapstructure:",squash"`
	TencentCloudRunConfig    `mapstructure:",squash"`

	// Do not check region and zone when validate.
	SkipRegionValidation bool `mapstructure:"skip_region_validation" required:"false"`
	// contains filtered or unexported fields
}

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 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"`
	SecretId                  *string                     `mapstructure:"secret_id" required:"true" cty:"secret_id" hcl:"secret_id"`
	SecretKey                 *string                     `mapstructure:"secret_key" required:"true" cty:"secret_key" hcl:"secret_key"`
	Region                    *string                     `mapstructure:"region" required:"true" cty:"region" hcl:"region"`
	Zone                      *string                     `mapstructure:"zone" required:"true" cty:"zone" hcl:"zone"`
	CvmEndpoint               *string                     `mapstructure:"cvm_endpoint" required:"false" cty:"cvm_endpoint" hcl:"cvm_endpoint"`
	VpcEndpoint               *string                     `mapstructure:"vpc_endpoint" required:"false" cty:"vpc_endpoint" hcl:"vpc_endpoint"`
	SecurityToken             *string                     `mapstructure:"security_token" required:"false" cty:"security_token" hcl:"security_token"`
	AssumeRole                *FlatTencentCloudAccessRole `mapstructure:"assume_role" required:"false" cty:"assume_role" hcl:"assume_role"`
	Profile                   *string                     `mapstructure:"profile" required:"false" cty:"profile" hcl:"profile"`
	SharedCredentialsDir      *string                     `mapstructure:"shared_credentials_dir" required:"false" cty:"shared_credentials_dir" hcl:"shared_credentials_dir"`
	ImageName                 *string                     `mapstructure:"image_name" required:"true" cty:"image_name" hcl:"image_name"`
	ImageDescription          *string                     `mapstructure:"image_description" required:"false" cty:"image_description" hcl:"image_description"`
	ForcePoweroff             *bool                       `mapstructure:"force_poweroff" required:"false" cty:"force_poweroff" hcl:"force_poweroff"`
	Sysprep                   *bool                       `mapstructure:"sysprep" required:"false" cty:"sysprep" hcl:"sysprep"`
	ImageCopyRegions          []string                    `mapstructure:"image_copy_regions" required:"false" cty:"image_copy_regions" hcl:"image_copy_regions"`
	ImageShareAccounts        []string                    `mapstructure:"image_share_accounts" required:"false" cty:"image_share_accounts" hcl:"image_share_accounts"`
	ImageTags                 map[string]string           `mapstructure:"image_tags" required:"false" cty:"image_tags" hcl:"image_tags"`
	AssociatePublicIpAddress  *bool                       `` /* 127-byte string literal not displayed */
	SourceImageId             *string                     `mapstructure:"source_image_id" required:"false" cty:"source_image_id" hcl:"source_image_id"`
	SourceImageName           *string                     `mapstructure:"source_image_name" required:"false" cty:"source_image_name" hcl:"source_image_name"`
	InstanceChargeType        *string                     `mapstructure:"instance_charge_type" required:"false" cty:"instance_charge_type" hcl:"instance_charge_type"`
	InstanceType              *string                     `mapstructure:"instance_type" required:"true" cty:"instance_type" hcl:"instance_type"`
	InstanceName              *string                     `mapstructure:"instance_name" required:"false" cty:"instance_name" hcl:"instance_name"`
	DiskType                  *string                     `mapstructure:"disk_type" required:"false" cty:"disk_type" hcl:"disk_type"`
	DiskSize                  *int64                      `mapstructure:"disk_size" required:"false" cty:"disk_size" hcl:"disk_size"`
	DataDisks                 []FlattencentCloudDataDisk  `mapstructure:"data_disks" cty:"data_disks" hcl:"data_disks"`
	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"`
	SubnetId                  *string                     `mapstructure:"subnet_id" required:"false" cty:"subnet_id" hcl:"subnet_id"`
	SubnetName                *string                     `mapstructure:"subnet_name" required:"false" cty:"subnet_name" hcl:"subnet_name"`
	CidrBlock                 *string                     `mapstructure:"cidr_block" required:"false" cty:"cidr_block" hcl:"cidr_block"`
	SubnectCidrBlock          *string                     `mapstructure:"subnect_cidr_block" required:"false" cty:"subnect_cidr_block" hcl:"subnect_cidr_block"`
	InternetChargeType        *string                     `mapstructure:"internet_charge_type" required:"false" cty:"internet_charge_type" hcl:"internet_charge_type"`
	InternetMaxBandwidthOut   *int64                      `mapstructure:"internet_max_bandwidth_out" required:"false" cty:"internet_max_bandwidth_out" hcl:"internet_max_bandwidth_out"`
	BandwidthPackageId        *string                     `mapstructure:"bandwidth_package_id" required:"false" cty:"bandwidth_package_id" hcl:"bandwidth_package_id"`
	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"`
	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"`
	HostName                  *string                     `mapstructure:"host_name" required:"false" cty:"host_name" hcl:"host_name"`
	CamRoleName               *string                     `mapstructure:"cam_role_name" required:"false" cty:"cam_role_name" hcl:"cam_role_name"`
	RunTags                   map[string]string           `mapstructure:"run_tags" required:"false" cty:"run_tags" hcl:"run_tags"`
	RunTag                    []config.FlatKeyValue       `mapstructure:"run_tag" required:"false" cty:"run_tag" hcl:"run_tag"`
	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" cty:"ssh_private_ip" hcl:"ssh_private_ip"`
	SkipRegionValidation      *bool                       `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation" hcl:"skip_region_validation"`
}

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 FlatTencentCloudAccessRole added in v1.2.0

type FlatTencentCloudAccessRole struct {
	RoleArn         *string `mapstructure:"role_arn" required:"false" cty:"role_arn" hcl:"role_arn"`
	SessionName     *string `mapstructure:"session_name" required:"false" cty:"session_name" hcl:"session_name"`
	SessionDuration *int    `mapstructure:"session_duration" required:"false" cty:"session_duration" hcl:"session_duration"`
}

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

func (*FlatTencentCloudAccessRole) HCL2Spec added in v1.2.0

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

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

type FlattencentCloudDataDisk

type FlattencentCloudDataDisk struct {
	DiskType   *string `mapstructure:"disk_type" cty:"disk_type" hcl:"disk_type"`
	DiskSize   *int64  `mapstructure:"disk_size" cty:"disk_size" hcl:"disk_size"`
	SnapshotId *string `mapstructure:"disk_snapshot_id" cty:"disk_snapshot_id" hcl:"disk_snapshot_id"`
}

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

func (*FlattencentCloudDataDisk) HCL2Spec

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

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

type Region

type Region string

type TencentCloudAccessConfig

type TencentCloudAccessConfig struct {
	// Tencentcloud secret id. You should set it directly,
	// or set the `TENCENTCLOUD_SECRET_ID` 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](https://intl.cloud.tencent.com/document/product/213/6091)
	// for parameter taking.
	Region string `mapstructure:"region" required:"true"`
	// The zone where your cvm will be launch. You should
	// reference [Region and Zone](https://intl.cloud.tencent.com/document/product/213/6091)
	// for parameter taking.
	Zone string `mapstructure:"zone" required:"true"`
	// The endpoint you want to reach the cloud endpoint,
	// if tce cloud you should set a tce cvm endpoint.
	CvmEndpoint string `mapstructure:"cvm_endpoint" required:"false"`
	// The endpoint you want to reach the cloud endpoint,
	// if tce cloud you should set a tce vpc endpoint.
	VpcEndpoint string `mapstructure:"vpc_endpoint" required:"false"`

	// STS access token, can be set through template or by exporting
	// as environment variable such as `export TENCENTCLOUD_SECURITY_TOKEN=value`.
	SecurityToken string `mapstructure:"security_token" required:"false"`
	// The `assume_role` block.
	// If provided, packer will attempt to assume this role using the supplied credentials.
	// - `role_arn` (string) - The ARN of the role to assume.
	//   It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_ARN`.
	// - `session_name` (string) - The session name to use when making the AssumeRole call.
	//   It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SESSION_NAME`.
	// - `session_duration` (int) - The duration of the session when making the AssumeRole call.
	//   Its value ranges from 0 to 43200(seconds), and default is 7200 seconds.
	//   It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION`.
	AssumeRole TencentCloudAccessRole `mapstructure:"assume_role" required:"false"`
	// The profile name as set in the shared credentials.
	// It can also be sourced from the `TENCENTCLOUD_PROFILE` environment variable.
	// If not set, the default profile created with `tccli configure` will be used.
	// If not set this defaults to `default`.
	Profile string `mapstructure:"profile" required:"false"`
	// The directory of the shared credentials.
	// It can also be sourced from the `TENCENTCLOUD_SHARED_CREDENTIALS_DIR` environment variable.
	// If not set this defaults to `~/.tccli`.
	SharedCredentialsDir string `mapstructure:"shared_credentials_dir" required:"false"`
	// contains filtered or unexported fields
}

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 TencentCloudAccessRole added in v1.2.0

type TencentCloudAccessRole struct {
	// The ARN of the role to assume.
	// It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_ARN`.
	RoleArn string `mapstructure:"role_arn" required:"false"`
	// The session name to use when making the AssumeRole call.
	// It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SESSION_NAME`.
	SessionName string `mapstructure:"session_name" required:"false"`
	// The duration of the session when making the AssumeRole call.
	// Its value ranges from 0 to 43200(seconds), and default is 7200 seconds.
	// It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION`.
	SessionDuration int `mapstructure:"session_duration" required:"false"`
}

func (*TencentCloudAccessRole) FlatMapstructure added in v1.2.0

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

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

type TencentCloudClient added in v1.2.0

type TencentCloudClient struct {
	Credential    *common.Credential
	ClientProfile *profile.ClientProfile

	Region string
	// contains filtered or unexported fields
}

func (*TencentCloudClient) UseCvmClient added in v1.2.0

func (me *TencentCloudClient) UseCvmClient(cpf *profile.ClientProfile) *cvm.Client

func (*TencentCloudClient) UseStsClient added in v1.2.0

func (me *TencentCloudClient) UseStsClient() *sts.Client

func (*TencentCloudClient) UseVpcClient added in v1.2.0

func (me *TencentCloudClient) UseVpcClient(cpf *profile.ClientProfile) *vpc.Client

type TencentCloudImageConfig

type TencentCloudImageConfig struct {
	// The name you want to create your customize image,
	// it should be composed of no more than 60 characters, of letters, numbers
	// or minus sign.
	ImageName string `mapstructure:"image_name" required:"true"`
	// Image description. It should no more than 60 characters.
	ImageDescription string `mapstructure:"image_description" required:"false"`
	// Indicates whether to perform a forced shutdown to
	// create an image when soft shutdown fails. Default value is `false`.
	ForcePoweroff bool `mapstructure:"force_poweroff" required:"false"`
	// Whether enable Sysprep during creating windows image.
	Sysprep bool `mapstructure:"sysprep" required:"false"`
	// 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"`
	// Key/value pair tags that will be applied to the resulting image.
	ImageTags map[string]string `mapstructure:"image_tags" required:"false"`
	// contains filtered or unexported fields
}

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:"false"`
	// The base image name of Image you want to create your
	// customized image from.Conflict with SourceImageId.
	SourceImageName string `mapstructure:"source_image_name" required:"false"`
	// Charge type of cvm, values can be `POSTPAID_BY_HOUR` (default) `SPOTPAID`
	InstanceChargeType string `mapstructure:"instance_charge_type" required:"false"`
	// The instance type your cvm will be launched by.
	// You should reference [Instance Type](https://intl.cloud.tencent.com/document/product/213/11518)
	// 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, default is `CLOUD_PREMIUM`. you could
	// reference [Disk Type](https://intl.cloud.tencent.com/document/product/213/15753#SystemDisk)
	// for parameter taking.
	DiskType string `mapstructure:"disk_type" required:"false"`
	// Root disk size your cvm will be launched by. values range(in GB):
	// - LOCAL_BASIC: 50
	// - Other: 50 ~ 1000 (need whitelist if > 50)
	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"`
	// 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"`
	// Internet charge type of cvm, values can be TRAFFIC_POSTPAID_BY_HOUR, BANDWIDTH_POSTPAID_BY_HOUR, BANDWIDTH_PACKAGE
	InternetChargeType string `mapstructure:"internet_charge_type" required:"false"`
	// 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"`
	// When internet_charge_type is BANDWIDTH_PACKAGE, bandwidth_package_id is required
	BandwidthPackageId string `mapstructure:"bandwidth_package_id" required:"false"`
	// Specify securitygroup 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"`
	// CAM role name.
	CamRoleName string `mapstructure:"cam_role_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"`
	// Same as [`run_tags`](#run_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.
	RunTag config.KeyValues `mapstructure:"run_tag" 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