asset

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2017 License: Apache-2.0 Imports: 21 Imported by: 0

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