commonadapter

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 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 ContextExtractor

type ContextExtractor func(ctx context.Context) map[string]interface{}

ContextExtractor extracts log fields from a context.

type Logger

type Logger struct {
	logur.LoggerFacade
	// contains filtered or unexported fields
}

Logger wraps a logur logger and exposes it under a custom interface.

func NewContextAwareLogger

func NewContextAwareLogger(logger logur.LoggerFacade, extractor ContextExtractor) *Logger

NewContextAwareLogger returns a new Logger instance that can extract information from a context.

func NewLogger

func NewLogger(logger logur.LoggerFacade) *Logger

NewLogger returns a new Logger instance.

func (*Logger) WithContext

func (l *Logger) WithContext(ctx context.Context) common.Logger

WithContext annotates a logger with a context.

func (*Logger) WithFields

func (l *Logger) WithFields(fields map[string]interface{}) common.Logger

WithFields annotates a logger with key-value pairs.

type OrgIDContextExtractor

type OrgIDContextExtractor interface {
	// GetOrganizationID extracts an organization ID from a context (if there is any).
	GetOrganizationID(ctx context.Context) (uint, bool)
}

OrgIDContextExtractor extracts an organization ID from a context (if there is any).

type OrgIDContextExtractorFunc

type OrgIDContextExtractorFunc func(ctx context.Context) (uint, bool)

OrgIDContextExtractorFunc converts an ordinary function to an OrgIDContextExtractor (given it's method signature is compatible with the interface).

func (OrgIDContextExtractorFunc) GetOrganizationID

func (f OrgIDContextExtractorFunc) GetOrganizationID(ctx context.Context) (uint, bool)

GetOrganizationID implements the OrgIDContextExtractor interface.

type ReadOnlyOrganizationalSecretStore

type ReadOnlyOrganizationalSecretStore interface {
	// Get returns a secret in the internal format of the secret store.
	Get(organizationID uint, secretID string) (*secret.SecretItemResponse, error)
}

type ReadWriteOrganizationalSecretStore

type ReadWriteOrganizationalSecretStore interface {
	ReadOnlyOrganizationalSecretStore

	Store(organizationID uint, request *secret.CreateSecretRequest) (string, error)

	// GetByName returns a secret in the internal format of the secret store based on secret name.
	GetByName(organizationID uint, name string) (*secret.SecretItemResponse, error)

	Delete(organizationID uint, secretID string) error
}

ReadWriteOrganizationalSecretStore is the global secret store that stores values under a compound key: the organization ID and a secret ID.

type SecretStore

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

SecretStore implements the common.SecretStore interface and acts as a lightweight wrapper around the global secret store.

func NewSecretStore

NewSecretStore returns a new SecretStore instance.

func (*SecretStore) Delete

func (s *SecretStore) Delete(ctx context.Context, secretID string) error

func (*SecretStore) GetIDByName

func (s *SecretStore) GetIDByName(ctx context.Context, secretName string) (string, error)

func (*SecretStore) GetNameByID

func (s *SecretStore) GetNameByID(ctx context.Context, secretID string) (string, error)

func (*SecretStore) GetSecretValues

func (s *SecretStore) GetSecretValues(ctx context.Context, secretID string) (map[string]string, error)

GetSecretValues implements the common.SecretStore interface.

Jump to

Keyboard shortcuts

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