interfaces

package
v1.0.33 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BootstrapHandler

type BootstrapHandler func(
	ctx context.Context,
	wg *sync.WaitGroup,
	startupTimer startup.Timer,
	dic *di.Container) (success bool)

BootstrapHandler defines the contract each bootstrap handler must fulfill. Implementation returns true if the handler completed successfully, false if it did not.

type Configuration added in v1.0.4

type Configuration interface {

	// GetBootstrap returns the configuration elements required by the bootstrap.
	GetBootstrap() config.BootstrapConfiguration

	// GetLogLevel returns the current ConfigurationStruct's log level.
	GetLogLevel() string

	// GetInsecureSecrets gets the config.InsecureSecrets field from the configuration struct.
	GetInsecureSecrets() config.InsecureSecrets

	// GetMqtt5Configs gets the config.Mqtt5Configs from the configuration struct.
	GetMqtt5Configs() config.Mqtt5Configs
}

Configuration interface provides an abstraction around a configuration struct.

type SecretProvider

type SecretProvider interface {
	// StoreSecret stores new secrets into the service's SecretStore at the specified secretName.
	StoreSecret(secretName string, secrets map[string]string) error

	// GetSecret retrieves secrets from the service's SecretStore at the specified secretName.
	GetSecret(secretName string, keys ...string) (map[string]string, error)

	// SecretsLastUpdated returns the last time secrets were updated
	SecretsLastUpdated() time.Time

	// ListSecretNames returns a list of secretNames for the current service from an insecure/secure secret store.
	ListSecretNames() ([]string, error)

	// HasSecret returns true if the service's SecretStore contains a secret at the specified secretName.
	HasSecret(secretName string) (bool, error)

	// RegisterSecretUpdatedCallback registers a callback for a secret. If you specify 'SecretNameWildcard'
	// as the secretName, then the callback will be called for any updated secret. Callbacks set for a specific
	// secretName are given a higher precedence over wildcard ones, and will be called instead of the wildcard one
	// if both are present.
	RegisterSecretUpdatedCallback(secretName string, callback func(secretName string)) error

	// DeregisterSecretUpdatedCallback removes a secret's registered callback secretName.
	DeregisterSecretUpdatedCallback(secretName string)
}

SecretProvider defines the contract for secret provider implementations that allow secrets to be retrieved/stored from/to a services Secret Store and other secret related APIs. This interface is limited to the APIs that individual service code need.

type SecretProviderExt

type SecretProviderExt interface {
	SecretProvider

	// SecretsUpdated sets the secrets last updated time to current time.
	SecretsUpdated()

	// GetAccessToken return an access token for the specified token type and service key.
	// Service key is use as the access token role which must have be previously setup.
	GetAccessToken(tokenType string, serviceKey string) (string, error)

	// SecretUpdatedAtSecretName performs updates and callbacks for an updated secret or secretName.
	SecretUpdatedAtSecretName(secretName string)

	// GetMetricsToRegister returns all metric objects that needs to be registered.
	GetMetricsToRegister() map[string]any

	// GetSelfJWT returns an encoded JWT for the current identity-based secret store token
	GetSelfJWT() (string, error)

	// IsJWTValid evaluates a given JWT and returns a true/false if the JWT is valid (i.e. belongs to us and current) or not
	IsJWTValid(jwt string) (bool, error)
}

SecretProviderExt defines the extended contract for secret provider implementations that provide additional APIs needed only from the bootstrap code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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