s3-micro

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2019 License: MIT Imports: 2 Imported by: 0

README

S3 microservice

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

Build Status GitHub release Go Report Card GoDoc MIT License

[ 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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
pkg
s3
Package proto is a reverse proxy.
Package proto is a reverse proxy.
google/api
Package google_api is a generated protocol buffer package.
Package google_api is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL