subscription

package
v1.8.8 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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSubscriberRegistry = MustNewSubscriberRegistry()

Functions

This section is empty.

Types

type CacheByTagPolicy

type CacheByTagPolicy string

CacheByTagPolicy represents a policy regarding caching of container image metadata using image tags as keys.

const (
	// CacheByTagPolicyForbid indicates that caching by tag is forbidden. This
	// is silently enforced. Any container image subscription that opts into
	// caching by tag will be treated as if it does not.
	CacheByTagPolicyForbid CacheByTagPolicy = "Forbid"
	// CacheByTagPolicyAllow indicates that caching by tag is allowed. Container
	// image subscriptions may opt into caching by tag.
	CacheByTagPolicyAllow CacheByTagPolicy = "Allow"
	// CacheByTagPolicyRequire indicates that caching by tag is required.
	// Container image subscriptions must explicitly opt into caching by tag or
	// their artifact discovery processes will fail. Requiring the explicit opt-in
	// is tantamount to acknowledging the cache by tag behavior to minimize the
	// potential for developers to be taken by surprise. This option sacrifices
	// some small degree of usability for safety.
	CacheByTagPolicyRequire CacheByTagPolicy = "Require"
	// CacheByTagPolicyForce indicates that caching by tag is forced. This is
	// silently enforced. Any container image subscription that does not opt into
	// caching by tag will be treated as if it does.
	CacheByTagPolicyForce CacheByTagPolicy = "Force"
)

type MockSubscriber

type MockSubscriber struct {
	ApplySubscriptionDefaultsFn func(
		ctx context.Context,
		sub *kargoapi.RepoSubscription,
	) error
	ValidateSubscriptionFn func(
		ctx context.Context,
		f *field.Path,
		sub kargoapi.RepoSubscription,
	) field.ErrorList
	DiscoverArtifactsFn func(
		ctx context.Context,
		project string,
		sub kargoapi.RepoSubscription,
	) (any, error)
}

func (*MockSubscriber) ApplySubscriptionDefaults

func (m *MockSubscriber) ApplySubscriptionDefaults(
	ctx context.Context,
	sub *kargoapi.RepoSubscription,
) error

func (*MockSubscriber) DiscoverArtifacts

func (m *MockSubscriber) DiscoverArtifacts(
	ctx context.Context,
	project string,
	sub kargoapi.RepoSubscription,
) (any, error)

func (*MockSubscriber) ValidateSubscription

func (m *MockSubscriber) ValidateSubscription(
	ctx context.Context,
	f *field.Path,
	sub kargoapi.RepoSubscription,
) field.ErrorList

type Subscriber

type Subscriber interface {
	// ApplySubscriptionDefaults applies default values to the provided
	// kargoapi.RepoSubscription.
	ApplySubscriptionDefaults(
		ctx context.Context,
		sub *kargoapi.RepoSubscription,
	) error
	// ValidateSubscription validates the provided kargoapi.RepoSubscription.
	ValidateSubscription(
		ctx context.Context,
		f *field.Path,
		sub kargoapi.RepoSubscription,
	) field.ErrorList
	// DiscoverArtifacts discovers artifacts according to the parameters of the
	// provided kargoapi.RepoSubscription. Implementations may return a value of
	// any type, but in practice, callers can only make sense of:
	// - kargoapi.ChartDiscoveryResult
	// - kargoapi.GitDiscoveryResult
	// - kargoapi.ImageDiscoveryResult
	// - kargoapi.DiscoveryResult
	DiscoverArtifacts(
		ctx context.Context,
		project string,
		sub kargoapi.RepoSubscription,
	) (any, error)
}

Subscriber is an interface to be implemented by components that can extract relevant subscription details from a kargoapi.RepoSubscription and use them to discover corresponding artifacts.

type SubscriberFactory

type SubscriberFactory = func(
	context.Context,
	credentials.Database,
) (Subscriber, error)

type SubscriberPredicate

type SubscriberPredicate = func(
	context.Context,
	kargoapi.RepoSubscription,
) (bool, error)

Jump to

Keyboard shortcuts

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