diff --git a/README.md b/README.md index 59fc45b..1abe70f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,16 @@ [![Go version](https://img.shields.io/github/go-mod/go-version/bilalcaliskan/s3-manager)](https://github.com/bilalcaliskan/s3-manager) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -**TBD** +It is a tool written with Golang that helps you make the following actions on an AWS S3 bucket: +- Searches a string in files (supports regex) +- Finds files (supports regex) +- Sets up a file cleaning rule that matches specific pattern (great idea to check flags on [cmd/clean/options/options.go](cmd/clean/options/options.go)) +- Sets/shows tags +- Sets/shows versioning configuration +- Sets/shows transfer acceleration configuration +- Sets/shows bucket policy + +## Access Credentials You can provide access credentials of your AWS account with below environment variables or CLI flags. Keep in mind that command line flags will override environment variables if you set both of them: @@ -21,6 +30,16 @@ will override environment variables if you set both of them: "--bucketName" CLI flag or "AWS_BUCKET_NAME" environment variable ``` +## Available Subcommands +Here is the list of available subcommands of **s3-manager**: + +- [clean](cmd/clean) +- [search](cmd/search) +- [tags](cmd/tags) +- [versioning](cmd/versioning) +- [bucketpolicy](cmd/bucketpolicy) +- [transferacceleration](cmd/transferacceleration) + ## Configuration ``` Usage: @@ -28,20 +47,24 @@ Usage: s3-manager [command] Available Commands: - clean clean subcommand cleans the app, finds and clears desired files - completion Generate the autocompletion script for the specified shell - search search subcommand searches the files which has desired substrings in it - configure configure subcommand configures the bucket level settings - help Help about any command + bucketpolicy + clean clean subcommand cleans the app, finds and clears desired files + completion Generate the autocompletion script for the specified shell + help Help about any command + search search subcommand searches the files which has desired substrings in it + tags + transferacceleration + versioning Flags: - --accessKey string access key credential to access S3 bucket, this value also can be passed via "AWS_ACCESS_KEY" environment variable (default "") - --bucketName string name of the target bucket on S3, this value also can be passed via "AWS_BUCKET_NAME" environment variable (default "") - -h, --help help for s3-manager - --region string region of the target bucket on S3, this value also can be passed via "AWS_REGION" environment variable (default "") - --secretKey string secret key credential to access S3 bucket, this value also can be passed via "AWS_SECRET_KEY" environment variable (default "") - --verbose verbose output of the logging library (default false) - -v, --version version for s3-manager + --accessKey string access key credential to access S3 bucket, this value also can be passed via "AWS_ACCESS_KEY" environment variable (default "") + --bannerFilePath string relative path of the banner file (default "banner.txt") + --bucketName string name of the target bucket on S3, this value also can be passed via "AWS_BUCKET_NAME" environment variable (default "") + -h, --help help for s3-manager + --region string region of the target bucket on S3, this value also can be passed via "AWS_REGION" environment variable (default "") + --secretKey string secret key credential to access S3 bucket, this value also can be passed via "AWS_SECRET_KEY" environment variable (default "") + --verbose verbose output of the logging library (default false) + -v, --version version for s3-manager Use "s3-manager [command] --help" for more information about a command. ``` diff --git a/TODOLIST.md b/TODOLIST.md index 8c5eb1c..ef0cf40 100644 --- a/TODOLIST.md +++ b/TODOLIST.md @@ -8,6 +8,7 @@ - [ ] re-enable prompt/select logic - [ ] fix code smells - [ ] fix duplications +- [ ] github issues - [ ] ~~storageclass~~ - [ ] ~~encryption~~ - [ ] ~~objectlock~~ diff --git a/cmd/bucketpolicy/add/add.go b/cmd/bucketpolicy/add/add.go index 39644b7..d911ae6 100644 --- a/cmd/bucketpolicy/add/add.go +++ b/cmd/bucketpolicy/add/add.go @@ -23,7 +23,7 @@ var ( bucketPolicyOpts *options2.BucketPolicyOptions AddCmd = &cobra.Command{ Use: "add", - Short: "", + Short: "adds a bucket policy configuration for the target bucket by specifying a valid policy file", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/bucketpolicy/bucketpolicy.go b/cmd/bucketpolicy/bucketpolicy.go index cafc44a..0bc9b3c 100644 --- a/cmd/bucketpolicy/bucketpolicy.go +++ b/cmd/bucketpolicy/bucketpolicy.go @@ -19,7 +19,7 @@ func init() { var ( BucketPolicyCmd = &cobra.Command{ Use: "bucketpolicy", - Short: "", + Short: "shows/sets the bucket policy configuration of the target bucket", SilenceUsage: true, SilenceErrors: true, } diff --git a/cmd/bucketpolicy/remove/remove.go b/cmd/bucketpolicy/remove/remove.go index d903c86..6907c19 100644 --- a/cmd/bucketpolicy/remove/remove.go +++ b/cmd/bucketpolicy/remove/remove.go @@ -19,7 +19,7 @@ var ( bucketPolicyOpts *options2.BucketPolicyOptions RemoveCmd = &cobra.Command{ Use: "remove", - Short: "", + Short: "removes the current bucket policy configuration of the target bucket", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/bucketpolicy/show/show.go b/cmd/bucketpolicy/show/show.go index 40839a3..58ec9fc 100644 --- a/cmd/bucketpolicy/show/show.go +++ b/cmd/bucketpolicy/show/show.go @@ -24,7 +24,7 @@ var ( bucketPolicyOpts *options2.BucketPolicyOptions ShowCmd = &cobra.Command{ Use: "show", - Short: "", + Short: "shows the bucket policy configuration of the target bucket", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/clean/clean.go b/cmd/clean/clean.go index f4e5469..5bf2c32 100644 --- a/cmd/clean/clean.go +++ b/cmd/clean/clean.go @@ -36,7 +36,7 @@ var ( // CleanCmd represents the clean command CleanCmd = &cobra.Command{ Use: "clean", - Short: "clean subcommand cleans the app, finds and clears desired files", + Short: "finds and clears desired files by a pre-configured rule set", SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { svc = cmd.Context().Value(rootopts.S3SvcKey{}).(*s3.S3) diff --git a/cmd/search/file/file.go b/cmd/search/file/file.go index d2d7c7d..4162aa9 100644 --- a/cmd/search/file/file.go +++ b/cmd/search/file/file.go @@ -23,7 +23,7 @@ var ( svc s3iface.S3API FileCmd = &cobra.Command{ Use: "file", - Short: "", + Short: "searches the files which has desired file name pattern in it (supports regex)", SilenceUsage: true, PreRunE: func(cmd *cobra.Command, args []string) error { svc, searchOpts, logger = utils.PrepareConstants(cmd, options.GetSearchOptions()) diff --git a/cmd/search/search.go b/cmd/search/search.go index 2479a63..87bf4f6 100644 --- a/cmd/search/search.go +++ b/cmd/search/search.go @@ -15,7 +15,7 @@ func init() { var ( SearchCmd = &cobra.Command{ Use: "search", - Short: "search subcommand searches the files which has desired substrings in it", + Short: "searches the files which has desired substrings in it", SilenceUsage: true, } ) diff --git a/cmd/search/text/text.go b/cmd/search/text/text.go index 162f938..01b575b 100644 --- a/cmd/search/text/text.go +++ b/cmd/search/text/text.go @@ -23,7 +23,7 @@ var ( svc s3iface.S3API TextCmd = &cobra.Command{ Use: "text", - Short: "", + Short: "searches the texts in files which has desired file name pattern and string pattern in it (supports regex)", SilenceUsage: true, PreRunE: func(cmd *cobra.Command, args []string) error { svc, searchOpts, logger = utils.PrepareConstants(cmd, options.GetSearchOptions()) diff --git a/cmd/tags/add/add.go b/cmd/tags/add/add.go index c59731d..b2f36fb 100644 --- a/cmd/tags/add/add.go +++ b/cmd/tags/add/add.go @@ -24,7 +24,7 @@ var ( tagOpts *options.TagOptions AddCmd = &cobra.Command{ Use: "add", - Short: "", + Short: "adds the tagging configuration for the target bucket", SilenceUsage: true, SilenceErrors: true, PreRunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/tags/remove/remove.go b/cmd/tags/remove/remove.go index f2f6a6e..9cc59df 100644 --- a/cmd/tags/remove/remove.go +++ b/cmd/tags/remove/remove.go @@ -28,7 +28,7 @@ var ( tagOpts *options.TagOptions RemoveCmd = &cobra.Command{ Use: "remove", - Short: "", + Short: "removes the tagging configuration for the target bucket", SilenceUsage: true, SilenceErrors: true, PreRunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/tags/show/show.go b/cmd/tags/show/show.go index 609471b..7cda863 100644 --- a/cmd/tags/show/show.go +++ b/cmd/tags/show/show.go @@ -24,7 +24,7 @@ var ( tagOpts *options.TagOptions ShowCmd = &cobra.Command{ Use: "show", - Short: "", + Short: "shows the tagging configuration for the target bucket", SilenceUsage: true, SilenceErrors: true, PreRunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/tags/tags.go b/cmd/tags/tags.go index 776fc48..1d5661d 100644 --- a/cmd/tags/tags.go +++ b/cmd/tags/tags.go @@ -16,7 +16,7 @@ func init() { var ( TagsCmd = &cobra.Command{ Use: "tags", - Short: "", + Short: "shows/sets the tagging configuration of the target bucket", SilenceUsage: true, SilenceErrors: true, } diff --git a/cmd/transferacceleration/set/disabled/disabled.go b/cmd/transferacceleration/set/disabled/disabled.go index 0d51f4c..8110fc4 100644 --- a/cmd/transferacceleration/set/disabled/disabled.go +++ b/cmd/transferacceleration/set/disabled/disabled.go @@ -20,7 +20,7 @@ var ( transferAccelerationOpts *options2.TransferAccelerationOptions DisabledCmd = &cobra.Command{ Use: "disabled", - Short: "", + Short: "disables the transfer acceleration configuration for the target bucket", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/transferacceleration/set/enabled/enabled.go b/cmd/transferacceleration/set/enabled/enabled.go index 0edee41..d3dd4f1 100644 --- a/cmd/transferacceleration/set/enabled/enabled.go +++ b/cmd/transferacceleration/set/enabled/enabled.go @@ -19,7 +19,7 @@ var ( transferAccelerationOpts *options.TransferAccelerationOptions EnabledCmd = &cobra.Command{ Use: "enabled", - Short: "", + Short: "enables the transfer acceleration configuration for the target bucket", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/transferacceleration/set/set.go b/cmd/transferacceleration/set/set.go index 4580d9a..e011296 100644 --- a/cmd/transferacceleration/set/set.go +++ b/cmd/transferacceleration/set/set.go @@ -14,7 +14,7 @@ func init() { var ( SetCmd = &cobra.Command{ Use: "set", - Short: "", + Short: "sets the transfer acceleration configuration for the target bucket (enabled/disabled)", SilenceUsage: true, SilenceErrors: true, } diff --git a/cmd/transferacceleration/show/show.go b/cmd/transferacceleration/show/show.go index c922e7e..1aa121f 100644 --- a/cmd/transferacceleration/show/show.go +++ b/cmd/transferacceleration/show/show.go @@ -24,7 +24,7 @@ var ( transferAccelerationOpts *options.TransferAccelerationOptions ShowCmd = &cobra.Command{ Use: "show", - Short: "", + Short: "shows the transfer acceleration configuration for the target bucket", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/transferacceleration/transferacceleration.go b/cmd/transferacceleration/transferacceleration.go index 16e8679..ad83abe 100644 --- a/cmd/transferacceleration/transferacceleration.go +++ b/cmd/transferacceleration/transferacceleration.go @@ -14,7 +14,7 @@ func init() { var ( TransferAccelerationCmd = &cobra.Command{ Use: "transferacceleration", - Short: "", + Short: "shows/sets the transfer acceleration configuration of the target bucket", SilenceUsage: true, SilenceErrors: true, } diff --git a/cmd/versioning/set/disabled/disabled.go b/cmd/versioning/set/disabled/disabled.go index eda3690..0490052 100644 --- a/cmd/versioning/set/disabled/disabled.go +++ b/cmd/versioning/set/disabled/disabled.go @@ -20,7 +20,7 @@ var ( versioningOpts *options.VersioningOptions DisabledCmd = &cobra.Command{ Use: "disabled", - Short: "", + Short: "disables the versioning configuration for the target bucket", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/versioning/set/enabled/enabled.go b/cmd/versioning/set/enabled/enabled.go index 0a29217..579be53 100644 --- a/cmd/versioning/set/enabled/enabled.go +++ b/cmd/versioning/set/enabled/enabled.go @@ -19,7 +19,7 @@ var ( versioningOpts *options.VersioningOptions EnabledCmd = &cobra.Command{ Use: "enabled", - Short: "", + Short: "enables the versioning configuration for the target bucket", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/versioning/set/set.go b/cmd/versioning/set/set.go index 99077a9..8908fa5 100644 --- a/cmd/versioning/set/set.go +++ b/cmd/versioning/set/set.go @@ -14,7 +14,7 @@ func init() { var ( SetCmd = &cobra.Command{ Use: "set", - Short: "", + Short: "sets the versioning configuration for the target bucket (enabled/disabled)", SilenceUsage: true, SilenceErrors: true, } diff --git a/cmd/versioning/show/show.go b/cmd/versioning/show/show.go index 0e95ae3..3fbeb3a 100644 --- a/cmd/versioning/show/show.go +++ b/cmd/versioning/show/show.go @@ -23,7 +23,7 @@ var ( versioningOpts *options.VersioningOptions ShowCmd = &cobra.Command{ Use: "show", - Short: "", + Short: "shows the versioning configuration for the target bucket", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/cmd/versioning/versioning.go b/cmd/versioning/versioning.go index 7f21893..580a98e 100644 --- a/cmd/versioning/versioning.go +++ b/cmd/versioning/versioning.go @@ -14,7 +14,7 @@ func init() { var ( VersioningCmd = &cobra.Command{ Use: "versioning", - Short: "", + Short: "shows/sets the versioning configuration of the target bucket", SilenceUsage: true, SilenceErrors: true, }