aws

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const IsIncludedInBuild = true

IsIncludedInBuild is true if Gokapi has been compiled with AWS support or the API is being mocked

View Source
const IsMockApi = false

IsMockApi is true if the API is being mocked and therefore can only be used for testing purposes

Variables

This section is empty.

Functions

func AddBucketName

func AddBucketName(file *models.File)

AddBucketName adds the bucket name to the file to be stored

func DeleteObject

func DeleteObject(file models.File) (bool, error)

DeleteObject deletes a file from S3

func Download

func Download(writer io.WriterAt, file models.File) (int64, error)

Download downloads a file from AWS, used for encrypted files and testing

func FileExists

func FileExists(file models.File) (bool, int64, error)

FileExists returns true if the object is stored in S3

func GetDefaultBucketName

func GetDefaultBucketName() string

GetDefaultBucketName returns the default bucketname where new files are stored

func Init

func Init(config models.AwsConfig) bool

Init reads the credentials for AWS. Returns true if valid

func IsAvailable

func IsAvailable() bool

IsAvailable returns true if valid credentials have been passed

func IsCorsCorrectlySet

func IsCorsCorrectlySet(bucket, gokapiUrl string) (bool, error)

IsCorsCorrectlySet returns true if CORS rules allow download from Gokapi

func IsValidLogin

func IsValidLogin(config models.AwsConfig) (bool, error)

IsValidLogin checks if a valid login was provided

func LogOut

func LogOut()

LogOut resets the credentials

func RedirectToDownload

func RedirectToDownload(w http.ResponseWriter, r *http.Request, file models.File, forceDownload bool) error

RedirectToDownload creates a presigned link that is valid for 15 seconds and redirects the client to this url

func Upload

func Upload(input io.Reader, file models.File) (string, error)

Upload uploads a file to AWS

Types

This section is empty.

Jump to

Keyboard shortcuts

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