Skip to content

Commit

Permalink
Merge pull request #11 from nao1215/doc/update-readme
Browse files Browse the repository at this point in the history
Update document for s3hub with gif image
  • Loading branch information
nao1215 authored Dec 29, 2023
2 parents 6964fe8 + ce1dacd commit 4d8c808
Show file tree
Hide file tree
Showing 15 changed files with 334 additions and 29 deletions.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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]
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
21 changes: 21 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

## Reporting a Vulnerability

If you discover any security-related issues or vulnerabilities, please contact us at [[email protected]](mailto:[email protected]). 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.
4 changes: 3 additions & 1 deletion app/domain/model/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
31 changes: 20 additions & 11 deletions app/external/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Binary file added doc/img/s3hub-interactive.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/s3hub-ls.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/s3hub-mb.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/s3hub-rm-all.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions doc/img/vhs/s3hub-ls.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# VHS documentation
#
# Output:
# Output <path>.gif Create a GIF output at the given <path>
# Output <path>.mp4 Create an MP4 output at the given <path>
# Output <path>.webm Create a WebM output at the given <path>
#
# Require:
# Require <string> Ensure a program is on the $PATH to proceed
#
# Settings:
# Set FontSize <number> Set the font size of the terminal
# Set FontFamily <string> Set the font family of the terminal
# Set Height <number> Set the height of the terminal
# Set Width <number> Set the width of the terminal
# Set LetterSpacing <float> Set the font letter spacing (tracking)
# Set LineHeight <float> Set the font line height
# Set LoopOffset <float>% Set the starting frame offset for the GIF loop
# Set Theme <json|string> Set the theme of the terminal
# Set Padding <number> Set the padding of the terminal
# Set Framerate <number> Set the framerate of the recording
# Set PlaybackSpeed <float> Set the playback speed of the recording
# Set MarginFill <file|#000000> Set the file or color the margin will be filled with.
# Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set.
# Set BorderRadius <number> Set terminal border radius, in pixels.
# Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight)
# Set WindowBarSize <number> Set window bar size, in pixels. Default is 40.
# Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms.
#
# Sleep:
# Sleep <time> Sleep for a set amount of <time> in seconds
#
# Type:
# Type[@<time>] "<characters>" Type <characters> into the terminal with a
# <time> delay between each character
#
# Keys:
# Escape[@<time>] [number] Press the Escape key
# Backspace[@<time>] [number] Press the Backspace key
# Delete[@<time>] [number] Press the Delete key
# Insert[@<time>] [number] Press the Insert key
# Down[@<time>] [number] Press the Down key
# Enter[@<time>] [number] Press the Enter key
# Space[@<time>] [number] Press the Space key
# Tab[@<time>] [number] Press the Tab key
# Left[@<time>] [number] Press the Left Arrow key
# Right[@<time>] [number] Press the Right Arrow key
# Up[@<time>] [number] Press the Up Arrow key
# Down[@<time>] [number] Press the Down Arrow key
# PageUp[@<time>] [number] Press the Page Up key
# PageDown[@<time>] [number] Press the Page Down key
# Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C)
#
# Display:
# Hide Hide the subsequent commands from the output
# Show Show the subsequent commands in the output

Output doc/img/s3hub-ls.gif

Require s3hub

Set Shell "bash"
Set FontSize 26
Set Width 1500
Set Height 400

