vsphere

package
v0.0.0-...-e73b65a Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DetailParam = base.DetailParam
	NameParam   = base.NameParam
)

Fields.

View Source
const (
	ClusterParam      = "cluster"
	ClusterCollection = "clusters"
	ClustersRoot      = ProviderRoot + "/" + ClusterCollection
	ClusterRoot       = ClustersRoot + "/:" + ClusterParam
)

Routes.

View Source
const (
	DatacenterParam      = "datacenter"
	DatacenterCollection = "datacenters"
	DatacentersRoot      = ProviderRoot + "/" + DatacenterCollection
	DatacenterRoot       = DatacentersRoot + "/:" + DatacenterParam
)

Routes.

View Source
const (
	DatastoreParam      = "datastore"
	DatastoreCollection = "datastores"
	DatastoresRoot      = ProviderRoot + "/" + DatastoreCollection
	DatastoreRoot       = DatastoresRoot + "/:" + DatastoreParam
)

Routes.

View Source
const (
	FolderParam      = "folder"
	FolderCollection = "folders"
	FoldersRoot      = ProviderRoot + "/" + FolderCollection
	FolderRoot       = FoldersRoot + "/:" + FolderParam
)

Routes.

View Source
const (
	HostParam      = "host"
	HostCollection = "hosts"
	HostsRoot      = ProviderRoot + "/" + HostCollection
	HostRoot       = HostsRoot + "/:" + HostParam
)

Routes

View Source
const (
	NetworkParam      = "network"
	NetworkCollection = "networks"
	NetworksRoot      = ProviderRoot + "/" + NetworkCollection
	NetworkRoot       = NetworksRoot + "/:" + NetworkParam
)

Routes.

View Source
const (
	ProviderParam = base.ProviderParam
	ProvidersRoot = Root
	ProviderRoot  = ProvidersRoot + "/:" + ProviderParam
)

Routes.

View Source
const (
	TreeRoot     = ProviderRoot + "/tree"
	TreeHostRoot = TreeRoot + "/host"
	TreeVmRoot   = TreeRoot + "/vm"
)

Routes.

View Source
const (
	VMParam      = "vm"
	VMCollection = "vms"
	VMsRoot      = ProviderRoot + "/" + VMCollection
	VMRoot       = VMsRoot + "/:" + VMParam
)

Routes.

View Source
const (
	WorkloadCollection = "workloads"
	WorkloadsRoot      = ProviderRoot + "/" + WorkloadCollection
	WorkloadRoot       = WorkloadsRoot + "/:" + VMParam
)

Routes.

View Source
const (
	Root = base.ProvidersRoot + "/" + string(api.VSphere)
)

Routes

Variables

This section is empty.

Functions

func Handlers

func Handlers(container *container.Container) []libweb.RequestHandler

Build all handlers.

Types

type AdapterBuilder

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

Build (and set) adapter list in the host.

type Cluster

type Cluster struct {
	Resource
	Folder      string      `json:"folder"`
	Networks    []model.Ref `json:"networks"`
	Datastores  []model.Ref `json:"datastores"`
	Hosts       []model.Ref `json:"hosts"`
	DasEnabled  bool        `json:"dasEnabled"`
	DasVms      []model.Ref `json:"dasVms"`
	DrsEnabled  bool        `json:"drsEnabled"`
	DrsBehavior string      `json:"drsBehavior"`
	DrsVms      []model.Ref `json:"drsVms"`
}

REST Resource.

func (*Cluster) Content

func (r *Cluster) Content(detail int) interface{}

As content.

func (r *Cluster) Link(p *api.Provider)

Build self link (URI).

func (*Cluster) With

func (r *Cluster) With(m *model.Cluster)

Build the resource using the model.

type ClusterHandler

type ClusterHandler struct {
	Handler
	// contains filtered or unexported fields
}

Cluster handler.

func (*ClusterHandler) AddRoutes

func (h *ClusterHandler) AddRoutes(e *gin.Engine)

Add routes to the `gin` router.

func (ClusterHandler) Get

func (h ClusterHandler) Get(ctx *gin.Context)

Get a specific REST resource.

func (ClusterHandler) List

func (h ClusterHandler) List(ctx *gin.Context)

List resources in a REST collection. A GET onn the collection that includes the `X-Watch` header will negotiate an upgrade of the connection to a websocket and push watch events.

