client

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package client is the main client for the CloudAvenue provider.

Package client is the main client for the CloudAvenue provider.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyOrgNameProvided = errors.New("empty Org name provided")
	ErrEmptyVDCNameProvided = errors.New("empty VDC name provided")
	ErrRetrievingOrg        = errors.New("error retrieving Org")
	ErrRetrievingOrgAdmin   = errors.New("error retrieving Org admin")
	ErrEmptyOrgFound        = errors.New("empty Org found")
	ErrRetrievingVDC        = errors.New("error retrieving VDC")
	ErrRetrievingAdminVDC   = errors.New("error retrieving AdminVDC")
	ErrRetrievingVDCGroup   = errors.New("error retrieving VDC Group")
	ErrEmptyVDCFound        = errors.New("empty VDC found")
)

Functions

This section is empty.

Types

type AdminOrg

type AdminOrg struct {
	*govcd.AdminOrg
}

func (*AdminOrg) GetOrgVAppLeaseSettings added in v0.2.0

func (ao *AdminOrg) GetOrgVAppLeaseSettings() *govcdtypes.VAppLeaseSettings

GetOrgVAppLeaseSettings retrieves the lease settings for a vApp in the specified organization.

func (*AdminOrg) ListCatalogs

func (ao *AdminOrg) ListCatalogs() *govcdtypes.CatalogsList

ListCatalogs

Get the catalogs list from the admin org.

type AdminVDC added in v0.3.0

type AdminVDC struct {
	*govcd.AdminVdc
	// contains filtered or unexported fields
}

func (AdminVDC) GetID added in v0.3.0

func (v AdminVDC) GetID() string

func (AdminVDC) GetName added in v0.3.0

func (v AdminVDC) GetName() string

type CloudAvenue

type CloudAvenue struct {
	// API VMWARE
	Vmware *govcd.VCDClient // Deprecated

	// SDK CLOUDAVENUE
	CAVSDK     *clientca.Client
	CAVSDKOpts *clientca.ClientOpts
}

CloudAvenue is the main struct for the CloudAvenue client.

func (*CloudAvenue) DefaultAdminVDCExist added in v0.3.0

func (c *CloudAvenue) DefaultAdminVDCExist() bool

func (*CloudAvenue) DefaultVDCExist

func (c *CloudAvenue) DefaultVDCExist() bool

DefaultVDCExist returns true if the default VDC exists.

func (*CloudAvenue) GetAdminOrg

func (c *CloudAvenue) GetAdminOrg() (*AdminOrg, error)

GetAdminOrg return the admin org using the name provided in the provider.

func (CloudAvenue) GetAdminVDC added in v0.3.0

func (c CloudAvenue) GetAdminVDC(opts ...GetAdminVDCOpts) (*AdminVDC, error)

GetAdminVdc return the admin vdc using the name provided in the provider.

func (*CloudAvenue) GetAffinityRule added in v0.3.0

func (c *CloudAvenue) GetAffinityRule(affinityRuleID string) (affinityRule *govcd.VdcComputePolicyV2, err error)

getAffinityRule retrieves an affinity rule by name.

func (*CloudAvenue) GetBootImage added in v0.3.0

func (c *CloudAvenue) GetBootImage(bootImageID string) (bootImage *govcdtypes.Media, err error)

GetBootImage retrieves a boot image by ID.

func (*CloudAvenue) GetDefaultVDC

func (c *CloudAvenue) GetDefaultVDC() string

GetDefaultVDC returns the default VDC.

func (*CloudAvenue) GetOrg

func (c *CloudAvenue) GetOrg() (*Org, error)

GetOrg return the org using the name provided in the provider.

func (*CloudAvenue) GetOrgAndVDC

func (c *CloudAvenue) GetOrgAndVDC(orgName, vdcName string) (org *govcd.Org, vdcOrVDCGroup VDCOrVDCGroupHandler, err error)

! Deprecated

GetOrgAndVDC

finds a pair of org and vdc using the names provided in the args. If the names are empty, it will use the default org and vdc names from the provider.

