Documentation ¶
Index ¶
- Constants
- func GetInputConfigForRef(ref Ref, value string) (bufconfig.InputConfig, error)
- func NewCannotSpecifyCommitOrTagWithRefError() error
- func NewCannotSpecifyCompressionForZipError() error
- func NewCannotSpecifyGitBranchAndCommitOrTagError() error
- func NewCompressionUnknownError(compression string) error
- func NewDepthParseError(s string) error
- func NewDepthZeroError() error
- func NewFormatCannotBeDeterminedError(value string) error
- func NewFormatNotAllowedError(format string, allowedFormats map[string]struct{}) error
- func NewFormatOverrideNotAllowedForDevNullError(devNull string) error
- func NewFormatUnknownError(formatString string) error
- func NewInvalidPathError(format string, path string) error
- func NewNoPathError() error
- func NewOptionsCouldNotParseRecurseSubmodulesError(s string) error
- func NewOptionsCouldNotParseStripComponentsError(s string) error
- func NewOptionsInvalidForFormatError(format string, inputName string, issue string) error
- func NewOptionsInvalidKeysError(keys ...string) error
- func NewOptionsInvalidValueForKeyError(key string, value string) error
- func NewPathUnknownGzError(path string) error
- func NewProtoFileCannotBeDevPathError(format string, path string) error
- func NewReadDisabledError(scheme string) error
- func NewReadGitDisabledError() error
- func NewReadHTTPDisabledError() error
- func NewReadLocalDisabledError() error
- func NewReadModuleDisabledError() error
- func NewReadStdioDisabledError() error
- func NewRealCleanPathError(path string) error
- func NewWriteDisabledError(scheme string) error
- func NewWriteHTTPDisabledError() error
- func NewWriteLocalDisabledError() error
- func NewWriteStdioDisabledError() error
- type ArchiveFormatOption
- type ArchiveRef
- type ArchiveType
- type BucketExtender
- type BucketRef
- type CompressionType
- type DirFormatOption
- type DirRef
- type FileRef
- type FileScheme
- type GetFileOption
- type GetModuleOption
- type GetParsedRefOption
- type GetReadBucketCloserOption
- func WithGetReadBucketCloserCopyToInMemory() GetReadBucketCloserOption
- func WithGetReadBucketCloserTargetExcludePaths(targetExcludePaths []string) GetReadBucketCloserOption
- func WithGetReadBucketCloserTargetPaths(targetPaths []string) GetReadBucketCloserOption
- func WithGetReadBucketCloserTerminateFunc(terminateFunc buftarget.TerminateFunc) GetReadBucketCloserOption
- type GetReadWriteBucketOption
- type GitFormatOption
- type GitRef
- type GitScheme
- type HasFormat
- type ModuleFormatOption
- type ModuleRef
- type ParsedArchiveRef
- type ParsedBucketRef
- type ParsedDirRef
- type ParsedFileRef
- type ParsedGitRef
- type ParsedModuleRef
- type ParsedProtoFileRef
- type ParsedRef
- type ParsedSingleRef
- type ProtoFileFormatOption
- type ProtoFileRef
- type ProtoFileWriter
- type PutFileOption
- type RawRef
- type ReadBucketCloser
- type ReadWriteBucket
- type Reader
- type ReaderOption
- func WithReaderGit(gitCloner git.Cloner) ReaderOption
- func WithReaderHTTP(httpClient *http.Client, httpAuthenticator httpauth.Authenticator) ReaderOption
- func WithReaderLocal() ReaderOption
- func WithReaderModule(moduleKeyProvider bufmodule.ModuleKeyProvider) ReaderOption
- func WithReaderStdio() 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 WithModuleFormat(format string, options ...ModuleFormatOption) RefParserOption
- func WithProtoFileFormat(format string, options ...ProtoFileFormatOption) 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. // // This can reference either stdin or stdout depending on if we are // reading or writing. FileSchemeStdio // FileSchemeStdin is the stdin file scheme. FileSchemeStdin // FileSchemeStdout is the stdout file scheme. FileSchemeStdout // 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 // GitSchemeGit is the git git scheme. GitSchemeGit // 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 ¶
func GetInputConfigForRef ¶ added in v1.32.0
func GetInputConfigForRef(ref Ref, value string) (bufconfig.InputConfig, error)
GetInputConfigForRef returns the input config for the ref. A string is also passed because if the ref is a git ref, it would only have a git.Name, instead of a git branch, a git ref and a git tag. Therefore the original string is passed.
func NewCannotSpecifyCommitOrTagWithRefError ¶ added in v1.32.0
func NewCannotSpecifyCommitOrTagWithRefError() error
NewCannotSpecifyCommitOrTagWithRefError is a fetch error.
func NewCannotSpecifyCompressionForZipError ¶
func NewCannotSpecifyCompressionForZipError() error
NewCannotSpecifyCompressionForZipError is a fetch error.
func NewCannotSpecifyGitBranchAndCommitOrTagError ¶ added in v1.32.0
func NewCannotSpecifyGitBranchAndCommitOrTagError() error
NewCannotSpecifyGitBranchAndCommitOrTagError is a fetch error.
func NewCompressionUnknownError ¶
NewCompressionUnknownError is a fetch error.
func NewDepthParseError ¶
NewDepthParseError is a fetch error.
func NewFormatCannotBeDeterminedError ¶
NewFormatCannotBeDeterminedError is a fetch error.
func NewFormatNotAllowedError ¶
NewFormatNotAllowedError is a fetch error.
func NewFormatOverrideNotAllowedForDevNullError ¶
NewFormatOverrideNotAllowedForDevNullError is a fetch error.
func NewFormatUnknownError ¶
NewFormatUnknownError is a fetch error.
func NewInvalidPathError ¶
NewInvalidPathError is a fetch error.
func NewOptionsCouldNotParseRecurseSubmodulesError ¶
NewOptionsCouldNotParseRecurseSubmodulesError is a fetch error.
func NewOptionsCouldNotParseStripComponentsError ¶
NewOptionsCouldNotParseStripComponentsError is a fetch error.
func NewOptionsInvalidForFormatError ¶
NewOptionsInvalidForFormatError is a fetch error.
func NewOptionsInvalidKeysError ¶ added in v1.29.0
NewOptionsInvalidKeysError is a fetch error.
func NewOptionsInvalidValueForKeyError ¶ added in v1.29.0
NewOptionsInvalidValueForKeyError is a fetch error.
func NewPathUnknownGzError ¶
NewPathUnknownGzError is a fetch error.
func NewProtoFileCannotBeDevPathError ¶ added in v1.19.0
NewProtoFileCannotBeDevPathError is a fetch error.
func NewReadDisabledError ¶
NewReadDisabledError is a fetch error.
func NewReadGitDisabledError ¶
func NewReadGitDisabledError() error
NewReadGitDisabledError is a fetch error.
func NewReadHTTPDisabledError ¶
func NewReadHTTPDisabledError() error
NewReadHTTPDisabledError is a fetch error.
func NewReadLocalDisabledError ¶
func NewReadLocalDisabledError() error
NewReadLocalDisabledError is a fetch error.
func NewReadModuleDisabledError ¶
func NewReadModuleDisabledError() error
NewReadModuleDisabledError is a fetch error.
func NewReadStdioDisabledError ¶
func NewReadStdioDisabledError() error
NewReadStdioDisabledError is a fetch error.
func NewRealCleanPathError ¶
NewRealCleanPathError is a fetch error.
func NewWriteDisabledError ¶
NewWriteDisabledError is a fetch error.
func NewWriteHTTPDisabledError ¶
func NewWriteHTTPDisabledError() error
NewWriteHTTPDisabledError is a fetch error.
func NewWriteLocalDisabledError ¶
func NewWriteLocalDisabledError() error
NewWriteLocalDisabledError is a fetch error.
func NewWriteStdioDisabledError ¶
func NewWriteStdioDisabledError() error
NewWriteStdioDisabledError is a fetch error.
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 // Applied before subdir StripComponents() uint32 // Will be empty instead of "." for root directory SubDirPath() string // 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, subDirPath string, ) (ArchiveRef, error)
NewArchiveRef returns a new ArchiveRef.
type BucketExtender ¶ added in v1.32.0
type BucketExtender interface { // SubDirPath is the subdir within the Bucket of the actual asset. // // This will be set if a terminate file was found. If so, the actual Bucket will be // the directory that contained this terminate file, and the subDirPath will be the sub-direftory of // the actual asset relative to the terminate file. SubDirPath() string }
BucketExtender has extra methods we attach to buckets.
type BucketRef ¶
type BucketRef interface { Ref // contains filtered or unexported methods }
BucketRef is a bucket reference.
type CompressionType ¶
type CompressionType int
CompressionType is a compression type.
func (CompressionType) String ¶ added in v1.32.0
func (c CompressionType) String() string
String implements fmt.Stringer
type DirFormatOption ¶
type DirFormatOption func(*dirFormatInfo)
DirFormatOption is a dir format option.
type DirRef ¶
type DirRef interface { // Path is the path to the reference. // // This will be the non-empty normalized directory path for directories. Path() string BucketRef // contains filtered or unexported methods }
DirRef is a local directory reference.
type FileRef ¶
type FileRef interface { Ref // Path is the path to the reference. // // 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. Path() string FileScheme() FileScheme CompressionType() CompressionType // contains filtered or unexported methods }
FileRef is a file reference.
type GetFileOption ¶
type GetFileOption func(*getFileOptions)
GetFileOption is a GetFile option.
func WithGetFileKeepFileCompression ¶
func WithGetFileKeepFileCompression() GetFileOption
WithGetFileKeepFileCompression says to return compressed.
type GetModuleOption ¶
type GetModuleOption func(*getModuleOptions)
GetModuleOption is a GetModule option.
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 GetReadBucketCloserOption ¶ added in v1.32.0
type GetReadBucketCloserOption func(*getReadBucketCloserOptions)
GetReadBucketCloserOption is a GetReadBucketCloser option.
func WithGetReadBucketCloserCopyToInMemory ¶ added in v1.32.0
func WithGetReadBucketCloserCopyToInMemory() GetReadBucketCloserOption
WithGetBucketCopyToInMemory says to copy the returned ReadBucketCloser to an in-memory ReadBucket. This can be a performance optimization at the expense of memory.
func WithGetReadBucketCloserTargetExcludePaths ¶ added in v1.32.0
func WithGetReadBucketCloserTargetExcludePaths(targetExcludePaths []string) GetReadBucketCloserOption
WithGetReadBucketCloserTargetExcludePaths sets the target exclude paths for the bucket targeting information.
func WithGetReadBucketCloserTargetPaths ¶ added in v1.32.0
func WithGetReadBucketCloserTargetPaths(targetPaths []string) GetReadBucketCloserOption
WithGetReadBucketCloserTargetPaths sets the target paths for the bucket targeting information.
func WithGetReadBucketCloserTerminateFunc ¶ added in v1.32.0
func WithGetReadBucketCloserTerminateFunc(terminateFunc buftarget.TerminateFunc) GetReadBucketCloserOption
WithGetReadBucketCloserTerminateFunc says to check the bucket at the given prefix, and potentially terminate the search for the workspace file. This will result in the given prefix being the workspace directory, and a SubDirPath being computed appropriately.
See bufconfig.TerminateAtControllingWorkspace, which is the only thing that uses this. This is used by both non-ProtoFileRefs to find the controlling workspace, AND ProtoFileRefs to find the controlling workspace of an enclosing module or workspace.
type GetReadWriteBucketOption ¶ added in v1.32.0
type GetReadWriteBucketOption func(*getReadWriteBucketOptions)
GetReadWriteBucketOption is a GetReadWriteBucket option.
func WithGetReadWriteBucketTargetExcludePaths ¶ added in v1.32.0
func WithGetReadWriteBucketTargetExcludePaths(targetExcludePaths []string) GetReadWriteBucketOption
func WithGetReadWriteBucketTargetPaths ¶ added in v1.32.0
func WithGetReadWriteBucketTargetPaths(targetPaths []string) GetReadWriteBucketOption
WithGetReadWriteBucketTargetPaths sets the target paths for the bucket targeting information.
func WithGetReadWriteBucketTerminateFunc ¶ added in v1.32.0
func WithGetReadWriteBucketTerminateFunc(terminateFunc buftarget.TerminateFunc) GetReadWriteBucketOption
WithGetReadWriteBucketTerminateFunc says to check the bucket at the given prefix, and potentially terminate the search for the workspace file. This will result in the given prefix being the workspace directory, and a SubDirPath being computed appropriately.
See bufconfig.TerminateAtControllingWorkspace, which is the only thing that uses this. This is used by both non-ProtoFileRefs to find the controlling workspace, AND ProtoFileRefs to find the controlling workspace of an enclosing module or workspace.
type GitFormatOption ¶
type GitFormatOption func(*gitFormatInfo)
GitFormatOption is a git format option.
type GitRef ¶
type GitRef interface { // Path is the path to the reference. // // This will be the non-empty path minus the scheme for http, https, ssh, and git repositories. // This will be the non-empty normalized directory path for local git repositories. Path() string 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 // Will be empty instead of "." for root directory SubDirPath() string // 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 ModuleFormatOption ¶
type ModuleFormatOption func(*moduleFormatInfo)
ModuleFormatOption is a module format option.
type ModuleRef ¶
type ModuleRef interface { Ref ModuleRef() bufmodule.ModuleRef // contains filtered or unexported methods }
ModuleRef is a module reference.
type ParsedArchiveRef ¶
type ParsedArchiveRef interface { ArchiveRef HasFormat }
ParsedArchiveRef is a parsed ArchiveRef.
func NewDirectParsedArchiveRef ¶
func NewDirectParsedArchiveRef( format string, path string, fileScheme FileScheme, archiveType ArchiveType, compressionType CompressionType, stripComponents uint32, subDirPath string, ) ParsedArchiveRef
NewDirectParsedArchiveRef returns a new ParsedArchiveRef with no validation checks.
This should only be used for testing.
type ParsedBucketRef ¶
ParsedBucketRef is a parsed BucketRef.
type ParsedDirRef ¶
ParsedDirRef is a parsed DirRef.
func NewDirectParsedDirRef ¶
func NewDirectParsedDirRef(format string, path string) ParsedDirRef
NewDirectParsedDirRef returns a new ParsedDirRef with no validation checks.
This should only be used for testing.
type ParsedFileRef ¶
ParsedFileRef is a parsed FileRef.
type ParsedGitRef ¶
ParsedGitRef is a parsed GitRef.
func NewDirectParsedGitRef ¶
func NewDirectParsedGitRef( format string, path string, gitScheme GitScheme, gitName git.Name, recurseSubmodules bool, depth uint32, subDirPath string, ) ParsedGitRef
NewDirectParsedGitRef returns a new ParsedGitRef with no validation checks.
This should only be used for testing.
type ParsedModuleRef ¶
ParsedModuleRef is a parsed ModuleRef.
func NewDirectParsedModuleRef ¶
func NewDirectParsedModuleRef( format string, moduleRef bufmodule.ModuleRef, ) ParsedModuleRef
NewDirectParsedModuleRef returns a new ParsedModuleRef with no validation checks.
This should only be used for testing.
type ParsedProtoFileRef ¶ added in v1.0.0
type ParsedProtoFileRef interface { ProtoFileRef HasFormat }
ParsedProtoFileRef is a parsed ProtoFileRef.
func NewDirectParsedProtoFileRef ¶ added in v1.32.0
func NewDirectParsedProtoFileRef( format string, path string, fileScheme FileScheme, includePackageFiles bool, ) ParsedProtoFileRef
NewDirectParsedProtoFileRef returns a new ParsedProtoFileRef with no validation checks.
This should only be used for testing.
type ParsedSingleRef ¶
ParsedSingleRef is a parsed SingleRef.
func NewDirectParsedSingleRef ¶
func NewDirectParsedSingleRef( format string, path string, fileScheme FileScheme, compressionType CompressionType, customOptions map[string]string, ) ParsedSingleRef
NewDirectParsedSingleRef returns a new ParsedSingleRef with no validation checks.
This should only be used for testing.
type ProtoFileFormatOption ¶ added in v1.0.0
type ProtoFileFormatOption func(*protoFileFormatInfo)
ProtoFileFormatOption is a single file format option.
type ProtoFileRef ¶ added in v1.0.0
type ProtoFileRef interface { BucketRef // Path is the normalized path to the file reference. Path() string // IncludePackageFiles says to include the files from the same package files IncludePackageFiles() bool FileScheme() FileScheme // contains filtered or unexported methods }
ProtoFileRef is a file reference that incorporates a BucketRef.
type ProtoFileWriter ¶ added in v1.32.0
type ProtoFileWriter interface { // PutProtoFile puts the proto file. PutProtoFile( ctx context.Context, container app.EnvStdoutContainer, protoFileRef ProtoFileRef, ) (io.WriteCloser, error) }
ProtoFileWriter is a writer of ProtoFiles.
func NewProtoFileWriter ¶ added in v1.32.0
func NewProtoFileWriter( logger *zap.Logger, ) ProtoFileWriter
NewProtoWriter returns a new ProtoWriter.
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 archive, git formats. SubDirPath string // Only set for git formats. // Only one of GitBranch and GitCommitOrTag will be set. GitBranch string // Only set for git formats. // Only one of GitBranch and GitCommitOrTag will be set. // Should indicate a full commit hash or tag name. // This is defined as anything that can be given to "git fetch". GitCommitOrTag string // Only set for git formats // Specifies a git reference to use with "git checkout". // Can be used on its own or with GitBranch. Not allowed with GitCommitOrTag. // This is defined as anything that can be given to "git checkout". // Differs from GitCommitOrTag in that it can be a short hash, or even a // relative commit, such as "HEAD^2". 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. It must be deep enough that the // requested GitRef will be included when cloning the requested branch // (or the repo's default branch if GitBranch is empty). GitDepth uint32 // Only set for archive formats. ArchiveStripComponents uint32 // Only set for proto file ref format. // Sets whether or not to include the files in the rest of the package // in the message for the ProtoFileRef. // This defaults to false. IncludePackageFiles bool // Any unrecognized options. Some formats may allow custom options, and those // formats should check for those custom options in this map. If a format // does not allow an option, an error will be returned. UnrecognizedOptions map[string]string }
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 ReadBucketCloser ¶
type ReadBucketCloser interface { storage.ReadBucketCloser BucketExtender }
ReadBucketCloser is a bucket returned from GetReadBucketCloser.
type ReadWriteBucket ¶ added in v1.32.0
type ReadWriteBucket interface { storage.ReadWriteBucket BucketExtender }
ReadWriteBucket is a bucket returned from GetReadWriteBucket.
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) // GetReadBucketCloser gets the bucket. GetReadBucketCloser( ctx context.Context, container app.EnvStdinContainer, bucketRef BucketRef, options ...GetReadBucketCloserOption, ) (ReadBucketCloser, buftarget.BucketTargeting, error) // GetReadWriteBucket gets the bucket. GetReadWriteBucket( ctx context.Context, container app.EnvStdinContainer, dirRef DirRef, options ...GetReadWriteBucketOption, ) (ReadWriteBucket, buftarget.BucketTargeting, error) // GetModuleKey gets the ModuleKey. GetModuleKey( ctx context.Context, container app.EnvStdinContainer, moduleRef ModuleRef, options ...GetModuleOption, ) (bufmodule.ModuleKey, error) }
Reader is a reader.
type ReaderOption ¶
type ReaderOption func(*reader)
ReaderOption is a 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.
func WithReaderModule ¶
func WithReaderModule( moduleKeyProvider bufmodule.ModuleKeyProvider, ) ReaderOption
WithReaderModule enables modules.
type RefParser ¶
type RefParser interface { // GetParsedRef gets the ParsedRef for the value. // // The returned ParsedRef will be either a ParsedSingleRef, ParsedArchiveRef, ParsedDirRef, ParsedGitRef, or ParsedModuleRef. // // 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) // GetParsedRefForInputConfig gets the ParsedRef for the input config. // // The returned ParsedRef will be either a ParsedSingleRef, ParsedArchiveRef, ParsedDirRef, ParsedGitRef, or ParsedModuleRef. // // The options should be used to validate that you are getting one of the correct formats. GetParsedRefForInputConfig(ctx context.Context, inputConfig bufconfig.InputConfig, 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 WithModuleFormat ¶
func WithModuleFormat(format string, options ...ModuleFormatOption) RefParserOption
WithModuleFormat attaches the given format as a module format.
It is up to the user to not incorrectly attach a format twice.
func WithProtoFileFormat ¶ added in v1.0.0
func WithProtoFileFormat(format string, options ...ProtoFileFormatOption) RefParserOption
WithProtoFileFormat attaches the given format as a single file format.
It is up to the user to not incorrectly attach 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 WithSingleCustomOptionKey ¶ added in v1.29.0
func WithSingleCustomOptionKey(key string) SingleFormatOption
WithSingleCustomOptionKey adds a custom option key that is recognized..
func WithSingleDefaultCompressionType ¶
func WithSingleDefaultCompressionType(defaultCompressionType CompressionType) SingleFormatOption
WithSingleDefaultCompressionType sets the default compression type.
type SingleRef ¶
type SingleRef interface { FileRef CustomOptionValue(key string) (string, bool) // 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.