asset

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2018 License: Apache-2.0 Imports: 23 Imported by: 7 modules, 36 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostFileRequest

type PostFileRequest struct {
	Action      string                 `json:"action"`
	ExtraFields map[string]interface{} `json:"extra-fields,omitempty"`
}

PostFileRequest models the POST request for upload asset file

type SignatureParser

type SignatureParser interface {
	ParseSignature(signed string, name string, expiredAt time.Time) (valid bool, err error)
}

SignatureParser parses a signed signature string

type Store

type Store interface {
	GetFileReader(name string) (io.ReadCloser, error)
	PutFileReader(name string, src io.Reader, length int64, contentType string) error
	GeneratePostFileRequest(name string) (*PostFileRequest, error)
}

Store specify the interfaces of an asset store

func NewCloudStore

func NewCloudStore(
	appName string,
	host string,
	authToken string,
	publicURLPrefix string,
	privateURLPrefix string,
	public bool,
) (Store, error)

NewCloudStore creates a new cloud asset store

func NewFileStore

func NewFileStore(dir, prefix, secret string, public bool) Store

NewFileStore creates a new fileStore

func NewS3Store

func NewS3Store(
	accessKey string,
	secretKey string,
	regionName string,
	bucketName string,
	urlPrefix string,
	public bool,
) (Store, error)

NewS3Store returns a new s3Store

type URLSigner

type URLSigner interface {
	// SignedURL returns a url with access to the named file. If asset
	// store is private, the returned URL is a signed one, allowing access
	// to asset for a short period.
	SignedURL(name string) (string, error)
	IsSignatureRequired() bool
}

URLSigner signs a signature and returns a URL accessible to that asset.

Jump to

Keyboard shortcuts

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