DEPRECATED: use GetOrg, GetVDC, GetVDCGroup or GetVDCOrVDCGroup instead.

func (*CloudAvenue) GetOrgName

func (c *CloudAvenue) GetOrgName() string

GetOrgName() returns the name of the organization.

func (*CloudAvenue) GetTemplate added in v0.3.0

func (c *CloudAvenue) GetTemplate(iD string) (vAppTemplate *govcd.VAppTemplate, err error)

GetTemplate retrieves a vApp template by name or ID.

func (*CloudAvenue) GetTemplateWithVMName added in v0.3.0

func (c *CloudAvenue) GetTemplateWithVMName(iD, vmName string) (vAppTemplate *govcd.VAppTemplate, err error)

GetTemplateWithVMName retrieves a vApp template with a VM name.

func (*CloudAvenue) GetURL

func (c *CloudAvenue) GetURL() string

GetURL returns the base path of the API.

func (*CloudAvenue) GetUserName added in v0.15.0

func (c *CloudAvenue) GetUserName() string

GetUserName() returns the name of the user.

func (*CloudAvenue) GetVDC

func (c *CloudAvenue) GetVDC(opts ...GetVDCOpts) (*VDC, error)

GetVDC return the vdc using the name provided in the argument. If the name is empty, it will try to use the default vdc provided in the provider.

func (*CloudAvenue) GetVDCGroup

func (c *CloudAvenue) GetVDCGroup(vdcGroupName string) (*VDCGroup, error)

GetVDCGroup return the vdc group using the name provided in the argument.

func (*CloudAvenue) GetVDCOrVDCGroup

func (c *CloudAvenue) GetVDCOrVDCGroup(vdcOrVDCGroupName string) (VDCOrVDCGroupHandler, error)

GetVDCOrVDCGroup return the vdc or vdc group using the name provided in the argument.

func (*CloudAvenue) New

func (c *CloudAvenue) New() (*CloudAvenue, error)

New creates a new CloudAvenue client.

type GetAdminVDCOpts added in v0.3.0

type GetAdminVDCOpts func(*AdminVDC)

func WithAdminVDCName added in v0.3.0

func WithAdminVDCName(name string) GetAdminVDCOpts

type GetVDCOpts

type GetVDCOpts func(*VDC)

func WithVDCName

func WithVDCName(name string) GetVDCOpts

type Org

type Org struct {
	*govcd.Org
}

func (*Org) DeleteNetworkDHCP added in v0.6.0

func (o *Org) DeleteNetworkDHCP(orgNetworkID string) error

DeleteNetworkDHCP deletes the DHCP object for the org network provided in parameter.

func (*Org) GetID

func (o *Org) GetID() string

Returns the ID of the organization.

func (*Org) GetName

func (o *Org) GetName() string

Returns the name of the organization.

func (*Org) GetNetworkDHCP added in v0.6.0

func (o *Org) GetNetworkDHCP(orgNetworkID string) (*govcd.OpenApiOrgVdcNetworkDhcp, error)

GetNetworkDHCP returns the DHCP object for the org network provided in parameter.

func (*Org) UpdateNetworkDHCP added in v0.6.0

func (o *Org) UpdateNetworkDHCP(orgNetworkID string, dhcpParameters *govcdtypes.OpenApiOrgVdcNetworkDhcp) error

UpdateNetworkDHCP updates the DHCP object for the org network provided in parameter.

type VAPP

type VAPP struct {
	*govcd.VApp
}

func (VAPP) GetDeploymentLeaseInSeconds added in v0.2.0

func (v VAPP) GetDeploymentLeaseInSeconds() int

GetDeploymentLeaseInSeconds retrieves the lease duration in seconds for a deployment.

func (VAPP) GetDescription

func (v VAPP) GetDescription() string

GetDescription give you the status code of the vApp.

func (VAPP) GetHREF

func (v VAPP) GetHREF() string

GetHREF give you the HREF of the vApp.

func (VAPP) GetID

func (v VAPP) GetID() string

GetID give you the ID of the vApp.

