library

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 12 Imported by: 25

Documentation

Index

Constants

View Source
const (
	ItemTypeISO  = "iso"
	ItemTypeOVF  = "ovf"
	ItemTypeVMTX = "vm-template"
)

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 Checksum

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

Checksum provides checksum information on library item files.

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

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

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, fileName, uri string) (*UpdateFile, error)

AddLibraryItemFileFromURI adds a file from a remote URI.

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) 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.

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) 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) 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) 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) 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) 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) ListLibraryItemUpdateSession

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

ListLibraryItemUpdateSession gets the list of update sessions

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) 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) 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) 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 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 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 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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