mirror of
https://github.com/kopia/kopia.git
synced 2026-03-17 05:38:34 -04:00
This updates the terminology everywhere - blocks become blobs and `storage.Storage` becomes `blob.Storage`. Also introduced blob.ID which is a specialized string type, that's different from CABS block ID. Also renamed CLI subcommands from `kopia storage` to `kopia blob`. While at it introduced `block.ErrBlockNotFound` and `object.ErrObjectNotFound` that do not leak from lower layers.
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gopkg.in/alecthomas/kingpin.v2"
|
|
|
|
"github.com/kopia/kopia/repo/blob"
|
|
"github.com/kopia/kopia/repo/blob/gcs"
|
|
)
|
|
|
|
func init() {
|
|
var options gcs.Options
|
|
|
|
RegisterStorageConnectFlags(
|
|
"google",
|
|
"a Google Cloud Storage bucket",
|
|
func(cmd *kingpin.CmdClause) {
|
|
cmd.Flag("bucket", "Name of the Google Cloud Storage bucket").Required().StringVar(&options.BucketName)
|
|
cmd.Flag("prefix", "Prefix to use for objects in the bucket").StringVar(&options.Prefix)
|
|
cmd.Flag("read-only", "Use read-only GCS scope to prevent write access").BoolVar(&options.ReadOnly)
|
|
cmd.Flag("credentials-file", "Use the provided JSON file with credentials").ExistingFileVar(&options.ServiceAccountCredentials)
|
|
cmd.Flag("max-download-speed", "Limit the download speed.").PlaceHolder("BYTES_PER_SEC").IntVar(&options.MaxDownloadSpeedBytesPerSecond)
|
|
cmd.Flag("max-upload-speed", "Limit the upload speed.").PlaceHolder("BYTES_PER_SEC").IntVar(&options.MaxUploadSpeedBytesPerSecond)
|
|
|
|
},
|
|
func(ctx context.Context, isNew bool) (blob.Storage, error) {
|
|
return gcs.New(ctx, &options)
|
|
},
|
|
)
|
|
}
|