Documentation
¶
Index ¶
- func MakeS3Path(bucketPrefix, user, userPath string) (string, error)
- func SetupHttpListeners(mgr Manager) error
- type ApiRequest
- type ApiResult
- type ApiResultData
- type Config
- type ListResult
- type Manager
- type ObjectInfo
- type SessionContext
- type SimpleManager
- func (self *SimpleManager) DeleteObject(cx *SessionContext, workspaceIn string, key string) error
- func (self *SimpleManager) DownloadUrl(cx *SessionContext, workspaceIn string, key string) (string, error)
- func (self *SimpleManager) List(cx *SessionContext, workspaceIn string, prefix string, page string) (*ListResult, error)
- func (self *SimpleManager) UploadUrl(cx *SessionContext, workspaceIn string, key string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeS3Path ¶
MakeS3Path internal method validates inputs, and constructs a bucket path from the given bucket prefix, user id, and userPath
func SetupHttpListeners ¶
SetupHttpListeners setup endpoints with the http engine
Types ¶
type ApiRequest ¶
type ApiRequest struct { Verb string Workspace string Key string Cx *SessionContext }
func NewApiRequest ¶
NewApiRequest extracts the api request parameters from the URL path and the remote user header. urlPath should be $verb/$workspace/$key, remoteUser should be set by the API gateway after verfying authentication and authorization
func (*ApiRequest) HandleApiRequest ¶
func (self *ApiRequest) HandleApiRequest(mgr Manager) *ApiResult
type ApiResult ¶
type ApiResult struct { Version int Method string Result string Data ApiResultData }
type ApiResultData ¶
type ApiResultData interface{}
type Config ¶
type Config struct { Bucket string `json:"bucket"` BucketPrefix string `json:"bucketprefix"` LogLevel string `json:"loglevel"` }
Config for constructing an AppContext
func LoadConfig ¶
LoadConfig from a json file
type ListResult ¶
type ListResult struct { Workspace string Prefix string Objects []ObjectInfo Prefixes []string }
type Manager ¶
type Manager interface { List(cx *SessionContext, workspaceIn string, prefix string, page string) (*ListResult, error) UploadUrl(cx *SessionContext, workspaceIn string, key string) (string, error) DownloadUrl(cx *SessionContext, workspaceIn string, key string) (string, error) DeleteObject(cx *SessionContext, workspaceIn string, key string) error }
func NewManager ¶
NewManager makes a new manager with the given configuration
type ObjectInfo ¶
type SessionContext ¶
type SessionContext struct {
User string
}
AppContext runtime context
func NewSessionContext ¶
func NewSessionContext(user string) (cx *SessionContext)
type SimpleManager ¶
type SimpleManager struct {
// contains filtered or unexported fields
}
func (*SimpleManager) DeleteObject ¶
func (self *SimpleManager) DeleteObject(cx *SessionContext, workspaceIn string, key string) error
DownloadUrl generates a presigned download url Use the range HTTP header to download range of bytes -
https://docs.aws.amazon.com/AmazonS3/latest/dev/GettingObjectsUsingAPIs.html
func (*SimpleManager) DownloadUrl ¶
func (self *SimpleManager) DownloadUrl(cx *SessionContext, workspaceIn string, key string) (string, error)
DownloadUrl generates a presigned download url Use the range HTTP header to download range of bytes -
https://docs.aws.amazon.com/AmazonS3/latest/dev/GettingObjectsUsingAPIs.html
func (*SimpleManager) List ¶
func (self *SimpleManager) List(cx *SessionContext, workspaceIn string, prefix string, page string) (*ListResult, error)
List the prefixes and objects under a given workspace and prefix. Currently no paging support - limit to 1000. Currently only support user workspace.
func (*SimpleManager) UploadUrl ¶
func (self *SimpleManager) UploadUrl(cx *SessionContext, workspaceIn string, key string) (string, error)
UploadUrl generates a presigned upload url TODO - support multipart upload