library

package
v0.56.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 14 Imported by: 20 modules, 30 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Examples

Constants

View Source
const (
	ItemTypeISO  = "iso"
	ItemTypeOVF  = "ovf"
	ItemTypeVMTX = "vm-template"
)
View Source
const (
	OvfDefaultSecurityPolicy = "OVF default policy"
)

Variables

This section is empty.

Functions

func ReadManifest

func ReadManifest(m io.Reader) (map[string]*Checksum, error)

ReadManifest converts an ovf manifest to a map of file name -> Checksum.

Types

type AddUsage added in v0.53.0

type AddUsage struct {
	ResourceUrn string `json:"resource_urn,omitempty"`
}

AddUsage defines the information required to add a resource usage on a content library.

type Checksum

type Checksum struct {
	Algorithm string `json:"algorithm,omitempty"`
	Checksum  string `json:"checksum"`
}

Checksum provides checksum information on library item files.

type Configuration added in v0.53.0

type Configuration struct {
	ApplyLibraryUsageToItems *bool `json:"apply_library_usage_to_items,omitempty"`
}

Configuration represents the configuration at individual Content Library level and applies to all types of libraries.

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"`
	DownloadEndpoint string    `json:"file_download_endpoint,omitempty"`
}

File provides methods to get information on library item files.

type FileValidationError added in v0.34.0

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

type Find struct {
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
}

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

func (i *Item) Patch(src *Item)

Patch merges updates from the given src.

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               []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"`
	Configuration         *Configuration   `json:"configuration_info,omitempty"`
}

Library provides methods to create, read, update, delete, and enumerate libraries.

func (*Library) Patch

func (l *Library) Patch(src *Library)

Patch merges updates from the given src.

type Manager

type Manager struct {
	*rest.Client
}

Manager extends rest.Client, adding content library related methods.

func NewManager

func NewManager(client *rest.Client) *Manager

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) AddLibraryUsage added in v0.53.0

func (c *Manager) AddLibraryUsage(ctx context.Context, libraryID string, addUsage AddUsage) (string, error)

AddLibraryUsage adds a resource usage on a content library.

func (*Manager) CancelLibraryItemDownloadSession

func (c *Manager) CancelLibraryItemDownloadSession(ctx context.Context, id string) error

CancelLibraryItemDownloadSession cancels an download session

func (*Manager) CancelLibraryItemUpdateSession

func (c *Manager) CancelLibraryItemUpdateSession(ctx context.Context, id string) error

CancelLibraryItemUpdateSession cancels an update session

func (*Manager) CompleteLibraryItemUpdateSession

func (c *Manager) CompleteLibraryItemUpdateSession(ctx context.Context, id string) error

CompleteLibraryItemUpdateSession completes an update session

func (*Manager) CopyLibraryItem added in v0.23.0

func (c *Manager) CopyLibraryItem(ctx context.Context, src *Item, dst Item) (string, error)

CopyLibraryItem copies a library item

func (*Manager) CreateLibrary

func (c *Manager) CreateLibrary(ctx context.Context, library Library) (string, error)

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.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
	})
}
Output:
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
	})

}
Output:
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=1047552
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=1047552
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
	})

}
Output:
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=1047552
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=1047552

func (*Manager) CreateLibraryItem

func (c *Manager) CreateLibraryItem(ctx context.Context, item Item) (string, error)

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

func (c *Manager) CreateTrustedCertificate(ctx context.Context, cert string) error

CreateTrustedCertificate adds a certificate to content library trust store

func (*Manager) DefaultOvfSecurityPolicy added in v0.30.0

func (c *Manager) DefaultOvfSecurityPolicy(ctx context.Context) (string, error)

func (*Manager) DeleteLibrary

func (c *Manager) DeleteLibrary(ctx context.Context, library *Library) error

DeleteLibrary deletes an existing library.

func (*Manager) DeleteLibraryItem

func (c *Manager) DeleteLibraryItem(ctx context.Context, item *Item) error

