common

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Code generated by "mapstructure-to-hcl2 -type ImageDestination"; DO NOT EDIT.

Index

Constants

View Source
const (
	// DefaultPasswordStr, DefaultPasswordNum and DefaultPasswordSpe are used to general default value of root password of UHost instance
	DefaultPasswordNum = "012346789"
	DefaultPasswordStr = "abcdefghijklmnopqrstuvwxyz"
	DefaultPasswordSpe = "-_"
)
View Source
const (
	InstanceStateRunning = "Running"
	InstanceStateStopped = "Stopped"

	ImageStateAvailable   = "Available"
	ImageStateUnavailable = "Unavailable"

	BootDiskStateNormal = "Normal"
	OsTypeWindows       = "Windows"
	SecurityGroupNonWeb = "recommend non web"
	IpTypePrivate       = "Private"
)
View Source
const (
	DefaultCreateImageTimeout = 3600
)

Variables

View Source
var BootDiskTypeMap = NewStringConverter(map[string]string{
	"cloud_ssd":    "CLOUD_SSD",
	"local_normal": "LOCAL_NORMAL",
	"local_ssd":    "LOCAL_SSD",
})
View Source
var ImageNamePattern = regexp.MustCompile(`^[A-Za-z0-9\p{Han}-_\[\]:,.]{1,63}$`)

Functions

func CheckIntIn

func CheckIntIn(val int, available []int) error

func CheckStringIn

func CheckStringIn(val string, available []string) error

func Halt

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

func IsExpectedStateError

func IsExpectedStateError(err error) bool

func IsNotCompleteError

func IsNotCompleteError(err error) bool

func IsNotFoundError

func IsNotFoundError(err error) bool

func IsStringIn

func IsStringIn(val string, available []string) bool

func NewExpectedStateError

func NewExpectedStateError(product, id string) error

func NewNotCompletedError

func NewNotCompletedError(product string) error

func NewNotFoundError

func NewNotFoundError(product, id string) error

func NewStringConverter

func NewStringConverter(input map[string]string) stringConverter

func SSHHost

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

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

Types

type AccessConfig

type AccessConfig struct {
	PublicKey  string `mapstructure:"public_key"`
	PrivateKey string `mapstructure:"private_key"`
	Region     string `mapstructure:"region"`
	ProjectId  string `mapstructure:"project_id"`
	BaseUrl    string `mapstructure:"base_url"`
	// contains filtered or unexported fields
}

func (*AccessConfig) Client

func (c *AccessConfig) Client() (*UCloudClient, error)

func (*AccessConfig) Config

func (c *AccessConfig) Config() error

func (*AccessConfig) Prepare

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

func (*AccessConfig) ValidateProjectId

func (c *AccessConfig) ValidateProjectId(projectId string) error

func (*AccessConfig) ValidateRegion

func (c *AccessConfig) ValidateRegion(region string) error

func (*AccessConfig) ValidateZone

func (c *AccessConfig) ValidateZone(region, zone string) error

type Artifact

