machine

package
v0.0.0-...-395fc46 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Machine

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

Machine provides an easy and portable way to interact with vms

func New

func New(ctx context.Context, urlstr string) (*Machine, error)

New opens the Machine identified by the URL given.

See the URLOpener documentation in driver subpackages for details on supported URL formats, and https://gocloud.dev/concepts/urls/ for more information.

func (*Machine) As

func (m *Machine) As(i interface{}) bool

As converts i to driver-specific types. See https://gocloud.dev/concepts/as/ for background information, the "As" examples in this package for examples, and the driver package documentation for the specific types supported for that driver.

func (*Machine) ErrorAs

func (m *Machine) ErrorAs(err error, i interface{}) bool

ErrorAs converts err to driver-specific types. ErrorAs panics if i is nil or not a pointer. ErrorAs returns false if err == nil. See https://gocloud.dev/concepts/as/ for background information.

func (*Machine) Shutdown

func (m *Machine) Shutdown(ctx context.Context) error

Shutdown releases any resources used for the machine.

func (*Machine) Start

func (m *Machine) Start(ctx context.Context) error

Start the machine

type MachineURLOpener

type MachineURLOpener interface {
	NewURL(ctx context.Context, u *url.URL) (*Machine, error)
}

MachineURLOpener represents types that can open Machines based on a URL. The opener must not modify the URL argument. NewURL must be safe to call from multiple goroutines.

This interface is generally implemented by types in driver packages.

type URLMux

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

URLMux is a URL opener multiplexer. It matches the scheme of the URLs against a set of registered schemes and calls the opener that matches the URL's scheme. See https://gocloud.dev/concepts/urls/ for more information.

The zero value is a multiplexer with no registered schemes.

func DefaultURLMux

func DefaultURLMux() *URLMux

DefaultURLMux returns the URLMux used by New.

Driver packages can use this to register their MachineURLOpener on the mux.

func (*URLMux) MachineSchemes

func (mux *URLMux) MachineSchemes() []string

MachineSchemes returns a sorted slice of the registered Machine schemes.

func (*URLMux) New

func (mux *URLMux) New(ctx context.Context, urlstr string) (*Machine, error)

New calls NewURL with the URL parsed from urlstr. New is safe to call from multiple goroutines.

func (*URLMux) NewURL

func (mux *URLMux) NewURL(ctx context.Context, u *url.URL) (*Machine, error)

NewURL dispatches the URL to the opener that is registered with the URL's scheme. NewURL is safe to call from multiple goroutines.

func (*URLMux) RegisterMachine

func (mux *URLMux) RegisterMachine(scheme string, opener MachineURLOpener)

RegisterMachine registers the opener with the given scheme. If an opener already exists for the scheme, RegisterMachine panics.

func (*URLMux) ValidMachineScheme

func (mux *URLMux) ValidMachineScheme(scheme string) bool

ValidMachineScheme returns true iff scheme has been registered for Machines.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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