DeleteLibraryItem deletes an existing library item.

func (*Manager) DeleteLibraryItemDownloadSession

func (c *Manager) DeleteLibraryItemDownloadSession(ctx context.Context, id string) error

DeleteLibraryItemDownloadSession deletes an download session

func (*Manager) DeleteLibraryItemUpdateSession

func (c *Manager) DeleteLibraryItemUpdateSession(ctx context.Context, id string) error

DeleteLibraryItemUpdateSession deletes an update session

func (*Manager) DeleteSubscriber added in v0.23.0

func (c *Manager) DeleteSubscriber(ctx context.Context, library *Library, subscriber string) error

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

func (c *Manager) DeleteTrustedCertificate(ctx context.Context, id string) error

DeleteTrustedCertificate deletes the trusted certificate from content library's trust store for the given id

func (*Manager) EvictSubscribedLibrary added in v0.37.0

func (c *Manager) EvictSubscribedLibrary(ctx context.Context, library *Library) error

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 added in v0.37.0

func (c *Manager) EvictSubscribedLibraryItem(ctx context.Context, item *Item) error

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

func (c *Manager) FailLibraryItemDownloadSession(ctx context.Context, id string) error

FailLibraryItemDownloadSession fails an download session

func (*Manager) FailLibraryItemUpdateSession

func (c *Manager) FailLibraryItemUpdateSession(ctx context.Context, id string) error

FailLibraryItemUpdateSession fails an update session

func (*Manager) FindLibrary

func (c *Manager) FindLibrary(ctx context.Context, search Find) ([]string, error)

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

func (c *Manager) FindLibraryItems(
	ctx context.Context, search FindItem) ([]string, error)

FindLibraryItems returns the IDs of all the library items that match the search criteria.

func (*Manager) ForceDeleteLibrary added in v0.53.0

func (c *Manager) ForceDeleteLibrary(ctx context.Context, library *Library) error

ForceDeleteLibrary Force deletes the specified library by skipping the usage check.

func (*Manager) GetLibraries

func (c *Manager) GetLibraries(ctx context.Context) ([]Library, error)

GetLibraries returns a list of all content library details in the system.

func (*Manager) GetLibraryByID

func (c *Manager) GetLibraryByID(ctx context.Context, id string) (*Library, error)

GetLibraryByID returns information on a library for the given ID.

func (*Manager) GetLibraryByName

func (c *Manager) GetLibraryByName(ctx context.Context, name string) (*Library, error)

GetLibraryByName returns information on a library for the given name.

func (*Manager) GetLibraryItem

func (c *Manager) GetLibraryItem(ctx context.Context, id string) (*Item, error)

GetLibraryItem returns information on a library item for the given ID.

func (*Manager) GetLibraryItemDownloadSession

func (c *Manager) GetLibraryItemDownloadSession(ctx context.Context, id string) (*Session, error)

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

func (c *Manager) GetLibraryItemFile(ctx context.Context, id, fileName string) (*File, error)

GetLibraryItemFile returns a file with the provided name for a library item.

func (*Manager) GetLibraryItemStorage added in v0.38.0

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

func (c *Manager) GetLibraryItemUpdateSession(ctx context.Context, id string) (*Session, error)

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

func (c *Manager) GetLibraryItems(ctx context.Context, libraryID string) ([]Item, error)

GetLibraryItems returns a list of all the library items for the specified library.

func (*Manager) GetLibraryUsage added in v0.53.0

func (c *Manager) GetLibraryUsage(ctx context.Context, libraryID, usageID string) (Usage, error)

GetLibraryUsage retrieves the library usage information for a given usage identifier.

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

func (c *Manager) KeepAliveLibraryItemDownloadSession(ctx context.Context, id string) error

KeepAliveLibraryItemDownloadSession keeps an inactive download session alive.

func (*Manager) KeepAliveLibraryItemUpdateSession

func (c *Manager) KeepAliveLibraryItemUpdateSession(ctx context.Context, id string) error

KeepAliveLibraryItemUpdateSession keeps an inactive update session alive.

