vsphere

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 32 Imported by: 35

Documentation

Overview

Package vsphere collects vSphere-specific configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClusterNetworks

func GetClusterNetworks(ctx context.Context, finder Finder, datacenter, cluster string) ([]types.ManagedObjectReference, error)

GetClusterNetworks returns a slice of Managed Object references for vSphere networks in the given Datacenter and Cluster.

func GetNetworkMo

func GetNetworkMo(ctx context.Context, client *vim25.Client, finder Finder, datacenter, cluster, network string) (*types.ManagedObjectReference, error)

GetNetworkMo returns the unique Managed Object for given network name inside of the given Datacenter and Cluster.

func GetNetworkMoID

func GetNetworkMoID(ctx context.Context, client *vim25.Client, finder Finder, datacenter, cluster, network string) (string, error)

GetNetworkMoID returns the unique Managed Object ID for given network name inside of the given Datacenter and Cluster.

func GetNetworkName

func GetNetworkName(ctx context.Context, client *vim25.Client, ref types.ManagedObjectReference) (string, error)

GetNetworkName returns the name of a vSphere network given its Managed Object reference.

func Platform

func Platform() (*vsphere.Platform, error)

Platform collects vSphere-specific configuration.

func Validate

func Validate(ic *types.InstallConfig) error

Validate executes platform-specific validation.

func ValidateForProvisioning

func ValidateForProvisioning(ic *types.InstallConfig) error

ValidateForProvisioning performs platform validation specifically for multi-zone installer-provisioned infrastructure. In this case, self-hosted networking is a requirement when the installer creates infrastructure for vSphere clusters.

Types

type AuthManager

type AuthManager interface {
	FetchUserPrivilegeOnEntities(ctx context.Context, entities []vim25types.ManagedObjectReference, userName string) ([]vim25types.UserPrivilegeResult, error)
	Properties(ctx context.Context, r vim25types.ManagedObjectReference, ps []string, dst interface{}) error
	Reference() vim25types.ManagedObjectReference
}

AuthManager defines an interface to an implementation of the AuthorizationManager to facilitate mocking

type ClientLogout

type ClientLogout func()

ClientLogout is empty function that logs out of vSphere clients

func CreateVSphereClients

func CreateVSphereClients(ctx context.Context, vcenter, username, password string) (*vim25.Client, *rest.Client, ClientLogout, error)

CreateVSphereClients creates the SOAP and REST client to access different portions of the vSphere API e.g. tags are only available in REST

type Finder

type Finder interface {
	Datacenter(ctx context.Context, path string) (*object.Datacenter, error)
	DatacenterList(ctx context.Context, path string) ([]*object.Datacenter, error)
	DatastoreList(ctx context.Context, path string) ([]*object.Datastore, error)
	ClusterComputeResource(ctx context.Context, path string) (*object.ClusterComputeResource, error)
	ClusterComputeResourceList(ctx context.Context, path string) ([]*object.ClusterComputeResource, error)
	Folder(ctx context.Context, path string) (*object.Folder, error)
	NetworkList(ctx context.Context, path string) ([]object.NetworkReference, error)
	Network(ctx context.Context, path string) (object.NetworkReference, error)
	ResourcePool(ctx context.Context, path string) (*object.ResourcePool, error)
}

Finder interface represents the client that is used to connect to VSphere to get specific information from the resources in the VCenter. This interface just describes all the useful functions used by the installer from the finder function in vmware govmomi package and is mostly used to create a mock client that can be used for testing.

func NewFinder

func NewFinder(client *vim25.Client, all ...bool) Finder

NewFinder creates a new client that conforms with the Finder interface and returns a vmware govmomi finder object that can be used to search for resources in vsphere.

type PermissionGroupDefinition

type PermissionGroupDefinition struct {
	/* Permissions array of privileges which correlate with the privileges listed in docs */
	Permissions []string
	/* Description friendly description of privilege group */
	Description string
}

PermissionGroupDefinition defines a group of permissions and a related human friendly description

type PrivilegeRelevanceFunc

type PrivilegeRelevanceFunc func(*vspheretypes.Platform) bool

PrivilegeRelevanceFunc returns true if the associated privilege group privileges should be verified

type SessionManager

type SessionManager interface {
	UserSession(ctx context.Context) (*vim25types.UserSession, error)
}

SessionManager defines an interface to an implementation of the SessionManager to facilitate mocking.

type TagManager

type TagManager interface {
	ListCategories(ctx context.Context) ([]string, error)
	GetCategories(ctx context.Context) ([]vapitags.Category, error)
	GetCategory(ctx context.Context, id string) (*vapitags.Category, error)
	GetTagsForCategory(ctx context.Context, id string) ([]vapitags.Tag, error)
	GetAttachedTags(ctx context.Context, ref mo.Reference) ([]vapitags.Tag, error)
	GetAttachedTagsOnObjects(ctx context.Context, objectID []mo.Reference) ([]vapitags.AttachedTags, error)
}

TagManager defines an interface to an implementation of the AuthorizationManager to facilitate mocking.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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