Skip to content

vishrantgupta/minio-go

Repository files navigation

Minio Go Library for Amazon S3 Compatible Cloud Storage Gitter

Description

Minio Go library is a simple client library for S3 compatible cloud storage servers. Supports AWS Signature Version 4 and 2. AWS Signature Version 4 is chosen as default.

List of supported cloud storage providers.

  • AWS Signature Version 4

    • Amazon S3
    • Minio
  • AWS Signature Version 2

    • Google Cloud Storage (Compatibility Mode)
    • Openstack Swift + Swift3 middleware
    • Ceph Object Gateway
    • Riak CS

Install

$ go get github.com/minio/minio-go

Example

ListBuckets() - AWS Signature Version 4.

This example shows how to List your buckets with default AWS Signature Version 4.

package main

import (
	"log"

	"github.com/minio/minio-go"
)

func main() {
	config := minio.Config{
		AccessKeyID:     "YOUR-ACCESS-KEY-HERE",
		SecretAccessKey: "YOUR-PASSWORD-HERE",
		Endpoint:        "https://s3.amazonaws.com",
	}
	s3Client, err := minio.New(config)
	if err != nil {
	    log.Fatalln(err)
	}
	for bucket := range s3Client.ListBuckets() {
		if bucket.Err != nil {
			log.Fatalln(bucket.Err)
		}
		log.Println(bucket.Stat)
	}
}

ListBuckets() - AWS Signature Version 2.

This example shows how to List your buckets with AWS Signature Version 2.

package main

import (
	"log"

	"github.com/minio/minio-go"
)

func main() {
	config := minio.Config{
		AccessKeyID:     "YOUR-ACCESS-KEY-HERE",
		SecretAccessKey: "YOUR-PASSWORD-HERE",
		Endpoint:        "https://s3.amazonaws.com",
		Signature:       minio.SignatureV2,        
	}
	s3Client, err := minio.New(config)
	if err != nil {
	    log.Fatalln(err)
	}
	for bucket := range s3Client.ListBuckets() {
		if bucket.Err != nil {
			log.Fatalln(bucket.Err)
		}
		log.Println(bucket.Stat)
	}
}

Documentation

Bucket Level

Object Level

Presigned Bucket/Object Level

Additional Documentation

More examples with AWS Signature Version 2 can be found here

API Reference

GoDoc

Contribute

Contributors Guide

Build Status Build status

About

MinIO Go client SDK for S3 compatible object storage

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.9%
  • Makefile 0.1%