Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteDriveBackup ¶ added in v1.0.0
DeleteDriveBackup deletes the specified backup file in linux/backups.
func DownloadFromDrive ¶ added in v1.0.0
DownloadFromDrive downloads a file from Google Drive /linux/backups/[filename] to localPath.
func GetLatestDriveBackup ¶ added in v1.0.0
GetLatestDriveBackup returns the name of the most recently modified .tar.xz file in linux/backups/
func ListDriveBackups ¶ added in v1.0.0
ListDriveBackups returns the names of .tar.xz files in linux/backups.
func UploadToDrive ¶ added in v1.0.0
UploadToDrive uploads a local file to Google Drive at /linux/backups/[filename]. This is left as a convenience wrapper using the underlying service. It preserves previous behavior.
Types ¶
type DriveClient ¶ added in v1.0.0
type DriveClient struct {
// contains filtered or unexported fields
}
DriveClient provides a small filesystem-like API over Google Drive.
func NewDriveClient ¶ added in v1.0.0
func NewDriveClient(ctx context.Context, basePath []string) (*DriveClient, error)
NewDriveClient creates and authenticates a DriveClient. If basePath is nil, the client will operate relative to Drive root unless absolute paths are provided.
func (*DriveClient) Ls ¶ added in v1.0.0
func (c *DriveClient) Ls(ctx context.Context, path string) ([]DriveEntry, error)
Ls lists the files and folders at the provided Drive-style path. Examples:
"" or "/" -> list root "linux/backups" -> list that folder "linux" -> list linux folder
It does not create missing folders; if the specified path doesn't exist, an error is returned.
func (*DriveClient) Rm ¶ added in v1.0.0
func (c *DriveClient) Rm(ctx context.Context, path string) error
Rm deletes the file(s) specified by the path. Path should be like "linux/backups/mybackup.tar.xz". If multiple files match the name in the target folder, all matches are deleted. It will not delete folders unless the last path component is an explicit folder name and matches Drive entries.