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.
Index ¶
- Constants
- func GetExternalNetworkByName(vcdClient *VCDClient, networkName string) (*types.ExternalNetworkReference, error)
- func LogAdminCatalog(catalog types.AdminCatalog)
- func LogAdminOrg(org types.AdminOrg)
- func LogCatalog(catalog types.Catalog)
- func LogCatalogItem(catalogItem types.CatalogItem)
- func LogDisk(disk types.Disk)
- func LogExternalNetwork(network types.ExternalNetworkReference)
- func LogNetwork(conf types.OrgVDCNetwork)
- func LogOrg(org types.Org)
- func LogTask(task *types.Task, howManyTimes int, elapsed time.Duration, first, last bool)
- func LogVapp(vapp types.VApp)
- func LogVdc(vdc types.Vdc)
- func RemoveMediaImageIfExists(vdc Vdc, mediaName string) error
- func RemoveOrgVdcNetworkIfExists(vdc Vdc, networkName string) error
- func ShowAdminCatalog(catalog types.AdminCatalog)
- func ShowAdminOrg(org types.AdminOrg)
- func ShowCatalog(catalog types.Catalog)
- func ShowCatalogItem(catalogItem types.CatalogItem)
- func ShowDisk(disk types.Disk)
- func ShowExternalNetwork(network types.ExternalNetworkReference)
- func ShowNetwork(conf types.OrgVDCNetwork)
- func ShowOrg(org types.Org)
- func ShowTask(task *types.Task, howManyTimes int, elapsed time.Duration, first, last bool)
- func ShowVapp(vapp types.VApp)
- func ShowVdc(vdc types.Vdc)
- type AdminCatalog
- type AdminOrg
- func (adminOrg *AdminOrg) CreateCatalog(Name, Description string) (AdminCatalog, error)
- func (org *AdminOrg) CreateVdc(vdcConfiguration *types.VdcConfiguration) (Task, error)
- func (org *AdminOrg) CreateVdcWait(vdcDefinition *types.VdcConfiguration) error
- func (adminOrg *AdminOrg) Delete(force bool, recursive bool) error
- func (adminOrg *AdminOrg) Disable() error
- func (adminOrg *AdminOrg) FindAdminCatalog(catalogName string) (AdminCatalog, error)
- func (adminOrg *AdminOrg) FindCatalog(catalogName string) (Catalog, error)
- func (adminOrg *AdminOrg) GetVdcByName(vdcname string) (Vdc, error)
- func (adminOrg *AdminOrg) Refresh() error
- func (adminOrg *AdminOrg) Update() (Task, error)
- type AdminVdc
- type Catalog
- func (cat *Catalog) FindCatalogItem(catalogItemName string) (CatalogItem, error)
- func (cat *Catalog) UploadMediaImage(mediaName, mediaDescription, filePath string, uploadPieceSize int64) (UploadTask, error)
- func (cat *Catalog) UploadOvf(ovaFileName, itemName, description string, uploadPieceSize int64) (UploadTask, error)
- type CatalogItem
- type CatalogOperations
- type Client
- func (cli *Client) FindVMByHREF(vmHREF string) (VM, error)
- func (cli *Client) NewRequest(params map[string]string, method string, reqUrl url.URL, body io.Reader) *http.Request
- func (cli *Client) NewRequestWitNotEncodedParams(params map[string]string, notEncodedParams map[string]string, method string, ...) *http.Request
- type Disk
- type EdgeGateway
- func (eGW *EdgeGateway) AddDhcpPool(network *types.OrgVDCNetwork, dhcppool []interface{}) (Task, error)
- func (eGW *EdgeGateway) AddIpsecVPN(ipsecVPNConfig *types.EdgeGatewayServiceConfiguration) (Task, error)
- func (eGW *EdgeGateway) AddNATMapping(natType, externalIP, internalIP string) (Task, error)
- func (eGW *EdgeGateway) AddNATPortMapping(...) (Task, error)
- func (eGW *EdgeGateway) AddNATPortMappingWithUplink(network *types.OrgVDCNetwork, ...) (Task, error)
- func (eGW *EdgeGateway) Create1to1Mapping(internal, external, description string) (Task, error)
- func (eGW *EdgeGateway) CreateFirewallRules(defaultAction string, rules []*types.FirewallRule) (Task, error)
- func (eGW *EdgeGateway) Refresh() error
- func (eGW *EdgeGateway) Remove1to1Mapping(internal, external string) (Task, error)
- func (eGW *EdgeGateway) RemoveNATMapping(natType, externalIP, internalIP, port string) (Task, error)
- func (eGW *EdgeGateway) RemoveNATPortMapping(natType, externalIP, externalPort string, internalIP, internalPort string) (Task, error)
- type Envelope
- type InspectionFunc
- type MediaItem
- type Org
- type OrgOperations
- type OrgVDCNetwork
- type Results
- type Task
- type UploadTask
- type VApp
- func (vapp *VApp) AddMetadata(key, value string) (Task, error)
- func (vapp *VApp) AddRAWNetworkConfig(orgvdcnetworks []*types.OrgVDCNetwork) (Task, error)
- func (vapp *VApp) AddVM(orgvdcnetworks []*types.OrgVDCNetwork, vapptemplate VAppTemplate, name string, ...) (Task, error)
- func (vapp *VApp) ChangeCPUcount(size int) (Task, error)
- func (vapp *VApp) ChangeMemorySize(size int) (Task, error)
- func (vapp *VApp) ChangeNetworkConfig(networks []map[string]interface{}, ip string) (Task, error)
- func (vapp *VApp) ChangeStorageProfile(name string) (Task, error)
- func (vapp *VApp) ChangeVMName(name string) (Task, error)
- func (vapp *VApp) Customize(computername, script string, changeSid bool) (Task, error)
- func (vapp *VApp) Delete() (Task, error)
- func (vapp *VApp) DeleteMetadata(key string) (Task, error)
- func (vapp *VApp) Deploy() (Task, error)
- func (vapp *VApp) GetNetworkConfig() (*types.NetworkConfigSection, error)
- func (vapp *VApp) GetNetworkConnectionSection() (*types.NetworkConnectionSection, error)
- func (vapp *VApp) GetStatus() (string, error)
- func (vapp *VApp) PowerOff() (Task, error)
- func (vapp *VApp) PowerOn() (Task, error)
- func (vapp *VApp) Reboot() (Task, error)
- func (vapp *VApp) Refresh() error
- func (vapp *VApp) RemoveVM(vm VM) error
- func (vapp *VApp) Reset() (Task, error)
- func (vapp *VApp) RunCustomizationScript(computername, script string) (Task, error)
- func (vapp *VApp) SetOvf(parameters map[string]string) (Task, error)
- func (vapp *VApp) Shutdown() (Task, error)
- func (vapp *VApp) Suspend() (Task, error)
- func (vapp *VApp) Undeploy() (Task, error)
- type VAppTemplate
- type VCDClient
- func (vdcCli *VCDClient) Authenticate(username, password, org string) error
- func (vdcCli *VCDClient) Disconnect() error
- func (vdcCli *VCDClient) NewVApp(client *Client) VApp
- func (vdcCli *VCDClient) Query(params map[string]string) (Results, error)
- func (vdcCli *VCDClient) QueryWithNotEncodedParams(params map[string]string, notEncodedParams map[string]string) (Results, error)
- type VM
- func (vm *VM) AttachDisk(diskParams *types.DiskAttachOrDetachParams) (Task, error)
- func (vm *VM) ChangeCPUcount(size int) (Task, error)
- func (vm *VM) ChangeMemorySize(size int) (Task, error)
- func (vm *VM) ChangeNetworkConfig(networks []map[string]interface{}, ip string) (Task, error)
- func (vm *VM) Customize(computername, script string, changeSid bool) (Task, error)
- func (vm *VM) DetachDisk(diskParams *types.DiskAttachOrDetachParams) (Task, error)
- func (vm *VM) EjectMedia(mediaParams *types.MediaInsertOrEjectParams) (Task, error)
- func (vm *VM) GetNetworkConnectionSection() (*types.NetworkConnectionSection, error)
- func (vm *VM) GetStatus() (string, error)
- func (vm *VM) HandleEjectMedia(org *Org, catalogName, mediaName string) (Task, error)
- func (vm *VM) HandleInsertMedia(org *Org, catalogName, mediaName string) (Task, error)
- func (vm *VM) InsertMedia(mediaParams *types.MediaInsertOrEjectParams) (Task, error)
- func (vm *VM) PowerOff() (Task, error)
- func (vm *VM) PowerOn() (Task, error)
- func (vm *VM) Refresh() error
- func (vm *VM) RunCustomizationScript(computername, script string) (Task, error)
- func (vm *VM) Undeploy() (Task, error)
- type VMRecord
- type Vdc
- func (vdc *Vdc) ComposeRawVApp(name string) error
- func (vdc *Vdc) ComposeVApp(orgvdcnetworks []*types.OrgVDCNetwork, vapptemplate VAppTemplate, ...) (Task, error)
- func (vdc *Vdc) CreateDisk(diskCreateParams *types.DiskCreateParams) (Task, error)
- func (vdc *Vdc) CreateOrgVDCNetwork(networkConfig *types.OrgVDCNetwork) (Task, error)
- func (vdc *Vdc) CreateOrgVDCNetworkWait(networkConfig *types.OrgVDCNetwork) error
- func (vdc *Vdc) Delete(force bool, recursive bool) (Task, error)
- func (vdc *Vdc) DeleteWait(force bool, recursive bool) error
- func (vdc *Vdc) FindDiskByHREF(href string) (*Disk, error)
- func (vdc *Vdc) FindEdgeGateway(edgegateway string) (EdgeGateway, error)
- func (vdc *Vdc) FindMediaImage(mediaName string) (MediaItem, error)
- func (vdc *Vdc) FindStorageProfileReference(name string) (types.Reference, error)
- func (vdc *Vdc) FindVAppByID(vappid string) (VApp, error)
- func (vdc *Vdc) FindVAppByName(vapp string) (VApp, error)
- func (vdc *Vdc) FindVDCNetwork(network string) (OrgVDCNetwork, error)
- func (vdc *Vdc) FindVMByName(vapp VApp, vm string) (VM, error)
- func (vdc *Vdc) GetDefaultStorageProfileReference(storageprofiles *types.QueryResultRecordsType) (types.Reference, error)
- func (vdc *Vdc) InstantiateVAppTemplate(template *types.InstantiateVAppTemplateParams) error
- func (vdc *Vdc) Query(params map[string]string) (Results, error)
- func (vdc *Vdc) QueryVM(vappName, vmName string) (VMRecord, error)
- func (vdc *Vdc) QueryWithNotEncodedParams(params map[string]string, notEncodedParams map[string]string) (Results, error)
- func (vdc *Vdc) Refresh() error
- func (vdc *Vdc) UploadMediaImage(mediaName, mediaDescription, filePath string, uploadPieceSize int64) (UploadTask, error)
Constants ¶
const MinimumDiskSize int = 1048576 // = 1Mb
While theoretically we can use smaller amounts, there is an issue when updating disks with size < 1MB
Variables ¶
This section is empty.
Functions ¶
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 LogExternalNetwork ¶
func LogExternalNetwork(network types.ExternalNetworkReference)
func LogNetwork ¶
func LogNetwork(conf types.OrgVDCNetwork)
func RemoveMediaImageIfExists ¶
Looks for an Org Vdc network and, if found, will delete it.
func 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 ShowExternalNetwork ¶
func ShowExternalNetwork(network types.ExternalNetworkReference)
func ShowNetwork ¶
func ShowNetwork(conf types.OrgVDCNetwork)
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 NewAdminCatalog ¶
func NewAdminCatalog(client *Client) *AdminCatalog
func (*AdminCatalog) Delete ¶
func (adminCatalog *AdminCatalog) Delete(force, recursive bool) error
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) Update ¶
func (adminCatalog *AdminCatalog) Update() error
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
type AdminOrg ¶
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 ¶
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
func NewAdminOrg ¶
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) CreateVdc ¶
func (org *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
func (*AdminOrg) CreateVdcWait ¶
func (org *AdminOrg) CreateVdcWait(vdcDefinition *types.VdcConfiguration) error
Creates the vdc and waits for the asynchronous task to complete.
func (*AdminOrg) Delete ¶
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) Disable ¶
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) FindAdminCatalog ¶
func (adminOrg *AdminOrg) FindAdminCatalog(catalogName string) (AdminCatalog, error)
Given a valid catalog name, FindCatalog 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
func (*AdminOrg) FindCatalog ¶
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.
func (*AdminOrg) 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. This function allows users to use an AdminOrg to fetch a vdc as well.
func (*AdminOrg) Refresh ¶
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) Update ¶
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 VApp *types.VApp // contains filtered or unexported fields }
func NewAdminVdc ¶
type Catalog ¶
type Catalog struct { Catalog *types.Catalog // contains filtered or unexported fields }
func NewCatalog ¶
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.
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)
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 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
func NewCatalogItem ¶
func NewCatalogItem(cli *Client) *CatalogItem
func (*CatalogItem) Delete ¶
func (catalogItem *CatalogItem) Delete() error
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) GetVAppTemplate ¶
func (catalogItem *CatalogItem) GetVAppTemplate() (VAppTemplate, error)
type CatalogOperations ¶
type CatalogOperations interface {
FindCatalogItem(catalogItem string) (CatalogItem, error)
}
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 }
Client provides a client to vCloud Director, values can be populated automatically using the Authenticate method.
func (*Client) NewRequest ¶
func (cli *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 (cli *Client) NewRequestWitNotEncodedParams(params map[string]string, notEncodedParams map[string]string, method string, reqUrl url.URL, body io.Reader) *http.Request
Function allow to pass complex values params which shouldn't be encoded like for queries. e.g. /query?filter=(name=foo)
type Disk ¶
type Disk struct { Disk *types.Disk // contains filtered or unexported fields }
Independent disk
func FindDiskByHREF ¶
Find an independent disk by VDC client and disk href
func (*Disk) AttachedVM ¶
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 ¶
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) Update ¶
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 EdgeGateway ¶
type EdgeGateway struct { EdgeGateway *types.EdgeGateway // contains filtered or unexported fields }
func NewEdgeGateway ¶
func NewEdgeGateway(cli *Client) *EdgeGateway
func (*EdgeGateway) AddDhcpPool ¶
func (eGW *EdgeGateway) AddDhcpPool(network *types.OrgVDCNetwork, dhcppool []interface{}) (Task, error)
func (*EdgeGateway) AddIpsecVPN ¶
func (eGW *EdgeGateway) AddIpsecVPN(ipsecVPNConfig *types.EdgeGatewayServiceConfiguration) (Task, error)
func (*EdgeGateway) AddNATMapping ¶
func (eGW *EdgeGateway) AddNATMapping(natType, externalIP, internalIP string) (Task, error)
func (*EdgeGateway) AddNATPortMapping ¶
func (eGW *EdgeGateway) AddNATPortMapping(natType, externalIP, externalPort, internalIP, internalPort, protocol, icmpSubType string) (Task, error)
func (*EdgeGateway) AddNATPortMappingWithUplink ¶
func (eGW *EdgeGateway) AddNATPortMappingWithUplink(network *types.OrgVDCNetwork, natType, externalIP, externalPort, internalIP, internalPort, protocol, icmpSubType string) (Task, error)
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) Refresh ¶
func (eGW *EdgeGateway) Refresh() error
func (*EdgeGateway) Remove1to1Mapping ¶
func (eGW *EdgeGateway) Remove1to1Mapping(internal, external string) (Task, error)
func (*EdgeGateway) RemoveNATMapping ¶
func (eGW *EdgeGateway) RemoveNATMapping(natType, externalIP, internalIP, port string) (Task, error)
func (*EdgeGateway) RemoveNATPortMapping ¶
func (eGW *EdgeGateway) RemoveNATPortMapping(natType, externalIP, externalPort string, internalIP, internalPort string) (Task, error)
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 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 MediaItem ¶
type MediaItem struct { MediaItem *types.MediaRecordType // contains filtered or unexported fields }
func NewMediaItem ¶
type Org ¶
func GetOrgByName ¶
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
func (*Org) FindCatalog ¶
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.
func (*Org) 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.
func (*Org) Refresh ¶
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.
type OrgOperations ¶
type OrgOperations interface { FindCatalog(catalog string) (Catalog, error) GetVdcByName(vdcname string) (Vdc, error) Refresh() error }
Interface for methods in common for Org and AdminOrg
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) 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) Refresh ¶
func (orgVdcNet *OrgVDCNetwork) Refresh() error
type Results ¶
type Results struct { Results *types.QueryResultRecordsType // contains filtered or unexported fields }
func NewResults ¶
type Task ¶
type Task struct { Task *types.Task // contains filtered or unexported fields }
func CreateOrg ¶
func CreateOrg(vcdClient *VCDClient, name string, fullName string, description string, settings *types.OrgSettings, isEnabled bool) (Task, error)
Creates an Organization based on settings, network, 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 (*Task) CancelTask ¶
func (*Task) GetTaskProgress ¶
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 ¶
Checks the status of the task every 3 seconds and returns when the task is either completed or failed
type UploadTask ¶
type UploadTask struct { *Task // contains filtered or unexported fields }
func NewUploadTask ¶
func NewUploadTask(task *Task, uploadProgress *float64, 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 ¶
func (*VApp) AddRAWNetworkConfig ¶
func (vapp *VApp) AddRAWNetworkConfig(orgvdcnetworks []*types.OrgVDCNetwork) (Task, error)
func (*VApp) AddVM ¶
func (vapp *VApp) AddVM(orgvdcnetworks []*types.OrgVDCNetwork, vapptemplate VAppTemplate, name string, acceptalleulas bool) (Task, error)
func (*VApp) ChangeNetworkConfig ¶
func (*VApp) ChangeStorageProfile ¶
func (*VApp) GetNetworkConfig ¶
func (vapp *VApp) GetNetworkConfig() (*types.NetworkConfigSection, error)
func (*VApp) GetNetworkConnectionSection ¶
func (vapp *VApp) GetNetworkConnectionSection() (*types.NetworkConnectionSection, error)
func (*VApp) RunCustomizationScript ¶
type VAppTemplate ¶
type VAppTemplate struct { VAppTemplate *types.VAppTemplate // contains filtered or unexported fields }
func NewVAppTemplate ¶
func NewVAppTemplate(cli *Client) *VAppTemplate
type VCDClient ¶
type VCDClient struct { Client Client // Client for the underlying VCD instance QueryHREF url.URL // HREF for the query API Mutex sync.Mutex // contains filtered or unexported fields }
func (*VCDClient) Authenticate ¶
Authenticate is an helper function that performs a login in vCloud Director.
func (*VCDClient) Disconnect ¶
Disconnect performs a disconnection from the vCloud Director API endpoint.
type VM ¶
type VM struct { VM *types.VM // contains filtered or unexported fields }
func (*VM) AttachDisk ¶
Attach 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) ChangeNetworkConfig ¶
func (*VM) DetachDisk ¶
Detach 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 ¶
Eject 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) GetNetworkConnectionSection ¶
func (*VM) HandleEjectMedia ¶
Helper function which finds media and calls EjectMedia
func (*VM) HandleInsertMedia ¶
Helper function which finds media and calls InsertMedia
func (*VM) InsertMedia ¶
Insert media for VM Call insertOrEjectMedia with media and types.RelMediaInsertMedia to insert media from VM.
func (*VM) RunCustomizationScript ¶
type VMRecord ¶
type VMRecord struct { VM *types.QueryResultVMRecordType // contains filtered or unexported fields }
func NewVMRecord ¶
create instance with reference to types.QueryResultVMRecordType
type Vdc ¶
type Vdc struct { Vdc *types.Vdc VApp *types.VApp // contains filtered or unexported fields }
func (*Vdc) ComposeRawVApp ¶
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.
func (*Vdc) CreateDisk ¶
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) 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) Delete ¶
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) DeleteWait ¶
Deletes the vdc and waits for the asynchronous task to complete.
func (*Vdc) FindDiskByHREF ¶
Find an independent disk by disk href in VDC
func (*Vdc) FindEdgeGateway ¶
func (vdc *Vdc) FindEdgeGateway(edgegateway string) (EdgeGateway, error)
func (*Vdc) FindStorageProfileReference ¶
func (*Vdc) FindVDCNetwork ¶
func (vdc *Vdc) FindVDCNetwork(network string) (OrgVDCNetwork, error)
func (*Vdc) GetDefaultStorageProfileReference ¶
func (*Vdc) InstantiateVAppTemplate ¶
func (vdc *Vdc) InstantiateVAppTemplate(template *types.InstantiateVAppTemplateParams) error
func (*Vdc) QueryWithNotEncodedParams ¶
func (*Vdc) UploadMediaImage ¶
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.