nutanix

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "packer.nutanix"
View Source
const EndpointVar string = "NUTANIX_ENDPOINT"

EndpointVar - key value in json request and env variable

View Source
const InsecureVar string = "NUTANIX_INSECURE"

InsecureVar - key value in json request and env variable

View Source
const PasswordVar string = "NUTANIX_PASSWORD"

PasswordVar - key value in json request and env variable

View Source
const PortVar string = "NUTANIX_PORT"

PortVar - key value in json request and env variable

View Source
const UsernameVar string = "NUTANIX_USERNAME"

UsernameVar - key value in json request and env variable

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact added in v0.1.0

type Artifact struct {
	Name string
	UUID string
}

Artifact contains the unique keys for the nutanix artifact produced from Packer

func (*Artifact) BuilderId added in v0.1.0

func (a *Artifact) BuilderId() string

BuilderId will return the unique builder id

func (*Artifact) Destroy added in v0.1.0

func (a *Artifact) Destroy() error

Destroy returns nothing important right now

func (*Artifact) Files added in v0.1.0

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

Files will return the files from the builder

func (*Artifact) Id added in v0.1.0

func (a *Artifact) Id() string

Id returns the UUID for the saved image

func (*Artifact) State added in v0.1.0

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

State returns nothing important right now

func (*Artifact) String added in v0.1.0

func (a *Artifact) String() string

String returns a String name of the artifact

type Builder

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

Builder - struct for building nutanix-builder

func (*Builder) ConfigSpec

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

func (*Builder) Prepare

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

func (*Builder) Run

Run the nutanix builder

type Config

type Config struct {
	common.PackerConfig            `mapstructure:",squash"`
	CommConfig                     communicator.Config `mapstructure:",squash"`
	bootcommand.VNCConfig          `mapstructure:",squash"`
	shutdowncommand.ShutdownConfig `mapstructure:",squash"`

	// The IP address that should be
	// binded to for VNC. By default we will use 0.0.0.0 for this. If you
	// wish to bind to a specific interfaces use w.x.y.z
	VNCBindAddress string `mapstructure:"vnc_bind_address" required:"false"`
	VNCUser        string `mapstructure:"vnc_user" required:"false"`
	VNCPassword    string `mapstructure:"vnc_password" required:"false"`
	VNCEnable      bool   `mapstructure:"vnc_enable" required:"false"`
	// The minimum and maximum port
	// to use for VNC access to the virtual machine. The builder uses VNC to type
	// the initial boot_command. Because Packer generally runs in parallel,
	// Packer uses a randomly chosen port in this range that appears available. By
	// default this is 5900 to 6000. The minimum and maximum ports are inclusive.
	// The minimum port cannot be set below 5900 due to a quirk in how QEMU parses
	// vnc display address.
	VNCPortMin int `mapstructure:"vnc_port_min" required:"false"`
	VNCPortMax int `mapstructure:"vnc_port_max"`
	// contains filtered or unexported fields
}

func (*Config) FlatMapstructure added in v0.1.0

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.

func (*Config) Prepare added in v0.1.0

func (c *Config) Prepare(raws ...interface{}) ([]string, error)

type Driver

type Driver interface {
	CreateRequest(vmConfig) (*ntnxschema.VMIntent, error)
	Create(*ntnxschema.VMIntent) (*nutanixInstance, error)
	Delete(string) error
	Get(string) (*nutanixInstance, error)
	GetHost(string) (*nutanixHost, error)
	PowerOff(string) error
	SaveVMDisk(string) (*nutanixImage, error)
	WaitForShutdown(string, <-chan struct{}) bool
}

A driver is able to talk to Nutanix PrismCentral and perform certain operations with it.

type FlatConfig added in v0.1.0

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"`
	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"`
	BootGroupInterval         *string           `mapstructure:"boot_keygroup_interval" cty:"boot_keygroup_interval" hcl:"boot_keygroup_interval"`
	BootWait                  *string           `mapstructure:"boot_wait" cty:"boot_wait" hcl:"boot_wait"`
	BootCommand               []string          `mapstructure:"boot_command" cty:"boot_command" hcl:"boot_command"`
	DisableVNC                *bool             `mapstructure:"disable_vnc" cty:"disable_vnc" hcl:"disable_vnc"`
	BootKeyInterval           *string           `mapstructure:"boot_key_interval" cty:"boot_key_interval" hcl:"boot_key_interval"`
	ShutdownCommand           *string           `mapstructure:"shutdown_command" required:"false" cty:"shutdown_command" hcl:"shutdown_command"`
	ShutdownTimeout           *string           `mapstructure:"shutdown_timeout" required:"false" cty:"shutdown_timeout" hcl:"shutdown_timeout"`
	VNCBindAddress            *string           `mapstructure:"vnc_bind_address" required:"false" cty:"vnc_bind_address" hcl:"vnc_bind_address"`
	VNCUser                   *string           `mapstructure:"vnc_user" required:"false" cty:"vnc_user" hcl:"vnc_user"`
	VNCPassword               *string           `mapstructure:"vnc_password" required:"false" cty:"vnc_password" hcl:"vnc_password"`
	VNCEnable                 *bool             `mapstructure:"vnc_enable" required:"false" cty:"vnc_enable" hcl:"vnc_enable"`
	VNCPortMin                *int              `mapstructure:"vnc_port_min" required:"false" cty:"vnc_port_min" hcl:"vnc_port_min"`
	VNCPortMax                *int              `mapstructure:"vnc_port_max" cty:"vnc_port_max" hcl:"vnc_port_max"`
}

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 added in v0.1.0

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 FlatclusterConfig added in v0.1.0

