s3

package module
v1.2.13 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

S3 Storage

This plugin can be used to store attachments and avatars to AWS S3.

How to use

Build
./answer build --with github.com/apache/answer-plugins/storage-s3
Configuration
  • Endpoint - Endpoint of the AWS S3 storage
  • Bucket Name - Your bucket name
  • Object Key Prefix - Prefix of the object key like 'answer/data/' that ending with '/'
  • Access Key Id - AccessKeyId of the S3
  • Access Key Secret - AccessKeySecret of the S3
  • Access Token - AccessToken of the S3
  • Visit Url Prefix - Prefix of access address for the uploaded file, ending with '/' such as https://example.com/xxx/

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Info embed.FS

Functions

This section is empty.

Types

type Client

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

func NewS3Client

func NewS3Client(id, secret, token, endpoint, region, bucket string, disableSSL bool) *Client

func (*Client) PutObject

func (s *Client) PutObject(key, ext string, file io.ReadSeeker) (err error)

type Storage

type Storage struct {
	Config *StorageConfig
	Client *Client
}

func (*Storage) ConfigFields

func (s *Storage) ConfigFields() []plugin.ConfigField

func (*Storage) ConfigReceiver

func (s *Storage) ConfigReceiver(config []byte) error

func (*Storage) ExceedFileSizeLimit added in v1.2.11

func (s *Storage) ExceedFileSizeLimit(fileSize int64, condition plugin.UploadFileCondition) bool

func (*Storage) Info

func (s *Storage) Info() plugin.Info

func (*Storage) IsUnsupportedFileType added in v1.2.11

func (s *Storage) IsUnsupportedFileType(originalFilename string, condition plugin.UploadFileCondition) bool

func (*Storage) UploadFile

func (s *Storage) UploadFile(ctx *plugin.GinContext, condition plugin.UploadFileCondition) (resp plugin.UploadFileResponse)

type StorageConfig

type StorageConfig struct {
	Endpoint        string `json:"endpoint"`
	BucketName      string `json:"bucket_name"`
	ObjectKeyPrefix string `json:"object_key_prefix"`
	AccessKeyID     string `json:"access_key_id"`
	AccessKeySecret string `json:"access_key_secret"`
	AccessToken     string `json:"access_token"`
	VisitUrlPrefix  string `json:"visit_url_prefix"`
	Region          string `json:"region"`
	DisableSSL      bool   `json:"disable_ssl"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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