storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Provides an abstraction layer for interacting with different cloud storage providers, simplifying data upload and download operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GcsBucket

type GcsBucket struct {
	Bucket string `mapstructure:"bucket"`
	Path   string `mapstructure:"path,omitempty"`
}

GcsBucket represents a Google Cloud Storage bucket configuration.

func (*GcsBucket) Download

func (gcs *GcsBucket) Download(prefix string, remove bool) ([]byte, error)

Download downloads data from the Google Cloud Storage bucket with the specified prefix. If remove is true, it deletes the object after download.

func (*GcsBucket) Upload

func (gcs *GcsBucket) Upload(object string, data []byte) error

Upload uploads data to the specified object in the Google Cloud Storage bucket.

type S3Bucket

type S3Bucket struct {
	Region string `mapstructure:"region"`
	Bucket string `mapstructure:"bucket"`
	Path   string `mapstructure:"path,omitempty"`
}

S3Bucket represents an Amazon S3 bucket configuration.

func (*S3Bucket) Download

func (s3 *S3Bucket) Download(prefix string, remove bool) ([]byte, error)

Download downloads data from the Amazon S3 bucket with the specified prefix. If remove is true, it deletes the object after download.

func (*S3Bucket) Upload

func (s3 *S3Bucket) Upload(object string, data []byte) error

Upload uploads data to the specified object in the Amazon S3 bucket.

type Secret

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

Secret represents a container for secret data.

type Storage

type Storage struct {
	Name      string    `mapstructure:"name"`
	Type      string    `mapstructure:"type"`
	S3Bucket  S3Bucket  `mapstructure:"s3,omitempty"`
	GcsBucket GcsBucket `mapstructure:"gcs,omitempty"`
}

Storage represents a configuration for different storage types.

func (*Storage) Download

func (s *Storage) Download(name string, remove bool) ([]byte, error)

Download downloads data from the configured cloud storage system with the specified name. If remove is true, it deletes the object after download.

func (*Storage) Upload

func (s *Storage) Upload(fileName string, data []byte) error

Upload uploads data to the specified object in the configured cloud storage system.

Jump to

Keyboard shortcuts

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