mirror of
https://github.com/kopia/kopia.git
synced 2026-01-28 00:08:04 -05:00
* throtting: implemented a Throttler based on token bucket and configurable window. * cli: rewired throttle options to use common Limits structure and helpers The JSON is backwards compatible. * blob: remove explicit throttling from gcs,s3,b2 & azure * cleanup: removed internal/throttle * repo: add throttling wrapper around storage at the repository level * throttling: expose APIs to get limits and add validation * server: expose API to get/set throttle in a running server * pr feedback
31 lines
1.3 KiB
Go
31 lines
1.3 KiB
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/alecthomas/kingpin"
|
|
|
|
"github.com/kopia/kopia/repo/blob"
|
|
"github.com/kopia/kopia/repo/blob/azure"
|
|
)
|
|
|
|
type storageAzureFlags struct {
|
|
azOptions azure.Options
|
|
}
|
|
|
|
func (c *storageAzureFlags) setup(_ storageProviderServices, cmd *kingpin.CmdClause) {
|
|
cmd.Flag("container", "Name of the Azure blob container").Required().StringVar(&c.azOptions.Container)
|
|
cmd.Flag("storage-account", "Azure storage account name (overrides AZURE_STORAGE_ACCOUNT environment variable)").Required().Envar("AZURE_STORAGE_ACCOUNT").StringVar(&c.azOptions.StorageAccount)
|
|
cmd.Flag("storage-key", "Azure storage account key (overrides AZURE_STORAGE_KEY environment variable)").Envar("AZURE_STORAGE_KEY").StringVar(&c.azOptions.StorageKey)
|
|
cmd.Flag("storage-domain", "Azure storage domain").Envar("AZURE_STORAGE_DOMAIN").StringVar(&c.azOptions.StorageDomain)
|
|
cmd.Flag("sas-token", "Azure SAS Token").Envar("AZURE_STORAGE_SAS_TOKEN").StringVar(&c.azOptions.SASToken)
|
|
cmd.Flag("prefix", "Prefix to use for objects in the bucket").StringVar(&c.azOptions.Prefix)
|
|
|
|
commonThrottlingFlags(cmd, &c.azOptions.Limits)
|
|
}
|
|
|
|
func (c *storageAzureFlags) connect(ctx context.Context, isCreate bool, formatVersion int) (blob.Storage, error) {
|
|
// nolint:wrapcheck
|
|
return azure.New(ctx, &c.azOptions)
|
|
}
|