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"
|
|
|
|
"github.com/thegeeklab/wp-plugin-go/types"
|
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
|
|
|
|
ACL types.StringMapFlag
|
|
|
|
CacheControl types.StringMapFlag
|
|
|
|
ContentType types.StringMapFlag
|
|
|
|
ContentEncoding types.StringMapFlag
|
|
|
|
Metadata types.DeepStringMapFlag
|
|
|
|
Redirects types.StringMapFlag
|
|
|
|
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
|
|
|
}
|