func (*Manager) ListLibraries

func (c *Manager) ListLibraries(ctx context.Context) ([]string, error)

ListLibraries returns a list of all content library IDs in the system.

func (*Manager) ListLibraryItemDownloadSession

func (c *Manager) ListLibraryItemDownloadSession(ctx context.Context) ([]string, error)

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

func (c *Manager) ListLibraryItemFiles(ctx context.Context, id string) ([]File, error)

ListLibraryItemFiles returns a list of all the files for a library item.

func (*Manager) ListLibraryItemStorage added in v0.38.0

func (c *Manager) ListLibraryItemStorage(ctx context.Context, id string) ([]Storage, error)

ListLibraryItemStorage returns a list of all the storage for a library item.

func (*Manager) ListLibraryItemUpdateSession

func (c *Manager) ListLibraryItemUpdateSession(ctx context.Context) ([]string, error)

ListLibraryItemUpdateSession gets the list of update sessions

func (*Manager) ListLibraryItemUpdateSessionFile added in v0.34.0

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

func (c *Manager) ListLibraryItems(ctx context.Context, id string) ([]string, error)

ListLibraryItems returns a list of all items in a content library.

func (*Manager) ListLibraryUsage added in v0.53.0

func (c *Manager) ListLibraryUsage(ctx context.Context, libraryID string) (UsageList, error)

ListLibraryUsage retrieves the list of resources currently using a content library. A content library can be safely deleted if no usage is present for that 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) ProbeTransferEndpoint added in v0.34.0

func (c *Manager) ProbeTransferEndpoint(ctx context.Context, endpoint TransferEndpoint) (*ProbeResult, error)

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) RemoveLibraryItemUpdateSessionFile added in v0.34.0

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) RemoveLibraryUsage added in v0.53.0

func (c *Manager) RemoveLibraryUsage(ctx context.Context, libraryID string, usageID string) error

RemoveLibraryUsage removes a resource usage on a content library.

func (*Manager) SyncLibrary added in v0.22.0

func (c *Manager) SyncLibrary(ctx context.Context, library *Library) error

SyncLibrary syncs a subscribed library.

func (*Manager) SyncLibraryItem added in v0.22.0

func (c *Manager) SyncLibraryItem(ctx context.Context, item *Item, force bool) error

SyncLibraryItem syncs a subscribed library item

func (*Manager) UpdateLibrary added in v0.25.0

func (c *Manager) UpdateLibrary(ctx context.Context, l *Library) error

UpdateLibrary can update one or both of the tag Description and Name fields.

func (*Manager) UpdateLibraryItem added in v0.26.1

func (c *Manager) UpdateLibraryItem(ctx context.Context, item *Item) error

UpdateLibraryItem can update one or both of the item Description and Name fields.

func (*Manager) ValidateLibraryItemUpdateSessionFile added in v0.34.0

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 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 ProbeResult added in v0.34.0

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 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 StateInfo added in v0.43.0

type StateInfo struct {
	State string `json:"state"`
}

StateInfo provides the state info of a content library.

type Storage added in v0.38.0

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 added in v0.38.0

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 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"`
	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 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.

type UpdateFileValidation added in v0.34.0

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 Usage added in v0.53.0

type Usage struct {
	ID           string     `json:"usage,omitempty"`
	ResourceUrn  string     `json:"resource_urn,omitempty"`
	AdditionTime *time.Time `json:"addition_time,omitempty"`
}

Usage provides methods to get usage information on content library.

type UsageList added in v0.53.0

type UsageList struct {
	LibraryUsageList []UsageSummary `json:"library_usage_list,omitempty"`
}

UsageList lists the usage by resource(s) on a content library.

type UsageSummary added in v0.53.0

type UsageSummary struct {
	ID          string `json:"usage,omitempty"`
	ResourceUrn string `json:"resource_urn,omitempty"`
}

UsageSummary contains commonly used information about the usage of a content library.

type Vcenter added in v0.23.0

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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