Documentation ¶
Overview ¶
Package acd represent an Amazon Cloud Drive client.
Index ¶
- func DefaultCacheFile() string
- func DefaultConfigFile() string
- func DefaultTokenFile() string
- type AccountInfo
- type AccountQuota
- type AccountUsage
- type Client
- func (c *Client) CheckResponse(res *http.Response) error
- func (c *Client) Close() error
- func (c *Client) Do(r *http.Request) (*http.Response, error)
- func (c *Client) Download(path string) (io.ReadCloser, error)
- func (c *Client) DownloadFolder(localPath, remotePath string, recursive bool) error
- func (c *Client) FetchNodeTree() error
- func (c *Client) GetAccountInfo() (*AccountInfo, error)
- func (c *Client) GetAccountQuota() (*AccountQuota, error)
- func (c *Client) GetAccountUsage() (*AccountUsage, error)
- func (c *Client) GetContentURL(path string) string
- func (c *Client) GetMetadataURL(path string) string
- func (c *Client) GetNodeTree() *node.Tree
- func (c *Client) List(path string) (node.Nodes, error)
- func (c *Client) Upload(filename string, overwrite bool, r io.Reader) error
- func (c *Client) UploadFolder(localPath, remotePath string, recursive, overwrite bool) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCacheFile ¶
func DefaultCacheFile() string
DefaultCacheFile returns the default path for the cache file. This is os-dependent setting.
func DefaultConfigFile ¶
func DefaultConfigFile() string
DefaultConfigFile returns the default path for the configuration file. This is os-dependent setting.
func DefaultTokenFile ¶
func DefaultTokenFile() string
DefaultTokenFile returns the default path for the token file. This is os-dependent setting.
Types ¶
type AccountInfo ¶
AccountInfo represents information about an Amazon Cloud Drive account.
type AccountQuota ¶
type AccountQuota struct { Quota uint64 `json:"quota"` LastCalculated time.Time `json:"lastCalculated"` Available uint64 `json:"available"` }
AccountQuota represents information about the account quotas.
type AccountUsage ¶
type AccountUsage struct { LastCalculated time.Time `json:"lastCalculated"` Doc struct { Billable struct { Bytes uint64 `json:"bytes"` Count uint32 `json:"count"` } `json:"billable"` Total struct { Bytes uint64 `json:"bytes"` Count uint32 `json:"count"` } `json:"total"` } `json:"doc"` Other struct { Billable struct { Bytes uint64 `json:"bytes"` Count uint32 `json:"count"` } `json:"billable"` Total struct { Bytes uint64 `json:"bytes"` Count uint32 `json:"count"` } `json:"total"` } `json:"other"` Photo struct { Billable struct { Bytes uint64 `json:"bytes"` Count uint32 `json:"count"` } `json:"billable"` Total struct { Bytes uint64 `json:"bytes"` Count uint32 `json:"count"` } `json:"total"` } `json:"photo"` Video struct { Billable struct { Bytes uint64 `json:"bytes"` Count uint32 `json:"count"` } `json:"billable"` Total struct { Bytes uint64 `json:"bytes"` Count uint32 `json:"count"` } `json:"total"` } `json:"video"` }
AccountUsage represents information about the account usage.
type Client ¶
type Client struct { // NodeTree is the tree of nodes as stored on the drive. This tree should // be fetched using (*Client).FetchNodeTree() as soon the client is // created. NodeTree *node.Tree // contains filtered or unexported fields }
Client provides a client for Amazon Cloud Drive.
func New ¶
New returns a new Amazon Cloud Drive "acd" Client. configFile must exist and must be a valid JSON decodable into Config.
func (*Client) CheckResponse ¶
CheckResponse validates the response from the Amazon Cloud Drive API. It does that by looking at the response's status code and it returns an error for any code lower than 200 or greater than 300
func (*Client) Do ¶
Do invokes net/http.Client.Do(). Refer to net/http.Client.Do() for documentation.
func (*Client) Download ¶
func (c *Client) Download(path string) (io.ReadCloser, error)
Download returns an io.ReadCloser for path. The caller is responsible for closing the body.
func (*Client) DownloadFolder ¶
DownloadFolder downloads an entire folder to a path, if recursive is true, it will also download all subfolders.
func (*Client) FetchNodeTree ¶
FetchNodeTree fetches and caches the NodeTree.
func (*Client) GetAccountInfo ¶
func (c *Client) GetAccountInfo() (*AccountInfo, error)
GetAccountInfo returns AccountInfo about the current account.
func (*Client) GetAccountQuota ¶
func (c *Client) GetAccountQuota() (*AccountQuota, error)
GetAccountQuota returns AccountQuota about the current account.
func (*Client) GetAccountUsage ¶
func (c *Client) GetAccountUsage() (*AccountUsage, error)
GetAccountUsage returns AccountUsage about the current account.
func (*Client) GetContentURL ¶
GetContentURL returns the content url.
func (*Client) GetMetadataURL ¶
GetMetadataURL returns the metadata url.
func (*Client) GetNodeTree ¶
GetNodeTree returns the NodeTree.
func (*Client) List ¶
List returns nodes.Nodes for all of the nodes underneath the path. It's up to the caller to differentiate between a file, a folder or an asset by using (*node.Node).IsFile(), (*node.Node).IsDir() and/or (*node.Node).IsAsset(). A dir has sub-nodes accessible via (*node.Node).Nodes, you do not need to call this this function for every sub-node.
func (*Client) Upload ¶
Upload uploads io.Reader to the path defined by the filename. It will create any non-existing folders.
func (*Client) UploadFolder ¶
UploadFolder uploads an entire folder. If recursive is true, it will recurse through the entire filetree under localPath. If overwrite is false and an existing file with the same md5 was found, an error will be returned.
type Config ¶
type Config struct { // TokenFile represents the file containing the oauth settings which must // be present on disk and has permissions 0600. The file is used by the // token package to produce a valid access token by calling the oauthServer // with the refresh token. The default oauth server is hosted at // https://go-acd.appspot.com with the source code available at // https://github.com/go-acd/oauth-server. It's currently not possible to // change the oauth-server. Please feel free to add this feature if you // have a use-case for it. TokenFile string `json:"tokenFile"` // CacheFile represents the file used by the client to cache the NodeTree. // This file is not assumed to be present and will be created on the first // run. It is gob-encoded node.Node. CacheFile string `json:"cacheFile"` // Timeout configures the HTTP Client with a timeout after which the client // will cancel the request and return. A timeout of 0 (the default) means // no timeout. See http://godoc.org/net/http#Client for more information. Timeout time.Duration `json:"timeout"` }
Config represents the clients configuration.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package integrationtest is the integration test of the library.
|
Package integrationtest is the integration test of the library. |
internal
|
|
log
Package log provides a common logging package for ACD with logging level.
|
Package log provides a common logging package for ACD with logging level. |
Package node represents the Amazon Cloud Drive nodes documented at https://developer.amazon.com/public/apis/experience/cloud-drive/content/nodes It also provides the Tree struct which allows you to refer to the entire filesystem as a file tree as defined by the Amazon documentation.
|
Package node represents the Amazon Cloud Drive nodes documented at https://developer.amazon.com/public/apis/experience/cloud-drive/content/nodes It also provides the Tree struct which allows you to refer to the entire filesystem as a file tree as defined by the Amazon documentation. |
Package token represents an oauth2.TokenSource which has the ability to refresh the access token through the oauth server.
|
Package token represents an oauth2.TokenSource which has the ability to refresh the access token through the oauth server. |