aws

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2017 License: Apache-2.0 Imports: 13 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DirectoryPermissions = 0755

DirectoryPermissions are the permissions when a new directory is created upon file download.

View Source
const ProviderName = `NerdalizeProvider`

ProviderName is the name of the credentials provider.

Variables

This section is empty.

Functions

func NewNerdalizeCredentials

func NewNerdalizeCredentials(c *client.NerdAPIClient) *credentials.Credentials

NewNerdalizeCredentials creates a new credentials object with the NerdalizeProvider as provider.

Types

type DataClient

type DataClient struct {
	Session *session.Session
	*DataClientConfig
}

DataClient holds a reference to an AWS session

func NewDataClient

func NewDataClient(conf *DataClientConfig) (*DataClient, error)

NewDataClient creates a new data client that is capable of uploading and downloading (multiple) files.

func (*DataClient) DownloadFile

func (client *DataClient) DownloadFile(key, outFile string) error

DownloadFile downloads a single file.

func (*DataClient) DownloadFiles

func (client *DataClient) DownloadFiles(root string, outDir string, kw KeyWriter, concurrency int) error

DownloadFiles concurrently downloads all files in a given s3 root path.

func (*DataClient) ListObjects

func (client *DataClient) ListObjects(root string) (keys []string, err error)

ListObjects lists all keys for a given root.

func (*DataClient) UploadDir

func (client *DataClient) UploadDir(dir string, root string, kw KeyWriter, concurrency int) error

UploadDir uploads every single file in the directory and all its subdirectories.

func (*DataClient) UploadFile

func (client *DataClient) UploadFile(filePath string, key string, root string) error

UploadFile uploads a single file.

func (*DataClient) UploadFiles

func (client *DataClient) UploadFiles(files []string, keys []string, root string, kw KeyWriter, concurrency int) error

UploadFiles uploads a list of files concurrently.

type DataClientConfig

type DataClientConfig struct {
	Credentials *credentials.Credentials
	Bucket      string
}

DataClientConfig provides config details to create a new DataClient.

type KeyWriter

type KeyWriter interface {
	Write(k string) error
}

KeyWriter writes a given key.

type Provider

type Provider struct {
	credentials.Expiry
	ExpiryWindow time.Duration
	Client       *client.NerdAPIClient
}

Provider satisfies the credentials.Provider interface, and is a client to retrieve credentials from the nerdalize api.

func (*Provider) IsExpired

func (p *Provider) IsExpired() bool

IsExpired checks if the AWS sessions is expired.

func (*Provider) Retrieve

func (p *Provider) Retrieve() (credentials.Value, error)

Retrieve will attempt to request the credentials from the nerdalize api. And error will be returned if the retrieval fails.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL