cloud

package
v6.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2020 License: Apache-2.0 Imports: 10 Imported by: 532

Documentation

Index

Constants

View Source
const (
	VMNotFoundError       = "Bosh::Clouds::VMNotFound"
	DiskNotFoundError     = "Bosh::Clouds::DiskNotFound"
	StemcellNotFoundError = "Bosh::Clouds::StemcellNotFound"
	NotImplementedError   = "Bosh::Clouds::NotImplemented"
)
View Source
const DefaultCPIVersion = 1
View Source
const MaxCpiApiVersionSupported = 2
View Source
const StemcellNoRegistryAsOfVersion = 2

The agent on stemcells with version 2 will avoid the registry IFF CPI and Director support CPI API v2 (above)

Variables

This section is empty.

Functions

This section is empty.

Types

type CPI

type CPI struct {
	JobPath     string
	JobsDir     string
	PackagesDir string
}

func (CPI) ExecutablePath

func (j CPI) ExecutablePath() string

type CPICmdRunner

type CPICmdRunner interface {
	Run(context CmdContext, method string, apiVersion int, args ...interface{}) (CmdOutput, error)
}

func NewCPICmdRunner

func NewCPICmdRunner(
	cmdRunner boshsys.CmdRunner,
	cpi CPI,
	logger boshlog.Logger,
) CPICmdRunner

type Cloud

type Cloud interface {
	CreateStemcell(imagePath string, cloudProperties biproperty.Map) (stemcellCID string, err error)
	DeleteStemcell(stemcellCID string) error
	HasVM(vmCID string) (bool, error)
	CreateVM(
		agentID string,
		stemcellCID string,
		cloudProperties biproperty.Map,
		networksInterfaces map[string]biproperty.Map,
		env biproperty.Map,
	) (vmCID string, err error)
	SetVMMetadata(cmCID string, metadata VMMetadata) error
	SetDiskMetadata(diskCID string, metadata DiskMetadata) error
	DeleteVM(vmCID string) error
	CreateDisk(size int, cloudProperties biproperty.Map, vmCID string) (diskCID string, err error)
	AttachDisk(vmCID, diskCID string) (interface{}, error)
	DetachDisk(vmCID, diskCID string) error
	DeleteDisk(diskCID string) error
	Info() (cpiInfo CpiInfo, err error)
	fmt.Stringer
}

func NewCloud

func NewCloud(
	cpiCmdRunner CPICmdRunner,
	directorID string,
	stemcellApiVersion int,
	logger boshlog.Logger,
) Cloud

type CmdContext

type CmdContext struct {
	DirectorID string `json:"director_uuid"`
	Vm         *VM    `json:"vm,omitempty"`
}

func (CmdContext) String

func (c CmdContext) String() string

type CmdError

type CmdError struct {
	Type      string `json:"type"`
	Message   string `json:"message"`
	OkToRetry bool   `json:"ok_to_retry"`
}

func (CmdError) String

func (e CmdError) String() string

type CmdInput

type CmdInput struct {
	Method     string        `json:"method"`
	Arguments  []interface{} `json:"arguments"`
	Context    CmdContext    `json:"context"`
	ApiVersion int           `json:"api_version"`
}

type CmdOutput

type CmdOutput struct {
	Result interface{} `json:"result"`
	Error  *CmdError   `json:"error,omitempty"`
	Log    string      `json:"log"`
}

type CpiInfo

type CpiInfo struct {
	StemcellFormats []string `json:"stemcell_formats"`
	ApiVersion      int      `json:"api_version,omitempty"`
}

type DiskMetadata

type DiskMetadata map[string]string

type Error

type Error interface {
	error
	Method() string
	Type() string
	Message() string
	OkToRetry() bool
}

func NewCPIError

func NewCPIError(method string, cmdError CmdError) Error

type Factory

type Factory interface {
	NewCloud(installation biinstall.Installation, directorID string, stemcellApiVersion int) (Cloud, error)
}

func NewFactory

func NewFactory(
	fs boshsys.FileSystem,
	cmdRunner boshsys.CmdRunner,
	logger boshlog.Logger,
) Factory

type Stemcell

type Stemcell struct {
	ApiVersion int `json:"api_version,omitempty"`
}

type VM

type VM struct {
	Stemcell *Stemcell `json:"stemcell,omitempty"`
}

type VMMetadata

type VMMetadata map[string]string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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