type Datacenter

type Datacenter struct {
	Resource
	Datastores model.Ref `json:"datastores"`
	Networks   model.Ref `json:"networks"`
	Clusters   model.Ref `json:"clusters"`
	VMs        model.Ref `json:"vms"`
}

REST Resource.

func (*Datacenter) Content

func (r *Datacenter) Content(detail int) interface{}

As content.

func (r *Datacenter) Link(p *api.Provider)

Build self link (URI).

func (*Datacenter) With

func (r *Datacenter) With(m *model.Datacenter)

Build the resource using the model.

type DatacenterHandler

type DatacenterHandler struct {
	Handler
	// contains filtered or unexported fields
}

Datacenter handler.

func (*DatacenterHandler) AddRoutes

func (h *DatacenterHandler) AddRoutes(e *gin.Engine)

Add routes to the `gin` router.

func (DatacenterHandler) Get

func (h DatacenterHandler) Get(ctx *gin.Context)

Get a specific REST resource.

func (DatacenterHandler) List

func (h DatacenterHandler) List(ctx *gin.Context)

List resources in a REST collection. A GET onn the collection that includes the `X-Watch` header will negotiate an upgrade of the connection to a websocket and push watch events.

type Datastore

type Datastore struct {
	Resource
	Type            string `json:"type"`
	Capacity        int64  `json:"capacity"`
	Free            int64  `json:"free"`
	MaintenanceMode string `json:"maintenance"`
}

REST Resource.

func (*Datastore) Content

func (r *Datastore) Content(detail int) interface{}

As content.

func (r *Datastore) Link(p *api.Provider)

Build self link (URI).

func (*Datastore) With

func (r *Datastore) With(m *model.Datastore)

Build the resource using the model.

type DatastoreHandler

type DatastoreHandler struct {
	Handler
}

Datastore handler.

func (*DatastoreHandler) AddRoutes

func (h *DatastoreHandler) AddRoutes(e *gin.Engine)

Add routes to the `gin` router.

func (DatastoreHandler) Get

func (h DatastoreHandler) Get(ctx *gin.Context)

Get a specific REST resource.

func (DatastoreHandler) List

func (h DatastoreHandler) List(ctx *gin.Context)

List resources in a REST collection. A GET onn the collection that includes the `X-Watch` header will negotiate an upgrade of the connection to a websocket and push watch events.

type Finder

type Finder struct {
	base.Client
}

Resource finder.

func (*Finder) ByRef

func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error)

Find a resource by ref. Returns:

ProviderNotSupportedErr
ProviderNotReadyErr
NotFoundErr
RefNotUniqueErr

func (*Finder) Host

func (r *Finder) Host(ref *base.Ref) (object interface{}, err error)

Find host by ref. Returns the matching resource and:

ProviderNotSupportedErr
ProviderNotReadyErr
NotFoundErr
RefNotUniqueErr

func (*Finder) Network

func (r *Finder) Network(ref *base.Ref) (object interface{}, err error)

Find a Network by ref. Returns the matching resource and:

ProviderNotSupportedErr
ProviderNotReadyErr
NotFoundErr
RefNotUniqueErr

func (*Finder) Storage

func (r *Finder) Storage(ref *base.Ref) (object interface{}, err error)

Find storage by ref. Returns the matching resource and:

ProviderNotSupportedErr
ProviderNotReadyErr
NotFoundErr
RefNotUniqueErr

func (*Finder) VM

func (r *Finder) VM(ref *base.Ref) (object interface{}, err error)

Find a VM by ref. Returns the matching resource and:

ProviderNotSupportedErr
ProviderNotReadyErr
NotFoundErr
RefNotUniqueErr

func (*Finder) With

func (r *Finder) With(client base.Client) base.Finder

With client.

func (*Finder) Workload

func (r *Finder) Workload(ref *base.Ref) (object interface{}, err error)

Find workload by ref. Returns the matching resource and:

ProviderNotSupportedErr
ProviderNotReadyErr
NotFoundErr
RefNotUniqueErr

type Folder

type Folder struct {
	Resource
	Folder     string      `json:"folder"`
	Datacenter string      `json:"datacenter"`
	Children   []model.Ref `json:"children"`
}

REST Resource.

