Documentation
¶
Index ¶
- Constants
- Variables
- func GetCidrHostNum(maskLen int) uint
- func GetCidrIpMask(maskLen int) string
- func GetCidrIpRange(cidr string) (string, string, string)
- func GetIpSeg3Range(ipSegs []string, maskLen int) (int, int)
- func GetIpSeg4Range(ipSegs []string, maskLen int) (int, int)
- func GetIpSegRange(userSegIp, offset uint8) (int, int)
- func GetSdkValue(stateBag multistep.StateBag, keyPattern string, obj interface{}) interface{}
- func Halt(stateBag multistep.StateBag, err error, prefix string) multistep.StepAction
- func IsUuid(v string) bool
- func SSHHost(c communicator.Config) func(multistep.StateBag) (string, error)
- func StringInSlice(v string, valid []string, ignoreCase bool) bool
- type AccessConfig
- type AfterStepRun
- type Artifact
- type ClientConfig
- type ClientWrapper
- func (c *ClientWrapper) WaitResource(param *WaitResourceParam) (*map[string]interface{}, error)
- func (c *ClientWrapper) WaitSecurityGroupClean(stateBag multistep.StateBag, securityGroupId string) (*map[string]interface{}, error)
- func (c *ClientWrapper) WaitSubnetClean(stateBag multistep.StateBag, subnetId string) (*map[string]interface{}, error)
- type CommonConfig
- type FlatKmiFilterOptions
- type KmiFilterOptions
- type Ks3Image
- type Ks3Images
- type ProcessRequestResult
- type StepCleanupKsyunTempKeys
- type StepConfigKsyunCommon
- type StepConfigKsyunKeyPair
- type StepConfigKsyunPublicIp
- type StepConfigKsyunSecurityGroup
- type StepConfigKsyunSubnet
- type StepConfigKsyunVpc
- type StepCreateKsyunTags
- type Tag
- type TagMap
- type Tags
- type WaitResourceParam
Constants ¶
View Source
const ( ResourceTypeKec = "instance" ResourceTypeEip = "eip" ResourceTypeImage = "image" ResourceTypeBareHost = "epc-host" ResourceTypeBareImage = "epc-image" )
Variables ¶
View Source
var ( RequestResourceSuccess = ProcessRequestResult{ Complete: true, StopRetry: true, } RequestResourceRetry = ProcessRequestResult{ Complete: false, StopRetry: false, } )
View Source
var ResourceTypeList = []string{ResourceTypeImage, ResourceTypeKec, ResourceTypeEip}
Functions ¶
func GetCidrHostNum ¶
func GetCidrIpMask ¶
func GetIpSegRange ¶
func GetSdkValue ¶
Types ¶
type AccessConfig ¶
type AccessConfig struct {
// Ksyun access key must be provided unless `profile` is set, but it can
// also be sourced from the `KSYUN_ACCESS_KEY` environment variable.
KsyunAccessKey string `mapstructure:"access_key" required:"true"`
// Ksyun secret key must be provided unless `profile` is set, but it can
// also be sourced from the `KSYUN_SECRET_KEY` environment variable.
KsyunSecretKey string `mapstructure:"secret_key" required:"true"`
// Ksyun region must be provided unless `profile` is set, but it can
// also be sourced from the `KSYUN_REGION` environment variable.
KsyunRegion string `mapstructure:"region" required:"true"`
}
func (*AccessConfig) Config ¶
func (c *AccessConfig) Config() error
func (*AccessConfig) Prepare ¶
func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error
type AfterStepRun ¶ added in v0.0.10
type AfterStepRun func()
type Artifact ¶ added in v0.0.10
type ClientConfig ¶
type ClientConfig struct {
AccessConfig `mapstructure:",squash"`
// contains filtered or unexported fields
}
func (*ClientConfig) Client ¶
func (c *ClientConfig) Client(stateBag *multistep.BasicStateBag) *ClientWrapper
type ClientWrapper ¶
type ClientWrapper struct {
SksClient *sks.Sks
EipClient *eip.Eip
VpcClient *vpc.Vpc
TagsClient *tagv2.Tagv2
}
func (*ClientWrapper) WaitResource ¶
func (c *ClientWrapper) WaitResource(param *WaitResourceParam) (*map[string]interface{}, error)
func (*ClientWrapper) WaitSecurityGroupClean ¶
func (*ClientWrapper) WaitSubnetClean ¶
type CommonConfig ¶
type CommonConfig struct {
// VPC ID allocated by the system.
VpcId string `mapstructure:"vpc_id" required:"false"`
// the default value is packer_vpc
VpcName string `mapstructure:"vpc_name" required:"false"`
// 172.16.0.0/16. When not specified, the default value is 172.16.0.0/16.
VpcCidrBlock string `mapstructure:"vpc_cidr_block" required:"false"`
// The ID of the Subnet to be used.
SubnetId string `mapstructure:"subnet_id" required:"false"`
// the default value is packer_subnet
SubnetName string `mapstructure:"subnet_name" required:"false"`
// 172.16.0.0/24. When not specified, the default value is 172.16.0.0/24.
DNS1 string `mapstructure:"dns1" required:"false"`
DNS2 string `mapstructure:"dns2" required:"false"`
SubnetCidrBlock string `mapstructure:"subnet_cidr_block" required:"false"`
// availability_zone
AvailabilityZone string `mapstructure:"availability_zone" 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://`.
// the default value is packer_security_group
SecurityGroupName string `mapstructure:"security_group_name" required:"false"`
// Private IP address, which specifies any valid value within the range of subnet IP address and represents
// the primary IP address of the instance. Only one can be selected and bound to the primary network card.
// If this parameter is not specified, the system will automatically select one from the valid address pool at random
// Valid values: standard IP address format
PrivateIpAddress string `mapstructure:"private_ip_address" required:"false"`
// Indicating associate whether public ip for creating kec instance
// Default `false`
AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address" required:"false"`
// PublicIp charge type, which can be
// Daily TrafficMonthly DailyPaidByTransfer HourlyInstantSettlement
// Default is Daily
PublicIpChargeType string `mapstructure:"public_ip_charge_type" required:"false"`
// [1-100]
// Default is 1
PublicIpBandWidth int `mapstructure:"public_ip_band_width" required:"false"`
// Default is 0
ProjectId string `mapstructure:"project_id" required:"false"`
// Key/value pair 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"`
}
type FlatKmiFilterOptions ¶ added in v0.2.0
type FlatKmiFilterOptions struct {
MostRecent *bool `mapstructure:"most_recent" cty:"most_recent" hcl:"most_recent"`
ImageSource *string `mapstructure:"image_source" cty:"image_source" hcl:"image_source"`
NameRegex *string `mapstructure:"name_regex" cty:"name_regex" hcl:"name_regex"`
Platform *string `mapstructure:"platform" cty:"platform" hcl:"platform"`
}
FlatKmiFilterOptions is an auto-generated flat version of KmiFilterOptions. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatKmiFilterOptions) HCL2Spec ¶ added in v0.2.0
func (*FlatKmiFilterOptions) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a KmiFilterOptions. This spec is used by HCL to read the fields of KmiFilterOptions. The decoded values from this spec will then be applied to a FlatKmiFilterOptions.
type KmiFilterOptions ¶ added in v0.2.0
type KmiFilterOptions struct {
// Selects the newest created image when true.
// This is most useful for selecting a daily distro build.
MostRecent bool `mapstructure:"most_recent"`
// ImageSource Valid values are import, copy, share, extend, system.
ImageSource string `mapstructure:"image_source"`
// NameRegex A regex string to filter resulting images by name.
// (Such as: `^CentOS 7.[1-2] 64` means CentOS 7.1 of 64-bit operating system or CentOS 7.2 of 64-bit operating system,
// \"^Ubuntu 16.04 64\" means Ubuntu 16.04 of 64-bit operating system).
NameRegex string `mapstructure:"name_regex"`
// Platform type of the image system.
Platform string `mapstructure:"platform"`
}
func (*KmiFilterOptions) FlatMapstructure ¶ added in v0.2.0
func (*KmiFilterOptions) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatKmiFilterOptions. FlatKmiFilterOptions is an auto-generated flat version of KmiFilterOptions. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (*KmiFilterOptions) GetFilteredImage ¶ added in v0.2.0
func (d *KmiFilterOptions) GetFilteredImage(params *map[string]interface{}, kecConn *kec.Kec) (image *Ks3Image, err error)
GetFilteredImage to get source image with filers
func (*KmiFilterOptions) IsEmpty ¶ added in v0.2.0
func (d *KmiFilterOptions) IsEmpty() bool
func (*KmiFilterOptions) String ¶ added in v0.2.0
func (d *KmiFilterOptions) String() string
type Ks3Image ¶ added in v0.2.0
type Ks3Image struct {
ImageId string `mapstructure:"ImageId"`
ImageType string `mapstructure:"Type"`
Name string `mapstructure:"Name"`
CreationDate string `mapstructure:"CreationDate"`
Platform string `mapstructure:"Platform"`
ImageSource string `mapstructure:"ImageSource"`
RealImageId string `mapstructure:"RealImageId"`
IsCloudMarket bool `mapstructure:"IsCloudMarket"`
SysDisk int `mapstructure:"SysDisk"`
IsPublic bool `mapstructure:"IsPublic"`
}
type Ks3Images ¶ added in v0.2.0
type Ks3Images struct {
ImagesSet []*Ks3Image `mapstructure:"ImagesSet"`
}
type ProcessRequestResult ¶
type StepCleanupKsyunTempKeys ¶
type StepCleanupKsyunTempKeys struct {
Comm *communicator.Config
SSHTemporaryPublicKey *string
}
func (*StepCleanupKsyunTempKeys) Cleanup ¶
func (s *StepCleanupKsyunTempKeys) Cleanup(state multistep.StateBag)
func (*StepCleanupKsyunTempKeys) Run ¶
func (s *StepCleanupKsyunTempKeys) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepConfigKsyunCommon ¶
type StepConfigKsyunCommon struct {
CommonConfig *CommonConfig
}
func (*StepConfigKsyunCommon) Cleanup ¶
func (s *StepConfigKsyunCommon) Cleanup(stateBag multistep.StateBag)
func (*StepConfigKsyunCommon) Run ¶
func (s *StepConfigKsyunCommon) Run(ctx context.Context, stateBag multistep.StateBag) multistep.StepAction
type StepConfigKsyunKeyPair ¶
type StepConfigKsyunKeyPair struct {
CommonConfig *CommonConfig
SSHTemporaryPublicKey *string
// contains filtered or unexported fields
}
func (*StepConfigKsyunKeyPair) Cleanup ¶
func (s *StepConfigKsyunKeyPair) Cleanup(stateBag multistep.StateBag)
func (*StepConfigKsyunKeyPair) Run ¶
func (s *StepConfigKsyunKeyPair) Run(ctx context.Context, stateBag multistep.StateBag) multistep.StepAction
type StepConfigKsyunPublicIp ¶
type StepConfigKsyunPublicIp struct {
CommonConfig *CommonConfig
// contains filtered or unexported fields
}
func (*StepConfigKsyunPublicIp) Cleanup ¶
func (s *StepConfigKsyunPublicIp) Cleanup(stateBag multistep.StateBag)
func (*StepConfigKsyunPublicIp) Run ¶
func (s *StepConfigKsyunPublicIp) Run(ctx context.Context, stateBag multistep.StateBag) multistep.StepAction
type StepConfigKsyunSecurityGroup ¶
type StepConfigKsyunSecurityGroup struct {
CommonConfig *CommonConfig
Index int
After AfterStepRun
// contains filtered or unexported fields
}
func (*StepConfigKsyunSecurityGroup) Cleanup ¶
func (s *StepConfigKsyunSecurityGroup) Cleanup(stateBag multistep.StateBag)
func (*StepConfigKsyunSecurityGroup) Run ¶
func (s *StepConfigKsyunSecurityGroup) Run(ctx context.Context, stateBag multistep.StateBag) multistep.StepAction
type StepConfigKsyunSubnet ¶
type StepConfigKsyunSubnet struct {
CommonConfig *CommonConfig
SubnetType string
Index int
After AfterStepRun
// contains filtered or unexported fields
}
func (*StepConfigKsyunSubnet) Cleanup ¶
func (s *StepConfigKsyunSubnet) Cleanup(stateBag multistep.StateBag)
func (*StepConfigKsyunSubnet) Run ¶
func (s *StepConfigKsyunSubnet) Run(ctx context.Context, stateBag multistep.StateBag) multistep.StepAction
type StepConfigKsyunVpc ¶
type StepConfigKsyunVpc struct {
CommonConfig *CommonConfig
After AfterStepRun
// contains filtered or unexported fields
}
func (*StepConfigKsyunVpc) Cleanup ¶
func (s *StepConfigKsyunVpc) Cleanup(stateBag multistep.StateBag)
func (*StepConfigKsyunVpc) Run ¶
func (s *StepConfigKsyunVpc) Run(ctx context.Context, stateBag multistep.StateBag) multistep.StepAction
type StepCreateKsyunTags ¶ added in v0.3.0
type StepCreateKsyunTags struct {
Tags map[string]string
// tag resource type Values: instance, epc-host, epc-image, image, eip
ResourceType string
}
func (*StepCreateKsyunTags) Cleanup ¶ added in v0.3.0
func (s *StepCreateKsyunTags) Cleanup(stateBag multistep.StateBag)
func (*StepCreateKsyunTags) Run ¶ added in v0.3.0
func (s *StepCreateKsyunTags) Run(ctx context.Context, stateBag multistep.StateBag) multistep.StepAction
type Tags ¶ added in v0.3.0
type Tags []*Tag
func (Tags) GetTagsParams ¶ added in v0.3.0
type WaitResourceParam ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.