core

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecretNameAccountRootTemplate = "%s-ac-root-%s"
	SecretNameAccountSignTemplate = "%s-ac-sign-%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountManager

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

func NewAccountManager

func NewAccountManager(
	natsClient outbound.NatsClient,
	accountReader outbound.AccountReader,
	secretClient outbound.SecretClient,
	clusterManager *ClusterManager,
) (*AccountManager, error)

func (*AccountManager) Create

func (*AccountManager) Delete

func (a *AccountManager) Delete(ctx context.Context, state *v1alpha1.Account) error

func (*AccountManager) Import

func (*AccountManager) SignUserJWT

func (a *AccountManager) SignUserJWT(ctx context.Context, accountRef domain.NamespacedName, claims *jwt.UserClaims) (*SignedUserJWT, error)

func (*AccountManager) Update

type ClusterManager

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

func NewClusterManager

func NewClusterManager(
	natsClusterReader outbound.NatsClusterReader,
	natsClient outbound.NatsClient,
	secretReader outbound.SecretReader,
	configMapReader outbound.ConfigMapReader,
	config *Config,
) (*ClusterManager, error)

func (*ClusterManager) GetClusterTarget

func (r *ClusterManager) GetClusterTarget(ctx context.Context, accountClusterRef *v1alpha1.NatsClusterRef) (*clusterTarget, error)

func (*ClusterManager) Validate

func (r *ClusterManager) Validate(ctx context.Context, state *v1alpha1.NatsCluster) error

type Config

type Config struct {
	OperatorNatsCluster *OperatorNatsCluster
	// OperatorNamespace is the Kubernetes namespace where the operator is deployed.
	// TODO: [#102][#144] When sunsetting DefaultNatsURL, remove this field if it no longer serves a purpose.
	OperatorNamespace domain.Namespace
	// DefaultNatsURL is a comma-separated list of NATS server URLs to use when OperatorNatsCluster is not configured.
	// Deprecated: This field is deprecated and will be removed in a future release.
	// TODO: [#102][#144] Sunset DefaultNatsURL (NATS_URL)
	DefaultNatsURL string
}

func NewConfig

func NewConfig(operatorNatsCluster *OperatorNatsCluster, operatorNamespace domain.Namespace, defaultNatsURL string) (*Config, error)

type OperatorNatsCluster

type OperatorNatsCluster struct {
	ClusterRef v1alpha1.NatsClusterRef
	// Optional controls account-level overrides when ClusterRef is configured.
	// false (default) means account-level cluster refs must not deviate.
	Optional bool
}

func NewOperatorNatsCluster

func NewOperatorNatsCluster(clusterRef v1alpha1.NatsClusterRef, optional bool) (*OperatorNatsCluster, error)

type Secrets

type Secrets struct {
	Root nkeys.KeyPair
	Sign nkeys.KeyPair
}

type SignedUserJWT

type SignedUserJWT struct {
	UserJWT   string
	AccountID string
	SignedBy  string
}

type UserJWTSigner

type UserJWTSigner interface {
	SignUserJWT(ctx context.Context, accountRef domain.NamespacedName, claims *jwt.UserClaims) (*SignedUserJWT, error)
}

type UserManager

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

func NewUserManager

func NewUserManager(userJWTSigner UserJWTSigner, secretClient outbound.SecretClient) *UserManager

func (*UserManager) CreateOrUpdate

func (u *UserManager) CreateOrUpdate(ctx context.Context, state *v1alpha1.User) error

func (*UserManager) Delete

func (u *UserManager) Delete(ctx context.Context, state *v1alpha1.User) error

Jump to

Keyboard shortcuts

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