Skip to content

Commit

Permalink
Merge pull request #62 from drone-plugins/storage-class
Browse files Browse the repository at this point in the history
Integrate setting for storage class to use
  • Loading branch information
tboerger committed Nov 7, 2020
2 parents 11c7f46 + 322a9b1 commit f6fdfaf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ func main() {
EnvVar: "PLUGIN_CACHE_CONTROL",
Value: &StringMapFlag{},
},
cli.StringFlag{
Name: "storage-class",
Usage: "set storage class to choose the best backend",
EnvVar: "PLUGIN_STORAGE_CLASS",
},
cli.StringFlag{
Name: "env-file",
Usage: "source env file",
Expand Down Expand Up @@ -138,6 +143,7 @@ func run(c *cli.Context) error {
ContentType: c.Generic("content-type").(*StringMapFlag).Get(),
ContentEncoding: c.Generic("content-encoding").(*StringMapFlag).Get(),
CacheControl: c.Generic("cache-control").(*StringMapFlag).Get(),
StorageClass: c.String("storage-class"),
PathStyle: c.Bool("path-style"),
DryRun: c.Bool("dry-run"),
}
Expand Down
7 changes: 7 additions & 0 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ type Plugin struct {
// Sets the Cache-Control header on each uploaded object based on a extension map
CacheControl map[string]string

// Sets the storage class, affects the storage backend costs
StorageClass string

// Copies the files from the specified directory.
// Regexp matching will apply to match multiple
// files
Expand Down Expand Up @@ -196,6 +199,10 @@ func (p *Plugin) Exec() error {
putObjectInput.ServerSideEncryption = aws.String(p.Encryption)
}

if p.StorageClass != "" {
putObjectInput.StorageClass = &(p.StorageClass)
}

_, err = client.PutObject(putObjectInput)

if err != nil {
Expand Down

0 comments on commit f6fdfaf

Please sign in to comment.