Documentation
¶
Overview ¶
Package bufos provides abstractions to read and write images from an OS context.
This is primarily meant for the CLI tool, and isn't used in a service context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Env ¶
type Env struct {
// Image is the image to use.
//
// Validated.
Image *imagev1beta1.Image
// ImageWithImports is a full Image with imports.
//
// Can be nil. This will only be present from source reads.
// See bufbuild.Handler.
// Validated.
ImageWithImports *imagev1beta1.Image
// Resolver is the resolver to apply before printing paths or FileAnnotations.
// Can be nil.
Resolver bufbuild.ProtoRealFilePathResolver
// Config is the config to use.
Config *bufconfig.Config
}
Env is an environment.
type EnvReader ¶
type EnvReader interface {
// ReadEnv reads an environment.
//
// If specificFilePaths is empty, this builds all the files under Buf control.
//
// Note that includeImports will only be respected for Images if the image was
// built with buf - if it was built with protoc, we have no way of detecting
// what is and isn't an import.
//
// Note that includeSourceInfo will only be respected for Sources. We make
// no modifications for Images.
//
// FileAnnotations will be fixed per the resolver before returning.
// If stdin is nil and this tries to read from stdin, returns user error.
ReadEnv(
ctx context.Context,
container app.EnvStdinContainer,
value string,
configOverride string,
specificFilePaths []string,
specificFilePathsAllowNotExist bool,
includeImports bool,
includeSourceInfo bool,
) (*Env, []*filev1beta1.FileAnnotation, error)
// ReadSourceEnv reads an source environment.
//
// This is the same as ReadEnv but disallows image values and always builds.
ReadSourceEnv(
ctx context.Context,
container app.EnvStdinContainer,
value string,
configOverride string,
specificFilePaths []string,
specificFilePathsAllowNotExist bool,
includeImports bool,
includeSourceInfo bool,
) (*Env, []*filev1beta1.FileAnnotation, error)
// ReadImageEnv reads an image environment.
//
// This is the same as ReadEnv but disallows source values and never builds.
ReadImageEnv(
ctx context.Context,
container app.EnvStdinContainer,
value string,
configOverride string,
specificFilePaths []string,
specificFilePathsAllowNotExist bool,
includeImports bool,
) (*Env, error)
// ListFiles lists the files.
ListFiles(
ctx context.Context,
container app.EnvStdinContainer,
value string,
configOverride string,
) ([]string, error)
// GetConfig gets the config.
GetConfig(
ctx context.Context,
configOverride string,
) (*bufconfig.Config, error)
}
EnvReader is an env reader.
func NewEnvReader ¶
func NewEnvReader( logger *zap.Logger, httpClient *http.Client, httpAuthenticator apphttp.Authenticator, gitCloner git.Cloner, configProvider bufconfig.Provider, buildHandler bufbuild.Handler, valueFlagName string, configOverrideFlagName string, ) EnvReader
NewEnvReader returns a new EnvReader.
type ImageWriter ¶
type ImageWriter interface {
// WriteImage writes the image to the value.
//
// The file must be an image format.
// This is a no-np if value is the equivalent of /dev/null.
//
// Validates the image before writing.
WriteImage(
ctx context.Context,
stdoutContainer app.StdoutContainer,
value string,
asFileDescriptorSet bool,
image *imagev1beta1.Image,
imageWithImports *imagev1beta1.Image,
) error
}
ImageWriter is an image writer.
func NewImageWriter ¶
func NewImageWriter( logger *zap.Logger, valueFlagName string, ) ImageWriter
NewImageWriter returns a new ImageWriter.
Click to show internal directories.
Click to hide internal directories.