bfss3

package module
v0.11.9 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package bfss3 abstracts Amazon S3 bucket.

When imported, it registers a global `s3://` scheme resolver and can be used like:

import (
  "github.com/bsm/bfs"

  _ "github.com/bsm/bfs/bfss3"
)

func main() {
  ctx := context.Background()
  b, _ := bfs.Connect(ctx, "s3://bucket/a&acl=MY_ACL")
  f, _ := b.Open(ctx, "b/c.txt") // opens s3://bucket/a/b/c.txt
  ...
}

bfs.Connect supports the following query parameters:

aws_access_key_id      - custom AWS credentials
aws_secret_access_key  - custom AWS credentials
aws_session_token      - custom AWS credentials
assume_role            - specify an AWS role ARN to assume
region                 - specify an AWS region
max_retries            - specify maximum number of retries
acl                    - custom ACL, defaults to DefaultACL
sse                    - server-side-encryption algorithm

Index

Constants

View Source
const DefaultACL = "bucket-owner-full-control"

DefaultACL is the default ACL setting.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, name string, c *Config) (bfs.Bucket, error)

New initiates an bfs.Bucket backed by S3.

Types

type Config

type Config struct {
	// Native AWS configuration.
	AWS *aws.Config
	// Custom ACL, defaults to DefaultACL.
	ACL string
	// GrantFullControl setting.
	GrantFullControl string
	// The Server-side encryption algorithm used when storing this object in S3.
	SSE string
	// An optional path prefix
	Prefix string
}

Config is passed to New to configure the S3 connection.

Jump to

Keyboard shortcuts

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