govcd

package
v2.16.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 31 Imported by: 55

Documentation

Overview

Package govcd provides a simple binding for vCloud Director REST APIs.

Contains auxiliary functions to show library entities structure. Used for debugging and testing.

  • Copyright 2021 VMware, Inc. All rights reserved. Licensed under the Apache v2 License.

  • Copyright 2021 VMware, Inc. All rights reserved. Licensed under the Apache v2 License.

  • Copyright 2021 VMware, Inc. All rights reserved. Licensed under the Apache v2 License.

Index

Constants

View Source
const (
	OrgUserRoleOrganizationAdministrator = "Organization Administrator"
	OrgUserRoleCatalogAuthor             = "Catalog Author"
	OrgUserRoleVappAuthor                = "vApp Author"
	OrgUserRoleVappUser                  = "vApp User"
	OrgUserRoleConsoleAccessOnly         = "Console Access Only"
	OrgUserRoleDeferToIdentityProvider   = "Defer to Identity Provider"

	// Allowed values for provider types
	OrgUserProviderIntegrated = "INTEGRATED" // The user is created locally or imported from LDAP
	OrgUserProviderSAML       = "SAML"       // The user is imported from a SAML identity provider.
	OrgUserProviderOAUTH      = "OAUTH"      // The user is imported from an OAUTH identity provider
)
View Source
const ApiTokenHeader = "API-token"
View Source
const AuthorizationHeader = "X-Vcloud-Authorization"

AuthorizationHeader header key used by default to set the authorization token.

View Source
const BearerTokenHeader = "X-Vmware-Vcloud-Access-Token"

BearerTokenHeader is the header key containing a bearer token

Variables

View Source
var ErrorEntityNotFound = fmt.Errorf(errorEntityNotFoundMessage)

Used to check the validity of provider type on creation

View Source
var (

	// SupportedMetadataTypes are the metadata types recognized so far. "NONE" is the same as ""
	SupportedMetadataTypes = []string{"NONE", "STRING", "NUMBER", "BOOLEAN", "DATETIME"}
)

Functions

func BuildUrnWithUuid added in v2.9.0

func BuildUrnWithUuid(urnPrefix, uuid string) (string, error)

BuildUrnWithUuid helps to build valid URNs where APIs require URN format, but other API responds with UUID (or extracted from HREF)

func ContainsNotFound added in v2.3.0

func ContainsNotFound(err error) bool

ContainsNotFound is a convenience function, similar to os.IsNotExist that checks whether a given error contains a "Not found" error. It is almost the same as `IsNotFound` but checks if an error contains substring ErrorEntityNotFound

func FindMissingImpliedRights added in v2.12.0

func FindMissingImpliedRights(client *Client, rights []types.OpenApiReference) ([]types.OpenApiReference, error)

FindMissingImpliedRights returns a list of the rights that are implied in the rights provided as input

func GetAllNetworkContextProfiles added in v2.15.0

func GetAllNetworkContextProfiles(client *Client, queryParameters url.Values) ([]*types.NsxtNetworkContextProfile, error)

GetAllNetworkContextProfiles retrieves a slice of types.NsxtNetworkContextProfile This function requires at least a filter value for 'context_id' which can be one of: * Org VDC ID - to get Network Context Profiles scoped for VDC * Network provider ID - to get Network Context Profiles scoped for attached NSX-T environment * VDC Group ID - to get Network Context Profiles scoped for attached NSX-T environment

func GetExternalNetworkByName deprecated

func GetExternalNetworkByName(vcdClient *VCDClient, networkName string) (*types.ExternalNetworkReference, error)

Deprecated: please use GetExternalNetwork function instead

func GetNetworkContextProfilesByNameScopeAndContext added in v2.15.0

func GetNetworkContextProfilesByNameScopeAndContext(client *Client, name, scope, contextId string) (*types.NsxtNetworkContextProfile, error)

GetNetworkContextProfilesByScopeAndName retrieves a single NSX-T Network Context Profile by name and context ID. All fields - name, scope and contextId are mandatory

contextId is mandatory and can be one off: * Org VDC ID - to get Network Context Profiles scoped for VDC * Network provider ID - to get Network Context Profiles scoped for attached NSX-T environment * VDC Group ID - to get Network Context Profiles scoped for attached NSX-T environment

scope can be one off: * SYSTEM * PROVIDER * TENANT

func GetNetworkPoolByHREF added in v2.3.0

func GetNetworkPoolByHREF(client *VCDClient, href string) (*types.VMWNetworkPool, error)

GetNetworkPoolByHREF functions fetches an network pool using VDC client and network pool href

func GetStorageProfileByHref added in v2.4.0

func GetStorageProfileByHref(vcdClient *VCDClient, url string) (*types.VdcStorageProfile, error)

GetStorageProfileByHref fetches storage profile using provided HREF. Deprecated: use client.GetStorageProfileByHref or vcdClient.GetStorageProfileByHref

func GetUuidFromHref added in v2.6.0

func GetUuidFromHref(href string, idAtEnd bool) (string, error)

Returns the UUID part of an HREF Similar to getBareEntityUuid, but tailored to HREF

func IsNotFound added in v2.3.0

func IsNotFound(err error) bool

IsNotFound is a convenience function, similar to os.IsNotExist that checks whether a given error is a "Not found" error, such as

if isNotFound(err) {
   // do what is needed in case of not found
}

func IsUuid added in v2.9.0

func IsUuid(identifier string) bool

IsUuid returns true if the identifier is a bare UUID

func IsVappNetwork added in v2.8.0

func IsVappNetwork(networkConfig *types.NetworkConfiguration) bool

IsVappNetwork allows to identify if given network config is a vApp network and not a vApp Org network

func LogAdminCatalog

func LogAdminCatalog(catalog types.AdminCatalog)

func LogAdminOrg

func LogAdminOrg(org types.AdminOrg)

func LogCatalog

func LogCatalog(catalog types.Catalog)

func LogCatalogItem

func LogCatalogItem(catalogItem types.CatalogItem)

func LogDisk

func LogDisk(disk types.Disk)

func LogEdgeGateway added in v2.7.0

func LogEdgeGateway(edgeGateway types.EdgeGateway)

func LogExternalNetwork

func LogExternalNetwork(network types.ExternalNetwork)

func LogNetwork

func LogNetwork(conf types.OrgVDCNetwork)

func LogOrg

func LogOrg(org types.Org)

func LogTask

func LogTask(task *types.Task, howManyTimes int, elapsed time.Duration, first, last bool)

func LogUser added in v2.3.0

func LogUser(user types.User)

func LogVapp

func LogVapp(vapp types.VApp)

func LogVdc

func LogVdc(vdc types.Vdc)

func LogVm added in v2.11.0

func LogVm(vm types.Vm)

func OwnerIsVdc added in v2.15.0

func OwnerIsVdc(urn string) bool

OwnerIsVdc evaluates a given URN and returns true if it is a VDC

func OwnerIsVdcGroup added in v2.15.0

func OwnerIsVdcGroup(urn string) bool

OwnerIsVdcGroup evaluates given URN and returns true if it is a VDC Group

func ParseErr

func ParseErr(bodyType types.BodyType, resp *http.Response, errType error) error

ParseErr takes an error XML resp, error interface for unmarshalling and returns a single string for use in error messages.

func QueryDistributedPortGroup added in v2.2.0

func QueryDistributedPortGroup(vcdCli *VCDClient, name string) ([]*types.PortGroupRecordType, error)

Find a Distributed port group by name

func QueryNetworkPoolByName added in v2.2.0

func QueryNetworkPoolByName(vcdCli *VCDClient, name string) ([]*types.QueryResultNetworkPoolRecordType, error)

QueryNetworkPoolByName finds a network pool by name

func QueryNetworkPortGroup added in v2.2.0

func QueryNetworkPortGroup(vcdCli *VCDClient, name string) ([]*types.PortGroupRecordType, error)

Find a Network port group by name

func QueryOrgVdcNetworkByName added in v2.3.0

func QueryOrgVdcNetworkByName(vcdCli *VCDClient, name string) ([]*types.QueryResultOrgVdcNetworkRecordType, error)

QueryOrgVdcNetworkByName finds a org VDC network by name which has edge gateway as reference

func QueryPortGroups added in v2.2.0

func QueryPortGroups(vcdCli *VCDClient, filter string) ([]*types.PortGroupRecordType, error)

Find a list of Port groups matching the filter parameter.

func QueryProviderVdcByName added in v2.2.0

func QueryProviderVdcByName(vcdCli *VCDClient, name string) ([]*types.QueryResultVMWProviderVdcRecordType, error)

QueryProviderVdcByName finds a provider VDC by name

func QueryProviderVdcStorageProfileByName added in v2.2.0

func QueryProviderVdcStorageProfileByName(vcdCli *VCDClient, name string) ([]*types.QueryResultProviderVdcStorageProfileRecordType, error)

QueryProviderVdcStorageProfileByName finds a provider VDC storage profile by name Deprecated: wrong implementation. Use VCDClient.QueryProviderVdcStorageProfileByName

func QueryVirtualCenters added in v2.2.0

func QueryVirtualCenters(vcdClient *VCDClient, filter string) ([]*types.QueryResultVirtualCenterRecordType, error)

Find a list of Virtual Centers matching the filter parameter. Filter constructing guide: https://pubs.vmware.com/vcloud-api-1-5/wwhelp/wwhimpl/js/html/wwhelp.htm#href=api_prog/GUID-CDF04296-5EB5-47E1-9BEC-228837C584CE.html Possible parameters are any attribute from QueryResultVirtualCenterRecordType struct E.g. filter could look like: name==vC1

func RemoveMediaImageIfExists

func RemoveMediaImageIfExists(vdc Vdc, mediaName string) error

Looks for media and, if found, will delete it. Deprecated: Use catalog.RemoveMediaIfExist

func RemoveOrgVdcNetworkIfExists

func RemoveOrgVdcNetworkIfExists(vdc Vdc, networkName string) error

RemoveOrgVdcNetworkIfExists looks for an Org Vdc network and, if found, will delete it.

func ShowAdminCatalog

func ShowAdminCatalog(catalog types.AdminCatalog)

func ShowAdminOrg

func ShowAdminOrg(org types.AdminOrg)

func ShowCatalog

func ShowCatalog(catalog types.Catalog)

func ShowCatalogItem

func ShowCatalogItem(catalogItem types.CatalogItem)

func ShowDisk

func ShowDisk(disk types.Disk)

func ShowEdgeGateway added in v2.7.0

func ShowEdgeGateway(edgeGateway types.EdgeGateway)

func ShowExternalNetwork

func ShowExternalNetwork(network types.ExternalNetwork)

func ShowNetwork

func ShowNetwork(conf types.OrgVDCNetwork)

func ShowOrg

func ShowOrg(org types.Org)

func ShowTask

func ShowTask(task *types.Task, howManyTimes int, elapsed time.Duration, first, last bool)

func ShowUser added in v2.3.0

func ShowUser(user types.User)

func ShowVapp

func ShowVapp(vapp types.VApp)

func ShowVdc

func ShowVdc(vdc types.Vdc)

func ShowVm added in v2.11.0

func ShowVm(vm types.Vm)

func SimpleLogTask added in v2.3.0

func SimpleLogTask(task *types.Task, howManyTimes int, elapsed time.Duration, first, last bool)

func SimpleShowTask added in v2.3.0

func SimpleShowTask(task *types.Task, howManyTimes int, elapsed time.Duration, first, last bool)

Types

type AdminCatalog

type AdminCatalog struct {
	AdminCatalog *types.AdminCatalog
	// contains filtered or unexported fields
}

AdminCatalog is a admin view of a vCloud Director Catalog To be able to get an AdminCatalog representation, users must have admin credentials to the System org. AdminCatalog is used for creating, updating, and deleting a Catalog. Definition: https://code.vmware.com/apis/220/vcloud#/doc/doc/types/AdminCatalogType.html

func CreateCatalog

func CreateCatalog(client *Client, links types.LinkList, Name, Description string) (AdminCatalog, error)

CreateCatalog creates a catalog with specified name and description

func CreateCatalogWithStorageProfile added in v2.10.0

func CreateCatalogWithStorageProfile(client *Client, links types.LinkList, Name, Description string, storageProfiles *types.CatalogStorageProfiles) (*AdminCatalog, error)

CreateCatalogWithStorageProfile is like CreateCatalog, but allows to specify storage profile

func NewAdminCatalog

func NewAdminCatalog(client *Client) *AdminCatalog

func NewAdminCatalogWithParent added in v2.15.0

func NewAdminCatalogWithParent(client *Client, parent organization) *AdminCatalog

func (*AdminCatalog) AddMetadataEntry added in v2.15.0

func (adminCatalog *AdminCatalog) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds AdminCatalog metadata typedValue and key/value pair provided as input and waits for the task to finish.

func (*AdminCatalog) AddMetadataEntryAsync added in v2.15.0

func (adminCatalog *AdminCatalog) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds AdminCatalog metadata typedValue and key/value pair provided as input and returns the task.

func (*AdminCatalog) Delete

func (adminCatalog *AdminCatalog) Delete(force, recursive bool) error

Delete deletes the Catalog, returning an error if the vCD call fails. Link to API call: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/DELETE-Catalog.html

func (*AdminCatalog) DeleteMetadataEntry added in v2.15.0

func (adminCatalog *AdminCatalog) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes AdminCatalog metadata depending on key provided as input and waits for the task to finish.

func (*AdminCatalog) DeleteMetadataEntryAsync added in v2.15.0

func (adminCatalog *AdminCatalog) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes AdminCatalog metadata depending on key provided as input and returns a task.

func (AdminCatalog) GetAccessControl added in v2.9.0

func (adminCatalog AdminCatalog) GetAccessControl(useTenantContext bool) (*types.ControlAccessParams, error)

GetAccessControl retrieves the access control information for this catalog

func (*AdminCatalog) GetMediaByHref added in v2.4.0

func (adminCatalog *AdminCatalog) GetMediaByHref(mediaHref string) (*Media, error)

GetMediaByHref finds a Media by HREF On success, returns a pointer to the Media structure and a nil error On failure, returns a nil pointer and an error

func (*AdminCatalog) GetMediaById added in v2.4.0

func (adminCatalog *AdminCatalog) GetMediaById(mediaId string) (*Media, error)

GetMediaById finds a Media by ID On success, returns a pointer to the Media structure and a nil error On failure, returns a nil pointer and an error

func (*AdminCatalog) GetMediaByName added in v2.4.0

func (adminCatalog *AdminCatalog) GetMediaByName(mediaName string, refresh bool) (*Media, error)

GetMediaByName finds a Media by Name On success, returns a pointer to the Media structure and a nil error On failure, returns a nil pointer and an error

func (*AdminCatalog) GetMediaByNameOrId added in v2.4.0

func (adminCatalog *AdminCatalog) GetMediaByNameOrId(identifier string, refresh bool) (*Media, error)

GetMediaByNameOrId finds a Media by Name or ID On success, returns a pointer to the Media structure and a nil error On failure, returns a nil pointer and an error

func (*AdminCatalog) GetMetadata added in v2.15.0

func (adminCatalog *AdminCatalog) GetMetadata() (*types.Metadata, error)

GetMetadata returns AdminCatalog metadata.

func (AdminCatalog) IsShared added in v2.9.0

func (adminCatalog AdminCatalog) IsShared(useTenantContext bool) (bool, error)

IsShared shows whether a catalog is shared or not, regardless of the number of subjects sharing it

func (*AdminCatalog) MergeMetadata added in v2.16.0

func (adminCatalog *AdminCatalog) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges AdminCatalog metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*AdminCatalog) MergeMetadataAsync added in v2.16.0

func (adminCatalog *AdminCatalog) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges AdminCatalog metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*AdminCatalog) PublishToExternalOrganizations added in v2.15.0

func (cat *AdminCatalog) PublishToExternalOrganizations(publishExternalCatalog types.PublishExternalCatalogParams) error

PublishToExternalOrganizations publishes a catalog to external organizations.

func (*AdminCatalog) QueryMedia added in v2.4.0

func (adminCatalog *AdminCatalog) QueryMedia(mediaName string) (*MediaRecord, error)

QueryMedia returns media image found in system using `name` and `catalog name` as query.

func (*AdminCatalog) Refresh added in v2.4.0

func (adminCatalog *AdminCatalog) Refresh() error

func (AdminCatalog) RemoveAccessControl added in v2.9.0

func (adminCatalog AdminCatalog) RemoveAccessControl(useTenantContext bool) error

RemoveAccessControl is a shortcut to SetAccessControl with all access disabled

func (*AdminCatalog) RemoveMediaIfExists added in v2.4.0

func (adminCatalog *AdminCatalog) RemoveMediaIfExists(mediaName string) error

Looks for media and, if found, will delete it.

func (AdminCatalog) SetAccessControl added in v2.9.0

func (adminCatalog AdminCatalog) SetAccessControl(accessControl *types.ControlAccessParams, useTenantContext bool) error

SetAccessControl changes the access control information for this catalog

func (*AdminCatalog) Update

func (adminCatalog *AdminCatalog) Update() error

Update updates the Catalog definition from current Catalog struct contents. Any differences that may be legally applied will be updated. Returns an error if the call to vCD fails. Update automatically performs a refresh with the admin catalog it gets back from the rest api Link to API call: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/PUT-Catalog.html

func (*AdminCatalog) UploadOvf

func (adminCatalog *AdminCatalog) UploadOvf(ovaFileName, itemName, description string, uploadPieceSize int64) (UploadTask, error)

UploadOvf uploads an ova file to a catalog. This method only uploads bits to vCD spool area. Returns errors if any occur during upload from vCD or upload process. On upload fail client may need to remove vCD catalog item which waits for files to be uploaded. Files from ova are extracted to system temp folder "govcd+random number" and left for inspection on error.

type AdminOrg

type AdminOrg struct {
	AdminOrg *types.AdminOrg

	TenantContext *TenantContext
	// contains filtered or unexported fields
}

AdminOrg gives an admin representation of an org. Administrators can delete and update orgs with an admin org object. AdminOrg includes all members of the Org element, and adds several elements that can be viewed and modified only by system administrators. Definition: https://code.vmware.com/apis/220/vcloud#/doc/doc/types/AdminOrgType.html

func GetAdminOrgByName

func GetAdminOrgByName(vcdClient *VCDClient, orgName string) (AdminOrg, error)

If user specifies valid organization name, then this returns an admin organization object. If no valid org is found, it returns an empty org and no error. Otherwise returns an empty AdminOrg and an error. API Documentation: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/GET-Organization-AdminView.html Deprecated: Use vcdClient.GetAdminOrgByName instead

func NewAdminOrg

func NewAdminOrg(cli *Client) *AdminOrg

func (*AdminOrg) AddCertificateToLibrary added in v2.14.0

func (adminOrg *AdminOrg) AddCertificateToLibrary(certificateConfig *types.CertificateLibraryItem) (*Certificate, error)

AddCertificateToLibrary uploads certificates with configuration details

func (*AdminOrg) AddMetadataEntry added in v2.15.0

func (adminOrg *AdminOrg) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds AdminOrg metadata key/value pair provided as input to the corresponding organization seen as administrator and waits for completion.

func (*AdminOrg) AddMetadataEntryAsync added in v2.15.0

func (adminOrg *AdminOrg) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds AdminOrg metadata key/value pair provided as input to the corresponding organization seen as administrator and returns a task.

func (*AdminOrg) CreateCatalog

func (adminOrg *AdminOrg) CreateCatalog(name, description string) (AdminCatalog, error)

CreateCatalog creates a catalog with given name and description under the the given organization. Returns an AdminCatalog that contains a creation task. API Documentation: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/POST-CreateCatalog.html

func (*AdminOrg) CreateCatalogWithStorageProfile added in v2.10.0

func (adminOrg *AdminOrg) CreateCatalogWithStorageProfile(name, description string, storageProfiles *types.CatalogStorageProfiles) (*AdminCatalog, error)

CreateCatalogWithStorageProfile is like CreateCatalog, but allows to specify storage profile

func (*AdminOrg) CreateGroup added in v2.8.0

func (adminOrg *AdminOrg) CreateGroup(group *types.Group) (*OrgGroup, error)

CreateGroup creates a group in Org. Supported provider types are `OrgUserProviderIntegrated` and `OrgUserProviderSAML`.

Note. This request will return HTTP 403 if Org is not configured for SAML or LDAP usage.

func (*AdminOrg) CreateNsxtEdgeGateway added in v2.10.0

func (adminOrg *AdminOrg) CreateNsxtEdgeGateway(edgeGatewayConfig *types.OpenAPIEdgeGateway) (*NsxtEdgeGateway, error)

CreateNsxtEdgeGateway allows to create NSX-T edge gateway for Org admins

func (*AdminOrg) CreateNsxtVdcGroup added in v2.14.0

func (adminOrg *AdminOrg) CreateNsxtVdcGroup(name, description, startingVdcId string, participatingVdcIds []string) (*VdcGroup, error)

CreateNsxtVdcGroup create NSX-T VDC group with provided VDC IDs. More generic creation method available also - CreateVdcGroup

func (*AdminOrg) CreateOrgVdc added in v2.6.0

func (adminOrg *AdminOrg) CreateOrgVdc(vdcConfiguration *types.VdcConfiguration) (*Vdc, error)

CreateOrgVdc creates a VDC with the given params under the given organization and waits for the asynchronous task to complete. Returns an AdminVdc pointer and an error.

func (*AdminOrg) CreateOrgVdcAsync added in v2.6.0

func (adminOrg *AdminOrg) CreateOrgVdcAsync(vdcConfiguration *types.VdcConfiguration) (Task, error)

CreateOrgVdcAsync creates a VDC with the given params under the given organization. Returns a Task and an error.

func (*AdminOrg) CreateRole added in v2.9.0

func (adminOrg *AdminOrg) CreateRole(newRole *types.Role) (*Role, error)

CreateRole creates a new role as a tenant administrator

func (*AdminOrg) CreateUser added in v2.3.0

func (adminOrg *AdminOrg) CreateUser(userConfiguration *types.User) (*OrgUser, error)

CreateUser creates an OrgUser from a full configuration structure The timeOut variable is the maximum time we wait for the user to be ready (This operation does not return a task) This function returns as soon as the user has been created, which could be as little as 200ms or as much as Client.MaxRetryTimeout Mandatory fields are: Name, Role, Password. https://code.vmware.com/apis/442/vcloud-director#/doc/doc/operations/POST-CreateUser.html

func (*AdminOrg) CreateUserSimple added in v2.3.0

func (adminOrg *AdminOrg) CreateUserSimple(userData OrgUserConfiguration) (*OrgUser, error)

CreateUserSimple creates an org user from a simplified structure

func (*AdminOrg) CreateVdc

func (adminOrg *AdminOrg) CreateVdc(vdcConfiguration *types.VdcConfiguration) (Task, error)

CreateVdc creates a VDC with the given params under the given organization. Returns an AdminVdc. API Documentation: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/POST-VdcConfiguration.html Deprecated in favor of adminOrg.CreateOrgVdcAsync

func (*AdminOrg) CreateVdcComputePolicy added in v2.9.0

func (org *AdminOrg) CreateVdcComputePolicy(newVdcComputePolicy *types.VdcComputePolicy) (*VdcComputePolicy, error)

CreateVdcComputePolicy creates a new VDC Compute Policy using OpenAPI endpoint Deprecated: use client.CreateVdcComputePolicy

func (*AdminOrg) CreateVdcGroup added in v2.14.0

func (adminOrg *AdminOrg) CreateVdcGroup(vdcGroup *types.VdcGroup) (*VdcGroup, error)

CreateVdcGroup create VDC group with provided VDC ref. Only supports NSX-T VDCs.

func (*AdminOrg) CreateVdcWait

func (adminOrg *AdminOrg) CreateVdcWait(vdcDefinition *types.VdcConfiguration) error

Creates the VDC and waits for the asynchronous task to complete. Deprecated in favor of adminOrg.CreateOrgVdc

func (*AdminOrg) Delete

func (adminOrg *AdminOrg) Delete(force bool, recursive bool) error

Deletes the org, returning an error if the vCD call fails. API Documentation: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/DELETE-Organization.html

func (*AdminOrg) DeleteMetadataEntry added in v2.15.0

func (adminOrg *AdminOrg) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes metadata of the corresponding organization with the given key, and waits for completion

func (*AdminOrg) DeleteMetadataEntryAsync added in v2.15.0

func (adminOrg *AdminOrg) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes metadata of the corresponding organization with the given key, and returns a task.

func (*AdminOrg) Disable

func (adminOrg *AdminOrg) Disable() error

Disables the org. Returns an error if the call to vCD fails. API Documentation: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/POST-DisableOrg.html

func (*AdminOrg) FetchUserByHref added in v2.3.0

func (adminOrg *AdminOrg) FetchUserByHref(href string) (*OrgUser, error)

FetchUserByHref returns a user by its HREF Deprecated: use GetUserByHref instead

func (*AdminOrg) FetchUserById added in v2.3.0

func (adminOrg *AdminOrg) FetchUserById(id string, refresh bool) (*OrgUser, error)

FetchUserById returns a user by its ID Deprecated: use GetUserById instead

func (*AdminOrg) FetchUserByName added in v2.3.0

func (adminOrg *AdminOrg) FetchUserByName(name string, refresh bool) (*OrgUser, error)

FetchUserByName returns a user by its Name Deprecated: use GetUserByName instead

func (*AdminOrg) FetchUserByNameOrId added in v2.3.0

func (adminOrg *AdminOrg) FetchUserByNameOrId(identifier string, refresh bool) (*OrgUser, error)

FetchUserById returns a user by its Name or ID Deprecated: use GetUserByNameOrId instead

func (*AdminOrg) FindAdminCatalog

func (adminOrg *AdminOrg) FindAdminCatalog(catalogName string) (AdminCatalog, error)

Given a valid catalog name, FindAdminCatalog returns an AdminCatalog object. If no catalog is found, then returns an empty AdminCatalog and no error. Otherwise it returns an error. Function allows user to use an AdminOrg to also fetch a Catalog. If user does not have proper credentials to perform administrator tasks then function returns an error. API Documentation: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/GET-Catalog-AdminView.html Deprecated: Use adminOrg.GetAdminCatalog instead

func (*AdminOrg) FindAdminCatalogRecords added in v2.4.0

func (adminOrg *AdminOrg) FindAdminCatalogRecords(name string) ([]*types.CatalogRecord, error)

FindAdminCatalogRecords uses catalog name to return AdminCatalogRecord information.

func (*AdminOrg) FindCatalog

func (adminOrg *AdminOrg) FindCatalog(catalogName string) (Catalog, error)

Given a valid catalog name, FindCatalog returns a Catalog object. If no catalog is found, then returns an empty catalog and no error. Otherwise it returns an error. Function allows user to use an AdminOrg to also fetch a Catalog. Deprecated: Use adminOrg.GetCatalogByName instead

func (*AdminOrg) FindCatalogRecords added in v2.15.0

func (adminOrg *AdminOrg) FindCatalogRecords(name string) ([]*types.CatalogRecord, error)

FindCatalogRecords given a catalog name, retrieves the catalogRecords for a given organization

func (*AdminOrg) GetAdminCatalogByHref added in v2.4.0

func (adminOrg *AdminOrg) GetAdminCatalogByHref(catalogHref string) (*AdminCatalog, error)

GetAdminCatalogByHref finds an AdminCatalog by HREF On success, returns a pointer to the Catalog structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetAdminCatalogById added in v2.4.0

func (adminOrg *AdminOrg) GetAdminCatalogById(catalogId string, refresh bool) (*AdminCatalog, error)

GetCatalogById finds an AdminCatalog by ID On success, returns a pointer to the AdminCatalog structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetAdminCatalogByName added in v2.4.0

func (adminOrg *AdminOrg) GetAdminCatalogByName(catalogName string, refresh bool) (*AdminCatalog, error)

GetCatalogByName finds an AdminCatalog by Name On success, returns a pointer to the AdminCatalog structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetAdminCatalogByNameOrId added in v2.4.0

func (adminOrg *AdminOrg) GetAdminCatalogByNameOrId(identifier string, refresh bool) (*AdminCatalog, error)

GetAdminCatalogByNameOrId finds an AdminCatalog by name or ID On success, returns a pointer to the AdminCatalog structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetAdminVDCByHref added in v2.4.0

func (adminOrg *AdminOrg) GetAdminVDCByHref(vdcHref string) (*AdminVdc, error)

GetAdminVDCByHref retrieves a VDC using a direct call with the HREF

func (*AdminOrg) GetAdminVDCById added in v2.4.0

func (adminOrg *AdminOrg) GetAdminVDCById(vdcId string, refresh bool) (*AdminVdc, error)

GetAdminVDCById finds an Admin VDC by ID On success, returns a pointer to the AdminVdc structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetAdminVDCByName added in v2.4.0

func (adminOrg *AdminOrg) GetAdminVDCByName(vdcName string, refresh bool) (*AdminVdc, error)

GetAdminVDCByName finds an Admin VDC by Name On success, returns a pointer to the AdminVdc structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetAdminVDCByNameOrId added in v2.4.0

func (adminOrg *AdminOrg) GetAdminVDCByNameOrId(identifier string, refresh bool) (*AdminVdc, error)

GetAdminVDCByNameOrId finds an Admin VDC by Name Or ID On success, returns a pointer to the AdminVdc structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetAdminVdcByName added in v2.3.0

func (adminOrg *AdminOrg) GetAdminVdcByName(vdcname string) (AdminVdc, error)

GetAdminVdcByName function uses a valid VDC name and returns a admin VDC object. If no VDC is found, then it returns an empty VDC and no error. Otherwise it returns an empty VDC and an error. Deprecated: Use adminOrg.GetAdminVDCByName

func (*AdminOrg) GetAllCertificatesFromLibrary added in v2.14.0

func (adminOrg *AdminOrg) GetAllCertificatesFromLibrary(queryParameters url.Values) ([]*Certificate, error)

GetAllCertificatesFromLibrary r retrieves all available certificates from certificate library. Query parameters can be supplied to perform additional filtering

func (*AdminOrg) GetAllNsxtEdgeGateways added in v2.10.0

func (adminOrg *AdminOrg) GetAllNsxtEdgeGateways(queryParameters url.Values) ([]*NsxtEdgeGateway, error)

GetAllNsxtEdgeGateways allows to retrieve all NSX-T edge gateways for Org Admins

func (*AdminOrg) GetAllNsxtVdcGroupCandidates added in v2.14.0

func (adminOrg *AdminOrg) GetAllNsxtVdcGroupCandidates(startingVdcId string, queryParameters url.Values) ([]*types.CandidateVdc, error)

GetAllNsxtVdcGroupCandidates returns NSXT candidate VDCs for VDC group

func (*AdminOrg) GetAllRights added in v2.12.0

func (adminOrg *AdminOrg) GetAllRights(queryParameters url.Values) ([]*types.Right, error)

GetAllRights retrieves all available rights. Query parameters can be supplied to perform additional filtering

func (*AdminOrg) GetAllRightsCategories added in v2.12.0

func (adminOrg *AdminOrg) GetAllRightsCategories(queryParameters url.Values) ([]*types.RightsCategory, error)

GetAllRightsCategories retrieves all rights categories. Query parameters can be supplied to perform additional filtering

func (*AdminOrg) GetAllRoles added in v2.12.0

func (adminOrg *AdminOrg) GetAllRoles(queryParameters url.Values) ([]*Role, error)

GetAllRoles retrieves all roles as tenant user. Query parameters can be supplied to perform additional filtering

func (*AdminOrg) GetAllStorageProfileReferences added in v2.10.0

func (adminOrg *AdminOrg) GetAllStorageProfileReferences(refresh bool) ([]*types.Reference, error)

GetAllStorageProfileReferences traverses all depending VDCs and returns a slice of storage profile references available in those VDCs

func (*AdminOrg) GetAllVDCs added in v2.10.0

func (adminOrg *AdminOrg) GetAllVDCs(refresh bool) ([]*Vdc, error)

GetAllVDCs returns all depending VDCs for a particular Org

func (*AdminOrg) GetAllVdcComputePolicies added in v2.9.0

func (org *AdminOrg) GetAllVdcComputePolicies(queryParameters url.Values) ([]*VdcComputePolicy, error)

GetAllVdcComputePolicies retrieves all VDC compute policies using OpenAPI endpoint. Query parameters can be supplied to perform additional filtering Deprecated: use client.GetAllVdcComputePolicies

func (*AdminOrg) GetAllVdcGroupCandidates added in v2.14.0

func (adminOrg *AdminOrg) GetAllVdcGroupCandidates(queryParameters url.Values) ([]*types.CandidateVdc, error)

GetAllVdcGroupCandidates returns candidate VDCs for VDC group

func (*AdminOrg) GetAllVdcGroups added in v2.14.0

func (adminOrg *AdminOrg) GetAllVdcGroups(queryParameters url.Values) ([]*VdcGroup, error)

GetAllVdcGroups retrieves all VDC groups. Query parameters can be supplied to perform additional filtering

func (*AdminOrg) GetAnyTypeEdgeGatewayById added in v2.15.0

func (adminOrg *AdminOrg) GetAnyTypeEdgeGatewayById(id string) (*AnyTypeEdgeGateway, error)

GetNsxtEdgeGatewayById allows retrieving NSX-T or NSX-V Edge Gateway by ID for Org admins

func (*AdminOrg) GetCatalogAccessControl added in v2.9.0

func (org *AdminOrg) GetCatalogAccessControl(catalogIdentifier string, useTenantContext bool) (*types.ControlAccessParams, error)

GetCatalogAccessControl is a convenience method to retrieve access control for a catalog from an organization. The input variable catalogIdentifier can be either the catalog name or its ID

func (*AdminOrg) GetCatalogByHref added in v2.4.0

func (adminOrg *AdminOrg) GetCatalogByHref(catalogHref string) (*Catalog, error)

GetCatalogByHref finds a Catalog by HREF On success, returns a pointer to the Catalog structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetCatalogById added in v2.4.0

func (adminOrg *AdminOrg) GetCatalogById(catalogId string, refresh bool) (*Catalog, error)

GetCatalogById finds a Catalog by ID On success, returns a pointer to the Catalog structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetCatalogByName added in v2.4.0

func (adminOrg *AdminOrg) GetCatalogByName(catalogName string, refresh bool) (*Catalog, error)

GetCatalogByName finds a Catalog by Name On success, returns a pointer to the Catalog structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetCatalogByNameOrId added in v2.4.0

func (adminOrg *AdminOrg) GetCatalogByNameOrId(identifier string, refresh bool) (*Catalog, error)

GetCatalogByNameOrId finds a Catalog by name or ID On success, returns a pointer to the Catalog structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetCertificateFromLibraryById added in v2.14.0

func (adminOrg *AdminOrg) GetCertificateFromLibraryById(id string) (*Certificate, error)

GetCertificateFromLibraryById Returns certificate from library of certificates from Org context

func (*AdminOrg) GetCertificateFromLibraryByName added in v2.14.0

func (adminOrg *AdminOrg) GetCertificateFromLibraryByName(name string) (*Certificate, error)

GetCertificateFromLibraryByName retrieves certificate from certificate library by given name

func (*AdminOrg) GetGroupByHref added in v2.8.0

func (adminOrg *AdminOrg) GetGroupByHref(href string) (*OrgGroup, error)

GetGroupByHref retrieves group by HREF

func (*AdminOrg) GetGroupById added in v2.8.0

func (adminOrg *AdminOrg) GetGroupById(id string, refresh bool) (*OrgGroup, error)

GetGroupById retrieves group by Id

func (*AdminOrg) GetGroupByName added in v2.8.0

func (adminOrg *AdminOrg) GetGroupByName(name string, refresh bool) (*OrgGroup, error)

GetGroupByName retrieves group by Name

func (*AdminOrg) GetGroupByNameOrId added in v2.8.0

func (adminOrg *AdminOrg) GetGroupByNameOrId(identifier string, refresh bool) (*OrgGroup, error)

GetGroupByNameOrId retrieves group by Name or Id. Id is prioritized for search

func (*AdminOrg) GetLdapConfiguration added in v2.8.0

func (adminOrg *AdminOrg) GetLdapConfiguration() (*types.OrgLdapSettingsType, error)

GetLdapConfiguration retrieves LDAP configuration structure

func (*AdminOrg) GetMetadata added in v2.15.0

func (adminOrg *AdminOrg) GetMetadata() (*types.Metadata, error)

GetMetadata returns the AdminOrg metadata of the corresponding organization seen as administrator

func (*AdminOrg) GetNsxtEdgeGatewayById added in v2.10.0

func (adminOrg *AdminOrg) GetNsxtEdgeGatewayById(id string) (*NsxtEdgeGateway, error)

GetNsxtEdgeGatewayById allows retrieving NSX-T edge gateway by ID for Org admins

func (*AdminOrg) GetNsxtEdgeGatewayByName added in v2.10.0

func (adminOrg *AdminOrg) GetNsxtEdgeGatewayByName(name string) (*NsxtEdgeGateway, error)

GetNsxtEdgeGatewayByName allows retrieving NSX-T edge gateway by Name for Org admins

func (*AdminOrg) GetRightById added in v2.12.0

func (adminOrg *AdminOrg) GetRightById(id string) (*types.Right, error)

func (*AdminOrg) GetRightByName added in v2.12.0

func (adminOrg *AdminOrg) GetRightByName(name string) (*types.Right, error)

GetRightByName retrieves right by given name

func (*AdminOrg) GetRightsCategoryById added in v2.12.0

func (adminOrg *AdminOrg) GetRightsCategoryById(id string) (*types.RightsCategory, error)

GetRightsCategoryById retrieves a rights category from its ID

func (*AdminOrg) GetRoleById added in v2.12.0

func (adminOrg *AdminOrg) GetRoleById(id string) (*Role, error)

GetRoleById retrieves role by given ID

func (*AdminOrg) GetRoleByName added in v2.12.0

func (adminOrg *AdminOrg) GetRoleByName(name string) (*Role, error)

GetRoleByName retrieves role by given name

func (*AdminOrg) GetRoleReference added in v2.4.0

func (adminOrg *AdminOrg) GetRoleReference(roleName string) (*types.Reference, error)

GetRoleReference finds a role within the organization

func (*AdminOrg) GetStorageProfileReferenceById added in v2.10.0

func (adminOrg *AdminOrg) GetStorageProfileReferenceById(id string, refresh bool) (*types.Reference, error)

GetStorageProfileReferenceById finds storage profile reference by specified ID in Org or returns ErrorEntityNotFound

func (*AdminOrg) GetUserByHref added in v2.4.0

func (adminOrg *AdminOrg) GetUserByHref(href string) (*OrgUser, error)

GetUserByHref returns a user by its HREF, without need for searching in the adminOrg user list

func (*AdminOrg) GetUserById added in v2.4.0

func (adminOrg *AdminOrg) GetUserById(id string, refresh bool) (*OrgUser, error)

GetUserById retrieves a user within an admin organization by ID Returns a valid user if it exists. If it doesn't, returns nil and ErrorEntityNotFound If argument refresh is true, the AdminOrg will be refreshed before searching. This is usually done after creating, modifying, or deleting users. If it is false, it will search within the data already in memory (useful when looping through the users and we know that no changes have occurred in the meantime)

func (*AdminOrg) GetUserByName added in v2.4.0

func (adminOrg *AdminOrg) GetUserByName(name string, refresh bool) (*OrgUser, error)

GetUserByName retrieves a user within an admin organization by name Returns a valid user if it exists. If it doesn't, returns nil and ErrorEntityNotFound If argument refresh is true, the AdminOrg will be refreshed before searching. This is usually done after creating, modifying, or deleting users. If it is false, it will search within the data already in memory (useful when looping through the users and we know that no changes have occurred in the meantime)

func (*AdminOrg) GetUserByNameOrId added in v2.4.0

func (adminOrg *AdminOrg) GetUserByNameOrId(identifier string, refresh bool) (*OrgUser, error)

GetUserByNameOrId retrieves a user within an admin organization by either name or ID Returns a valid user if it exists. If it doesn't, returns nil and ErrorEntityNotFound If argument refresh is true, the AdminOrg will be refreshed before searching. This is usually done after creating, modifying, or deleting users. If it is false, it will search within the data already in memory (useful when looping through the users and we know that no changes have occurred in the meantime)

func (*AdminOrg) GetVDCByHref added in v2.4.0

func (adminOrg *AdminOrg) GetVDCByHref(vdcHref string) (*Vdc, error)

GetVDCByHref retrieves a VDC using a direct call with the HREF

func (*AdminOrg) GetVDCById added in v2.4.0

func (adminOrg *AdminOrg) GetVDCById(vdcId string, refresh bool) (*Vdc, error)

GetVDCById finds a VDC by ID On success, returns a pointer to the Vdc structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetVDCByName added in v2.4.0

func (adminOrg *AdminOrg) GetVDCByName(vdcName string, refresh bool) (*Vdc, error)

GetVDCByName finds a VDC by Name On success, returns a pointer to the Vdc structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetVDCByNameOrId added in v2.4.0

func (adminOrg *AdminOrg) GetVDCByNameOrId(identifier string, refresh bool) (*Vdc, error)

GetVDCByNameOrId finds a VDC by name or ID On success, returns a pointer to the VDC structure and a nil error On failure, returns a nil pointer and an error

func (*AdminOrg) GetVdcByName

func (adminOrg *AdminOrg) GetVdcByName(vdcname string) (Vdc, error)

If user specifies valid vdc name then this returns a vdc object. If no vdc is found, then it returns an empty vdc and no error. Otherwise it returns an empty vdc and an error. This function allows users to use an AdminOrg to fetch a vdc as well. Deprecated: Use adminOrg.GetVDCByName instead

func (*AdminOrg) GetVdcComputePolicyById added in v2.9.0

func (org *AdminOrg) GetVdcComputePolicyById(id string) (*VdcComputePolicy, error)

GetVdcComputePolicyById retrieves VDC compute policy by given ID Deprecated: use client.GetVdcComputePolicyById

func (*AdminOrg) GetVdcGroupById added in v2.14.0

func (adminOrg *AdminOrg) GetVdcGroupById(id string) (*VdcGroup, error)

GetVdcGroupById Returns VDC group using provided ID

func (*AdminOrg) GetVdcGroupByName added in v2.14.0

func (adminOrg *AdminOrg) GetVdcGroupByName(name string) (*VdcGroup, error)

GetVdcGroupByName retrieves VDC group by given name When the name contains commas, semicolons or asterisks, the encoding is rejected by the API in VCD 10.2 version. For this reason, when one or more commas, semicolons or asterisks are present we run the search brute force, by fetching all VDC groups and comparing the names. Yet, this not needed anymore in VCD 10.3 version. Also, url.QueryEscape as well as url.Values.Encode() both encode the space as a + character. So we use search brute force too. Reference to issue: https://github.com/golang/go/issues/4013 https://github.com/czos/goamz/pull/11/files

func (*AdminOrg) LdapConfigure added in v2.8.0

func (adminOrg *AdminOrg) LdapConfigure(settings *types.OrgLdapSettingsType) (*types.OrgLdapSettingsType, error)

LdapConfigure allows to configure LDAP mode in use by the Org

func (*AdminOrg) LdapDisable added in v2.8.0

func (adminOrg *AdminOrg) LdapDisable() error

LdapDisable wraps LdapConfigure to disable LDAP configuration for org

func (*AdminOrg) MergeMetadata added in v2.16.0

func (adminOrg *AdminOrg) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges AdminOrg metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*AdminOrg) MergeMetadataAsync added in v2.16.0

func (adminOrg *AdminOrg) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges AdminOrg metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*AdminOrg) QueryCatalogList added in v2.8.0

func (adminOrg *AdminOrg) QueryCatalogList() ([]*types.CatalogRecord, error)

QueryCatalogList returns a list of catalogs for this organization

func (*AdminOrg) Refresh

func (adminOrg *AdminOrg) Refresh() error

Given an adminorg with a valid HREF, the function refetches the adminorg and updates the user's adminorg data. Otherwise if the function fails, it returns an error. Users should use refresh whenever they have a stale org due to the creation/update/deletion of a resource within the org or the org itself.

func (*AdminOrg) SearchByFilter added in v2.8.0

func (org *AdminOrg) SearchByFilter(queryType string, criteria *FilterDef) ([]QueryItem, string, error)

SearchByFilter runs the search for a specific Org

func (*AdminOrg) Update

func (adminOrg *AdminOrg) Update() (Task, error)

Updates the Org definition from current org struct contents. Any differences that may be legally applied will be updated. Returns an error if the call to vCD fails. API Documentation: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/PUT-Organization.html

type AdminVdc

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

func NewAdminVdc

func NewAdminVdc(cli *Client) *AdminVdc

func (*AdminVdc) AddStorageProfile added in v2.13.0

func (vdc *AdminVdc) AddStorageProfile(storageProfile *types.VdcStorageProfileConfiguration, description string) (Task, error)

AddStorageProfile adds a storage profile to a VDC

func (*AdminVdc) AddStorageProfileWait added in v2.13.0

func (vdc *AdminVdc) AddStorageProfileWait(storageProfile *types.VdcStorageProfileConfiguration, description string) error

AddStorageProfileWait adds a storage profile to a VDC and return a refreshed VDC

func (*AdminVdc) GetAllAssignedVdcComputePolicies added in v2.9.0

func (vdc *AdminVdc) GetAllAssignedVdcComputePolicies(queryParameters url.Values) ([]*VdcComputePolicy, error)

GetAllAssignedVdcComputePolicies retrieves all VDC assigned compute policies using OpenAPI endpoint. Query parameters can be supplied to perform additional filtering

func (*AdminVdc) GetDefaultStorageProfileReference added in v2.13.0

func (adminVdc *AdminVdc) GetDefaultStorageProfileReference() (*types.Reference, error)

GetDefaultStorageProfileReference finds the default storage profile for the VDC

func (*AdminVdc) GetVappList added in v2.9.0

func (vdc *AdminVdc) GetVappList() []*types.ResourceReference

GetVappList returns the list of vApps for an Admin VDC

func (*AdminVdc) QueryCatalogItemList added in v2.8.0

func (vdc *AdminVdc) QueryCatalogItemList() ([]*types.QueryResultCatalogItemType, error)

QueryCatalogItemList returns a list of Catalog Item for the given Admin VDC

func (*AdminVdc) QueryCompatibleStorageProfiles added in v2.13.0

func (adminVdc *AdminVdc) QueryCompatibleStorageProfiles() ([]*types.QueryResultProviderVdcStorageProfileRecordType, error)

QueryCompatibleStorageProfiles retrieves all storage profiles belonging to the same provider VDC to which the Org VDC belongs

func (*AdminVdc) QueryVappTemplateList added in v2.8.0

func (vdc *AdminVdc) QueryVappTemplateList() ([]*types.QueryResultVappTemplateType, error)

QueryVappTemplateList returns a list of vApp templates for the given VDC

func (*AdminVdc) Refresh added in v2.3.0

func (adminVdc *AdminVdc) Refresh() error

Given an adminVdc with a valid HREF, the function refresh the adminVdc and updates the adminVdc data. Returns an error on failure Users should use refresh whenever they suspect a stale VDC due to the creation/update/deletion of a resource within the the VDC itself.

func (*AdminVdc) RemoveStorageProfile added in v2.13.0

func (vdc *AdminVdc) RemoveStorageProfile(storageProfileName string) (Task, error)

RemoveStorageProfile remove a storage profile from a VDC

func (*AdminVdc) RemoveStorageProfileWait added in v2.13.0

func (vdc *AdminVdc) RemoveStorageProfileWait(storageProfileName string) error

RemoveStorageProfileWait removes a storege profile from a VDC and returns a refreshed VDC or an error

func (*AdminVdc) SetAssignedComputePolicies added in v2.9.0

func (vdc *AdminVdc) SetAssignedComputePolicies(computePolicyReferences types.VdcComputePolicyReferences) (*types.VdcComputePolicyReferences, error)

SetAssignedComputePolicies assign(set) compute policies.

func (*AdminVdc) SetDefaultStorageProfile added in v2.13.0

func (vdc *AdminVdc) SetDefaultStorageProfile(storageProfileName string) error

SetDefaultStorageProfile sets a given storage profile as default This operation will automatically unset the previous default storage profile.

func (*AdminVdc) Update added in v2.3.0

func (adminVdc *AdminVdc) Update() (AdminVdc, error)

Update function updates an Admin VDC from current VDC struct contents. Any differences that may be legally applied will be updated. Returns an empty AdminVdc struct and error if the call to vCD fails. API Documentation: https://vdc-repo.vmware.com/vmwb-repository/dcr-public/7a028e78-bd37-4a6a-8298-9c26c7eeb9aa/09142237-dd46-4dee-8326-e07212fb63a8/doc/doc/operations/PUT-Vdc.html

func (*AdminVdc) UpdateAsync added in v2.3.0

func (adminVdc *AdminVdc) UpdateAsync() (Task, error)

UpdateAsync updates VDC from current VDC struct contents. Any differences that may be legally applied will be updated. Returns an error if the call to vCD fails. API Documentation: https://vdc-repo.vmware.com/vmwb-repository/dcr-public/7a028e78-bd37-4a6a-8298-9c26c7eeb9aa/09142237-dd46-4dee-8326-e07212fb63a8/doc/doc/operations/PUT-Vdc.html

func (*AdminVdc) UpdateStorageProfile added in v2.10.0

func (vdc *AdminVdc) UpdateStorageProfile(storageProfileId string, storageProfile *types.AdminVdcStorageProfile) (*types.AdminVdcStorageProfile, error)

UpdateStorageProfile updates VDC storage profile and returns refreshed VDC or error.

type AnyTypeEdgeGateway added in v2.15.0

type AnyTypeEdgeGateway struct {
	EdgeGateway *types.OpenAPIEdgeGateway
	// contains filtered or unexported fields
}

AnyTypeEdgeGateway is a common structure which fetches any type of Edge Gateway (NSX-T or NSX-V) using OpenAPI endpoint. It can be useful to identify type of Edge Gateway or just retrieve common fields - like OwnerRef. There is also a function GetNsxtEdgeGateway to convert it to NsxtEdgeGateway (if it is an NSX-T one)

func (*AnyTypeEdgeGateway) GetNsxtEdgeGateway added in v2.15.0

func (anyTypeGateway *AnyTypeEdgeGateway) GetNsxtEdgeGateway() (*NsxtEdgeGateway, error)

GetNsxtEdgeGateway converts `AnyTypeEdgeGateway` to `NsxtEdgeGateway` if it is an NSX-T one

func (*AnyTypeEdgeGateway) IsNsxt added in v2.15.0

func (anyTypeGateway *AnyTypeEdgeGateway) IsNsxt() bool

IsNsxt checks if Edge Gateways is NSX-T backed

func (*AnyTypeEdgeGateway) IsNsxv added in v2.15.0

func (anyTypeGateway *AnyTypeEdgeGateway) IsNsxv() bool

IsNsxv checks if Edge Gateways is NSX-V backed

type Catalog

type Catalog struct {
	Catalog *types.Catalog
	// contains filtered or unexported fields
}

func NewCatalog

func NewCatalog(client *Client) *Catalog

func (*Catalog) Delete

func (catalog *Catalog) Delete(force, recursive bool) error

Delete deletes the Catalog, returning an error if the vCD call fails. Link to API call: https://code.vmware.com/apis/1046/vmware-cloud-director/doc/doc/operations/DELETE-Catalog.html

func (*Catalog) FindCatalogItem

func (cat *Catalog) FindCatalogItem(catalogItemName string) (CatalogItem, error)

If catalog item is a valid CatalogItem and the call succeeds, then the function returns a CatalogItem. If the item does not exist, then it returns an empty CatalogItem. If the call fails at any point, it returns an error. Deprecated: use GetCatalogItemByName instead

func (Catalog) GetAccessControl added in v2.9.0

func (catalog Catalog) GetAccessControl(useTenantContext bool) (*types.ControlAccessParams, error)

GetAccessControl retrieves the access control information for this catalog

func (*Catalog) GetCatalogItemByHref added in v2.4.0

func (cat *Catalog) GetCatalogItemByHref(catalogItemHref string) (*CatalogItem, error)

GetCatalogItemByHref finds a CatalogItem by HREF On success, returns a pointer to the CatalogItem structure and a nil error On failure, returns a nil pointer and an error

func (*Catalog) GetCatalogItemById added in v2.4.0

func (cat *Catalog) GetCatalogItemById(catalogItemId string, refresh bool) (*CatalogItem, error)

GetCatalogItemById finds a Catalog Item by ID On success, returns a pointer to the CatalogItem structure and a nil error On failure, returns a nil pointer and an error

func (*Catalog) GetCatalogItemByName added in v2.4.0

func (cat *Catalog) GetCatalogItemByName(catalogItemName string, refresh bool) (*CatalogItem, error)

GetCatalogItemByName finds a CatalogItem by Name On success, returns a pointer to the CatalogItem structure and a nil error On failure, returns a nil pointer and an error

func (*Catalog) GetCatalogItemByNameOrId added in v2.4.0

func (cat *Catalog) GetCatalogItemByNameOrId(identifier string, refresh bool) (*CatalogItem, error)

GetCatalogItemByNameOrId finds a Catalog Item by Name or ID On success, returns a pointer to the CatalogItem structure and a nil error On failure, returns a nil pointer and an error

func (*Catalog) GetMediaByHref added in v2.4.0

func (cat *Catalog) GetMediaByHref(mediaHref string) (*Media, error)

GetMediaByHref finds a Media by HREF On success, returns a pointer to the Media structure and a nil error On failure, returns a nil pointer and an error

func (*Catalog) GetMediaById added in v2.4.0

func (catalog *Catalog) GetMediaById(mediaId string) (*Media, error)

GetMediaById finds a Media by ID On success, returns a pointer to the Media structure and a nil error On failure, returns a nil pointer and an error

func (*Catalog) GetMediaByName added in v2.4.0

func (cat *Catalog) GetMediaByName(mediaName string, refresh bool) (*Media, error)

GetMediaByName finds a Media by Name On success, returns a pointer to the Media structure and a nil error On failure, returns a nil pointer and an error

func (*Catalog) GetMediaByNameOrId added in v2.4.0

func (cat *Catalog) GetMediaByNameOrId(identifier string, refresh bool) (*Media, error)

GetMediaByNameOrId finds a Media by Name or ID On success, returns a pointer to the Media structure and a nil error On failure, returns a nil pointer and an error

func (*Catalog) GetMetadata added in v2.15.0

func (catalog *Catalog) GetMetadata() (*types.Metadata, error)

GetMetadata returns Catalog metadata.

func (*Catalog) GetVappTemplateByHref added in v2.6.0

func (cat *Catalog) GetVappTemplateByHref(href string) (*VAppTemplate, error)

GetVappTemplateByHref finds a vApp template by HREF On success, returns a pointer to the vApp template structure and a nil error On failure, returns a nil pointer and an error

func (Catalog) IsShared added in v2.9.0

func (catalog Catalog) IsShared(useTenantContext bool) (bool, error)

IsShared shows whether a catalog is shared or not, regardless of the number of subjects sharing it

func (*Catalog) PublishToExternalOrganizations added in v2.15.0

func (cat *Catalog) PublishToExternalOrganizations(publishExternalCatalog types.PublishExternalCatalogParams) error

PublishToExternalOrganizations publishes a catalog to external organizations.

func (*Catalog) QueryCatalogItemList added in v2.8.0

func (catalog *Catalog) QueryCatalogItemList() ([]*types.QueryResultCatalogItemType, error)

QueryCatalogItemList returns a list of Catalog Item for the given catalog

func (*Catalog) QueryMedia added in v2.4.0

func (catalog *Catalog) QueryMedia(mediaName string) (*MediaRecord, error)

QueryMedia returns media image found in system using `name` and `catalog name` as query.

func (*Catalog) QueryMediaList added in v2.8.0

func (catalog *Catalog) QueryMediaList() ([]*types.MediaRecordType, error)

QueryMediaList retrieves a list of media items for the catalog

func (*Catalog) QueryVappTemplateList added in v2.8.0

func (catalog *Catalog) QueryVappTemplateList() ([]*types.QueryResultVappTemplateType, error)

QueryVappTemplateList returns a list of vApp templates for the given catalog

func (*Catalog) Refresh added in v2.4.0

func (cat *Catalog) Refresh() error

Refresh gets a fresh copy of the catalog from vCD

func (Catalog) RemoveAccessControl added in v2.9.0

func (catalog Catalog) RemoveAccessControl(useTenantContext bool) error

RemoveAccessControl is a shortcut to SetAccessControl with all access disabled

func (*Catalog) SearchByFilter added in v2.8.0

func (catalog *Catalog) SearchByFilter(queryType, parentField string, criteria *FilterDef) ([]QueryItem, string, error)

SearchByFilter runs the search for a specific catalog The 'parentField' argument defines which filter will be added, depending on the items we search for:

  • 'catalog' contains the catalog HREF or ID
  • 'catalogName' contains the catalog name

func (Catalog) SetAccessControl added in v2.9.0

func (catalog Catalog) SetAccessControl(accessControl *types.ControlAccessParams, useTenantContext bool) error

SetAccessControl changes the access control information for this catalog

func (*Catalog) UploadMediaImage

func (cat *Catalog) UploadMediaImage(mediaName, mediaDescription, filePath string, uploadPieceSize int64) (UploadTask, error)

func (*Catalog) UploadOvf

func (cat *Catalog) UploadOvf(ovaFileName, itemName, description string, uploadPieceSize int64) (UploadTask, error)

UploadOvf uploads an ova/ovf file to a catalog. This method only uploads bits to vCD spool area. ovaFileName should be the path of OVA or OVF file(not ovf folder) itself. For OVF, user need to make sure all the files that OVF depends on exist and locate under the same folder. Returns errors if any occur during upload from vCD or upload process. On upload fail client may need to remove vCD catalog item which waits for files to be uploaded. Files from ova are extracted to system temp folder "govcd+random number" and left for inspection on error.

func (cat *Catalog) UploadOvfByLink(ovfUrl, itemName, description string) (Task, error)

UploadOvfByLink uploads an OVF file to a catalog from remote URL. Returns errors if any occur during upload from VCD or upload process. On upload fail client may need to remove VCD catalog item which is in failed state.

type CatalogItem

type CatalogItem struct {
	CatalogItem *types.CatalogItem
	// contains filtered or unexported fields
}

func FindMediaAsCatalogItem

func FindMediaAsCatalogItem(org *Org, catalogName, mediaName string) (CatalogItem, error)

Finds media in catalog and returns catalog item Deprecated: Use catalog.GetMediaByName()

func NewCatalogItem

func NewCatalogItem(cli *Client) *CatalogItem

func (*CatalogItem) AddMetadataEntry added in v2.16.0

func (catalogItem *CatalogItem) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds CatalogItem metadata typedValue and key/value pair provided as input and waits for the task to finish.

func (*CatalogItem) AddMetadataEntryAsync added in v2.16.0

func (catalogItem *CatalogItem) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds CatalogItem metadata typedValue and key/value pair provided as input and returns the task.

func (*CatalogItem) Delete

func (catalogItem *CatalogItem) Delete() error

Delete deletes the Catalog Item, returning an error if the vCD call fails. Link to API call: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/DELETE-CatalogItem.html

func (*CatalogItem) DeleteMetadataEntry added in v2.16.0

func (catalogItem *CatalogItem) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes CatalogItem metadata depending on key provided as input and waits for the task to finish.

func (*CatalogItem) DeleteMetadataEntryAsync added in v2.16.0

func (catalogItem *CatalogItem) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes CatalogItem metadata depending on key provided as input and returns a task.

func (*CatalogItem) GetMetadata added in v2.16.0

func (catalogItem *CatalogItem) GetMetadata() (*types.Metadata, error)

GetMetadata returns CatalogItem metadata.

func (*CatalogItem) GetVAppTemplate

func (catalogItem *CatalogItem) GetVAppTemplate() (VAppTemplate, error)

func (*CatalogItem) MergeMetadata added in v2.16.0

func (catalogItem *CatalogItem) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges CatalogItem metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*CatalogItem) MergeMetadataAsync added in v2.16.0

func (catalogItem *CatalogItem) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges CatalogItem metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

type Certificate added in v2.14.0

type Certificate struct {
	CertificateLibrary *types.CertificateLibraryItem
	Href               string
	// contains filtered or unexported fields
}

Certificate is a structure defining a certificate in VCD It is called "Certificate Library" in the UI, and "Certificate Library item" in the API

func (*Certificate) Delete added in v2.14.0

func (certificate *Certificate) Delete() error

Delete deletes certificate from Certificate library

func (*Certificate) Update added in v2.14.0

func (certificate *Certificate) Update() (*Certificate, error)

Update updates existing Certificate. Allows changing only alias and description

type Client

type Client struct {
	APIVersion       string      // The API version required
	VCDToken         string      // Access Token (authorization header)
	VCDAuthHeader    string      // Authorization header
	VCDHREF          url.URL     // VCD API ENDPOINT
	Http             http.Client // HttpClient is the client to use. Default will be used if not provided.
	IsSysAdmin       bool        // flag if client is connected as system administrator
	UsingBearerToken bool        // flag if client is using a bearer token
	UsingAccessToken bool        // flag if client is using an API token

	// MaxRetryTimeout specifies a time limit (in seconds) for retrying requests made by the SDK
	// where vCloud director may take time to respond and retry mechanism is needed.
	// This must be >0 to avoid instant timeout errors.
	MaxRetryTimeout int

	// UseSamlAdfs specifies if SAML auth is used for authenticating vCD instead of local login.
	// The following conditions must be met so that authentication SAML authentication works:
	// * SAML IdP (Identity Provider) is Active Directory Federation Service (ADFS)
	// * Authentication endpoint "/adfs/services/trust/13/usernamemixed" must be enabled on ADFS
	// server
	UseSamlAdfs bool
	// CustomAdfsRptId allows to set custom Relaying Party Trust identifier. By default vCD Entity
	// ID is used as Relaying Party Trust identifier.
	CustomAdfsRptId string

	// UserAgent to send for API queries. Standard format is described as:
	// "User-Agent: <product> / <product-version> <comment>"
	UserAgent string
	// contains filtered or unexported fields
}

Client provides a client to vCloud Director, values can be populated automatically using the Authenticate method.

func (*Client) APIClientVersionIs added in v2.6.0

func (client *Client) APIClientVersionIs(versionConstraint string) bool

APIClientVersionIs allows to compare against currently used API version VCDClient.Client.APIVersion. Can be useful to validate if a certain feature can be used or not. It does not require for the client to be authenticated.

Format: ">= 27.0, < 32.0", ">= 30.0", "= 27.0"

vCD version mapping to API version support https://code.vmware.com/doc/preview?id=8072

func (*Client) APIVCDMaxVersionIs added in v2.6.0

func (client *Client) APIVCDMaxVersionIs(versionConstraint string) bool

APIVCDMaxVersionIs compares against maximum vCD supported API version from /api/versions (not necessarily the currently used one). This allows to check what is the maximum API version that vCD instance supports and can be used to guess vCD product version. API 31.0 support was first introduced in vCD 9.5 (as per https://code.vmware.com/doc/preview?id=8072). Therefore APIMaxVerIs(">= 31.0") implies that you have vCD 9.5 or newer running inside. It does not require for the client to be authenticated.

Format: ">= 27.0, < 32.0", ">= 30.0", "= 27.0"

vCD version mapping to API version support https://code.vmware.com/doc/preview?id=8072

func (*Client) AddCertificateToLibrary added in v2.14.0

func (client *Client) AddCertificateToLibrary(certificateConfig *types.CertificateLibraryItem) (*Certificate, error)

AddCertificateToLibrary uploads certificates with configuration details

func (*Client) CreateGlobalRole added in v2.12.0

func (client *Client) CreateGlobalRole(newGlobalRole *types.GlobalRole) (*GlobalRole, error)

CreateGlobalRole creates a new global role as a system administrator

func (*Client) CreateRightsBundle added in v2.12.0

func (client *Client) CreateRightsBundle(newRightsBundle *types.RightsBundle) (*RightsBundle, error)

CreateRightsBundle creates a new rights bundle as a system administrator

func (*Client) CreateVdcComputePolicy added in v2.16.0

func (client *Client) CreateVdcComputePolicy(newVdcComputePolicy *types.VdcComputePolicy) (*VdcComputePolicy, error)

CreateVdcComputePolicy creates a new VDC Compute Policy using OpenAPI endpoint

func (*Client) ExecuteParamRequestWithCustomError added in v2.4.0

func (client *Client) ExecuteParamRequestWithCustomError(pathURL string, params map[string]string,
	requestType, contentType, errorMessage string, payload interface{}, errType error) (*http.Response, error)

ExecuteParamRequestWithCustomError behaves exactly like ExecuteRequestWithCustomError but accepts query parameter specification

func (*Client) ExecuteRequest added in v2.2.0

func (client *Client) ExecuteRequest(pathURL, requestType, contentType, errorMessage string, payload, out interface{}) (*http.Response, error)

ExecuteRequest helper function creates request, runs it, check responses and parses out interface from response. pathURL - request URL requestType - HTTP method type contentType - value to set for "Content-Type" errorMessage - error message to return when error happens payload - XML struct which will be marshalled and added as body/payload out - structure to be used for unmarshalling xml E.g. unmarshalledAdminOrg := &types.AdminOrg{} client.ExecuteRequest(adminOrg.AdminOrg.HREF, http.MethodGet, "", "error refreshing organization: %s", nil, unmarshalledAdminOrg)

func (*Client) ExecuteRequestWithApiVersion added in v2.6.0

func (client *Client) ExecuteRequestWithApiVersion(pathURL, requestType, contentType, errorMessage string, payload, out interface{}, apiVersion string) (*http.Response, error)

ExecuteRequestWithApiVersion helper function creates request, runs it, check responses and parses out interface from response. pathURL - request URL requestType - HTTP method type contentType - value to set for "Content-Type" errorMessage - error message to return when error happens payload - XML struct which will be marshalled and added as body/payload out - structure to be used for unmarshalling xml apiVersion - api version which will be used in request E.g. unmarshalledAdminOrg := &types.AdminOrg{} client.ExecuteRequest(adminOrg.AdminOrg.HREF, http.MethodGet, "", "error refreshing organization: %s", nil, unmarshalledAdminOrg)

func (*Client) ExecuteRequestWithCustomError added in v2.3.0

func (client *Client) ExecuteRequestWithCustomError(pathURL, requestType, contentType, errorMessage string,
	payload interface{}, errType error) (*http.Response, error)

ExecuteRequestWithCustomError sends the request and checks for 2xx response. If the returned status code was not as expected - the returned error will be unmarshalled to `errType` which implements Go's standard `error` interface.

func (*Client) ExecuteRequestWithoutResponse added in v2.2.0

func (client *Client) ExecuteRequestWithoutResponse(pathURL, requestType, contentType, errorMessage string, payload interface{}) error

ExecuteRequestWithoutResponse helper function creates request, runs it, checks response and do not expect any values from it. pathURL - request URL requestType - HTTP method type contentType - value to set for "Content-Type" errorMessage - error message to return when error happens payload - XML struct which will be marshalled and added as body/payload E.g. client.ExecuteRequestWithoutResponse(catalogItemHREF.String(), http.MethodDelete, "", "error deleting Catalog item: %s", nil)

func (*Client) ExecuteRequestWithoutResponseWithApiVersion added in v2.6.0

func (client *Client) ExecuteRequestWithoutResponseWithApiVersion(pathURL, requestType, contentType, errorMessage string, payload interface{}, apiVersion string) error

ExecuteRequestWithoutResponseWithApiVersion helper function creates request, runs it, checks response and do not expect any values from it. pathURL - request URL requestType - HTTP method type contentType - value to set for "Content-Type" errorMessage - error message to return when error happens payload - XML struct which will be marshalled and added as body/payload apiVersion - api version which will be used in request E.g. client.ExecuteRequestWithoutResponse(catalogItemHREF.String(), http.MethodDelete, "", "error deleting Catalog item: %s", nil)

func (*Client) ExecuteTaskRequest added in v2.2.0

func (client *Client) ExecuteTaskRequest(pathURL, requestType, contentType, errorMessage string, payload interface{}) (Task, error)

ExecuteTaskRequest helper function creates request, runs it, checks response and parses task from response. pathURL - request URL requestType - HTTP method type contentType - value to set for "Content-Type" errorMessage - error message to return when error happens payload - XML struct which will be marshalled and added as body/payload E.g. client.ExecuteTaskRequest(updateDiskLink.HREF, http.MethodPut, updateDiskLink.Type, "error updating disk: %s", xmlPayload)

func (*Client) ExecuteTaskRequestWithApiVersion added in v2.6.0

func (client *Client) ExecuteTaskRequestWithApiVersion(pathURL, requestType, contentType, errorMessage string, payload interface{}, apiVersion string) (Task, error)

ExecuteTaskRequestWithApiVersion helper function creates request, runs it, checks response and parses task from response. pathURL - request URL requestType - HTTP method type contentType - value to set for "Content-Type" errorMessage - error message to return when error happens payload - XML struct which will be marshalled and added as body/payload apiVersion - api version which will be used in request E.g. client.ExecuteTaskRequest(updateDiskLink.HREF, http.MethodPut, updateDiskLink.Type, "error updating disk: %s", xmlPayload)

func (*Client) FindVMByHREF deprecated

func (client *Client) FindVMByHREF(vmHREF string) (VM, error)

Deprecated: use client.GetVMByHref instead

func (Client) GetAccessControl added in v2.9.0

func (client Client) GetAccessControl(href, entityType, entityName string, headerValues map[string]string) (*types.ControlAccessParams, error)

GetAccessControl retrieves the access control information for the requested entity

func (*Client) GetAllCertificatesFromLibrary added in v2.14.0

func (client *Client) GetAllCertificatesFromLibrary(queryParameters url.Values) ([]*Certificate, error)

GetAllCertificatesFromLibrary retrieves all available certificates from certificate library. Query parameters can be supplied to perform additional filtering

func (*Client) GetAllGlobalRoles added in v2.12.0

func (client *Client) GetAllGlobalRoles(queryParameters url.Values) ([]*GlobalRole, error)

GetAllGlobalRoles retrieves all global roles. Query parameters can be supplied to perform additional filtering Only System administrator can handle global roles

func (*Client) GetAllRights added in v2.12.0

func (client *Client) GetAllRights(queryParameters url.Values) ([]*types.Right, error)

GetAllRights retrieves all available rights. Query parameters can be supplied to perform additional filtering

func (*Client) GetAllRightsBundles added in v2.12.0

func (client *Client) GetAllRightsBundles(queryParameters url.Values) ([]*RightsBundle, error)

GetAllRightsBundles retrieves all rights bundles. Query parameters can be supplied to perform additional filtering

func (*Client) GetAllRightsCategories added in v2.12.0

func (client *Client) GetAllRightsCategories(queryParameters url.Values) ([]*types.RightsCategory, error)

GetAllRightsCategories retrieves all rights categories. Query parameters can be supplied to perform additional filtering

func (*Client) GetAllRoles added in v2.12.0

func (client *Client) GetAllRoles(queryParameters url.Values) ([]*Role, error)

GetAllRoles retrieves all roles as System administrator. Query parameters can be supplied to perform additional filtering

func (*Client) GetAllVdcComputePolicies added in v2.16.0

func (client *Client) GetAllVdcComputePolicies(queryParameters url.Values) ([]*VdcComputePolicy, error)

GetAllVdcComputePolicies retrieves all VDC compute policies using OpenAPI endpoint. Query parameters can be supplied to perform additional filtering

func (*Client) GetCertificateFromLibraryById added in v2.14.0

func (client *Client) GetCertificateFromLibraryById(id string) (*Certificate, error)

GetCertificateFromLibraryById Returns certificate from library of certificates from System Context

func (*Client) GetCertificateFromLibraryByName added in v2.14.0

func (client *Client) GetCertificateFromLibraryByName(name string) (*Certificate, error)

GetCertificateFromLibraryByName retrieves certificate from certificate library by given name

func (*Client) GetGlobalRoleById added in v2.12.0

func (client *Client) GetGlobalRoleById(id string) (*GlobalRole, error)

GetGlobalRoleById retrieves global role by given ID

func (*Client) GetGlobalRoleByName added in v2.12.0

func (client *Client) GetGlobalRoleByName(name string) (*GlobalRole, error)

GetGlobalRoleByName retrieves a global role by given name

func (Client) GetQueryType added in v2.9.0

func (client Client) GetQueryType(queryType string) string

GetQueryType is an utility function to get the appropriate query type depending on the user's role

func (*Client) GetRightById added in v2.12.0

func (client *Client) GetRightById(id string) (*types.Right, error)

func (*Client) GetRightByName added in v2.12.0

func (client *Client) GetRightByName(name string) (*types.Right, error)

GetRightByName retrieves right by given name

func (*Client) GetRightsBundleById added in v2.12.0

func (client *Client) GetRightsBundleById(id string) (*RightsBundle, error)

GetRightsBundleById retrieves rights bundle by given ID

func (*Client) GetRightsBundleByName added in v2.12.0

func (client *Client) GetRightsBundleByName(name string) (*RightsBundle, error)

GetRightsBundleByName retrieves rights bundle by given name

func (*Client) GetRightsCategoryById added in v2.12.0

func (client *Client) GetRightsCategoryById(id string) (*types.RightsCategory, error)

GetRightsCategoryById retrieves a rights category from its ID

func (*Client) GetSessionInfo added in v2.14.0

func (client *Client) GetSessionInfo() (*types.CurrentSessionInfo, error)

GetSessionInfo collects the basic session information for a VCD connection

func (*Client) GetSpecificApiVersionOnCondition added in v2.6.0

func (client *Client) GetSpecificApiVersionOnCondition(vcdApiVersionCondition, wantedApiVersion string) string

GetSpecificApiVersionOnCondition returns default version or wantedApiVersion if it is connected to version described in vcdApiVersionCondition f.e. values ">= 32.0", "32.0" returns 32.0 if vCD version is above or 9.7

func (*Client) GetStorageProfileByHref added in v2.13.0

func (client *Client) GetStorageProfileByHref(url string) (*types.VdcStorageProfile, error)

GetStorageProfileByHref fetches a storage profile using its HREF.

func (*Client) GetVMByHref added in v2.4.0

func (client *Client) GetVMByHref(vmHref string) (*VM, error)

GetVMByHref returns a VM reference by running a vCD API call If no valid VM is found, it returns a nil VM reference and an error Note that the pointer receiver here is a Client instead of a VApp, because there are cases where we know the VM HREF but not which VApp it belongs to.

func (*Client) GetVcdFullVersion added in v2.10.0

func (client *Client) GetVcdFullVersion() (VcdVersion, error)

GetVcdFullVersion returns the full VCD version information as a structure

func (*Client) GetVcdShortVersion added in v2.10.0

func (client *Client) GetVcdShortVersion() (string, error)

GetVcdShortVersion returns the VCD version (three digits, no build info)

func (*Client) GetVcdVersion added in v2.10.0

func (client *Client) GetVcdVersion() (string, time.Time, error)

GetVcdVersion finds the VCD version and the time of build

func (*Client) GetVdcComputePolicyById added in v2.16.0

func (client *Client) GetVdcComputePolicyById(id string) (*VdcComputePolicy, error)

GetVdcComputePolicyById retrieves VDC compute policy by given ID

func (*Client) MaxSupportedVersion added in v2.10.0

func (client *Client) MaxSupportedVersion() (string, error)

MaxSupportedVersion parses supported version list and returns the highest version in string format.

func (*Client) NewRequest

func (client *Client) NewRequest(params map[string]string, method string, reqUrl url.URL, body io.Reader) *http.Request

NewRequest creates a new HTTP request and applies necessary auth headers if set.

func (*Client) NewRequestWitNotEncodedParams

func (client *Client) NewRequestWitNotEncodedParams(params map[string]string, notEncodedParams map[string]string, method string, reqUrl url.URL, body io.Reader) *http.Request

NewRequestWitNotEncodedParams allows passing complex values params that shouldn't be encoded like for queries. e.g. /query?filter=name=foo

func (*Client) NewRequestWitNotEncodedParamsWithApiVersion added in v2.6.0

func (client *Client) NewRequestWitNotEncodedParamsWithApiVersion(params map[string]string, notEncodedParams map[string]string, method string, reqUrl url.URL, body io.Reader, apiVersion string) *http.Request

NewRequestWitNotEncodedParamsWithApiVersion allows passing complex values params that shouldn't be encoded like for queries. e.g. /query?filter=name=foo * params - request parameters * notEncodedParams - request parameters which will be added not encoded * method - request type * reqUrl - request url * body - request body * apiVersion - provided Api version overrides default Api version value used in request parameter

func (*Client) NewRequestWithApiVersion added in v2.6.0

func (client *Client) NewRequestWithApiVersion(params map[string]string, method string, reqUrl url.URL, body io.Reader, apiVersion string) *http.Request

NewRequestWithApiVersion creates a new HTTP request and applies necessary auth headers if set. Allows to override default request API Version

func (*Client) OpenApiBuildEndpoint added in v2.9.0

func (client *Client) OpenApiBuildEndpoint(endpoint ...string) (*url.URL, error)

OpenApiBuildEndpoint helps to construct OpenAPI endpoint by using already configured VCD HREF while requiring only the last bit for endpoint. This is a variadic function and multiple pieces can be supplied for convenience. Leading '/' is added automatically. Sample URL construct: https://HOST/cloudapi/endpoint

func (*Client) OpenApiDeleteItem added in v2.9.0

func (client *Client) OpenApiDeleteItem(apiVersion string, urlRef *url.URL, params url.Values, additionalHeader map[string]string) error

OpenApiDeleteItem is a low level OpenAPI client function to perform DELETE request for any item. The urlRef must point to ID of exact item (e.g. '/1.0.0/edgeGateways/{EDGE_ID}') It handles synchronous and asynchronous tasks. When a task is synchronous - it will block until it is finished.

func (*Client) OpenApiGetAllItems added in v2.9.0

func (client *Client) OpenApiGetAllItems(apiVersion string, urlRef *url.URL, queryParams url.Values, outType interface{}, additionalHeader map[string]string) error

OpenApiGetAllItems retrieves and accumulates all pages then parsing them to a single 'outType' object. It works by at first crawling pages and accumulating all responses into []json.RawMessage (as strings). Because there is no intermediate unmarshalling to exact `outType` for every page it unmarshals into response struct in one go. 'outType' must be a slice of object (e.g. []*types.OpenAPIEdgeGateway) because this response contains slice of structs.

Note. Query parameter 'pageSize' is defaulted to 128 (maximum supported) unless it is specified in queryParams

func (*Client) OpenApiGetItem added in v2.9.0

func (client *Client) OpenApiGetItem(apiVersion string, urlRef *url.URL, params url.Values, outType interface{}, additionalHeader map[string]string) error

OpenApiGetItem is a low level OpenAPI client function to perform GET request for any item. The urlRef must point to ID of exact item (e.g. '/1.0.0/edgeGateways/{EDGE_ID}') It responds with HTTP 403: Forbidden - If the user is not authorized or the entity does not exist. When HTTP 403 is returned this function returns "ErrorEntityNotFound: API_ERROR" so that one can use ContainsNotFound(err) to differentiate when an objects was not found from any other error.

func (*Client) OpenApiIsSupported added in v2.9.0

func (client *Client) OpenApiIsSupported() bool

OpenApiIsSupported allows to check whether VCD supports OpenAPI. Each OpenAPI endpoint however is introduced with different VCD API versions so this is just a general check if OpenAPI is supported at all. Particular endpoint introduction version can be checked in self hosted docs (https://HOSTNAME/docs/)

func (*Client) OpenApiPostItem added in v2.9.0

func (client *Client) OpenApiPostItem(apiVersion string, urlRef *url.URL, params url.Values, payload, outType interface{}, additionalHeader map[string]string) error

OpenApiPostItem is a low level OpenAPI client function to perform POST request for item supporting synchronous or asynchronous requests. The urlRef must point to POST endpoint (e.g. '/1.0.0/edgeGateways'). When a task is synchronous - it will track task until it is finished and pick reference to marshal outType.

func (*Client) OpenApiPostItemAsync added in v2.9.0

func (client *Client) OpenApiPostItemAsync(apiVersion string, urlRef *url.URL, params url.Values, payload interface{}) (Task, error)

OpenApiPostItemAsync is a low level OpenAPI client function to perform POST request for items that support asynchronous requests. The urlRef must point to POST endpoint (e.g. '/1.0.0/edgeGateways') that supports asynchronous requests. It will return an error if item does not support asynchronous request (does not respond with HTTP 202).

Note. Even though it may return error if the item does not support asynchronous request - the object may still be created. OpenApiPostItem would handle both cases and always return created item.

func (*Client) OpenApiPostItemSync added in v2.9.0

func (client *Client) OpenApiPostItemSync(apiVersion string, urlRef *url.URL, params url.Values, payload, outType interface{}) error

OpenApiPostItemSync is a low level OpenAPI client function to perform POST request for items that support synchronous requests. The urlRef must point to POST endpoint (e.g. '/1.0.0/edgeGateways') that supports synchronous requests. It will return an error when endpoint does not support synchronous requests (HTTP response status code is not 201). Response will be unmarshalled into outType.

Note. Even though it may return error if the item does not support synchronous request - the object may still be created. OpenApiPostItem would handle both cases and always return created item.

func (*Client) OpenApiPutItem added in v2.9.0

func (client *Client) OpenApiPutItem(apiVersion string, urlRef *url.URL, params url.Values, payload, outType interface{}, additionalHeader map[string]string) error

OpenApiPutItem is a low level OpenAPI client function to perform PUT request for any item. The urlRef must point to ID of exact item (e.g. '/1.0.0/edgeGateways/{EDGE_ID}') It handles synchronous and asynchronous tasks. When a task is synchronous - it will block until it is finished.

func (*Client) OpenApiPutItemAsync added in v2.9.0

func (client *Client) OpenApiPutItemAsync(apiVersion string, urlRef *url.URL, params url.Values, payload interface{}, additionalHeader map[string]string) (Task, error)

OpenApiPutItemAsync is a low level OpenAPI client function to perform PUT request for items that support asynchronous requests. The urlRef must point to ID of exact item (e.g. '/1.0.0/edgeGateways/{EDGE_ID}') that supports asynchronous requests. It will return an error if item does not support asynchronous request (does not respond with HTTP 202).

Note. Even though it may return error if the item does not support asynchronous request - the object may still be created. OpenApiPutItem would handle both cases and always return created item.

func (*Client) OpenApiPutItemSync added in v2.9.0

func (client *Client) OpenApiPutItemSync(apiVersion string, urlRef *url.URL, params url.Values, payload, outType interface{}, additionalHeader map[string]string) error

OpenApiPutItemSync is a low level OpenAPI client function to perform PUT request for items that support synchronous requests. The urlRef must point to ID of exact item (e.g. '/1.0.0/edgeGateways/{EDGE_ID}') and support synchronous requests. It will return an error when endpoint does not support synchronous requests (HTTP response status code is not 201). Response will be unmarshalled into outType.

Note. Even though it may return error if the item does not support synchronous request - the object may still be updated. OpenApiPutItem would handle both cases and always return updated item.

func (*Client) QueryAllProviderVdcStorageProfiles added in v2.13.0

func (client *Client) QueryAllProviderVdcStorageProfiles() ([]*types.QueryResultProviderVdcStorageProfileRecordType, error)

QueryAllProviderVdcStorageProfiles gets the list of provider VDC storage profiles from ALL provider VDCs

func (*Client) QueryAllVdcs added in v2.12.0

func (client *Client) QueryAllVdcs() ([]*types.QueryResultOrgVdcRecordType, error)

QueryAllVdcs returns all Org VDCs in a VCD instance

This function requires "System" user or returns an error

func (*Client) QueryProviderVdcStorageProfiles added in v2.13.0

func (client *Client) QueryProviderVdcStorageProfiles(providerVdcHref string) ([]*types.QueryResultProviderVdcStorageProfileRecordType, error)

QueryProviderVdcStorageProfiles gets the list of provider VDC storage profiles for a given Provider VDC

func (*Client) QueryVappList added in v2.9.0

func (client *Client) QueryVappList() ([]*types.QueryResultVAppRecordType, error)

QueryVappList returns a list of all vApps in all the organizations available to the caller

func (*Client) QueryVmList added in v2.8.0

func (client *Client) QueryVmList(filter types.VmQueryFilter) ([]*types.QueryResultVMRecordType, error)

QueryVmList returns a list of all VMs in all the organizations available to the caller

func (*Client) QueryWithNotEncodedParams added in v2.4.0

func (client *Client) QueryWithNotEncodedParams(params map[string]string, notEncodedParams map[string]string) (Results, error)

QueryWithNotEncodedParams uses Query API to search for requested data

func (*Client) QueryWithNotEncodedParamsWithApiVersion added in v2.7.0

func (client *Client) QueryWithNotEncodedParamsWithApiVersion(params map[string]string, notEncodedParams map[string]string, apiVersion string) (Results, error)

QueryWithNotEncodedParams uses Query API to search for requested data

func (*Client) QueryWithNotEncodedParamsWithApiVersionWithHeaders added in v2.15.0

func (client *Client) QueryWithNotEncodedParamsWithApiVersionWithHeaders(params map[string]string, notEncodedParams map[string]string, apiVersion string, headers map[string]string) (Results, error)

func (*Client) QueryWithNotEncodedParamsWithHeaders added in v2.15.0

func (client *Client) QueryWithNotEncodedParamsWithHeaders(params map[string]string, notEncodedParams map[string]string, headers map[string]string) (Results, error)

func (*Client) RemoveCustomHeader added in v2.12.0

func (client *Client) RemoveCustomHeader()

RemoveCustomHeader remove custom header values from the client

func (*Client) RemoveProvidedCustomHeaders added in v2.15.0

func (client *Client) RemoveProvidedCustomHeaders(values map[string]string)

RemoveProvidedCustomHeaders removes custom header values from the client

func (*Client) SearchByFilter added in v2.8.0

func (client *Client) SearchByFilter(queryType string, criteria *FilterDef) ([]QueryItem, string, error)

SearchByFilter is a generic filter that can operate on entities that implement the QueryItem interface It requires a queryType and a set of criteria. Returns a list of QueryItem interface elements, which can be cast back to the wanted real type Also returns a human readable text of the conditions being passed and how they matched the data found See "## Query engine" in CODING_GUIDELINES.md for more info

func (*Client) SetAccessControl added in v2.9.0

func (client *Client) SetAccessControl(accessControl *types.ControlAccessParams, href, entityType, entityName string, headerValues map[string]string) error

SetAccessControl changes the access control information for this entity There are two ways of setting the access: with accessControl.IsSharedToEveryone = true we give access to everyone with accessControl.IsSharedToEveryone = false, accessControl.AccessSettings defines which subjects can access the vApp For each setting we must provide: * The subject (HREF and Type are mandatory) * The access level (one of ReadOnly, Change, FullControl)

func (*Client) SetCustomHeader added in v2.12.0

func (client *Client) SetCustomHeader(values map[string]string)

SetCustomHeader adds custom HTTP header values to a client

func (*Client) VersionEqualOrGreater added in v2.10.0

func (client *Client) VersionEqualOrGreater(compareTo string, howManyDigits int) (bool, error)

VersionEqualOrGreater return true if the current version is the same or greater than the one being compared. If howManyDigits is > 3, the comparison includes the build. Examples:

client version is 1.2.3.1234
compare version is 1.2.3.2000

function return true if howManyDigits is <= 3, but false if howManyDigits is > 3

client version is 1.2.3.1234
compare version is 1.1.1.0

function returns true regardless of value of howManyDigits

type DateItem added in v2.8.0

type DateItem struct {
	Name       string
	Date       string
	Entity     interface{}
	EntityType string
}

type DhcpSettings

type DhcpSettings struct {
	IsEnabled        bool
	MaxLeaseTime     int
	DefaultLeaseTime int
	IPRange          *types.IPRange
}

struct type used to pass information for vApp network DHCP

type Disk

type Disk struct {
	Disk *types.Disk
	// contains filtered or unexported fields
}

Independent disk

func FindDiskByHREF

func FindDiskByHREF(client *Client, href string) (*Disk, error)

Find an independent disk by VDC client and disk href Deprecated: Use VDC.GetDiskByHref()

func NewDisk

func NewDisk(cli *Client) *Disk

Init independent disk struct

func (*Disk) AddMetadataEntry added in v2.15.0

func (disk *Disk) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds metadata key/value pair provided as input to the corresponding independent disk and waits for completion.

func (*Disk) AddMetadataEntryAsync added in v2.15.0

func (disk *Disk) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds metadata key/value pair provided as input to the corresponding independent disk and returns a task.

func (*Disk) AttachedVM

func (disk *Disk) AttachedVM() (*types.Reference, error)

Get a VM that is attached the disk An independent disk can be attached to at most one virtual machine. If the disk isn't attached to any VM, return empty VM reference and no error. Otherwise return the first VM reference and no error. Reference: vCloud API Programming Guide for Service Providers vCloud API 30.0 PDF Page 107, https://vdc-download.vmware.com/vmwb-repository/dcr-public/1b6cf07d-adb3-4dba-8c47-9c1c92b04857/ 241956dd-e128-4fcc-8131-bf66e1edd895/vcloud_sp_api_guide_30_0.pdf

func (*Disk) Delete

func (disk *Disk) Delete() (Task, error)

Remove an independent disk 1 Verify the independent disk is not connected to any VM 2 Delete the independent disk. Make a DELETE request to the URL in the rel="remove" link in the Disk 3 Return task of independent disk deletion If the independent disk is connected to a VM, the task will be failed. Reference: vCloud API Programming Guide for Service Providers vCloud API 30.0 PDF Page 106 - 107, https://vdc-download.vmware.com/vmwb-repository/dcr-public/1b6cf07d-adb3-4dba-8c47-9c1c92b04857/ 241956dd-e128-4fcc-8131-bf66e1edd895/vcloud_sp_api_guide_30_0.pdf

func (*Disk) DeleteMetadataEntry added in v2.15.0

func (disk *Disk) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes metadata of the corresponding independent disk with the given key, and waits for completion

func (*Disk) DeleteMetadataEntryAsync added in v2.15.0

func (disk *Disk) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes metadata of the corresponding independent disk with the given key, and returns a task.

func (*Disk) GetAttachedVmsHrefs added in v2.15.0

func (disk *Disk) GetAttachedVmsHrefs() ([]string, error)

Get a VMs HREFs that is attached to the disk An independent disk can be attached to at most one virtual machine. If the disk isn't attached to any VM, return empty slice. Otherwise return the list of VMs HREFs.

func (*Disk) GetMetadata added in v2.15.0

func (disk *Disk) GetMetadata() (*types.Metadata, error)

GetMetadata returns the metadata of the corresponding independent disk

func (*Disk) MergeMetadata added in v2.16.0

func (disk *Disk) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges Disk metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*Disk) MergeMetadataAsync added in v2.16.0

func (disk *Disk) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges Disk metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*Disk) Refresh

func (disk *Disk) Refresh() error

Refresh the disk information by disk href

func (*Disk) Update

func (disk *Disk) Update(newDiskInfo *types.Disk) (Task, error)

Update an independent disk 1 Verify the independent disk is not connected to any VM 2 Use newDiskInfo to change update the independent disk 3 Return task of independent disk update If the independent disk is connected to a VM, the task will be failed. Reference: vCloud API Programming Guide for Service Providers vCloud API 30.0 PDF Page 104 - 106, https://vdc-download.vmware.com/vmwb-repository/dcr-public/1b6cf07d-adb3-4dba-8c47-9c1c92b04857/ 241956dd-e128-4fcc-8131-bf66e1edd895/vcloud_sp_api_guide_30_0.pdf

type DiskRecord

type DiskRecord struct {
	Disk *types.DiskRecordType
	// contains filtered or unexported fields
}

Independent disk query record

func NewDiskRecord

func NewDiskRecord(cli *Client) *DiskRecord

Create instance with reference to types.DiskRecordType

type DistributedFirewall added in v2.15.0

type DistributedFirewall struct {
	DistributedFirewallRuleContainer *types.DistributedFirewallRules

	VdcGroup *VdcGroup
	// contains filtered or unexported fields
}

DistributedFirewall contains a types.DistributedFirewallRules which handles Distributed Firewall rules in a VDC Group

func (*DistributedFirewall) DeleteAllRules added in v2.15.0

func (firewall *DistributedFirewall) DeleteAllRules() error

DeleteAllRules removes all Distributed Firewall rules

Note. This function works only with `default` policy as this was the only supported when this functions was created

type EdgeBgpIpPrefixList added in v2.16.0

type EdgeBgpIpPrefixList struct {
	EdgeBgpIpPrefixList *types.EdgeBgpIpPrefixList
	// contains filtered or unexported fields
}

EdgeBgpIpPrefixList helps to configure BGP IP Prefix Lists in NSX-T Edge Gateways

func (*EdgeBgpIpPrefixList) Delete added in v2.16.0

func (bgpIpPrefixListCfg *EdgeBgpIpPrefixList) Delete() error

Delete deletes existing BGP IP Prefix List

func (*EdgeBgpIpPrefixList) Update added in v2.16.0

func (bgpIpPrefixListCfg *EdgeBgpIpPrefixList) Update(bgpIpPrefixList *types.EdgeBgpIpPrefixList) (*EdgeBgpIpPrefixList, error)

Update updates existing BGP IP Prefix List with new configuration and returns it

type EdgeBgpNeighbor added in v2.16.0

type EdgeBgpNeighbor struct {
	EdgeBgpNeighbor *types.EdgeBgpNeighbor
	// contains filtered or unexported fields
}

EdgeBgpNeighbor represents NSX-T Edge Gateway BGP Neighbor

func (*EdgeBgpNeighbor) Delete added in v2.16.0

func (bgpNeighbor *EdgeBgpNeighbor) Delete() error

Delete deletes existing BGP Neighbor

func (*EdgeBgpNeighbor) Update added in v2.16.0

func (bgpNeighbor *EdgeBgpNeighbor) Update(bgpNeighborConfig *types.EdgeBgpNeighbor) (*EdgeBgpNeighbor, error)

Update updates existing BGP Neighbor with new configuration and returns it

type EdgeGateway

type EdgeGateway struct {
	EdgeGateway *types.EdgeGateway
	// contains filtered or unexported fields
}

func CreateAndConfigureEdgeGateway added in v2.3.0

func CreateAndConfigureEdgeGateway(vcdClient *VCDClient, orgName, vdcName, egwName string, egwConfiguration *types.EdgeGateway) (EdgeGateway, error)

CreateAndConfigureEdgeGateway creates an edge gateway using a full configuration structure

func CreateEdgeGateway added in v2.3.0

func CreateEdgeGateway(vcdClient *VCDClient, egwc EdgeGatewayCreation) (EdgeGateway, error)

CreateEdgeGateway creates an edge gateway using a simplified configuration structure

func NewEdgeGateway

func NewEdgeGateway(cli *Client) *EdgeGateway

func (*EdgeGateway) AddDNATRule added in v2.3.0

func (egw *EdgeGateway) AddDNATRule(ruleDetails NatRule) (*types.NatRule, error)

AddDNATRule creates DNAT rule and returns the NAT struct that was created or an error. Allows assigning a specific Org VDC or an external network. When edge gateway is advanced vCD API uses element <tag> to map with NSX edge gateway ID. A known issue is that updating rule using User interface resets <tag> and as result mapping is lost. Getting using NatRule.ID won't be valid anymore. Old functions AddNATPortMapping and AddNATMapping assigned rule only to first external network

func (*EdgeGateway) AddDhcpPool

func (egw *EdgeGateway) AddDhcpPool(network *types.OrgVDCNetwork, dhcppool []interface{}) (Task, error)

AddDhcpPool adds (or updates) the DHCP pool connected to a specific network. TODO: this is legacy code from 2015, which requires a Terraform structure to work. It may need some re-thinking.

func (*EdgeGateway) AddIpsecVPN

func (egw *EdgeGateway) AddIpsecVPN(ipsecVPNConfig *types.EdgeGatewayServiceConfiguration) (Task, error)

func (*EdgeGateway) AddNATMapping deprecated

func (egw *EdgeGateway) AddNATMapping(natType, externalIP, internalIP string) (Task, error)

Deprecated: Use eGW.AddNATRule()

func (*EdgeGateway) AddNATPortMapping deprecated

func (egw *EdgeGateway) AddNATPortMapping(natType, externalIP, externalPort, internalIP, internalPort, protocol, icmpSubType string) (Task, error)

Deprecated: Use eGW.AddNATPortMappingWithUplink()

func (egw *EdgeGateway) AddNATPortMappingWithUplink(network *types.OrgVDCNetwork, natType, externalIP, externalPort, internalIP, internalPort, protocol, icmpSubType string) (Task, error)

Deprecated: Use eGW.AddDNATRule() or eGW.CreateNsxvNatRule() for NSX-V

func (*EdgeGateway) AddNATRule deprecated added in v2.2.0

func (egw *EdgeGateway) AddNATRule(network *types.OrgVDCNetwork, natType, externalIP, internalIP string) (Task, error)

Deprecated: Use eGW.AddSNATRule() or eGW.AddDNATRule()

func (*EdgeGateway) AddNATRuleAsync added in v2.3.0

func (egw *EdgeGateway) AddNATRuleAsync(ruleDetails NatRule) (Task, error)

AddNATRuleAsync creates NAT rule and return task or err Allows assigning specific network Org VDC or external. Old function AddNATPortMapping and AddNATMapping function shouldn't be used because assigns rule to first external network

func (*EdgeGateway) AddSNATRule added in v2.3.0

func (egw *EdgeGateway) AddSNATRule(networkHref, externalIP, internalIP, description string) (*types.NatRule, error)

AddSNATRule creates SNAT rule and returns created NAT rule or error. Allows assigning a specific Org VDC or an external network. Old functions AddNATPortMapping and AddNATMapping aren't correct as assigned rule only to first external network

func (*EdgeGateway) Create1to1Mapping

func (egw *EdgeGateway) Create1to1Mapping(internal, external, description string) (Task, error)

func (*EdgeGateway) CreateFirewallRules

func (egw *EdgeGateway) CreateFirewallRules(defaultAction string, rules []*types.FirewallRule) (Task, error)

func (*EdgeGateway) CreateLbAppProfile added in v2.3.0

func (egw *EdgeGateway) CreateLbAppProfile(lbAppProfileConfig *types.LbAppProfile) (*types.LbAppProfile, error)

CreateLbAppProfile creates a load balancer application profile based on mandatory fields. It is a synchronous operation. It returns created object with all fields (including ID) populated or an error.

func (*EdgeGateway) CreateLbAppRule added in v2.3.0

func (egw *EdgeGateway) CreateLbAppRule(lbAppRuleConfig *types.LbAppRule) (*types.LbAppRule, error)

CreateLbAppRule creates a load balancer application rule based on mandatory fields. It is a synchronous operation. It returns created object with all fields (including ID) populated or an error.

func (*EdgeGateway) CreateLbServerPool added in v2.3.0

func (egw *EdgeGateway) CreateLbServerPool(lbPoolConfig *types.LbPool) (*types.LbPool, error)

CreateLbServerPool creates a load balancer server pool based on mandatory fields. It is a synchronous operation. It returns created object with all fields (including ID) populated or an error. Name and Algorithm fields must be populated.

func (*EdgeGateway) CreateLbServiceMonitor added in v2.3.0

func (egw *EdgeGateway) CreateLbServiceMonitor(lbMonitorConfig *types.LbMonitor) (*types.LbMonitor, error)

CreateLbServiceMonitor creates a load balancer service monitor based on mandatory fields. It is a synchronous operation. It returns created object with all fields (including ID) populated or an error.

func (*EdgeGateway) CreateLbVirtualServer added in v2.3.0

func (egw *EdgeGateway) CreateLbVirtualServer(lbVirtualServerConfig *types.LbVirtualServer) (*types.LbVirtualServer, error)

CreateLbVirtualServer creates a load balancer virtual server based on mandatory fields. It is a synchronous operation. It returns created object with all fields (including ID) populated or an error. Name, Protocol, Port and IpAddress fields must be populated

func (*EdgeGateway) CreateNsxvFirewallRule added in v2.4.0

func (egw *EdgeGateway) CreateNsxvFirewallRule(firewallRuleConfig *types.EdgeFirewallRule, aboveRuleId string) (*types.EdgeFirewallRule, error)

CreateNsxvFirewallRule creates firewall rule using proxied NSX-V API. It is a synchronous operation. It returns an object with all fields populated (including ID) If aboveRuleId is not empty, it will send a query parameter aboveRuleId= which instructs NSX to place this rule above the specified rule ID

func (*EdgeGateway) CreateNsxvNatRule added in v2.4.0

func (egw *EdgeGateway) CreateNsxvNatRule(natRuleConfig *types.EdgeNatRule) (*types.EdgeNatRule, error)

CreateNsxvNatRule creates NAT rule using proxied NSX-V API. It is a synchronuous operation. It returns an object with all fields populated (including ID)

func (*EdgeGateway) Delete added in v2.3.0

func (egw *EdgeGateway) Delete(force bool, recursive bool) error

Deletes the edge gateway, returning an error with the operation result. https://code.vmware.com/apis/442/vcloud-director/doc/doc/operations/DELETE-EdgeGateway.html

func (*EdgeGateway) DeleteAsync added in v2.3.0

func (egw *EdgeGateway) DeleteAsync(force bool, recursive bool) (Task, error)

Deletes the edge gateway, returning a task and an error with the operation result. https://code.vmware.com/apis/442/vcloud-director/doc/doc/operations/DELETE-EdgeGateway.html

func (*EdgeGateway) DeleteLbAppProfile added in v2.3.0

func (egw *EdgeGateway) DeleteLbAppProfile(lbAppProfileConfig *types.LbAppProfile) error

DeleteLbAppProfile is able to delete the types.LbAppProfile type by Name and/or ID. If both - Name and ID are specified it performs a lookup by ID and returns an error if the specified name and found name do not match.

func (*EdgeGateway) DeleteLbAppProfileById added in v2.3.0

func (egw *EdgeGateway) DeleteLbAppProfileById(id string) error

DeleteLbAppProfileById wraps DeleteLbAppProfile and requires only ID for deletion

func (*EdgeGateway) DeleteLbAppProfileByName added in v2.3.0

func (egw *EdgeGateway) DeleteLbAppProfileByName(name string) error

DeleteLbAppProfileByName wraps DeleteLbAppProfile and requires only Name for deletion

func (*EdgeGateway) DeleteLbAppRule added in v2.3.0

func (egw *EdgeGateway) DeleteLbAppRule(lbAppRuleConfig *types.LbAppRule) error

DeleteLbAppRule is able to delete the types.LbAppRule type by Name and/or ID. If both - Name and ID are specified it performs a lookup by ID and returns an error if the specified name and found name do not match.

func (*EdgeGateway) DeleteLbAppRuleById added in v2.3.0

func (egw *EdgeGateway) DeleteLbAppRuleById(id string) error

DeleteLBAppRuleById wraps DeleteLbAppRule and requires only ID for deletion

func (*EdgeGateway) DeleteLbAppRuleByName added in v2.3.0

func (egw *EdgeGateway) DeleteLbAppRuleByName(name string) error

DeleteLbAppRuleByName wraps DeleteLbAppRule and requires only Name for deletion

func (*EdgeGateway) DeleteLbServerPool added in v2.3.0

func (egw *EdgeGateway) DeleteLbServerPool(lbPoolConfig *types.LbPool) error

DeleteLbServerPool is able to delete the types.LbPool type by Name and/or ID. If both - Name and ID are specified it performs a lookup by ID and returns an error if the specified name and found name do not match.

func (*EdgeGateway) DeleteLbServerPoolById added in v2.3.0

func (egw *EdgeGateway) DeleteLbServerPoolById(id string) error

DeleteLbServerPoolById wraps DeleteLbServerPool and requires only ID for deletion

func (*EdgeGateway) DeleteLbServerPoolByName added in v2.3.0

func (egw *EdgeGateway) DeleteLbServerPoolByName(name string) error

DeleteLbServerPoolByName wraps DeleteLbServerPool and requires only Name for deletion

func (*EdgeGateway) DeleteLbServiceMonitor added in v2.3.0

func (egw *EdgeGateway) DeleteLbServiceMonitor(lbMonitorConfig *types.LbMonitor) error

DeleteLbServiceMonitor is able to delete the types.LbMonitor type by Name and/or ID. If both - Name and ID are specified it performs a lookup by ID and returns an error if the specified name and found name do not match.

func (*EdgeGateway) DeleteLbServiceMonitorById added in v2.3.0

func (egw *EdgeGateway) DeleteLbServiceMonitorById(id string) error

DeleteLbServiceMonitorById wraps DeleteLbServiceMonitor and requires only ID for deletion

func (*EdgeGateway) DeleteLbServiceMonitorByName added in v2.3.0

func (egw *EdgeGateway) DeleteLbServiceMonitorByName(name string) error

DeleteLbServiceMonitorByName wraps DeleteLbServiceMonitor and requires only Name for deletion

func (*EdgeGateway) DeleteLbVirtualServer added in v2.3.0

func (egw *EdgeGateway) DeleteLbVirtualServer(lbVirtualServerConfig *types.LbVirtualServer) error

DeleteLbVirtualServer is able to delete the types.LbVirtualServer type by Name and/or ID. If both - Name and ID are specified it performs a lookup by ID and returns an error if the specified name and found name do not match.

func (*EdgeGateway) DeleteLbVirtualServerById added in v2.3.0

func (egw *EdgeGateway) DeleteLbVirtualServerById(id string) error

DeleteLbVirtualServerById wraps DeleteLbVirtualServer and requires only ID for deletion

func (*EdgeGateway) DeleteLbVirtualServerByName added in v2.3.0

func (egw *EdgeGateway) DeleteLbVirtualServerByName(name string) error

DeleteLbVirtualServerByName wraps DeleteLbVirtualServer and requires only Name for deletion

func (*EdgeGateway) DeleteNsxvFirewallRuleById added in v2.4.0

func (egw *EdgeGateway) DeleteNsxvFirewallRuleById(id string) error

DeleteNsxvFirewallRuleById deletes types.EdgeFirewallRule by real (not the number shown in UI) firewall rule ID as shown in the UI using proxied NSX-V API. It returns and error `ErrorEntityNotFound` if the firewall rule is not found.

func (*EdgeGateway) DeleteNsxvNatRuleById added in v2.4.0

func (egw *EdgeGateway) DeleteNsxvNatRuleById(id string) error

DeleteNsxvNatRuleById deletes types.EdgeNatRule by NAT rule ID as shown in the UI using proxied NSX-V API. It returns and error `ErrorEntityNotFound` if the NAT rule is now found.

func (*EdgeGateway) GetAllNsxvDhcpLeases added in v2.6.0

func (egw *EdgeGateway) GetAllNsxvDhcpLeases() ([]*types.EdgeDhcpLeaseInfo, error)

GetAllNsxvDhcpLeases retrieves all DHCP leases defined in NSX-V edge gateway

func (*EdgeGateway) GetAllNsxvFirewallRules added in v2.4.0

func (egw *EdgeGateway) GetAllNsxvFirewallRules() ([]*types.EdgeFirewallRule, error)

GetAllNsxvFirewallRules retrieves all firewall rules and returns []*types.EdgeFirewallRule or an error of type ErrorEntityNotFound if there are no firewall rules

func (*EdgeGateway) GetAnyVnicIndexByNetworkName added in v2.4.0

func (egw *EdgeGateway) GetAnyVnicIndexByNetworkName(networkName string) (*int, string, error)

GetAnyVnicIndexByNetworkName parses XML structure of vNic mapping to networks in edge gateway XML and returns *int of vNic index and network type by network name networkName cannot be empty networkType will be one of: 'internal', 'uplink', 'trunk', 'subinterface'

Warning: this function assumes that there are no duplicate network names attached. If it is so this function will return the first network

func (*EdgeGateway) GetDhcpRelay added in v2.5.0

func (egw *EdgeGateway) GetDhcpRelay() (*types.EdgeDhcpRelay, error)

GetDhcpRelay retrieves a structure of *types.EdgeDhcpRelay with all DHCP relay settings present on a particular edge gateway.

func (*EdgeGateway) GetFirewallConfig added in v2.4.0

func (egw *EdgeGateway) GetFirewallConfig() (*types.FirewallConfigWithXml, error)

GetFirewallConfig retrieves firewall configuration and can be used to alter main configuration options. These are 3 fields only: FirewallConfigWithXml.Enabled, FirewallConfigWithXml.DefaultPolicy.LoggingEnabled and FirewallConfigWithXml.DefaultPolicy.Action

func (*EdgeGateway) GetLBGeneralParams added in v2.3.0

func (egw *EdgeGateway) GetLBGeneralParams() (*types.LbGeneralParamsWithXml, error)

GetLBGeneralParams retrieves load balancer configuration of `&types.LoadBalancer` and can be used to access global configuration options. These are 4 fields only: LoadBalancer.Enabled, LoadBalancer.AccelerationEnabled, LoadBalancer.Logging.Enable, LoadBalancer.Logging.LogLevel

func (*EdgeGateway) GetLbAppProfileById added in v2.3.0

func (egw *EdgeGateway) GetLbAppProfileById(id string) (*types.LbAppProfile, error)

GetLbAppProfileById wraps getLbAppProfile and needs only an ID for lookup

func (*EdgeGateway) GetLbAppProfileByName added in v2.3.0

func (egw *EdgeGateway) GetLbAppProfileByName(name string) (*types.LbAppProfile, error)

GetLbAppProfileByName wraps getLbAppProfile and needs only a Name for lookup

func (*EdgeGateway) GetLbAppProfiles added in v2.10.0

func (egw *EdgeGateway) GetLbAppProfiles() ([]*types.LbAppProfile, error)

GetLbAppProfiles returns a list of all LB application profiles in a given edge gateway

func (*EdgeGateway) GetLbAppRuleById added in v2.3.0

func (egw *EdgeGateway) GetLbAppRuleById(id string) (*types.LbAppRule, error)

ReadLBAppRuleById wraps getLbAppRule and needs only an ID for lookup

func (*EdgeGateway) GetLbAppRuleByName added in v2.3.0

func (egw *EdgeGateway) GetLbAppRuleByName(name string) (*types.LbAppRule, error)

GetLbAppRuleByName wraps getLbAppRule and needs only a Name for lookup

func (*EdgeGateway) GetLbAppRules added in v2.10.0

func (egw *EdgeGateway) GetLbAppRules() ([]*types.LbAppRule, error)

GetLbAppRules returns a list of all LB application rules for a given edge gateway

func (*EdgeGateway) GetLbServerPoolById added in v2.3.0

func (egw *EdgeGateway) GetLbServerPoolById(id string) (*types.LbPool, error)

GetLbServerPoolByName wraps getLbServerPool and needs only an ID for lookup

func (*EdgeGateway) GetLbServerPoolByName added in v2.3.0

func (egw *EdgeGateway) GetLbServerPoolByName(name string) (*types.LbPool, error)

GetLbServerPoolByName wraps getLbServerPool and needs only a Name for lookup

func (*EdgeGateway) GetLbServerPools added in v2.5.0

func (egw *EdgeGateway) GetLbServerPools() ([]*types.LbPool, error)

GetLbServerPools return all created server pools without filtering.

func (*EdgeGateway) GetLbServiceMonitorById added in v2.3.0

func (egw *EdgeGateway) GetLbServiceMonitorById(id string) (*types.LbMonitor, error)

GetLbServiceMonitorById wraps getLbServiceMonitor and needs only an ID for lookup

func (*EdgeGateway) GetLbServiceMonitorByName added in v2.3.0

func (egw *EdgeGateway) GetLbServiceMonitorByName(name string) (*types.LbMonitor, error)

GetLbServiceMonitorByName wraps getLbServiceMonitor and needs only a Name for lookup

func (*EdgeGateway) GetLbServiceMonitors added in v2.5.0

func (egw *EdgeGateway) GetLbServiceMonitors() ([]*types.LbMonitor, error)

GetLbServiceMonitors return all service monitors without filtering

func (*EdgeGateway) GetLbVirtualServerById added in v2.3.0

func (egw *EdgeGateway) GetLbVirtualServerById(id string) (*types.LbVirtualServer, error)

GetLbVirtualServerById wraps getLbVirtualServers and needs only an ID for lookup

func (*EdgeGateway) GetLbVirtualServerByName added in v2.3.0

func (egw *EdgeGateway) GetLbVirtualServerByName(name string) (*types.LbVirtualServer, error)

GetLbVirtualServerByName wraps getLbVirtualServers and needs only a Name for lookup

func (*EdgeGateway) GetLbVirtualServers added in v2.5.0

func (egw *EdgeGateway) GetLbVirtualServers() ([]*types.LbVirtualServer, error)

GetLbVirtualServers is getting all virtual servers without filtering anything

func (*EdgeGateway) GetNatRule added in v2.3.0

func (egw *EdgeGateway) GetNatRule(id string) (*types.NatRule, error)

GetNatRule returns NAT rule or error.

func (*EdgeGateway) GetNetworkNameAndTypeByVnicIndex added in v2.4.0

func (egw *EdgeGateway) GetNetworkNameAndTypeByVnicIndex(vNicIndex int) (string, string, error)

GetNetworkNameAndTypeByVnicIndex returns network name and network type for given vNic index returned networkType can be one of: 'internal', 'uplink', 'trunk', 'subinterface'

func (*EdgeGateway) GetNetworks added in v2.3.0

func (egw *EdgeGateway) GetNetworks() ([]SimpleNetworkIdentifier, error)

GetNetworks returns the list of networks associated with an edge gateway In the return structure, an interfaceType of "uplink" indicates an external network, while "internal" is for Org VDC routed networks

func (*EdgeGateway) GetNsxvActiveDhcpLeaseByMac added in v2.6.0

func (egw *EdgeGateway) GetNsxvActiveDhcpLeaseByMac(mac string) (*types.EdgeDhcpLeaseInfo, error)

GetNsxvActiveDhcpLeaseByMac finds active DHCP lease for a given hardware address (MAC)

func (*EdgeGateway) GetNsxvFirewallRuleById added in v2.4.0

func (egw *EdgeGateway) GetNsxvFirewallRuleById(id string) (*types.EdgeFirewallRule, error)

GetNsxvFirewallRuleById retrieves types.EdgeFirewallRule by real (not the number shown in UI) firewall rule ID as shown in the UI using proxied NSX-V API. It returns and error `ErrorEntityNotFound` if the firewall rule is not found

func (*EdgeGateway) GetNsxvNatRuleById added in v2.4.0

func (egw *EdgeGateway) GetNsxvNatRuleById(id string) (*types.EdgeNatRule, error)

GetNsxvNatRuleById retrieves types.EdgeNatRule by NAT rule ID as shown in the UI using proxied NSX-V API. It returns and error `ErrorEntityNotFound` if the NAT rule is not found.

func (*EdgeGateway) GetNsxvNatRules added in v2.10.0

func (egw *EdgeGateway) GetNsxvNatRules() ([]*types.EdgeNatRule, error)

GetNsxvNatRules returns a list of all NAT rules in a given edge gateway

func (*EdgeGateway) GetVnicIndexByNetworkNameAndType added in v2.4.0

func (egw *EdgeGateway) GetVnicIndexByNetworkNameAndType(networkName, networkType string) (*int, error)

GetVnicIndexByNetworkNameAndType returns *int of vNic index for specified network name and network type networkType one of: 'internal', 'uplink', 'trunk', 'subinterface' networkName cannot be empty

func (*EdgeGateway) HasAdvancedNetworking added in v2.3.0

func (egw *EdgeGateway) HasAdvancedNetworking() bool

HasAdvancedNetworking returns true if the edge gateway has advanced network configuration enabled

func (*EdgeGateway) HasDefaultGateway added in v2.3.0

func (egw *EdgeGateway) HasDefaultGateway() bool

HasDefaultGateway returns true if the edge gateway uses one of the external networks as default gateway

func (*EdgeGateway) Refresh

func (egw *EdgeGateway) Refresh() error

func (*EdgeGateway) Remove1to1Mapping

func (egw *EdgeGateway) Remove1to1Mapping(internal, external string) (Task, error)

func (*EdgeGateway) RemoveIpsecVPN

func (egw *EdgeGateway) RemoveIpsecVPN() (Task, error)

Removes an Edge Gateway VPN, by passing an empty configuration

func (*EdgeGateway) RemoveNATMapping deprecated

func (egw *EdgeGateway) RemoveNATMapping(natType, externalIP, internalIP, port string) (Task, error)

Deprecated: use one of RemoveNATRuleAsync, RemoveNATRule

func (*EdgeGateway) RemoveNATPortMapping deprecated

func (egw *EdgeGateway) RemoveNATPortMapping(natType, externalIP, externalPort, internalIP, internalPort string) (Task, error)

Deprecated: use one of RemoveNATRuleAsync, RemoveNATRule

func (*EdgeGateway) RemoveNATRule added in v2.3.0

func (egw *EdgeGateway) RemoveNATRule(id string) error

RemoveNATRule removes NAT removes NAT rule identified by ID and handles task. Returns error if issues rise. Old functions RemoveNATPortMapping and RemoveNATMapping removed using rule details and expected interface to be of external network type.

func (*EdgeGateway) RemoveNATRuleAsync added in v2.3.0

func (egw *EdgeGateway) RemoveNATRuleAsync(id string) (Task, error)

RemoveNATRuleAsync removes NAT rule or returns an error. Old functions RemoveNATPortMapping and RemoveNATMapping removed using rule details and expected interface to be of external network type.

func (*EdgeGateway) ResetDhcpRelay added in v2.5.0

func (egw *EdgeGateway) ResetDhcpRelay() error

ResetDhcpRelay removes all configuration by sending a DELETE request for DHCP relay configuration endpoint

func (*EdgeGateway) Update added in v2.7.0

func (egw *EdgeGateway) Update() error

Update is a wrapper around UpdateAsync The pointer receiver is refreshed after update

func (*EdgeGateway) UpdateAsync added in v2.7.0

func (egw *EdgeGateway) UpdateAsync() (Task, error)

UpdateAsync updates the edge gateway in place with the information contained in the internal structure

func (*EdgeGateway) UpdateDhcpRelay added in v2.5.0

func (egw *EdgeGateway) UpdateDhcpRelay(dhcpRelayConfig *types.EdgeDhcpRelay) (*types.EdgeDhcpRelay, error)

UpdateDhcpRelay updates DHCP relay settings for a particular edge gateway and returns them. The feature itself enables you to leverage your existing DHCP infrastructure from within NSX without any interruption to the IP address management in your environment. DHCP messages are relayed from virtual machine(s) to the designated DHCP server(s) in the physical world. This enables IP addresses within NSX to continue to be in sync with IP addresses in other environments.

func (*EdgeGateway) UpdateFirewallConfig added in v2.4.0

func (egw *EdgeGateway) UpdateFirewallConfig(enabled, defaultLoggingEnabled bool, defaultAction string) (*types.FirewallConfigWithXml, error)

UpdateFirewallConfig allows to update firewall configuration. It accepts three fields (Enabled, DefaultLoggingEnabled, DefaultAction) and uses them to construct types.FirewallConfigWithXml without altering other options to prevent config corruption. They are represented in firewall configuration page in the UI.

func (*EdgeGateway) UpdateLBGeneralParams added in v2.3.0

func (egw *EdgeGateway) UpdateLBGeneralParams(enabled, accelerationEnabled, loggingEnabled bool, logLevel string) (*types.LbGeneralParamsWithXml, error)

UpdateLBGeneralParams allows to update global load balancer configuration. It accepts four fields (Enabled, AccelerationEnabled, Logging.Enable, Logging.LogLevel) and uses them to construct types.LbGeneralParamsWithXml without altering other options to prevent config corruption. They are represented in load balancer global configuration tab in the UI.

func (*EdgeGateway) UpdateLbAppProfile added in v2.3.0

func (egw *EdgeGateway) UpdateLbAppProfile(lbAppProfileConfig *types.LbAppProfile) (*types.LbAppProfile, error)

UpdateLbAppProfile updates types.LbAppProfile with all fields. At least name or ID must be specified. If both - Name and ID are specified it performs a lookup by ID and returns an error if the specified name and found name do not match.

func (*EdgeGateway) UpdateLbAppRule added in v2.3.0

func (egw *EdgeGateway) UpdateLbAppRule(lbAppRuleConfig *types.LbAppRule) (*types.LbAppRule, error)

UpdateLbAppRule updates types.LbAppRule with all fields. At least name or ID must be specified. If both - Name and ID are specified it performs a lookup by ID and returns an error if the specified name and found name do not match.

func (*EdgeGateway) UpdateLbServerPool added in v2.3.0

func (egw *EdgeGateway) UpdateLbServerPool(lbPoolConfig *types.LbPool) (*types.LbPool, error)

UpdateLbServerPool updates types.LbPool with all fields. At least name or ID must be specified. If both - Name and ID are specified it performs a lookup by ID and returns an error if the specified name and found name do not match. Name and Algorithm fields must be populated.

func (*EdgeGateway) UpdateLbServiceMonitor added in v2.3.0

func (egw *EdgeGateway) UpdateLbServiceMonitor(lbMonitorConfig *types.LbMonitor) (*types.LbMonitor, error)

UpdateLbServiceMonitor updates types.LbMonitor with all fields. At least name or ID must be specified. If both - Name and ID are specified it performs a lookup by ID and returns an error if the specified name and found name do not match.

func (*EdgeGateway) UpdateLbVirtualServer added in v2.3.0

func (egw *EdgeGateway) UpdateLbVirtualServer(lbVirtualServerConfig *types.LbVirtualServer) (*types.LbVirtualServer, error)

UpdateLbVirtualServer updates types.LbVirtualServer with all fields. At least name or ID must be specified. If both - Name and ID are specified it performs a lookup by ID and returns an error if the specified name and found name do not match. Name, Protocol, Port and IpAddress fields must be populated

func (*EdgeGateway) UpdateNatRule added in v2.3.0

func (egw *EdgeGateway) UpdateNatRule(natRule *types.NatRule) (*types.NatRule, error)

UpdateNatRule updates NAT rule and handles task. Returns updated NAT rule or error.

func (*EdgeGateway) UpdateNatRuleAsync added in v2.3.0

func (egw *EdgeGateway) UpdateNatRuleAsync(natRule *types.NatRule) (Task, error)

UpdateNatRuleAsync updates NAT rule and returns task or error.

func (*EdgeGateway) UpdateNsxvFirewallRule added in v2.4.0

func (egw *EdgeGateway) UpdateNsxvFirewallRule(firewallRuleConfig *types.EdgeFirewallRule) (*types.EdgeFirewallRule, error)

UpdateNsxvFirewallRule updates types.EdgeFirewallRule with all fields using proxied NSX-V API. Real firewall rule ID (not the number shown in UI) is mandatory to perform the update.

func (*EdgeGateway) UpdateNsxvNatRule added in v2.4.0

func (egw *EdgeGateway) UpdateNsxvNatRule(natRuleConfig *types.EdgeNatRule) (*types.EdgeNatRule, error)

UpdateNsxvNatRule updates types.EdgeNatRule with all fields using proxied NSX-V API. ID is mandatory to perform the update.

type EdgeGatewayCreation added in v2.3.0

type EdgeGatewayCreation struct {
	ExternalNetworks           []string // List of external networks to be linked to this gateway
	DefaultGateway             string   // Which network should be used as default gateway (empty name = no default gateway)
	OrgName                    string   // parent Org
	VdcName                    string   // parent VDC
	Name                       string   // edge gateway name
	Description                string   // Optional description
	BackingConfiguration       string   // Type of backing configuration (compact, full)
	AdvancedNetworkingEnabled  bool     // enable advanced gateway
	HAEnabled                  bool     // enable HA
	UseDefaultRouteForDNSRelay bool     // True if the default gateway should be used as the DNS relay
	DistributedRoutingEnabled  bool     // If advanced networking enabled, also enable distributed routing
}

Simple structure to pass Edge Gateway creation parameters.

type EjectTask

type EjectTask struct {
	*Task
	// contains filtered or unexported fields
}

func NewEjectTask

func NewEjectTask(task *Task, vm *VM) *EjectTask

Creates wrapped Task which is dedicated for eject media functionality and provides additional functionality to answer VM questions

func (*EjectTask) WaitInspectTaskCompletion

func (ejectTask *EjectTask) WaitInspectTaskCompletion(isAnswerYes bool, delay time.Duration) error

function which handles answers for ejecting

func (*EjectTask) WaitTaskCompletion

func (ejectTask *EjectTask) WaitTaskCompletion(isAnswerYes bool) error

Checks the status of the task every 3 seconds and returns when the eject task is either completed or failed

type Envelope

type Envelope struct {
	File []struct {
		HREF      string `xml:"href,attr"`
		ID        string `xml:"id,attr"`
		Size      int    `xml:"size,attr"`
		ChunkSize int    `xml:"chunkSize,attr"`
	} `xml:"References>File"`
}

Envelope is a ovf description root element. File contains information for vmdk files. Namespace: http://schemas.dmtf.org/ovf/envelope/1 Description: Envelope is a ovf description root element. File contains information for vmdk files..

type ExtendedSessionInfo added in v2.14.0

type ExtendedSessionInfo struct {
	User           string
	Org            string
	Roles          []string
	Rights         []string
	Version        string
	ConnectionType string
}

ExtendedSessionInfo collects data regarding a VCD connection

type ExternalNetwork added in v2.2.0

type ExternalNetwork struct {
	ExternalNetwork *types.ExternalNetwork
	// contains filtered or unexported fields
}

func GetExternalNetwork added in v2.2.0

func GetExternalNetwork(vcdClient *VCDClient, networkName string) (*ExternalNetwork, error)

GetExternalNetwork returns an ExternalNetwork reference if the network name matches an existing one. If no valid external network is found, it returns an empty ExternalNetwork reference and an error Deprecated: use vcdClient.GetExternalNetworkByName instead

func NewExternalNetwork added in v2.2.0

func NewExternalNetwork(cli *Client) *ExternalNetwork

func (*ExternalNetwork) Delete added in v2.2.0

func (externalNetwork *ExternalNetwork) Delete() (Task, error)

func (*ExternalNetwork) DeleteWait added in v2.2.0

func (externalNetwork *ExternalNetwork) DeleteWait() error

func (ExternalNetwork) Refresh added in v2.2.0

func (externalNetwork ExternalNetwork) Refresh() error

type ExternalNetworkV2 added in v2.9.0

type ExternalNetworkV2 struct {
	ExternalNetwork *types.ExternalNetworkV2
	// contains filtered or unexported fields
}

ExternalNetworkV2 is a type for version 2 of external network which uses OpenAPI endpoint to manage external networks of both types (NSX-V and NSX-T)

func CreateExternalNetworkV2 added in v2.9.0

func CreateExternalNetworkV2(vcdClient *VCDClient, newExtNet *types.ExternalNetworkV2) (*ExternalNetworkV2, error)

CreateExternalNetworkV2 creates a new external network using OpenAPI endpoint. It can create NSX-V and NSX-T backed networks based on what ExternalNetworkV2.NetworkBackings is provided. types.ExternalNetworkV2 has documented fields.

func GetAllExternalNetworksV2 added in v2.9.0

func GetAllExternalNetworksV2(vcdClient *VCDClient, queryParameters url.Values) ([]*ExternalNetworkV2, error)

GetAllExternalNetworksV2 retrieves all external networks using OpenAPI endpoint. Query parameters can be supplied to perform additional filtering

func GetExternalNetworkV2ById added in v2.9.0

func GetExternalNetworkV2ById(vcdClient *VCDClient, id string) (*ExternalNetworkV2, error)

GetExternalNetworkV2ById retrieves external network by given ID using OpenAPI endpoint

func GetExternalNetworkV2ByName added in v2.9.0

func GetExternalNetworkV2ByName(vcdClient *VCDClient, name string) (*ExternalNetworkV2, error)

GetExternalNetworkV2ByName retrieves external network by given name using OpenAPI endpoint. Returns an error if not exactly one network is found.

func (*ExternalNetworkV2) Delete added in v2.9.0

func (extNet *ExternalNetworkV2) Delete() error

Delete deletes external network using OpenAPI endpoint

func (*ExternalNetworkV2) Update added in v2.9.0

func (extNet *ExternalNetworkV2) Update() (*ExternalNetworkV2, error)

Update updates existing external network using OpenAPI endpoint

type FilterDef added in v2.8.0

type FilterDef struct {
	// A collection of filters (with keys from SupportedFilters)
	Filters map[string]string

	// A list of metadata filters
	Metadata []MetadataDef

	// If true, the query will include metadata fields and search for exact values.
	// Otherwise, the engine will collect metadata fields and search by regexp
	UseMetadataApiFilter bool
}

FilterDef defines all the criteria used by the engine to retrieve data

func NewFilterDef added in v2.8.0

func NewFilterDef() *FilterDef

NewFilterDef builds a new filter definition

func (*FilterDef) AddFilter added in v2.8.0

func (fd *FilterDef) AddFilter(key, value string) error

AddFilter adds a new filter to the criteria

func (*FilterDef) AddMetadataFilter added in v2.8.0

func (fd *FilterDef) AddMetadataFilter(key, value, valueType string, isSystem, useMetadataApiFilter bool) error

AddMetadataFilter adds a new metadata filter to an existing set

type FilterMatch added in v2.8.0

type FilterMatch struct {
	Criteria     *FilterDef
	ExpectedName string
	Entity       interface{}
	EntityType   string
}

FilterMatch contains a filter, the name of the item that is expected to match, and the item itself

func HelperMakeFiltersFromCatalogItem added in v2.8.0

func HelperMakeFiltersFromCatalogItem(catalog *Catalog) ([]FilterMatch, error)

func HelperMakeFiltersFromCatalogs added in v2.8.0

func HelperMakeFiltersFromCatalogs(org *AdminOrg) ([]FilterMatch, error)

func HelperMakeFiltersFromEdgeGateways added in v2.8.0

func HelperMakeFiltersFromEdgeGateways(vdc *Vdc) ([]FilterMatch, error)

HelperMakeFiltersFromEdgeGateways looks at the existing edge gateways and creates a set of criteria to retrieve each of them

func HelperMakeFiltersFromMedia added in v2.8.0

func HelperMakeFiltersFromMedia(vdc *Vdc, catalogName string) ([]FilterMatch, error)

func HelperMakeFiltersFromNetworks added in v2.8.0

func HelperMakeFiltersFromNetworks(vdc *Vdc) ([]FilterMatch, error)

HelperMakeFiltersFromNetworks looks at the existing networks and creates a set of criteria to retrieve each of them

func HelperMakeFiltersFromOrgVdc added in v2.12.0

func HelperMakeFiltersFromOrgVdc(org *Org) ([]FilterMatch, error)

func HelperMakeFiltersFromVappTemplate added in v2.8.0

func HelperMakeFiltersFromVappTemplate(catalog *Catalog) ([]FilterMatch, error)

type GlobalRole added in v2.12.0

type GlobalRole struct {
	GlobalRole *types.GlobalRole
	// contains filtered or unexported fields
}

func (*GlobalRole) AddRights added in v2.12.0

func (globalRole *GlobalRole) AddRights(newRights []types.OpenApiReference) error

AddRights adds a collection of rights to a global role

func (*GlobalRole) Delete added in v2.12.0

func (globalRole *GlobalRole) Delete() error

Delete deletes global role

func (*GlobalRole) GetRights added in v2.12.0

func (globalRole *GlobalRole) GetRights(queryParameters url.Values) ([]*types.Right, error)

GetRights retrieves all rights belonging to a given Global Role. Query parameters can be supplied to perform additional filtering

func (*GlobalRole) GetTenants added in v2.12.0

func (globalRole *GlobalRole) GetTenants(queryParameters url.Values) ([]types.OpenApiReference, error)

GetTenants retrieves all tenants associated to a given Global Role. Query parameters can be supplied to perform additional filtering

func (*GlobalRole) PublishAllTenants added in v2.12.0

func (globalRole *GlobalRole) PublishAllTenants() error

PublishAllTenants publishes a global role to all tenants

func (*GlobalRole) PublishTenants added in v2.12.0

func (globalRole *GlobalRole) PublishTenants(tenants []types.OpenApiReference) error

PublishTenants publishes a global role to one or more tenants, adding to tenants that may already been there

func (*GlobalRole) RemoveAllRights added in v2.12.0

func (globalRole *GlobalRole) RemoveAllRights() error

RemoveAllRights removes all rights from a global role

func (*GlobalRole) RemoveRights added in v2.12.0

func (globalRole *GlobalRole) RemoveRights(removeRights []types.OpenApiReference) error

RemoveRights removes specific rights from a global role

func (*GlobalRole) ReplacePublishedTenants added in v2.12.0

func (globalRole *GlobalRole) ReplacePublishedTenants(tenants []types.OpenApiReference) error

ReplacePublishedTenants publishes a global role to one or more tenants, removing the tenants already present

func (*GlobalRole) UnpublishAllTenants added in v2.12.0

func (globalRole *GlobalRole) UnpublishAllTenants() error

UnpublishAllTenants remove publication status of a global role from all tenants

func (*GlobalRole) UnpublishTenants added in v2.12.0

func (globalRole *GlobalRole) UnpublishTenants(tenants []types.OpenApiReference) error

UnpublishTenants remove tenats from a global role

func (*GlobalRole) Update added in v2.12.0

func (globalRole *GlobalRole) Update() (*GlobalRole, error)

Update updates existing global role

func (*GlobalRole) UpdateRights added in v2.12.0

func (globalRole *GlobalRole) UpdateRights(newRights []types.OpenApiReference) error

UpdateRights replaces existing rights with the given collection of rights

type InspectionFunc

type InspectionFunc func(task *types.Task, howManyTimes int, elapsed time.Duration, first, last bool)

This callback function can be passed to task.WaitInspectTaskCompletion to perform user defined operations * task is the task object being processed * howManyTimes is the number of times the task has been refreshed * elapsed is how much time since the task was initially processed * first is true if this is the first refresh of the task * last is true if the function is being called for the last time.

type Media added in v2.4.0

type Media struct {
	Media *types.Media
	// contains filtered or unexported fields
}

func NewMedia added in v2.4.0

func NewMedia(cli *Client) *Media

func (*Media) AddMetadata deprecated added in v2.4.0

func (media *Media) AddMetadata(key string, value string) (*Media, error)

Deprecated: use Media.AddMetadataEntry.

func (*Media) AddMetadataAsync deprecated added in v2.4.0

func (media *Media) AddMetadataAsync(key string, value string) (Task, error)

Deprecated: use Media.AddMetadataEntryAsync.

func (*Media) AddMetadataEntry added in v2.15.0

func (media *Media) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds Media metadata typedValue and key/value pair provided as input and waits for the task to finish.

func (*Media) AddMetadataEntryAsync added in v2.15.0

func (media *Media) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds Media metadata typedValue and key/value pair provided as input and returns the task.

func (*Media) Delete added in v2.4.0

func (media *Media) Delete() (Task, error)

Deletes the Media Item, returning an error if the vCD call fails. Link to API call: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/DELETE-Media.html

func (*Media) DeleteMetadata deprecated added in v2.4.0

func (media *Media) DeleteMetadata(key string) error

Deprecated: use Media.DeleteMetadataEntry.

func (*Media) DeleteMetadataAsync deprecated added in v2.4.0

func (media *Media) DeleteMetadataAsync(key string) (Task, error)

Deprecated: use Media.DeleteMetadataEntryAsync.

func (*Media) DeleteMetadataEntry added in v2.15.0

func (media *Media) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes Media metadata depending on key provided as input and waits for the task to finish.

func (*Media) DeleteMetadataEntryAsync added in v2.15.0

func (media *Media) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes Media metadata depending on key provided as input and returns the task.

func (*Media) GetMetadata added in v2.4.0

func (media *Media) GetMetadata() (*types.Metadata, error)

GetMetadata returns Media metadata.

func (*Media) MergeMetadata added in v2.16.0

func (media *Media) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges Media metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*Media) MergeMetadataAsync added in v2.16.0

func (media *Media) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges Media metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*Media) Refresh added in v2.4.0

func (media *Media) Refresh() error

Refresh refreshes the media information by href

type MediaItem deprecated

type MediaItem struct {
	MediaItem *types.MediaRecordType
	// contains filtered or unexported fields
}

Deprecated: use MediaRecord

func NewMediaItem deprecated

func NewMediaItem(vdc *Vdc) *MediaItem

Deprecated: use NewMediaRecord

func (*MediaItem) AddMetadata added in v2.4.0

func (mediaItem *MediaItem) AddMetadata(key string, value string) (*MediaItem, error)

AddMetadata adds metadata key/value pair provided as input. Deprecated: Use MediaRecord.AddMetadata.

func (*MediaItem) AddMetadataAsync deprecated added in v2.4.0

func (mediaItem *MediaItem) AddMetadataAsync(key string, value string) (Task, error)

Deprecated: use MediaItem.AddMetadataEntryAsync.

func (*MediaItem) Delete

func (mediaItem *MediaItem) Delete() (Task, error)

Deletes the Media Item, returning an error if the vCD call fails. Link to API call: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/DELETE-Media.html Deprecated: Use MediaRecord.Delete

func (*MediaItem) DeleteMetadata added in v2.4.0

func (mediaItem *MediaItem) DeleteMetadata(key string) error

DeleteMetadata deletes metadata depending on key provided as input from media item. Deprecated: Use MediaRecord.DeleteMetadata.

func (*MediaItem) DeleteMetadataAsync added in v2.4.0

func (mediaItem *MediaItem) DeleteMetadataAsync(key string) (Task, error)

DeleteMetadataAsync deletes metadata depending on key provided as input from MediaItem. Deprecated: Use MediaRecord.DeleteMetadataAsync.

func (*MediaItem) GetMetadata added in v2.4.0

func (mediaItem *MediaItem) GetMetadata() (*types.Metadata, error)

GetMetadata returns MediaItem metadata. Deprecated: Use MediaRecord.GetMetadata.

func (*MediaItem) Refresh added in v2.4.0

func (mediaItem *MediaItem) Refresh() error

Refresh refreshes the media item information by href Deprecated: Use MediaRecord.Refresh

type MediaRecord added in v2.4.0

type MediaRecord struct {
	MediaRecord *types.MediaRecordType
	// contains filtered or unexported fields
}

func NewMediaRecord added in v2.4.0

func NewMediaRecord(cli *Client) *MediaRecord

func (*MediaRecord) AddMetadata deprecated added in v2.4.0

func (mediaRecord *MediaRecord) AddMetadata(key string, value string) (*MediaRecord, error)

Deprecated: use MediaRecord.AddMetadataEntry.

func (*MediaRecord) AddMetadataAsync deprecated added in v2.4.0

func (mediaRecord *MediaRecord) AddMetadataAsync(key string, value string) (Task, error)

Deprecated: use MediaRecord.AddMetadataEntryAsync.

func (*MediaRecord) AddMetadataEntry added in v2.15.0

func (mediaRecord *MediaRecord) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds MediaRecord metadata typedValue and key/value pair provided as input and waits for the task to finish.

func (*MediaRecord) AddMetadataEntryAsync added in v2.15.0

func (mediaRecord *MediaRecord) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds MediaRecord metadata typedValue and key/value pair provided as input and returns the task.

func (*MediaRecord) Delete added in v2.4.0

func (mediaRecord *MediaRecord) Delete() (Task, error)

Deletes the Media Item, returning an error if the vCD call fails. Link to API call: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/DELETE-Media.html

func (*MediaRecord) DeleteMetadata deprecated added in v2.4.0

func (mediaRecord *MediaRecord) DeleteMetadata(key string) error

Deprecated: use MediaRecord.DeleteMetadataEntry.

func (*MediaRecord) DeleteMetadataAsync deprecated added in v2.4.0

func (mediaRecord *MediaRecord) DeleteMetadataAsync(key string) (Task, error)

Deprecated: use MediaRecord.DeleteMetadataEntryAsync.

func (*MediaRecord) DeleteMetadataEntry added in v2.15.0

func (mediaRecord *MediaRecord) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes MediaRecord metadata depending on key provided as input and waits for the task to finish.

func (*MediaRecord) DeleteMetadataEntryAsync added in v2.15.0

func (mediaRecord *MediaRecord) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes MediaRecord metadata depending on key provided as input and returns the task.

func (*MediaRecord) GetMetadata added in v2.4.0

func (mediaRecord *MediaRecord) GetMetadata() (*types.Metadata, error)

GetMetadata returns MediaRecord metadata.

func (*MediaRecord) MergeMetadata added in v2.16.0

func (mediaRecord *MediaRecord) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges MediaRecord metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*MediaRecord) MergeMetadataAsync added in v2.16.0

func (mediaRecord *MediaRecord) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges MediaRecord metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*MediaRecord) Refresh added in v2.4.0

func (mediaRecord *MediaRecord) Refresh() error

Refresh refreshes the media information by href

type MetadataDef added in v2.8.0

type MetadataDef struct {
	Key      string      // name of the field (addressed as metadata:key)
	Type     string      // Type of the field (one of SupportedMetadataTypes)
	Value    interface{} // contents of the metadata field
	IsSystem bool        // if true, the metadata field will be addressed as metadata@SYSTEM:key
}

MetadataDef defines a metadata structure

type MetadataFilter added in v2.8.0

type MetadataFilter struct {
	Type  string
	Value string
}

MetadataFilter is a definition of a value used to filter metadata. It is made of a Type (such as 'STRING', 'INT', 'BOOL") and a Value, which is the value we want to search for.

type NatRule added in v2.3.0

type NatRule struct {
	NatType      string
	NetworkHref  string
	ExternalIP   string
	ExternalPort string
	InternalIP   string
	InternalPort string
	Protocol     string
	IcmpSubType  string
	Description  string
}

Struct which covers NAT rule fields

type NsxtAlbCloud added in v2.13.0

type NsxtAlbCloud struct {
	NsxtAlbCloud *types.NsxtAlbCloud
	// contains filtered or unexported fields
}

NsxtAlbCloud helps to use the virtual infrastructure provided by NSX Advanced Load Balancer, register NSX-T Cloud instances with VMware Cloud Director by consuming NsxtAlbImportableCloud.

func (*NsxtAlbCloud) Delete added in v2.13.0

func (nsxtAlbCloud *NsxtAlbCloud) Delete() error

Delete removes NSX-T ALB Cloud configuration

func (*NsxtAlbCloud) GetAlbImportableServiceEngineGroupById added in v2.13.0

func (nsxtAlbCloud *NsxtAlbCloud) GetAlbImportableServiceEngineGroupById(parentAlbCloudUrn, id string) (*NsxtAlbImportableServiceEngineGroups, error)

GetAlbImportableServiceEngineGroupById Note. ID filtering is performed on client side

func (*NsxtAlbCloud) GetAlbImportableServiceEngineGroupByName added in v2.13.0

func (nsxtAlbCloud *NsxtAlbCloud) GetAlbImportableServiceEngineGroupByName(parentAlbCloudUrn, name string) (*NsxtAlbImportableServiceEngineGroups, error)

GetAlbImportableServiceEngineGroupByName returns importable NSX-T ALB Clouds.

func (*NsxtAlbCloud) GetAllAlbImportableServiceEngineGroups added in v2.13.0

func (nsxtAlbCloud *NsxtAlbCloud) GetAllAlbImportableServiceEngineGroups(parentAlbCloudUrn string, queryParameters url.Values) ([]*NsxtAlbImportableServiceEngineGroups, error)

GetAllAlbImportableServiceEngineGroups lists all Importable Service Engine Groups available in ALB Controller

type NsxtAlbController added in v2.13.0

type NsxtAlbController struct {
	NsxtAlbController *types.NsxtAlbController
	// contains filtered or unexported fields
}

NsxtAlbController helps to integrate VMware Cloud Director with NSX-T Advanced Load Balancer deployment. Controller instances are registered with VMware Cloud Director instance. Controller instances serve as a central control plane for the load-balancing services provided by NSX-T Advanced Load Balancer. To configure an NSX-T ALB one needs to supply AVI Controller endpoint, credentials and license to be used.

func (*NsxtAlbController) Delete added in v2.13.0

func (nsxtAlbController *NsxtAlbController) Delete() error

Delete deletes existing NSX-T ALB Controller

func (*NsxtAlbController) GetAlbImportableCloudByName added in v2.13.0

func (nsxtAlbController *NsxtAlbController) GetAlbImportableCloudByName(name string) (*NsxtAlbImportableCloud, error)

GetAlbImportableCloudByName is attached to NsxtAlbController type for a convenient parent/child relationship

func (*NsxtAlbController) GetAllAlbImportableClouds added in v2.13.0

func (nsxtAlbController *NsxtAlbController) GetAllAlbImportableClouds(queryParameters url.Values) ([]*NsxtAlbImportableCloud, error)

GetAllAlbImportableClouds is attached to NsxtAlbController type for a convenient parent/child relationship

func (*NsxtAlbController) Update added in v2.13.0

func (nsxtAlbController *NsxtAlbController) Update(albControllerConfig *types.NsxtAlbController) (*NsxtAlbController, error)

Update updates existing NSX-T ALB Controller with new supplied albControllerConfig configuration

type NsxtAlbImportableCloud added in v2.13.0

type NsxtAlbImportableCloud struct {
	NsxtAlbImportableCloud *types.NsxtAlbImportableCloud
	// contains filtered or unexported fields
}

NsxtAlbImportableCloud allows user to list importable NSX-T ALB Clouds. Each importable cloud can only be imported once by using NsxtAlbCloud construct. It has a flag AlreadyImported which hints if it is already consumed or not.

type NsxtAlbImportableServiceEngineGroups added in v2.13.0

type NsxtAlbImportableServiceEngineGroups struct {
	NsxtAlbImportableServiceEngineGroups *types.NsxtAlbImportableServiceEngineGroups
	// contains filtered or unexported fields
}

NsxtAlbImportableServiceEngineGroups provides capability to list all Importable Service Engine Groups available in ALB Controller so that they can be consumed by NsxtAlbServiceEngineGroup

Note. The API does not return Importable Service Engine Group once it is consumed.

type NsxtAlbPool added in v2.14.0

type NsxtAlbPool struct {
	NsxtAlbPool *types.NsxtAlbPool
	// contains filtered or unexported fields
}

NsxtAlbPool defines configuration of a single NSX-T ALB Pool. Pools maintain the list of servers assigned to them and perform health monitoring, load balancing, persistence. A pool may only be used or referenced by only one virtual service at a time.

func (*NsxtAlbPool) Delete added in v2.14.0

func (nsxtAlbPool *NsxtAlbPool) Delete() error

Delete deletes NSX-T ALB Pool

func (*NsxtAlbPool) Update added in v2.14.0

func (nsxtAlbPool *NsxtAlbPool) Update(albPoolConfig *types.NsxtAlbPool) (*NsxtAlbPool, error)

Update updates NSX-T ALB Pool based on supplied configuration

type NsxtAlbServiceEngineGroup added in v2.13.0

type NsxtAlbServiceEngineGroup struct {
	NsxtAlbServiceEngineGroup *types.NsxtAlbServiceEngineGroup
	// contains filtered or unexported fields
}

NsxtAlbServiceEngineGroup provides virtual service management capabilities for tenants. This entity can be created by referencing a backing importable service engine group - NsxtAlbImportableServiceEngineGroups.

A service engine group is an isolation domain that also defines shared service engine properties, such as size, network access, and failover. Resources in a service engine group can be used for different virtual services, depending on your tenant needs. These resources cannot be shared between different service engine groups.

func (*NsxtAlbServiceEngineGroup) Delete added in v2.13.0

func (nsxtAlbServiceEngineGroup *NsxtAlbServiceEngineGroup) Delete() error

Delete deletes NSX-T ALB Service Engine Group configuration

func (*NsxtAlbServiceEngineGroup) Sync added in v2.13.0

func (nsxtAlbServiceEngineGroup *NsxtAlbServiceEngineGroup) Sync() error

Sync syncs a specified Load Balancer Service Engine Group. It requests the HA mode and the maximum number of supported Virtual Services for this Service Engine Group from the Load Balancer, and updates vCD's local record of these properties.

func (*NsxtAlbServiceEngineGroup) Update added in v2.13.0

func (nsxtAlbServiceEngineGroup *NsxtAlbServiceEngineGroup) Update(albSEGroupConfig *types.NsxtAlbServiceEngineGroup) (*NsxtAlbServiceEngineGroup, error)

Update updates existing ALB Controller with new supplied albControllerConfig configuration

type NsxtAlbServiceEngineGroupAssignment added in v2.14.0

type NsxtAlbServiceEngineGroupAssignment struct {
	NsxtAlbServiceEngineGroupAssignment *types.NsxtAlbServiceEngineGroupAssignment
	// contains filtered or unexported fields
}

NsxtAlbServiceEngineGroupAssignment handles Service Engine Group Assignment to NSX-T Edge Gateways

func (*NsxtAlbServiceEngineGroupAssignment) Delete added in v2.14.0

func (nsxtEdgeAlbServiceEngineGroup *NsxtAlbServiceEngineGroupAssignment) Delete() error

Delete deletes NSX-T ALB Service Engine Group Assignment

func (*NsxtAlbServiceEngineGroupAssignment) Update added in v2.14.0

Update updates existing ALB Service Engine Group Assignment with new supplied assignmentConfig configuration

type NsxtAlbVirtualService added in v2.14.0

type NsxtAlbVirtualService struct {
	NsxtAlbVirtualService *types.NsxtAlbVirtualService
	// contains filtered or unexported fields
}

NsxtAlbVirtualService combines Load Balancer Pools with Service Engine Groups and exposes a virtual service on defined VIP (virtual IP address) while optionally allowing to use encrypted traffic

func (*NsxtAlbVirtualService) Delete added in v2.14.0

func (nsxtAlbVirtualService *NsxtAlbVirtualService) Delete() error

Delete deletes NSX-T ALB Virtual Service

func (*NsxtAlbVirtualService) Update added in v2.14.0

func (nsxtAlbVirtualService *NsxtAlbVirtualService) Update(albVirtualServiceConfig *types.NsxtAlbVirtualService) (*NsxtAlbVirtualService, error)

Update updates NSX-T ALB Virtual Service based on supplied configuration

type NsxtAppPortProfile added in v2.12.0

type NsxtAppPortProfile struct {
	NsxtAppPortProfile *types.NsxtAppPortProfile
	// contains filtered or unexported fields
}

NsxtAppPortProfile uses OpenAPI endpoint to operate NSX-T Application Port Profiles It can have 3 types of scopes: * SYSTEM - Read-only (The ones that are provided by SYSTEM). Constant `types.ApplicationPortProfileScopeSystem` * PROVIDER - Created by Provider on a particular network provider (NSX-T manager). Constant `types.ApplicationPortProfileScopeProvider` * TENANT (Created by Tenant at Org VDC level). Constant `types.ApplicationPortProfileScopeTenant`

More details about scope in documentation for types.NsxtAppPortProfile

func (*NsxtAppPortProfile) Delete added in v2.12.0

func (appPortProfile *NsxtAppPortProfile) Delete() error

Delete allows users to delete NSX-T Application Port Profile

func (*NsxtAppPortProfile) Update added in v2.12.0

func (appPortProfile *NsxtAppPortProfile) Update(appPortProfileConfig *types.NsxtAppPortProfile) (*NsxtAppPortProfile, error)

Update allows users to update NSX-T Application Port Profile

type NsxtEdgeCluster added in v2.10.0

type NsxtEdgeCluster struct {
	NsxtEdgeCluster *types.NsxtEdgeCluster
	// contains filtered or unexported fields
}

NsxtEdgeCluster is a logical grouping of NSX-T Edge virtual machines.

type NsxtEdgeGateway added in v2.10.0

type NsxtEdgeGateway struct {
	EdgeGateway *types.OpenAPIEdgeGateway
	// contains filtered or unexported fields
}

NsxtEdgeGateway uses OpenAPI endpoint to operate NSX-T Edge Gateways

func (*NsxtEdgeGateway) CreateBgpIpPrefixList added in v2.16.0

func (egw *NsxtEdgeGateway) CreateBgpIpPrefixList(bgpIpPrefixList *types.EdgeBgpIpPrefixList) (*EdgeBgpIpPrefixList, error)

CreateBgpIpPrefixList creates a BGP IP Prefix List with supplied configuration

Note. VCD 10.2 versions do not automatically return ID for created BGP IP Prefix List. To work around it this code automatically retrieves the entity by Name after the task is finished. This function may fail on VCD 10.2 if duplicate BGP IP Prefix Lists exist.

func (*NsxtEdgeGateway) CreateBgpNeighbor added in v2.16.0

func (egw *NsxtEdgeGateway) CreateBgpNeighbor(bgpNeighborConfig *types.EdgeBgpNeighbor) (*EdgeBgpNeighbor, error)

CreateBgpNeighbor creates BGP Neighbor with the given configuration

func (*NsxtEdgeGateway) CreateIpSecVpnTunnel added in v2.12.0

func (egw *NsxtEdgeGateway) CreateIpSecVpnTunnel(ipSecVpnConfig *types.NsxtIpSecVpnTunnel) (*NsxtIpSecVpnTunnel, error)

CreateIpSecVpnTunnel creates IPsec VPN Tunnel and returns it

func (*NsxtEdgeGateway) CreateNatRule added in v2.12.0

func (egw *NsxtEdgeGateway) CreateNatRule(natRuleConfig *types.NsxtNatRule) (*NsxtNatRule, error)

CreateNatRule creates a NAT rule and returns it.

Note. API has a limitation, that it does not return ID for created rule. To work around it this function creates a NAT rule, fetches all rules and finds a rule with exactly the same field values and returns it (including ID) There is still a slight risk to retrieve wrong ID if exactly the same rule already exists.

func (*NsxtEdgeGateway) CreateNsxtFirewallGroup added in v2.12.0

func (egw *NsxtEdgeGateway) CreateNsxtFirewallGroup(firewallGroupConfig *types.NsxtFirewallGroup) (*NsxtFirewallGroup, error)

CreateNsxtFirewallGroup allows users to create NSX-T Firewall Group

func (*NsxtEdgeGateway) Delete added in v2.10.0

func (egw *NsxtEdgeGateway) Delete() error

Delete allows deleting NSX-T edge gateway for sysadmins

func (*NsxtEdgeGateway) DeleteNsxtRouteAdvertisement added in v2.16.0

func (egw *NsxtEdgeGateway) DeleteNsxtRouteAdvertisement() error

DeleteNsxtRouteAdvertisement method is the same as DeleteNsxtRouteAdvertisementWithContext but sending TenantContext by default

func (*NsxtEdgeGateway) DeleteNsxtRouteAdvertisementWithContext added in v2.16.0

func (egw *NsxtEdgeGateway) DeleteNsxtRouteAdvertisementWithContext(useTenantContext bool) error

DeleteNsxtRouteAdvertisementWithContext deletes the list of subnets that will be advertised.

func (*NsxtEdgeGateway) DisableAlb added in v2.14.0

func (egw *NsxtEdgeGateway) DisableAlb() error

DisableAlb is a shortcut wrapping UpdateAlbSettings which disables ALB configuration

func (*NsxtEdgeGateway) DisableBgpConfiguration added in v2.16.0

func (egw *NsxtEdgeGateway) DisableBgpConfiguration() error

DisableBgpConfiguration performs an `UpdateBgpConfiguration` and preserve all field values as they were, but explicitly sets Enabled to false.

func (*NsxtEdgeGateway) GetAlbSettings added in v2.14.0

func (egw *NsxtEdgeGateway) GetAlbSettings() (*types.NsxtAlbConfig, error)

GetAlbSettings retrieves NSX-T ALB settings for a particular Edge Gateway

func (*NsxtEdgeGateway) GetAllBgpIpPrefixLists added in v2.16.0

func (egw *NsxtEdgeGateway) GetAllBgpIpPrefixLists(queryParameters url.Values) ([]*EdgeBgpIpPrefixList, error)

GetAllBgpIpPrefixLists retrieves all BGP IP Prefix Lists in a given NSX-T Edge Gateway with optional queryParameters

func (*NsxtEdgeGateway) GetAllBgpNeighbors added in v2.16.0

func (egw *NsxtEdgeGateway) GetAllBgpNeighbors(queryParameters url.Values) ([]*EdgeBgpNeighbor, error)

GetAllBgpNeighbors retrieves all BGP Neighbors with an optional filter

func (*NsxtEdgeGateway) GetAllIpSecVpnTunnels added in v2.12.0

func (egw *NsxtEdgeGateway) GetAllIpSecVpnTunnels(queryParameters url.Values) ([]*NsxtIpSecVpnTunnel, error)

GetAllIpSecVpnTunnels returns all IPsec VPN Tunnel configurations

func (*NsxtEdgeGateway) GetAllNatRules added in v2.12.0

func (egw *NsxtEdgeGateway) GetAllNatRules(queryParameters url.Values) ([]*NsxtNatRule, error)

GetAllNatRules retrieves all NAT rules with an optional queryParameters filter.

func (*NsxtEdgeGateway) GetAllNsxtFirewallGroups added in v2.12.0

func (egw *NsxtEdgeGateway) GetAllNsxtFirewallGroups(queryParameters url.Values, firewallGroupType string) ([]*NsxtFirewallGroup, error)

GetAllNsxtFirewallGroups allows users to retrieve all NSX-T Firewall Groups in a particular Edge Gateway firewallGroupType can be one of the following: * types.FirewallGroupTypeSecurityGroup - for NSX-T Security Groups * types.FirewallGroupTypeIpSet - for NSX-T IP Sets * "" (empty) - search will not be limited and will get both - IP Sets and Security Groups

func (*NsxtEdgeGateway) GetBgpConfiguration added in v2.16.0

func (egw *NsxtEdgeGateway) GetBgpConfiguration() (*types.EdgeBgpConfig, error)

GetBgpConfiguration retrieves BGP Configuration for NSX-T Edge Gateway

func (*NsxtEdgeGateway) GetBgpIpPrefixListById added in v2.16.0

func (egw *NsxtEdgeGateway) GetBgpIpPrefixListById(id string) (*EdgeBgpIpPrefixList, error)

GetBgpIpPrefixListById retrieves BGP IP Prefix List By ID

func (*NsxtEdgeGateway) GetBgpIpPrefixListByName added in v2.16.0

func (egw *NsxtEdgeGateway) GetBgpIpPrefixListByName(name string) (*EdgeBgpIpPrefixList, error)

GetBgpIpPrefixListByName retrieves BGP IP Prefix List By Name It is meant to retrieve exactly one entry: * Will fail if more than one entry with the same name found * Will return an error containing `ErrorEntityNotFound` if no entries are found

Note. API does not support filtering by 'name' field therefore filtering is performed on client side

func (*NsxtEdgeGateway) GetBgpNeighborById added in v2.16.0

func (egw *NsxtEdgeGateway) GetBgpNeighborById(id string) (*EdgeBgpNeighbor, error)

GetBgpNeighborById retrieves BGP Neighbor By ID

func (*NsxtEdgeGateway) GetBgpNeighborByIp added in v2.16.0

func (egw *NsxtEdgeGateway) GetBgpNeighborByIp(neighborIpAddress string) (*EdgeBgpNeighbor, error)

GetBgpNeighborByIp retrieves BGP Neighbor by Neighbor IP address It is meant to retrieve exactly one entry: * Will fail if more than one entry with the same Neighbor IP found (should not happen as uniqueness is enforced by API) * Will return an error containing `ErrorEntityNotFound` if no entries are found

Note. API does not support filtering by 'neighborIpAddress' field therefore filtering is performed on client side

func (*NsxtEdgeGateway) GetIpSecVpnTunnelById added in v2.12.0

func (egw *NsxtEdgeGateway) GetIpSecVpnTunnelById(id string) (*NsxtIpSecVpnTunnel, error)

GetIpSecVpnTunnelById retrieves single IPsec VPN Tunnel by ID

func (*NsxtEdgeGateway) GetIpSecVpnTunnelByName added in v2.12.0

func (egw *NsxtEdgeGateway) GetIpSecVpnTunnelByName(name string) (*NsxtIpSecVpnTunnel, error)

GetIpSecVpnTunnelByName retrieves single IPsec VPN Tunnel by Name.

Note. Name uniqueness is not enforced therefore it might exist a few IPsec VPN Tunnels with the same name. An error will be returned in that case.

func (*NsxtEdgeGateway) GetNatRuleById added in v2.12.0

func (egw *NsxtEdgeGateway) GetNatRuleById(id string) (*NsxtNatRule, error)

GetNatRuleById finds a NAT rule by ID and returns it

func (*NsxtEdgeGateway) GetNatRuleByName added in v2.12.0

func (egw *NsxtEdgeGateway) GetNatRuleByName(name string) (*NsxtNatRule, error)

GetNatRuleByName finds a NAT rule by Name and returns it

Note. API does not enforce name uniqueness therefore an error will be thrown if two rules with the same name exist

func (*NsxtEdgeGateway) GetNsxtFirewall added in v2.12.0

func (egw *NsxtEdgeGateway) GetNsxtFirewall() (*NsxtFirewall, error)

GetNsxtFirewall retrieves all firewall rules system, default and user defined rules

func (*NsxtEdgeGateway) GetNsxtFirewallGroupById added in v2.12.0

func (egw *NsxtEdgeGateway) GetNsxtFirewallGroupById(id string) (*NsxtFirewallGroup, error)

GetNsxtFirewallGroupById retrieves NSX-T Firewall Group by ID

func (*NsxtEdgeGateway) GetNsxtFirewallGroupByName added in v2.12.0

func (egw *NsxtEdgeGateway) GetNsxtFirewallGroupByName(name string, firewallGroupType string) (*NsxtFirewallGroup, error)

GetNsxtFirewallGroupByName allows users to retrieve Firewall Group by Name in a particular Edge Gateway firewallGroupType can be one of the following: * types.FirewallGroupTypeSecurityGroup - for NSX-T Security Groups * types.FirewallGroupTypeIpSet - for NSX-T IP Sets * "" (empty) - search will not be limited and will get both - IP Sets and Security Groups

Note. One might get an error if IP Set and Security Group exist with the same name (two objects of the same type cannot exist) and firewallGroupType is left empty.

func (*NsxtEdgeGateway) GetNsxtRouteAdvertisement added in v2.16.0

func (egw *NsxtEdgeGateway) GetNsxtRouteAdvertisement() (*types.RouteAdvertisement, error)

GetNsxtRouteAdvertisement method is the same as GetNsxtRouteAdvertisementWithContext but sending TenantContext by default

func (*NsxtEdgeGateway) GetNsxtRouteAdvertisementWithContext added in v2.16.0

func (egw *NsxtEdgeGateway) GetNsxtRouteAdvertisementWithContext(useTenantContext bool) (*types.RouteAdvertisement, error)

GetNsxtRouteAdvertisementWithContext retrieves the list of subnets that will be advertised so that the Edge Gateway can route out to the connected external network.

func (*NsxtEdgeGateway) MoveToVdcOrVdcGroup added in v2.15.0

func (egw *NsxtEdgeGateway) MoveToVdcOrVdcGroup(vdcOrVdcGroupId string) (*NsxtEdgeGateway, error)

MoveToVdcOrVdcGroup moves NSX-T Edge Gateway to another VDC. This can cover such scenarios: * Move from VDC to VDC Group * Move from VDC Group to VDC (which is part of that VDC Group)

This function is just an Update operation with OwnerRef changed to vdcGroupId, but it is more convenient to use it. Note. NSX-T Edge Gateway cannot be moved directly from one VDC to another

func (*NsxtEdgeGateway) Update added in v2.10.0

func (egw *NsxtEdgeGateway) Update(edgeGatewayConfig *types.OpenAPIEdgeGateway) (*NsxtEdgeGateway, error)

Update allows updating NSX-T edge gateway for Org admins

func (*NsxtEdgeGateway) UpdateAlbSettings added in v2.14.0

func (egw *NsxtEdgeGateway) UpdateAlbSettings(config *types.NsxtAlbConfig) (*types.NsxtAlbConfig, error)

UpdateAlbSettings updates NSX-T ALB settings for a particular Edge Gateway

func (*NsxtEdgeGateway) UpdateBgpConfiguration added in v2.16.0

func (egw *NsxtEdgeGateway) UpdateBgpConfiguration(bgpConfig *types.EdgeBgpConfig) (*types.EdgeBgpConfig, error)

UpdateBgpConfiguration updates BGP configuration on NSX-T Edge Gateway

Note. Update of BGP configuration requires version to be specified in 'Version' field. This function automatically handles it.

func (*NsxtEdgeGateway) UpdateNsxtFirewall added in v2.12.0

func (egw *NsxtEdgeGateway) UpdateNsxtFirewall(firewallRules *types.NsxtFirewallRuleContainer) (*NsxtFirewall, error)

UpdateNsxtFirewall allows user to set new firewall rules or update existing ones. The API does not have POST endpoint and always uses PUT endpoint for creating and updating.

func (*NsxtEdgeGateway) UpdateNsxtRouteAdvertisement added in v2.16.0

func (egw *NsxtEdgeGateway) UpdateNsxtRouteAdvertisement(enable bool, subnets []string) (*types.RouteAdvertisement, error)

UpdateNsxtRouteAdvertisement method is the same as UpdateNsxtRouteAdvertisementWithContext but sending TenantContext by default

func (*NsxtEdgeGateway) UpdateNsxtRouteAdvertisementWithContext added in v2.16.0

func (egw *NsxtEdgeGateway) UpdateNsxtRouteAdvertisementWithContext(enable bool, subnets []string, useTenantContext bool) (*types.RouteAdvertisement, error)

UpdateNsxtRouteAdvertisementWithContext updates the list of subnets that will be advertised so that the Edge Gateway can route out to the connected external network.

type NsxtFirewall added in v2.12.0

type NsxtFirewall struct {
	NsxtFirewallRuleContainer *types.NsxtFirewallRuleContainer
	// contains filtered or unexported fields
}

NsxtFirewall contains a types.NsxtFirewallRuleContainer which encloses three types of rules - system, default and user defined rules. User defined rules are the only ones that can be modified, others are read-only.

func (*NsxtFirewall) DeleteAllRules added in v2.12.0

func (firewall *NsxtFirewall) DeleteAllRules() error

DeleteAllRules allows users to delete all NSX-T Firewall rules in a particular Edge Gateway

func (*NsxtFirewall) DeleteRuleById added in v2.12.0

func (firewall *NsxtFirewall) DeleteRuleById(id string) error

DeleteRuleById allows users to delete NSX-T Firewall Rule By ID

type NsxtFirewallGroup added in v2.12.0

type NsxtFirewallGroup struct {
	NsxtFirewallGroup *types.NsxtFirewallGroup
	// contains filtered or unexported fields
}

NsxtFirewallGroup uses OpenAPI endpoint to operate NSX-T Security Groups and IP Sets which use the same Firewall Group API endpoint

IP sets are groups of objects to which the firewall rules apply. Combining multiple objects into IP sets helps reduce the total number of firewall rules to be created.

Security groups are groups of Org Vdc networks to which distributed firewall rules apply. Grouping networks helps you to reduce the total number of distributed firewall rules to be created.

func (*NsxtFirewallGroup) Delete added in v2.12.0

func (firewallGroup *NsxtFirewallGroup) Delete() error

Delete allows users to delete NSX-T Firewall Group

func (*NsxtFirewallGroup) GetAssociatedVms added in v2.12.0

func (firewallGroup *NsxtFirewallGroup) GetAssociatedVms() ([]*types.NsxtFirewallGroupMemberVms, error)

GetAssociatedVms allows users to retrieve a list of references to child VMs (with vApps when they exist).

Note. Only Security Groups have associated VMs. Executing it on an IP Set will return an error similar to: "only Security Groups have associated VMs. This Firewall Group has type 'IP_SET'"

func (*NsxtFirewallGroup) IsDynamicSecurityGroup added in v2.16.0

func (firewallGroup *NsxtFirewallGroup) IsDynamicSecurityGroup() bool

IsDynamicSecurityGroup allows users to check if Firewall Group is a Dynamic Security Group

func (*NsxtFirewallGroup) IsIpSet added in v2.12.0

func (firewallGroup *NsxtFirewallGroup) IsIpSet() bool

IsIpSet allows users to check if Firewall Group is an IP Set

func (*NsxtFirewallGroup) IsSecurityGroup added in v2.12.0

func (firewallGroup *NsxtFirewallGroup) IsSecurityGroup() bool

IsSecurityGroup allows users to check if Firewall Group is a Static Security Group

func (*NsxtFirewallGroup) Update added in v2.12.0

func (firewallGroup *NsxtFirewallGroup) Update(firewallGroupConfig *types.NsxtFirewallGroup) (*NsxtFirewallGroup, error)

Update allows users to update NSX-T Firewall Group

type NsxtImportableSwitch added in v2.11.0

type NsxtImportableSwitch struct {
	NsxtImportableSwitch *types.NsxtImportableSwitch
	// contains filtered or unexported fields
}

NsxtImportableSwitch is a read only object to retrieve NSX-T segments (importable switches) to be used for Org VDC imported network.

type NsxtIpSecVpnTunnel added in v2.12.0

type NsxtIpSecVpnTunnel struct {
	NsxtIpSecVpn *types.NsxtIpSecVpnTunnel
	// contains filtered or unexported fields
}

NsxtIpSecVpnTunnel offers site-to-site connectivity between an Edge Gateway and remote sites which also use NSX-T Data Center or which have either third-party hardware routers or VPN gateways that support IPsec. Policy-based IPsec VPN requires a VPN policy to be applied to packets to determine which traffic is to be protected by IPsec before being passed through a VPN tunnel. This type of VPN is considered static because when a local network topology and configuration change, the VPN policy settings must also be updated to accommodate the changes. NSX-T Data Center Edge Gateways support split tunnel configuration, with IPsec traffic taking routing precedence. VMware Cloud Director supports automatic route redistribution when you use IPsec VPN on an NSX-T edge gateway.

func (*NsxtIpSecVpnTunnel) Delete added in v2.12.0

func (ipSecVpn *NsxtIpSecVpnTunnel) Delete() error

Delete allows users to delete NSX-T IPsec VPN Tunnel

func (*NsxtIpSecVpnTunnel) GetStatus added in v2.12.0

func (ipSecVpn *NsxtIpSecVpnTunnel) GetStatus() (*types.NsxtIpSecVpnTunnelStatus, error)

GetStatus returns status of IPsec VPN Tunnel.

Note. This is not being immediately populated and may appear after some time depending on NsxtIpSecVpnTunnelSecurityProfile.DpdConfiguration

func (*NsxtIpSecVpnTunnel) GetTunnelConnectionProperties added in v2.12.0

func (ipSecVpn *NsxtIpSecVpnTunnel) GetTunnelConnectionProperties() (*types.NsxtIpSecVpnTunnelSecurityProfile, error)

GetTunnelConnectionProperties retrieves IPsec VPN Tunnel Security Profile

func (*NsxtIpSecVpnTunnel) IsEqualTo added in v2.12.0

func (ipSecVpn *NsxtIpSecVpnTunnel) IsEqualTo(vpnConfig *types.NsxtIpSecVpnTunnel) bool

IsEqualTo helps to find NSX-T IPsec VPN Tunnel Configuration Combination of LocalAddress and RemoteAddress has to be unique (enforced by API). This is a list of fields compared: * LocalEndpoint.LocalAddress * RemoteEndpoint.RemoteAddress

func (*NsxtIpSecVpnTunnel) Update added in v2.12.0

func (ipSecVpn *NsxtIpSecVpnTunnel) Update(ipSecVpnConfig *types.NsxtIpSecVpnTunnel) (*NsxtIpSecVpnTunnel, error)

Update updates NSX-T IPsec VPN Tunnel configuration with newly supplied data.

func (*NsxtIpSecVpnTunnel) UpdateTunnelConnectionProperties added in v2.12.0

func (ipSecVpn *NsxtIpSecVpnTunnel) UpdateTunnelConnectionProperties(ipSecVpnTunnelConnectionProperties *types.NsxtIpSecVpnTunnelSecurityProfile) (*types.NsxtIpSecVpnTunnelSecurityProfile, error)

UpdateTunnelConnectionProperties allows user to customize IPsec VPN Tunnel Security Profile when the default one does not fit requirements.

type NsxtNatRule added in v2.12.0

type NsxtNatRule struct {
	NsxtNatRule *types.NsxtNatRule
	// contains filtered or unexported fields
}

NsxtNatRule describes a single NAT rule of 5 different Rule Types - DNAT`, `NO_DNAT`, `SNAT`, `NO_SNAT`, 'REFLEXIVE' 'REFLEXIVE' is only supported in API 35.2 (VCD 10.2.2+)

A SNAT or a DNAT rule on an Edge Gateway in the VMware Cloud Director environment is always configured from the perspective of your organization VDC. DNAT and NO_DNAT - outside traffic going inside SNAT and NO_SNAT - inside traffic going outside More docs in https://docs.vmware.com/en/VMware-Cloud-Director/10.2/VMware-Cloud-Director-Tenant-Portal-Guide/GUID-9E43E3DC-C028-47B3-B7CA-59F0ED40E0A6.html

Note. This structure and all its API calls will require at least API version 34.0, but will elevate it to 35.2 if possible because API 35.2 introduces support for 2 new fields FirewallMatch and Priority.

func (*NsxtNatRule) Delete added in v2.12.0

func (nsxtNat *NsxtNatRule) Delete() error

Delete deletes NSX-T NAT rule

func (*NsxtNatRule) IsEqualTo added in v2.12.0

func (nsxtNat *NsxtNatRule) IsEqualTo(rule *types.NsxtNatRule) bool

IsEqualTo allows to check if a rule has exactly the same fields (except ID) to the supplied rule This validation is very tricky because minor version changes impact how fields are return. This function relies on most common and stable fields: * Name * Enabled * Description * ExternalAddresses * InternalAddresses * ApplicationPortProfile.ID

func (*NsxtNatRule) Update added in v2.12.0

func (nsxtNat *NsxtNatRule) Update(natRuleConfig *types.NsxtNatRule) (*NsxtNatRule, error)

Update allows users to update NSX-T NAT rule

type NsxtTier0Router added in v2.9.0

type NsxtTier0Router struct {
	NsxtTier0Router *types.NsxtTier0Router
	// contains filtered or unexported fields
}

NsxtTier0Router

type OpenApiOrgVdcNetwork added in v2.11.0

type OpenApiOrgVdcNetwork struct {
	OpenApiOrgVdcNetwork *types.OpenApiOrgVdcNetwork
	// contains filtered or unexported fields
}

OpenApiOrgVdcNetwork uses OpenAPI endpoint to operate both - NSX-T and NSX-V Org VDC networks

func (*OpenApiOrgVdcNetwork) AddMetadataEntry added in v2.15.0

func (openApiOrgVdcNetwork *OpenApiOrgVdcNetwork) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds OpenApiOrgVdcNetwork metadata typedValue and key/value pair provided as input and waits for the task to finish. TODO: This function is currently using XML API underneath as OpenAPI metadata is supported from v37.0 and is currently in alpha at the moment. See https://github.com/vmware/go-vcloud-director/pull/455

func (*OpenApiOrgVdcNetwork) DeletNetworkDhcp added in v2.16.0

func (orgVdcNet *OpenApiOrgVdcNetwork) DeletNetworkDhcp() error

DeletNetworkDhcp allows to perform HTTP DELETE request on DHCP pool configuration for Org network

func (*OpenApiOrgVdcNetwork) Delete added in v2.11.0

func (orgVdcNet *OpenApiOrgVdcNetwork) Delete() error

Delete allows to delete Org VDC network

func (*OpenApiOrgVdcNetwork) DeleteMetadataEntry added in v2.15.0

func (openApiOrgVdcNetwork *OpenApiOrgVdcNetwork) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes OpenApiOrgVdcNetwork metadata depending on key provided as input and waits for the task to finish. TODO: This function is currently using XML API underneath as OpenAPI metadata is supported from v37.0 and is currently in alpha at the moment. // TODO: This function is currently using XML underneath as metadata is supported in v37.0 and at the moment is in alpha state. See https://github.com/vmware/go-vcloud-director/pull/455

func (*OpenApiOrgVdcNetwork) GetMetadata added in v2.15.0

func (openApiOrgVdcNetwork *OpenApiOrgVdcNetwork) GetMetadata() (*types.Metadata, error)

GetMetadata returns OpenApiOrgVdcNetwork metadata. TODO: This function is currently using XML API underneath as OpenAPI metadata is supported from v37.0 and is currently in alpha at the moment. See https://github.com/vmware/go-vcloud-director/pull/455

func (*OpenApiOrgVdcNetwork) GetOpenApiOrgVdcNetworkDhcp added in v2.16.0

func (orgVdcNet *OpenApiOrgVdcNetwork) GetOpenApiOrgVdcNetworkDhcp() (*OpenApiOrgVdcNetworkDhcp, error)

GetOpenApiOrgVdcNetworkDhcp allows to retrieve DHCP configuration for specific Org VDC network

func (*OpenApiOrgVdcNetwork) GetType added in v2.11.0

func (orgVdcNet *OpenApiOrgVdcNetwork) GetType() string

GetType returns type of Org VDC network

func (*OpenApiOrgVdcNetwork) IsDirect added in v2.11.0

func (orgVdcNet *OpenApiOrgVdcNetwork) IsDirect() bool

IsDirect returns true if the network type is direct (NSX-V only)

func (*OpenApiOrgVdcNetwork) IsImported added in v2.11.0

func (orgVdcNet *OpenApiOrgVdcNetwork) IsImported() bool

IsImported returns true if the network type is imported (NSX-T only)

func (*OpenApiOrgVdcNetwork) IsIsolated added in v2.11.0

func (orgVdcNet *OpenApiOrgVdcNetwork) IsIsolated() bool

IsIsolated returns true if the network type is isolated (NSX-V and NSX-T)

func (*OpenApiOrgVdcNetwork) IsRouted added in v2.11.0

func (orgVdcNet *OpenApiOrgVdcNetwork) IsRouted() bool

IsRouted returns true if the network type is isolated (NSX-V and NSX-T)

func (*OpenApiOrgVdcNetwork) MergeMetadata added in v2.16.0

func (openApiOrgVdcNetwork *OpenApiOrgVdcNetwork) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges OpenApiOrgVdcNetwork metadata provided as a key-value map of type `typedValue` with the already present in VCD, and waits for the task to finish. TODO: This function is currently using XML API underneath as OpenAPI metadata is supported from v37.0 and is currently in alpha at the moment. See https://github.com/vmware/go-vcloud-director/pull/455

func (*OpenApiOrgVdcNetwork) Update added in v2.11.0

func (orgVdcNet *OpenApiOrgVdcNetwork) Update(OrgVdcNetworkConfig *types.OpenApiOrgVdcNetwork) (*OpenApiOrgVdcNetwork, error)

Update allows to update Org VDC network

func (*OpenApiOrgVdcNetwork) UpdateDhcp added in v2.16.0

func (orgVdcNet *OpenApiOrgVdcNetwork) UpdateDhcp(orgVdcNetworkDhcpConfig *types.OpenApiOrgVdcNetworkDhcp) (*OpenApiOrgVdcNetworkDhcp, error)

UpdateDhcp updates DHCP configuration for specific Org VDC network

type OpenApiOrgVdcNetworkDhcp added in v2.11.0

type OpenApiOrgVdcNetworkDhcp struct {
	OpenApiOrgVdcNetworkDhcp *types.OpenApiOrgVdcNetworkDhcp
	// contains filtered or unexported fields
}

OpenApiOrgVdcNetwork uses OpenAPI endpoint to operate both - NSX-T and NSX-V Org VDC network DHCP settings

type Org

type Org struct {
	Org *types.Org

	TenantContext *TenantContext
	// contains filtered or unexported fields
}

func GetOrgByName

func GetOrgByName(vcdClient *VCDClient, orgName string) (Org, error)

If user specifies a valid organization name, then this returns a organization object. If no valid org is found, it returns an empty org and no error. Otherwise it returns an error and an empty Org object Deprecated: Use vcdClient.GetOrgByName instead

func NewOrg

func NewOrg(client *Client) *Org

func (*Org) CreateCatalog

func (org *Org) CreateCatalog(name, description string) (Catalog, error)

CreateCatalog creates a catalog with given name and description under the given organization. Returns an Catalog that contains a creation task. API Documentation: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/POST-CreateCatalog.html

func (*Org) CreateCatalogWithStorageProfile added in v2.10.0

func (org *Org) CreateCatalogWithStorageProfile(name, description string, storageProfiles *types.CatalogStorageProfiles) (*Catalog, error)

CreateCatalogWithStorageProfile is like CreateCatalog but additionally allows to specify storage profiles

func (*Org) CreateNsxtAppPortProfile added in v2.12.0

func (org *Org) CreateNsxtAppPortProfile(appPortProfileConfig *types.NsxtAppPortProfile) (*NsxtAppPortProfile, error)

CreateNsxtAppPortProfile allows users to create NSX-T Application Port Profile definition. It can have 3 types of scopes: * SYSTEM (The ones that are provided by SYSTEM) Read-only * PROVIDER (Created by Provider globally) * TENANT (Create by tenant at Org level) More details about scope in documentation for types.NsxtAppPortProfile

func (*Org) CreateOpenApiOrgVdcNetwork added in v2.15.0

func (org *Org) CreateOpenApiOrgVdcNetwork(orgVdcNetworkConfig *types.OpenApiOrgVdcNetwork) (*OpenApiOrgVdcNetwork, error)

CreateOpenApiOrgVdcNetwork allows to create NSX-T or NSX-V Org VDC network

func (*Org) FindCatalog

func (org *Org) FindCatalog(catalogName string) (Catalog, error)

Given a valid catalog name, FindCatalog returns a Catalog object. If no catalog is found, then returns an empty catalog and no error. Otherwise it returns an error. Deprecated: use org.GetCatalogByName instead

func (*Org) GetAllNsxtAppPortProfiles added in v2.12.0

func (org *Org) GetAllNsxtAppPortProfiles(queryParameters url.Values, scope string) ([]*NsxtAppPortProfile, error)

GetAllNsxtAppPortProfiles returns all NSX-T Application Port Profiles for specific scope More details about scope in documentation for types.NsxtAppPortProfile

func (*Org) GetAllNsxtEdgeGateways added in v2.10.0

func (org *Org) GetAllNsxtEdgeGateways(queryParameters url.Values) ([]*NsxtEdgeGateway, error)

GetAllNsxtEdgeGateways allows to retrieve all NSX-T edge gateways for Org users

func (*Org) GetAllNsxtFirewallGroups added in v2.12.0

func (org *Org) GetAllNsxtFirewallGroups(queryParameters url.Values, firewallGroupType string) ([]*NsxtFirewallGroup, error)

GetAllNsxtFirewallGroups allows users to retrieve all Firewall Groups for Org firewallGroupType can be one of the following: * types.FirewallGroupTypeSecurityGroup - for NSX-T Security Groups * types.FirewallGroupTypeIpSet - for NSX-T IP Sets * "" (empty) - search will not be limited and will get both - IP Sets and Security Groups

It is possible to add additional filtering by using queryParameters of type 'url.Values'. One special filter is `_context==` filtering. Value can be one of the following:

* Org Vdc Network ID (_context==networkId) - Returns all the firewall groups which the specified network is a member of.

* Edge Gateway ID (_context==edgeGatewayId) - Returns all the firewall groups which are available to the specific edge gateway. Or use a shorthand NsxtEdgeGateway.GetAllNsxtFirewallGroups() which automatically injects this filter.

* Network Provider ID (_context==networkProviderId) - Returns all the firewall groups which are available under a specific network provider. This context requires system admin privilege. 'networkProviderId' is NSX-T manager ID

func (*Org) GetAllOpenApiOrgVdcNetworks added in v2.15.0

func (org *Org) GetAllOpenApiOrgVdcNetworks(queryParameters url.Values) ([]*OpenApiOrgVdcNetwork, error)

GetAllOpenApiOrgVdcNetworks allows to retrieve all NSX-T or NSX-V Org VDC networks in Org

Note. If pageSize > 32 it will be limited to maximum of 32 in this function because API validation does not allow for higher number

func (*Org) GetAllSecurityTagValues added in v2.16.0

func (org *Org) GetAllSecurityTagValues(queryParameters url.Values) ([]types.SecurityTagValue, error)

GetAllSecurityTagValues Retrieves the list of security tags that are in the organization and can be reused to tag an entity. The list of tags include tags assigned to entities within the organization. This function works from API v36.0 (VCD 10.3.0+)

func (*Org) GetAllSecurityTaggedEntities added in v2.16.0

func (org *Org) GetAllSecurityTaggedEntities(queryParameters url.Values) ([]types.SecurityTaggedEntity, error)

GetAllSecurityTaggedEntities Retrieves the list of entities that have at least one tag assigned to it. queryParameters allows users to pass filters: I.e: filter=(tag==Web;entityType==vm) This function works from API v36.0 (VCD 10.3.0+)

func (*Org) GetAllSecurityTaggedEntitiesByName added in v2.16.0

func (org *Org) GetAllSecurityTaggedEntitiesByName(securityTagName string) ([]types.SecurityTaggedEntity, error)

GetAllSecurityTaggedEntitiesByName wraps GetAllSecurityTaggedEntities and returns ErrorEntityNotFound if nothing was found This function works from API v36.0 (VCD 10.3.0+)

func (*Org) GetAllVdcComputePolicies added in v2.9.0

func (org *Org) GetAllVdcComputePolicies(queryParameters url.Values) ([]*VdcComputePolicy, error)

GetAllVdcComputePolicies retrieves all VDC compute policies using OpenAPI endpoint. Query parameters can be supplied to perform additional filtering Deprecated: use client.GetAllVdcComputePolicies

func (*Org) GetAnyTypeEdgeGatewayById added in v2.15.0

func (org *Org) GetAnyTypeEdgeGatewayById(id string) (*AnyTypeEdgeGateway, error)

GetNsxtEdgeGatewayById allows retrieving NSX-T or NSX-V Edge Gateway by ID for Org users

func (*Org) GetCatalogAccessControl added in v2.9.0

func (org *Org) GetCatalogAccessControl(catalogIdentifier string, useTenantContext bool) (*types.ControlAccessParams, error)

GetCatalogAccessControl is a convenience method to retrieve access control for a catalog from an organization. The input variable catalogIdentifier can be either the catalog name or its ID

func (*Org) GetCatalogByHref added in v2.4.0

func (org *Org) GetCatalogByHref(catalogHref string) (*Catalog, error)

GetCatalogByHref finds a Catalog by HREF On success, returns a pointer to the Catalog structure and a nil error On failure, returns a nil pointer and an error

func (*Org) GetCatalogById added in v2.4.0

func (org *Org) GetCatalogById(catalogId string, refresh bool) (*Catalog, error)

GetCatalogById finds a Catalog by ID On success, returns a pointer to the Catalog structure and a nil error On failure, returns a nil pointer and an error

func (*Org) GetCatalogByName added in v2.4.0

func (org *Org) GetCatalogByName(catalogName string, refresh bool) (*Catalog, error)

GetCatalogByName finds a Catalog by Name On success, returns a pointer to the Catalog structure and a nil error On failure, returns a nil pointer and an error

refresh has no effect here, but is kept to preserve signature

func (*Org) GetCatalogByNameOrId added in v2.4.0

func (org *Org) GetCatalogByNameOrId(identifier string, refresh bool) (*Catalog, error)

GetCatalogByNameOrId finds a Catalog by name or ID On success, returns a pointer to the Catalog structure and a nil error On failure, returns a nil pointer and an error

func (*Org) GetMetadata added in v2.15.0

func (org *Org) GetMetadata() (*types.Metadata, error)

GetMetadata returns the Org metadata of the corresponding organization seen as administrator

func (*Org) GetNsxtAppPortProfileById added in v2.12.0

func (org *Org) GetNsxtAppPortProfileById(id string) (*NsxtAppPortProfile, error)

GetNsxtAppPortProfileById retrieves NSX-T Application Port Profile by ID

func (*Org) GetNsxtAppPortProfileByName added in v2.12.0

func (org *Org) GetNsxtAppPortProfileByName(name, scope string) (*NsxtAppPortProfile, error)

GetNsxtAppPortProfileByName allows users to retrieve Application Port Profiles for specific scope. More details in documentation for types.NsxtAppPortProfile

Note. Names are enforced to be unique per scope

func (*Org) GetNsxtEdgeGatewayById added in v2.10.0

func (org *Org) GetNsxtEdgeGatewayById(id string) (*NsxtEdgeGateway, error)

GetNsxtEdgeGatewayById allows retrieving NSX-T edge gateway by ID for Org users

func (*Org) GetNsxtEdgeGatewayByName added in v2.10.0

func (org *Org) GetNsxtEdgeGatewayByName(name string) (*NsxtEdgeGateway, error)

GetNsxtEdgeGatewayByName allows retrieving NSX-T edge gateway by Name for Org admins

func (*Org) GetNsxtEdgeGatewayByNameAndOwnerId added in v2.15.0

func (org *Org) GetNsxtEdgeGatewayByNameAndOwnerId(edgeGatewayName, ownerId string) (*NsxtEdgeGateway, error)

GetNsxtEdgeGatewayByNameAndOwnerId looks up NSX-T Edge Gateway by name and its owner ID (owner can be VDC or VDC Group).

func (*Org) GetNsxtFirewallGroupById added in v2.12.0

func (org *Org) GetNsxtFirewallGroupById(id string) (*NsxtFirewallGroup, error)

GetNsxtFirewallGroupById retrieves NSX-T Firewall Group by ID

func (*Org) GetNsxtFirewallGroupByName added in v2.12.0

func (org *Org) GetNsxtFirewallGroupByName(name, firewallGroupType string) (*NsxtFirewallGroup, error)

GetNsxtFirewallGroupByName allows users to retrieve Firewall Group by Name firewallGroupType can be one of the following: * types.FirewallGroupTypeSecurityGroup - for NSX-T Security Groups * types.FirewallGroupTypeIpSet - for NSX-T IP Sets * "" (empty) - search will not be limited and will get both - IP Sets and Security Groups

Note. One might get an error if IP Set and Security Group exist with the same name (two objects of the same type cannot exist) and firewallGroupType is left empty.

func (*Org) GetOpenApiOrgVdcNetworkById added in v2.11.0

func (org *Org) GetOpenApiOrgVdcNetworkById(id string) (*OpenApiOrgVdcNetwork, error)

GetOpenApiOrgVdcNetworkById allows to retrieve both - NSX-T and NSX-V Org VDC networks

func (*Org) GetOpenApiOrgVdcNetworkByNameAndOwnerId added in v2.15.0

func (org *Org) GetOpenApiOrgVdcNetworkByNameAndOwnerId(name, ownerId string) (*OpenApiOrgVdcNetwork, error)

GetOpenApiOrgVdcNetworkByNameAndOwnerId allows to retrieve both - NSX-T and NSX-V Org VDC networks by network name and Owner (VDC or VDC Group) ID

func (*Org) GetTaskList added in v2.9.0

func (org *Org) GetTaskList() (*types.TasksList, error)

GetTaskList returns Tasks for Organization and error.

func (*Org) GetVDCByHref added in v2.4.0

func (org *Org) GetVDCByHref(vdcHref string) (*Vdc, error)

GetVDCByHref finds a VDC by HREF On success, returns a pointer to the VDC structure and a nil error On failure, returns a nil pointer and an error

func (*Org) GetVDCById added in v2.4.0

func (org *Org) GetVDCById(vdcId string, refresh bool) (*Vdc, error)

GetVDCById finds a VDC by ID On success, returns a pointer to the VDC structure and a nil error On failure, returns a nil pointer and an error

refresh has no effect and is kept to preserve signature

func (*Org) GetVDCByName added in v2.4.0

func (org *Org) GetVDCByName(vdcName string, refresh bool) (*Vdc, error)

GetVDCByName finds a VDC by Name On success, returns a pointer to the VDC structure and a nil error On failure, returns a nil pointer and an error

refresh has no effect and is kept to preserve signature

func (*Org) GetVDCByNameOrId added in v2.4.0

func (org *Org) GetVDCByNameOrId(identifier string, refresh bool) (*Vdc, error)

GetVDCByNameOrId finds a VDC by name or ID On success, returns a pointer to the VDC structure and a nil error On failure, returns a nil pointer and an error

refresh has no effect and is kept to preserve signature

func (*Org) GetVdcByName

func (org *Org) GetVdcByName(vdcname string) (Vdc, error)

GetVdcByName if user specifies valid vdc name then this returns a vdc object. If no vdc is found, then it returns an empty vdc and no error. Otherwise it returns an empty vdc and an error. Deprecated: use org.GetVDCByName instead

func (*Org) GetVdcComputePolicyById added in v2.9.0

func (org *Org) GetVdcComputePolicyById(id string) (*VdcComputePolicy, error)

GetVdcComputePolicyById retrieves VDC compute policy by given ID Deprecated: use client.GetVdcComputePolicyById

func (*Org) GetVdcGroupById added in v2.15.0

func (org *Org) GetVdcGroupById(id string) (*VdcGroup, error)

GetVdcGroupById Returns VDC group using provided ID

func (*Org) QueryCatalogList added in v2.8.0

func (org *Org) QueryCatalogList() ([]*types.CatalogRecord, error)

QueryCatalogList returns a list of catalogs for this organization

func (*Org) QueryOrgVdcList added in v2.12.0

func (org *Org) QueryOrgVdcList() ([]*types.QueryResultOrgVdcRecordType, error)

QueryOrgVdcList returns all Org VDCs using query endpoint

Note. Being a 'System' user it will not return any VDC

func (*Org) QueryVmById added in v2.12.0

func (org *Org) QueryVmById(id string) (*VM, error)

QueryVmById retrieves a standalone VM by ID in an Org It can also retrieve a standard VM (created from vApp)

func (*Org) QueryVmList added in v2.12.0

func (org *Org) QueryVmList(filter types.VmQueryFilter) ([]*types.QueryResultVMRecordType, error)

QueryVmList returns a list of all VMs in a given Org

func (*Org) Refresh

func (org *Org) Refresh() error

Given an org with a valid HREF, the function refetches the org and updates the user's org data. Otherwise if the function fails, it returns an error. Users should use refresh whenever they have a stale org due to the creation/update/deletion of a resource within the org or the org itself.

func (*Org) SearchByFilter added in v2.8.0

func (org *Org) SearchByFilter(queryType string, criteria *FilterDef) ([]QueryItem, string, error)

SearchByFilter runs the search for a specific Org

func (*Org) UpdateSecurityTag added in v2.16.0

func (org *Org) UpdateSecurityTag(securityTag *types.SecurityTag) (*types.SecurityTag, error)

UpdateSecurityTag updates the entities associated with a Security Tag. Only the list of tagged entities can be updated. The name cannot be updated. Any other existing entities not in the list will be untagged. This function works from API v36.0 (VCD 10.3.0+)

type OrgGroup added in v2.8.0

type OrgGroup struct {
	Group *types.Group

	AdminOrg *AdminOrg // needed to be able to update, as the list of roles is found in the Org
	// contains filtered or unexported fields
}

OrgGroup defines group structure

func NewGroup added in v2.8.0

func NewGroup(cli *Client, org *AdminOrg) *OrgGroup

NewGroup creates a new group structure which still needs to have Group attribute populated

func (*OrgGroup) Delete added in v2.8.0

func (group *OrgGroup) Delete() error

Delete removes a group

func (*OrgGroup) Update added in v2.8.0

func (group *OrgGroup) Update() error

Update allows to update group. vCD API allows to update only role

type OrgUser added in v2.3.0

type OrgUser struct {
	User *types.User

	AdminOrg *AdminOrg // needed to be able to update, as the list of roles is found in the Org
	// contains filtered or unexported fields
}

Definition of an OrgUser

func NewUser added in v2.3.0

func NewUser(cli *Client, org *AdminOrg) *OrgUser

NewUser creates an empty user

func (*OrgUser) ChangePassword added in v2.3.0

func (user *OrgUser) ChangePassword(newPass string) error

ChangePassword changes user's password Constraints: the password must be non-empty, with a minimum of 6 characters

func (*OrgUser) ChangeRole added in v2.3.0

func (user *OrgUser) ChangeRole(roleName string) error

ChangeRole changes a user's role Fails is we try to set the same role as the current one. Also fails if the provided role name is not found.

func (*OrgUser) Delete added in v2.3.0

func (user *OrgUser) Delete(takeOwnership bool) error

Delete removes the user, returning an error if the call fails. if requested, it will attempt to take ownership before the removal. API Documentation: https://code.vmware.com/apis/442/vcloud-director#/doc/doc/operations/DELETE-User.html Note: in the GUI we need to disable the user before deleting. There is no such constraint with the API.

Expected behaviour: with takeOwnership = true, all entities owned by the user being deleted will be transferred to the caller. with takeOwnership = false, if the user own catalogs, networks, or running VMs/vApps, the call will fail.

If the user owns only powered-off VMs/vApps, the call will succeeds and the
VMs/vApps will be removed.

func (*OrgUser) Disable added in v2.3.0

func (user *OrgUser) Disable() error

Disable disables a user, if it is enabled. Fails otherwise.

func (*OrgUser) Enable added in v2.3.0

func (user *OrgUser) Enable() error

Enable enables a user if it was disabled. Fails otherwise.

func (*OrgUser) GetRoleName added in v2.3.0

func (user *OrgUser) GetRoleName() string

GetRoleName retrieves the name of the role currently assigned to the user

func (*OrgUser) TakeOwnership added in v2.3.0

func (user *OrgUser) TakeOwnership() error

TakeOwnership takes ownership of the user's objects. Ownership is transferred to the caller. This is a call to make before deleting. Calling user.DeleteTakeOwnership() will run TakeOwnership before the actual user removal. API Documentation: https://code.vmware.com/apis/442/vcloud-director#/doc/doc/operations/POST-TakeOwnership.html

func (*OrgUser) Unlock added in v2.3.0

func (user *OrgUser) Unlock() error

Unlock unlocks a user that was locked out by the system. Note that there is no procedure to LOCK a user: it is locked by the system when it exceeds the number of unauthorized access attempts

func (*OrgUser) Update added in v2.3.0

func (user *OrgUser) Update() error

Update updates the user, using its own configuration data returning an error if the call fails. API Documentation: https://code.vmware.com/apis/442/vcloud-director#/doc/doc/operations/PUT-User.html

func (*OrgUser) UpdateSimple added in v2.3.0

func (user *OrgUser) UpdateSimple(userData OrgUserConfiguration) error

UpdateSimple updates the user, using ALL the fields in userData structure returning an error if the call fails. Careful: DeployedVmQuota and StoredVmQuota use a `0` value to mean "unlimited"

type OrgUserConfiguration added in v2.3.0

type OrgUserConfiguration struct {
	Name            string // Mandatory
	Password        string // Mandatory
	RoleName        string // Mandatory
	ProviderType    string // Optional: defaults to "INTEGRATED"
	IsEnabled       bool   // Optional: defaults to false
	IsLocked        bool   // Only used for updates
	IsExternal      bool   // Optional: defaults to false
	DeployedVmQuota int    // Optional: 0 means "unlimited"
	StoredVmQuota   int    // Optional: 0 means "unlimited"
	FullName        string // Optional
	Description     string // Optional
	EmailAddress    string // Optional
	Telephone       string // Optional
	IM              string // Optional
}

Simplified structure to insert or modify an organization user

type OrgVDCNetwork

type OrgVDCNetwork struct {
	OrgVDCNetwork *types.OrgVDCNetwork
	// contains filtered or unexported fields
}

OrgVDCNetwork an org vdc network client

func NewOrgVDCNetwork

func NewOrgVDCNetwork(cli *Client) *OrgVDCNetwork

NewOrgVDCNetwork creates an org vdc network client

func (*OrgVDCNetwork) AddMetadataEntry added in v2.15.0

func (orgVdcNetwork *OrgVDCNetwork) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds OrgVDCNetwork metadata typedValue and key/value pair provided as input and waits for the task to finish. Note: Requires system administrator privileges.

func (*OrgVDCNetwork) AddMetadataEntryAsync added in v2.15.0

func (orgVdcNetwork *OrgVDCNetwork) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds OrgVDCNetwork metadata typedValue and key/value pair provided as input and returns the task. Note: Requires system administrator privileges.

func (*OrgVDCNetwork) Delete

func (orgVdcNet *OrgVDCNetwork) Delete() (Task, error)

Delete a network. Fails if the network is busy. Returns a task to monitor the deletion.

func (*OrgVDCNetwork) DeleteMetadataEntry added in v2.15.0

func (orgVdcNetwork *OrgVDCNetwork) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes OrgVDCNetwork metadata depending on key provided as input and waits for the task to finish. Note: Requires system administrator privileges.

func (*OrgVDCNetwork) DeleteMetadataEntryAsync added in v2.15.0

func (orgVdcNetwork *OrgVDCNetwork) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes OrgVDCNetwork metadata depending on key provided as input and returns a task. Note: Requires system administrator privileges.

func (*OrgVDCNetwork) GetMetadata added in v2.15.0

func (orgVdcNetwork *OrgVDCNetwork) GetMetadata() (*types.Metadata, error)

GetMetadata returns OrgVDCNetwork metadata.

func (*OrgVDCNetwork) MergeMetadata added in v2.16.0

func (orgVdcNetwork *OrgVDCNetwork) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges OrgVDCNetwork metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete. Note: Requires system administrator privileges.

func (*OrgVDCNetwork) MergeMetadataAsync added in v2.16.0

func (orgVdcNetwork *OrgVDCNetwork) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges OrgVDCNetwork metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete. Note: Requires system administrator privileges.

func (*OrgVDCNetwork) Refresh

func (orgVdcNet *OrgVDCNetwork) Refresh() error

func (*OrgVDCNetwork) Rename added in v2.7.0

func (orgVdcNet *OrgVDCNetwork) Rename(newName string) error

Rename is a wrapper around Update(), where we only change the name of the network Since the purpose is explicitly changing the name, the function will fail if the new name is not different from the existing one

func (*OrgVDCNetwork) Update added in v2.7.0

func (orgVdcNet *OrgVDCNetwork) Update() error

Update is a wrapper around UpdateAsync, where we explicitly wait for the task to finish. The pointer receiver is refreshed after update

func (*OrgVDCNetwork) UpdateAsync added in v2.7.0

func (orgVdcNet *OrgVDCNetwork) UpdateAsync() (Task, error)

UpdateAsync will change the contents of a network using the information in the receiver data structure.

type QueryAdminCatalog added in v2.8.0

type QueryAdminCatalog types.AdminCatalogRecord

func (QueryAdminCatalog) GetDate added in v2.8.0

func (catalog QueryAdminCatalog) GetDate() string

func (QueryAdminCatalog) GetHref added in v2.8.0

func (catalog QueryAdminCatalog) GetHref() string

func (QueryAdminCatalog) GetIp added in v2.8.0

func (catalog QueryAdminCatalog) GetIp() string

func (QueryAdminCatalog) GetMetadataValue added in v2.8.0

func (catalog QueryAdminCatalog) GetMetadataValue(key string) string

func (QueryAdminCatalog) GetName added in v2.8.0

func (catalog QueryAdminCatalog) GetName() string

func (QueryAdminCatalog) GetParentId added in v2.8.0

func (catalog QueryAdminCatalog) GetParentId() string

func (QueryAdminCatalog) GetParentName added in v2.8.0

func (catalog QueryAdminCatalog) GetParentName() string

func (QueryAdminCatalog) GetType added in v2.8.0

func (catalog QueryAdminCatalog) GetType() string

type QueryCatalog added in v2.8.0

type QueryCatalog types.CatalogRecord

func (QueryCatalog) GetDate added in v2.8.0

func (catalog QueryCatalog) GetDate() string

func (QueryCatalog) GetHref added in v2.8.0

func (catalog QueryCatalog) GetHref() string

-------------------------------------------------------------- catalog --------------------------------------------------------------

func (QueryCatalog) GetIp added in v2.8.0

func (catalog QueryCatalog) GetIp() string

func (QueryCatalog) GetMetadataValue added in v2.8.0

func (catalog QueryCatalog) GetMetadataValue(key string) string

func (QueryCatalog) GetName added in v2.8.0

func (catalog QueryCatalog) GetName() string

func (QueryCatalog) GetParentId added in v2.8.0

func (catalog QueryCatalog) GetParentId() string

func (QueryCatalog) GetParentName added in v2.8.0

func (catalog QueryCatalog) GetParentName() string

func (QueryCatalog) GetType added in v2.8.0

func (catalog QueryCatalog) GetType() string

type QueryCatalogItem added in v2.8.0

type QueryCatalogItem types.QueryResultCatalogItemType

func (QueryCatalogItem) GetDate added in v2.8.0

func (catItem QueryCatalogItem) GetDate() string

func (QueryCatalogItem) GetHref added in v2.8.0

func (catItem QueryCatalogItem) GetHref() string

-------------------------------------------------------------- catalog item --------------------------------------------------------------

func (QueryCatalogItem) GetIp added in v2.8.0

func (catItem QueryCatalogItem) GetIp() string

func (QueryCatalogItem) GetMetadataValue added in v2.8.0

func (catItem QueryCatalogItem) GetMetadataValue(key string) string

func (QueryCatalogItem) GetName added in v2.8.0

func (catItem QueryCatalogItem) GetName() string

func (QueryCatalogItem) GetParentId added in v2.8.0

func (catItem QueryCatalogItem) GetParentId() string

func (QueryCatalogItem) GetParentName added in v2.8.0

func (catItem QueryCatalogItem) GetParentName() string

func (QueryCatalogItem) GetType added in v2.8.0

func (catItem QueryCatalogItem) GetType() string

type QueryEdgeGateway added in v2.8.0

type QueryEdgeGateway types.QueryResultEdgeGatewayRecordType

func (QueryEdgeGateway) GetDate added in v2.8.0

func (egw QueryEdgeGateway) GetDate() string

func (QueryEdgeGateway) GetHref added in v2.8.0

func (egw QueryEdgeGateway) GetHref() string

-------------------------------------------------------------- edge gateway --------------------------------------------------------------

func (QueryEdgeGateway) GetIp added in v2.8.0

func (egw QueryEdgeGateway) GetIp() string

func (QueryEdgeGateway) GetMetadataValue added in v2.8.0

func (egw QueryEdgeGateway) GetMetadataValue(key string) string

func (QueryEdgeGateway) GetName added in v2.8.0

func (egw QueryEdgeGateway) GetName() string

func (QueryEdgeGateway) GetParentId added in v2.8.0

func (egw QueryEdgeGateway) GetParentId() string

func (QueryEdgeGateway) GetParentName added in v2.8.0

func (egw QueryEdgeGateway) GetParentName() string

func (QueryEdgeGateway) GetType added in v2.8.0

func (egw QueryEdgeGateway) GetType() string

type QueryItem added in v2.8.0

type QueryItem interface {
	GetDate() string
	GetName() string
	GetType() string
	GetIp() string
	GetMetadataValue(key string) string
	GetParentName() string
	GetParentId() string
	GetHref() string
}

QueryItem is an entity that is used to evaluate a Condition

type QueryMedia added in v2.8.0

type QueryMedia types.MediaRecordType

func (QueryMedia) GetDate added in v2.8.0

func (media QueryMedia) GetDate() string

func (QueryMedia) GetHref added in v2.8.0

func (media QueryMedia) GetHref() string

-------------------------------------------------------------- media item --------------------------------------------------------------

func (QueryMedia) GetIp added in v2.8.0

func (media QueryMedia) GetIp() string

func (QueryMedia) GetMetadataValue added in v2.8.0

func (media QueryMedia) GetMetadataValue(key string) string

func (QueryMedia) GetName added in v2.8.0

func (media QueryMedia) GetName() string

func (QueryMedia) GetParentId added in v2.8.0

func (media QueryMedia) GetParentId() string

func (QueryMedia) GetParentName added in v2.8.0

func (media QueryMedia) GetParentName() string

func (QueryMedia) GetType added in v2.8.0

func (media QueryMedia) GetType() string

type QueryOrgVdc added in v2.12.0

func (QueryOrgVdc) GetDate added in v2.12.0

func (orgVdc QueryOrgVdc) GetDate() string

func (QueryOrgVdc) GetHref added in v2.12.0

func (orgVdc QueryOrgVdc) GetHref() string

-------------------------------------------------------------- Org VDC --------------------------------------------------------------

func (QueryOrgVdc) GetIp added in v2.12.0

func (orgVdc QueryOrgVdc) GetIp() string

func (QueryOrgVdc) GetMetadataValue added in v2.12.0

func (orgVdc QueryOrgVdc) GetMetadataValue(key string) string

func (QueryOrgVdc) GetName added in v2.12.0

func (orgVdc QueryOrgVdc) GetName() string

func (QueryOrgVdc) GetParentId added in v2.12.0

func (orgVdc QueryOrgVdc) GetParentId() string

func (QueryOrgVdc) GetParentName added in v2.12.0

func (orgVdc QueryOrgVdc) GetParentName() string

func (QueryOrgVdc) GetType added in v2.12.0

func (orgVdc QueryOrgVdc) GetType() string

type QueryOrgVdcNetwork added in v2.8.0

type QueryOrgVdcNetwork types.QueryResultOrgVdcNetworkRecordType

func (QueryOrgVdcNetwork) GetDate added in v2.8.0

func (network QueryOrgVdcNetwork) GetDate() string

func (QueryOrgVdcNetwork) GetHref added in v2.8.0

func (network QueryOrgVdcNetwork) GetHref() string

-------------------------------------------------------------- Org VDC network --------------------------------------------------------------

func (QueryOrgVdcNetwork) GetIp added in v2.8.0

func (network QueryOrgVdcNetwork) GetIp() string

func (QueryOrgVdcNetwork) GetMetadataValue added in v2.8.0

func (network QueryOrgVdcNetwork) GetMetadataValue(key string) string

func (QueryOrgVdcNetwork) GetName added in v2.8.0

func (network QueryOrgVdcNetwork) GetName() string

func (QueryOrgVdcNetwork) GetParentId added in v2.8.0

func (network QueryOrgVdcNetwork) GetParentId() string

func (QueryOrgVdcNetwork) GetParentName added in v2.8.0

func (network QueryOrgVdcNetwork) GetParentName() string

func (QueryOrgVdcNetwork) GetType added in v2.8.0

func (network QueryOrgVdcNetwork) GetType() string

type QueryVAppTemplate added in v2.8.0

type QueryVAppTemplate types.QueryResultVappTemplateType

All the Query* types are localizations of Query records that can be returned from a query. Each one of these implements the QueryItem interface

func (QueryVAppTemplate) GetDate added in v2.8.0

func (vappTemplate QueryVAppTemplate) GetDate() string

func (QueryVAppTemplate) GetHref added in v2.8.0

func (vappTemplate QueryVAppTemplate) GetHref() string

-------------------------------------------------------------- vApp template --------------------------------------------------------------

func (QueryVAppTemplate) GetIp added in v2.8.0

func (vappTemplate QueryVAppTemplate) GetIp() string

func (QueryVAppTemplate) GetMetadataValue added in v2.8.0

func (vappTemplate QueryVAppTemplate) GetMetadataValue(key string) string

func (QueryVAppTemplate) GetName added in v2.8.0

func (vappTemplate QueryVAppTemplate) GetName() string

func (QueryVAppTemplate) GetParentId added in v2.8.0

func (vappTemplate QueryVAppTemplate) GetParentId() string

func (QueryVAppTemplate) GetParentName added in v2.8.0

func (vappTemplate QueryVAppTemplate) GetParentName() string

func (QueryVAppTemplate) GetType added in v2.8.0

func (vappTemplate QueryVAppTemplate) GetType() string

type QueryVapp added in v2.9.0

func (QueryVapp) GetDate added in v2.9.0

func (vapp QueryVapp) GetDate() string

func (QueryVapp) GetHref added in v2.9.0

func (vapp QueryVapp) GetHref() string

-------------------------------------------------------------- vApp --------------------------------------------------------------

func (QueryVapp) GetIp added in v2.9.0

func (vapp QueryVapp) GetIp() string

func (QueryVapp) GetMetadataValue added in v2.9.0

func (vapp QueryVapp) GetMetadataValue(key string) string

func (QueryVapp) GetName added in v2.9.0

func (vapp QueryVapp) GetName() string

func (QueryVapp) GetParentId added in v2.9.0

func (vapp QueryVapp) GetParentId() string

func (QueryVapp) GetParentName added in v2.9.0

func (vapp QueryVapp) GetParentName() string

func (QueryVapp) GetType added in v2.9.0

func (vapp QueryVapp) GetType() string

type QueryVm added in v2.9.0

func (QueryVm) GetDate added in v2.9.0

func (vm QueryVm) GetDate() string

func (QueryVm) GetHref added in v2.9.0

func (vm QueryVm) GetHref() string

-------------------------------------------------------------- VM --------------------------------------------------------------

func (QueryVm) GetIp added in v2.9.0

func (vm QueryVm) GetIp() string

func (QueryVm) GetMetadataValue added in v2.9.0

func (vm QueryVm) GetMetadataValue(key string) string

func (QueryVm) GetName added in v2.9.0

func (vm QueryVm) GetName() string

func (QueryVm) GetParentId added in v2.9.0

func (vm QueryVm) GetParentId() string

func (QueryVm) GetParentName added in v2.9.0

func (vm QueryVm) GetParentName() string

func (QueryVm) GetType added in v2.9.0

func (vm QueryVm) GetType() string

type Results

type Results struct {
	Results *types.QueryResultRecordsType
	// contains filtered or unexported fields
}

func NewResults

func NewResults(cli *Client) *Results

type RightsBundle added in v2.12.0

type RightsBundle struct {
	RightsBundle *types.RightsBundle
	// contains filtered or unexported fields
}

func (*RightsBundle) AddRights added in v2.12.0

func (rb *RightsBundle) AddRights(newRights []types.OpenApiReference) error

AddRights adds a collection of rights to a rights bundle

func (*RightsBundle) Delete added in v2.12.0

func (rb *RightsBundle) Delete() error

Delete deletes rights bundle

func (*RightsBundle) GetRights added in v2.12.0

func (rb *RightsBundle) GetRights(queryParameters url.Values) ([]*types.Right, error)

func (*RightsBundle) GetTenants added in v2.12.0

func (rb *RightsBundle) GetTenants(queryParameters url.Values) ([]types.OpenApiReference, error)

GetTenants retrieves all tenants associated to a given Rights Bundle. Query parameters can be supplied to perform additional filtering

func (*RightsBundle) PublishAllTenants added in v2.12.0

func (rb *RightsBundle) PublishAllTenants() error

PublishAllTenants removes publication status in rights bundle from one or more tenants

func (*RightsBundle) PublishTenants added in v2.12.0

func (rb *RightsBundle) PublishTenants(tenants []types.OpenApiReference) error

PublishTenants publishes a rights bundle to one or more tenants

func (*RightsBundle) RemoveAllRights added in v2.12.0

func (rb *RightsBundle) RemoveAllRights() error

RemoveAllRights removes all rights from a rights bundle

func (*RightsBundle) RemoveRights added in v2.12.0

func (rb *RightsBundle) RemoveRights(removeRights []types.OpenApiReference) error

RemoveRights removes specific rights from a rights bundle

func (*RightsBundle) ReplacePublishedTenants added in v2.12.0

func (rb *RightsBundle) ReplacePublishedTenants(tenants []types.OpenApiReference) error

ReplacePublishedTenants publishes a rights bundle to one or more tenants, removing the tenants already present

func (*RightsBundle) UnpublishAllTenants added in v2.12.0

func (rb *RightsBundle) UnpublishAllTenants() error

UnpublishAllTenants removes publication status in rights bundle from one or more tenants

func (*RightsBundle) UnpublishTenants added in v2.12.0

func (rb *RightsBundle) UnpublishTenants(tenants []types.OpenApiReference) error

UnpublishTenants removes publication status in rights bundle from one or more tenants

func (*RightsBundle) Update added in v2.12.0

func (rb *RightsBundle) Update() (*RightsBundle, error)

Update updates existing rights bundle

func (*RightsBundle) UpdateRights added in v2.12.0

func (rb *RightsBundle) UpdateRights(newRights []types.OpenApiReference) error

UpdateRights replaces existing rights with the given collection of rights

type Role added in v2.9.0

type Role struct {
	Role *types.Role

	TenantContext *TenantContext
	// contains filtered or unexported fields
}

Role uses OpenAPI endpoint to operate user roles

func (*Role) AddRights added in v2.12.0

func (role *Role) AddRights(newRights []types.OpenApiReference) error

AddRights adds a collection of rights to a role

func (*Role) Delete added in v2.9.0

func (role *Role) Delete() error

Delete deletes OpenAPI role

func (*Role) GetRights added in v2.12.0

func (role *Role) GetRights(queryParameters url.Values) ([]*types.Right, error)

GetRights retrieves all rights belonging to a given Role. Query parameters can be supplied to perform additional filtering

func (*Role) RemoveAllRights added in v2.12.0

func (role *Role) RemoveAllRights() error

RemoveAllRights removes all rights from a role

func (*Role) RemoveRights added in v2.12.0

func (role *Role) RemoveRights(removeRights []types.OpenApiReference) error

RemoveRights removes specific rights from a role

func (*Role) Update added in v2.9.0

func (role *Role) Update() (*Role, error)

Update updates existing OpenAPI role

func (*Role) UpdateRights added in v2.12.0

func (role *Role) UpdateRights(newRights []types.OpenApiReference) error

UpdateRights replaces existing rights with the given collection of rights

type SimpleNetworkIdentifier added in v2.3.0

type SimpleNetworkIdentifier struct {
	Name          string
	InterfaceType string
}

Simplified structure used to list networks connected to an edge gateway

type StringMap added in v2.8.0

type StringMap map[string]string

type SupportedVersions added in v2.2.0

type SupportedVersions struct {
	VersionInfos `xml:"VersionInfo"`
}

type Task

type Task struct {
	Task *types.Task
	// contains filtered or unexported fields
}

func CreateAndConfigureEdgeGatewayAsync added in v2.3.0

func CreateAndConfigureEdgeGatewayAsync(vcdClient *VCDClient, orgName, vdcName, egwName string, egwConfiguration *types.EdgeGateway) (Task, error)

CreateAndConfigureEdgeGatewayAsync creates an edge gateway using a full configuration structure

func CreateEdgeGatewayAsync added in v2.3.0

func CreateEdgeGatewayAsync(vcdClient *VCDClient, egwc EdgeGatewayCreation) (Task, error)

CreateEdgeGatewayAsync creates an edge gateway using a simplified configuration structure https://code.vmware.com/apis/442/vcloud-director/doc/doc/operations/POST-CreateEdgeGateway.html

Note. This function does not allow to pick exact subnet in external network to use for edge gateway. It will pick first one instead.

func CreateExternalNetwork added in v2.2.0

func CreateExternalNetwork(vcdClient *VCDClient, externalNetworkData *types.ExternalNetwork) (Task, error)

CreateExternalNetwork allows create external network and returns Task or error. types.ExternalNetwork struct is general and used for various types of networks. But for external network fence mode is always isolated, isInherited is false, parentNetwork is empty.

func CreateOrg

func CreateOrg(vcdClient *VCDClient, name string, fullName string, description string, settings *types.OrgSettings, isEnabled bool) (Task, error)

Creates an Admin Organization based on settings, description, and org name. The Organization created will have these settings specified in the settings parameter. The settings variable is defined in types.go. Method will fail unless user has an admin token. API Documentation: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/POST-CreateOrganization.html Organization creation in vCD has two bugs BZ 2177355, BZ 2228936 (fixes are in 9.1.0.3 and 9.5.0.2) which require organization settings to be provided as workarounds. At least one element among DelayAfterPowerOnSeconds, DeployedVMQuota, StoredVmQuota, UseServerBootSequence, getVdcQuota should be set when providing generalOrgSettings. If either VAppLeaseSettings or VAppTemplateLeaseSettings is provided then all elements need to have values, otherwise don't provide them at all. Overall elements must be in the correct order.

func NewTask

func NewTask(cli *Client) *Task

func (*Task) CancelTask

func (task *Task) CancelTask() error

func (*Task) GetTaskProgress

func (task *Task) GetTaskProgress() (string, error)

func (*Task) Refresh

func (task *Task) Refresh() error

func (*Task) WaitInspectTaskCompletion

func (task *Task) WaitInspectTaskCompletion(inspectionFunc InspectionFunc, delay time.Duration) error

Customizable version of WaitTaskCompletion. Users can define the sleeping duration and an optional callback function for extra monitoring.

func (*Task) WaitTaskCompletion

func (task *Task) WaitTaskCompletion() error

Checks the status of the task every 3 seconds and returns when the task is either completed or failed

type TenantContext added in v2.12.0

type TenantContext struct {
	OrgId   string // The bare ID (without prefix) of an organization
	OrgName string // The organization name
}

TenantContext stores the information needed for an object to be used in the context of a given organization

type UploadTask

type UploadTask struct {
	*Task
	// contains filtered or unexported fields
}

func NewUploadTask

func NewUploadTask(task *Task, uploadProgress *mutexedProgress, uploadError *error) *UploadTask

Creates wrapped Task which is dedicated for upload functionality and provides additional functionality to monitor upload progress.

func (*UploadTask) GetUploadError

func (uploadTask *UploadTask) GetUploadError() error

func (*UploadTask) GetUploadProgress

func (uploadTask *UploadTask) GetUploadProgress() string

func (*UploadTask) ShowUploadProgress

func (uploadTask *UploadTask) ShowUploadProgress() error

type VApp

type VApp struct {
	VApp *types.VApp
	// contains filtered or unexported fields
}

func NewVApp

func NewVApp(cli *Client) *VApp

func (*VApp) AddEmptyVm added in v2.8.0

func (vapp *VApp) AddEmptyVm(reComposeVAppParams *types.RecomposeVAppParamsForEmptyVm) (*VM, error)

AddEmptyVm adds an empty VM (without template) to vApp and returns the new created VM or an error.

func (*VApp) AddEmptyVmAsync added in v2.8.0

func (vapp *VApp) AddEmptyVmAsync(reComposeVAppParams *types.RecomposeVAppParamsForEmptyVm) (Task, error)

AddEmptyVmAsync adds an empty VM (without template) to the vApp and returns a Task and an error.

func (*VApp) AddIsolatedNetwork

func (vapp *VApp) AddIsolatedNetwork(newIsolatedNetworkSettings *VappNetworkSettings) (Task, error)

Function allows to create isolated network for vApp. This is equivalent to vCD UI function - vApp network creation. Deprecated: in favor of vapp.CreateVappNetwork

func (*VApp) AddMetadata deprecated

func (vapp *VApp) AddMetadata(key string, value string) (Task, error)

Deprecated: use VApp.AddMetadataEntry

func (*VApp) AddMetadataEntry added in v2.15.0

func (vapp *VApp) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds VApp metadata typedValue and key/value pair provided as input and waits for the task to finish.

func (*VApp) AddMetadataEntryAsync added in v2.15.0

func (vapp *VApp) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds VApp metadata typedValue and key/value pair provided as input and returns the task.

func (*VApp) AddNewVM added in v2.2.0

func (vapp *VApp) AddNewVM(name string, vappTemplate VAppTemplate, network *types.NetworkConnectionSection, acceptAllEulas bool) (Task, error)

AddNewVM adds VM from vApp template with custom NetworkConnectionSection

func (*VApp) AddNewVMWithComputePolicy added in v2.9.0

func (vapp *VApp) AddNewVMWithComputePolicy(name string, vappTemplate VAppTemplate,
	network *types.NetworkConnectionSection,
	storageProfileRef *types.Reference, computePolicy *types.VdcComputePolicy, acceptAllEulas bool) (Task, error)

AddNewVMWithComputePolicy adds VM from vApp template with custom NetworkConnectionSection and optional storage profile and compute policy

func (*VApp) AddNewVMWithStorageProfile added in v2.5.0

func (vapp *VApp) AddNewVMWithStorageProfile(name string, vappTemplate VAppTemplate,
	network *types.NetworkConnectionSection,
	storageProfileRef *types.Reference, acceptAllEulas bool) (Task, error)

AddNewVMWithStorageProfile adds VM from vApp template with custom NetworkConnectionSection and optional storage profile

func (*VApp) AddOrgNetwork added in v2.6.0

func (vapp *VApp) AddOrgNetwork(newNetworkSettings *VappNetworkSettings, orgNetwork *types.OrgVDCNetwork, isFenced bool) (*types.NetworkConfigSection, error)

AddOrgNetwork adds Org VDC network as vApp network. Returns pointer to types.NetworkConfigSection or error

func (*VApp) AddOrgNetworkAsync added in v2.6.0

func (vapp *VApp) AddOrgNetworkAsync(newNetworkSettings *VappNetworkSettings, orgNetwork *types.OrgVDCNetwork, isFenced bool) (Task, error)

AddOrgNetworkAsync adds asynchronously Org VDC network as vApp network. Returns Task or error

func (*VApp) AddRAWNetworkConfig

func (vapp *VApp) AddRAWNetworkConfig(orgvdcnetworks []*types.OrgVDCNetwork) (Task, error)

AddRAWNetworkConfig adds existing VDC network to vApp Deprecated: in favor of vapp.AddOrgNetwork

func (*VApp) AddVM deprecated

func (vapp *VApp) AddVM(orgVdcNetworks []*types.OrgVDCNetwork, vappNetworkName string, vappTemplate VAppTemplate, name string, acceptAllEulas bool) (Task, error)

AddVM create vm in vApp using vApp template orgVdcNetworks - adds org VDC networks to be available for vApp. Can be empty. vappNetworkName - adds vApp network to be available for vApp. Can be empty. vappTemplate - vApp Template which will be used for VM creation. name - name for VM. acceptAllEulas - setting allows to automatically accept or not Eulas.

Deprecated: Use vapp.AddNewVM instead for more sophisticated network handling

func (*VApp) BlockWhileStatus

func (vapp *VApp) BlockWhileStatus(unwantedStatus string, timeOutAfterSeconds int) error

BlockWhileStatus blocks until the status of vApp exits unwantedStatus. It sleeps 200 milliseconds between iterations and times out after timeOutAfterSeconds of seconds.

func (*VApp) ChangeCPUCount

func (vapp *VApp) ChangeCPUCount(virtualCpuCount int) (Task, error)

Sets number of available virtual logical processors (i.e. CPUs x cores per socket) https://communities.vmware.com/thread/576209 Deprecated: Use vm.ChangeCPUcount()

func (*VApp) ChangeCPUCountWithCore

func (vapp *VApp) ChangeCPUCountWithCore(virtualCpuCount int, coresPerSocket *int) (Task, error)

Sets number of available virtual logical processors (i.e. CPUs x cores per socket) and cores per socket. Socket count is a result of: virtual logical processors/cores per socket https://communities.vmware.com/thread/576209 Deprecated: Use vm.ChangeCPUCountWithCore()

func (*VApp) ChangeMemorySize

func (vapp *VApp) ChangeMemorySize(size int) (Task, error)

Deprecated as it changes only first VM's memory

func (*VApp) ChangeNetworkConfig

func (vapp *VApp) ChangeNetworkConfig(networks []map[string]interface{}, ip string) (Task, error)

func (*VApp) ChangeStorageProfile

func (vapp *VApp) ChangeStorageProfile(name string) (Task, error)

func (*VApp) ChangeVMName

func (vapp *VApp) ChangeVMName(name string) (Task, error)

Deprecated as it changes only first VM's name

func (*VApp) CreateVappNetwork added in v2.6.0

func (vapp *VApp) CreateVappNetwork(newNetworkSettings *VappNetworkSettings, orgNetwork *types.OrgVDCNetwork) (*types.NetworkConfigSection, error)

CreateVappNetwork creates isolated or nat routed(connected to Org VDC network) network for vApp. Returns pointer to types.NetworkConfigSection or error If orgNetwork is nil, then isolated network created.

func (*VApp) CreateVappNetworkAsync added in v2.6.0

func (vapp *VApp) CreateVappNetworkAsync(newNetworkSettings *VappNetworkSettings, orgNetwork *types.OrgVDCNetwork) (Task, error)

CreateVappNetworkAsync creates asynchronously isolated or nat routed network for vApp. Returns Task or error If orgNetwork is nil, then isolated network created.

func (*VApp) Customize deprecated

func (vapp *VApp) Customize(computername, script string, changeSid bool) (Task, error)

Customize applies customization to first child VM

Deprecated: Use vm.SetGuestCustomizationSection()

func (*VApp) Delete

func (vapp *VApp) Delete() (Task, error)

func (*VApp) DeleteMetadata deprecated

func (vapp *VApp) DeleteMetadata(key string) (Task, error)

Deprecated: use VApp.DeleteMetadataEntry.

func (*VApp) DeleteMetadataEntry added in v2.15.0

func (vapp *VApp) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes VApp metadata by key provided as input and waits for the task to finish.

func (*VApp) DeleteMetadataEntryAsync added in v2.15.0

func (vapp *VApp) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes VApp metadata depending on key provided as input and returns the task.

func (*VApp) Deploy

func (vapp *VApp) Deploy() (Task, error)

func (VApp) GetAccessControl added in v2.9.0

func (vapp VApp) GetAccessControl(useTenantContext bool) (*types.ControlAccessParams, error)

GetAccessControl retrieves the access control information for this vApp

func (*VApp) GetLease added in v2.14.0

func (vapp *VApp) GetLease() (*types.LeaseSettingsSection, error)

GetLease retrieves the lease terms for a vApp

func (*VApp) GetMetadata added in v2.2.0

func (vapp *VApp) GetMetadata() (*types.Metadata, error)

GetMetadata returns VApp metadata.

func (*VApp) GetNetworkConfig

func (vapp *VApp) GetNetworkConfig() (*types.NetworkConfigSection, error)

func (*VApp) GetNetworkConnectionSection

func (vapp *VApp) GetNetworkConnectionSection() (*types.NetworkConnectionSection, error)

func (*VApp) GetProductSectionList added in v2.4.0

func (vapp *VApp) GetProductSectionList() (*types.ProductSectionList, error)

GetProductSectionList retrieves product section for a vApp. It allows to read vApp guest properties.

The slice of properties "ProductSectionList.ProductSection.Property" is not necessarily ordered or returned as set before

func (*VApp) GetStatus

func (vapp *VApp) GetStatus() (string, error)

func (*VApp) GetVMById added in v2.4.0

func (vapp *VApp) GetVMById(id string, refresh bool) (*VM, error)

GetVMById returns a VM reference if the VM ID matches an existing one. If no valid VM is found, it returns a nil VM reference and an error

func (*VApp) GetVMByName added in v2.4.0

func (vapp *VApp) GetVMByName(vmName string, refresh bool) (*VM, error)

GetVMByName returns a VM reference if the VM name matches an existing one. If no valid VM is found, it returns a nil VM reference and an error

func (*VApp) GetVMByNameOrId added in v2.4.0

func (vapp *VApp) GetVMByNameOrId(identifier string, refresh bool) (*VM, error)

GetVMByNameOrId returns a VM reference if either the VM name or ID matches an existing one. If no valid VM is found, it returns a nil VM reference and an error

func (*VApp) GetVappNetworkById added in v2.8.0

func (vapp *VApp) GetVappNetworkById(id string, refresh bool) (*types.VAppNetwork, error)

GetVappNetworkById returns a VApp network reference if the vApp network ID matches an existing one. If no valid VApp network is found, it returns a nil VApp network reference and an error

func (*VApp) GetVappNetworkByName added in v2.8.0

func (vapp *VApp) GetVappNetworkByName(vappNetworkName string, refresh bool) (*types.VAppNetwork, error)

GetVappNetworkByName returns a VAppNetwork reference if the vApp network name matches an existing one. If no valid vApp network is found, it returns a nil VAppNetwork reference and an error

func (*VApp) GetVappNetworkByNameOrId added in v2.8.0

func (vapp *VApp) GetVappNetworkByNameOrId(identifier string, refresh bool) (*types.VAppNetwork, error)

GetVappNetworkByNameOrId returns a types.VAppNetwork reference if either the vApp network name or ID matches an existing one. If no valid vApp network is found, it returns a nil types.VAppNetwork reference and an error

func (VApp) IsShared added in v2.9.0

func (vapp VApp) IsShared(useTenantContext bool) (bool, error)

IsShared shows whether a vApp is shared or not, regardless of the number of subjects sharing it

func (*VApp) MergeMetadata added in v2.16.0

func (vapp *VApp) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges VApp metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*VApp) MergeMetadataAsync added in v2.16.0

func (vapp *VApp) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges VApp metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*VApp) PowerOff

func (vapp *VApp) PowerOff() (Task, error)

func (*VApp) PowerOn

func (vapp *VApp) PowerOn() (Task, error)

func (*VApp) Reboot

func (vapp *VApp) Reboot() (Task, error)

func (*VApp) Refresh

func (vapp *VApp) Refresh() error

func (VApp) RemoveAccessControl added in v2.9.0

func (vapp VApp) RemoveAccessControl(useTenantContext bool) error

RemoveAccessControl is a shortcut to SetAccessControl with all access disabled

func (*VApp) RemoveAllNetworkFirewallRules added in v2.8.0

func (vapp *VApp) RemoveAllNetworkFirewallRules(networkId string) error

RemoveAllNetworkFirewallRules removes all network firewall rules from a vApp network. Returns error

func (*VApp) RemoveAllNetworkNatRules added in v2.8.0

func (vapp *VApp) RemoveAllNetworkNatRules(networkId string) error

RemoveAllNetworkNatRules removes all NAT rules from a vApp network Returns error

func (*VApp) RemoveAllNetworkStaticRoutes added in v2.8.0

func (vapp *VApp) RemoveAllNetworkStaticRoutes(networkId string) error

RemoveAllNetworkStaticRoutes removes all static routes from a vApp network Returns error

func (*VApp) RemoveAllNetworks added in v2.3.0

func (vapp *VApp) RemoveAllNetworks() (Task, error)

RemoveAllNetworks detaches all networks from vApp

func (*VApp) RemoveIsolatedNetwork

func (vapp *VApp) RemoveIsolatedNetwork(networkName string) (Task, error)

Removes vApp isolated network Deprecated: in favor vapp.RemoveNetwork

func (*VApp) RemoveNetwork added in v2.6.0

func (vapp *VApp) RemoveNetwork(identifier string) (*types.NetworkConfigSection, error)

RemoveNetwork removes any network (be it isolated or connected to an Org Network) from vApp Returns pointer to types.NetworkConfigSection or error

func (*VApp) RemoveNetworkAsync added in v2.6.0

func (vapp *VApp) RemoveNetworkAsync(identifier string) (Task, error)

RemoveNetworkAsync asynchronously removes any network (be it isolated or connected to an Org Network) from vApp Accepts network ID or name

func (*VApp) RemoveVM

func (vapp *VApp) RemoveVM(vm VM) error

========================= issue#252 ================================== TODO: To be refactored, handling networks better. See issue#252 for details https://github.com/vmware/go-vcloud-director/issues/252 ======================================================================

func (*VApp) Rename added in v2.12.0

func (vapp *VApp) Rename(newName string) error

Rename changes the name of a vApp

func (*VApp) RenewLease added in v2.14.0

func (vapp *VApp) RenewLease(deploymentLeaseInSeconds, storageLeaseInSeconds int) error

RenewLease updates the lease terms for the vApp

func (*VApp) Reset

func (vapp *VApp) Reset() (Task, error)

func (*VApp) RunCustomizationScript

func (vapp *VApp) RunCustomizationScript(computername, script string) (Task, error)

func (VApp) SetAccessControl added in v2.9.0

func (vapp VApp) SetAccessControl(accessControl *types.ControlAccessParams, useTenantContext bool) error

SetAccessControl changes the access control information for this vApp

func (*VApp) SetOvf deprecated

func (vapp *VApp) SetOvf(parameters map[string]string) (Task, error)

SetOvf sets guest properties for the first child VM in vApp

Deprecated: Use vm.SetProductSectionList()

func (*VApp) SetProductSectionList added in v2.4.0

func (vapp *VApp) SetProductSectionList(productSection *types.ProductSectionList) (*types.ProductSectionList, error)

SetProductSectionList sets product section for a vApp. It allows to change vApp guest properties.

The slice of properties "ProductSectionList.ProductSection.Property" is not necessarily ordered or returned as set before

func (*VApp) Shutdown

func (vapp *VApp) Shutdown() (Task, error)

func (*VApp) Suspend

func (vapp *VApp) Suspend() (Task, error)

func (*VApp) Undeploy

func (vapp *VApp) Undeploy() (Task, error)

func (*VApp) UpdateDescription added in v2.12.0

func (vapp *VApp) UpdateDescription(newDescription string) error

UpdateDescription changes the description of a vApp

func (*VApp) UpdateNameDescription added in v2.12.0

func (vapp *VApp) UpdateNameDescription(newName, newDescription string) error

UpdateNameDescription can change the name and the description of a vApp If name is empty, it is left unchanged.

func (*VApp) UpdateNetwork added in v2.6.0

func (vapp *VApp) UpdateNetwork(newNetworkSettings *VappNetworkSettings, orgNetwork *types.OrgVDCNetwork) (*types.NetworkConfigSection, error)

UpdateNetwork updates vApp networks (isolated or connected to Org VDC network) Returns pointer to types.NetworkConfigSection or error

func (*VApp) UpdateNetworkAsync added in v2.6.0

func (vapp *VApp) UpdateNetworkAsync(networkSettingsToUpdate *VappNetworkSettings, orgNetwork *types.OrgVDCNetwork) (Task, error)

UpdateNetworkAsync asynchronously updates vApp networks (isolated or connected to Org VDC network). Returns task or error

func (*VApp) UpdateNetworkFirewallRules added in v2.8.0

func (vapp *VApp) UpdateNetworkFirewallRules(networkId string, firewallRules []*types.FirewallRule, enabled bool, defaultAction string, logDefaultAction bool) (*types.VAppNetwork, error)

UpdateNetworkFirewallRules updates vApp networks firewall rules. It will overwrite existing ones as there is no 100% way to identify them separately. Returns pointer to types.VAppNetwork or error

func (*VApp) UpdateNetworkFirewallRulesAsync added in v2.8.0

func (vapp *VApp) UpdateNetworkFirewallRulesAsync(networkId string, firewallRules []*types.FirewallRule, enabled bool, defaultAction string, logDefaultAction bool) (Task, error)

UpdateNetworkFirewallRulesAsync asynchronously updates vApp networks firewall rules. It will overwrite existing ones as there is no 100% way to identify them separately. Returns task or error

func (*VApp) UpdateNetworkNatRules added in v2.8.0

func (vapp *VApp) UpdateNetworkNatRules(networkId string, natRules []*types.NatRule, enabled bool, natType, policy string) (*types.VAppNetwork, error)

UpdateNetworkNatRules updates vApp networks NAT rules. Returns pointer to types.VAppNetwork or error

func (*VApp) UpdateNetworkNatRulesAsync added in v2.8.0

func (vapp *VApp) UpdateNetworkNatRulesAsync(networkId string, natRules []*types.NatRule, enabled bool, natType, policy string) (Task, error)

UpdateNetworkNatRulesAsync asynchronously updates vApp NAT rules. Returns task or error

func (*VApp) UpdateNetworkStaticRouting added in v2.8.0

func (vapp *VApp) UpdateNetworkStaticRouting(networkId string, staticRoutes []*types.StaticRoute, enabled bool) (*types.VAppNetwork, error)

UpdateNetworkStaticRouting updates vApp network static routes. Returns pointer to types.VAppNetwork or error

func (*VApp) UpdateNetworkStaticRoutingAsync added in v2.8.0

func (vapp *VApp) UpdateNetworkStaticRoutingAsync(networkId string, staticRoutes []*types.StaticRoute, enabled bool) (Task, error)

UpdateNetworkStaticRoutingAsync asynchronously updates vApp network static routes. Returns task or error

func (*VApp) UpdateOrgNetwork added in v2.6.0

func (vapp *VApp) UpdateOrgNetwork(newNetworkSettings *VappNetworkSettings, isFenced bool) (*types.NetworkConfigSection, error)

UpdateOrgNetwork updates Org VDC network which is part of a vApp Returns pointer to types.NetworkConfigSection or error

func (*VApp) UpdateOrgNetworkAsync added in v2.6.0

func (vapp *VApp) UpdateOrgNetworkAsync(networkSettingsToUpdate *VappNetworkSettings, isFenced bool) (Task, error)

UpdateOrgNetworkAsync asynchronously updates Org VDC network which is part of a vApp Returns task or error

type VAppTemplate

type VAppTemplate struct {
	VAppTemplate *types.VAppTemplate
	// contains filtered or unexported fields
}

func NewVAppTemplate

func NewVAppTemplate(cli *Client) *VAppTemplate

func (*VAppTemplate) AddMetadata deprecated added in v2.4.0

func (vAppTemplate *VAppTemplate) AddMetadata(key string, value string) (*VAppTemplate, error)

Deprecated: use VAppTemplate.AddMetadataEntry.

func (*VAppTemplate) AddMetadataAsync deprecated added in v2.4.0

func (vAppTemplate *VAppTemplate) AddMetadataAsync(key string, value string) (Task, error)

Deprecated: use VAppTemplate.AddMetadataEntryAsync.

func (*VAppTemplate) AddMetadataEntry added in v2.15.0

func (vAppTemplate *VAppTemplate) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds VAppTemplate metadata typedValue and key/value pair provided as input and waits for the task to finish.

func (*VAppTemplate) AddMetadataEntryAsync added in v2.15.0

func (vAppTemplate *VAppTemplate) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds VAppTemplate metadata typedValue and key/value pair provided as input and returns the task.

func (*VAppTemplate) DeleteMetadata deprecated added in v2.4.0

func (vAppTemplate *VAppTemplate) DeleteMetadata(key string) error

Deprecated: use VAppTemplate.DeleteMetadataEntry.

func (*VAppTemplate) DeleteMetadataAsync deprecated added in v2.4.0

func (vAppTemplate *VAppTemplate) DeleteMetadataAsync(key string) (Task, error)

Deprecated: use VAppTemplate.DeleteMetadataEntryAsync.

func (*VAppTemplate) DeleteMetadataEntry added in v2.15.0

func (vAppTemplate *VAppTemplate) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes VAppTemplate metadata depending on key provided as input and waits for the task to finish.

func (*VAppTemplate) DeleteMetadataEntryAsync added in v2.15.0

func (vAppTemplate *VAppTemplate) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes VAppTemplate metadata depending on key provided as input and returns the task.

func (*VAppTemplate) GetMetadata added in v2.4.0

func (vAppTemplate *VAppTemplate) GetMetadata() (*types.Metadata, error)

GetMetadata returns VAppTemplate metadata.

func (*VAppTemplate) MergeMetadata added in v2.16.0

func (vAppTemplate *VAppTemplate) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges VAppTemplate metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*VAppTemplate) MergeMetadataAsync added in v2.16.0

func (vAppTemplate *VAppTemplate) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges VAppTemplate metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*VAppTemplate) Refresh added in v2.4.0

func (vAppTemplate *VAppTemplate) Refresh() error

Refresh refreshes the vApp template item information by href

func (*VAppTemplate) Update added in v2.15.0

func (vAppTemplate *VAppTemplate) Update() (*VAppTemplate, error)

Update updates the vApp template item information Returns vApp template and error.

func (*VAppTemplate) UpdateAsync added in v2.15.0

func (vAppTemplate *VAppTemplate) UpdateAsync() (Task, error)

UpdateAsync updates the vApp template item information Returns Task and error.

type VCDClient

type VCDClient struct {
	Client Client // Client for the underlying VCD instance

	QueryHREF url.URL // HREF for the query API
	// contains filtered or unexported fields
}

func NewVCDClient

func NewVCDClient(vcdEndpoint url.URL, insecure bool, options ...VCDClientOption) *VCDClient

NewVCDClient initializes VMware vCloud Director client with reasonable defaults. It accepts functions of type VCDClientOption for adjusting defaults.

func (*VCDClient) AddMetadataEntryByHref added in v2.15.0

func (vcdClient *VCDClient) AddMetadataEntryByHref(href, typedValue, key, value string) error

AddMetadataEntryByHref adds metadata typedValue and key/value pair provided as input to the given resource reference, then waits for the task to finish.

func (*VCDClient) AddMetadataEntryByHrefAsync added in v2.15.0

func (vcdClient *VCDClient) AddMetadataEntryByHrefAsync(href, typedValue, key, value string) (Task, error)

AddMetadataEntryByHrefAsync adds metadata typedValue and key/value pair provided as input to the given resource reference and returns the task.

func (*VCDClient) Authenticate

func (vcdClient *VCDClient) Authenticate(username, password, org string) error

Authenticate is a helper function that performs a login in vCloud Director.

func (*VCDClient) CreateAlbCloud added in v2.13.0

func (vcdClient *VCDClient) CreateAlbCloud(albCloudConfig *types.NsxtAlbCloud) (*NsxtAlbCloud, error)

CreateAlbCloud creates NSX-T ALB Cloud

func (*VCDClient) CreateAlbServiceEngineGroupAssignment added in v2.14.0

func (vcdClient *VCDClient) CreateAlbServiceEngineGroupAssignment(assignmentConfig *types.NsxtAlbServiceEngineGroupAssignment) (*NsxtAlbServiceEngineGroupAssignment, error)

func (*VCDClient) CreateNsxtAlbController added in v2.13.0

func (vcdClient *VCDClient) CreateNsxtAlbController(albControllerConfig *types.NsxtAlbController) (*NsxtAlbController, error)

CreateNsxtAlbController creates controller with supplied albControllerConfig configuration

func (*VCDClient) CreateNsxtAlbPool added in v2.14.0

func (vcdClient *VCDClient) CreateNsxtAlbPool(albPoolConfig *types.NsxtAlbPool) (*NsxtAlbPool, error)

CreateNsxtAlbPool creates NSX-T ALB Pool based on supplied configuration

func (*VCDClient) CreateNsxtAlbServiceEngineGroup added in v2.13.0

func (vcdClient *VCDClient) CreateNsxtAlbServiceEngineGroup(albServiceEngineGroup *types.NsxtAlbServiceEngineGroup) (*NsxtAlbServiceEngineGroup, error)

func (*VCDClient) CreateNsxtAlbVirtualService added in v2.14.0

func (vcdClient *VCDClient) CreateNsxtAlbVirtualService(albVirtualServiceConfig *types.NsxtAlbVirtualService) (*NsxtAlbVirtualService, error)

CreateNsxtAlbVirtualService creates NSX-T ALB Virtual Service based on supplied configuration

func (*VCDClient) DeleteMetadataEntryByHref added in v2.15.0

func (vcdClient *VCDClient) DeleteMetadataEntryByHref(href, key string) error

DeleteMetadataEntryByHref deletes metadata from the given resource reference, depending on key provided as input and waits for the task to finish.

func (*VCDClient) DeleteMetadataEntryByHrefAsync added in v2.15.0

func (vcdClient *VCDClient) DeleteMetadataEntryByHrefAsync(href, key string) (Task, error)

DeleteMetadataEntryByHrefAsync deletes metadata from the given resource reference, depending on key provided as input and returns a task.

func (*VCDClient) Disconnect

func (vcdClient *VCDClient) Disconnect() error

Disconnect performs a disconnection from the vCloud Director API endpoint.

func (*VCDClient) GetAdminOrgById added in v2.4.0

func (vcdClient *VCDClient) GetAdminOrgById(orgId string) (*AdminOrg, error)

GetAdminOrgById finds an Admin Organization by ID On success, returns a pointer to the Admin Org structure and a nil error On failure, returns a nil pointer and an error

func (*VCDClient) GetAdminOrgByName added in v2.4.0

func (vcdClient *VCDClient) GetAdminOrgByName(orgName string) (*AdminOrg, error)

GetAdminOrgByName finds an Admin Organization by name On success, returns a pointer to the Admin Org structure and a nil error On failure, returns a nil pointer and an error

func (*VCDClient) GetAdminOrgByNameOrId added in v2.4.0

func (vcdClient *VCDClient) GetAdminOrgByNameOrId(identifier string) (*AdminOrg, error)

GetAdminOrgByNameOrId finds an Admin Organization by name or ID On success, returns a pointer to the Admin Org structure and a nil error On failure, returns a nil pointer and an error

func (*VCDClient) GetAlbCloudById added in v2.13.0

func (vcdClient *VCDClient) GetAlbCloudById(id string) (*NsxtAlbCloud, error)

GetAlbCloudById returns NSX-T ALB Cloud by ID

Note. This function uses server side filtering instead of directly querying endpoint with specified ID because such endpoint does not exist

func (*VCDClient) GetAlbCloudByName added in v2.13.0

func (vcdClient *VCDClient) GetAlbCloudByName(name string) (*NsxtAlbCloud, error)

GetAlbCloudByName returns NSX-T ALB Cloud by name

func (*VCDClient) GetAlbControllerById added in v2.13.0

func (vcdClient *VCDClient) GetAlbControllerById(id string) (*NsxtAlbController, error)

GetAlbControllerById returns NSX-T ALB Controller by ID

func (*VCDClient) GetAlbControllerByName added in v2.13.0

func (vcdClient *VCDClient) GetAlbControllerByName(name string) (*NsxtAlbController, error)

GetAlbControllerByName returns NSX-T ALB Controller by Name

func (*VCDClient) GetAlbControllerByUrl added in v2.13.0

func (vcdClient *VCDClient) GetAlbControllerByUrl(url string) (*NsxtAlbController, error)

GetAlbControllerByUrl returns configured ALB Controller by URL

Note. Filtering is performed on client side.

func (*VCDClient) GetAlbImportableCloudById added in v2.13.0

func (vcdClient *VCDClient) GetAlbImportableCloudById(parentAlbControllerUrn, id string) (*NsxtAlbImportableCloud, error)

GetAlbImportableCloudById returns importable NSX-T ALB Clouds. Note. ID filtering is performed on client side

func (*VCDClient) GetAlbImportableCloudByName added in v2.13.0

func (vcdClient *VCDClient) GetAlbImportableCloudByName(parentAlbControllerUrn, name string) (*NsxtAlbImportableCloud, error)

GetAlbImportableCloudByName returns importable NSX-T ALB Clouds.

func (*VCDClient) GetAlbImportableServiceEngineGroupById added in v2.13.0

func (vcdClient *VCDClient) GetAlbImportableServiceEngineGroupById(parentAlbCloudUrn, id string) (*NsxtAlbImportableServiceEngineGroups, error)

GetAlbImportableServiceEngineGroupById Note. ID filtering is performed on client side

func (*VCDClient) GetAlbImportableServiceEngineGroupByName added in v2.13.0

func (vcdClient *VCDClient) GetAlbImportableServiceEngineGroupByName(parentAlbCloudUrn, name string) (*NsxtAlbImportableServiceEngineGroups, error)

GetAlbImportableServiceEngineGroupByName returns importable NSX-T ALB Clouds.

func (*VCDClient) GetAlbPoolById added in v2.14.0

func (vcdClient *VCDClient) GetAlbPoolById(id string) (*NsxtAlbPool, error)

GetAlbPoolById fetches ALB Pool By Id

func (*VCDClient) GetAlbPoolByName added in v2.14.0

func (vcdClient *VCDClient) GetAlbPoolByName(edgeGatewayId string, name string) (*NsxtAlbPool, error)

GetAlbPoolByName fetches ALB Pool By Name

func (*VCDClient) GetAlbServiceEngineGroupAssignmentById added in v2.14.0

func (vcdClient *VCDClient) GetAlbServiceEngineGroupAssignmentById(id string) (*NsxtAlbServiceEngineGroupAssignment, error)

func (*VCDClient) GetAlbServiceEngineGroupAssignmentByName added in v2.14.0

func (vcdClient *VCDClient) GetAlbServiceEngineGroupAssignmentByName(name string) (*NsxtAlbServiceEngineGroupAssignment, error)

func (*VCDClient) GetAlbServiceEngineGroupById added in v2.13.0

func (vcdClient *VCDClient) GetAlbServiceEngineGroupById(id string) (*NsxtAlbServiceEngineGroup, error)

GetAlbServiceEngineGroupById returns importable NSX-T ALB Cloud by ID

func (*VCDClient) GetAlbServiceEngineGroupByName added in v2.13.0

func (vcdClient *VCDClient) GetAlbServiceEngineGroupByName(optionalContext, name string) (*NsxtAlbServiceEngineGroup, error)

GetAlbServiceEngineGroupByName returns NSX-T ALB Service Engine by Name Context is not mandatory for this resource. Supported contexts are: * Gateway ID (_context==gatewayId) - returns all Load Balancer Service Engine Groups that are accessible to the gateway. * Assignable Gateway ID (_context=gatewayId;_context==assignable) returns all Load Balancer Service Engine Groups that are assignable to the gateway. This filters out any Load Balancer Service Engine groups that are already assigned to the gateway or assigned to another gateway if the reservation type is 'DEDICATED’.

func (*VCDClient) GetAlbVirtualServiceById added in v2.14.0

func (vcdClient *VCDClient) GetAlbVirtualServiceById(id string) (*NsxtAlbVirtualService, error)

GetAlbVirtualServiceById fetches ALB Virtual Service By ID

func (*VCDClient) GetAlbVirtualServiceByName added in v2.14.0

func (vcdClient *VCDClient) GetAlbVirtualServiceByName(edgeGatewayId string, name string) (*NsxtAlbVirtualService, error)

GetAlbVirtualServiceByName fetches ALB Virtual Service By Name

func (*VCDClient) GetAllAlbClouds added in v2.13.0

func (vcdClient *VCDClient) GetAllAlbClouds(queryParameters url.Values) ([]*NsxtAlbCloud, error)

GetAllAlbClouds returns all configured NSX-T ALB Clouds

func (*VCDClient) GetAllAlbControllers added in v2.13.0

func (vcdClient *VCDClient) GetAllAlbControllers(queryParameters url.Values) ([]*NsxtAlbController, error)

GetAllAlbControllers returns all configured NSX-T ALB Controllers

func (*VCDClient) GetAllAlbImportableClouds added in v2.13.0

func (vcdClient *VCDClient) GetAllAlbImportableClouds(parentAlbControllerUrn string, queryParameters url.Values) ([]*NsxtAlbImportableCloud, error)

GetAllAlbImportableClouds returns importable NSX-T ALB Clouds. parentAlbControllerUrn (ID in URN format of a parent ALB Controller) is mandatory

func (*VCDClient) GetAllAlbImportableServiceEngineGroups added in v2.13.0

func (vcdClient *VCDClient) GetAllAlbImportableServiceEngineGroups(parentAlbCloudUrn string, queryParameters url.Values) ([]*NsxtAlbImportableServiceEngineGroups, error)

GetAllAlbImportableServiceEngineGroups lists all Importable Service Engine Groups available in ALB Controller

func (*VCDClient) GetAllAlbPoolSummaries added in v2.14.0

func (vcdClient *VCDClient) GetAllAlbPoolSummaries(edgeGatewayId string, queryParameters url.Values) ([]*NsxtAlbPool, error)

GetAllAlbPoolSummaries retrieves partial information for type `NsxtAlbPool`, but it is the only way to retrieve all ALB pools for Edge Gateway

func (*VCDClient) GetAllAlbPools added in v2.14.0

func (vcdClient *VCDClient) GetAllAlbPools(edgeGatewayId string, queryParameters url.Values) ([]*NsxtAlbPool, error)

GetAllAlbPools uses GetAllAlbPoolSummaries behind the scenes and the fetches complete data for all ALB Pools. This has performance penalty because each ALB Pool is fetched individually.

func (*VCDClient) GetAllAlbServiceEngineGroupAssignments added in v2.14.0

func (vcdClient *VCDClient) GetAllAlbServiceEngineGroupAssignments(queryParameters url.Values) ([]*NsxtAlbServiceEngineGroupAssignment, error)

func (*VCDClient) GetAllAlbServiceEngineGroups added in v2.13.0

func (vcdClient *VCDClient) GetAllAlbServiceEngineGroups(context string, queryParameters url.Values) ([]*NsxtAlbServiceEngineGroup, error)

GetAllAlbServiceEngineGroups retrieves NSX-T ALB Service Engines with possible filters

Context is not mandatory for this resource. Supported contexts are: * Gateway ID (_context==gatewayId) - returns all Load Balancer Service Engine Groups that are accessible to the gateway. * Assignable Gateway ID (_context=gatewayId;_context==assignable) returns all Load Balancer Service Engine Groups that are assignable to the gateway. This filters out any Load Balancer Service Engine groups that are already assigned to the gateway or assigned to another gateway if the reservation type is 'DEDICATED’.

func (*VCDClient) GetAllAlbVirtualServiceSummaries added in v2.14.0

func (vcdClient *VCDClient) GetAllAlbVirtualServiceSummaries(edgeGatewayId string, queryParameters url.Values) ([]*NsxtAlbVirtualService, error)

GetAllAlbVirtualServiceSummaries returns a limited subset of NsxtAlbVirtualService values, but does it in single query. To fetch complete information for ALB Virtual Services one can use GetAllAlbVirtualServices(), but it is slower as it has to retrieve Virtual Services one by one.

func (*VCDClient) GetAllAlbVirtualServices added in v2.14.0

func (vcdClient *VCDClient) GetAllAlbVirtualServices(edgeGatewayId string, queryParameters url.Values) ([]*NsxtAlbVirtualService, error)

GetAllAlbVirtualServices fetches ALB Virtual Services by at first listing all Virtual Services summaries and then fetching complete structure one by one

func (*VCDClient) GetAllImportableNsxtTier0Routers added in v2.9.0

func (vcdClient *VCDClient) GetAllImportableNsxtTier0Routers(nsxtManagerId string, queryParameters url.Values) ([]*NsxtTier0Router, error)

GetAllImportableNsxtTier0Routers retrieves all NSX-T Tier-0 routers using OpenAPI endpoint. Query parameters can be supplied to perform additional filtering. By default it injects FIQL filter _context==nsxtManagerId (e.g. _context==urn:vcloud:nsxtmanager:09722307-aee0-4623-af95-7f8e577c9ebc) because it is mandatory to list child Tier-0 routers.

Warning. The API returns only unused Tier-0 routers (the ones that are not used in external networks yet)

Note. IDs of Tier-0 routers do not have a standard and may look as strings when they are created using UI or as UUIDs when they are created using API

func (*VCDClient) GetAuthResponse added in v2.5.0

func (vcdClient *VCDClient) GetAuthResponse(username, password, org string) (*http.Response, error)

GetAuthResponse performs authentication and returns the full HTTP response The purpose of this function is to preserve information that is useful for token-based authentication

func (*VCDClient) GetBearerTokenFromApiToken added in v2.14.0

func (vcdClient *VCDClient) GetBearerTokenFromApiToken(org, token string) (*types.ApiTokenRefresh, error)

GetBearerTokenFromApiToken uses an API token to retrieve a bearer token using the refresh token operation.

func (*VCDClient) GetExtendedSessionInfo added in v2.14.0

func (vcdClient *VCDClient) GetExtendedSessionInfo() (*ExtendedSessionInfo, error)

GetExtendedSessionInfo collects extended session information for support and debugging It will try to collect as much data as possible, failing only if the minimum data can't be collected.

func (*VCDClient) GetExternalNetworkById added in v2.4.0

func (vcdClient *VCDClient) GetExternalNetworkById(id string) (*ExternalNetwork, error)

GetExternalNetworkById returns an ExternalNetwork reference if the network ID matches an existing one. If no valid external network is found, it returns a nil ExternalNetwork reference and an error

func (*VCDClient) GetExternalNetworkByName added in v2.4.0

func (vcdClient *VCDClient) GetExternalNetworkByName(networkName string) (*ExternalNetwork, error)

GetExternalNetworkByName returns an ExternalNetwork reference if the network name matches an existing one. If no valid external network is found, it returns a nil ExternalNetwork reference and an error

func (*VCDClient) GetExternalNetworkByNameOrId added in v2.4.0

func (vcdClient *VCDClient) GetExternalNetworkByNameOrId(identifier string) (*ExternalNetwork, error)

GetExternalNetworkByNameOrId returns an ExternalNetwork reference if either the network name or ID matches an existing one. If no valid external network is found, it returns a nil ExternalNetwork reference and an error

func (*VCDClient) GetExternalNetworks added in v2.4.0

func (vcdClient *VCDClient) GetExternalNetworks() (*types.ExternalNetworkReferences, error)

GetExternalNetworks returns a list of available external networks

func (*VCDClient) GetFilteredAlbServiceEngineGroupAssignmentByName added in v2.14.0

func (vcdClient *VCDClient) GetFilteredAlbServiceEngineGroupAssignmentByName(name string, queryParameters url.Values) (*NsxtAlbServiceEngineGroupAssignment, error)

GetFilteredAlbServiceEngineGroupAssignmentByName will get all ALB Service Engine Group assignments based on filters provided in queryParameters additionally will filter by name locally because VCD does not support server side filtering by name.

func (*VCDClient) GetFilteredNsxtImportableSwitches added in v2.13.0

func (vcdClient *VCDClient) GetFilteredNsxtImportableSwitches(filter map[string]string) ([]*NsxtImportableSwitch, error)

GetFilteredNsxtImportableSwitches returns all available importable switches. One of the filters below is required (using plain UUID - not URN): * orgVdc * nsxTManager (only in VCD 10.3.0+)

Note. OpenAPI endpoint does not exist for this resource and by default endpoint "/network/orgvdcnetworks/importableswitches" returns only unused NSX-T importable switches (the ones that are not already consumed in Org VDC networks) and there is no way to get them all.

func (*VCDClient) GetFilteredNsxtImportableSwitchesByName added in v2.13.0

func (vcdClient *VCDClient) GetFilteredNsxtImportableSwitchesByName(filter map[string]string, name string) (*NsxtImportableSwitch, error)

GetFilteredNsxtImportableSwitchesByName builds on top of GetFilteredNsxtImportableSwitches and additionally performs client side filtering by Name

func (*VCDClient) GetImportableNsxtTier0RouterByName added in v2.9.0

func (vcdClient *VCDClient) GetImportableNsxtTier0RouterByName(name, nsxtManagerId string) (*NsxtTier0Router, error)

func (*VCDClient) GetMetadataByHref added in v2.15.0

func (vcdClient *VCDClient) GetMetadataByHref(href string) (*types.Metadata, error)

GetMetadataByHref returns metadata from the given resource reference.

func (*VCDClient) GetOrgById added in v2.4.0

func (vcdClient *VCDClient) GetOrgById(orgId string) (*Org, error)

GetOrgById finds an Organization by ID On success, returns a pointer to the Org structure and a nil error On failure, returns a nil pointer and an error

func (*VCDClient) GetOrgByName added in v2.4.0

func (vcdClient *VCDClient) GetOrgByName(orgName string) (*Org, error)

GetOrgByName finds an Organization by name On success, returns a pointer to the Org structure and a nil error On failure, returns a nil pointer and an error

func (*VCDClient) GetOrgByNameOrId added in v2.4.0

func (vcdClient *VCDClient) GetOrgByNameOrId(identifier string) (*Org, error)

GetOrgByNameOrId finds an Organization by name or ID On success, returns a pointer to the Org structure and a nil error On failure, returns a nil pointer and an error

func (*VCDClient) GetOrgList added in v2.10.0

func (vcdClient *VCDClient) GetOrgList() (*types.OrgList, error)

GetOrgList returns the list ov available orgs

func (*VCDClient) GetStorageProfileByHref added in v2.13.0

func (vcdClient *VCDClient) GetStorageProfileByHref(url string) (*types.VdcStorageProfile, error)

GetStorageProfileByHref fetches a storage profile using its HREF.

func (*VCDClient) LogSessionInfo added in v2.14.0

func (client *VCDClient) LogSessionInfo()

LogSessionInfo prints session information into the default logs

func (*VCDClient) MergeMetadataByHref added in v2.16.0

func (vcdClient *VCDClient) MergeMetadataByHref(href, typedValue string, metadata map[string]interface{}) error

MergeMetadataByHref merges metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*VCDClient) MergeMetadataByHrefAsync added in v2.16.0

func (vcdClient *VCDClient) MergeMetadataByHrefAsync(href, typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataByHrefAsync merges metadata provided as a key-value map of type `typedValue` with the already present in VCD, and returns the task.

func (*VCDClient) NewVApp

func (vcdClient *VCDClient) NewVApp(client *Client) VApp

func (*VCDClient) Query

func (vcdClient *VCDClient) Query(params map[string]string) (Results, error)

func (*VCDClient) QueryNetworkPools added in v2.4.0

func (vcdClient *VCDClient) QueryNetworkPools() ([]*types.QueryResultNetworkPoolRecordType, error)

QueryNetworkPools gets the list of network pools

func (*VCDClient) QueryNsxtManagerByName added in v2.9.0

func (vcdClient *VCDClient) QueryNsxtManagerByName(name string) ([]*types.QueryResultNsxtManagerRecordType, error)

QueryNsxtManagerByName searches for NSX-T managers available in VCD

func (*VCDClient) QueryProviderVdcStorageProfileByName added in v2.13.0

func (vcdClient *VCDClient) QueryProviderVdcStorageProfileByName(name, providerVDCHref string) (*types.QueryResultProviderVdcStorageProfileRecordType, error)

QueryProviderVdcStorageProfileByName finds a provider VDC storage profile by name There are four cases: 1. [FOUND] The name matches and is unique among all the storage profiles 2. [FOUND] The name matches, it is not unique, and it is disambiguated by the provider VDC HREF 3. [NOT FOUND] The name matches, is not unique, but no Provider HREF was given: the search will fail 4. [NOT FOUND] The name does not match any of the storage profiles

func (*VCDClient) QueryProviderVdcStorageProfiles added in v2.4.0

func (vcdClient *VCDClient) QueryProviderVdcStorageProfiles() ([]*types.QueryResultProviderVdcStorageProfileRecordType, error)

QueryProviderVdcStorageProfiles gets the list of provider VDC storage profiles from ALL provider VDCs Deprecated: use either client.QueryProviderVdcStorageProfiles or client.QueryAllProviderVdcStorageProfiles

func (*VCDClient) QueryProviderVdcs added in v2.4.0

func (vcdClient *VCDClient) QueryProviderVdcs() ([]*types.QueryResultVMWProviderVdcRecordType, error)

QueryProviderVdcs gets the list of available provider VDCs

func (*VCDClient) QueryWithNotEncodedParams

func (vcdClient *VCDClient) QueryWithNotEncodedParams(params map[string]string, notEncodedParams map[string]string) (Results, error)

func (*VCDClient) QueryWithNotEncodedParamsWithApiVersion added in v2.7.0

func (vcdClient *VCDClient) QueryWithNotEncodedParamsWithApiVersion(params map[string]string, notEncodedParams map[string]string, apiVersion string) (Results, error)

func (*VCDClient) SetApiToken added in v2.14.0

func (vcdClient *VCDClient) SetApiToken(org, apiToken string) (*types.ApiTokenRefresh, error)

SetApiToken behaves similarly to SetToken, with the difference that it will return full information about the bearer token, so that the caller can make decisions about token expiration

func (*VCDClient) SetToken added in v2.5.0

func (vcdClient *VCDClient) SetToken(org, authHeader, token string) error

SetToken will set the authorization token in the client, without using other credentials Up to version 29, token authorization uses the header key x-vcloud-authorization In version 30+ it also uses X-Vmware-Vcloud-Access-Token:TOKEN coupled with X-Vmware-Vcloud-Token-Type:"bearer"

type VCDClientOption

type VCDClientOption func(*VCDClient) error

VCDClientOption defines signature for customizing VCDClient using functional options pattern.

func WithAPIVersion added in v2.2.0

func WithAPIVersion(version string) VCDClientOption

WithAPIVersion allows to override default API version. Please be cautious about changing the version as the default specified is the most tested.

func WithHttpHeader added in v2.12.0

func WithHttpHeader(options map[string]string) VCDClientOption

WithHttpHeader allows to specify custom HTTP header values. Typical usage of this function is to inject a tenant context into the client.

WARNING: Using this function in an environment with concurrent operations may result in negative side effects, such as operations as system administrator and as tenant using the same client. This setting is justified when we want to start a session where the additional header is always needed. For cases where we need system administrator and tenant operations in the same environment we can either a) use two separate clients or b) use the `additionalHeader` parameter in *newRequest* functions

func WithHttpTimeout added in v2.4.0

func WithHttpTimeout(timeout int64) VCDClientOption

WithHttpTimeout allows to override default http timeout

func WithHttpUserAgent added in v2.9.0

func WithHttpUserAgent(userAgent string) VCDClientOption

WithHttpUserAgent allows to specify HTTP user-agent which can be useful for statistics tracking. By default User-Agent is set to "go-vcloud-director". It can be unset by supplying empty value.

func WithMaxRetryTimeout

func WithMaxRetryTimeout(timeoutSeconds int) VCDClientOption

WithMaxRetryTimeout allows default vCDClient MaxRetryTimeout value override

func WithSamlAdfs added in v2.8.0

func WithSamlAdfs(useSaml bool, customAdfsRptId string) VCDClientOption

WithSamlAdfs specifies if SAML auth is used for authenticating to vCD instead of local login. The following conditions must be met so that SAML authentication works: * SAML IdP (Identity Provider) is Active Directory Federation Service (ADFS) * WS-Trust authentication endpoint "/adfs/services/trust/13/usernamemixed" must be enabled on ADFS server By default vCD SAML Entity ID will be used as Relaying Party Trust Identifier unless customAdfsRptId is specified

type VM

type VM struct {
	VM *types.Vm
	// contains filtered or unexported fields
}

func NewVM

func NewVM(cli *Client) *VM

func (*VM) AddInternalDisk added in v2.6.0

func (vm *VM) AddInternalDisk(diskData *types.DiskSettings) (string, error)

AddInternalDisk creates disk type *types.DiskSettings to the VM. Returns new disk ID and error. Runs synchronously, VM is ready for another operation after this function returns.

func (*VM) AddMetadata deprecated added in v2.2.0

func (vm *VM) AddMetadata(key string, value string) (Task, error)

Deprecated: use VM.AddMetadataEntry.

func (*VM) AddMetadataEntry added in v2.15.0

func (vm *VM) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds VM metadata typedValue and key/value pair provided as input and waits for the task to finish.

func (*VM) AddMetadataEntryAsync added in v2.15.0

func (vm *VM) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds VM metadata typedValue and key/value pair provided as input and returns the task.

func (*VM) AnswerQuestion

func (vm *VM) AnswerQuestion(questionId string, choiceId int) error

AnswerQuestion uses the provided answer to existing VM question for operation which need additional response Reference: https://code.vmware.com/apis/287/vcloud#/doc/doc/operations/POST-AnswerVmPendingQuestion.html

func (*VM) AttachDisk

func (vm *VM) AttachDisk(diskParams *types.DiskAttachOrDetachParams) (Task, error)

AttachDisk attaches an independent disk Call attachOrDetachDisk with disk and types.RelDiskAttach to attach an independent disk. Please verify the independent disk is not connected to any VM before calling this function. If the independent disk is connected to a VM, the task will be failed. Reference: vCloud API Programming Guide for Service Providers vCloud API 30.0 PDF Page 164 - 165, https://vdc-download.vmware.com/vmwb-repository/dcr-public/1b6cf07d-adb3-4dba-8c47-9c1c92b04857/ 241956dd-e128-4fcc-8131-bf66e1edd895/vcloud_sp_api_guide_30_0.pdf

func (*VM) BlockWhileGuestCustomizationStatus added in v2.4.0

func (vm *VM) BlockWhileGuestCustomizationStatus(unwantedStatus string, timeOutAfterSeconds int) error

BlockWhileGuestCustomizationStatus blocks until the customization status of VM exits unwantedStatus. It sleeps 3 seconds between iterations and times out after timeOutAfterSeconds of seconds.

timeOutAfterSeconds must be more than 4 and less than 2 hours (60s*120)

func (*VM) ChangeCPU added in v2.15.0

func (vm *VM) ChangeCPU(cpus, cpuCores int) error

ChangeCPUCount sets number of available virtual logical processors (i.e. CPUs x cores per socket) Cpu cores count is inherited from template. https://communities.vmware.com/thread/576209

func (*VM) ChangeCPUCount

func (vm *VM) ChangeCPUCount(virtualCpuCount int) (Task, error)

ChangeCPUCount sets number of available virtual logical processors (i.e. CPUs x cores per socket) Cpu cores count is inherited from template. https://communities.vmware.com/thread/576209 Deprecated: use vm.ChangeCPU instead

func (*VM) ChangeCPUCountWithCore

func (vm *VM) ChangeCPUCountWithCore(virtualCpuCount int, coresPerSocket *int) (Task, error)

ChangeCPUCountWithCore sets number of available virtual logical processors (i.e. CPUs x cores per socket) and cores per socket. Socket count is a result of: virtual logical processors/cores per socket https://communities.vmware.com/thread/576209 Deprecated: use vm.ChangeCPU instead

func (*VM) ChangeMemory added in v2.15.0

func (vm *VM) ChangeMemory(sizeInMb int64) error

ChangeMemory sets memory value. Size is MB

func (*VM) ChangeMemorySize deprecated

func (vm *VM) ChangeMemorySize(size int) (Task, error)

Deprecated: use vm.ChangeMemory instead

func (*VM) ChangeNetworkConfig

func (vm *VM) ChangeNetworkConfig(networks []map[string]interface{}) (Task, error)

ChangeNetworkConfig allows to update existing VM NIC configuration.f

func (*VM) Customize deprecated

func (vm *VM) Customize(computerName, script string, changeSid bool) (Task, error)

Customize function allows to set ComputerName, apply customization script and enable or disable the changeSid option

Deprecated: Use vm.SetGuestCustomizationSection()

func (*VM) Delete added in v2.11.0

func (vm *VM) Delete() error

Delete deletes a standalone VM

func (*VM) DeleteAsync added in v2.11.0

func (vm *VM) DeleteAsync() (Task, error)

DeleteAsync starts a standalone VM deletion, returning a task

func (*VM) DeleteInternalDisk added in v2.6.0

func (vm *VM) DeleteInternalDisk(diskId string) error

DeleteInternalDisk delete disk using provided disk ID. Runs synchronously, VM is ready for another operation after this function returns.

func (*VM) DeleteMetadata deprecated added in v2.2.0

func (vm *VM) DeleteMetadata(key string) (Task, error)

Deprecated: use VM.DeleteMetadataEntry.

func (*VM) DeleteMetadataEntry added in v2.15.0

func (vm *VM) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes VM metadata by key provided as input and waits for the task to finish.

func (*VM) DeleteMetadataEntryAsync added in v2.15.0

func (vm *VM) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes VM metadata depending on key provided as input and returns the task.

func (*VM) DetachDisk

func (vm *VM) DetachDisk(diskParams *types.DiskAttachOrDetachParams) (Task, error)

DetachDisk detaches an independent disk Call attachOrDetachDisk with disk and types.RelDiskDetach to detach an independent disk. Please verify the independent disk is connected the VM before calling this function. If the independent disk is not connected to the VM, the task will be failed. Reference: vCloud API Programming Guide for Service Providers vCloud API 30.0 PDF Page 164 - 165, https://vdc-download.vmware.com/vmwb-repository/dcr-public/1b6cf07d-adb3-4dba-8c47-9c1c92b04857/ 241956dd-e128-4fcc-8131-bf66e1edd895/vcloud_sp_api_guide_30_0.pdf

func (*VM) EjectMedia

func (vm *VM) EjectMedia(mediaParams *types.MediaInsertOrEjectParams) (EjectTask, error)

EjectMedia ejects media from VM Call insertOrEjectMedia with media and types.RelMediaEjectMedia to eject media from VM. If media isn't inserted then task still will be successful.

func (*VM) GetGuestCustomizationSection added in v2.4.0

func (vm *VM) GetGuestCustomizationSection() (*types.GuestCustomizationSection, error)

GetGuestCustomizationSection retrieves guest customization section for a VM. It allows to read VM guest customization properties.

func (*VM) GetGuestCustomizationStatus added in v2.4.0

func (vm *VM) GetGuestCustomizationStatus() (string, error)

GetGuestCustomizationStatus retrieves guest customization status. It can be one of "GC_PENDING", "REBOOT_PENDING", "GC_FAILED", "POST_GC_PENDING", "GC_COMPLETE"

func (*VM) GetInternalDiskById added in v2.6.0

func (vm *VM) GetInternalDiskById(diskId string, refresh bool) (*types.DiskSettings, error)

GetInternalDiskById returns a *types.DiskSettings if one exists. If it doesn't, returns nil and ErrorEntityNotFound or other err.

func (*VM) GetMetadata added in v2.2.0

func (vm *VM) GetMetadata() (*types.Metadata, error)

GetMetadata returns VM metadata.

func (*VM) GetNetworkConnectionSection

func (vm *VM) GetNetworkConnectionSection() (*types.NetworkConnectionSection, error)

GetNetworkConnectionSection returns current networks attached to VM

The slice of NICs is not necessarily ordered by NIC index

func (*VM) GetParentVApp added in v2.6.0

func (vm *VM) GetParentVApp() (*VApp, error)

GetParentVApp find parent vApp for VM by checking its "up" "link".

Note. The VM has a parent vApp defined even if it was created as a standalone

func (*VM) GetParentVdc added in v2.6.0

func (vm *VM) GetParentVdc() (*Vdc, error)

GetParentVdc returns parent VDC for VM

func (*VM) GetProductSectionList added in v2.4.0

func (vm *VM) GetProductSectionList() (*types.ProductSectionList, error)

GetProductSectionList retrieves product section for a VM. It allows to read VM guest properties.

The slice of properties "ProductSectionList.ProductSection.Property" is not necessarily ordered or returned as set before

func (*VM) GetQuestion

func (vm *VM) GetQuestion() (types.VmPendingQuestion, error)

GetQuestion uses the get existing VM question for operation which need additional response Reference: https://code.vmware.com/apis/287/vcloud#/doc/doc/operations/GET-VmPendingQuestion.html

func (*VM) GetStatus

func (vm *VM) GetStatus() (string, error)

func (*VM) GetVMSecurityTags added in v2.16.0

func (vm *VM) GetVMSecurityTags() (*types.EntitySecurityTags, error)

GetVMSecurityTags Retrieves the list of tags for a specific VM. If user has view right to the VM, user can view its tags. This function works from API v36.0 (VCD 10.3.0+)

func (*VM) GetVirtualHardwareSection added in v2.4.0

func (vm *VM) GetVirtualHardwareSection() (*types.VirtualHardwareSection, error)

GetVirtualHardwareSection returns the virtual hardware items attached to a VM

func (*VM) HandleEjectMedia

func (vm *VM) HandleEjectMedia(org *Org, catalogName, mediaName string) (EjectTask, error)

HandleEjectMedia is a helper function which finds media and calls EjectMedia

func (*VM) HandleEjectMediaAndAnswer added in v2.4.0

func (vm *VM) HandleEjectMediaAndAnswer(org *Org, catalogName, mediaName string, answerYes bool) (*VM, error)

HandleEjectMediaAndAnswer helper function which finds media, calls EjectMedia, waits for task to complete and answer question. Also waits until VM status refreshes - this added as 9.7-10.0 vCD versions has lag in status update. answerYes - handles question risen when VM is running. True value enforces ejection.

func (*VM) HandleInsertMedia

func (vm *VM) HandleInsertMedia(org *Org, catalogName, mediaName string) (Task, error)

HandleInsertMedia helper function finds media and calls InsertMedia

func (*VM) InsertMedia

func (vm *VM) InsertMedia(mediaParams *types.MediaInsertOrEjectParams) (Task, error)

InsertMedia insert media for a VM Call insertOrEjectMedia with media and types.RelMediaInsertMedia to insert media from VM.

func (*VM) IsDeployed added in v2.4.0

func (vm *VM) IsDeployed() (bool, error)

IsDeployed checks if the VM is deployed or not

func (*VM) MergeMetadata added in v2.16.0

func (vm *VM) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges VM metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete.

func (*VM) MergeMetadataAsync added in v2.16.0

func (vm *VM) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges VM metadata provided as a key-value map of type `typedValue` with the already present in VCD, then returns the task.

func (*VM) PowerOff

func (vm *VM) PowerOff() (Task, error)

func (*VM) PowerOn

func (vm *VM) PowerOn() (Task, error)

func (*VM) PowerOnAndForceCustomization added in v2.4.0

func (vm *VM) PowerOnAndForceCustomization() error

PowerOnAndForceCustomization is a synchronous function which is equivalent to the functionality one has in UI. It triggers customization which may be useful in some cases (like altering NICs)

The VM _must_ be un-deployed for this action to actually work.

func (*VM) Refresh

func (vm *VM) Refresh() error

func (*VM) RunCustomizationScript

func (vm *VM) RunCustomizationScript(computerName, script string) (Task, error)

func (*VM) SetGuestCustomizationSection added in v2.4.0

func (vm *VM) SetGuestCustomizationSection(guestCustomizationSection *types.GuestCustomizationSection) (*types.GuestCustomizationSection, error)

SetGuestCustomizationSection sets guest customization section for a VM. It allows to change VM guest customization properties.

func (*VM) SetProductSectionList added in v2.4.0

func (vm *VM) SetProductSectionList(productSection *types.ProductSectionList) (*types.ProductSectionList, error)

SetProductSectionList sets product section for a VM. It allows to change VM guest properties.

The slice of properties "ProductSectionList.ProductSection.Property" is not necessarily ordered or returned as set before

func (*VM) ToggleHardwareVirtualization added in v2.2.0

func (vm *VM) ToggleHardwareVirtualization(isEnabled bool) (Task, error)

ToggleHardwareVirtualization allows to either enable or disable hardware assisted CPU virtualization for the VM. It can only be performed on a powered off VM and will return an error otherwise. This is mainly useful for hypervisor nesting.

func (*VM) Undeploy

func (vm *VM) Undeploy() (Task, error)

Undeploy triggers a VM undeploy and power off action. "Power off" action in UI behaves this way.

func (*VM) UpdateComputePolicy added in v2.9.0

func (vm *VM) UpdateComputePolicy(computePolicy *types.VdcComputePolicy) (*VM, error)

UpdateComputePolicy updates VM compute policy and returns refreshed VM or error.

func (*VM) UpdateComputePolicyAsync added in v2.9.0

func (vm *VM) UpdateComputePolicyAsync(computePolicy *types.VdcComputePolicy) (Task, error)

UpdateComputePolicyAsync updates VM Compute policy and returns Task and error.

func (*VM) UpdateInternalDisks added in v2.6.0

func (vm *VM) UpdateInternalDisks(disksSettingToUpdate *types.VmSpecSection) (*types.VmSpecSection, error)

UpdateInternalDisks applies disks configuration for the VM. types.VmSpecSection has to have all internal disk state. Disks which don't match provided ones in types.VmSpecSection will be deleted. Matched internal disk will be updated. New internal disk description found in types.VmSpecSection will be created. Returns updated types.VmSpecSection and error. Runs synchronously, VM is ready for another operation after this function returns.

func (*VM) UpdateInternalDisksAsync added in v2.6.0

func (vm *VM) UpdateInternalDisksAsync(disksSettingToUpdate *types.VmSpecSection) (Task, error)

UpdateInternalDisksAsync applies disks configuration for the VM. types.VmSpecSection has to have all internal disk state. Disks which don't match provided ones in types.VmSpecSection will be deleted. Matched internal disk will be updated. New internal disk description found in types.VmSpecSection will be created. Returns Task and error.

func (*VM) UpdateNetworkConnectionSection added in v2.4.0

func (vm *VM) UpdateNetworkConnectionSection(networks *types.NetworkConnectionSection) error

UpdateNetworkConnectionSection applies network configuration of types.NetworkConnectionSection for the VM Runs synchronously, VM is ready for another operation after this function returns.

func (*VM) UpdateStorageProfile added in v2.10.0

func (vm *VM) UpdateStorageProfile(storageProfileHref string) (*VM, error)

UpdateStorageProfile updates VM storage profile and returns refreshed VM or error.

func (*VM) UpdateStorageProfileAsync added in v2.10.0

func (vm *VM) UpdateStorageProfileAsync(storageProfileHref string) (Task, error)

UpdateStorageProfileAsync updates VM storage profile and returns Task and error.

func (*VM) UpdateVMSecurityTags added in v2.16.0

func (vm *VM) UpdateVMSecurityTags(entitySecurityTags *types.EntitySecurityTags) (*types.EntitySecurityTags, error)

UpdateVMSecurityTags updates the list of tags for a specific VM. An empty list of tags means to delete all tags for the VM. If user has edit permission on the VM, user can edit its tags. This function works from API v36.0 (VCD 10.3.0+)

func (*VM) UpdateVmCpuAndMemoryHotAdd added in v2.9.0

func (vm *VM) UpdateVmCpuAndMemoryHotAdd(cpuAdd, memoryAdd bool) (*VM, error)

UpdateVmCpuAndMemoryHotAdd updates VM Capabilities and returns refreshed VM or error.

func (*VM) UpdateVmCpuAndMemoryHotAddAsync added in v2.9.0

func (vm *VM) UpdateVmCpuAndMemoryHotAddAsync(cpuHot, memoryAdd bool) (Task, error)

UpdateVmCpuAndMemoryHotAddAsync updates VM Capabilities and returns Task and error.

func (*VM) UpdateVmSpecSection added in v2.8.0

func (vm *VM) UpdateVmSpecSection(vmSettingsToUpdate *types.VmSpecSection, description string) (*VM, error)

UpdateVmSpecSection updates VM Spec section and returns refreshed VM or error.

func (*VM) UpdateVmSpecSectionAsync added in v2.8.0

func (vm *VM) UpdateVmSpecSectionAsync(vmSettingsToUpdate *types.VmSpecSection, description string) (Task, error)

UpdateVmSpecSectionAsync updates VM Spec section and returns Task and error.

func (*VM) WaitForDhcpIpByNicIndexes added in v2.6.0

func (vm *VM) WaitForDhcpIpByNicIndexes(nicIndexes []int, maxWaitSeconds int, useNsxvDhcpLeaseCheck bool) ([]string, bool, error)

WaitForDhcpIpByNicIndexes accepts a slice of NIC indexes in VM, tries to get these IPs up to maxWaitSeconds and then returns: * a list of IPs * whether the function hit timeout (some IP values may be available after timeout) * error

This function checks a slice of nicIndexes and reuses all possible API calls. It may return a partial result for IP addresses when the timeout is hit.

Getting a DHCP address is complicated because vCD (in UI and in types.NetworkConnectionSection) reports IP addresses only when guest tools are present on a VM. This function also attempts to check if VM NICs are attached to routed network on edge gateway - then there is a chance that built-in DHCP pools are used and active DHCP leases can be found.

For this function to work - at least one the following must be true: * VM has guest tools (vCD UI shows IP address). (Takes longer time) * VM DHCP interface is connected to routed Org network and is using NSX-V Edge Gateway DHCP. (Takes less time, but is more constrained)

type VMRecord

type VMRecord struct {
	VM *types.QueryResultVMRecordType
	// contains filtered or unexported fields
}

func NewVMRecord

func NewVMRecord(cli *Client) *VMRecord

NewVMRecord creates an instance with reference to types.QueryResultVMRecordType

type VappNetworkSettings

type VappNetworkSettings struct {
	ID                 string
	Name               string
	Description        string
	Gateway            string
	NetMask            string
	DNS1               string
	DNS2               string
	DNSSuffix          string
	GuestVLANAllowed   *bool
	StaticIPRanges     []*types.IPRange
	DhcpSettings       *DhcpSettings
	RetainIpMacEnabled *bool
	VappFenceEnabled   *bool
}

struct type used to pass information for vApp network creation

type VappTemplateData added in v2.8.0

type VappTemplateData struct {
	Name                     string
	ItemCreationDate         string
	VappTemplateCreationDate string
	Metadata                 StringMap
	Created                  bool
}

func HelperCreateMultipleCatalogItems added in v2.8.0

func HelperCreateMultipleCatalogItems(catalog *Catalog, requestData []VappTemplateData, verbose bool) ([]VappTemplateData, error)

HelperCreateMultipleCatalogItems deploys several catalog items, as defined in requestData Returns a set of VappTemplateData with what was created. If the requested objects exist already, returns updated information about the existing items.

type VcdVersion added in v2.10.0

type VcdVersion struct {
	Version *semver.Version
	Time    time.Time
}

VcdVersion contains the full information about a VCD version

type Vdc

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

func NewVdc

func NewVdc(cli *Client) *Vdc

func (*Vdc) AddMetadata deprecated added in v2.3.0

func (vdc *Vdc) AddMetadata(key string, value string) (Vdc, error)

Deprecated: use Vdc.AddMetadataEntry.

func (*Vdc) AddMetadataAsync deprecated added in v2.3.0

func (vdc *Vdc) AddMetadataAsync(key string, value string) (Task, error)

Deprecated: use Vdc.AddMetadataEntryAsync.

func (*Vdc) AddMetadataEntry added in v2.15.0

func (vdc *Vdc) AddMetadataEntry(typedValue, key, value string) error

AddMetadataEntry adds VDC metadata typedValue and key/value pair provided as input and waits for the task to finish. Note: Requires system administrator privileges.

func (*Vdc) AddMetadataEntryAsync added in v2.15.0

func (vdc *Vdc) AddMetadataEntryAsync(typedValue, key, value string) (Task, error)

AddMetadataEntryAsync adds VDC metadata typedValue and key/value pair provided as input and returns the task. Note: Requires system administrator privileges.

func (*Vdc) ComposeRawVApp

func (vdc *Vdc) ComposeRawVApp(name string, description string) error

ComposeRawVApp creates an empty vApp Deprecated: use CreateRawVApp instead

func (*Vdc) ComposeVApp

func (vdc *Vdc) ComposeVApp(orgvdcnetworks []*types.OrgVDCNetwork, vapptemplate VAppTemplate, storageprofileref types.Reference, name string, description string, acceptalleulas bool) (Task, error)

ComposeVApp creates a vapp with the given template, name, and description that uses the storageprofile and networks given. If you want all eulas to be accepted set acceptalleulas to true. Returns a successful task if completed successfully, otherwise returns an error and an empty task. Deprecated: bad implementation

func (*Vdc) CreateDisk

func (vdc *Vdc) CreateDisk(diskCreateParams *types.DiskCreateParams) (Task, error)

Create an independent disk in VDC Reference: vCloud API Programming Guide for Service Providers vCloud API 30.0 PDF Page 102 - 103, https://vdc-download.vmware.com/vmwb-repository/dcr-public/1b6cf07d-adb3-4dba-8c47-9c1c92b04857/ 241956dd-e128-4fcc-8131-bf66e1edd895/vcloud_sp_api_guide_30_0.pdf

func (*Vdc) CreateNsxtFirewallGroup added in v2.12.0

func (vdc *Vdc) CreateNsxtFirewallGroup(firewallGroupConfig *types.NsxtFirewallGroup) (*NsxtFirewallGroup, error)

CreateNsxtFirewallGroup allows users to create NSX-T Firewall Group

func (*Vdc) CreateNsxvIpSet added in v2.5.0

func (vdc *Vdc) CreateNsxvIpSet(ipSetConfig *types.EdgeIpSet) (*types.EdgeIpSet, error)

CreateNsxvIpSet creates an IP set from *types.EdgeIpSet. IP set defines a group of IP addresses that you can add as the source or destination in a firewall rule or in DHCP relay configuration.

func (*Vdc) CreateOpenApiOrgVdcNetwork added in v2.11.0

func (vdc *Vdc) CreateOpenApiOrgVdcNetwork(orgVdcNetworkConfig *types.OpenApiOrgVdcNetwork) (*OpenApiOrgVdcNetwork, error)

CreateOpenApiOrgVdcNetwork allows to create NSX-T or NSX-V Org VDC network

func (*Vdc) CreateOrgVDCNetwork

func (vdc *Vdc) CreateOrgVDCNetwork(networkConfig *types.OrgVDCNetwork) (Task, error)

Fine tuning network creation function. Return an error (the result of the network creation) and a task (used to monitor the network configuration) This function can create any type of Org Vdc network. The exact type is determined by the combination of properties given with the network configuration structure.

func (*Vdc) CreateOrgVDCNetworkWait

func (vdc *Vdc) CreateOrgVDCNetworkWait(networkConfig *types.OrgVDCNetwork) error

A wrapper call around CreateOrgVDCNetwork. Creates a network and then uses the associated task to monitor its configuration

func (*Vdc) CreateRawVApp added in v2.12.0

func (vdc *Vdc) CreateRawVApp(name string, description string) (*VApp, error)

CreateRawVApp creates an empty vApp

func (*Vdc) CreateStandaloneVMFromTemplate added in v2.11.0

func (vdc *Vdc) CreateStandaloneVMFromTemplate(params *types.InstantiateVmTemplateParams) (*VM, error)

CreateStandaloneVMFromTemplate creates a standalone VM from a template

func (*Vdc) CreateStandaloneVMFromTemplateAsync added in v2.11.0

func (vdc *Vdc) CreateStandaloneVMFromTemplateAsync(params *types.InstantiateVmTemplateParams) (Task, error)

CreateStandaloneVMFromTemplateAsync starts a standalone VM creation using a template

func (*Vdc) CreateStandaloneVm added in v2.11.0

func (vdc *Vdc) CreateStandaloneVm(params *types.CreateVmParams) (*VM, error)

CreateStandaloneVm creates a standalone VM without a template

func (*Vdc) CreateStandaloneVmAsync added in v2.11.0

func (vdc *Vdc) CreateStandaloneVmAsync(params *types.CreateVmParams) (Task, error)

CreateStandaloneVmAsync starts a standalone VM creation without a template, returning a task

func (*Vdc) CreateVmAffinityRule added in v2.8.0

func (vdc *Vdc) CreateVmAffinityRule(affinityRuleDef *types.VmAffinityRule) (*VmAffinityRule, error)

CreateVmAffinityRule is a wrap around CreateVmAffinityRuleAsync that handles the task and returns the finished object

func (*Vdc) CreateVmAffinityRuleAsync added in v2.8.0

func (vdc *Vdc) CreateVmAffinityRuleAsync(affinityRuleDef *types.VmAffinityRule) (Task, error)

CreateVmAffinityRuleAsync creates a new VM affinity rule, and returns a task that handles the operation

func (*Vdc) Delete

func (vdc *Vdc) Delete(force bool, recursive bool) (Task, error)

Deletes the vdc, returning an error of the vCD call fails. API Documentation: https://code.vmware.com/apis/220/vcloud#/doc/doc/operations/DELETE-Vdc.html

func (*Vdc) DeleteControlAccess added in v2.16.0

func (vdc *Vdc) DeleteControlAccess(useTenantContext bool) (*types.ControlAccessParams, error)

DeleteControlAccess makes stop sharing VDC with anyone

func (*Vdc) DeleteMetadata deprecated added in v2.3.0

func (vdc *Vdc) DeleteMetadata(key string) (Vdc, error)

Deprecated: use Vdc.DeleteMetadataEntry.

func (*Vdc) DeleteMetadataAsync deprecated added in v2.3.0

func (vdc *Vdc) DeleteMetadataAsync(key string) (Task, error)

Deprecated: use Vdc.DeleteMetadataEntryAsync.

func (*Vdc) DeleteMetadataEntry added in v2.15.0

func (vdc *Vdc) DeleteMetadataEntry(key string) error

DeleteMetadataEntry deletes VDC metadata by key provided as input and waits for the task to finish. Note: Requires system administrator privileges.

func (*Vdc) DeleteMetadataEntryAsync added in v2.15.0

func (vdc *Vdc) DeleteMetadataEntryAsync(key string) (Task, error)

DeleteMetadataEntryAsync deletes VDC metadata depending on key provided as input and returns the task. Note: Requires system administrator privileges.

func (*Vdc) DeleteNsxvIpSetById added in v2.5.0

func (vdc *Vdc) DeleteNsxvIpSetById(id string) error

DeleteNsxvIpSetById deletes IP set by its ID which is formatted as f9daf2da-b4f9-4921-a2f4-d77a943a381c:ipset-9

func (*Vdc) DeleteNsxvIpSetByName added in v2.5.0

func (vdc *Vdc) DeleteNsxvIpSetByName(name string) error

DeleteNsxvIpSetById deletes IP set by its name

func (*Vdc) DeleteOpenApiOrgVdcNetworkDhcp added in v2.11.0

func (vdc *Vdc) DeleteOpenApiOrgVdcNetworkDhcp(orgNetworkId string) error

DeleteOpenApiOrgVdcNetworkDhcp allows to perform HTTP DELETE request on DHCP pool configuration for specified Org VDC Network ID

func (*Vdc) DeleteWait

func (vdc *Vdc) DeleteWait(force bool, recursive bool) error

Deletes the vdc and waits for the asynchronous task to complete.

func (*Vdc) FindDiskByHREF

func (vdc *Vdc) FindDiskByHREF(href string) (*Disk, error)

Find an independent disk by disk href in VDC Deprecated: Use VDC.GetDiskByHref()

func (*Vdc) FindEdgeGateway deprecated

func (vdc *Vdc) FindEdgeGateway(edgegateway string) (EdgeGateway, error)

Deprecated: use GetEdgeGatewayByName

func (*Vdc) FindEdgeGatewayNameByNetwork added in v2.5.0

func (vdc *Vdc) FindEdgeGatewayNameByNetwork(networkName string) (string, error)

FindEdgeGatewayNameByNetwork searches the VDC for a connection between an edge gateway and a given network. On success, returns the name of the edge gateway

func (*Vdc) FindMediaImage

func (vdc *Vdc) FindMediaImage(mediaName string) (MediaItem, error)

FindMediaImage returns media image found in system using `name` as query. Can find a few of them if media with same name exist in different catalogs. Deprecated: Use catalog.GetMediaByName()

func (*Vdc) FindStorageProfileReference

func (vdc *Vdc) FindStorageProfileReference(name string) (types.Reference, error)

func (*Vdc) FindVAppByID deprecated

func (vdc *Vdc) FindVAppByID(vappid string) (VApp, error)

Deprecated: use vdc.GetVAppById instead

func (*Vdc) FindVAppByName deprecated

func (vdc *Vdc) FindVAppByName(vapp string) (VApp, error)

Deprecated: use vdc.GetVAppByName instead

func (*Vdc) FindVDCNetwork deprecated

func (vdc *Vdc) FindVDCNetwork(network string) (OrgVDCNetwork, error)

Deprecated: use GetOrgVdcNetworkByName

func (*Vdc) FindVMByName deprecated

func (vdc *Vdc) FindVMByName(vapp VApp, vm string) (VM, error)

Deprecated: use vapp.GetVMByName instead

func (*Vdc) GetAllNsxtEdgeClusters added in v2.10.0

func (vdc *Vdc) GetAllNsxtEdgeClusters(queryParameters url.Values) ([]*NsxtEdgeCluster, error)

GetAllNsxtEdgeClusters retrieves all available Edge Clusters for a particular VDC

func (*Vdc) GetAllNsxtEdgeGateways added in v2.10.0

func (vdc *Vdc) GetAllNsxtEdgeGateways(queryParameters url.Values) ([]*NsxtEdgeGateway, error)

GetAllNsxtEdgeGateways allows to retrieve all NSX-T edge gateways for specific VDC

func (*Vdc) GetAllNsxtFirewallGroups added in v2.12.0

func (vdc *Vdc) GetAllNsxtFirewallGroups(queryParameters url.Values, firewallGroupType string) ([]*NsxtFirewallGroup, error)

GetAllNsxtFirewallGroups allows users to retrieve all NSX-T Firewall Groups

func (*Vdc) GetAllNsxtImportableSwitches added in v2.11.0

func (vdc *Vdc) GetAllNsxtImportableSwitches() ([]*NsxtImportableSwitch, error)

GetAllNsxtImportableSwitches retrieves all available importable switches which can be consumed for creating NSX-T "Imported" Org VDC network

Note. OpenAPI endpoint does not exist for this resource and by default endpoint "/network/orgvdcnetworks/importableswitches" returns only unused NSX-T importable switches (the ones that are not already consumed in Org VDC networks) and there is no way to get them all.

func (*Vdc) GetAllNsxvIpSets added in v2.5.0

func (vdc *Vdc) GetAllNsxvIpSets() ([]*types.EdgeIpSet, error)

GetAllNsxvIpSets retrieves all IP sets and returns []*types.EdgeIpSet or an error of type ErrorEntityNotFound if there are no IP sets

func (*Vdc) GetAllOpenApiOrgVdcNetworks added in v2.11.0

func (vdc *Vdc) GetAllOpenApiOrgVdcNetworks(queryParameters url.Values) ([]*OpenApiOrgVdcNetwork, error)

GetAllOpenApiOrgVdcNetworks allows to retrieve all NSX-T or NSX-V Org VDC networks in Vdc

Note. If pageSize > 32 it will be limited to maximum of 32 in this function because API validation does not allow for higher number

func (*Vdc) GetAllVmAffinityRuleList added in v2.8.0

func (vdc *Vdc) GetAllVmAffinityRuleList() ([]*types.VmAffinityRule, error)

GetAllVmAffinityRuleList retrieves all VM affinity and anti-affinity rules

func (*Vdc) GetCapabilities added in v2.11.0

func (vdc *Vdc) GetCapabilities() ([]types.VdcCapability, error)

GetCapabilities allows to retrieve a list of VDC capabilities. It has a list of values. Some particularly useful are: * networkProvider - overlay stack responsible for providing network functionality. (NSX_V or NSX_T) * crossVdc - supports cross vDC network creation

func (*Vdc) GetControlAccess added in v2.16.0

func (vdc *Vdc) GetControlAccess(useTenantContext bool) (*types.ControlAccessParams, error)

GetControlAccess read and returns the control access parameters from a VDC

func (*Vdc) GetDefaultStorageProfileReference

func (vdc *Vdc) GetDefaultStorageProfileReference(storageprofiles *types.QueryResultRecordsType) (types.Reference, error)

GetDefaultStorageProfileReference should find the default storage profile for a VDC Deprecated: unused and implemented in the wrong way. Use adminVdc.GetDefaultStorageProfileReference instead

func (*Vdc) GetDiskByHref added in v2.4.0

func (vdc *Vdc) GetDiskByHref(diskHref string) (*Disk, error)

GetDiskByHref finds a Disk by HREF On success, returns a pointer to the Disk structure and a nil error On failure, returns a nil pointer and an error

func (*Vdc) GetDiskById added in v2.4.0

func (vdc *Vdc) GetDiskById(diskId string, refresh bool) (*Disk, error)

GetDiskById finds a Disk by ID On success, returns a pointer to the Disk structure and a nil error On failure, returns a nil pointer and an error

func (*Vdc) GetDisksByName added in v2.4.0

func (vdc *Vdc) GetDisksByName(diskName string, refresh bool) (*[]Disk, error)

GetDisksByName finds one or more Disks by Name On success, returns a pointer to the Disk list and a nil error On failure, returns a nil pointer and an error

func (*Vdc) GetEdgeGatewayByHref added in v2.6.0

func (vdc *Vdc) GetEdgeGatewayByHref(href string) (*EdgeGateway, error)

GetEdgeGatewayByHref retrieves an edge gateway from VDC by querying directly its HREF. The name passed as parameter is only used for error reporting

func (*Vdc) GetEdgeGatewayById added in v2.4.0

func (vdc *Vdc) GetEdgeGatewayById(id string, refresh bool) (*EdgeGateway, error)

GetEdgeGatewayById search VDC list of edge gateways for a given ID. If the id matches, it returns a pointer to an edge gateway object. On failure, it returns a nil object and an error

func (*Vdc) GetEdgeGatewayByName added in v2.4.0

func (vdc *Vdc) GetEdgeGatewayByName(name string, refresh bool) (*EdgeGateway, error)

GetEdgeGatewayByName search the VDC list of edge gateways for a given name. If the name matches, it returns a pointer to an edge gateway object. On failure, it returns a nil object and an error

func (*Vdc) GetEdgeGatewayByNameOrId added in v2.4.0

func (vdc *Vdc) GetEdgeGatewayByNameOrId(identifier string, refresh bool) (*EdgeGateway, error)

GetEdgeGatewayByNameOrId search the VDC list of edge gateways for a given name or ID. If the name or the ID match, it returns a pointer to an edge gateway object. On failure, it returns a nil object and an error

func (*Vdc) GetEdgeGatewayRecordsType added in v2.6.0

func (vdc *Vdc) GetEdgeGatewayRecordsType(refresh bool) (*types.QueryResultEdgeGatewayRecordsType, error)

GetEdgeGatewayRecordsType retrieves a list of edge gateways from VDC Deprecated: use QueryEdgeGatewayList instead

func (*Vdc) GetMetadata added in v2.3.0

func (vdc *Vdc) GetMetadata() (*types.Metadata, error)

GetMetadata returns VDC metadata. Note: Requires system administrator privileges.

func (*Vdc) GetNetworkList added in v2.5.0

func (vdc *Vdc) GetNetworkList() ([]*types.QueryResultOrgVdcNetworkRecordType, error)

GetNetworkList returns a list of networks for the VDC

func (*Vdc) GetNsxtAppPortProfileByName added in v2.15.0

func (vdc *Vdc) GetNsxtAppPortProfileByName(name, scope string) (*NsxtAppPortProfile, error)

GetNsxtAppPortProfileByName allows users to retrieve Application Port Profiles for specific scope. More details in documentation for types.NsxtAppPortProfile

Note. Names are enforced to be unique per scope

func (*Vdc) GetNsxtEdgeClusterByName added in v2.10.0

func (vdc *Vdc) GetNsxtEdgeClusterByName(name string) (*NsxtEdgeCluster, error)

GetNsxtEdgeClusterByName retrieves a particular NSX-T Edge Cluster by name available for that VDC Note: Multiple NSX-T Edge Clusters with the same name may exist.

func (*Vdc) GetNsxtEdgeGatewayById added in v2.10.0

func (vdc *Vdc) GetNsxtEdgeGatewayById(id string) (*NsxtEdgeGateway, error)

GetNsxtEdgeGatewayById allows retrieving NSX-T edge gateway by ID for specific VDC

func (*Vdc) GetNsxtEdgeGatewayByName added in v2.10.0

func (vdc *Vdc) GetNsxtEdgeGatewayByName(name string) (*NsxtEdgeGateway, error)

GetNsxtEdgeGatewayByName allows to retrieve NSX-T edge gateway by Name for specific VDC

func (*Vdc) GetNsxtFirewallGroupById added in v2.12.0

func (vdc *Vdc) GetNsxtFirewallGroupById(id string) (*NsxtFirewallGroup, error)

GetNsxtFirewallGroupById retrieves NSX-T Firewall Group by ID

func (*Vdc) GetNsxtFirewallGroupByName added in v2.12.0

func (vdc *Vdc) GetNsxtFirewallGroupByName(name, firewallGroupType string) (*NsxtFirewallGroup, error)

GetNsxtFirewallGroupByName allows users to retrieve Firewall Group by Name firewallGroupType can be one of the following: * types.FirewallGroupTypeSecurityGroup - for NSX-T Security Groups * types.FirewallGroupTypeIpSet - for NSX-T IP Sets * "" (empty) - search will not be limited and will get both - IP Sets and Security Groups

Note. One might get an error if IP Set and Security Group exist with the same name (two objects of the same type cannot exist) and firewallGroupType is left empty.

func (*Vdc) GetNsxtImportableSwitchByName added in v2.11.0

func (vdc *Vdc) GetNsxtImportableSwitchByName(name string) (*NsxtImportableSwitch, error)

GetNsxtImportableSwitchByName retrieves a particular NSX-T Segment by name available for that VDC

Note. OpenAPI endpoint does not exist for this resource and by default endpoint "/network/orgvdcnetworks/importableswitches" returns only unused NSX-T importable switches (the ones that are not already consumed in Org VDC networks) and there is no way to get them all (including the used ones).

func (*Vdc) GetNsxvIpSetById added in v2.5.0

func (vdc *Vdc) GetNsxvIpSetById(id string) (*types.EdgeIpSet, error)

GetNsxvIpSetById searches for IP set by ID. Returns ErrorEntityNotFound if an IP set is not found

func (*Vdc) GetNsxvIpSetByName added in v2.5.0

func (vdc *Vdc) GetNsxvIpSetByName(name string) (*types.EdgeIpSet, error)

GetNsxvIpSetByName searches for IP set by name. Names are unique therefore it can find only one. Returns ErrorEntityNotFound if an IP set is not found

func (*Vdc) GetNsxvIpSetByNameOrId added in v2.5.0

func (vdc *Vdc) GetNsxvIpSetByNameOrId(identifier string) (*types.EdgeIpSet, error)

GetNsxvIpSetByNameOrId uses the same identifier to search by name and by ID. Priority is to try and find the IP set by ID. If it is not found - then a search by name is performed.

func (*Vdc) GetOpenApiOrgVdcNetworkById added in v2.11.0

func (vdc *Vdc) GetOpenApiOrgVdcNetworkById(id string) (*OpenApiOrgVdcNetwork, error)

GetOpenApiOrgVdcNetworkById allows to retrieve both - NSX-T and NSX-V Org VDC networks

func (*Vdc) GetOpenApiOrgVdcNetworkByName added in v2.11.0

func (vdc *Vdc) GetOpenApiOrgVdcNetworkByName(name string) (*OpenApiOrgVdcNetwork, error)

GetOpenApiOrgVdcNetworkByName allows to retrieve both - NSX-T and NSX-V Org VDC networks

func (*Vdc) GetOpenApiOrgVdcNetworkDhcp added in v2.11.0

func (vdc *Vdc) GetOpenApiOrgVdcNetworkDhcp(orgNetworkId string) (*OpenApiOrgVdcNetworkDhcp, error)

GetOpenApiOrgVdcNetworkDhcp allows to retrieve DHCP configuration for specific Org VDC network ID specified as orgNetworkId using OpenAPI

func (*Vdc) GetOrgVdcNetworkByHref added in v2.4.0

func (vdc *Vdc) GetOrgVdcNetworkByHref(href string) (*OrgVDCNetwork, error)

GetOrgVdcNetworkByHref returns an Org VDC Network reference if the network HREF matches an existing one. If no valid external network is found, it returns a nil Network reference and an error

func (*Vdc) GetOrgVdcNetworkById added in v2.4.0

func (vdc *Vdc) GetOrgVdcNetworkById(id string, refresh bool) (*OrgVDCNetwork, error)

GetOrgVdcNetworkById returns an Org VDC Network reference if the network ID matches an existing one. If no valid external network is found, it returns a nil Network reference and an error

func (*Vdc) GetOrgVdcNetworkByName added in v2.4.0

func (vdc *Vdc) GetOrgVdcNetworkByName(name string, refresh bool) (*OrgVDCNetwork, error)

GetOrgVdcNetworkByName returns an Org VDC Network reference if the network name matches an existing one. If no valid external network is found, it returns a nil Network reference and an error

func (*Vdc) GetOrgVdcNetworkByNameOrId added in v2.4.0

func (vdc *Vdc) GetOrgVdcNetworkByNameOrId(identifier string, refresh bool) (*OrgVDCNetwork, error)

GetOrgVdcNetworkByNameOrId returns a VDC Network reference if either the network name or ID matches an existing one. If no valid external network is found, it returns a nil ExternalNetwork reference and an error

func (*Vdc) GetVAppByHref added in v2.4.0

func (vdc *Vdc) GetVAppByHref(vappHref string) (*VApp, error)

GetVappByHref returns a vApp reference by running a vCD API call If no valid vApp is found, it returns a nil VApp reference and an error

func (*Vdc) GetVAppById added in v2.4.0

func (vdc *Vdc) GetVAppById(id string, refresh bool) (*VApp, error)

GetVappById returns a vApp reference if the vApp ID matches an existing one. If no valid vApp is found, it returns a nil VApp reference and an error

func (*Vdc) GetVAppByName added in v2.4.0

func (vdc *Vdc) GetVAppByName(vappName string, refresh bool) (*VApp, error)

GetVappByName returns a vApp reference if the vApp Name matches an existing one. If no valid vApp is found, it returns a nil VApp reference and an error

func (*Vdc) GetVAppByNameOrId added in v2.4.0

func (vdc *Vdc) GetVAppByNameOrId(identifier string, refresh bool) (*VApp, error)

GetVappByNameOrId returns a vApp reference if either the vApp name or ID matches an existing one. If no valid vApp is found, it returns a nil VApp reference and an error

func (*Vdc) GetVappAccessControl added in v2.9.0

func (vdc *Vdc) GetVappAccessControl(vappIdentifier string, useTenantContext bool) (*types.ControlAccessParams, error)

GetVappAccessControl is a convenience method to retrieve access control for a vApp from a VDC. The input variable vappIdentifier can be either the vApp name or its ID

func (*Vdc) GetVappList added in v2.9.0

func (vdc *Vdc) GetVappList() []*types.ResourceReference

GetVappList returns the list of vApps for a VDC

func (*Vdc) GetVmAffinityRuleByHref added in v2.8.0

func (vdc *Vdc) GetVmAffinityRuleByHref(href string) (*VmAffinityRule, error)

GetVmAffinityRuleByHref finds a VM affinity or anti-affinity rule by HREF

func (*Vdc) GetVmAffinityRuleById added in v2.8.0

func (vdc *Vdc) GetVmAffinityRuleById(id string) (*VmAffinityRule, error)

GetVmAffinityRuleById retrieves a VM affinity or anti-affinity rule by ID

func (*Vdc) GetVmAffinityRuleByNameOrId added in v2.8.0

func (vdc *Vdc) GetVmAffinityRuleByNameOrId(identifier string) (*VmAffinityRule, error)

GetVmAffinityRuleByNameOrId retrieves an affinity or anti-affinity rule by name or ID Given the possibility of a name identifying multiple items, this function may also fail when the search by name returns more than one item.

func (*Vdc) GetVmAffinityRuleList added in v2.8.0

func (vdc *Vdc) GetVmAffinityRuleList() ([]*types.VmAffinityRule, error)

GetVmAffinityRuleList retrieves VM affinity rules

func (*Vdc) GetVmAffinityRulesByName added in v2.8.0

func (vdc *Vdc) GetVmAffinityRulesByName(name string, polarity string) ([]*VmAffinityRule, error)

GetVmAffinityRulesByName finds the rules with the given name Note that name does not have to be unique, so a search by name can match several items If polarity is indicated, the function retrieves only the rules with the given polarity

func (*Vdc) GetVmAntiAffinityRuleList added in v2.8.0

func (vdc *Vdc) GetVmAntiAffinityRuleList() ([]*types.VmAffinityRule, error)

GetVmAntiAffinityRuleList retrieves VM anti-affinity rules

func (*Vdc) InstantiateVAppTemplate

func (vdc *Vdc) InstantiateVAppTemplate(template *types.InstantiateVAppTemplateParams) error

func (*Vdc) IsNsxt added in v2.11.0

func (vdc *Vdc) IsNsxt() bool

IsNsxt is a convenience function to check if VDC is backed by NSX-T pVdc If error occurs - it returns false

func (*Vdc) IsNsxv added in v2.11.0

func (vdc *Vdc) IsNsxv() bool

IsNsxv is a convenience function to check if VDC is backed by NSX-V pVdc If error occurs - it returns false

func (*Vdc) MergeMetadata added in v2.16.0

func (vdc *Vdc) MergeMetadata(typedValue string, metadata map[string]interface{}) error

MergeMetadata merges VDC metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete. Note: Requires system administrator privileges.

func (*Vdc) MergeMetadataAsync added in v2.16.0

func (vdc *Vdc) MergeMetadataAsync(typedValue string, metadata map[string]interface{}) (Task, error)

MergeMetadataAsync merges VDC metadata provided as a key-value map of type `typedValue` with the already present in VCD, then waits for the task to complete. Note: Requires system administrator privileges.

func (*Vdc) Query

func (vdc *Vdc) Query(params map[string]string) (Results, error)

func (*Vdc) QueryAllMedia added in v2.8.0

func (vdc *Vdc) QueryAllMedia(mediaName string) ([]*MediaRecord, error)

QueryAllMedia returns all media images found in system using `name` as query.

func (*Vdc) QueryCatalogItemList added in v2.8.0

func (vdc *Vdc) QueryCatalogItemList() ([]*types.QueryResultCatalogItemType, error)

QueryCatalogItemList returns a list of Catalog Item for the given VDC

func (*Vdc) QueryDisk

func (vdc *Vdc) QueryDisk(diskName string) (DiskRecord, error)

QueryDisk find independent disk using disk name. Returns DiskRecord type

func (*Vdc) QueryDisks added in v2.4.0

func (vdc *Vdc) QueryDisks(diskName string) (*[]*types.DiskRecordType, error)

QueryDisks find independent disks using disk name. Returns list of DiskRecordType

func (*Vdc) QueryEdgeGatewayList added in v2.12.0

func (vdc *Vdc) QueryEdgeGatewayList() ([]*types.QueryResultEdgeGatewayRecordType, error)

QueryEdgeGatewayList returns a list of all the edge gateways in a VDC

func (*Vdc) QueryMediaList added in v2.8.0

func (vdc *Vdc) QueryMediaList() ([]*types.MediaRecordType, error)

QueryMediaList retrieves a list of media items for the VDC

func (*Vdc) QueryVM

func (vdc *Vdc) QueryVM(vappName, vmName string) (VMRecord, error)

Find vm using vApp name and VM name. Returns VMRecord query return type

func (*Vdc) QueryVappTemplateList added in v2.8.0

func (vdc *Vdc) QueryVappTemplateList() ([]*types.QueryResultVappTemplateType, error)

QueryVappTemplateList returns a list of vApp templates for the given VDC

func (*Vdc) QueryVappVmTemplate added in v2.8.0

func (vdc *Vdc) QueryVappVmTemplate(catalogName, vappTemplateName, vmNameInTemplate string) (*types.QueryResultVMRecordType, error)

QueryVappVmTemplate Finds VM template using catalog name, vApp template name, VN name in template. Returns types.QueryResultVMRecordType

func (*Vdc) QueryVmById added in v2.11.0

func (vdc *Vdc) QueryVmById(id string) (*VM, error)

QueryVmById retrieves a standalone VM by ID in a Vdc It can also retrieve a standard VM (created from vApp)

func (*Vdc) QueryVmByName added in v2.11.0

func (vdc *Vdc) QueryVmByName(name string) (*VM, error)

QueryVmByName finds a standalone VM by name The search fails either if there are more VMs with the wanted name, or if there are none It can also retrieve a standard VM (created from vApp)

func (*Vdc) QueryVmList added in v2.11.0

func (vdc *Vdc) QueryVmList(filter types.VmQueryFilter) ([]*types.QueryResultVMRecordType, error)

QueryVmList returns a list of all VMs in a given VDC

func (*Vdc) QueryWithNotEncodedParams

func (vdc *Vdc) QueryWithNotEncodedParams(params map[string]string, notEncodedParams map[string]string) (Results, error)

func (*Vdc) QueryWithNotEncodedParamsWithApiVersion added in v2.7.0

func (vdc *Vdc) QueryWithNotEncodedParamsWithApiVersion(params map[string]string, notEncodedParams map[string]string, apiVersion string) (Results, error)

func (*Vdc) Refresh

func (vdc *Vdc) Refresh() error

func (*Vdc) SearchByFilter added in v2.8.0

func (vdc *Vdc) SearchByFilter(queryType, parentField string, criteria *FilterDef) ([]QueryItem, string, error)

SearchByFilter runs the search for a specific VDC The 'parentField' argument defines which filter will be added, depending on the items we search for:

  • 'vdc' contains the VDC HREF or ID
  • 'vdcName' contains the VDC name

func (*Vdc) SetControlAccess added in v2.16.0

func (vdc *Vdc) SetControlAccess(isSharedToEveryOne bool, everyoneAccessLevel string, accessSettings []*types.AccessSetting, useTenantContext bool) (*types.ControlAccessParams, error)

SetControlAccess sets VDC control access parameters for everybody or individual users/groups. This method either sets control for everybody, passing isSharedToEveryOne true, and everyoneAccessLevel (currently only ReadOnly is supported for VDC) and nil for accessSettings, or can set access control for specific users/groups, passing isSharedToEveryOne false, everyoneAccessLevel "" and accessSettings filled as desired. The method will fail if tries to configure access control for everybody and passes individual users/groups to configure. It returns the control access parameters that are read from the API (using Vdc.GetControlAccess).

func (*Vdc) UpdateNsxvIpSet added in v2.5.0

func (vdc *Vdc) UpdateNsxvIpSet(ipSetConfig *types.EdgeIpSet) (*types.EdgeIpSet, error)

UpdateNsxvIpSet sends all fields of ipSetConfig. Omiting a value may reset it. ID is mandatory to perform update. Because the API always requires a Revision to be sent - the update fetches latest revision number automatically and embeds into the update structure.

func (*Vdc) UpdateOpenApiOrgVdcNetworkDhcp added in v2.11.0

func (vdc *Vdc) UpdateOpenApiOrgVdcNetworkDhcp(orgNetworkId string, orgVdcNetworkDhcpConfig *types.OpenApiOrgVdcNetworkDhcp) (*OpenApiOrgVdcNetworkDhcp, error)

UpdateOpenApiOrgVdcNetworkDhcp allows to update DHCP configuration for specific Org VDC network ID specified as orgNetworkId using OpenAPI

func (*Vdc) UploadMediaImage deprecated

func (vdc *Vdc) UploadMediaImage(mediaName, mediaDescription, filePath string, uploadPieceSize int64) (UploadTask, error)

Uploads an ISO file as media. This method only uploads bits to vCD spool area. Returns errors if any occur during upload from vCD or upload process. On upload fail client may need to remove vCD catalog item which waits for files to be uploaded.

Deprecated: This method is broken in API V32.0+. Please use catalog.UploadMediaImage because VCD does not support uploading directly to VDC anymore.

type VdcComputePolicy added in v2.9.0

type VdcComputePolicy struct {
	VdcComputePolicy *types.VdcComputePolicy
	Href             string
	// contains filtered or unexported fields
}

In UI called VM sizing policy. In API VDC compute policy

func (*VdcComputePolicy) Delete added in v2.9.0

func (vdcComputePolicy *VdcComputePolicy) Delete() error

Delete deletes VDC compute policy

func (*VdcComputePolicy) Update added in v2.9.0

func (vdcComputePolicy *VdcComputePolicy) Update() (*VdcComputePolicy, error)

Update existing VDC compute policy

type VdcGroup added in v2.14.0

type VdcGroup struct {
	VdcGroup *types.VdcGroup
	Href     string
	// contains filtered or unexported fields
}

VdcGroup is a structure defining a VdcGroup in Organization

func (*VdcGroup) ActivateDfw added in v2.14.0

func (vdcGroup *VdcGroup) ActivateDfw() (*VdcGroup, error)

ActivateDfw activates distributed firewall

func (*VdcGroup) CreateNsxtFirewallGroup added in v2.16.0

func (vdcGroup *VdcGroup) CreateNsxtFirewallGroup(firewallGroupConfig *types.NsxtFirewallGroup) (*NsxtFirewallGroup, error)

CreateNsxtFirewallGroup allows users to create NSX-T Firewall Group

func (*VdcGroup) CreateOpenApiOrgVdcNetwork added in v2.15.0

func (vdcGroup *VdcGroup) CreateOpenApiOrgVdcNetwork(orgVdcNetworkConfig *types.OpenApiOrgVdcNetwork) (*OpenApiOrgVdcNetwork, error)

CreateOpenApiOrgVdcNetwork allows to create NSX-T or NSX-V Org VDC network

func (*VdcGroup) DeactivateDfw added in v2.14.0

func (vdcGroup *VdcGroup) DeactivateDfw() (*VdcGroup, error)

DeactivateDfw deactivates distributed firewall

func (*VdcGroup) Delete added in v2.14.0

func (vdcGroup *VdcGroup) Delete() error

Delete deletes VDC group

func (*VdcGroup) DeleteAllDistributedFirewallRules added in v2.15.0

func (vdcGroup *VdcGroup) DeleteAllDistributedFirewallRules() error

DeleteAllDistributedFirewallRules removes all Distributed Firewall rules

Note. This function works only with `default` policy as this was the only supported when this functions was created

func (*VdcGroup) DisableDefaultPolicy added in v2.14.0

func (vdcGroup *VdcGroup) DisableDefaultPolicy() (*VdcGroup, error)

DisableDefaultPolicy deactivates default dfw policy

func (*VdcGroup) EnableDefaultPolicy added in v2.14.0

func (vdcGroup *VdcGroup) EnableDefaultPolicy() (*VdcGroup, error)

EnableDefaultPolicy activates default dfw policy

func (*VdcGroup) GenericUpdate added in v2.14.0

func (vdcGroup *VdcGroup) GenericUpdate() (*VdcGroup, error)

GenericUpdate updates existing Vdc group. API allows changing only name and description and participating VCDs

func (*VdcGroup) GetAllNsxtEdgeGateways added in v2.15.0

func (vdcGroup *VdcGroup) GetAllNsxtEdgeGateways(queryParameters url.Values) ([]*NsxtEdgeGateway, error)

GetAllNsxtEdgeGateways allows to retrieve all NSX-T edge gateways for specific VDC

func (*VdcGroup) GetAllNsxtImportableSwitches added in v2.15.0

func (vdcGroup *VdcGroup) GetAllNsxtImportableSwitches() ([]*NsxtImportableSwitch, error)

GetAllNsxtImportableSwitches retrieves all available importable switches which can be consumed for creating NSX-T "Imported" Org VDC network

Note. OpenAPI endpoint does not exist for this resource and by default endpoint "/network/orgvdcnetworks/importableswitches" returns only unused NSX-T importable switches (the ones that are not already consumed in Org VDC networks) and there is no way to get them all.

func (*VdcGroup) GetAllOpenApiOrgVdcNetworks added in v2.15.0

func (vdcGroup *VdcGroup) GetAllOpenApiOrgVdcNetworks(queryParameters url.Values) ([]*OpenApiOrgVdcNetwork, error)

GetAllOpenApiOrgVdcNetworks allows to retrieve all NSX-T or NSX-V Org VDC networks in Vdc

Note. If pageSize > 32 it will be limited to maximum of 32 in this function because API validation does not allow for higher number

func (*VdcGroup) GetCapabilities added in v2.15.0

func (vdcGroup *VdcGroup) GetCapabilities() ([]types.VdcCapability, error)

GetCapabilities allows to retrieve a list of VDC capabilities. It has a list of values. Some particularly useful are: * networkProvider - overlay stack responsible for providing network functionality. (NSX_V or NSX_T) * crossVdc - supports cross vDC network creation

func (*VdcGroup) GetDfwPolicies added in v2.14.0

func (vdcGroup *VdcGroup) GetDfwPolicies() (*types.DfwPolicies, error)

GetDfwPolicies retrieves all distributed firewall policies

func (*VdcGroup) GetDistributedFirewall added in v2.15.0

func (vdcGroup *VdcGroup) GetDistributedFirewall() (*DistributedFirewall, error)

GetDistributedFirewall retrieves Distributed Firewall in a VDC Group which contains all rules

Note. This function works only with `default` policy as this was the only supported when this functions was created

func (*VdcGroup) GetNsxtAppPortProfileByName added in v2.15.0

func (vdcGroup *VdcGroup) GetNsxtAppPortProfileByName(name, scope string) (*NsxtAppPortProfile, error)

GetNsxtAppPortProfileByName allows users to retrieve Application Port Profiles for specific scope. More details in documentation for types.NsxtAppPortProfile

Note. Names are enforced to be unique per scope

func (*VdcGroup) GetNsxtEdgeGatewayByName added in v2.15.0

func (vdcGroup *VdcGroup) GetNsxtEdgeGatewayByName(name string) (*NsxtEdgeGateway, error)

GetNsxtEdgeGatewayByName allows to retrieve NSX-T edge gateway by Name for specific VDC Group

func (*VdcGroup) GetNsxtFirewallGroupById added in v2.15.0

func (vdcGroup *VdcGroup) GetNsxtFirewallGroupById(id string) (*NsxtFirewallGroup, error)

GetNsxtFirewallGroupById retrieves NSX-T Firewall Group by ID

func (*VdcGroup) GetNsxtFirewallGroupByName added in v2.15.0

func (vdcGroup *VdcGroup) GetNsxtFirewallGroupByName(name string, firewallGroupType string) (*NsxtFirewallGroup, error)

GetNsxtFirewallGroupByName allows users to retrieve Firewall Group by Name in a particular VDC Group firewallGroupType can be one of the following: * types.FirewallGroupTypeSecurityGroup - for NSX-T Static Security Groups * types.FirewallGroupTypeVmCriteria - for NSX-T Dynamic Security Groups * types.FirewallGroupTypeIpSet - for NSX-T IP Sets * "" (empty) - search will not be limited and will get both - IP Sets and Security Groups

Note. One might get an error if IP Set and Security Group exist with the same name (two objects of the same type cannot exist) and firewallGroupType is left empty.

func (*VdcGroup) GetNsxtImportableSwitchByName added in v2.15.0

func (vdcGroup *VdcGroup) GetNsxtImportableSwitchByName(name string) (*NsxtImportableSwitch, error)

GetNsxtImportableSwitchByName retrieves a particular NSX-T Segment by name available for that VDC

Note. OpenAPI endpoint does not exist for this resource and by default endpoint "/network/orgvdcnetworks/importableswitches" returns only unused NSX-T importable switches (the ones that are not already consumed in Org VDC networks) and there is no way to get them all (including the used ones).

func (*VdcGroup) GetOpenApiOrgVdcNetworkById added in v2.15.0

func (vdcGroup *VdcGroup) GetOpenApiOrgVdcNetworkById(id string) (*OpenApiOrgVdcNetwork, error)

GetOpenApiOrgVdcNetworkById allows to retrieve both - NSX-T and NSX-V Org VDC Group networks

func (*VdcGroup) GetOpenApiOrgVdcNetworkByName added in v2.15.0

func (vdcGroup *VdcGroup) GetOpenApiOrgVdcNetworkByName(name string) (*OpenApiOrgVdcNetwork, error)

GetOpenApiOrgVdcNetworkByName allows to retrieve both - NSX-T and NSX-V Org VDC networks

func (*VdcGroup) IsNsxt added in v2.15.0

func (vdcGroup *VdcGroup) IsNsxt() bool

IsNsxt is a convenience function to check if VDC is backed by NSX-T pVdc If error occurs - it returns false

func (*VdcGroup) Update added in v2.14.0

func (vdcGroup *VdcGroup) Update(name, description string, participatingOrgVddIs []string) (*VdcGroup, error)

Update updates existing Vdc group. Allows changing only name and description and participating VCDs Not restrictive update method also available - GenericUpdate

func (*VdcGroup) UpdateDefaultDfwPolicies added in v2.14.0

func (vdcGroup *VdcGroup) UpdateDefaultDfwPolicies(defaultDfwPolicies types.DefaultPolicy) (*VdcGroup, error)

UpdateDefaultDfwPolicies updates distributed firewall default policies

func (*VdcGroup) UpdateDfwPolicies added in v2.14.0

func (vdcGroup *VdcGroup) UpdateDfwPolicies(dfwPolicies types.DfwPolicies) (*VdcGroup, error)

UpdateDfwPolicies updates distributed firewall policies

func (*VdcGroup) UpdateDistributedFirewall added in v2.15.0

func (vdcGroup *VdcGroup) UpdateDistributedFirewall(dfwRules *types.DistributedFirewallRules) (*DistributedFirewall, error)

UpdateDistributedFirewall updates Distributed Firewall in a VDC Group

Note. This function works only with `default` policy as this was the only supported when this functions was created

type VersionInfo added in v2.2.0

type VersionInfo struct {
	Version    string `xml:"Version"`
	LoginUrl   string `xml:"LoginUrl"`
	Deprecated bool   `xml:"deprecated,attr,omitempty"`
}

type VersionInfos added in v2.2.0

type VersionInfos []VersionInfo

type VmAffinityRule added in v2.8.0

type VmAffinityRule struct {
	VmAffinityRule *types.VmAffinityRule
	// contains filtered or unexported fields
}

VmAffinityRule is the govcd structure to deal with VM affinity rules

func NewVmAffinityRule added in v2.8.0

func NewVmAffinityRule(cli *Client) *VmAffinityRule

NewVmAffinityRule creates a new VM affinity rule

func (*VmAffinityRule) Delete added in v2.8.0

func (vmar *VmAffinityRule) Delete() error

Delete removes a VM affinity rule from vCD

func (*VmAffinityRule) Refresh added in v2.8.0

func (vmar *VmAffinityRule) Refresh() error

Refresh gets a fresh copy of the VM affinity rule from vCD

func (*VmAffinityRule) SetEnabled added in v2.8.0

func (vmar *VmAffinityRule) SetEnabled(value bool) error

SetEnabled is a shortcut to update only the IsEnabled property of a VM affinity rule

func (*VmAffinityRule) SetMandatory added in v2.8.0

func (vmar *VmAffinityRule) SetMandatory(value bool) error

SetMandatory is a shortcut to update only the IsMandatory property of a VM affinity rule

func (*VmAffinityRule) Update added in v2.8.0

func (vmar *VmAffinityRule) Update() error

Update modifies a VM affinity rule using as input the entity's internal data.

Source Files

Jump to

Keyboard shortcuts

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