Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SyncTools ¶
func SyncTools(syncContext *SyncContext) error
SyncTools copies the Juju tools tarball from the official bucket or a specified source directory into the user's environment.
Types ¶
type BuildToolsTarballFunc ¶
type BuildToolsTarballFunc func(forceVersion *version.Number, stream string) (*BuiltTools, error)
BuildToolsTarballFunc is a function which can build a tools tarball.
var BuildToolsTarball BuildToolsTarballFunc = buildToolsTarball
Override for testing.
type BuiltTools ¶
type BuiltTools struct { Version version.Binary Dir string StorageName string Sha256Hash string Size int64 }
BuiltTools contains metadata for a tools tarball resulting from a call to BundleTools.
type StorageToolsFinder ¶
type StorageToolsFinder struct {
Storage storage.StorageReader
}
StorageToolsFinder is an implementation of ToolsFinder that searches for tools in the specified storage.
type StorageToolsUploader ¶
type StorageToolsUploader struct { Storage storage.Storage WriteMetadata bool WriteMirrors envtools.ShouldWriteMirrors }
StorageToolsUplader is an implementation of ToolsUploader that writes tools to the provided storage and then writes merged metadata, optionally with mirrors.
func (StorageToolsUploader) UploadTools ¶
type SyncContext ¶
type SyncContext struct { // TargetToolsFinder is a ToolsFinder provided to find existing // tools in the target destination. TargetToolsFinder ToolsFinder // TargetToolsUploader is a ToolsUploader provided to upload // tools to the target destination. TargetToolsUploader ToolsUploader // AllVersions controls the copy of all versions, not only the latest. AllVersions bool // Copy tools with major version, if MajorVersion > 0. MajorVersion int // Copy tools with minor version, if MinorVersion > 0. MinorVersion int // DryRun controls that nothing is copied. Instead it's logged // what would be coppied. DryRun bool // Stream specifies the simplestreams stream to use (defaults to "Released"). Stream string // Source, if non-empty, specifies a directory in the local file system // to use as a source. Source string }
SyncContext describes the context for tool synchronization.
type ToolsFinder ¶
type ToolsFinder interface { // FindTools returns a list of tools with the specified major version in the specified stream. FindTools(major int, stream string) (coretools.List, error) }
ToolsFinder provides an interface for finding tools of a specified version.
type ToolsUploader ¶
type ToolsUploader interface { // UploadTools uploads the tools with the specified version and tarball contents. UploadTools(toolsDir, stream string, tools *coretools.Tools, data []byte) error }
ToolsUploader provides an interface for uploading tools and associated metadata.
type UploadFunc ¶
type UploadFunc func(stor storage.Storage, stream string, forceVersion *version.Number, series ...string) (*coretools.Tools, error)
UploadFunc is the type of Upload, which may be reassigned to control the behaviour of tools uploading.
var Upload UploadFunc = upload
Exported for testing.