Categorygithub.com/dioad/s3-index-generator
modulepackage
0.9.6
Repository: https://github.com/dioad/s3-index-generator.git
Documentation: pkg.go.dev

# README

Description

This lambda is intended to listen for S3 events and then generate index html files for all the objects in the bucket.

Can also be run from the command line. If running from a command line the binary takes one argument which is the bucket name.

Environment Variables

NameRequiredDefaultDescription
INDEX_TYPENomultipage
TEMPLATE_BUCKET_URLNoS3 URL in the form s3://bucket/path. Expects templates (defined below) in a subdirectory called templates/. So if this is set to s3://bucket/path it will expect templates to be stored in s3://bucket/path/templates/singlepage.index.html
STATIC_BUCKET_URLNoS3 URL in the form s3://bucket/path. Expects static assets in a subdirectory called static/. So if this is set to s3://bucket/path it will expect templates to be stored in s3://bucket/path/static/style.css
INDEX_TEMPLATENo${INDEX_TYPE}.index.html.tmpl

Custom Templates

If TEMPLATE_BUCKET_URL is set the utility will look for a root template with the name ${INDEX_TYPE}.index.html.tmpl within a subdirectory of TEMPLATE_BUCKET_URL

Templates are rendered against an ObjectTree instance:

type Object struct {
    Object *s3.Object
    Tags map[string]string
}

type ObjectTree struct {
	FullPath string
	DirName  string
	Objects  []*Object
	Children map[string]*ObjectTree
}

Each ObjectTree represents a directory within the SRC_BUCKET_NAME bucket. Objects 'in' the directory are contained in the Objects member, while sub trees are contained within Children. DirName is the base name of a path, i.e. if the path is a/b/c the basename is c. The FullPath contains the full path to the folder, in the previous example it would be a/b/c.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
HasKey returns a function that excludes paths with the given key.
HasPrefix returns a function that excludes paths with the given prefix.
HasSuffix returns a function that excludes paths with the given suffix.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewRootObjectTree creates a new root object tree.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ObjectTree is a tree of objects.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
PathFilter is an interface for filtering paths.

# Type aliases

Exclusions is a list of functions that exclude paths.
Inclusions is a list of functions that exclude paths.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
PredicateFunc is a function that excludes paths.
No description provided by the author
No description provided by the author