apiv1

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCloudID

func NewCloudID(cid string) cloudID

func NewCloudKVs

func NewCloudKVs(val map[string]interface{}) cloudKVs

Types

type Action

type Action interface{}

type ActionFactory

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

func NewActionFactory

func NewActionFactory(cpiFactory CPIFactory) ActionFactory

func (ActionFactory) Create

func (f ActionFactory) Create(method string, apiVersion int, context CallContext) (interface{}, error)

type AgentEnv

type AgentEnv interface {
	AttachSystemDisk(DiskHint)
	AttachEphemeralDisk(DiskHint)
	AttachPersistentDisk(DiskCID, DiskHint)
	DetachPersistentDisk(DiskCID)
	AsBytes() ([]byte, error)
	// contains filtered or unexported methods
}

type AgentEnvFactory

type AgentEnvFactory struct{}

func NewAgentEnvFactory

func NewAgentEnvFactory() AgentEnvFactory

func (AgentEnvFactory) ForVM

func (f AgentEnvFactory) ForVM(
	agentID AgentID, cid VMCID, networks Networks, env VMEnv, agentOptions AgentOptions) AgentEnv

func (AgentEnvFactory) FromBytes

func (f AgentEnvFactory) FromBytes(bytes []byte) (AgentEnv, error)

type AgentEnvImpl

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

func (AgentEnvImpl) AsBytes

func (ae AgentEnvImpl) AsBytes() ([]byte, error)

func (*AgentEnvImpl) AttachEphemeralDisk

func (ae *AgentEnvImpl) AttachEphemeralDisk(hint DiskHint)

func (*AgentEnvImpl) AttachPersistentDisk

func (ae *AgentEnvImpl) AttachPersistentDisk(cid DiskCID, hint DiskHint)

todo better type for hint

func (*AgentEnvImpl) AttachSystemDisk

func (ae *AgentEnvImpl) AttachSystemDisk(hint DiskHint)

func (*AgentEnvImpl) DetachPersistentDisk

func (ae *AgentEnvImpl) DetachPersistentDisk(cid DiskCID)

type AgentID

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

func NewAgentID

func NewAgentID(id string) AgentID

func (AgentID) AsString

func (c AgentID) AsString() string

func (AgentID) MarshalJSON

func (c AgentID) MarshalJSON() ([]byte, error)

func (*AgentID) UnmarshalJSON

func (c *AgentID) UnmarshalJSON(data []byte) error

type AgentOptions

type AgentOptions struct {
	Mbus      string   // e.g. "https://user:password@127.0.0.1:4321/agent"
	NTP       []string // e.g. ["0.us.pool.ntp.org"]. Ok to be empty
	Blobstore BlobstoreOptions
}

func (AgentOptions) Validate

func (o AgentOptions) Validate() error

type BlobstoreOptions

type BlobstoreOptions struct {
	Type    string `json:"provider"`
	Options map[string]interface{}
}

func (BlobstoreOptions) Validate

func (o BlobstoreOptions) Validate() error

type BlobstoreSpec

type BlobstoreSpec struct {
	Provider string                 `json:"provider"`
	Options  map[string]interface{} `json:"options"`
}

type CPI

type CPI interface {
	Info() (Info, error)
	CPIV1
	CPIV2Additions
}

type CPIFactory

type CPIFactory interface {
	New(CallContext) (CPI, error)
}

type CPIV1 added in v0.1.0

type CPIV1 interface {
	StemcellsV1
	VMsV1
	DisksV1
	SnapshotsV1
}

type CPIV2Additions added in v0.1.0

type CPIV2Additions interface {
	VMsV2Additions
	DisksV2Additions
}

type CallContext

type CallContext interface {
	As(interface{}) error
}

type CloudPropsImpl

type CloudPropsImpl struct {
	json.RawMessage
}

func (CloudPropsImpl) As

func (c CloudPropsImpl) As(val interface{}) error

func (CloudPropsImpl) MarshalJSON

func (c CloudPropsImpl) MarshalJSON() ([]byte, error)

type DiskCID

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

func NewDiskCID

func NewDiskCID(cid string) DiskCID

func (DiskCID) AsString

func (c DiskCID) AsString() string

func (DiskCID) MarshalJSON

func (c DiskCID) MarshalJSON() ([]byte, error)

func (*DiskCID) UnmarshalJSON

func (c *DiskCID) UnmarshalJSON(data []byte) error

type DiskCloudProps

type DiskCloudProps interface {
	As(interface{}) error
	// contains filtered or unexported methods
}

type DiskHint added in v0.1.0

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

func NewDiskHintFromMap added in v0.1.0

func NewDiskHintFromMap(val map[string]interface{}) DiskHint

