s3store

package module
v0.0.0-...-0a32869 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 15 Imported by: 0

README

S3Store

S3Store is a storage module that uses Amazon's S3 object storage as a storage interface for CertMagic.

Usage

The NewS3Storage(bucket, region string) function will automatically use credentials from ENV vars, ~/.aws/credentials files and any assumed roles. It should not be necessary to provide any explicit credentials.

Otherwise, if you want to provide explicit credentials, you can do so with NewS3StorageWithCredentials(accessKey, secretKey, bucket, region string).

License

This library is distributed under the MIT License, see LICENSE for more information.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StorageKeys cm.KeyBuilder

Functions

This section is empty.

Types

type S3Store

type S3Store struct {
	// contains filtered or unexported fields
}

func NewS3Store

func NewS3Store(client *s3.Client, bucketName string) *S3Store

func NewS3StoreWithCredentials

func NewS3StoreWithCredentials(accessKey, secretKey, bucketName, region string) *S3Store

func (*S3Store) Delete

func (s *S3Store) Delete(ctx context.Context, key string) error

Delete deletes the value at key.

func (*S3Store) Exists

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

Exists returns true if key exists in s3

func (*S3Store) Filename

func (s *S3Store) Filename(key string) string

Filename returns the key as a path on the file system prefixed by S3Storage.Path.

func (*S3Store) List

func (s *S3Store) List(ctx context.Context, prefix string, recursive bool) ([]string, error)

List returns all keys that match prefix. because s3 has no concept of directories, everything is an explicit path, there is really no such thing as recursive search. This is simply here to fulfill the interface requirements of the List function

func (*S3Store) Load

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

Load retrieves the value at key.

func (*S3Store) Lock

func (s *S3Store) Lock(ctx context.Context, key string) error

Lock obtains a lock named by the given key. It blocks until the lock can be obtained or an error is returned.

func (*S3Store) Stat

func (s *S3Store) Stat(ctx context.Context, key string) (cm.KeyInfo, error)

Stat returns information about key.

func (*S3Store) Store

func (s *S3Store) Store(ctx context.Context, key string, value []byte) error

Store saves value at key.

func (*S3Store) String

func (s *S3Store) String() string

func (*S3Store) Unlock

func (s *S3Store) Unlock(ctx context.Context, key string) error

Unlock releases the lock for name.

Jump to

Keyboard shortcuts

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