func (*Folder) Content

func (r *Folder) Content(detail int) interface{}

Content.

func (r *Folder) Link(p *api.Provider)

Build self link (URI).

func (*Folder) With

func (r *Folder) With(m *model.Folder)

Build the resource using the model.

type FolderHandler

type FolderHandler struct {
	Handler
	// contains filtered or unexported fields
}

Folder handler.

func (*FolderHandler) AddRoutes

func (h *FolderHandler) AddRoutes(e *gin.Engine)

Add routes to the `gin` router.

func (FolderHandler) Get

func (h FolderHandler) Get(ctx *gin.Context)

Get a specific REST resource.

func (FolderHandler) List

func (h FolderHandler) List(ctx *gin.Context)

List resources in a REST collection. A GET onn the collection that includes the `X-Watch` header will negotiate an upgrade of the connection to a websocket and push watch events.

type Handler

type Handler struct {
	base.Handler
}

Base handler.

func (Handler) ListOptions

func (h Handler) ListOptions(ctx *gin.Context) libmodel.ListOptions

Build list options.

func (Handler) Predicate

func (h Handler) Predicate(ctx *gin.Context) (p libmodel.Predicate)

Build list predicate.

type Host

type Host struct {
	Resource
	Cluster            string            `json:"cluster"`
	Status             string            `json:"status"`
	InMaintenanceMode  bool              `json:"inMaintenance"`
	ManagementServerIp string            `json:"managementServerIp"`
	Thumbprint         string            `json:"thumbprint"`
	Timezone           string            `json:"timezone"`
	CpuSockets         int16             `json:"cpuSockets"`
	CpuCores           int16             `json:"cpuCores"`
	ProductName        string            `json:"productName"`
	ProductVersion     string            `json:"productVersion"`
	Network            model.HostNetwork `json:"networking"`
	Networks           []model.Ref       `json:"networks"`
	Datastores         []model.Ref       `json:"datastores"`
	VMs                []model.Ref       `json:"vms"`
	NetworkAdapters    []NetworkAdapter  `json:"networkAdapters"`
}

REST Resource.

func (*Host) Content

func (r *Host) Content(detail int) interface{}

As content.

func (r *Host) Link(p *api.Provider)

Build self link (URI).

func (*Host) With

func (r *Host) With(m *model.Host)

Build the resource using the model.

type HostHandler

type HostHandler struct {
	Handler
}

Host handler.

func (*HostHandler) AddRoutes

func (h *HostHandler) AddRoutes(e *gin.Engine)

Add routes to the `gin` router.

func (HostHandler) Get

func (h HostHandler) Get(ctx *gin.Context)

Get a specific REST resource.

func (HostHandler) List

func (h HostHandler) List(ctx *gin.Context)

List resources in a REST collection. A GET onn the collection that includes the `X-Watch` header will negotiate an upgrade of the connection to a websocket and push watch events.

type HostNavigator

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

Host (tree) navigator.

func (*HostNavigator) Next

func (n *HostNavigator) Next(p libmodel.Model) (r []libmodel.Model, err error)

Next (children) on the branch.

type Network

type Network struct {
	Resource
	Variant  string          `json:"variant"`
	DVSwitch *model.Ref      `json:"dvSwitch,omitempty"`
	Host     []model.DVSHost `json:"host"`
	Tag      string          `json:"tag,omitempty"`
	Key      string          `json:"key,omitempty"`
}

REST Resource.

func (*Network) Content

func (r *Network) Content(detail int) interface{}

As content.

func (r *Network) Link(p *api.Provider)

Build self link (URI).

func (*Network) With

func (r *Network) With(m *model.Network)

Build the resource using the model.

type NetworkAdapter

type NetworkAdapter struct {
	Name       string `json:"name"`
	IpAddress  string `json:"ipAddress"`
	SubnetMask string `json:"subnetMask"`
	LinkSpeed  int32  `json:"linkSpeed"`
	MTU        int32  `json:"mtu"`
}

Host network adapter.

type NetworkHandler

type NetworkHandler struct {
	Handler
}

Network handler.

func (*NetworkHandler) AddRoutes

func (h *NetworkHandler) AddRoutes(e *gin.Engine)

Add routes to the `gin` router.

func (NetworkHandler) Get

func (h NetworkHandler) Get(ctx *gin.Context)

Get a specific REST resource.

func (NetworkHandler) List

func (h NetworkHandler) List(ctx *gin.Context)

List resources in a REST collection. A GET onn the collection that includes the `X-Watch` header will negotiate an upgrade of the connection to a websocket and push watch events.

type NodeBuilder

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

Tree node builder.

func (*NodeBuilder) Node

func (r *NodeBuilder) Node(parent *TreeNode, m libmodel.Model) *TreeNode

Build a node for the model.

type NotFoundError

type NotFoundError = base.NotFoundError

type PathBuilder

type PathBuilder struct {
	// Database.
	DB libmodel.DB
	// contains filtered or unexported fields
}

Path builder.

func (*PathBuilder) Path

func (r *PathBuilder) Path(m model.Model) (path string)

Determine object path.

type Provider

type Provider struct {
	ocp.Resource
	Type            string       `json:"type"`
	Object          api.Provider `json:"object"`
	APIVersion      string       `json:"apiVersion"`
	Product         string       `json:"product"`
	DatacenterCount int64        `json:"datacenterCount"`
	ClusterCount    int64        `json:"clusterCount"`
	HostCount       int64        `json:"hostCount"`
	VMCount         int64        `json:"vmCount"`
	NetworkCount    int64        `json:"networkCount"`
	DatastoreCount  int64        `json:"datastoreCount"`
}

REST Resource.

func (*Provider) Content

func (r *Provider) Content(detail int) interface{}

As content.

func (r *Provider) Link()

Build self link (URI).

func (*Provider) With

func (r *Provider) With(m *model.Provider)

Set fields with the specified object.

type ProviderHandler

type ProviderHandler struct {
	base.Handler
}

Provider handler.

func (ProviderHandler) AddDerived

func (h ProviderHandler) AddDerived(r *Provider) (err error)

Add derived fields.

func (*ProviderHandler) AddRoutes

func (h *ProviderHandler) AddRoutes(e *gin.Engine)

Add routes to the `gin` router.

func (ProviderHandler) Get

func (h ProviderHandler) Get(ctx *gin.Context)

Get a specific REST resource.

func (ProviderHandler) List

func (h ProviderHandler) List(ctx *gin.Context)

List resources in a REST collection.

func (*ProviderHandler) ListContent

func (h *ProviderHandler) ListContent(ctx *gin.Context) (content []interface{}, err error)

Build the list content.

type RefNotUniqueError

type RefNotUniqueError = base.RefNotUniqueError

type Resolver

type Resolver struct {
	*api.Provider
}

API path resolver.

func (*Resolver) Path

func (r *Resolver) Path(resource interface{}, id string) (path string, err error)

Build the URL path.

type Resource

type Resource struct {
	// Object ID.
	ID string `json:"id"`
	// Variant
	Variant string `json:"variant,omitempty"`
	// Parent.
	Parent model.Ref `json:"parent"`
	// Path
	Path string `json:"path,omitempty"`
	// Revision
	Revision int64 `json:"revision"`
	// Object name.
	Name string `json:"name"`
	// Self link.
	SelfLink string `json:"selfLink"`
}

REST Resource.

func (*Resource) With

func (r *Resource) With(m *model.Base)

Build the resource using the model.

type ResourceNotResolvedError

type ResourceNotResolvedError = base.ResourceNotResolvedError

Errors.

type Tree

type Tree = base.Tree

Types.

type TreeHandler

type TreeHandler struct {
	Handler
	// contains filtered or unexported fields
}

Tree handler.

func (*TreeHandler) AddRoutes

func (h *TreeHandler) AddRoutes(e *gin.Engine)

Add routes to the `gin` router.

func (TreeHandler) Get

func (h TreeHandler) Get(ctx *gin.Context)

Get not supported.

func (TreeHandler) HostTree

func (h TreeHandler) HostTree(ctx *gin.Context)

Cluster & Host Tree.

func (TreeHandler) List

func (h TreeHandler) List(ctx *gin.Context)

List not supported.

func (*TreeHandler) Prepare

func (h *TreeHandler) Prepare(ctx *gin.Context) int

Prepare to handle the request.

func (TreeHandler) VmTree

func (h TreeHandler) VmTree(ctx *gin.Context)

VM Tree.

