Documentation ¶
Index ¶
- Constants
- func GetDefaultCollectorCredentialsDirectory() (string, error)
- func HashKeyToEncryptionKey(key string) ([]byte, error)
- func HashKeyToEncryptionKeyWith(hasher Hasher, key string) ([]byte, error)
- func HashKeyToFilename(key string) (string, error)
- func HashKeyToFilenameWith(hasher Hasher, key string) (string, error)
- type CollectorCredentials
- type Hasher
- type LocalFsStore
- type LocalFsStoreOpt
- type Store
Constants ¶
const (
DefaultCollectorDataDirectory = ".sumologic-otel-collector/"
)
Variables ¶
This section is empty.
Functions ¶
func HashKeyToEncryptionKey ¶
HashKeyToEncryptionKey creates an encryption key using a default hasher. It returns the created key and an error.
func HashKeyToEncryptionKeyWith ¶
HashKeyToEncryptionKeyWith creates a 32 bytes long key from the provided key using the provided hasher.
func HashKeyToFilename ¶
HashKeyToFilename creates a filename using the default hasher and provided key as input. It returns this filename and an error.
Types ¶
type CollectorCredentials ¶
type CollectorCredentials struct { // CollectorName indicates what name was set in the configuration when // registration has been made. CollectorName string `json:"collectorName"` Credentials api.OpenRegisterResponsePayload `json:"collectorCredentials"` // APIBaseURL saves the destination API base URL which was used for registration. // This is used for instance when the API redirects the collector to a different // deployment due to the fact that the installation token being used for registration // belongs to a different deployment. // In order to make collector registration work, we save the destination // API base URL so that when the collector starts up again it can use this // API base URL for communication with the backend. APIBaseURL string `json:"apiBaseUrl"` }
CollectorCredentials are used for storing the credentials received during collector registration.
type LocalFsStore ¶
type LocalFsStore struct {
// contains filtered or unexported fields
}
LocalFsStore implements Store interface and can be used to store and retrieve collector credentials from local file system.
Files are stored locally in collectorCredentialsDirectory.
func (LocalFsStore) Check ¶
func (cr LocalFsStore) Check(key string) bool
Check checks if collector credentials can be found under a name being a hash of provided key inside collectorCredentialsDirectory.
func (LocalFsStore) Delete ¶
func (cr LocalFsStore) Delete(key string) error
func (LocalFsStore) Get ¶
func (cr LocalFsStore) Get(key string) (CollectorCredentials, error)
Get retrieves collector credentials stored in local file system and then decrypts it using a hash of provided key.
func (LocalFsStore) Store ¶
func (cr LocalFsStore) Store(key string, creds CollectorCredentials) error
Store stores collector credentials in a file in directory as specified in CollectorCredentialsDirectory. The credentials are encrypted using the provided key.
func (LocalFsStore) Validate ¶
func (cr LocalFsStore) Validate() error
Validate checks if the store is operating correctly This mostly means file permissions and the like
type LocalFsStoreOpt ¶
type LocalFsStoreOpt func(*LocalFsStore)
func WithCredentialsDirectory ¶
func WithCredentialsDirectory(dir string) LocalFsStoreOpt
func WithLogger ¶
func WithLogger(l *zap.Logger) LocalFsStoreOpt
type Store ¶
type Store interface { // Check checks if collector credentials exist under the specified key. Check(key string) bool // Get returns the collector credentials stored under a specified key. Get(key string) (CollectorCredentials, error) // Store stores the provided collector credentials stored under a specified key. Store(key string, creds CollectorCredentials) error // Delete deletes collector credentials stored under the specified key. Delete(key string) error // Validate checks if the store is operating correctly Validate() error }
Store is an interface to get collector authentication data
func NewLocalFsStore ¶
func NewLocalFsStore(opts ...LocalFsStoreOpt) (Store, error)