func (VAPP) GetName

func (v VAPP) GetName() string

GetName give you the name of the vApp.

func (VAPP) GetStatusCode

func (v VAPP) GetStatusCode() int

GetStatusCode give you the status code of the vApp.

func (VAPP) GetStorageLeaseInSeconds added in v0.2.0

func (v VAPP) GetStorageLeaseInSeconds() int

GetStorageLeaseInSeconds retrieves the lease duration in seconds for a storage resource.

func (VAPP) IsVAPPNetwork added in v0.3.0

func (v VAPP) IsVAPPNetwork(networkName string) (bool, error)

IsVAPPNetwork check if it is a vApp network (not vApp Org Network).

func (VAPP) IsVAPPOrgNetwork added in v0.3.0

func (v VAPP) IsVAPPOrgNetwork(networkName string) (bool, error)

IsVAPPOrgNetwork check if it is a vApp Org Network (not vApp network).

type VDC

type VDC struct {
	*govcd.Vdc
	// contains filtered or unexported fields
}

func (VDC) CreateVAPP added in v0.2.0

func (v VDC) CreateVAPP(name, description string) (*VAPP, error)

CreateVAPP create new vApp.

func (VDC) GetDefaultPlacementPolicyID added in v0.3.0

func (v VDC) GetDefaultPlacementPolicyID() string

GetDefaultPlacementPolicyID give you the ID of the default placement policy.

func (VDC) GetID

func (v VDC) GetID() string

GetID give you the ID of the vDC.

func (VDC) GetIPSetByID added in v0.7.0

func (v VDC) GetIPSetByID(id string) (*govcd.NsxtFirewallGroup, error)

GetIPSetByID return the NSX-T firewall group using the ID provided in the argument.

func (VDC) GetIPSetByName added in v0.7.0

func (v VDC) GetIPSetByName(name string) (*govcd.NsxtFirewallGroup, error)

GetIPSetByName return the NSX-T firewall group using the name provided in the argument.

func (VDC) GetIPSetByNameOrID added in v0.7.0

func (v VDC) GetIPSetByNameOrID(nameOrID string) (*govcd.NsxtFirewallGroup, error)

GetIPSetByNameOrId return the NSX-T firewall group using the name or ID provided in the argument.

func (VDC) GetName

func (v VDC) GetName() string

GetName give you the name of the vDC.

func (VDC) GetSecurityGroupByID added in v0.6.0

func (v VDC) GetSecurityGroupByID(nsxtFirewallGroupID string) (*govcd.NsxtFirewallGroup, error)

GetSecurityGroupByID return the NSX-T security group using the ID provided in the argument.

func (VDC) GetSecurityGroupByName added in v0.6.0

func (v VDC) GetSecurityGroupByName(nsxtFirewallGroupName string) (*govcd.NsxtFirewallGroup, error)

GetSecurityGroupByName return the NSX-T security group using the name provided in the argument.

func (VDC) GetSecurityGroupByNameOrID added in v0.6.0

func (v VDC) GetSecurityGroupByNameOrID(nsxtFirewallGroupNameOrID string) (*govcd.NsxtFirewallGroup, error)

GetSecurityGroupByNameOrID return the NSX-T security group using the name or ID provided in the argument.

func (VDC) GetVAPP

func (v VDC) GetVAPP(nameOrID string, refresh bool) (*VAPP, error)

GetVAPP give you the vApp using the name provided in the argument.

func (VDC) IsVDCGroup added in v0.6.0

func (v VDC) IsVDCGroup() bool

IsVDCGroup return true if the object is a VDC Group.

func (VDC) SetIPSet added in v0.7.0

func (v VDC) SetIPSet(ipSetConfig *govcdtypes.NsxtFirewallGroup) (*govcd.NsxtFirewallGroup, error)

SetIPSet set the NSX-T firewall group using the name provided in the argument.

type VDCGroup

type VDCGroup struct {
	*govcd.VdcGroup
}

func (VDCGroup) GetID

func (g VDCGroup) GetID() string