type Artifact struct {
	UCloudImages *ImageInfoSet

	BuilderIdValue string

	Client *UCloudClient

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

type ExpectedStateError struct {
	// contains filtered or unexported fields
}

func (*ExpectedStateError) Error

func (e *ExpectedStateError) Error() string

type FlatImageDestination

type FlatImageDestination struct {
	ProjectId   *string `mapstructure:"project_id" cty:"project_id"`
	Region      *string `mapstructure:"region" cty:"region"`
	Name        *string `mapstructure:"name" cty:"name"`
	Description *string `mapstructure:"description" cty:"description"`
}

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

func (*FlatImageDestination) HCL2Spec

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

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

type ImageConfig

type ImageConfig struct {
	ImageName             string             `mapstructure:"image_name"`
	ImageDescription      string             `mapstructure:"image_description"`
	ImageDestinations     []ImageDestination `mapstructure:"image_copy_to_mappings"`
	WaitImageReadyTimeout int                `mapstructure:"wait_image_ready_timeout"`
}

func (*ImageConfig) Prepare

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

type ImageDestination

type ImageDestination struct {
	ProjectId   string `mapstructure:"project_id"`
	Region      string `mapstructure:"region"`
	Name        string `mapstructure:"name"`
	Description string `mapstructure:"description"`
}

func (*ImageDestination) FlatMapstructure

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

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

type ImageInfo

type ImageInfo struct {
	ImageId   string
	ProjectId string
	Region    string
}

func (*ImageInfo) Id

func (i *ImageInfo) Id() string

type ImageInfoSet

type ImageInfoSet struct {
	// contains filtered or unexported fields
}

func NewImageInfoSet

func NewImageInfoSet(vL []ImageInfo) *ImageInfoSet

func (*ImageInfoSet) Get

func (i *ImageInfoSet) Get(projectId, region string) *ImageInfo

func (*ImageInfoSet) GetAll

func (i *ImageInfoSet) GetAll() []ImageInfo

func (*ImageInfoSet) Remove

func (i *ImageInfoSet) Remove(id string)

func (*ImageInfoSet) Set

func (i *ImageInfoSet) Set(img ImageInfo)

type InstanceType

type InstanceType struct {
	CPU           int
	Memory        int
	HostType      string
	HostScaleType string
}

func ParseInstanceType

func ParseInstanceType(s string) (*InstanceType, error)

func (*InstanceType) Iscustomized

func (i *InstanceType) Iscustomized() bool

func (*InstanceType) String

func (i *InstanceType) String() string

type NotCompletedError

type NotCompletedError struct {
	// contains filtered or unexported fields
}

func (*NotCompletedError) Error

func (e *NotCompletedError) Error() string

type NotFoundError

type NotFoundError struct {
	// contains filtered or unexported fields
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type RunConfig

type RunConfig struct {
	Zone            string `mapstructure:"availability_zone"`
	SourceImageId   string `mapstructure:"source_image_id"`
	InstanceType    string `mapstructure:"instance_type"`
	InstanceName    string `mapstructure:"instance_name"`
	BootDiskType    string `mapstructure:"boot_disk_type"`
	VPCId           string `mapstructure:"vpc_id"`
	SubnetId        string `mapstructure:"subnet_id"`
	SecurityGroupId string `mapstructure:"security_group_id"`

	// Communicator settings
	Comm            communicator.Config `mapstructure:",squash"`
	UseSSHPrivateIp bool                `mapstructure:"use_ssh_private_ip"`
}

func (*RunConfig) Prepare

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

type UCloudClient

type UCloudClient struct {
	UHostConn    *uhost.UHostClient
	UNetConn     *unet.UNetClient
	VPCConn      *vpc.VPCClient
	UAccountConn *uaccount.UAccountClient
	UFileConn    *ufile.UFileClient
}

func (*UCloudClient) DescribeFirewallById

func (c *UCloudClient) DescribeFirewallById(sgId string) (*unet.FirewallDataSet, error)

func (*UCloudClient) DescribeImageById

func (c *UCloudClient) DescribeImageById(imageId string) (*uhost.UHostImageSet, error)

func (*UCloudClient) DescribeImageByInfo

func (c *UCloudClient) DescribeImageByInfo(projectId, regionId, imageId string) (*uhost.UHostImageSet, error)

func (*UCloudClient) DescribeSubnetById

func (c *UCloudClient) DescribeSubnetById(subnetId string) (*vpc.VPCSubnetInfoSet, error)

func (*UCloudClient) DescribeUHostById

func (c *UCloudClient) DescribeUHostById(uhostId string) (*uhost.UHostInstanceSet, error)

func (*UCloudClient) DescribeVPCById

func (c *UCloudClient) DescribeVPCById(vpcId string) (*vpc.VPCInfo, error)

Jump to

Keyboard shortcuts

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