action

package
v8.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: Apache-2.0, UPL-1.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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, _ DiskCloudProperties, vmCID VMCID) (DiskCID, error)

Run creates a persistent block volume 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

Run extracts the image URL from the properties and delegates to StemcellCreator for creating an image

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, _ []DiskCID, env Environment) (VMCID, error)

Run creates an instance for the given configuration in OCI.

If the instance is configured to be created in a manual network it assigns the given private IP to that instance.

For dynamic network where the instance is not assigned an IP, it queries the IPs assigned to the new instance. In addition, if a SSHTunnel is configured it creates a forward tunnel to the public IP of that instance.

Finally, it updates the agent registry with details of the new instance

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 volume.

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 {
}

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 volumes 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 volume 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 Info

type Info struct{}

Info action handles the info() request

func NewInfo

func NewInfo() Info

NewInfo creates a new Info instance

func (Info) Run

func (i Info) Run() (StemcellInfo, error)

Run returns information about the stemcell(s) supported by this CPI.

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() registry.NetworkSetting

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

type NetworkCloudProperties

type NetworkCloudProperties struct {
	VcnName    string `json:"vcn,omitempty"`
	SubnetName string `json:"subnet_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() 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 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"`
	// Deprecated: Light stemcells with image-ocid attribute are deprecated and
	// will be removed prior to GA.  Use stemcells with image-source-url attribute
	// instead.
	ImageOCID      string `json:"image-ocid,omitempty"`
	ImageSourceURL string `json:"image-source-url,omitempty"`
}

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

type StemcellInfo

type StemcellInfo struct {
	Formats []string `json:"stemcell_formats"`
}

StemcellInfo contains info about stemcells supported by this CPI

type VMCID

type VMCID string

VMCID is an identifier for an instance

type VMCloudProperties

type VMCloudProperties struct {
	Name               string `json:"name,omitempty"`
	Shape              string `json:"instance_shape"`
	AvailabilityDomain string `json:"availability_domain"`
}

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