2022-05-03 09:45:54 +00:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
import (
|
2023-08-19 14:00:02 +00:00
|
|
|
wp "github.com/thegeeklab/wp-plugin-go/plugin"
|
2022-05-03 09:45:54 +00:00
|
|
|
)
|
|
|
|
|
2023-08-19 14:00:02 +00:00
|
|
|
// Plugin implements provide the plugin implementation.
|
2022-05-03 09:45:54 +00:00
|
|
|
type Plugin struct {
|
2023-08-19 14:00:02 +00:00
|
|
|
*wp.Plugin
|
|
|
|
Settings *Settings
|
2022-05-03 09:45:54 +00:00
|
|
|
}
|
|
|
|
|
2023-08-19 14:00:02 +00:00
|
|
|
// Settings for the Plugin.
|
|
|
|
type Settings struct {
|
|
|
|
Endpoint string
|
|
|
|
AccessKey string
|
|
|
|
SecretKey string
|
|
|
|
Bucket string
|
|
|
|
Region string
|
|
|
|
Source string
|
|
|
|
Target string
|
|
|
|
Delete bool
|
2023-08-21 10:50:44 +00:00
|
|
|
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
|
2023-08-19 14:00:02 +00:00
|
|
|
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
|
2022-05-03 09:45:54 +00:00
|
|
|
}
|