func NewDiskHintFromString added in v0.1.0

func NewDiskHintFromString(val string) DiskHint

func (DiskHint) MarshalJSON added in v0.1.0

func (i DiskHint) MarshalJSON() ([]byte, error)

func (*DiskHint) UnmarshalJSON added in v0.1.0

func (i *DiskHint) UnmarshalJSON(data []byte) error

type DiskMeta added in v0.1.0

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

func NewDiskMeta added in v0.1.0

func NewDiskMeta(meta map[string]interface{}) DiskMeta

func (DiskMeta) MarshalJSON added in v0.1.0

func (c DiskMeta) MarshalJSON() ([]byte, error)

func (*DiskMeta) UnmarshalJSON added in v0.1.0

func (c *DiskMeta) UnmarshalJSON(data []byte) error

type DisksSpec

type DisksSpec struct {
	System     DiskHint       `json:"system"`
	Ephemeral  DiskHint       `json:"ephemeral"`
	Persistent PersistentSpec `json:"persistent"`
}

type DisksV1 added in v0.1.0

type DisksV1 interface {
	CreateDisk(int, DiskCloudProps, *VMCID) (DiskCID, error)
	DeleteDisk(DiskCID) error

	AttachDisk(VMCID, DiskCID) error
	DetachDisk(VMCID, DiskCID) error
	SetDiskMetadata(DiskCID, DiskMeta) error

	HasDisk(DiskCID) (bool, error)
	ResizeDisk(DiskCID, int) error
}

type DisksV2Additions added in v0.1.0

type DisksV2Additions interface {
	AttachDiskV2(VMCID, DiskCID) (DiskHint, error)
}

type EnvSpec

type EnvSpec map[string]interface{}

type Info

type Info struct {
	APIVersion      int      `json:"api_version"` // filled automatically
	StemcellFormats []string `json:"stemcell_formats"`
}

type Network

type Network interface {
	Type() string

	IP() string
	Netmask() string
	Gateway() string

	DNS() []string
	Default() []string

	SetMAC(string)
	SetDNS([]string)
	SetPreconfigured()

	CloudProps() NetworkCloudProps

	// Misc
	IsDynamic() bool
	IsDefaultFor(string) bool
	IPWithSubnetMask() string
	// contains filtered or unexported methods
}

func NewNetwork

func NewNetwork(opts NetworkOpts) Network

type NetworkCloudProps

type NetworkCloudProps interface {
	As(interface{}) error
}

type NetworkImpl

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

func (NetworkImpl) CloudProps

func (n NetworkImpl) CloudProps() NetworkCloudProps

func (NetworkImpl) DNS

func (n NetworkImpl) DNS() []string

func (NetworkImpl) Default

func (n NetworkImpl) Default() []string

func (NetworkImpl) Gateway

func (n NetworkImpl) Gateway() string

func (NetworkImpl) IP

func (n NetworkImpl) IP() string

func (NetworkImpl) IPWithSubnetMask

func (n NetworkImpl) IPWithSubnetMask() string

func (NetworkImpl) IsDefaultFor

func (n NetworkImpl) IsDefaultFor(what string) bool

func (NetworkImpl) IsDynamic

func (n NetworkImpl) IsDynamic() bool

func (NetworkImpl) MarshalJSON added in v0.1.0

func (n NetworkImpl) MarshalJSON() ([]byte, error)

func (NetworkImpl) Netmask

func (n NetworkImpl) Netmask() string

func (*NetworkImpl) SetDNS

func (n *NetworkImpl) SetDNS(nameservers []string)

func (*NetworkImpl) SetMAC

func (n *NetworkImpl) SetMAC(mac string)

func (*NetworkImpl) SetPreconfigured

func (n *NetworkImpl) SetPreconfigured()

func (NetworkImpl) Type

func (n NetworkImpl) Type() string

type NetworkOpts

type NetworkOpts struct {
	Type string

	IP      string
	Netmask string
	Gateway string

	DNS     []string
	Default []string

	CloudProps CloudPropsImpl `json:"cloud_properties"`
}

type NetworkSpec

type NetworkSpec struct {
	Type string `json:"type"`

	IP      string `json:"ip"`
	Netmask string `json:"netmask"`
	Gateway string `json:"gateway"`

	DNS     []string `json:"dns"`
	Default []string `json:"default"`

	MAC string `json:"mac"`

	Preconfigured bool `json:"preconfigured"`
}

type Networks

type Networks map[string]Network

func (Networks) BackfillDefaultDNS

func (ns Networks) BackfillDefaultDNS(nameservers []string)

func (Networks) Default

func (ns Networks) Default() Network

func (*Networks) UnmarshalJSON

func (ns *Networks) UnmarshalJSON(data []byte) error

