action

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

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

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TIMEOUT          time.Duration
	POLLING_INTERVAL time.Duration
)

Functions

This section is empty.

Types

type Action

type Action interface {
}

Action to be performed by a CPI

type AttachDisk

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

AttachDisk action handles the attach_disk request to attach a persistent disk to a vm instance

func NewAttachDisk

func NewAttachDisk(c client.Connector, l boshlog.Logger, r registry.Client) AttachDisk

NewAttachDisk creates an AttachDisk instance

func (AttachDisk) Run

func (ad AttachDisk) Run(vmCID VMCID, diskCID DiskCID) (interface{}, error)

Run implements the Action handler

type ConcreteFactory

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

ConcreteFactory creates Actions to handle CPI requests from BOSH

func NewConcreteFactory

func NewConcreteFactory(
	connector client.Connector,
	uuidGen boshuuid.Generator,
	cfg config.Config,
	logger boshlog.Logger,
) ConcreteFactory

NewConcreteFactory creates a ConcreteFactory instance

func (ConcreteFactory) Create

func (f ConcreteFactory) Create(method string) (Action, error)

Create creates an Action responsible for handling a method request

type CreateDisk

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

CreateDisk action handles the create_disk method invocation

func NewCreateDisk

func NewCreateDisk(c client.Connector, l boshlog.Logger) CreateDisk

NewCreateDisk creates a CreateDisk instance

func (CreateDisk) Run

func (cd CreateDisk) Run(size int, props DiskCloudProperties) (DiskCID, error)

Run creates a block storage of the requested size and returns it's ID

type CreateStemcell

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

CreateStemcell action handles the create_stemcell method invocation

func NewCreateStemcell

func NewCreateStemcell(c client.Connector, logger boshlog.Logger) CreateStemcell

NewCreateStemcell creates a CreateStemcell instance

func (CreateStemcell) Run

func (cs CreateStemcell) Run(_ string, cloudProps StemcellCloudProperties) (stemcellId string, err error)

type CreateVM

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

CreateVM action handles the create_vm request

func NewCreateVM

NewCreateVM creates a CreateVM instance

func (CreateVM) Run

func (cv CreateVM) Run(agentID string, stemcellCID StemcellCID, cloudProps VMCloudProperties, networks Networks, disks []DiskCID, env Environment) (VMCID, error)

type DeleteDisk

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

DeleteDisk action handles the delete_disk request

func NewDeleteDisk

func NewDeleteDisk(c client.Connector, l boshlog.Logger) DeleteDisk

NewDeleteDisk creates a DeleteDisk instance

func (DeleteDisk) Run

func (dd DeleteDisk) Run(diskCID DiskCID) (interface{}, error)

Run deletes a previously created persistent block storage.

type DeleteStemcell

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

DeleteStemcell action handles the delete_stemcell method invocation

func NewDeleteStemcell

func NewDeleteStemcell(connector client.Connector, logger boshlog.Logger) DeleteStemcell

NewDeleteStemcell creates a DeleteStemcell instance

func (DeleteStemcell) Run

func (ds DeleteStemcell) Run(stemcellCID StemcellCID) (interface{}, error)

Run delegates the request to a StemCellDestroyer

type DeleteVM

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

DeleteVM action handles the delete_vm request

func NewDeleteVM

func NewDeleteVM(c client.Connector, l boshlog.Logger, r registry.Client) DeleteVM

NewDeleteVM creates a DeleteVM instance

func (DeleteVM) Run

func (dv DeleteVM) Run(vmCID VMCID) (interface{}, error)

Run deletes the requested VM. Prior to deleting a vm, it detaches any block volumes attached to that vm. It also deletes the vm information from he agent registry after the VM is deleted. These operations are not atomic, i.e if the registry can't be updated Run will return an error, but deleted VM is not restored.

type DetachDisk

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

DetachDisk action handles the detach_disk request to detach a persistent disk from a vm instance

func NewDetachDisk

func NewDetachDisk(c client.Connector, l boshlog.Logger, r registry.Client) DetachDisk

NewDetachDisk creates a DetachDisk instance

func (DetachDisk) Run

func (dd DetachDisk) Run(vmCID VMCID, diskCID DiskCID) (interface{}, error)

Run detaches the given disk from the the given vm. It also updates the agent registry after the detachment is completed. An error is thrown in case the disk or vm is not found, there is a failure in detachment, or if the registry can't be updated successfully.

type DiskCID

type DiskCID string

DiskCID is a identifier for a persistent disk.

type DiskCloudProperties

type DiskCloudProperties struct {
	Datacenter string `json:"datacenter,omitempty"`
}

DiskCloudProperties holds the CPI specific disk properties

type Environment

type Environment map[string]interface{}

Environment used to create an instance

type Factory

type Factory interface {
	// Create an action for the given request method
	Create(method string) (Action, error)
}

Factory interface for creating an Action.

type GetDisks

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

GetDisks action handles the get_disks request

func NewGetDisks

func NewGetDisks(c client.Connector, l boshlog.Logger) GetDisks

NewGetDisks creates a GetDisks instance

func (GetDisks) Run

func (gd GetDisks) Run(vmCID VMCID) ([]string, error)

