s3copy

package
v0.0.0-...-eeee692 Latest Latest
Warning

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

Go to latest
Published: May 25, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BucketNameRegex = regexp.MustCompile(`^[a-z0-9\-.]+$`)
)

Functions

func S3CopyHandler

func S3CopyHandler(w http.ResponseWriter, r *http.Request)

Takes a request for a task's file to be copied from one s3 location to another. Ensures that if the destination file path already exists, no file copy is performed.

Types

type S3CopyCommand

type S3CopyCommand struct {
	// AwsKey & AwsSecret are provided to make it possible to transfer
	// files to/from any bucket using the appropriate keys for each
	AwsKey    string `mapstructure:"aws_key" plugin:"expand" json:"aws_key"`
	AwsSecret string `mapstructure:"aws_secret" plugin:"expand" json:"aws_secret"`

	// An array of file copy configurations
	S3CopyFiles []*s3CopyFile `mapstructure:"s3_copy_files" plugin:"expand"`
}

The S3CopyPlugin consists of zero or more files that are to be copied from one location in S3 to the other.

func (*S3CopyCommand) AttachTaskFiles

func (c *S3CopyCommand) AttachTaskFiles(pluginLogger plugin.Logger,
	pluginCom plugin.PluginCommunicator, request S3CopyRequest) error

AttachTaskFiles is responsible for sending the specified file to the API Server

func (*S3CopyCommand) Execute

func (scc *S3CopyCommand) Execute(pluginLogger plugin.Logger,
	pluginCom plugin.PluginCommunicator,
	taskConfig *model.TaskConfig,
	stop chan bool) error

Execute carries out the S3CopyCommand command - this is required to satisfy the 'Command' interface

func (*S3CopyCommand) Name

func (scc *S3CopyCommand) Name() string

func (*S3CopyCommand) ParseParams

func (scc *S3CopyCommand) ParseParams(params map[string]interface{}) error

ParseParams decodes the S3 push command parameters that are specified as part of an S3CopyPlugin command; this is required to satisfy the 'Command' interface

func (*S3CopyCommand) Plugin

func (scc *S3CopyCommand) Plugin() string

func (*S3CopyCommand) S3Copy

func (scc *S3CopyCommand) S3Copy(taskConfig *model.TaskConfig,
	pluginLogger plugin.Logger, pluginCom plugin.PluginCommunicator) error

S3Copy is responsible for carrying out the core of the S3CopyPlugin's function - it makes an API calls to copy a given staged file to it's final production destination

type S3CopyPlugin

type S3CopyPlugin struct{}

S3CopyPlugin is used to copy files around in s3

func (*S3CopyPlugin) Configure

func (self *S3CopyPlugin) Configure(map[string]interface{}) error

func (*S3CopyPlugin) GetAPIHandler

func (scp *S3CopyPlugin) GetAPIHandler() http.Handler

func (*S3CopyPlugin) Name

func (scp *S3CopyPlugin) Name() string

Name returns the name of this plugin - it serves to satisfy the 'Plugin' interface

func (*S3CopyPlugin) NewCommand

func (scp *S3CopyPlugin) NewCommand(cmdName string) (plugin.Command, error)

NewCommand returns the S3CopyPlugin - this is to satisfy the 'Plugin' interface

type S3CopyRequest

type S3CopyRequest struct {
	AwsKey              string `json:"aws_key"`
	AwsSecret           string `json:"aws_secret"`
	S3SourceBucket      string `json:"s3_source_bucket"`
	S3SourcePath        string `json:"s3_source_path"`
	S3DestinationBucket string `json:"s3_destination_bucket"`
	S3DestinationPath   string `json:"s3_destination_path"`
	S3DisplayName       string `json:"display_name"`
}

S3CopyRequest holds information necessary for the API server to complete an S3 copy request; namely, an S3 key/secret, a source and a destination path

Jump to

Keyboard shortcuts

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