type FlatclusterConfig struct {
	Username *string `mapstructure:"nutanix_username" cty:"nutanix_username" hcl:"nutanix_username"`
	Password *string `mapstructure:"nutanix_password" cty:"nutanix_password" hcl:"nutanix_password"`
	Insecure *bool   `mapstructure:"nutanix_insecure" cty:"nutanix_insecure" hcl:"nutanix_insecure"`
	Endpoint *string `mapstructure:"nutanix_endpoint" cty:"nutanix_endpoint" hcl:"nutanix_endpoint"`
}

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

func (*FlatclusterConfig) HCL2Spec added in v0.1.0

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

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

type FlatvmConfig added in v0.1.0

type FlatvmConfig struct {
	VMName     *string `mapstructure:"vmname" json:"vmname" required:"false" cty:"vmname" hcl:"vmname"`
	DiskType   *string `mapstructure:"disk_type" json:"disk_type" required:"true" cty:"disk_type" hcl:"disk_type"`
	ImageName  *string `mapstructure:"ImageName" json:"ImageName" cty:"ImageName" hcl:"ImageName"`
	SubnetName *string `mapstructure:"SubnetName" json:"SubnetName" cty:"SubnetName" hcl:"SubnetName"`
	Cluster    *string `mapstructure:"Cluster" json:"Cluster" cty:"Cluster" hcl:"Cluster"`
	CPU        *int32  `mapstructure:"CPU" json:"CPU" cty:"CPU" hcl:"CPU"`
	MemoryMB   *int64  `mapstructure:"MemoryMB" json:"MemoryMB" cty:"MemoryMB" hcl:"MemoryMB"`
	DiskSizeGB *int64  `mapstructure:"DiskSizeGB" json:"DiskSizeGB" cty:"DiskSizeGB" hcl:"DiskSizeGB"`
	UserData   *string `mapstructure:"UserData" json:"UserData" cty:"UserData" hcl:"UserData"`
}

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

func (*FlatvmConfig) HCL2Spec added in v0.1.0

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

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

type NutanixDriver added in v0.1.0

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

func (*NutanixDriver) Create added in v0.1.0

func (d *NutanixDriver) Create(req *ntnxschema.VMIntent) (*nutanixInstance, error)

func (*NutanixDriver) CreateRequest added in v0.1.0

func (d *NutanixDriver) CreateRequest(vm vmConfig) (*ntnxschema.VMIntent, error)

func (*NutanixDriver) Delete added in v0.1.0

func (d *NutanixDriver) Delete(vmUUID string) error

func (*NutanixDriver) Get added in v0.1.0

func (d *NutanixDriver) Get(vmUUID string) (*nutanixInstance, error)

func (*NutanixDriver) GetHost added in v0.1.0

func (d *NutanixDriver) GetHost(hostUUID string) (*nutanixHost, error)

func (*NutanixDriver) PowerOff added in v0.1.0

func (d *NutanixDriver) PowerOff(vmUUID string) error

func (*NutanixDriver) SaveVMDisk added in v0.1.0

func (d *NutanixDriver) SaveVMDisk(diskUUID string) (*nutanixImage, error)

func (*NutanixDriver) WaitForShutdown added in v0.1.0

func (d *NutanixDriver) WaitForShutdown(vmUUID string, cancelCh <-chan struct{}) bool

type StepShutdown added in v0.1.0

type StepShutdown struct {
	Command string
	Timeout time.Duration
}

This step shuts down the machine. It first attempts to do so gracefully, but ultimately forcefully shuts it down if that fails.

Uses:

communicator packersdk.Communicator
driver Driver
ui     packersdk.Ui
vmName string

Produces:

<nothing>

func (*StepShutdown) Cleanup added in v0.1.0

func (s *StepShutdown) Cleanup(state multistep.StateBag)

func (*StepShutdown) Run added in v0.1.0

Jump to

Keyboard shortcuts

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