Documentation ¶
Index ¶
- Constants
- Variables
- type AzureStorage
- func (s *AzureStorage) MakeDirector(extractKey func(r *http.Request) string) func(r *http.Request)
- func (s *AzureStorage) PresignGetObject(name string) (*url.URL, error)
- func (s *AzureStorage) PresignHeadObject(name string) (*url.URL, error)
- func (s *AzureStorage) PresignPutObject(name string, header http.Header) (*http.Request, error)
- func (s *AzureStorage) SignedURL(name string, now time.Time, duration time.Duration, ...) (*url.URL, error)
- type GCSStorage
- func (s *GCSStorage) MakeDirector(extractKey func(r *http.Request) string) func(r *http.Request)
- func (s *GCSStorage) PresignGetOrHeadObject(name string, method string) (*url.URL, error)
- func (s *GCSStorage) PresignHeadObject(name string) (*url.URL, error)
- func (s *GCSStorage) PresignPutObject(name string, header http.Header) (*http.Request, error)
- type HeaderField
- type PresignUploadRequest
- type PresignUploadResponse
- type Provider
- type S3Storage
- type Storage
Constants ¶
View Source
const MaxContentLength = 10 * 1024 * 1024
MaxContentLength is 10MiB.
View Source
const PresignGetExpires time.Duration = 1 * duration.PerHour
PresignGetExpires is how long the presign GET request remains valid.
View Source
const PresignPutExpires time.Duration = 15 * duration.PerMinute
PresignPutExpires is how long the presign PUT request remains valid.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AzureStorage ¶
type AzureStorage struct { ServiceURL string StorageAccount string Container string AccessKey string Clock clock.Clock }
func NewAzureStorage ¶
func (*AzureStorage) MakeDirector ¶
func (*AzureStorage) PresignGetObject ¶
func (s *AzureStorage) PresignGetObject(name string) (*url.URL, error)
func (*AzureStorage) PresignHeadObject ¶
func (s *AzureStorage) PresignHeadObject(name string) (*url.URL, error)
func (*AzureStorage) PresignPutObject ¶
type GCSStorage ¶
type GCSStorage struct { ServiceAccount string Bucket string CredentialsJSON []byte Clock clock.Clock // contains filtered or unexported fields }
func NewGCSStorage ¶
func (*GCSStorage) MakeDirector ¶
func (*GCSStorage) PresignGetOrHeadObject ¶
func (*GCSStorage) PresignHeadObject ¶
func (s *GCSStorage) PresignHeadObject(name string) (*url.URL, error)
func (*GCSStorage) PresignPutObject ¶
type HeaderField ¶
type PresignUploadRequest ¶
type PresignUploadRequest struct { Key string `json:"key"` Headers map[string]interface{} `json:"headers"` }
func (*PresignUploadRequest) ContentLength ¶
func (r *PresignUploadRequest) ContentLength() (contentLength int)
func (*PresignUploadRequest) HTTPHeader ¶
func (r *PresignUploadRequest) HTTPHeader() http.Header
func (*PresignUploadRequest) Sanitize ¶
func (r *PresignUploadRequest) Sanitize()
type PresignUploadResponse ¶
type PresignUploadResponse struct { Key string `json:"key"` URL string `json:"url"` Method string `json:"method"` Headers []HeaderField `json:"headers"` }
func NewPresignUploadResponse ¶
func NewPresignUploadResponse(r *http.Request, key string) PresignUploadResponse
type Provider ¶
type Provider struct {
Storage Storage
}
func (*Provider) MakeDirector ¶
func (*Provider) PresignPutRequest ¶
func (p *Provider) PresignPutRequest(r *PresignUploadRequest) (*PresignUploadResponse, error)
type S3Storage ¶
type S3Storage struct { Bucket string Region string AccessKeyID string SecretAccessKey string // contains filtered or unexported fields }
func NewS3Storage ¶
func (*S3Storage) MakeDirector ¶
func (*S3Storage) PresignHeadObject ¶
type Storage ¶
type Storage interface { // PresignPutObject returns an HTTP request that is ready for use. PresignPutObject(name string, header http.Header) (*http.Request, error) // PresignHeadObject returns an URL that is ready for use. PresignHeadObject(name string) (*url.URL, error) // MakeDirector takes extractKey and returns a Director of httputil.ReverseProxy. MakeDirector(extractKey func(r *http.Request) string) func(r *http.Request) }
Click to show internal directories.
Click to hide internal directories.