blob

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const DriverName = "blob"

Variables

View Source
var ErrPartialFailureToDownloadOnInit = errors.New("failed to download some files from the bucket")
View Source
var ErrUnsupportedBucketScheme = errors.New("currently only \"s3\" and \"gs\" bucket URL schemes are supported")

Functions

This section is empty.

Types

type CloneResult

type CloneResult struct {
	// contains filtered or unexported fields
}

type Cloner

type Cloner struct {
	// contains filtered or unexported fields
}

func NewCloner

func NewCloner(bucket *blob.Bucket, fsys clonerFS) (*Cloner, error)

NewCloner creates an object to clone the bucket and saves supported files in the fsys.

func (*Cloner) Clone

func (c *Cloner) Clone(ctx context.Context) (*CloneResult, error)

type Conf

type Conf struct {
	// DownloadTimeout specifies the timeout for downloading from cloud storage.
	DownloadTimeout *time.Duration `yaml:"downloadTimeout,omitempty" conf:",example=30s"`
	// RequestTimeout specifies the timeout for an HTTP request.
	RequestTimeout *time.Duration `yaml:"requestTimeout,omitempty" conf:",example=10s"`
	// Bucket URL (Examples: s3://my-bucket?region=us-west-1 gs://my-bucket azblob://my-container).
	Bucket string `yaml:"bucket" conf:"required,example=\"s3://my-bucket-name?region=us-east-2\""`
	// Prefix specifies a subdirectory to download.
	Prefix string `yaml:"prefix,omitempty" conf:",example=policies"`
	// WorkDir is the local path to check out policies to.
	WorkDir string `yaml:"workDir" conf:",example=${HOME}/tmp/cerbos/work"`
	// UpdatePollInterval specifies the interval to poll the cloud storage. Set to 0 to disable.
	UpdatePollInterval time.Duration `yaml:"updatePollInterval" conf:",example=15s"`
}

Conf is required (if driver is set to 'blob') configuration for cloud storage driver. +desc=This section is required only if storage.driver is blob.

func GetConf added in v0.15.0

func GetConf() (*Conf, error)

func (*Conf) Key

func (conf *Conf) Key() string

func (*Conf) SetDefaults

func (conf *Conf) SetDefaults()

func (*Conf) Validate

func (conf *Conf) Validate() error

type Store

type Store struct {
	*storage.SubscriptionManager
	// contains filtered or unexported fields
}

func NewStore

func NewStore(ctx context.Context, conf *Conf, cloner bucketCloner) (*Store, error)

func (*Store) Driver

func (s *Store) Driver() string

func (*Store) GetCompilationUnits

func (s *Store) GetCompilationUnits(_ context.Context, ids ...namer.ModuleID) (map[namer.ModuleID]*policy.CompilationUnit, error)

func (*Store) GetDependents

func (s *Store) GetDependents(_ context.Context, ids ...namer.ModuleID) (map[namer.ModuleID][]namer.ModuleID, error)

func (*Store) GetFirstMatch added in v0.29.0

func (s *Store) GetFirstMatch(_ context.Context, candidates []namer.ModuleID) (*policy.CompilationUnit, error)

func (*Store) InspectPolicies added in v0.35.0

func (*Store) ListPolicyIDs added in v0.12.0

func (s *Store) ListPolicyIDs(ctx context.Context, _ storage.ListPolicyIDsParams) ([]string, error)

func (*Store) ListSchemaIDs added in v0.11.0

func (s *Store) ListSchemaIDs(ctx context.Context) ([]string, error)

func (*Store) LoadPolicy added in v0.12.0

func (s *Store) LoadPolicy(ctx context.Context, file ...string) ([]*policy.Wrapper, error)

func (*Store) LoadSchema added in v0.11.0

func (s *Store) LoadSchema(ctx context.Context, url string) (io.ReadCloser, error)

func (*Store) Reload added in v0.15.0

func (s *Store) Reload(ctx context.Context) error

func (*Store) RepoStats added in v0.15.0

func (s *Store) RepoStats(ctx context.Context) storage.RepoStats

func (*Store) Subscribe

func (s *Store) Subscribe(sub storage.Subscriber)

Jump to

Keyboard shortcuts

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