diff --git a/.github/ISSUE_TEMPLATE/PULL_REQUEST_TEMPLATE.md b/.github/ISSUE_TEMPLATE/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..1117942 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,25 @@ +--- +name: Pull Request +about: Create a pull request to help us improve +title: "[Pull Request] XXX" +labels: "" +assignees: '' + +--- + +## Summary + +[Provide a brief overview and purpose of the PR] + +## Related Issues + +[Link any related issues that this PR addresses, if applicable] + + +## Screenshots (Optional) + +[Include any relevant screenshots or demos of the changes made] + +## Additional Comments + +[Any other information or comments you'd like to share with the reviewers or contributors] diff --git a/CHANGELOG.md b/CHANGELOG.md index d554401..f091b40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ -## [](https://github.com/nao1215/rainbow/compare/77bdf974281a...) (2023-12-26) +## [](https://github.com/nao1215/rainbow/compare/77bdf974281a...) (2023-12-29) +* Add remove subcommand [#10](https://github.com/nao1215/rainbow/pull/10) ([nao1215](https://github.com/nao1215)) +* Add ls subcommand [#9](https://github.com/nao1215/rainbow/pull/9) ([nao1215](https://github.com/nao1215)) +* Add s3hub mb subcommand [#8](https://github.com/nao1215/rainbow/pull/8) ([nao1215](https://github.com/nao1215)) * Add: document for developers [#7](https://github.com/nao1215/rainbow/pull/7) ([nao1215](https://github.com/nao1215)) * Introduce s3hub command interactive UI without logic [#6](https://github.com/nao1215/rainbow/pull/6) ([nao1215](https://github.com/nao1215)) * Add: s3hub subcommand entrypoint. all subcommnads are not implemented yet [#5](https://github.com/nao1215/rainbow/pull/5) ([nao1215](https://github.com/nao1215)) diff --git a/Makefile b/Makefile index 4bd191e..ad0d298 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build test clean changelog tools help docker generate +.PHONY: build test clean changelog tools help docker generate gif S3HUB = s3hub VERSION = $(shell git describe --tags --abbrev=0) @@ -31,10 +31,16 @@ tools: ## Install dependency tools $(GO_INSTALL) github.com/Songmu/ghch/cmd/ghch@latest $(GO_INSTALL) github.com/nao1215/hottest@latest $(GO_INSTALL) github.com/google/wire/cmd/wire@latest + $(GO_INSTALL) github.com/charmbracelet/vhs@latest generate: ## Generate code from templates $(GO) generate ./... +gif: docker ## Generate gif image + vhs < doc/img/vhs/s3hub-mb.tape + vhs < doc/img/vhs/s3hub-ls.tape + vhs < doc/img/vhs/s3hub-rm-all.tape + docker: ## Start docker (localstack) docker compose up -d diff --git a/README.md b/README.md index 5cf7faa..ab0f0f3 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,20 @@ The rainbow project is a toolset for managing AWS resources. This project consis |:--|:--|:--|:--| |[s3hub](./doc/s3hub/README.md)|✅||user-friendly s3 management tool| +### s3hub example +#### Create a bucket(s) +![create_bucket](./doc/img/s3hub-mb.gif) + +#### List buckets +![ls_bucket](./doc/img/s3hub-ls.gif) + +#### Remove a bucket with all objects +![rm_bucket](./doc/img/s3hub-rm-all.gif) + +#### Interactive mode +![interactive_mode](./doc/img/s3hub-interactive.gif) + + ## Template List [WIP] diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..73e9043 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,21 @@ +# Security Policy + +## Reporting a Vulnerability + +If you discover any security-related issues or vulnerabilities, please contact us at [n.chika156@gmail.com](mailto:n.chika156@gmail.com). We appreciate your responsible disclosure and will work with you to address the issue promptly. + +## Supported Versions + +We recommend using the latest release for the most up-to-date and secure experience. Security updates are provided for the latest stable version. + +## Security Policy + +- Security issues are treated with the highest priority. +- We follow responsible disclosure practices. +- Fixes for security vulnerabilities will be provided in a timely manner. + +## Acknowledgments + +We would like to thank the security researchers and contributors who responsibly report security issues and work with us to make our project more secure. + +Thank you for your help in making our project safe and secure for everyone. \ No newline at end of file diff --git a/app/domain/model/s3.go b/app/domain/model/s3.go index 49b5532..f04d1c9 100644 --- a/app/domain/model/s3.go +++ b/app/domain/model/s3.go @@ -16,11 +16,13 @@ const ( // S3DeleteObjectChunksSize is the maximum number of objects that can be deleted in a single request. S3DeleteObjectChunksSize = 500 // MaxS3DeleteObjectsParallelsCount is the maximum number of parallel executions of DeleteObjects. - MaxS3DeleteObjectsParallelsCount = 3 + MaxS3DeleteObjectsParallelsCount = 5 // MaxS3DeleteObjectsRetryCount is the maximum number of retries for DeleteObjects. MaxS3DeleteObjectsRetryCount = 6 // S3DeleteObjectsDelayTimeSec is the delay time in seconds. S3DeleteObjectsDelayTimeSec = 5 + // MaxS3Keys is the maximum number of keys that can be specified in a single request. + MaxS3Keys = 1000 ) // DeleteObjectsRetryCount is the number of retries for DeleteObjects. diff --git a/app/external/s3.go b/app/external/s3.go index f7ee465..a2a277c 100644 --- a/app/external/s3.go +++ b/app/external/s3.go @@ -240,18 +240,27 @@ func NewS3BucketObjectsLister(client *s3.Client) *S3BucketObjectsLister { // ListS3BucketObjects lists the objects in the bucket. func (c *S3BucketObjectsLister) ListS3BucketObjects(ctx context.Context, input *service.S3BucketObjectsListerInput) (*service.S3BucketObjectsListerOutput, error) { - out, err := c.client.ListObjectsV2(ctx, &s3.ListObjectsV2Input{ - Bucket: aws.String(input.Bucket.String()), - }) - if err != nil { - return nil, err - } - var objects model.S3ObjectSets - for _, o := range out.Contents { - objects = append(objects, model.S3Object{ - S3Key: model.S3Key(*o.Key), - }) + in := &s3.ListObjectsV2Input{ + Bucket: aws.String(input.Bucket.String()), + MaxKeys: aws.Int32(model.MaxS3Keys), + } + for { + output, err := c.client.ListObjectsV2(ctx, in) + if err != nil { + return nil, err + } + + for _, o := range output.Contents { + objects = append(objects, model.S3Object{ + S3Key: model.S3Key(*o.Key), + }) + } + + if !*output.IsTruncated { + break + } + in.ContinuationToken = output.NextContinuationToken } return &service.S3BucketObjectsListerOutput{Objects: objects}, nil } diff --git a/doc/img/s3hub-interactive.gif b/doc/img/s3hub-interactive.gif new file mode 100644 index 0000000..eec99ef Binary files /dev/null and b/doc/img/s3hub-interactive.gif differ diff --git a/doc/img/s3hub-ls.gif b/doc/img/s3hub-ls.gif new file mode 100644 index 0000000..4776bde Binary files /dev/null and b/doc/img/s3hub-ls.gif differ diff --git a/doc/img/s3hub-mb.gif b/doc/img/s3hub-mb.gif new file mode 100644 index 0000000..d7ed764 Binary files /dev/null and b/doc/img/s3hub-mb.gif differ diff --git a/doc/img/s3hub-rm-all.gif b/doc/img/s3hub-rm-all.gif new file mode 100644 index 0000000..7b18fda Binary files /dev/null and b/doc/img/s3hub-rm-all.gif differ diff --git a/doc/img/vhs/s3hub-ls.tape b/doc/img/vhs/s3hub-ls.tape new file mode 100644 index 0000000..2476f13 --- /dev/null +++ b/doc/img/vhs/s3hub-ls.tape @@ -0,0 +1,69 @@ +# VHS documentation +# +# Output: +# Output .gif Create a GIF output at the given +# Output .mp4 Create an MP4 output at the given +# Output .webm Create a WebM output at the given +# +# Require: +# Require Ensure a program is on the $PATH to proceed +# +# Settings: +# Set FontSize Set the font size of the terminal +# Set FontFamily Set the font family of the terminal +# Set Height Set the height of the terminal +# Set Width Set the width of the terminal +# Set LetterSpacing Set the font letter spacing (tracking) +# Set LineHeight Set the font line height +# Set LoopOffset % Set the starting frame offset for the GIF loop +# Set Theme Set the theme of the terminal +# Set Padding Set the padding of the terminal +# Set Framerate Set the framerate of the recording +# Set PlaybackSpeed Set the playback speed of the recording +# Set MarginFill Set the file or color the margin will be filled with. +# Set Margin Set the size of the margin. Has no effect if MarginFill isn't set. +# Set BorderRadius Set terminal border radius, in pixels. +# Set WindowBar Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight) +# Set WindowBarSize Set window bar size, in pixels. Default is 40. +# Set TypingSpeed