GetID give you the ID of the vDC Group.

func (VDCGroup) GetIPSetByID added in v0.7.0

func (g VDCGroup) GetIPSetByID(id string) (*govcd.NsxtFirewallGroup, error)

GetIPSetByID return the NSX-T firewall group using the ID provided in the argument.

func (VDCGroup) GetIPSetByName added in v0.7.0

func (g VDCGroup) GetIPSetByName(name string) (*govcd.NsxtFirewallGroup, error)

GetIPSetByName return the NSX-T firewall group using the name provided in the argument.

func (VDCGroup) GetIPSetByNameOrID added in v0.7.0

func (g VDCGroup) GetIPSetByNameOrID(nameOrID string) (*govcd.NsxtFirewallGroup, error)

GetIPSetByNameOrID return the NSX-T firewall group using the name or ID provided in the argument.

func (VDCGroup) GetName

func (g VDCGroup) GetName() string

GetName give you the name of the vDC Group.

func (VDCGroup) GetSecurityGroupByID added in v0.6.0

func (g VDCGroup) GetSecurityGroupByID(nsxtFirewallGroupID string) (*govcd.NsxtFirewallGroup, error)

GetSecurityGroupByID return the NSX-T security group using the ID provided in the argument.

func (VDCGroup) GetSecurityGroupByName added in v0.6.0

func (g VDCGroup) GetSecurityGroupByName(nsxtFirewallGroupName string) (*govcd.NsxtFirewallGroup, error)

GetSecurityGroupByName return the NSX-T security group using the name provided in the argument.

func (VDCGroup) GetSecurityGroupByNameOrID added in v0.6.0

func (g VDCGroup) GetSecurityGroupByNameOrID(nsxtFirewallGroupNameOrID string) (*govcd.NsxtFirewallGroup, error)

GetSecurityGroupByNameOrID return the NSX-T security group using the name or ID provided in the argument.

func (VDCGroup) IsVDCGroup added in v0.6.0

func (g VDCGroup) IsVDCGroup() bool

IsVDCGroup return true if the object is a VDC Group.

func (VDCGroup) SetIPSet added in v0.7.0

func (g VDCGroup) SetIPSet(ipSetConfig *govcdtypes.NsxtFirewallGroup) (*govcd.NsxtFirewallGroup, error)

SetIPSet set the NSX-T firewall group using the name provided in the argument.

type VDCOrVDCGroupHandler

type VDCOrVDCGroupHandler interface {
	// * Global Get
	GetName() string
	GetID() string

	// * Global Is
	IsVDCGroup() bool

	// * Network
	GetOpenApiOrgVdcNetworkByName(string) (*govcd.OpenApiOrgVdcNetwork, error)

	// * Security Group
	GetSecurityGroupByID(nsxtFirewallGroupID string) (*govcd.NsxtFirewallGroup, error)
	GetSecurityGroupByName(nsxtFirewallGroupName string) (*govcd.NsxtFirewallGroup, error)
	GetSecurityGroupByNameOrID(nsxtFirewallGroupNameOrID string) (*govcd.NsxtFirewallGroup, error)

	// * IP Set
	GetIPSetByID(id string) (*govcd.NsxtFirewallGroup, error)
	GetIPSetByName(name string) (*govcd.NsxtFirewallGroup, error)
	GetIPSetByNameOrID(nameOrID string) (*govcd.NsxtFirewallGroup, error)
	SetIPSet(ipSetConfig *govcdtypes.NsxtFirewallGroup) (*govcd.NsxtFirewallGroup, error)
}

VDCOrVDCGroupHandler is an interface to access some common methods on VDC or VDC Group without explicitly handling exact types.

type VM added in v0.3.0

type VM struct {
	*govcd.VM
}

func (VM) CpusCoresIsDefined added in v0.3.0

func (v VM) CpusCoresIsDefined() bool

CpusCoresIsDefined returns true if the number of cores per CPU of a VM is defined.

func (VM) CpusIsDefined added in v0.3.0

func (v VM) CpusIsDefined() bool