type NetworksSpec

type NetworksSpec map[string]NetworkSpec

type PersistentSpec

type PersistentSpec map[string]DiskHint

type SnapshotCID added in v0.1.0

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

func NewSnapshotCID added in v0.1.0

func NewSnapshotCID(cid string) SnapshotCID

func (SnapshotCID) AsString added in v0.1.0

func (c SnapshotCID) AsString() string

func (SnapshotCID) MarshalJSON added in v0.1.0

func (c SnapshotCID) MarshalJSON() ([]byte, error)

func (*SnapshotCID) UnmarshalJSON added in v0.1.0

func (c *SnapshotCID) UnmarshalJSON(data []byte) error

type SnapshotsV1 added in v0.1.0

type SnapshotsV1 interface {
	SnapshotDisk(DiskCID, DiskMeta) (SnapshotCID, error)
	DeleteSnapshot(SnapshotCID) error
}

type StemcellAPIVersion added in v0.1.0

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

func NewStemcellAPIVersion added in v0.1.0

func NewStemcellAPIVersion(ctx CallContext) StemcellAPIVersion

func (StemcellAPIVersion) Value added in v0.1.0

func (s StemcellAPIVersion) Value() (int, error)

type StemcellCID

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

func NewStemcellCID

func NewStemcellCID(cid string) StemcellCID

func (StemcellCID) AsString

func (c StemcellCID) AsString() string

func (StemcellCID) MarshalJSON

func (c StemcellCID) MarshalJSON() ([]byte, error)

func (*StemcellCID) UnmarshalJSON

func (c *StemcellCID) UnmarshalJSON(data []byte) error

type StemcellCloudProps

type StemcellCloudProps interface {
	As(interface{}) error
}

type StemcellsV1 added in v0.1.0

type StemcellsV1 interface {
	CreateStemcell(string, StemcellCloudProps) (StemcellCID, error)
	DeleteStemcell(StemcellCID) error
}

type VMCID

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

func NewVMCID

func NewVMCID(cid string) VMCID

func (VMCID) AsString

func (c VMCID) AsString() string

func (VMCID) MarshalJSON

func (c VMCID) MarshalJSON() ([]byte, error)

func (*VMCID) UnmarshalJSON

func (c *VMCID) UnmarshalJSON(data []byte) error

type VMCloudProps

type VMCloudProps interface {
	As(interface{}) error
	// contains filtered or unexported methods
}

type VMCloudPropsImpl added in v0.1.0

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

func NewVMCloudPropsFromMap added in v0.1.0

func NewVMCloudPropsFromMap(val map[string]interface{}) VMCloudPropsImpl

func (VMCloudPropsImpl) As added in v0.1.0

func (i VMCloudPropsImpl) As(val interface{}) error

func (VMCloudPropsImpl) MarshalJSON added in v0.1.0

func (i VMCloudPropsImpl) MarshalJSON() ([]byte, error)

type VMEnv

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

func NewVMEnv

func NewVMEnv(env map[string]interface{}) VMEnv

func (VMEnv) MarshalJSON

func (c VMEnv) MarshalJSON() ([]byte, error)

func (*VMEnv) UnmarshalJSON

func (c *VMEnv) UnmarshalJSON(data []byte) error

type VMMeta

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

func NewVMMeta

func NewVMMeta(meta map[string]interface{}) VMMeta

func (VMMeta) MarshalJSON

func (c VMMeta) MarshalJSON() ([]byte, error)

func (*VMMeta) UnmarshalJSON

func (c *VMMeta) UnmarshalJSON(data []byte) error

type VMResources added in v0.1.0

type VMResources struct {
	RAM               int    `json:"ram"`
	CPU               int    `json:"cpu"`
	EphemeralDiskSize int    `json:"ephemeral_disk_size"`
	Audio             string `json:"audio"`
}

type VMSpec

type VMSpec struct {
	Name string `json:"name"`
	ID   string `json:"id"`
}

type VMsV1 added in v0.1.0

type VMsV1 interface {
	CreateVM(AgentID, StemcellCID, VMCloudProps, Networks, []DiskCID, VMEnv) (VMCID, error)
	DeleteVM(VMCID) error

	CalculateVMCloudProperties(VMResources) (VMCloudProps, error)

	SetVMMetadata(VMCID, VMMeta) error
	HasVM(VMCID) (bool, error)

	RebootVM(VMCID) error
	GetDisks(VMCID) ([]DiskCID, error)
}

type VMsV2Additions added in v0.1.0

type VMsV2Additions interface {
	CreateVMV2(AgentID, StemcellCID, VMCloudProps, Networks, []DiskCID, VMEnv) (VMCID, Networks, error)
}

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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