mirror of
https://github.com/thegeeklab/wp-s3-action.git
synced 2024-11-14 00:00:39 +00:00
58 lines
1.2 KiB
Go
58 lines
1.2 KiB
Go
package plugin
|
|
|
|
import (
|
|
wp "github.com/thegeeklab/wp-plugin-go/plugin"
|
|
)
|
|
|
|
// Plugin implements provide the plugin implementation.
|
|
type Plugin struct {
|
|
*wp.Plugin
|
|
Settings *Settings
|
|
}
|
|
|
|
// Settings for the Plugin.
|
|
type Settings struct {
|
|
Endpoint string
|
|
AccessKey string
|
|
SecretKey string
|
|
Bucket string
|
|
Region string
|
|
Source string
|
|
Target string
|
|
Delete bool
|
|
ACL map[string]string
|
|
CacheControl map[string]string
|
|
ContentType map[string]string
|
|
ContentEncoding map[string]string
|
|
Metadata map[string]map[string]string
|
|
Redirects map[string]string
|
|
CloudFrontDistribution string
|
|
DryRun bool
|
|
PathStyle bool
|
|
Client AWS
|
|
Jobs []Job
|
|
MaxConcurrency int
|
|
}
|
|
|
|
type Job struct {
|
|
local string
|
|
remote string
|
|
action string
|
|
}
|
|
|
|
type Result struct {
|
|
j Job
|
|
err error
|
|
}
|
|
|
|
func New(options wp.Options, settings *Settings) *Plugin {
|
|
p := &Plugin{}
|
|
|
|
options.Execute = p.run
|
|
|
|
p.Plugin = wp.New(options)
|
|
p.Settings = settings
|
|
|
|
return p
|
|
}
|