Documentation
¶
Index ¶
- Constants
- Variables
- func Copy(context *endly.Context, transfers ...*Transfer) (interface{}, error)
- func GetStorageService(context *endly.Context, resource *url.Resource) (storage.Service, error)
- func IsShellCompressable(protScheme string) bool
- func New() endly.Service
- func NewExpandedContentHandler(context *endly.Context, replaceMap map[string]string, expand bool) func(reader io.ReadCloser) (io.ReadCloser, error)
- func UseMemoryService(context *endly.Context) storage.Service
- type AssetTransfer
- type CopyRequest
- type CopyResponse
- type DownloadRequest
- type DownloadResponse
- type RemoveRequest
- type RemoveResponse
- type Transfer
- type UploadRequest
- type UploadResponse
Constants ¶
const ServiceID = "storage"
ServiceID represents transfer service id
Variables ¶
var CompressionTimeout = 120000
CompressionTimeout compression/decompression timeout
var MaxContentSize = 1024 * 64
MaxContentSize represent max allowed expandable content size
Functions ¶
func GetStorageService ¶
GetStorageService return toolbox storage service
func IsShellCompressable ¶
IsShellCompressable returns true if resource can be compress via shell command.
func NewExpandedContentHandler ¶
func NewExpandedContentHandler(context *endly.Context, replaceMap map[string]string, expand bool) func(reader io.ReadCloser) (io.ReadCloser, error)
NewExpandedContentHandler return a new reader that can substitute content with state map, replacement data provided in replacement map.
Types ¶
type AssetTransfer ¶
type AssetTransfer map[string]interface{}
AssetTransfer represents asset transfer
func (*AssetTransfer) AsTransfer ¶
func (t *AssetTransfer) AsTransfer(base *Transfer) []*Transfer
AsTransfer converts map to transfer or transfers
type CopyRequest ¶
type CopyRequest struct { *Transfer `description:"if asset uses relative path it will be joined with this URL" json:",inline"` Assets AssetTransfer `` // transfers /* 130-byte string literal not displayed */ Transfers []*Transfer `description:"actual transfer assets, if empty it derives from assets or source/desc "` Udf string `description:"custom user defined function to returns a CopyHandler type func which performs the copy"` }
CopyRequest represents a resources copy request
func NewCopyRequest ¶
func NewCopyRequest(assets AssetTransfer, transfers ...*Transfer) *CopyRequest
CopyRequest creates a new copy request
func NewCopyRequestFromuRL ¶
func NewCopyRequestFromuRL(URL string) (*CopyRequest, error)
NewCopyRequestFromuRL creates a new request from URL (JSON or YAML format are supported)
func (*CopyRequest) Messages ¶
func (r *CopyRequest) Messages() []*msg.Message
Items returns event messages
func (*CopyRequest) Validate ¶
func (r *CopyRequest) Validate() error
Validate checks if request is valid
type CopyResponse ¶
type CopyResponse struct {
TransferredURL []string //transferred URLs
}
CopyResponse represents a resources copy response
type DownloadRequest ¶
type DownloadRequest struct { Source *url.Resource `required:"true" description:"source asset or directory"` DestKey string `required:"true" description:"state map key destination"` Udf string `description:"name of udf to transform payload before placing into state map"` //name of udf function that will be used to transform payload Expect interface{} `description:"if specified expected file content used for validation"` }
DownloadRequest represents a resources download request, it downloads source into context.state target key
func (*DownloadRequest) Messages ¶
func (r *DownloadRequest) Messages() []*msg.Message
Items returns event messages
func (*DownloadRequest) Validate ¶
func (r *DownloadRequest) Validate() error
Validate checks if request is valid
type DownloadResponse ¶
type DownloadResponse struct { Info toolbox.FileInfo Payload string //source content, if binary then is will be prefixed base64: followed by based 64 encoded content. Transformed interface{} Assert *validator.AssertResponse }
DownloadResponse represents a download response
type RemoveRequest ¶
type RemoveRequest struct {
Assets []*url.Resource `required:"true" description:"resources to remove"`
}
RemoveRequest represents a resources Remove request
func NewRemoveRequest ¶
func NewRemoveRequest(assets ...*url.Resource) *RemoveRequest
NewRemoveRequest creates a new remove request
func (*RemoveRequest) Messages ¶
func (r *RemoveRequest) Messages() []*msg.Message
Items returns tag messages
func (*RemoveRequest) Validate ¶
func (r *RemoveRequest) Validate() error
Validate checks if request is valid
type RemoveResponse ¶
type RemoveResponse struct {
Removed []string
}
RemoveResponse represents a resources Remove response, it returns url of all resource that have been removed.
type Transfer ¶
type Transfer struct { Expand bool `description:"flag to substitute asset content with state keys"` Compress bool `` //flag to compress asset before sending over wirte and to decompress (this option is only supported on scp or file proto) /* 133-byte string literal not displayed */ Replace map[string]string `description:"replacements map, if key if found in the conent it wil be replaced with corresponding value."` Source *url.Resource `required:"true" description:"source asset or directory"` Dest *url.Resource `required:"true" description:"destination asset or directory"` }
Transfer represents copy instruction
type UploadRequest ¶
type UploadRequest struct { SourceKey string `required:"true" description:"state key with asset content"` Dest *url.Resource `required:"true" description:"destination asset or directory"` //target URL with credentials }
UploadRequest represents a resources upload request, it takes context state key to upload to target destination.
func (*UploadRequest) Messages ¶
func (r *UploadRequest) Messages() []*msg.Message
Items returns event messages
func (*UploadRequest) Validate ¶
func (r *UploadRequest) Validate() error
Validate checks if request is valid
type UploadResponse ¶
UploadResponse represents a upload response