gdrive

package
v0.0.0-...-58c64f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package gdrive implements Storage based on Google Drive.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDriveService

func CreateDriveService(ctx context.Context, opt *Options) (*drive.Service, error)

CreateDriveService creates a new Google Drive service, which encapsulates multiple clients used to access different Google Drive functionality. Exported for tests only.

func New

func New(ctx context.Context, opt *Options, isCreate bool) (blob.Storage, error)

New creates new Google Drive-backed storage with specified options:

- the 'folderID' field is required and all other parameters are optional.

By default the connection reuses credentials managed by (https://cloud.google.com/sdk/), but this can be disabled by setting IgnoreDefaultCredentials to true.

Types

type Options

type Options struct {
	// FolderId is Google Drive's ID of a folder where data is stored.
	FolderID string `json:"folderID"`

	// ServiceAccountCredentialsFile specifies the name of the file with Drive credentials.
	ServiceAccountCredentialsFile string `json:"credentialsFile,omitempty"`

	// ServiceAccountCredentialJSON specifies the raw JSON credentials.
	ServiceAccountCredentialJSON json.RawMessage `json:"credentials,omitempty" kopia:"sensitive"`

	// ReadOnly causes GCS connection to be opened with read-only scope to prevent accidental mutations.
	ReadOnly bool `json:"readOnly,omitempty"`

	throttling.Limits
}

Options defines options Google Cloud Storage-backed storage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL