adapters

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewArchiverAdapter

func NewArchiverAdapter() interfaces.Archiver

NewArchiverAdapter creates a new archiver adapter

func NewConsulAdapter

func NewConsulAdapter() (interfaces.ConsulClient, error)

NewConsulAdapter creates a new consul adapter

func NewFileSystemAdapter

func NewFileSystemAdapter() interfaces.FileSystem

NewFileSystemAdapter creates a new filesystem adapter

func NewGCSAdapter

func NewGCSAdapter() (interfaces.StorageClient, error)

NewGCSAdapter creates a new GCS adapter

func NewLoggerAdapter

func NewLoggerAdapter() interfaces.Logger

NewLoggerAdapter creates a new logger adapter

func NewS3Adapter

func NewS3Adapter(region, endpoint, encryption, kmsKeyID string) interfaces.StorageClient

NewS3Adapter creates a new S3 adapter

Types

type ArchiverAdapter

type ArchiverAdapter struct{}

ArchiverAdapter implements the Archiver interface

func (*ArchiverAdapter) TarGz

func (a *ArchiverAdapter) TarGz(destination string, sources []string) error

TarGz creates a tar.gz archive

func (*ArchiverAdapter) UnTarGz

func (a *ArchiverAdapter) UnTarGz(source, destination string) error

UnTarGz extracts a tar.gz archive

type ConsulAdapter

type ConsulAdapter struct {
	Client *consulapi.Client
}

ConsulAdapter implements the ConsulClient interface

func (*ConsulAdapter) CreateACL

func (c *ConsulAdapter) CreateACL(acl *consulapi.ACLEntry) error

CreateACL creates an ACL in consul

func (*ConsulAdapter) CreatePQ

CreatePQ creates a prepared query in consul

func (*ConsulAdapter) ListACLs

func (c *ConsulAdapter) ListACLs() ([]*consulapi.ACLEntry, error)

ListACLs lists all ACLs from consul

func (*ConsulAdapter) ListKeys

func (c *ConsulAdapter) ListKeys() (consulapi.KVPairs, error)

ListKeys lists all keys from consul

func (*ConsulAdapter) ListPQs

ListPQs lists all prepared queries from consul

func (*ConsulAdapter) PutKV

func (c *ConsulAdapter) PutKV(key string, value []byte) error

PutKV puts a key-value pair in consul

type FileSystemAdapter

type FileSystemAdapter struct{}

FileSystemAdapter implements the FileSystem interface

func (*FileSystemAdapter) MkdirAll

func (f *FileSystemAdapter) MkdirAll(path string, perm int) error

MkdirAll creates directories

func (*FileSystemAdapter) ReadFile

func (f *FileSystemAdapter) ReadFile(filename string) ([]byte, error)

ReadFile reads data from a file

func (*FileSystemAdapter) Remove

func (f *FileSystemAdapter) Remove(path string) error

Remove removes a file

func (*FileSystemAdapter) RemoveAll

func (f *FileSystemAdapter) RemoveAll(path string) error

RemoveAll removes a directory and all its contents

func (*FileSystemAdapter) WriteFile

func (f *FileSystemAdapter) WriteFile(filename string, data []byte, perm int) error

WriteFile writes data to a file

type GCSAdapter

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

GCSAdapter implements StorageClient for Google Cloud Storage

func (*GCSAdapter) Download

func (g *GCSAdapter) Download(bucket, key string) ([]byte, error)

Download downloads data from GCS

func (*GCSAdapter) Upload

func (g *GCSAdapter) Upload(bucket, key string, data []byte) error

Upload uploads data to GCS

type LoggerAdapter

type LoggerAdapter struct{}

LoggerAdapter implements the Logger interface

func (*LoggerAdapter) Fatal

func (l *LoggerAdapter) Fatal(args ...interface{})

Fatal logs and exits

func (*LoggerAdapter) Fatalf

func (l *LoggerAdapter) Fatalf(format string, args ...interface{})

Fatalf logs with format and exits

func (*LoggerAdapter) Print

func (l *LoggerAdapter) Print(args ...interface{})

Print logs without format

func (*LoggerAdapter) Printf

func (l *LoggerAdapter) Printf(format string, args ...interface{})

Printf logs with format

type S3Adapter

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

S3Adapter implements StorageClient for AWS S3

func (*S3Adapter) Download

func (s *S3Adapter) Download(bucket, key string) ([]byte, error)

Download downloads data from S3

func (*S3Adapter) Upload

func (s *S3Adapter) Upload(bucket, key string, data []byte) error

Upload uploads data to S3

Jump to

Keyboard shortcuts

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