vcenter

package
v0.0.0-...-79a645e Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const ProvisionerType = "vcenter"

ProvisionerType : Constant string value used to represent the provisioner type vcenter

Variables

View Source
var ProvisionersNewVCenterCmd = &cobra.Command{
	Use:   "vcenter <OUTPUT_FILE>",
	Short: "Add a new VCenter Provisioner.",
	Args:  cobra.ExactArgs(1),
	Run: func(cmd *cobra.Command, args []string) {

		f, err := os.OpenFile(args[0], os.O_RDWR|os.O_CREATE, 0644)
		if err != nil {
			cli.SetError(err, 1)
			return
		}
		defer f.Close()
		p, err := NewProvisioner(log, &Config{
			Username:   provisionersNewVCenterUsername,
			Password:   provisionersNewVCenterPassword,
			Address:    provisionersNewVCenterAddress,
			Datacenter: provisionersNewVCenterDatacenter,
			Datastore:  provisionersNewVCenterDatastore,
			Cluster:    provisionersNewVCenterCluster,
			Notes:      provisionersNewVCenterNotes,
		})
		if err != nil {
			cli.SetError(err, 4)
			return
		}

		data, err := p.Marshal()
		if err != nil {
			cli.SetError(err, 5)
			return
		}
		out := provisioners.Encrypt(data, provisionersNewPassphrase)
		_, err = io.Copy(f, bytes.NewReader(out))
		if err != nil {
			cli.SetError(err, 6)
			return
		}
	},
}

ProvisionersNewVCenterCmd is a cobra command that can be used to create a new vcenter provisioner.

Functions

This section is empty.

Types

type Config

type Config struct {
	Username   string `json:"username"`
	Password   string `json:"password"`
	Address    string `json:"address"`
	Datacenter string `json:"datacenter"`
	Datastore  string `json:"datastore"`
	Cluster    string `json:"cluster"`
	Notes      string `json:"notes"`
}

Config contains configuration fields required by the Provisioner

type Provisioner

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

Provisioner satisfies the provisioners.Provisioner interface

func NewProvisioner

func NewProvisioner(log elog.View, cfg *Config) (*Provisioner, error)

NewProvisioner - Create a VCenter Provisioner object

func (*Provisioner) DiskFormat

func (p *Provisioner) DiskFormat() vdisk.Format

DiskFormat returns the provisioners required disk format

func (*Provisioner) Marshal

func (p *Provisioner) Marshal() ([]byte, error)

Marshal returns json provisioner as bytes

func (*Provisioner) Provision

func (p *Provisioner) Provision(args *provisioners.ProvisionArgs) error

Provision given a valid ProvisionArgs object will provision the passed vorteil project

to the configured vcenter provisioner. OVF and VMDK will be needed in different steps
so the OVA tar will be read from directly.

func (*Provisioner) SizeAlign

func (p *Provisioner) SizeAlign() vcfg.Bytes

SizeAlign returns vcfg MiB size in bytes

func (*Provisioner) Type

func (p *Provisioner) Type() string

Type returns 'vcenter'

func (*Provisioner) Validate

func (p *Provisioner) Validate() error

Validate Provisioner configuration

Jump to

Keyboard shortcuts

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