Skip to content

Commit

Permalink
Merge pull request #71 from bilalcaliskan/devel
Browse files Browse the repository at this point in the history
docs: update documentation
  • Loading branch information
bilalcaliskan authored Jun 12, 2023
2 parents 9cdab77 + 6c87282 commit 889f841
Show file tree
Hide file tree
Showing 24 changed files with 59 additions and 35 deletions.
49 changes: 36 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -21,27 +30,41 @@ 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:
s3-manager [flags]
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.
```
Expand Down
1 change: 1 addition & 0 deletions TODOLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [ ] re-enable prompt/select logic
- [ ] fix code smells
- [ ] fix duplications
- [ ] github issues
- [ ] ~~storageclass~~
- [ ] ~~encryption~~
- [ ] ~~objectlock~~
2 changes: 1 addition & 1 deletion cmd/bucketpolicy/add/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/bucketpolicy/bucketpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/bucketpolicy/remove/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/bucketpolicy/show/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/clean/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/search/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion cmd/search/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
)
2 changes: 1 addition & 1 deletion cmd/search/text/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion cmd/tags/add/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tags/remove/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tags/show/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tags/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/transferacceleration/set/disabled/disabled.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/transferacceleration/set/enabled/enabled.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/transferacceleration/set/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/transferacceleration/show/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/transferacceleration/transferacceleration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/versioning/set/disabled/disabled.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/versioning/set/enabled/enabled.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/versioning/set/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/versioning/show/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/versioning/versioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit 889f841

Please sign in to comment.