s3steps

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeContext

func InitializeContext(ctx context.Context) context.Context

InitializeContext adds the s3 session to the context. The new context is returned because context is immutable.

Types

type ContextKey

type ContextKey string

ContextKey defines a type to store the s3 session in context.Context.

type CreatedBucket

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

type CreatedDocument

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

type Logger

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

Logger logs the s3 operations in a configurable file.

func GetLogger

func GetLogger() *Logger

GetLogger returns the logger for s3 operations. If the logger is not created yet, it creates a new instance of Logger.

func NewLogger

func NewLogger(path string) (*Logger, error)

NewLogger creates an instance of the logger. It configures the file path where the s3 operations are logged.

func (Logger) LogMessage

func (l Logger) LogMessage(message string)

Log a S3 message

func (Logger) LogOperation

func (l Logger) LogOperation(operation, bucket, key string)

Log a S3 operation

type Session

type Session struct {
	Client           *aws_s.Session
	CreatedBuckets   []*CreatedBucket
	CreatedDocuments []*CreatedDocument
}

func GetSession

func GetSession(ctx context.Context) *Session

GetSession returns the s3 session stored in context. Note that the context should be previously initialized with InitializeContext function.

func (*Session) CleanUp

func (s *Session) CleanUp(ctx context.Context)

CleanUp cleans session by deleting all documents created in S3

func (*Session) CreateS3Bucket

func (s *Session) CreateS3Bucket(ctx context.Context, bucket string) error

CreateS3Bucket creates a new bucket.

func (*Session) DeleteS3Bucket

func (s *Session) DeleteS3Bucket(ctx context.Context, bucket string) error

DeleteS3Bucket deletes the bucket in S3.

func (*Session) DeleteS3File

func (s *Session) DeleteS3File(ctx context.Context, bucket, key string) error

DeleteS3File deletes the file in S3.

func (*Session) NewS3Session

func (s *Session) NewS3Session(ctx context.Context) error

NewS3Session initiates a new aws session.

func (*Session) UploadS3FileWithContent

func (s *Session) UploadS3FileWithContent(ctx context.Context, bucket, key, message string) error

UploadS3FileWithContent creates a new file in S3 with the content specified.

func (*Session) ValidateS3BucketExists

func (s *Session) ValidateS3BucketExists(ctx context.Context, bucket string) error

ValidateS3BucketExists verifies the existence of a bucket.

func (*Session) ValidateS3FileExists

func (s *Session) ValidateS3FileExists(ctx context.Context, bucket, key string) error

ValidateS3FileExists checks the existence of a file in S3.

func (*Session) ValidateS3FileExistsWithContent

func (s *Session) ValidateS3FileExistsWithContent(ctx context.Context, bucket, key, message string) error

ValidateS3FileWithContent checks the existence of a file in S3 with the content specified.

type Steps

type Steps struct {
}

Steps to initialize common steps.

func (Steps) InitializeSteps

func (cs Steps) InitializeSteps(ctx context.Context, scenCtx *godog.ScenarioContext) context.Context

InitializeSteps initializes all the steps to work with S3. It implements StepsInitializer interface.

Jump to

Keyboard shortcuts

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