offsite

package
v0.1.40 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventUpload = "upload"
)
View Source
const PlaceholderSecretKey = "%SAME-AS-BEFORE%" // #nosec G101 - not a hardcoded credential, just a placeholder

Variables

This section is empty.

Functions

func ValidateBucketPath

func ValidateBucketPath(path string) error

ValidateBucketPath validates the S3 bucket path format

func ValidateOffsiteConfig

func ValidateOffsiteConfig(config *OffsiteSettingsJSON) error

ValidateOffsiteConfig validates the offsite configuration

Types

type OffsiteLog

type OffsiteLog struct {
	ID                int64            `db:"id" json:"id"`
	Event             string           `db:"event" json:"event"`
	OffsiteSettingsID int64            `db:"offsite_settings_id" json:"offsiteSettingsId"`
	Object            string           `db:"object" json:"object"`
	Success           bool             `db:"success" json:"success"`
	ErrorDetails      *string          `db:"error_details" json:"errorDetails,omitempty"`
	CreatedAt         rfc3339time.Time `db:"created_at" json:"createdAt"`
}

type OffsiteSettings

type OffsiteSettings struct {
	ID              int64            `db:"id" json:"id"`
	Active          bool             `db:"active" json:"active"`
	Type            OffsiteType      `db:"type" json:"type"`
	Bucket          string           `db:"bucket" json:"bucket"`
	Endpoint        *string          `db:"endpoint" json:"endpoint,omitempty"`
	Region          *string          `db:"region" json:"region,omitempty"`
	AccessKeyID     string           `db:"access_key_id" json:"accessKeyId"`
	SecretAccessKey string           `db:"secret_access_key" json:"-"`
	BucketPath      *string          `db:"bucket_path" json:"bucketPath,omitempty"`
	EC2IAMRole      bool             `db:"ec2_iam_role" json:"ec2IamRole"`
	CreatedAt       rfc3339time.Time `db:"created_at" json:"createdAt"`
	UpdatedAt       rfc3339time.Time `db:"updated_at" json:"updatedAt"`
}

type OffsiteSettingsJSON

type OffsiteSettingsJSON struct {
	Type            OffsiteType `json:"type"`
	Bucket          string      `json:"bucket"`
	Endpoint        *string     `json:"endpoint,omitempty"`
	Region          *string     `json:"region,omitempty"`
	AccessKeyID     string      `json:"accessKeyId"`
	SecretAccessKey string      `json:"secretAccessKey"`
	BucketPath      *string     `json:"bucketPath,omitempty"`
	EC2IAMRole      bool        `json:"ec2IamRole"`
}

type OffsiteStore

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

func NewOffsiteStore

func NewOffsiteStore(db *sqlx.DB) *OffsiteStore

func (*OffsiteStore) AddLog

func (s *OffsiteStore) AddLog(log *OffsiteLog) error

func (*OffsiteStore) Create

func (s *OffsiteStore) Create(settings *OffsiteSettings) error

func (*OffsiteStore) GetActive

func (s *OffsiteStore) GetActive() (*OffsiteSettings, error)

func (*OffsiteStore) GetByID

func (s *OffsiteStore) GetByID(id int64) (*OffsiteSettings, error)

func (*OffsiteStore) GetLogs

func (s *OffsiteStore) GetLogs(limit int) ([]OffsiteLog, error)

func (*OffsiteStore) GetPreviousSecretKey

func (s *OffsiteStore) GetPreviousSecretKey() (string, error)

func (*OffsiteStore) ListAllSecrets

func (s *OffsiteStore) ListAllSecrets() ([]SecretRow, error)

ListAllSecrets returns the stored secret of every offsite settings row (active or not — inactive rows back the '%SAME-AS-BEFORE%' apply flow).

func (*OffsiteStore) Remove

func (s *OffsiteStore) Remove() error

func (*OffsiteStore) UpdateSecretAccessKey

func (s *OffsiteStore) UpdateSecretAccessKey(id int64, encryptedSecret string) error

UpdateSecretAccessKey replaces the stored secret of one settings row.

type OffsiteType

type OffsiteType string
const (
	TypeS3 OffsiteType = "s3"
)

type SecretRow

type SecretRow struct {
	ID              int64  `db:"id"`
	SecretAccessKey string `db:"secret_access_key"`
}

SecretRow pairs an offsite settings row ID with its stored (encrypted) secret access key, for the daemon's startup re-encryption sweep.

Jump to

Keyboard shortcuts

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