gdrive

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 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 added in v0.10.7

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) (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 `kopia:"sensitive" json:"credentials,omitempty"`

	// 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