Documentation ¶
Overview ¶
Package operation contains all vCenter objects related operation. Author : Smruti P Mohanty
Copyright (c) 2017 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func GetClusterData(ctx context.Context, pc *property.Collector, clst mo.ClusterComputeResource, ...)
- func GetVMData(ctx context.Context, pc *property.Collector, hst mo.HostSystem, ...)
- func WalkFolder(ctx context.Context, f *object.Folder) ([]types.ManagedObjectReference, []types.ManagedObjectReference)
- func WalkManagedEntity(childEntity types.ManagedObjectReference) (bool, bool)
- type ClusterOperation
- type ClusterStruct
- type DatacenterOperation
- func (dcops *DatacenterOperation) CreateCluster(datacenter *object.Datacenter, clustername string) (*object.ClusterComputeResource, error)
- func (dcops *DatacenterOperation) GetAllCluster(datacenter *object.Datacenter) ([]mo.ClusterComputeResource, error)
- func (dcops *DatacenterOperation) GetCluster(clustername string) (mo.ClusterComputeResource, error)
- func (dcops *DatacenterOperation) GetHostFolder(datacenter *object.Datacenter) *object.Folder
- func (dcops *DatacenterOperation) GetStandAloneHosts(datacenter *object.Datacenter) []mo.HostSystem
- type HostOperation
- type HostStruct
- type VCenter
- func (vcenter *VCenter) Connect(ctx context.Context) error
- func (vcenter *VCenter) CreateDataCenter(ctx context.Context, dcname string) (*object.Datacenter, error)
- func (vcenter *VCenter) GetAllDatacenter(ctx context.Context) ([]*object.Datacenter, error)
- func (vcenter *VCenter) GetDatacenter(ctx context.Context, dcname string) (*object.Datacenter, error)
- type VMOperation
- type VMStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClusterData ¶
func GetClusterData(ctx context.Context, pc *property.Collector, clst mo.ClusterComputeResource, clus chan ClusterStruct, getvm bool)
GetClusterData is used by getvcinventory in example. It Returns Clusters and its child object. Do not change this sample.
func GetVMData ¶
func GetVMData(ctx context.Context, pc *property.Collector, hst mo.HostSystem, vmchan chan []VMStruct)
GetVMData is used by getvcinventory in example. It Returns VM Objects and its power state.
func WalkFolder ¶
func WalkFolder(ctx context.Context, f *object.Folder) ([]types.ManagedObjectReference, []types.ManagedObjectReference)
WalkFolder is used to Walk the Folder of a Inventory Object
func WalkManagedEntity ¶
func WalkManagedEntity(childEntity types.ManagedObjectReference) (bool, bool)
WalkManagedEntity is used to Walk through the child entity of a Managed ENtity
Types ¶
type ClusterOperation ¶
ClusterOperation is the Reciever Object For all Cluster Operation
func (*ClusterOperation) GetAllClusterHosts ¶
func (cops *ClusterOperation) GetAllClusterHosts(clst mo.ClusterComputeResource, powerstate string) ([]mo.HostSystem, error)
GetAllClusterHosts Returns all the Hosts in a given Cluster Object.
type ClusterStruct ¶
type ClusterStruct struct { Cluster string Hosts []HostStruct }
ClusterStruct is used for storing Cluster Name and the Arrays of Host Name within the cluster.
type DatacenterOperation ¶
DatacenterOperation is the Reciever Object For all Datacenter Operation
func (*DatacenterOperation) CreateCluster ¶
func (dcops *DatacenterOperation) CreateCluster(datacenter *object.Datacenter, clustername string) (*object.ClusterComputeResource, error)
CreateCluster creates a Cluster under a specified datacenter object.
func (*DatacenterOperation) GetAllCluster ¶
func (dcops *DatacenterOperation) GetAllCluster(datacenter *object.Datacenter) ([]mo.ClusterComputeResource, error)
GetAllCluster Returns all the cluster object under a data center
func (*DatacenterOperation) GetCluster ¶
func (dcops *DatacenterOperation) GetCluster(clustername string) (mo.ClusterComputeResource, error)
GetCluster Returns cluster object under a data center when a cluster name is passed to it.
func (*DatacenterOperation) GetHostFolder ¶
func (dcops *DatacenterOperation) GetHostFolder(datacenter *object.Datacenter) *object.Folder
GetHostFolder Returns the HostFolder of a Datacenter. Used for Creation of Cluster and Addition of standalone Hosts.
func (*DatacenterOperation) GetStandAloneHosts ¶
func (dcops *DatacenterOperation) GetStandAloneHosts(datacenter *object.Datacenter) []mo.HostSystem
GetStandAloneHosts Returns all the Standalone Hosts Objects in a Cluster
type HostOperation ¶
HostOperation is the Reciever Object For all Host Operation
func (*HostOperation) GetAllVMs ¶
func (hostops *HostOperation) GetAllVMs(hst mo.HostSystem) ([]mo.VirtualMachine, error)
GetAllVMs Returns All VMs Objects in a Host Object
type HostStruct ¶
HostStruct is used to store Hostname, its powerstate and the VMs that it contains.
type VCenter ¶
VCenter represents a vCenter server
func NewVCenter ¶
NewVCenter returns a new VCenter instance
func (*VCenter) CreateDataCenter ¶
func (vcenter *VCenter) CreateDataCenter(ctx context.Context, dcname string) (*object.Datacenter, error)
CreateDataCenter creates a datacenter and returns a datacenter object
func (*VCenter) GetAllDatacenter ¶
GetAllDatacenter Returns all the datacenter in a Given vCenter. The vCenter reciever must be connected using vcenter.Connect(ctx) where ctx is the context of type context.Context
func (*VCenter) GetDatacenter ¶
func (vcenter *VCenter) GetDatacenter(ctx context.Context, dcname string) (*object.Datacenter, error)
GetDatacenter Returns datacenter object when a datacenter name in a Given vCenter is passed to it. The vCenter reciever must be connected using vcenter.Connect(ctx) where ctx is the context of type context.Context
type VMOperation ¶
VMOperation is the Reciever Object For all VM Operation
func (*VMOperation) CloneVM ¶
func (vmops *VMOperation) CloneVM(newVMName string, poweron bool, host *mo.HostSystem, template *object.VirtualMachine, cluster *mo.ClusterComputeResource, datacenter *object.Datacenter, datastore *mo.Datastore) (*object.VirtualMachine, types.TaskInfoState)
CloneVM Clones a VM