Type "export AWS_PROFILE=localstack" Sleep 200ms Enter
Type "s3hub ls" Sleep 500ms Enter
Sleep 5s
69 changes: 69 additions & 0 deletions doc/img/vhs/s3hub-mb.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# VHS documentation
#
# Output:
# Output <path>.gif Create a GIF output at the given <path>
# Output <path>.mp4 Create an MP4 output at the given <path>
# Output <path>.webm Create a WebM output at the given <path>
#
# Require:
# Require <string> Ensure a program is on the $PATH to proceed
#
# Settings:
# Set FontSize <number> Set the font size of the terminal
# Set FontFamily <string> Set the font family of the terminal
# Set Height <number> Set the height of the terminal
# Set Width <number> Set the width of the terminal
# Set LetterSpacing <float> Set the font letter spacing (tracking)
# Set LineHeight <float> Set the font line height
# Set LoopOffset <float>% Set the starting frame offset for the GIF loop
# Set Theme <json|string> Set the theme of the terminal
# Set Padding <number> Set the padding of the terminal
# Set Framerate <number> Set the framerate of the recording
# Set PlaybackSpeed <float> Set the playback speed of the recording
# Set MarginFill <file|#000000> Set the file or color the margin will be filled with.
# Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set.
# Set BorderRadius <number> Set terminal border radius, in pixels.
# Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight)
# Set WindowBarSize <number> Set window bar size, in pixels. Default is 40.
# Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms.
#
# Sleep:
# Sleep <time> Sleep for a set amount of <time> in seconds
#
# Type:
# Type[@<time>] "<characters>" Type <characters> into the terminal with a
# <time> delay between each character
#
# Keys:
# Escape[@<time>] [number] Press the Escape key
# Backspace[@<time>] [number] Press the Backspace key
# Delete[@<time>] [number] Press the Delete key
# Insert[@<time>] [number] Press the Insert key
# Down[@<time>] [number] Press the Down key
# Enter[@<time>] [number] Press the Enter key
# Space[@<time>] [number] Press the Space key
# Tab[@<time>] [number] Press the Tab key
# Left[@<time>] [number] Press the Left Arrow key
# Right[@<time>] [number] Press the Right Arrow key
# Up[@<time>] [number] Press the Up Arrow key
# Down[@<time>] [number] Press the Down Arrow key
# PageUp[@<time>] [number] Press the Page Up key
# PageDown[@<time>] [number] Press the Page Down key
# Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C)
#
# Display:
# Hide Hide the subsequent commands from the output
# Show Show the subsequent commands in the output

Output doc/img/s3hub-mb.gif

Require s3hub

Set Shell "bash"
Set FontSize 20
Set Width 900
Set Height 300

Type "export AWS_PROFILE=localstack" Sleep 200ms Enter
Type "s3hub mb s3hub-s3-bucket-example" Sleep 500ms Enter
Sleep 5s
69 changes: 69 additions & 0 deletions doc/img/vhs/s3hub-rm-all.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# VHS documentation
#
# Output:
# Output <path>.gif Create a GIF output at the given <path>
# Output <path>.mp4 Create an MP4 output at the given <path>
# Output <path>.webm Create a WebM output at the given <path>
#
# Require:
# Require <string> Ensure a program is on the $PATH to proceed
#
# Settings:
# Set FontSize <number> Set the font size of the terminal
# Set FontFamily <string> Set the font family of the terminal
# Set Height <number> Set the height of the terminal
# Set Width <number> Set the width of the terminal
# Set LetterSpacing <float> Set the font letter spacing (tracking)
# Set LineHeight <float> Set the font line height
# Set LoopOffset <float>% Set the starting frame offset for the GIF loop
# Set Theme <json|string> Set the theme of the terminal
# Set Padding <number> Set the padding of the terminal
# Set Framerate <number> Set the framerate of the recording
# Set PlaybackSpeed <float> Set the playback speed of the recording
# Set MarginFill <file|#000000> Set the file or color the margin will be filled with.
# Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set.
# Set BorderRadius <number> Set terminal border radius, in pixels.
# Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight)
# Set WindowBarSize <number> Set window bar size, in pixels. Default is 40.
# Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms.
#
# Sleep:
# Sleep <time> Sleep for a set amount of <time> in seconds
#
# Type:
# Type[@<time>] "<characters>" Type <characters> into the terminal with a
# <time> delay between each character
#
# Keys:
# Escape[@<time>] [number] Press the Escape key
# Backspace[@<time>] [number] Press the Backspace key
# Delete[@<time>] [number] Press the Delete key
# Insert[@<time>] [number] Press the Insert key
# Down[@<time>] [number] Press the Down key
# Enter[@<time>] [number] Press the Enter key
# Space[@<time>] [number] Press the Space key
# Tab[@<time>] [number] Press the Tab key
# Left[@<time>] [number] Press the Left Arrow key
# Right[@<time>] [number] Press the Right Arrow key
# Up[@<time>] [number] Press the Up Arrow key
# Down[@<time>] [number] Press the Down Arrow key
# PageUp[@<time>] [number] Press the Page Up key
# PageDown[@<time>] [number] Press the Page Down key
# Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C)
#
# Display:
# Hide Hide the subsequent commands from the output
# Show Show the subsequent commands in the output

Output doc/img/s3hub-rm-all.gif

Require s3hub

Set Shell "bash"
Set FontSize 26
Set Width 1200
Set Height 600

Type "export AWS_PROFILE=localstack" Sleep 200ms Enter
Type "s3hub rm test-bucket-on-localstack --force" Sleep 500ms Enter
Sleep 10s
Loading

0 comments on commit 4d8c808

Please sign in to comment.