s3blob

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: BSD-3-Clause Imports: 12 Imported by: 20

README

go-cloud-s3blob

This is thing wrapper around the default go-cloud S3 blob opener to check for a credentials parameter (in blob URIs) and use it to assign AWS S3 session credentials.

Example

import (
	"context"
	"gocloud.dev/blob"
	_ "github.com/aaronland/go-cloud-s3blob"
)

func main() {

	ctx := context.Background()	
	bucket, _ := blob.OpenBucket(ctx, "s3blob://BUCKET?region=REGION&credentials=CREDENTIALS")

	// do stuff with bucket here
}

Note the use of the s3blob:// scheme which is different than the default s3:// scheme.

Credentials

Credentials for AWS sessions are defined as string labels. They are:

Label Description
env: Read credentials from AWS defined environment variables.
iam: Assume AWS IAM credentials are in effect.
{AWS_PROFILE_NAME} This this profile from the default AWS credentials location.
{AWS_CREDENTIALS_PATH}:{AWS_PROFILE_NAME} This this profile from a user-defined AWS credentials location.

See also

Documentation

Index

Constants

View Source
const Scheme = "s3blob"

Variables

This section is empty.

Functions

func SetACLWriterOptionsWithContext added in v0.2.0

func SetACLWriterOptionsWithContext(ctx context.Context, key interface{}, acl string) context.Context

SetACLWriterOptionsWithContext return a new context.Context instance with a gocloud.dev/blob.WriterOptions instance used to assign 'acl' permissions for all S3 blob writes. The WriterOptions instance is assigned to the new context with key 'key' and is assumed to be retrieved later by code using blob.NewWriter instances.

Types

type URLOpener

type URLOpener struct {
	Session *aws_session.Session
}

func (*URLOpener) OpenBucketURL

func (o *URLOpener) OpenBucketURL(ctx context.Context, u *url.URL) (*blob.Bucket, error)

Jump to

Keyboard shortcuts

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