Documentation ¶
Index ¶
- Variables
- func AWSGetSession() (sess *session.Session, err error)
- func InitLog(level string)
- func ParseInput(osArgs []string, allowedParams PluginParams) (providedParams map[string]interface{}, err error)
- func PrintResults(results map[string]interface{}) (err error)
- func S3Download(sess *session.Session, bucket, key, fileName string) (err error)
- func S3SplitBucketKey(s3url string) (bucket string, key string, err error)
- func S3Upload(sess *session.Session, bucket, key, fileName string) (err error)
- type PluginParams
Constants ¶
This section is empty.
Variables ¶
var Log *logrus.Logger
Functions ¶
func AWSGetSession ¶
AWSGetSession uses credentials sourced from environment variables to establish an AWS session and return it.
func InitLog ¶
func InitLog(level string)
InitLog starts the logrus logger. This should be called exactly one time by the main program before the program uses other functions from papigoplug. A good default level is "info".
func ParseInput ¶
func ParseInput(osArgs []string, allowedParams PluginParams) (providedParams map[string]interface{}, err error)
ParseInput scans the provided arguments list (e.g. CLI args from os.Args). It expects that there is one real arg, i.e. that osArgs has length 2, that osArgs[0] is the file name and that osArgs[1] is a JSON dictionary. It marshals the JSON dictionary into a map and returns it after validating that the provided parameters satisfy the constraints defined by allowedParams (that no Required parameters are missing and that all other provided parameters are part of the Optional list).
func PrintResults ¶
PrintResults encodes the provided map into a JSON string within key "plugin_results" and prints that. This function must be called at the end of the program.
func S3Download ¶
S3Download creates a local file a blob from s3 and saves it to a local file path, using multipart concurrency. The file is first downloaded to a temporary location on the disk, and then is renamed/moved to the final destination.
func S3SplitBucketKey ¶
S3SplitBucketKey returns the bucket and key components of a s3:// URL.
Types ¶
type PluginParams ¶
PluginParams must be instantiated by the program to define/constrain the allowed parameters.