aws

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssumeRoleSession

func AssumeRoleSession(cfg aws.Config, roleArn, sessionName string) (aws.Config, error)

AssumeRoleSession returns a new aws.Config by wrapping the given aws.Config with the requested role credentials and session name.

func NewConfig

func NewConfig() (aws.Config, error)

NewConfig returns a new aws.Config with default values.

func NewConfigWithAssumedRole

func NewConfigWithAssumedRole(name string) (aws.Config, error)

NewConfigWithAssumedRole returns a new aws.Config with default values, and assumes the IAM role for the attached IAM instance profile for the current instance using the provided session name.

Types

type Client

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

Client implements the provider.Client interface.

func NewClient

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

NewClient returns a new Client.

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 {
	BucketName      string
	RoleSessionName string
}

type ObjectStore

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

ObjectStore implements the provider.ObjectStore interface for AWS S3.

func NewObjectStore

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

NewObjectStore returns a new instance of ObjectStore.

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