package library
import "github.com/vmware/govmomi/vapi/library"
Index ¶
- Constants
- func ReadManifest(m io.Reader) (map[string]*Checksum, error)
- type Checksum
- type ContentSecurityPoliciesInfo
- type DownloadFile
- type File
- type FileValidationError
- type Find
- type FindItem
- type Item
- type ItemCertificateVerification
- type Library
- type Manager
- func NewManager(client *rest.Client) *Manager
- func (c *Manager) AddLibraryItemFile(ctx context.Context, sessionID string, updateFile UpdateFile) (*UpdateFile, error)
- func (c *Manager) AddLibraryItemFileFromURI(ctx context.Context, sessionID, name, uri string, checksum ...Checksum) (*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) EvictSubscribedLibrary(ctx context.Context, library *Library) error
- func (c *Manager) EvictSubscribedLibraryItem(ctx context.Context, item *Item) 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) GetLibraryItemStorage(ctx context.Context, id, fileName string) ([]Storage, 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) ListLibraryItemStorage(ctx context.Context, id string) ([]Storage, error)
- func (c *Manager) ListLibraryItemUpdateSession(ctx context.Context) ([]string, error)
- func (c *Manager) ListLibraryItemUpdateSessionFile(ctx context.Context, sessionID string) ([]UpdateFile, 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) ProbeTransferEndpoint(ctx context.Context, endpoint TransferEndpoint) (*ProbeResult, 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) RemoveLibraryItemUpdateSessionFile(ctx context.Context, sessionID string, fileName 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) ValidateLibraryItemUpdateSessionFile(ctx context.Context, sessionID string) (*UpdateFileValidation, error)
- func (c *Manager) WaitOnLibraryItemUpdateSession( ctx context.Context, sessionID string, interval time.Duration, intervalCallback func()) error
- type Placement
- type ProbeResult
- type Publication
- type Session
- type StateInfo
- type Storage
- type StorageBacking
- type Subscriber
- type SubscriberLibrary
- type SubscriberSummary
- type Subscription
- type TransferEndpoint
- type TrustedCertificate
- type TrustedCertificateSummary
- type UpdateFile
- type UpdateFileValidation
- type Vcenter
Examples ¶
- Manager.CreateLibrary
- Manager.CreateLibrary (Subscribed)
- Manager.CreateLibrary (Subscribed_ondemand)
Constants ¶
const ( ItemTypeISO = "iso" ItemTypeOVF = "ovf" ItemTypeVMTX = "vm-template" )
const (
OvfDefaultSecurityPolicy = "OVF default policy"
)
Functions ¶
func ReadManifest ¶
ReadManifest converts an ovf manifest to a map of file name -> Checksum.
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 ¶
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"` DownloadEndpoint string `json:"file_download_endpoint,omitempty"` }
File provides methods to get information on library item files.
type FileValidationError ¶
type FileValidationError struct { Name string `json:"name"` ErrorMessage rest.LocalizableMessage `json:"error_message"` }
FileValidationError contains the validation error of a file in the update session
type Find ¶
Find is the search criteria for finding libraries.
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.
func (*Item) Patch ¶
Patch merges updates from the given src.
type ItemCertificateVerification ¶
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 []StorageBacking `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"` ServerGUID string `json:"server_guid,omitempty"` StateInfo *StateInfo `json:"state_info,omitempty"` }
Library provides methods to create, read, update, delete, and enumerate libraries.
func (*Library) Patch ¶
Patch merges updates from the given src.
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, name, uri string, checksum ...Checksum) (*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 ¶
CopyLibraryItem copies a library item
func (*Manager) CreateLibrary ¶
CreateLibrary creates a new library with the given Type, Name,
Description, and CategoryID.
Code:play
Output: Code:play
Output: Code:play
Output: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.StorageBacking{{
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
})
}
created library example
Example (Subscribed)¶
package main
import (
"context"
"fmt"
"net/url"
"os"
"path/filepath"
"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/vim25/soap"
"github.com/vmware/govmomi/vim25/types"
_ "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)
pubLibID, err := m.CreateLibrary(ctx, library.Library{
Name: "my-pub-lib",
Type: "LOCAL",
Storage: []library.StorageBacking{
{
DatastoreID: ds.Reference().Value,
Type: "DATASTORE",
},
},
Publication: &library.Publication{
Published: types.New(true),
},
})
if err != nil {
return err
}
pubLib, err := m.GetLibraryByID(ctx, pubLibID)
if err != nil {
return err
}
fmt.Println("created library", pubLib.Name)
// Upload an OVA.
pubItemID, err := m.CreateLibraryItem(ctx, library.Item{
Name: "my-image",
Type: "OVF",
LibraryID: pubLib.ID,
})
if err != nil {
return err
}
pubItem, err := m.GetLibraryItem(ctx, pubItemID)
if err != nil {
return err
}
fmt.Println(" created library item", pubItem.Name)
uploadSessionID, err := m.CreateLibraryItemUpdateSession(
ctx,
library.Session{
LibraryItemID: pubItemID,
})
uploadFn := func(path string) error {
f, err := os.Open(filepath.Clean(path))
if err != nil {
return err
}
defer f.Close()
fi, err := f.Stat()
if err != nil {
return err
}
info := library.UpdateFile{
Name: filepath.Base(path),
SourceType: "PUSH",
Size: fi.Size(),
}
update, err := m.AddLibraryItemFile(ctx, uploadSessionID, info)
if err != nil {
return err
}
u, err := url.Parse(update.UploadEndpoint.URI)
if err != nil {
return err
}
p := soap.DefaultUpload
p.ContentLength = info.Size
return m.Client.Upload(ctx, f, u, &p)
}
if err := uploadFn("./testdata/ttylinux-pc_i486-16.1.ova"); err != nil {
return err
}
if err := m.CompleteLibraryItemUpdateSession(
ctx, uploadSessionID); err != nil {
return err
}
pubItemStor, err := m.ListLibraryItemStorage(ctx, pubItemID)
if err != nil {
return err
}
for i := range pubItemStor {
is := pubItemStor[i]
fmt.Printf(
" uploaded library item file %s, cached=%v, size=%d\n",
is.Name, is.Cached, is.Size)
}
// Create a subscribed library that points to the one above.
subLibID, err := m.CreateLibrary(ctx, library.Library{
Name: "my-sub-lib",
Type: "SUBSCRIBED",
Storage: []library.StorageBacking{
{
DatastoreID: ds.Reference().Value,
Type: "DATASTORE",
},
},
Subscription: &library.Subscription{
SubscriptionURL: pubLib.Publication.PublishURL,
OnDemand: types.New(false),
},
})
if err != nil {
return err
}
subLib, err := m.GetLibraryByID(ctx, subLibID)
if err != nil {
return err
}
fmt.Println("created library", subLib.Name)
subItemIDs, err := m.ListLibraryItems(ctx, subLibID)
if err != nil {
return err
}
for i := range subItemIDs {
subItemID := subItemIDs[i]
subItem, err := m.GetLibraryItem(ctx, subItemID)
if err != nil {
return err
}
fmt.Println(" got subscribed library item", subItem.Name)
subItemStor, err := m.ListLibraryItemStorage(ctx, subItemID)
if err != nil {
return err
}
for i := range subItemStor {
is := subItemStor[i]
fmt.Printf(
" library item file %s, cached=%v, size=%d\n",
is.Name, is.Cached, is.Size)
}
}
return nil
})
}
created library my-pub-lib
created library item my-image
uploaded library item file ttylinux-pc_i486-16.1.ovf, cached=true, size=5005
uploaded library item file ttylinux-pc_i486-16.1.mf, cached=true, size=159
uploaded library item file ttylinux-pc_i486-16.1-disk1.vmdk, cached=true, size=1048576
created library my-sub-lib
got subscribed library item my-image
library item file ttylinux-pc_i486-16.1.ovf, cached=true, size=5005
library item file ttylinux-pc_i486-16.1.mf, cached=true, size=159
library item file ttylinux-pc_i486-16.1-disk1.vmdk, cached=true, size=1048576
Example (Subscribed_ondemand)¶
package main
import (
"context"
"fmt"
"net/url"
"os"
"path/filepath"
"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/vim25/soap"
"github.com/vmware/govmomi/vim25/types"
_ "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)
pubLibID, err := m.CreateLibrary(ctx, library.Library{
Name: "my-pub-lib",
Type: "LOCAL",
Storage: []library.StorageBacking{
{
DatastoreID: ds.Reference().Value,
Type: "DATASTORE",
},
},
Publication: &library.Publication{
Published: types.New(true),
},
})
if err != nil {
return err
}
pubLib, err := m.GetLibraryByID(ctx, pubLibID)
if err != nil {
return err
}
fmt.Println("created library", pubLib.Name)
// Upload an OVA.
pubItemID, err := m.CreateLibraryItem(ctx, library.Item{
Name: "my-image",
Type: "OVF",
LibraryID: pubLib.ID,
})
if err != nil {
return err
}
pubItem, err := m.GetLibraryItem(ctx, pubItemID)
if err != nil {
return err
}
fmt.Println(" created library item", pubItem.Name)
uploadSessionID, err := m.CreateLibraryItemUpdateSession(
ctx,
library.Session{
LibraryItemID: pubItemID,
})
uploadFn := func(path string) error {
f, err := os.Open(filepath.Clean(path))
if err != nil {
return err
}
defer f.Close()
fi, err := f.Stat()
if err != nil {
return err
}
info := library.UpdateFile{
Name: filepath.Base(path),
SourceType: "PUSH",
Size: fi.Size(),
}
update, err := m.AddLibraryItemFile(ctx, uploadSessionID, info)
if err != nil {
return err
}
u, err := url.Parse(update.UploadEndpoint.URI)
if err != nil {
return err
}
p := soap.DefaultUpload
p.ContentLength = info.Size
return m.Client.Upload(ctx, f, u, &p)
}
if err := uploadFn("./testdata/ttylinux-pc_i486-16.1.ova"); err != nil {
return err
}
if err := m.CompleteLibraryItemUpdateSession(
ctx, uploadSessionID); err != nil {
return err
}
pubItemStor, err := m.ListLibraryItemStorage(ctx, pubItemID)
if err != nil {
return err
}
for i := range pubItemStor {
is := pubItemStor[i]
fmt.Printf(
" uploaded library item file %s, cached=%v, size=%d\n",
is.Name, is.Cached, is.Size)
}
// Create a subscribed library that points to the one above.
subLibID, err := m.CreateLibrary(ctx, library.Library{
Name: "my-sub-lib",
Type: "SUBSCRIBED",
Storage: []library.StorageBacking{
{
DatastoreID: ds.Reference().Value,
Type: "DATASTORE",
},
},
Subscription: &library.Subscription{
SubscriptionURL: pubLib.Publication.PublishURL,
OnDemand: types.New(true),
},
})
if err != nil {
return err
}
subLib, err := m.GetLibraryByID(ctx, subLibID)
if err != nil {
return err
}
fmt.Println("created library", subLib.Name)
subItemIDs, err := m.ListLibraryItems(ctx, subLibID)
if err != nil {
return err
}
for i := range subItemIDs {
subItemID := subItemIDs[i]
subItem, err := m.GetLibraryItem(ctx, subItemID)
if err != nil {
return err
}
fmt.Println(" got subscribed library item", subItem.Name)
// List the item's storage prior to being synced.
subItemStor, err := m.ListLibraryItemStorage(ctx, subItemID)
if err != nil {
return err
}
for i := range subItemStor {
is := subItemStor[i]
fmt.Printf(
" library item file %s, cached=%v, size=%d\n",
is.Name, is.Cached, is.Size)
}
// Synchronize the item.
if err := m.SyncLibraryItem(ctx, subItem, true); err != nil {
return err
}
fmt.Println(" sync'd (force=true) subscribed library item", subItem.Name)
// List the item's storage after being synced.
subItemStor, err = m.ListLibraryItemStorage(ctx, subItemID)
if err != nil {
return err
}
for i := range subItemStor {
is := subItemStor[i]
fmt.Printf(
" library item file %s, cached=%v, size=%d\n",
is.Name, is.Cached, is.Size)
}
}
return nil
})
}
created library my-pub-lib
created library item my-image
uploaded library item file ttylinux-pc_i486-16.1.ovf, cached=true, size=5005
uploaded library item file ttylinux-pc_i486-16.1.mf, cached=true, size=159
uploaded library item file ttylinux-pc_i486-16.1-disk1.vmdk, cached=true, size=1048576
created library my-sub-lib
got subscribed library item my-image
library item file ttylinux-pc_i486-16.1.ovf, cached=true, size=5005
library item file ttylinux-pc_i486-16.1.mf, cached=true, size=159
library item file ttylinux-pc_i486-16.1-disk1.vmdk, cached=false, size=0
sync'd (force=true) subscribed library item my-image
library item file ttylinux-pc_i486-16.1.ovf, cached=true, size=5005
library item file ttylinux-pc_i486-16.1.mf, cached=true, size=159
library item file ttylinux-pc_i486-16.1-disk1.vmdk, cached=true, size=1048576
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 ¶
func (c *Manager) CreateSubscriber(ctx context.Context, library *Library, s SubscriberLibrary) (string, error)
CreateSubscriber creates a subscription of the published library.
func (*Manager) CreateTrustedCertificate ¶
CreateTrustedCertificate adds a certificate to content library trust store
func (*Manager) DefaultOvfSecurityPolicy ¶
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 ¶
DeleteSubscriber deletes the specified subscription of the published library. The subscribed library associated with the subscription will not be deleted.
func (*Manager) DeleteTrustedCertificate ¶
DeleteTrustedCertificate deletes the trusted certificate from content library's trust store for the given id
func (*Manager) EvictSubscribedLibrary ¶
EvictSubscribedLibrary evicts the cached content of an on-demand subscribed library. This operation allows the cached content of a subscribed library to be removed to free up storage capacity.
func (*Manager) EvictSubscribedLibraryItem ¶
EvictSubscribedLibraryItem evicts the cached content of a library item in an on-demand subscribed library. This operation allows the cached content of a subscribed library item to be removed to free up storage capacity.
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) GetLibraryItemStorage ¶
func (c *Manager) GetLibraryItemStorage(ctx context.Context, id, fileName string) ([]Storage, error)
GetLibraryItemStorage returns the storage for a specific file in 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 ¶
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 ¶
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) ListLibraryItemStorage ¶
ListLibraryItemStorage returns a list of all the storage for a library item.
func (*Manager) ListLibraryItemUpdateSession ¶
ListLibraryItemUpdateSession gets the list of update sessions
func (*Manager) ListLibraryItemUpdateSessionFile ¶
func (c *Manager) ListLibraryItemUpdateSessionFile(ctx context.Context, sessionID string) ([]UpdateFile, error)
ListLibraryItemUpdateSessionFile lists all files in the library item associated with the update session
func (*Manager) ListLibraryItems ¶
ListLibraryItems returns a list of all items in a content library.
func (*Manager) ListSecurityPolicies ¶
func (c *Manager) ListSecurityPolicies(ctx context.Context) ([]ContentSecurityPoliciesInfo, error)
ListSecurityPolicies lists security policies
func (*Manager) ListSubscribers ¶
func (c *Manager) ListSubscribers(ctx context.Context, library *Library) ([]SubscriberSummary, error)
ListSubscribers lists the subscriptions of the published library.
func (*Manager) ListTrustedCertificates ¶
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) ProbeTransferEndpoint ¶
func (c *Manager) ProbeTransferEndpoint(ctx context.Context, endpoint TransferEndpoint) (*ProbeResult, error)
func (*Manager) PublishLibrary ¶
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 ¶
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) RemoveLibraryItemUpdateSessionFile ¶
func (c *Manager) RemoveLibraryItemUpdateSessionFile(ctx context.Context, sessionID string, fileName string) error
RemoveLibraryItemUpdateSessionFile requests a file to be removed. The file will only be effectively removed when the update session is completed.
func (*Manager) SyncLibrary ¶
SyncLibrary syncs a subscribed library.
func (*Manager) SyncLibraryItem ¶
SyncLibraryItem syncs a subscribed library item
func (*Manager) UpdateLibrary ¶
UpdateLibrary can update one or both of the tag Description and Name fields.
func (*Manager) UpdateLibraryItem ¶
UpdateLibraryItem can update one or both of the item Description and Name fields.
func (*Manager) ValidateLibraryItemUpdateSessionFile ¶
func (c *Manager) ValidateLibraryItemUpdateSessionFile(ctx context.Context, sessionID string) (*UpdateFileValidation, error)
ValidateLibraryItemUpdateSessionFile validates all files in the library item associated with the update session
func (*Manager) WaitOnLibraryItemUpdateSession ¶
func (c *Manager) WaitOnLibraryItemUpdateSession( ctx context.Context, sessionID string, interval time.Duration, intervalCallback func()) error
WaitOnLibraryItemUpdateSession blocks until the update session is no longer in the ACTIVE state.
type Placement ¶
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 ProbeResult ¶
type ProbeResult struct { Status string `json:"status"` SSLThumbprint string `json:"ssl_thumbprint,omitempty"` SSLCertificate string `json:"ssl_certificate,omitempty"` ErrorMessages []rest.LocalizableMessage `json:"error_messages,omitempty"` }
type Publication ¶
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 StateInfo ¶
type StateInfo struct { State string `json:"state"` }
StateInfo provides the state info of a content library.
type Storage ¶
type Storage struct { Checksum Checksum `json:"checksum_info,omitempty"` StorageBacking StorageBacking `json:"storage_backing"` StorageURIs []string `json:"storage_uris"` Name string `json:"name"` Size int64 `json:"size"` Cached bool `json:"cached"` Version string `json:"version"` }
Storage is an expanded form of library.File that includes details about the storage backing for a file in a library item
type StorageBacking ¶
type StorageBacking struct { DatastoreID string `json:"datastore_id,omitempty"` Type string `json:"type,omitempty"` StorageURI string `json:"storage_uri,omitempty"` }
StorageBacking defines a storage location where content in a library will be stored.
type Subscriber ¶
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 ¶
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 ¶
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 ¶
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"` SSLCertificate string `json:"ssl_certificate,omitempty"` SSLCertificateThumbprint string `json:"ssl_certificate_thumbprint,omitempty"` }
TransferEndpoint provides information on the source of a library item file.
type TrustedCertificate ¶
type TrustedCertificate struct { Text string `json:"cert_text"` }
TrustedCertificate contains a trusted certificate in Base64 encoded PEM format
type TrustedCertificateSummary ¶
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.
type UpdateFileValidation ¶
type UpdateFileValidation struct { HasErrors bool `json:"has_errors"` MissingFiles []string `json:"missing_files,omitempty"` InvalidFiles []FileValidationError `json:"invalid_files,omitempty"` }
UpdateFileValidation contains the result of validating the files in the update session
type Vcenter ¶
type Vcenter struct { Hostname string `json:"hostname"` Port int `json:"https_port,omitempty"` ServerGUID string `json:"server_guid"` }
Vcenter contains information about the vCenter Server instance where a subscribed library associated with a subscription exists.
Source Files ¶
library.go library_file.go library_item.go library_item_downloadsession_file.go library_item_storage.go library_item_updatesession.go library_item_updatesession_file.go security_policy.go trusted_certificates.go
Directories ¶
Path | Synopsis |
---|---|
vapi/library/finder |
- Version
- v0.48.1 (latest)
- Published
- Feb 11, 2025
- Platform
- linux/amd64
- Imports
- 14 packages
- Last checked
- 2 months ago –
Tools for package owners.