Documentation
¶
Index ¶
Constants ¶
View Source
const ( FileInputType = "file" DirInputType = "dir" )
View Source
const MediaTypeGZip = "application/gzip"
MediaTypeGZip defines the media type for a gzipped file
View Source
const MediaTypeOctetStream = "application/octet-stream"
MediaTypeOctetStream is the media type for any binary data.
View Source
const MediaTypeTar = "application/x-tar"
MediaTypeTar defines the media type for a tarred file
Variables ¶
This section is empty.
Functions ¶
func TarFileSystem ¶
func TarFileSystem(ctx context.Context, fs vfs.FileSystem, root string, writer io.Writer, opts TarFileSystemOptions) error
TarFileSystem creates a tar archive from a filesystem.
Types ¶
type BlobInput ¶
type BlobInput struct {
// Type defines the input type of the blob to be added.
// Note that a input blob of type "dir" is automatically tarred.
Type BlobInputType `json:"type"`
// MediaType is the mediatype of the defined file that is also added to the oci layer.
// Should be a custom media type in the form of "application/vnd.<mydomain>.<my description>"
MediaType string `json:"mediaType,omitempty"`
// Path is the path that points to the blob to be added.
Path string `json:"path"`
// CompressWithGzip defines that the blob should be automatically compressed using gzip.
CompressWithGzip *bool `json:"compress,omitempty"`
// PreserveDir defines that the directory specified in the Path field should be included in the blob.
// Only supported for Type dir.
PreserveDir bool `json:"preserveDir,omitempty"`
// IncludeFiles is a list of shell file name patterns that describe the files that should be included.
// If nothing is defined all files are included.
// Only relevant for blobinput type "dir".
IncludeFiles []string `json:"includeFiles,omitempty"`
// ExcludeFiles is a list of shell file name patterns that describe the files that should be excluded from the resulting tar.
// Excluded files always overwrite included files.
// Only relevant for blobinput type "dir".
ExcludeFiles []string `json:"excludeFiles,omitempty"`
// FollowSymlinks configures to follow and resolve symlinks when a directory is tarred.
// This options will include the content of the symlink directly in the tar.
// This option should be used with care.
FollowSymlinks bool `json:"followSymlinks,omitempty"`
}
BlobInput defines a local resource input that should be added to the component descriptor and to the resource's access.
func (*BlobInput) Read ¶
func (input *BlobInput) Read(ctx context.Context, fs vfs.FileSystem, inputFilePath string) (*BlobOutput, error)
Read reads the configured blob and returns a reader to the given file.
func (*BlobInput) SetMediaTypeIfNotDefined ¶
SetMediaTypeIfNotDefined sets the media type of the input blob if its not defined
type BlobInputType ¶
type BlobInputType string
type BlobOutput ¶
type BlobOutput struct {
Digest string
Size int64
Reader io.ReadCloser
}
BlobOutput is the output if read BlobInput.
type TarFileSystemOptions ¶
type TarFileSystemOptions struct {
IncludeFiles []string
ExcludeFiles []string
// PreserveDir defines that the directory specified in the Path field should be included in the blob.
// Only supported for Type dir.
PreserveDir bool
FollowSymlinks bool
// contains filtered or unexported fields
}
TarFileSystemOptions describes additional options for tarring a filesystem.
Click to show internal directories.
Click to hide internal directories.