validation

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct{}

Backend performs validation with real clusters.

func (Backend) ApplicationNamespaces added in v0.9.0

func (b Backend) ApplicationNamespaces(
	ctx Context,
	drpcName, drpcNamespace string,
) ([]string, error)

ApplicationNamespaces inspects the application DRPC and returns the application namespaces on the hub and managed clusters.

func (Backend) CheckS3 added in v0.15.0

func (b Backend) CheckS3(ctx Context, profiles []*s3.Profile) <-chan s3.Result

func (Backend) Gather added in v0.9.0

func (b Backend) Gather(
	ctx Context,
	clusters []*types.Cluster,
	options gathering.Options,
) <-chan gathering.Result

func (Backend) GatherS3 added in v0.13.0

func (b Backend) GatherS3(
	ctx Context,
	profiles []*s3.Profile,
	prefixes []string,
	outputDir string,
) <-chan s3.Result

func (Backend) Validate

func (b Backend) Validate(ctx Context) error

Validate the environment. Must be called once before calling other functions.

type Context

type Context interface {
	Env() *types.Env
	Config() *config.Config
	Logger() *zap.SugaredLogger
	Context() context.Context
}

Context is validation context, decoupling the ramenctl command from the backend implementation.

type ContextFunc

type ContextFunc func(Context) error

type Mock

type Mock struct {
	ValidateFunc              ContextFunc
	ApplicationNamespacesFunc func(ctx Context, drpcName, drpcNamespace string) ([]string, error)
	GatherFunc                func(ctx Context, clsuters []*types.Cluster, options gathering.Options) <-chan gathering.Result
	GatherS3Func              func(ctx Context, profiles []*s3.Profile, prefixes []string, outputDir string) <-chan s3.Result
	CheckS3Func               func(ctx Context, profiles []*s3.Profile) <-chan s3.Result
}

Mock implements the Validation interface. All operations succeed without accessing the clusters. To cause operations to fail or return non default values, set a function returning an error.

func (*Mock) ApplicationNamespaces added in v0.9.0

func (m *Mock) ApplicationNamespaces(
	ctx Context,
	drpcName, drpcNamespace string,
) ([]string, error)

func (*Mock) CheckS3 added in v0.15.0

func (m *Mock) CheckS3(ctx Context, profiles []*s3.Profile) <-chan s3.Result

func (*Mock) Gather added in v0.9.0

func (m *Mock) Gather(
	ctx Context,
	clusters []*types.Cluster,
	options gathering.Options,
) <-chan gathering.Result

func (*Mock) GatherS3 added in v0.13.0

func (m *Mock) GatherS3(
	ctx Context,
	profiles []*s3.Profile,
	prefixes []string,
	outputDir string,
) <-chan s3.Result

func (*Mock) Validate

func (m *Mock) Validate(ctx Context) error

type Validation

type Validation interface {
	Validate(ctx Context) error
	ApplicationNamespaces(ctx Context, drpcName, drpcNamespace string) ([]string, error)
	Gather(
		ctx Context,
		clusters []*types.Cluster,
		options gathering.Options,
	) <-chan gathering.Result
	GatherS3(
		ctx Context,
		profiles []*s3.Profile,
		prefixes []string,
		outputDir string,
	) <-chan s3.Result
	CheckS3(ctx Context, profiles []*s3.Profile) <-chan s3.Result
}

Validation provides the validation operations.

Jump to

Keyboard shortcuts

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