Run queries and returns the IDs of block storages attached to the given vm

type HasDisk

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

HasDisk action handles the has_disk request

func NewHasDisk

func NewHasDisk(c client.Connector, l boshlog.Logger) HasDisk

NewHasDisk creates a HasDisk instance

func (HasDisk) Run

func (hd HasDisk) Run(diskCID DiskCID) (bool, error)

Run queries OCI to determine if the given block storage exists

type HasVM

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

HasVM action handles the has_vm request

func NewHasVM

func NewHasVM(c client.Connector, l boshlog.Logger) HasVM

NewHasVM creates a HasVM instance

func (HasVM) Run

func (hv HasVM) Run(vmCID VMCID) (bool, error)

Run queries OCI to determine if the given vm exists

type Network

type Network struct {
	Type            string                 `json:"type,omitempty"`
	IP              string                 `json:"ip,omitempty"`
	Gateway         string                 `json:"gateway,omitempty"`
	Netmask         string                 `json:"netmask,omitempty"`
	DNS             []string               `json:"dns,omitempty"`
	DHCP            bool                   `json:"use_dhcp,omitempty"`
	Default         []string               `json:"default,omitempty"`
	CloudProperties NetworkCloudProperties `json:"cloud_properties,omitempty"`
}

Network properties

func (Network) AsRegistryNetwork

func (n Network) AsRegistryNetwork(publicIp string) registry.NetworkSetting

AsRegistryNetwork converts a single network to network setting structure expected by the agent registry

type NetworkCloudProperties

type NetworkCloudProperties struct {
	PrivateNetWorkId string `json:"private-network-id,omitempty"`
	OpenPorts        []Rule `json:"open-ports,omitempty"`
	PolicyName       string `json:"firewall-policy-name,omitempty"`
}

NetworkCloudProperties holds the CPI specific network properties defined in cloud config

type Networks

type Networks map[string]*Network

Networks configured in the environment

func (Networks) AllDynamic

func (ns Networks) AllDynamic() bool

AllDynamic returns true if all the configured networks are dynamic, otherwise false.

func (Networks) AsNetworkConfiguration

func (ns Networks) AsNetworkConfiguration() vm.Networks

AsNetworkConfiguration converts the networks map to vm.Networks suitable for use with the vm.Creator

func (Networks) AsRegistryNetworks

func (ns Networks) AsRegistryNetworks(publicIp string) registry.NetworksSettings

AsRegistryNetworks converts the networks map to network settings structure expected by the agent registry

func (Networks) First

func (ns Networks) First() *Network

First returns the first network in the map. Returns nil if the map is empty

func (Networks) FirstDynamic

func (ns Networks) FirstDynamic() *Network

FirstDynamic returns the first "dynamic" network in the networks map. It returns nil if none exist.

func (Networks) FirstStatic

func (ns Networks) FirstStatic() *Network

FirstStatic returns the first "manual" network in the networks map. It returns nil if none exist.

type Rule

type Rule struct {
	PortFrom *int   `json:"port-from,omitempty"`
	PortTo   *int   `json:"port-to,omitempty"`
	Source   string `json:"source,omitempty"`
}

type SetVMMetadata

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

SetVMMetadata action handles the set_vm_metadata request

func NewSetVMMetadata

func NewSetVMMetadata(c client.Connector, l boshlog.Logger) SetVMMetadata

NewSetVMMetadata creates a SetVMMetadata instance

func (SetVMMetadata) Run

func (sm SetVMMetadata) Run(vmCID VMCID, metadata VMMetadata) (interface{}, error)

Run updates the display name of the VM

type StemcellCID

type StemcellCID string

StemcellCID is an identifier for an image

type StemcellCloudProperties

type StemcellCloudProperties struct {
	Name           string `json:"name,omitempty"`
	Version        string `json:"version,omitempty"`
	ImageID        string `json:"image-id"`
	ImageSourceURL string `json:"image-source-url,omitempty"`
	OSType         string `json:"os-type,omitempty"`
	Architecture   string `json:"architecture,omitempty"`
}

StemcellCloudProperties holds the CPI specific stemcell properties defined in stemcell's manifest

type VMCID

type VMCID string

VMCID is an identifier for an instance

type VMCloudProperties

type VMCloudProperties struct {
	Name           string  `json:"name,omitempty"`
	Datacenter     string  `json:"datacenter,omitempty"`
	InstanceFlavor string  `json:"flavor,omitempty"`
	Cores          int     `json:"cores,omitempty"`
	DiskSize       int     `json:"diskSize,omitempty"`
	EphemeralDisk  int     `json:"ephemeralDiskSize,omitempty"`
	Ram            float32 `json:"ram,omitempty"`
	SSHKey         string  `json:"rsa_key,omitempty"`
	PublicIP       string  `json:"public_ip,omitempty"`
	SSHPairPath    string  `json:"keypair,omitempty"`
	Director       bool    `json:"director,omitempty"`
	LBId           string  `json:"lb-id,omitempty"`
}

VMCloudProperties holds the CPI specific properties defined in cloud-config for creating a instance

type VMMetadata

type VMMetadata map[string]string

VMMetadata contains the BOSH metadata for a vm instance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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