handler

package
v0.0.0-...-26f57ef Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupHandler

type BackupHandler struct {
	Broker   RabbitBroker
	Endpoint GraphQLEndpoint
	// contains filtered or unexported fields
}

BackupHandler .

func (*BackupHandler) WebhookHandler

func (b *BackupHandler) WebhookHandler(w http.ResponseWriter, r *http.Request)

WebhookHandler handles processing the actual webhooks that come in via the http listener

type BackupInterface

type BackupInterface interface {
	WebhookHandler(w http.ResponseWriter, r *http.Request)
}

BackupInterface .

func NewBackupHandler

func NewBackupHandler(broker RabbitBroker, graphql GraphQLEndpoint) (BackupInterface, error)

NewBackupHandler .

type BackupMetrics

type BackupMetrics struct {
	BackupStartTimestamp int         `json:"backup_start_timestamp"`
	BackupEndTimestamp   int         `json:"backup_end_timestamp"`
	Errors               int         `json:"errors"`
	NewFiles             int         `json:"new_files"`
	ChangedFiles         int         `json:"changed_files"`
	UnmodifiedFiles      int         `json:"unmodified_files"`
	NewDirs              int         `json:"new_dirs"`
	ChangedDirs          int         `json:"changed_dirs"`
	UnmodifiedDirs       int         `json:"unmodified_dirs"`
	DataTransferred      int         `json:"data_transferred"`
	MountedPVCs          interface{} `json:"mounted_PVCs"`
	Folder               string      `json:"Folder"`
}

BackupMetrics - metrics from the backup data

type Backups

type Backups struct {
	Name            string        `json:"name"`
	BucketName      string        `json:"bucket_name"`
	BackupMetrics   BackupMetrics `json:"backup_metrics"`
	Snapshots       []Snapshot    `json:"snapshots"`
	RestoreLocation string        `json:"restore_location"`
	SnapshotID      string        `json:"snapshot_ID"`
	RestoredFiles   []string      `json:"restored_files"`
}

Backups - this is used for the actual backup data in the body of the webhook

type GraphQLEndpoint

type GraphQLEndpoint struct {
	Endpoint        string `json:"endpoint"`
	JWTAudience     string `json:"audience"`
	TokenSigningKey string `json:"tokenSigningKey"`
}

GraphQLEndpoint .

type RabbitBroker

type RabbitBroker struct {
	Hostname     string `json:"hostname"`
	Port         string `json:"port"`
	Username     string `json:"username,omitempty"`
	Password     string `json:"password,omitempty"`
	QueueName    string `json:"queueName"`
	ExchangeName string `json:"exchangeName"`
}

RabbitBroker .

type Snapshot

type Snapshot struct {
	ID       string      `json:"id"`
	Time     time.Time   `json:"time"`
	Tree     string      `json:"tree"`
	Paths    []string    `json:"paths"`
	Hostname string      `json:"hostname"`
	Username string      `json:"username"`
	UID      int         `json:"uid"`
	Gid      int         `json:"gid"`
	Tags     interface{} `json:"tags"`
}

Snapshot - information about each snapshot in a backup

type Webhook

type Webhook struct {
	Webhooktype string  `json:"webhooktype"`
	Event       string  `json:"event"`
	UUID        string  `json:"uuid"`
	Body        Backups `json:"body"`
}

Webhook - this is used for the incoming webhook data

func ProcessBackups

func ProcessBackups(backupData Backups, backupsEnv api.Environment) []Webhook

ProcessBackups actually process the backups here, check that the ones we want to add to the API aren't already in the API

Jump to

Keyboard shortcuts

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