CpusIsDefined returns true if the number of CPUs of a VM is defined.

func (VM) GetAffinityRuleID added in v0.3.0

func (v VM) GetAffinityRuleID() string

GetAffinityRuleID returns the affinity rule ID of a VM.

func (VM) GetAffinityRuleIDOrDefault added in v0.3.0

func (v VM) GetAffinityRuleIDOrDefault() (string, error)

GetAffinityRuleIDOrDefault returns the affinity rule ID of a VM or the default affinity rule ID if the VM has no affinity rule ID.

func (VM) GetCPUHotAddEnabled added in v0.3.0

func (v VM) GetCPUHotAddEnabled() bool

GetCPUHotAddEnabled returns the hot add of a VM.

func (VM) GetCpus added in v0.3.0

func (v VM) GetCpus() int

GetCpus returns the number of CPUs of a VM.

func (VM) GetCpusCores added in v0.3.0

func (v VM) GetCpusCores() int

GetCpusCores returns the number of cores per CPU of a VM.

func (VM) GetCustomization added in v0.3.0

func (v VM) GetCustomization() (guestCustomization *govcdtypes.GuestCustomizationSection, err error)

GetCustomization returns the customization of a VM.

func (VM) GetDefaultAffinityRuleID added in v0.3.0

func (v VM) GetDefaultAffinityRuleID() (string, error)

GetDefaultAffinityRuleID returns the default affinity rule ID of a VM.

func (VM) GetExposeHardwareVirtualization added in v0.3.0

func (v VM) GetExposeHardwareVirtualization() bool

GetExposeHardwareVirtualization returns the expose hardware virtualization of a VM.

func (VM) GetGuestProperties added in v0.3.0

func (v VM) GetGuestProperties() (guestProperties []*govcdtypes.Property, err error)

* Guest properties GetGuestProperties returns the guest properties of a VM.

func (VM) GetMemory added in v0.3.0

func (v VM) GetMemory() int64

GetMemory returns the memory of a VM.

func (VM) GetMemoryHotAddEnabled added in v0.3.0

func (v VM) GetMemoryHotAddEnabled() bool

GetMemoryHotAddEnabled returns the hot add of a VM.

func (VM) GetNetworkConnection added in v0.3.0

func (v VM) GetNetworkConnection() (networkConnections []*govcdtypes.NetworkConnection)

GetNetworkConnection returns the network connection of a VM.

func (VM) GetOSType added in v0.3.0

func (v VM) GetOSType() string

GetOSType returns the OS type of a VM.

func (VM) GetStorageProfileName added in v0.3.0

func (v VM) GetStorageProfileName() string

GetStorageProfileName returns the storage profile name of a VM.

func (VM) HotAddIsDefined added in v0.3.0

func (v VM) HotAddIsDefined() bool

HotAddIsDefined returns true if the hot add of a VM is defined.

func (VM) MemoryIsDefined added in v0.3.0

func (v VM) MemoryIsDefined() bool

MemoryIsDefined returns true if the memory of a VM is defined.

func (VM) NetworkConnectionIsDefined added in v0.3.0

func (v VM) NetworkConnectionIsDefined() bool

NetworkConnectionIsDefined checks if a network connection is defined.

func (VM) SetCustomization added in v0.3.0

func (v VM) SetCustomization(guestCustomization *govcdtypes.GuestCustomizationSection) (err error)

SetCustomization sets the customization of a VM.

func (VM) SetExposeHardwareVirtualization added in v0.3.0

func (v VM) SetExposeHardwareVirtualization(isEnabled bool) (err error)

SetExposeHardwareVirtualization sets the expose hardware virtualization of a VM.

func (VM) SetGuestProperties added in v0.3.0

func (v VM) SetGuestProperties(guestProperties map[string]string) (err error)

SetGuestProperties sets the guest properties of a VM If the guest property already exists, it will be updated.

func (VM) SetOSType added in v0.3.0

func (v VM) SetOSType(osType string) (err error)

SetOSType sets the OS type of a VM.

Jump to

Keyboard shortcuts

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