common

package
v0.0.0-...-8aaee07 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuilderId = "wangweihong.hci"
)

Variables

This section is empty.

Functions

func DeleteImage

func DeleteImage(client *example.Client, cluster string, tenant string, repository, image string) error

func FindAvailableIP

func FindAvailableIP(instanceCIDR string) (string, error)

func GetImage

func GetImage(client *example.Client, cluster string, tenant string, repository, name, imageType string) (string, error)

func GetImageRepository

func GetImageRepository(client *example.Client, cluster string, tenant string, name string) (string, error)

func GetTenant

func GetTenant(client *example.Client, name string) (string, error)

func InspectServer

func InspectServer(c *example.Client, cluster, tenant, server string) (*iexample.EcsInspectResponse, error)

func IsExporting

func IsExporting(client *example.Client, cluster string, tenant string, server string) (bool, error)

func ShutoffServer

func ShutoffServer(c *example.Client, cluster, tenant, server string) error

func SyncImage

func SyncImage(client *example.Client, cluster string, tenant string, repository string) error

Types

type AccessConfig

type AccessConfig struct {
	// The access key of the HCI to use.
	// If omitted, the HCI_ENDPOINT environment variable is used.
	Endpoint string `mapstructure:"endpoint"  required:"true" `
	// The name of tenant in which to launch the server to create the image.
	// If omitted, the HCI_TENANT environment variable is used.
	Tenant string `mapstructure:"tenant" required:"true"`
	// The name of tenant in which to launch the server to create the image.
	// If omitted, the HCI_USER environment variable is used.
	User string `mapstructure:"user" required:"true"`
	// The name of tenant in which to launch the server to create the image.
	// If omitted, the HCI_PASSWORD environment variable is used.
	Password string `mapstructure:"password" required:"true"`
}

AccessConfig is for common configuration related to HCI access

func (*AccessConfig) HCIClient

func (c *AccessConfig) HCIClient() (*example.Client, error)

HCIClient is the hci common client

func (*AccessConfig) Prepare

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

type Artifact

type Artifact struct {
	Cluster string
	Tenant  string
	Repo    string
	// ImageId of built image
	ImageId string

	// BuilderIdValue is the unique ID for the builder that created this image
	BuilderIdValue string

	//  client for performing API stuff.
	Client *example.Client
}

packersdk.Artifact implementation

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (a *Artifact) Files() []string

func (*Artifact) Id

func (*Artifact) Id() string

func (*Artifact) State

func (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type ImageConfig

type ImageConfig struct {
	// The name of the packer image.
	ImageName string `mapstructure:"image_name" required:"true"`
	// The description of the packer image.
	ImageDescription string `mapstructure:"image_description" required:"false"`
	// The type of the packer image. Available values include:
	// raw,qcow2, 默认为qcow2
	ImageType string `mapstructure:"image_type" required:"false"`
	// 导出的镜像仓库, 不指定使用原仓库
	ExportRepository string `mapstructure:"export_repository" required:"false"`
}

ImageConfig is for common configuration related to creating Images.

func (*ImageConfig) Prepare

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

type SSHConfig

type SSHConfig struct {
	Comm communicator.Config `mapstructure:",squash"`
}

func (*SSHConfig) Prepare

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

type StepAuth

type StepAuth struct {
}

This is a definition of a builder step and should implement multistep.Step

func (*StepAuth) Cleanup

func (s *StepAuth) Cleanup(_ multistep.StateBag)

Cleanup can be used to clean up any artifact created by the step. A step's clean up always run at the end of a build, regardless of whether provisioning succeeds or fails.

func (*StepAuth) Run

Run should execute the purpose of this step

type StepCreateImage

type StepCreateImage struct {
	Config ImageConfig
}

func (*StepCreateImage) Cleanup

func (s *StepCreateImage) Cleanup(_ multistep.StateBag)

func (*StepCreateImage) Run

Run should execute the purpose of this step

type StepLoadComputeGroup

type StepLoadComputeGroup struct {
}

This is a definition of a builder step and should implement multistep.Step

func (*StepLoadComputeGroup) Cleanup

func (s *StepLoadComputeGroup) Cleanup(_ multistep.StateBag)

Cleanup can be used to clean up any artifact created by the step. A step's clean up always run at the end of a build, regardless of whether provisioning succeeds or fails.

func (*StepLoadComputeGroup) Run

Run should execute the purpose of this step

type StepLoadNetwork

type StepLoadNetwork struct {
}

func (*StepLoadNetwork) Run

Run should execute the purpose of this step

type StepLoadResourcePool

type StepLoadResourcePool struct {
}

This is a definition of a builder step and should implement multistep.Step

func (*StepLoadResourcePool) Cleanup

func (s *StepLoadResourcePool) Cleanup(_ multistep.StateBag)

Cleanup can be used to clean up any artifact created by the step. A step's clean up always run at the end of a build, regardless of whether provisioning succeeds or fails.

func (*StepLoadResourcePool) Run

Run should execute the purpose of this step

type StepLoadSpec

type StepLoadSpec struct {
	Spec string
}

This is a definition of a builder step and should implement multistep.Step

func (*StepLoadSpec) Cleanup

func (s *StepLoadSpec) Cleanup(_ multistep.StateBag)

Cleanup can be used to clean up any artifact created by the step. A step's clean up always run at the end of a build, regardless of whether provisioning succeeds or fails.

func (*StepLoadSpec) Run

Run should execute the purpose of this step

type StepLoadTenant

type StepLoadTenant struct {
	TargetTenant string
}

This is a definition of a builder step and should implement multistep.Step

func (*StepLoadTenant) Cleanup

func (s *StepLoadTenant) Cleanup(_ multistep.StateBag)

Cleanup can be used to clean up any artifact created by the step. A step's clean up always run at the end of a build, regardless of whether provisioning succeeds or fails.

func (*StepLoadTenant) Run

Run should execute the purpose of this step

type StepVncConnect

type StepVncConnect struct {
}

This is a definition of a builder step and should implement multistep.Step

func (*StepVncConnect) Cleanup

func (s *StepVncConnect) Cleanup(_ multistep.StateBag)

Cleanup can be used to clean up any artifact created by the step. A step's clean up always run at the end of a build, regardless of whether provisioning succeeds or fails.

func (*StepVncConnect) ConnectVNC

func (s *StepVncConnect) ConnectVNC(state multistep.StateBag) (*vnc.ClientConn, error)

func (*StepVncConnect) Run

Run should execute the purpose of this step

Jump to

Keyboard shortcuts

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