type TreeNode

type TreeNode = base.TreeNode

type VM

type VM struct {
	VM1
	PolicyVersion         int            `json:"policyVersion"`
	UUID                  string         `json:"uuid"`
	Firmware              string         `json:"firmware"`
	ConnectionState       string         `json:"connectionState"`
	Snapshot              model.Ref      `json:"snapshot"`
	ChangeTrackingEnabled bool           `json:"changeTrackingEnabled"`
	CpuAffinity           []int32        `json:"cpuAffinity"`
	CpuHotAddEnabled      bool           `json:"cpuHotAddEnabled"`
	CpuHotRemoveEnabled   bool           `json:"cpuHotRemoveEnabled"`
	MemoryHotAddEnabled   bool           `json:"memoryHotAddEnabled"`
	FaultToleranceEnabled bool           `json:"faultToleranceEnabled"`
	CpuCount              int32          `json:"cpuCount"`
	CoresPerSocket        int32          `json:"coresPerSocket"`
	MemoryMB              int32          `json:"memoryMB"`
	GuestName             string         `json:"guestName"`
	GuestID               string         `json:"guestId"`
	BalloonedMemory       int32          `json:"balloonedMemory"`
	IpAddress             string         `json:"ipAddress"`
	StorageUsed           int64          `json:"storageUsed"`
	NumaNodeAffinity      []string       `json:"numaNodeAffinity"`
	Devices               []model.Device `json:"devices"`
	NICs                  []model.NIC    `json:"nics"`
}

VM full detail.

func (*VM) Content

func (r *VM) Content(detail int) interface{}

As content.

func (r *VM) Link(p *api.Provider)

Build self link (URI).

func (*VM) With

func (r *VM) With(m *model.VM)

Build the resource using the model.

type VM0

type VM0 = Resource

VM detail=0

type VM1

type VM1 struct {
	VM0
	RevisionValidated int64           `json:"revisionValidated"`
	IsTemplate        bool            `json:"isTemplate"`
	PowerState        string          `json:"powerState"`
	Host              string          `json:"host"`
	Networks          []model.Ref     `json:"networks"`
	Disks             []model.Disk    `json:"disks"`
	Concerns          []model.Concern `json:"concerns"`
}

VM detail=1

func (*VM1) Content

func (r *VM1) Content(detail int) interface{}

As content.

func (*VM1) With

func (r *VM1) With(m *model.VM)

Build the resource using the model.

type VMHandler

type VMHandler struct {
	Handler
}

Virtual Machine handler.

func (*VMHandler) AddRoutes

func (h *VMHandler) AddRoutes(e *gin.Engine)

Add routes to the `gin` router.

func (VMHandler) Get

func (h VMHandler) Get(ctx *gin.Context)

Get a specific REST resource.

func (VMHandler) List

func (h VMHandler) List(ctx *gin.Context)

List resources in a REST collection. A GET onn the collection that includes the `X-Watch` header will negotiate an upgrade of the connection to a websocket and push watch events.

type VMNavigator

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

VM (tree) navigator.

func (*VMNavigator) Next

func (n *VMNavigator) Next(p libmodel.Model) (r []libmodel.Model, err error)

Next (children) on the branch.

type Workload

type Workload struct {
	SelfLink string `json:"selfLink"`
	VM
	Host struct {
		Host
		Cluster struct {
			Cluster
			Datacenter *Datacenter `json:"datacenter"`
		} `json:"cluster"`
	} `json:"host"`
}

Workload

func (*Workload) Expand

func (r *Workload) Expand(db libmodel.DB) (err error)

Expand the resource.

func (r *Workload) Link(p *api.Provider)

Build self link (URI).

func (*Workload) With

func (r *Workload) With(m *model.VM)

type WorkloadHandler

type WorkloadHandler struct {
	Handler
}

Virtual Machine handler.

func (*WorkloadHandler) AddRoutes

func (h *WorkloadHandler) AddRoutes(e *gin.Engine)

Add routes to the `gin` router.

func (WorkloadHandler) Get

func (h WorkloadHandler) Get(ctx *gin.Context)

Get a specific REST resource.

func (WorkloadHandler) List

func (h WorkloadHandler) List(ctx *gin.Context)

List resources in a REST collection.

Jump to

Keyboard shortcuts

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