Documentation ¶
Index ¶
- Constants
- Variables
- type Archive
- func (a *Archive) Archive(format Format, w io.Writer) error
- func (a *Archive) Bytes(format Format) ([]byte, error)
- func (a *Archive) EnsureHash() error
- func (a *Archive) Equals(other *Archive) bool
- func (a *Archive) GetAssets() (map[string]interface{}, bool)
- func (a *Archive) GetPath() (string, bool)
- func (a *Archive) GetURI() (string, bool)
- func (a *Archive) GetURIURL() (*url.URL, bool, error)
- func (a *Archive) HasContents() bool
- func (a *Archive) IsAssets() bool
- func (a *Archive) IsPath() bool
- func (a *Archive) IsURI() bool
- func (a *Archive) Open() (Reader, error)
- func (a *Archive) ReadSourceArchive() (Format, io.ReadCloser, error)
- func (a *Archive) Serialize() map[string]interface{}
- type Format
- type Reader
Constants ¶
const ( ArchiveSig = sig.ArchiveSig ArchiveHashProperty = "hash" // the dynamic property for an archive's hash. ArchiveAssetsProperty = "assets" // the dynamic property for an archive's assets. ArchivePathProperty = "path" // the dynamic property for an archive's path. ArchiveURIProperty = "uri" // the dynamic property for an archive's URI. )
const ( NotArchive = iota // not an archive. TarArchive // a POSIX tar archive. TarGZIPArchive // a POSIX tar archive that has been subsequently compressed using GZip. ZIPArchive // a multi-file ZIP archive. JARArchive // a Java JAR file )
const ( // BookkeepingDir is the name of our bookkeeping folder, we store state here (like .git for git). // Copied from workspace.BookkeepingDir to break import cycle. BookkeepingDir = ".pulumi" )
Variables ¶
var ArchiveExts = map[string]Format{ ".tar": TarArchive, ".tgz": TarGZIPArchive, ".tar.gz": TarGZIPArchive, ".zip": ZIPArchive, ".jar": JARArchive, }
ArchiveExts maps from a file extension and its associated archive and/or compression format.
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive struct { // Sig is the unique archive type signature (see properties.go). Sig string `json:"4dabf18193072939515e22adb298388d" yaml:"4dabf18193072939515e22adb298388d"` // Hash contains the SHA256 hash of the archive's contents. Hash string `json:"hash,omitempty" yaml:"hash,omitempty"` // Assets, when non-nil, is a collection of other assets/archives. Assets map[string]interface{} `json:"assets,omitempty" yaml:"assets,omitempty"` // Path is a non-empty string representing a path to a file on the current filesystem, for file archives. Path string `json:"path,omitempty" yaml:"path,omitempty"` // URI is a non-empty URI (file://, http://, https://, etc), for URI-backed archives. URI string `json:"uri,omitempty" yaml:"uri,omitempty"` }
Archive is a serialized archive reference. It is a union: thus, only one of its fields will be non-nil. Several helper routines exist as members in order to easily interact with archives of different kinds.
func Deserialize ¶
DeserializeArchive checks to see if the map contains an archive, using its signature, and if so deserializes it.
func FromAssets ¶
func (*Archive) Archive ¶
Archive produces a single archive stream in the desired format. It prefers to return the archive with as little copying as is feasible, however if the desired format is different from the source, it will need to translate.
func (*Archive) Bytes ¶
Bytes fetches the archive contents as a byte slices. This is almost certainly the least efficient way to deal with the underlying streaming capabilities offered by assets and archives, but can be used in a pinch to interact with APIs that demand []bytes.
func (*Archive) EnsureHash ¶
EnsureHash computes the SHA256 hash of the archive's contents and stores it on the object.
func (*Archive) Equals ¶
Equals returns true if a is value-equal to other. In this case, value equality is determined only by the hash: even if the contents of two archives come from different sources, they are treated as equal if their hashes match. Similarly, if the contents of two archives come from the same source but the archives have different hashes, the archives are not equal.
func (*Archive) GetURIURL ¶
GetURIURL returns the underlying URI as a parsed URL, provided it is one. If there was an error parsing the URI, it will be returned as a non-nil error object.
func (*Archive) HasContents ¶
HasContents indicates whether or not an archive's contents can be read.
func (*Archive) Open ¶
Open returns an ArchiveReader that can be used to iterate over the named blobs that comprise the archive.
func (*Archive) ReadSourceArchive ¶
func (a *Archive) ReadSourceArchive() (Format, io.ReadCloser, error)
ReadSourceArchive returns a stream to the underlying archive, if there is one.
type Format ¶
type Format int
Format indicates what archive and/or compression format an archive uses.
type Reader ¶
type Reader interface { // Next returns the name and contents of the next member of the archive. If there are no more members in the // archive, this function returns ("", nil, io.EOF). The blob returned by a call to Next() must be read in full // before the next call to Next(). Next() (string, *asset.Blob, error) // Close terminates the stream. Close() error }
Reader presents the contents of an archive as a stream of named blobs.