Documentation
¶
Index ¶
- Constants
- type Config
- type PreSignedURL
- type S3Client
- func (c S3Client) GetBucket() string
- func (c S3Client) KeyFromURL(url *url.URL) (string, error)
- func (c S3Client) NewGetPresignedURL(key string) (*PreSignedURL, error)
- func (c S3Client) SetTagValueForKey(key string, tagName string, tagValue string) error
- func (c S3Client) TagValueForKey(key string, tagName string) (string, error)
- func (c S3Client) UploadFile(key string, body io.ReadSeeker) error
Constants ¶
const AVStatusTagName = "av-status"
AVStatusTagName is the name of the tag that stores virus scan results for uploaded files
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PreSignedURL ¶
PreSignedURL is the model to return S3 pre-signed URLs
type S3Client ¶
type S3Client struct {
// contains filtered or unexported fields
}
S3Client is an EASi s3 client wrapper
func NewS3Client ¶
NewS3Client creates a new s3 service client
func NewS3ClientUsingClient ¶
NewS3ClientUsingClient creates a new s3 wrapper using the specified s3 client This is most useful for testing where the s3 client needs to be mocked out.
func (S3Client) KeyFromURL ¶
KeyFromURL strips the configured bucket name from a URL, returning only the S3 key.
This isn't always necessary for working with S3 buckets if they use virtual-hosted-style access, i.e. https://bucket-name.s3.region-code.amazonaws.com/key-name. However, MinIO by default uses path-style access, which puts the bucket name in the URL, i.e. https://s3.region-code.amazonaws.com/bucket-name/key-name. It's possible to configure MinIO to use virtual-hosted style, but it's tricky to get working with our current Docker Compose setup, so we don't bother with it. See https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-bucket-intro.html and https://github.com/minio/minio/tree/master/docs/config#domain.
func (S3Client) NewGetPresignedURL ¶
func (c S3Client) NewGetPresignedURL(key string) (*PreSignedURL, error)
NewGetPresignedURL returns a pre-signed URL used for GET-ing objects
func (S3Client) SetTagValueForKey ¶
SetTagValueForKey sets the tag value and returns an error if any was encountered.
func (S3Client) TagValueForKey ¶
TagValueForKey returns the tag value and if that tag was found for the specified key and tag name. If no value is found, returns an empty string.
func (S3Client) UploadFile ¶
func (c S3Client) UploadFile(key string, body io.ReadSeeker) error
UploadFile uploads a file to the configured bucket for saving documents. Note that no file extension will be added to the key by this method; it assumes the caller has already added an extension, if desired.