Skip to content

Commit

Permalink
examples: replace example go modules with instructions to run
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Caratzas <[email protected]>
  • Loading branch information
bigjust committed May 10, 2023
1 parent 9ac1007 commit 47b954f
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 100 deletions.
2 changes: 2 additions & 0 deletions examples/rgw/golang/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
go.mod
go.sum
13 changes: 9 additions & 4 deletions examples/rgw/golang/object-upload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
This directory contains Golang code examples on how to upload an object to an S3 bucket running on a Ceph RGW cluster.

# Prerequisite
Linux machine running an RGW Ceph cluster. Preferrably started with the ``OSD=1 MON=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh --debug --new `` command.
Go installed on the Linux machine.
Linux machine running an RGW Ceph cluster. Preferrably started with the ``OSD=1 MON=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh --debug --new `` command.
Go installed on the Linux machine.

## Workflow Procedure
1. Install AWS CLI version one on your Linux machine as explained [here](https://docs.aws.amazon.com/cli/v1/userguide/install-linux.html)
2. Create a bucket on the Ceph cluster with the command
2. Create a bucket on the Ceph cluster with the command
```
aws --endpoint-url http://localhost:8000 s3 mb s3://sample-bucket
```
3. Navigate through your file system to where the Golang example code exist on your terminal.
4. Run ``` go mod tidy ``` to install the required Go packages on the system.
4. Install the required Golang packages on the system
```
go mod init examples/object-upload/v2
go get github.com/aws/aws-sdk-go
go mod tidy
```
5. Run the Golang program as ``` go run object-upload.go -b sample-bucket -f fortuna.txt ``` on the terminal window to test out object upload to Ceph RGW cluster.
5 changes: 0 additions & 5 deletions examples/rgw/golang/object-upload/go.mod

This file was deleted.

24 changes: 0 additions & 24 deletions examples/rgw/golang/object-upload/go.sum

This file was deleted.

15 changes: 10 additions & 5 deletions examples/rgw/golang/put-bucket-notification-creation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
This directory contains Golang code examples on how to create a put bucket notification to a topic and S3 bucket running on a Ceph RGW cluster.

# Prerequisite
Linux machine running an RGW Ceph cluster. Preferrably started with the ``OSD=1 MON=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh --debug --new `` command.
Go installed on the Linux machine.
Linux machine running an RGW Ceph cluster. Preferrably started with the ``OSD=1 MON=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh --debug --new `` command.
Go installed on the Linux machine.

## Workflow Procedure
1. Install AWS CLI version one on your Linux machine as explained [here](https://docs.aws.amazon.com/cli/v1/userguide/install-linux.html)
2. Create a topic on the Ceph cluster with the command
2. Create a topic on the Ceph cluster with the command
```
aws --region default --endpoint-url http://localhost:8000 sns create-topic --name=sample-topic --attributes='{"push-endpoint": "http://localhost:10900"}'
```
Expand All @@ -16,8 +16,13 @@ aws --region default --endpoint-url http://localhost:8000 sns create-topic --nam
aws --endpoint-url http://localhost:8000 s3 mb s3://sample-bucket
```
4. Navigate through your file system to where the Golang example code exists on your terminal.
5. Run ``` go mod tidy ``` to install the required Go packages on the system.
6. Run the Golang program as ``` go run put-bucket-notification-creation.go -b sample-bucket -t arn:aws:sns:default::sample-topic ``` on the terminal window to create the put bucket notification with the suffix filter rule.
5. Install the required Golang packages on the system.
```
go mod init examples/put-bucket-notification-creation/v2
go get github.com/aws/aws-sdk-go
go mod tidy
```
6. Run the Golang program as ``` go run put-bucket-notification-creation.go -b sample-bucket -t arn:aws:sns:default::sample-topic ``` on the terminal window to create the put bucket notification with the suffix filter rule.
7. Upload any jpg file you have to the bucket with the command
```
aws --endpoint-url http://localhost:8000 s3 cp your-jpg-file.jpg s3://sample-bucket
Expand Down
5 changes: 0 additions & 5 deletions examples/rgw/golang/put-bucket-notification-creation/go.mod

This file was deleted.

24 changes: 0 additions & 24 deletions examples/rgw/golang/put-bucket-notification-creation/go.sum

This file was deleted.

13 changes: 9 additions & 4 deletions examples/rgw/golang/topic-creation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
This directory contains Golang code example on how to create an SNS Topic on a Ceph RGW cluster.

# Prerequisite
Linux machine running an RGW Ceph cluster. Preferrably started with the ``OSD=1 MON=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh --debug --new `` command.
Go installed on the Linux machine.
Linux machine running an RGW Ceph cluster. Preferrably started with the ``OSD=1 MON=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh --debug --new `` command.
Go installed on the Linux machine.

## Workflow Procedure
1. Navigate through your file system to where the Golang example code exists on your terminal.
2. Run ``` go mod tidy ``` to install the required Golang packages on the system.
3. Run the Golang program as ``` go run topic-creation.go -t sample-topic-1 -a '{"push-endpoint": "http://127.0.0.1:10900"}' ``` on the terminal window to create SNS topic with custom attributes.
2. Install the required Golang packages on the system.
```
go mod init examples/topic-creation/v2
go get github.com/aws/aws-sdk-go
go mod tidy
```
3. Run the Golang program as ``` go run topic-creation.go -t sample-topic-1 -a '{"push-endpoint": "http://127.0.0.1:10900"}' ``` on the terminal window to create SNS topic with custom attributes.
5 changes: 0 additions & 5 deletions examples/rgw/golang/topic-creation/go.mod

This file was deleted.

24 changes: 0 additions & 24 deletions examples/rgw/golang/topic-creation/go.sum

This file was deleted.

0 comments on commit 47b954f

Please sign in to comment.