apiv1

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 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, context CallContext) (interface{}, error)

type AgentEnv

type AgentEnv interface {
	AttachSystemDisk(interface{})
	AttachEphemeralDisk(interface{})
	AttachPersistentDisk(DiskCID, interface{})
	DetachPersistentDisk(DiskCID)
	AsBytes() ([]byte, error)
}

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

func (*AgentEnvImpl) AttachPersistentDisk

func (ae *AgentEnvImpl) AttachPersistentDisk(cid DiskCID, hint interface{})

todo better type for hint

func (*AgentEnvImpl) AttachSystemDisk

func (ae *AgentEnvImpl) AttachSystemDisk(hint interface{})

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)
	Stemcells
	VMs
	Disks
	Snapshots
}

type CPIFactory

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

type CallContext

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

type CloudPropsImpl

type CloudPropsImpl struct {
	json.RawMessage
}

func (CloudPropsImpl) As

func (p 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
}

type Disks

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

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

	HasDisk(DiskCID) (bool, error)
}

type DisksSpec

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

type EnvSpec

type EnvSpec map[string]interface{}

type Info

type Info struct {
	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) 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]interface{}

type Snapshots

type Snapshots interface {
}

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 Stemcells

type Stemcells 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
}

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 VMSpec

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

type VMs

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

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

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

Directories

Path Synopsis
This file was generated by counterfeiter This file was generated by counterfeiter
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