Documentation ¶
Index ¶
- Constants
- func ReadManifest(m io.Reader) (map[string]*Checksum, error)
- type Checksum
- type ContentSecurityPoliciesInfo
- type DownloadFile
- type File
- type Find
- type FindItem
- type Item
- type ItemCertificateVerification
- type Library
- type Manager
- func (c *Manager) AddLibraryItemFile(ctx context.Context, sessionID string, updateFile UpdateFile) (*UpdateFile, error)
- func (c *Manager) AddLibraryItemFileFromURI(ctx context.Context, sessionID, fileName, uri string) (*UpdateFile, error)
- func (c *Manager) CancelLibraryItemDownloadSession(ctx context.Context, id string) error
- func (c *Manager) CancelLibraryItemUpdateSession(ctx context.Context, id string) error
- func (c *Manager) CompleteLibraryItemUpdateSession(ctx context.Context, id string) error
- func (c *Manager) CopyLibraryItem(ctx context.Context, src *Item, dst Item) (string, error)
- func (c *Manager) CreateLibrary(ctx context.Context, library Library) (string, error)
- func (c *Manager) CreateLibraryItem(ctx context.Context, item Item) (string, error)
- func (c *Manager) CreateLibraryItemDownloadSession(ctx context.Context, session Session) (string, error)
- func (c *Manager) CreateLibraryItemUpdateSession(ctx context.Context, session Session) (string, error)
- func (c *Manager) CreateSubscriber(ctx context.Context, library *Library, s SubscriberLibrary) (string, error)
- func (c *Manager) CreateTrustedCertificate(ctx context.Context, cert string) error
- func (c *Manager) DefaultOvfSecurityPolicy(ctx context.Context) (string, error)
- func (c *Manager) DeleteLibrary(ctx context.Context, library *Library) error
- func (c *Manager) DeleteLibraryItem(ctx context.Context, item *Item) error
- func (c *Manager) DeleteLibraryItemDownloadSession(ctx context.Context, id string) error
- func (c *Manager) DeleteLibraryItemUpdateSession(ctx context.Context, id string) error
- func (c *Manager) DeleteSubscriber(ctx context.Context, library *Library, subscriber string) error
- func (c *Manager) DeleteTrustedCertificate(ctx context.Context, id string) error
- func (c *Manager) FailLibraryItemDownloadSession(ctx context.Context, id string) error
- func (c *Manager) FailLibraryItemUpdateSession(ctx context.Context, id string) error
- func (c *Manager) FindLibrary(ctx context.Context, search Find) ([]string, error)
- func (c *Manager) FindLibraryItems(ctx context.Context, search FindItem) ([]string, error)
- func (c *Manager) GetLibraries(ctx context.Context) ([]Library, error)
- func (c *Manager) GetLibraryByID(ctx context.Context, id string) (*Library, error)
- func (c *Manager) GetLibraryByName(ctx context.Context, name string) (*Library, error)
- func (c *Manager) GetLibraryItem(ctx context.Context, id string) (*Item, error)
- func (c *Manager) GetLibraryItemDownloadSession(ctx context.Context, id string) (*Session, error)
- func (c *Manager) GetLibraryItemDownloadSessionFile(ctx context.Context, sessionID string, name string) (*DownloadFile, error)
- func (c *Manager) GetLibraryItemFile(ctx context.Context, id, fileName string) (*File, error)
- func (c *Manager) GetLibraryItemUpdateSession(ctx context.Context, id string) (*Session, error)
- func (c *Manager) GetLibraryItemUpdateSessionFile(ctx context.Context, sessionID string, fileName string) (*UpdateFile, error)
- func (c *Manager) GetLibraryItems(ctx context.Context, libraryID string) ([]Item, error)
- func (c *Manager) GetSubscriber(ctx context.Context, library *Library, subscriber string) (*Subscriber, error)
- func (c *Manager) GetTrustedCertificate(ctx context.Context, id string) (*TrustedCertificate, error)
- func (c *Manager) KeepAliveLibraryItemDownloadSession(ctx context.Context, id string) error
- func (c *Manager) KeepAliveLibraryItemUpdateSession(ctx context.Context, id string) error
- func (c *Manager) ListLibraries(ctx context.Context) ([]string, error)
- func (c *Manager) ListLibraryItemDownloadSession(ctx context.Context) ([]string, error)
- func (c *Manager) ListLibraryItemDownloadSessionFile(ctx context.Context, sessionID string) ([]DownloadFile, error)
- func (c *Manager) ListLibraryItemFiles(ctx context.Context, id string) ([]File, error)
- func (c *Manager) ListLibraryItemUpdateSession(ctx context.Context) ([]string, error)
- func (c *Manager) ListLibraryItems(ctx context.Context, id string) ([]string, error)
- func (c *Manager) ListSecurityPolicies(ctx context.Context) ([]ContentSecurityPoliciesInfo, error)
- func (c *Manager) ListSubscribers(ctx context.Context, library *Library) ([]SubscriberSummary, error)
- func (c *Manager) ListTrustedCertificates(ctx context.Context) ([]TrustedCertificateSummary, error)
- func (c *Manager) PrepareLibraryItemDownloadSessionFile(ctx context.Context, sessionID string, name string) (*DownloadFile, error)
- func (c *Manager) PublishLibrary(ctx context.Context, library *Library, subscriptions []string) error
- func (c *Manager) PublishLibraryItem(ctx context.Context, item *Item, force bool, subscriptions []string) error
- func (c *Manager) SyncLibrary(ctx context.Context, library *Library) error
- func (c *Manager) SyncLibraryItem(ctx context.Context, item *Item, force bool) error
- func (c *Manager) UpdateLibrary(ctx context.Context, l *Library) error
- func (c *Manager) UpdateLibraryItem(ctx context.Context, item *Item) error
- func (c *Manager) WaitOnLibraryItemUpdateSession(ctx context.Context, sessionID string, interval time.Duration, ...) error
- type Placement
- type Publication
- type Session
- type StorageBackings
- type Subscriber
- type SubscriberLibrary
- type SubscriberSummary
- type Subscription
- type TransferEndpoint
- type TrustedCertificate
- type TrustedCertificateSummary
- type UpdateFile
- type Vcenter
Examples ¶
Constants ¶
const ( ItemTypeISO = "iso" ItemTypeOVF = "ovf" ItemTypeVMTX = "vm-template" )
const (
OvfDefaultSecurityPolicy = "OVF default policy"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Checksum ¶
type Checksum struct { Algorithm string `json:"algorithm,omitempty"` Checksum string `json:"checksum"` }
Checksum provides checksum information on library item files.
type ContentSecurityPoliciesInfo ¶ added in v0.30.0
type ContentSecurityPoliciesInfo struct { // ItemTypeRules are rules governing the policy. ItemTypeRules map[string]string `json:"item_type_rules"` // Name is a human-readable identifier identifying the policy. Name string `json:"name"` // Policy is the unique identifier for a policy. Policy string `json:"policy"` }
ContentSecurityPoliciesInfo contains information on security policies that can be used to describe security for content library items.
type DownloadFile ¶
type DownloadFile struct { BytesTransferred int64 `json:"bytes_transferred"` Checksum *Checksum `json:"checksum_info,omitempty"` DownloadEndpoint *TransferEndpoint `json:"download_endpoint,omitempty"` ErrorMessage *rest.LocalizableMessage `json:"error_message,omitempty"` Name string `json:"name"` Size int64 `json:"size,omitempty"` Status string `json:"status"` }
DownloadFile is the specification for the downloadsession operations file:add, file:get, and file:list.
type File ¶
type File struct { Cached *bool `json:"cached,omitempty"` Checksum *Checksum `json:"checksum_info,omitempty"` Name string `json:"name,omitempty"` Size *int64 `json:"size,omitempty"` Version string `json:"version,omitempty"` }
File provides methods to get information on library item files.
type FindItem ¶
type FindItem struct { Cached *bool `json:"cached,omitempty"` LibraryID string `json:"library_id,omitempty"` Name string `json:"name,omitempty"` SourceID string `json:"source_id,omitempty"` Type string `json:"type,omitempty"` }
FindItem is the search criteria for finding library items.
type Item ¶
type Item struct { Cached bool `json:"cached,omitempty"` ContentVersion string `json:"content_version,omitempty"` CreationTime *time.Time `json:"creation_time,omitempty"` Description *string `json:"description,omitempty"` ID string `json:"id,omitempty"` LastModifiedTime *time.Time `json:"last_modified_time,omitempty"` LastSyncTime *time.Time `json:"last_sync_time,omitempty"` LibraryID string `json:"library_id,omitempty"` MetadataVersion string `json:"metadata_version,omitempty"` Name string `json:"name,omitempty"` Size int64 `json:"size,omitempty"` SourceID string `json:"source_id,omitempty"` Type string `json:"type,omitempty"` Version string `json:"version,omitempty"` SecurityCompliance *bool `json:"security_compliance,omitempty"` CertificateVerification *ItemCertificateVerification `json:"certificate_verification_info,omitempty"` }
Item provides methods to create, read, update, delete, and enumerate library items.
type ItemCertificateVerification ¶ added in v0.30.0
type ItemCertificateVerification struct { Status string `json:"status"` CertChain []string `json:"cert_chain,omitempty"` }
ItemCertificateVerification contains the certificate verification status and item's signing certificate
type Library ¶
type Library struct { CreationTime *time.Time `json:"creation_time,omitempty"` Description *string `json:"description,omitempty"` ID string `json:"id,omitempty"` LastModifiedTime *time.Time `json:"last_modified_time,omitempty"` LastSyncTime *time.Time `json:"last_sync_time,omitempty"` Name string `json:"name,omitempty"` Storage []StorageBackings `json:"storage_backings,omitempty"` Type string `json:"type,omitempty"` Version string `json:"version,omitempty"` Subscription *Subscription `json:"subscription_info,omitempty"` Publication *Publication `json:"publish_info,omitempty"` SecurityPolicyID string `json:"security_policy_id,omitempty"` UnsetSecurityPolicyID bool `json:"unset_security_policy_id,omitempty"` }
Library provides methods to create, read, update, delete, and enumerate libraries.
type Manager ¶
Manager extends rest.Client, adding content library related methods.
func NewManager ¶
NewManager creates a new Manager instance with the given client.
func (*Manager) AddLibraryItemFile ¶
func (c *Manager) AddLibraryItemFile(ctx context.Context, sessionID string, updateFile UpdateFile) (*UpdateFile, error)
AddLibraryItemFile adds a file
func (*Manager) AddLibraryItemFileFromURI ¶
func (c *Manager) AddLibraryItemFileFromURI( ctx context.Context, sessionID, fileName, uri string) (*UpdateFile, error)
AddLibraryItemFileFromURI adds a file from a remote URI.
func (*Manager) CancelLibraryItemDownloadSession ¶
CancelLibraryItemDownloadSession cancels an download session
func (*Manager) CancelLibraryItemUpdateSession ¶
CancelLibraryItemUpdateSession cancels an update session
func (*Manager) CompleteLibraryItemUpdateSession ¶
CompleteLibraryItemUpdateSession completes an update session
func (*Manager) CopyLibraryItem ¶ added in v0.23.0
CopyLibraryItem copies a library item
func (*Manager) CreateLibrary ¶
CreateLibrary creates a new library with the given Type, Name, Description, and CategoryID.
Example ¶
package main import ( "context" "fmt" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/simulator" "github.com/vmware/govmomi/vapi/library" "github.com/vmware/govmomi/vapi/rest" "github.com/vmware/govmomi/vim25" _ "github.com/vmware/govmomi/vapi/simulator" ) func main() { simulator.Run(func(ctx context.Context, vc *vim25.Client) error { c := rest.NewClient(vc) err := c.Login(ctx, simulator.DefaultLogin) if err != nil { return err } ds, err := find.NewFinder(vc).DefaultDatastore(ctx) if err != nil { return err } m := library.NewManager(c) id, err := m.CreateLibrary(ctx, library.Library{ Name: "example", Type: "LOCAL", Storage: []library.StorageBackings{{ DatastoreID: ds.Reference().Value, Type: "DATASTORE", }}, }) if err != nil { return err } l, err := m.GetLibraryByID(ctx, id) if err != nil { return err } fmt.Println("created library", l.Name) return nil }) }
Output: created library example
func (*Manager) CreateLibraryItem ¶
CreateLibraryItem creates a new library item
func (*Manager) CreateLibraryItemDownloadSession ¶
func (c *Manager) CreateLibraryItemDownloadSession(ctx context.Context, session Session) (string, error)
CreateLibraryItemDownloadSession creates a new library item
func (*Manager) CreateLibraryItemUpdateSession ¶
func (c *Manager) CreateLibraryItemUpdateSession(ctx context.Context, session Session) (string, error)
CreateLibraryItemUpdateSession creates a new library item
func (*Manager) CreateSubscriber ¶ added in v0.23.0
func (c *Manager) CreateSubscriber(ctx context.Context, library *Library, s SubscriberLibrary) (string, error)
CreateSubscriber creates a subscription of the published library.
func (*Manager) CreateTrustedCertificate ¶ added in v0.30.0
CreateTrustedCertificate adds a certificate to content library trust store
func (*Manager) DefaultOvfSecurityPolicy ¶ added in v0.30.0
func (*Manager) DeleteLibrary ¶
DeleteLibrary deletes an existing library.
func (*Manager) DeleteLibraryItem ¶
DeleteLibraryItem deletes an existing library item.
func (*Manager) DeleteLibraryItemDownloadSession ¶
DeleteLibraryItemDownloadSession deletes an download session
func (*Manager) DeleteLibraryItemUpdateSession ¶
DeleteLibraryItemUpdateSession deletes an update session
func (*Manager) DeleteSubscriber ¶ added in v0.23.0
DeleteSubscriber deletes the specified subscription of the published library. The subscribed library associated with the subscription will not be deleted.
func (*Manager) DeleteTrustedCertificate ¶ added in v0.30.0
DeleteTrustedCertificate deletes the trusted certificate from content library's trust store for the given id
func (*Manager) FailLibraryItemDownloadSession ¶
FailLibraryItemDownloadSession fails an download session
func (*Manager) FailLibraryItemUpdateSession ¶
FailLibraryItemUpdateSession fails an update session
func (*Manager) FindLibrary ¶
FindLibrary returns one or more libraries that match the provided search criteria.
The provided name is case-insensitive.
Either the name or type of library may be set to empty values in order to search for all libraries, all libraries with a specific name, regardless of type, or all libraries of a specified type.
func (*Manager) FindLibraryItems ¶
FindLibraryItems returns the IDs of all the library items that match the search criteria.
func (*Manager) GetLibraries ¶
GetLibraries returns a list of all content library details in the system.
func (*Manager) GetLibraryByID ¶
GetLibraryByID returns information on a library for the given ID.
func (*Manager) GetLibraryByName ¶
GetLibraryByName returns information on a library for the given name.
func (*Manager) GetLibraryItem ¶
GetLibraryItem returns information on a library item for the given ID.
func (*Manager) GetLibraryItemDownloadSession ¶
GetLibraryItemDownloadSession gets the download session information with status
func (*Manager) GetLibraryItemDownloadSessionFile ¶
func (c *Manager) GetLibraryItemDownloadSessionFile(ctx context.Context, sessionID string, name string) (*DownloadFile, error)
GetLibraryItemDownloadSessionFile retrieves information about a specific file that is a part of an download session.
func (*Manager) GetLibraryItemFile ¶
GetLibraryItemFile returns a file with the provided name for a library item.
func (*Manager) GetLibraryItemUpdateSession ¶
GetLibraryItemUpdateSession gets the update session information with status
func (*Manager) GetLibraryItemUpdateSessionFile ¶
func (c *Manager) GetLibraryItemUpdateSessionFile(ctx context.Context, sessionID string, fileName string) (*UpdateFile, error)
GetLibraryItemUpdateSessionFile retrieves information about a specific file that is a part of an update session.
func (*Manager) GetLibraryItems ¶
GetLibraryItems returns a list of all the library items for the specified library.
func (*Manager) GetSubscriber ¶ added in v0.23.0
func (c *Manager) GetSubscriber(ctx context.Context, library *Library, subscriber string) (*Subscriber, error)
GetSubscriber returns information about the specified subscriber of the published library.
func (*Manager) GetTrustedCertificate ¶ added in v0.30.0
func (c *Manager) GetTrustedCertificate(ctx context.Context, id string) (*TrustedCertificate, error)
GetTrustedCertificate retrieves a trusted certificate for a given certificate id
func (*Manager) KeepAliveLibraryItemDownloadSession ¶
KeepAliveLibraryItemDownloadSession keeps an inactive download session alive.
func (*Manager) KeepAliveLibraryItemUpdateSession ¶
KeepAliveLibraryItemUpdateSession keeps an inactive update session alive.
func (*Manager) ListLibraries ¶
ListLibraries returns a list of all content library IDs in the system.
func (*Manager) ListLibraryItemDownloadSession ¶
ListLibraryItemDownloadSession gets the list of download sessions
func (*Manager) ListLibraryItemDownloadSessionFile ¶
func (c *Manager) ListLibraryItemDownloadSessionFile(ctx context.Context, sessionID string) ([]DownloadFile, error)
ListLibraryItemDownloadSessionFile retrieves information about a specific file that is a part of an download session.
func (*Manager) ListLibraryItemFiles ¶
ListLibraryItemFiles returns a list of all the files for a library item.
func (*Manager) ListLibraryItemUpdateSession ¶
ListLibraryItemUpdateSession gets the list of update sessions
func (*Manager) ListLibraryItems ¶
ListLibraryItems returns a list of all items in a content library.
func (*Manager) ListSecurityPolicies ¶ added in v0.30.0
func (c *Manager) ListSecurityPolicies(ctx context.Context) ([]ContentSecurityPoliciesInfo, error)
ListSecurityPolicies lists security policies
func (*Manager) ListSubscribers ¶ added in v0.23.0
func (c *Manager) ListSubscribers(ctx context.Context, library *Library) ([]SubscriberSummary, error)
ListSubscribers lists the subscriptions of the published library.
func (*Manager) ListTrustedCertificates ¶ added in v0.30.0
func (c *Manager) ListTrustedCertificates(ctx context.Context) ([]TrustedCertificateSummary, error)
ListTrustedCertificates retrieves all content library's trusted certificates
func (*Manager) PrepareLibraryItemDownloadSessionFile ¶
func (c *Manager) PrepareLibraryItemDownloadSessionFile(ctx context.Context, sessionID string, name string) (*DownloadFile, error)
PrepareLibraryItemDownloadSessionFile retrieves information about a specific file that is a part of an download session.
func (*Manager) PublishLibrary ¶ added in v0.23.0
func (c *Manager) PublishLibrary(ctx context.Context, library *Library, subscriptions []string) error
PublishLibrary publishes the library to specified subscriptions. If no subscriptions are specified, then publishes the library to all subscriptions.
func (*Manager) PublishLibraryItem ¶ added in v0.23.0
func (c *Manager) PublishLibraryItem(ctx context.Context, item *Item, force bool, subscriptions []string) error
PublishLibraryItem publishes a library item to specified subscriptions. If no subscriptions are specified, then publishes the library item to all subscriptions.
func (*Manager) SyncLibrary ¶ added in v0.22.0
SyncLibrary syncs a subscribed library.
func (*Manager) SyncLibraryItem ¶ added in v0.22.0
SyncLibraryItem syncs a subscribed library item
func (*Manager) UpdateLibrary ¶ added in v0.25.0
UpdateLibrary can update one or both of the tag Description and Name fields.
func (*Manager) UpdateLibraryItem ¶ added in v0.26.1
UpdateLibraryItem can update one or both of the item Description and Name fields.
type Placement ¶ added in v0.23.0
type Placement struct { ResourcePool string `json:"resource_pool,omitempty"` Host string `json:"host,omitempty"` Folder string `json:"folder,omitempty"` Cluster string `json:"cluster,omitempty"` Network string `json:"network,omitempty"` }
Placement information used to place a virtual machine template
type Publication ¶ added in v0.23.0
type Publication struct { AuthenticationMethod string `json:"authentication_method"` UserName string `json:"user_name,omitempty"` Password string `json:"password,omitempty"` CurrentPassword string `json:"current_password,omitempty"` PersistJSON *bool `json:"persist_json_enabled,omitempty"` Published *bool `json:"published,omitempty"` PublishURL string `json:"publish_url,omitempty"` }
Publication info
type Session ¶
type Session struct { ClientProgress int64 `json:"client_progress,omitempty"` ErrorMessage *rest.LocalizableMessage `json:"error_message,omitempty"` ExpirationTime *time.Time `json:"expiration_time,omitempty"` ID string `json:"id,omitempty"` LibraryItemContentVersion string `json:"library_item_content_version,omitempty"` LibraryItemID string `json:"library_item_id,omitempty"` State string `json:"state,omitempty"` }
Session is used to create an initial update or download session
type StorageBackings ¶
type StorageBackings struct { DatastoreID string `json:"datastore_id,omitempty"` Type string `json:"type,omitempty"` }
StorageBackings for Content Libraries
type Subscriber ¶ added in v0.23.0
type Subscriber struct { LibraryID string `json:"subscribed_library"` LibraryName string `json:"subscribed_library_name"` LibraryLocation string `json:"subscribed_library_location"` Placement *Placement `json:"subscribed_library_placement,omitempty"` Vcenter *Vcenter `json:"subscribed_library_vcenter,omitempty"` }
Subscriber contains the detailed info for a library subscriber.
type SubscriberLibrary ¶ added in v0.23.0
type SubscriberLibrary struct { Target string `json:"target"` LibraryID string `json:"subscribed_library,omitempty"` Location string `json:"location"` Vcenter *Vcenter `json:"vcenter,omitempty"` Placement *Placement `json:"placement,omitempty"` }
SubscriberLibrary is the specification for a subscribed library to be associated with a subscription.
type SubscriberSummary ¶ added in v0.23.0
type SubscriberSummary struct { LibraryID string `json:"subscribed_library"` LibraryName string `json:"subscribed_library_name"` SubscriptionID string `json:"subscription"` LibraryVcenterHostname string `json:"subscribed_library_vcenter_hostname,omitempty"` }
SubscriberSummary as returned by ListSubscribers
type Subscription ¶ added in v0.22.0
type Subscription struct { AuthenticationMethod string `json:"authentication_method"` AutomaticSyncEnabled *bool `json:"automatic_sync_enabled,omitempty"` OnDemand *bool `json:"on_demand,omitempty"` Password string `json:"password,omitempty"` SslThumbprint string `json:"ssl_thumbprint,omitempty"` SubscriptionURL string `json:"subscription_url,omitempty"` UserName string `json:"user_name,omitempty"` }
Subscription info
type TransferEndpoint ¶
type TransferEndpoint struct { URI string `json:"uri,omitempty"` SSLCertificateThumbprint string `json:"ssl_certificate_thumbprint,omitempty"` }
TransferEndpoint provides information on the source of a library item file.
type TrustedCertificate ¶ added in v0.30.0
type TrustedCertificate struct {
Text string `json:"cert_text"`
}
TrustedCertificate contains a trusted certificate in Base64 encoded PEM format
type TrustedCertificateSummary ¶ added in v0.30.0
type TrustedCertificateSummary struct { TrustedCertificate ID string `json:"certificate"` }
TrustedCertificateSummary contains a trusted certificate in Base64 encoded PEM format and its id
type UpdateFile ¶
type UpdateFile struct { BytesTransferred int64 `json:"bytes_transferred,omitempty"` Checksum *Checksum `json:"checksum_info,omitempty"` ErrorMessage *rest.LocalizableMessage `json:"error_message,omitempty"` Name string `json:"name"` Size int64 `json:"size,omitempty"` SourceEndpoint *TransferEndpoint `json:"source_endpoint,omitempty"` SourceType string `json:"source_type"` Status string `json:"status,omitempty"` UploadEndpoint *TransferEndpoint `json:"upload_endpoint,omitempty"` }
UpdateFile is the specification for the updatesession operations file:add, file:get, and file:list.