Documentation ¶
Index ¶
- type AES256Key
- type Resource
- func (r *Resource) Cachable() bool
- func (r *Resource) Clone() *Resource
- func (r *Resource) CredentialURL(username, password string) string
- func (r *Resource) Decode(target interface{}) (err error)
- func (r *Resource) DecodeWith(target interface{}, decoderFactory toolbox.DecoderFactory) error
- func (r *Resource) DecoderFactory() toolbox.DecoderFactory
- func (r *Resource) DirectoryPath() string
- func (r *Resource) Download() ([]byte, error)
- func (r *Resource) DownloadBase64() (string, error)
- func (r *Resource) DownloadText() (string, error)
- func (r *Resource) HasChanged() (changed bool, err error)
- func (r *Resource) Host() string
- func (r *Resource) Init() (err error)
- func (r *Resource) JSONDecode(target interface{}) error
- func (r *Resource) Port() string
- func (r *Resource) Rename(name string) (err error)
- func (r *Resource) YAMLDecode(target interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AES256Key ¶ added in v0.31.3
type AES256Key struct { Key []byte Base64Key string Base64KeyMd5Hash string Base64KeySha256Hash string }
AES256Key represents custom key
type Resource ¶
type Resource struct { URL string `description:"resource URL or relative or absolute path" required:"true"` //URL of resource Credentials string `description:"credentials file"` //name of credential file or credential key depending on implementation ParsedURL *url.URL `json:"-"` //parsed URL resource Cache string `description:"local cache path"` //Cache path for the resource, if specified resource will be cached in the specified path CustomKey *AES256Key `description:" content encryption key"` CacheExpiryMs int //CacheExpiryMs expiry time in ms // contains filtered or unexported fields }
Resource represents a URL based resource, with enriched meta info
func NewResource ¶
func NewResource(Params ...interface{}) *Resource
NewResource returns a new resource for provided URL, followed by optional credential, cache and cache expiryMs.
func (*Resource) CredentialURL ¶
CredentialURL returns url's with provided credential
func (*Resource) DecodeWith ¶
func (r *Resource) DecodeWith(target interface{}, decoderFactory toolbox.DecoderFactory) error
Decode decodes url's data into target, it takes decoderFactory which decodes data into target
func (*Resource) DecoderFactory ¶ added in v0.5.4
func (r *Resource) DecoderFactory() toolbox.DecoderFactory
DecoderFactory returns new decoder factory for resource
func (*Resource) DirectoryPath ¶
Path returns url's path directory, assumption is that directory does not have extension, if path ends with '/' it is being stripped.
func (*Resource) Download ¶
Download downloads data from URL, it returns data as []byte, or error, if resource is cacheable it first look into cache
func (*Resource) DownloadBase64 ¶ added in v0.26.0
DownloadBase64 loads base64 resource content
func (*Resource) DownloadText ¶
DownloadText returns a text downloaded from url
func (*Resource) HasChanged ¶
func (*Resource) JSONDecode ¶
JSONDecode decodes json resource into target
func (*Resource) YAMLDecode ¶
JSONDecode decodes yaml resource into target