Documentation ¶
Index ¶
- Constants
- type ArchiveFormatOption
- type ArchiveRef
- type ArchiveType
- type BucketRef
- type CompressionType
- type DirFormatOption
- type DirRef
- type FileRef
- type FileScheme
- type GetBucketOption
- type GetFileOption
- type GetParsedRefOption
- type GitFormatOption
- type GitRef
- type GitScheme
- type HasFormat
- type ParsedArchiveRef
- type ParsedBucketRef
- type ParsedDirRef
- type ParsedFileRef
- type ParsedGitRef
- type ParsedRef
- type ParsedSingleRef
- type PutFileOption
- type RawRef
- type Reader
- type ReaderOption
- type Ref
- type RefParser
- type RefParserOption
- func WithArchiveFormat(format string, archiveType ArchiveType, options ...ArchiveFormatOption) RefParserOption
- func WithDirFormat(format string, options ...DirFormatOption) RefParserOption
- func WithGitFormat(format string, options ...GitFormatOption) RefParserOption
- func WithRawRefProcessor(rawRefProcessor func(*RawRef) error) RefParserOption
- func WithSingleFormat(format string, options ...SingleFormatOption) RefParserOption
- type SingleFormatOption
- type SingleRef
- type Writer
- type WriterOption
Constants ¶
const ( // FileSchemeHTTP is the http file scheme. FileSchemeHTTP FileScheme = iota + 1 // FileSchemeHTTPS is the https file scheme. FileSchemeHTTPS // FileSchemeLocal is the local file scheme. FileSchemeLocal // FileSchemeStdio is the stdio file scheme. FileSchemeStdio // FileSchemeNull is the null file scheme. FileSchemeNull // GitSchemeHTTP is the http git scheme. GitSchemeHTTP GitScheme = iota + 1 // GitSchemeHTTPS is the https git scheme. GitSchemeHTTPS // GitSchemeLocal is the local git scheme. GitSchemeLocal // GitSchemeSSH is the ssh git scheme. GitSchemeSSH // ArchiveTypeTar is a tar archive. ArchiveTypeTar ArchiveType = iota + 1 // ArchiveTypeZip is a zip archive. ArchiveTypeZip // CompressionTypeNone is no compression. CompressionTypeNone CompressionType = iota + 1 // CompressionTypeGzip is gzip compression. CompressionTypeGzip // CompressionTypeZstd is zstd compression. CompressionTypeZstd )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArchiveFormatOption ¶
type ArchiveFormatOption func(*archiveFormatInfo)
ArchiveFormatOption is a archive format option.
func WithArchiveDefaultCompressionType ¶
func WithArchiveDefaultCompressionType(defaultCompressionType CompressionType) ArchiveFormatOption
WithArchiveDefaultCompressionType sets the default compression type.
Note this should never be set for zip.
type ArchiveRef ¶
type ArchiveRef interface { FileRef BucketRef ArchiveType() ArchiveType StripComponents() uint32 // contains filtered or unexported methods }
ArchiveRef is an archive reference.
An ArchiveRef is a special type of reference that can be either a FileRef or a BucketRef. Note that if ArchiveType is ArchiveTypeZip, CompressionType will always be CompressionTypeNone.
func NewArchiveRef ¶
func NewArchiveRef( path string, archiveType ArchiveType, compressionType CompressionType, stripComponents uint32, ) (ArchiveRef, error)
NewArchiveRef returns a new ArchiveRef.
type BucketRef ¶
type BucketRef interface { Ref // contains filtered or unexported methods }
BucketRef is a bucket reference.
type DirFormatOption ¶
type DirFormatOption func(*dirFormatInfo)
DirFormatOption is a dir format option.
type DirRef ¶
type DirRef interface { BucketRef // contains filtered or unexported methods }
DirRef is a local directory reference.
type FileRef ¶
type FileRef interface { Ref FileScheme() FileScheme CompressionType() CompressionType // contains filtered or unexported methods }
FileRef is a file reference.
type GetBucketOption ¶
type GetBucketOption func(*getBucketOptions)
GetBucketOption is a GetBucket option
func WithGetBucketExactPath ¶
func WithGetBucketExactPath(exactPath string) GetBucketOption
WithGetBucketExactPath is equivalent to normalpath.WithExactPath.
func WithGetBucketExt ¶
func WithGetBucketExt(ext string) GetBucketOption
WithGetBucketExt is equivalent to normalpath.WithExt.
type GetFileOption ¶
type GetFileOption func(*getFileOptions)
GetFileOption is a GetFile option
func WithGetFileKeepFileCompression ¶
func WithGetFileKeepFileCompression() GetFileOption
WithGetFileKeepFileCompression says to return s compressed.
type GetParsedRefOption ¶
type GetParsedRefOption func(*getParsedRefOptions)
GetParsedRefOption is a GetParsedRef option
func WithAllowedFormats ¶
func WithAllowedFormats(formats ...string) GetParsedRefOption
WithAllowedFormats limits the allowed formats to the given formats.
type GitFormatOption ¶
type GitFormatOption func(*gitFormatInfo)
GitFormatOption is a git format option.
type GitRef ¶
type GitRef interface { BucketRef GitScheme() GitScheme // Optional. May be nil, in which case clone the default branch. GitName() git.Name // Will always be >= 1 Depth() uint32 RecurseSubmodules() bool // contains filtered or unexported methods }
GitRef is a git reference.
type HasFormat ¶
type HasFormat interface {
Format() string
}
HasFormat is an object that has a format.
type ParsedArchiveRef ¶
type ParsedArchiveRef interface { ArchiveRef HasFormat }
ParsedArchiveRef is a parsed ArchiveRef.
type ParsedBucketRef ¶
ParsedBucketRef is a parsed BucketRef.
type ParsedDirRef ¶
ParsedDirRef is a parsed DirRef.
type ParsedFileRef ¶
ParsedFileRef is a parsed FileRef.
type ParsedGitRef ¶
ParsedGitRef is a parsed GitRef.
type ParsedSingleRef ¶
ParsedSingleRef is a parsed SingleRef.
type PutFileOption ¶
type PutFileOption func(*putFileOptions)
PutFileOption is a PutFile option
func WithPutFileNoFileCompression ¶
func WithPutFileNoFileCompression() PutFileOption
WithPutFileNoFileCompression says to put s uncompressed.
type RawRef ¶
type RawRef struct { // Will always be set // Not normalized yet Path string // Will always be set // Set via RawRefProcessor if not explicitly set Format string // Only set for single, archive formats // Cannot be set for zip archives CompressionType CompressionType // Only set for git formats // Only one of GitBranch and GitTag will be set GitBranch string // Only set for git formats // Only one of GitBranch and GitTag will be set GitTag string // Only set for git formats // Specifies an exact git reference to use with git checkout. // Can be used on its own or with GitBranch. Not allowed with GitTag. // This is defined as anything that can be given to git checkout. GitRef string // Only set for git formats GitRecurseSubmodules bool // Only set for git formats. // The depth to use when cloning a repository. Only allowed when GitRef // is set. Defaults to 50 if unset. GitDepth uint32 // Only set for archive formats ArchiveStripComponents uint32 }
RawRef is an unprocessed ref used for WithRefProcessor.
A RawRefProcessor will allow modifications to a RawRef before continuing parsing. This allows defaults to be inferred from the path.
The Path will be the only value set when the RawRefProcessor is invoked, and is not normalized. After the RawRefProcessor is called, options will be parsed.
type Reader ¶
type Reader interface { // GetFile gets the file. // SingleRefs and ArchiveRefs will result in decompressed files unless KeepFileCompression is set. GetFile( ctx context.Context, container app.EnvStdinContainer, fileRef FileRef, options ...GetFileOption, ) (io.ReadCloser, error) // GetBucket gets the bucket . GetBucket( ctx context.Context, container app.EnvStdinContainer, bucketRef BucketRef, options ...GetBucketOption, ) (storage.ReadBucketCloser, error) }
Reader is a reader.
type ReaderOption ¶
type ReaderOption func(*reader)
ReaderOption is an Reader option.
func WithReaderGit ¶
func WithReaderGit(gitCloner git.Cloner) ReaderOption
WithReaderGit enables Git.
func WithReaderHTTP ¶
func WithReaderHTTP(httpClient *http.Client, httpAuthenticator httpauth.Authenticator) ReaderOption
WithReaderHTTP enables HTTP.
type Ref ¶
type Ref interface { // Path is the path to. // // This will be the non-empty path minus the scheme for http and https files. // This will be the non-empty normalized file path for local files. // This will be empty for stdio and null files. // This will be the non-empty normalized directory path for directories. // This will be the non-empty path minus the scheme for http, https, and ssh git repositories. // This will be the non-empty normalized directory path for local git repositories. Path() string // contains filtered or unexported methods }
Ref is a reference.
type RefParser ¶
type RefParser interface { // GetParsedRef gets the ParsedRef for the value. // // The returned ParsedRef will be either a ParsedSingleRef, ParsedArchiveRef, ParsedDirRef, or ParsedGitRef. // // The options should be used to validate that you are getting one of the correct formats. GetParsedRef(ctx context.Context, value string, options ...GetParsedRefOption) (ParsedRef, error) }
RefParser parses references.
func NewRefParser ¶
func NewRefParser(logger *zap.Logger, options ...RefParserOption) RefParser
NewRefParser returns a new RefParser.
type RefParserOption ¶
type RefParserOption func(*refParser)
RefParserOption is an RefParser option.
func WithArchiveFormat ¶
func WithArchiveFormat(format string, archiveType ArchiveType, options ...ArchiveFormatOption) RefParserOption
WithArchiveFormat attaches the given format as an archive format.
It is up to the user to not incorrectly attached a format twice.
func WithDirFormat ¶
func WithDirFormat(format string, options ...DirFormatOption) RefParserOption
WithDirFormat attaches the given format as a dir format.
It is up to the user to not incorrectly attached a format twice.
func WithGitFormat ¶
func WithGitFormat(format string, options ...GitFormatOption) RefParserOption
WithGitFormat attaches the given format as a git format.
It is up to the user to not incorrectly attached a format twice.
func WithRawRefProcessor ¶
func WithRawRefProcessor(rawRefProcessor func(*RawRef) error) RefParserOption
WithRawRefProcessor attaches the given RawRefProcessor.
If format is not manually specified, the RefParser will use this format parser with the raw path, that is not normalized.
func WithSingleFormat ¶
func WithSingleFormat(format string, options ...SingleFormatOption) RefParserOption
WithSingleFormat attaches the given format as a single format.
It is up to the user to not incorrectly attached a format twice.
type SingleFormatOption ¶
type SingleFormatOption func(*singleFormatInfo)
SingleFormatOption is a single format option.
func WithSingleDefaultCompressionType ¶
func WithSingleDefaultCompressionType(defaultCompressionType CompressionType) SingleFormatOption
WithSingleDefaultCompressionType sets the default compression type.
type SingleRef ¶
type SingleRef interface { FileRef // contains filtered or unexported methods }
SingleRef is a non-archive file reference.
func NewSingleRef ¶
func NewSingleRef(path string, compressionType CompressionType) (SingleRef, error)
NewSingleRef returns a new SingleRef.
type Writer ¶
type Writer interface { // PutFile puts the file. PutFile( ctx context.Context, container app.EnvStdoutContainer, fileRef FileRef, options ...PutFileOption, ) (io.WriteCloser, error) }
Writer is a writer.