digitalocean

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*godo.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg *Config) (*Client, error)

func (*Client) DownloadFile

func (c *Client) DownloadFile(ctx context.Context, key string, w io.WriterAt) error

func (*Client) GetAddrs

func (c *Client) GetAddrs(ctx context.Context) ([]string, error)

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, key string, r io.ReadCloser) error

type Config

type Config struct {
	AccessToken     string
	SpacesURL       string
	SpacesAccessKey string
	SpacesSecretKey string
	SpaceName       string
}

func (*Config) Token

func (cfg *Config) Token() (*oauth2.Token, error)

type ObjectStore

type ObjectStore struct {
	*s3.S3
	*s3manager.Uploader
	*s3manager.Downloader
	// contains filtered or unexported fields
}

ObjectStore implements the provider.ObjectStore interface for AWS S3.

func NewObjectStore

func NewObjectStore(cfg *Config, bucket string) (*ObjectStore, error)

func (*ObjectStore) Download

func (s *ObjectStore) Download(ctx context.Context, key string) ([]byte, error)

Download downloads an object given the provided key.

func (*ObjectStore) Exists

func (s *ObjectStore) Exists(ctx context.Context, key string) (bool, error)

Exists checks for existence of a particular key in the established object bucket.

func (*ObjectStore) Upload

func (s *ObjectStore) Upload(ctx context.Context, key string, data []byte) error

Upload uploads an object given the provided key and file content.

Jump to

Keyboard shortcuts

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