Skip to content
/ s3-micro Public

This project is an upload and download microservice of Amazon S3.

License

Notifications You must be signed in to change notification settings

lxlxw/s3-micro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S3 microservice

This project is an upload and download microservice of Amazon S3.

Build Status GitHub release Go Report Card GoDoc MIT License HitCount

[ English | 中文 ]

Table of Contents

Installation

Use go get to retrieve the project to add it to your GOPATH workspace, or project's Go module dependencies.

go get github.com/lxlxw/s3-micro

To update the project use go get -u to retrieve the latest version of the project.

go get -u github.com/lxlxw/s3-micro

Configuration

cat ./conf/s3.toml
[S3]
accesskey = "AKIAJCWZ4372EFTEW6ZA"
secretkey = "xxxxxx"
region = "us-east-1"
endpoint = "s3.amazonaws.com"

Build

$ cd "$GOPATH/src/github.com/lxlxw/s3-micro"
make build

Run Grpc Server

make server

Run Http Server

make http

Usage

RESTful API examples

curl -X POST -k http://localhost:8088/api/object/upload -d '{"bucketname": "test_bucket", "key":"test/test.txt", "filecontent":"xxxxxx"}'

You find more detailed api documentation at /doc.

or

open http://localhost:8088/swagger-ui

Grpc examples

create a service client, make a request, handle the error, and process the response.

package main

import (
	"log"

	"golang.org/x/net/context"
	"google.golang.org/grpc"

	pb "github.com/lxlxw/s3-micro/proto"
)

func main() {

	conn, err := grpc.Dial(":50052", grpc.WithInsecure())
	if err != nil {
		log.Println(err)
	}
	defer conn.Close()

	// new client
	c := pb.NewStoreApiServiceClient(conn)

	// call method
	req := &pb.CreateBucketRequest{Bucketname: "test-bucket"}
	res, err := c.CreateBucket(context.Background(), req)
	if err != nil {
		log.Println(err)
	}
	log.Println(res.Msg)
}

Features

  • gRPC
  • RESTful API
  • Swagger UI
  • Middleware
  • App configurable
  • Logging
  • JWT Authorization

Swagger

Support and Feedback

If you find a bug, please submit the issue in Github directly. S3-Micro Issues

Contact

License

S3-Micro is based on the MIT protocol.

http://www.opensource.org/licenses/MIT

About

This project is an upload and download microservice of Amazon S3.

Resources

License

Stars

Watchers

Forks

Packages

No packages published