git

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: 27 Imported by: 0

Documentation

Index

Constants

View Source
const DriverName = "git"

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	// SSH holds auth details for the SSH protocol.
	SSH *SSHAuth `yaml:"ssh,omitempty"`
	// HTTPS holds auth details for the HTTPS protocol.
	HTTPS *HTTPSAuth `yaml:"https,omitempty"`
	// OperationTimeout specifies the timeout for git operations.
	OperationTimeout *time.Duration `yaml:"operationTimeout,omitempty" conf:",example=60s"`
	// Protocol is the Git protocol to use. Valid values are https, ssh, and file.
	Protocol string `yaml:"protocol" conf:"required,example=file"`
	// URL is the URL to the Git repo.
	URL string `yaml:"url" conf:"required,example=file://${HOME}/tmp/cerbos/policies"`
	// Branch is the branch to checkout.
	Branch string `yaml:"branch" conf:",example=policies"`
	// SubDir is the path under the checked-out Git repo where the policies are stored.
	SubDir string `yaml:"subDir,omitempty" conf:",example=policies"`
	// CheckoutDir is the local path to checkout the Git repo to.
	CheckoutDir string `yaml:"checkoutDir" conf:",example=${HOME}/tmp/cerbos/work"`
	// [DEPRECATED] ScratchDir is the directory to use for holding temporary data.
	ScratchDir string `yaml:"scratchDir" conf:",ignore"`
	// UpdatePollInterval specifies the interval to poll the Git repository for changes. Set to 0 to disable.
	UpdatePollInterval time.Duration `yaml:"updatePollInterval" conf:",example=60s"`
}

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

func GetConf added in v0.15.0

func GetConf() (*Conf, error)

func (*Conf) Key

func (conf *Conf) Key() string

func (*Conf) Validate

func (conf *Conf) Validate() (errs error)

type HTTPSAuth

type HTTPSAuth struct {
	// The username to use for authentication.
	Username string `yaml:"username" conf:",example=cerbos"`
	// The password (or token) to use for authentication.
	Password string `yaml:"password" conf:",example=${GITHUB_TOKEN}"`
}

HTTPSAuth holds auth details for the HTTPS protocol.

func (*HTTPSAuth) Auth

func (ha *HTTPSAuth) Auth() (transport.AuthMethod, error)

type SSHAuth

type SSHAuth struct {
	// The git user. Defaults to git.
	User string `yaml:"user" conf:",example=git"`
	// The path to the SSH private key file.
	PrivateKeyFile string `yaml:"privateKeyFile" conf:",example=${HOME}/.ssh/id_rsa"`
	// The password to the SSH private key.
	Password string `yaml:"password" conf:",example=pw"`
}

SSHAuth holds auth details for the SSH protocol.

func (*SSHAuth) Auth

func (sa *SSHAuth) Auth() (transport.AuthMethod, error)

type Store

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

func NewStore

func NewStore(ctx context.Context, conf *Conf) (*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

Jump to

Keyboard shortcuts

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