2
2
mirror of https://github.com/octoleo/restic.git synced 2024-09-27 14:09:01 +00:00
restic/vendor/src/github.com/minio/minio-go
Alexander Neumann 56dd4c0595 Update minio-go
2016-07-29 20:28:44 +02:00
..
docs Update minio-go 2016-07-29 20:28:44 +02:00
examples/s3 Update minio-go 2016-07-29 20:28:44 +02:00
api_functional_v2_test.go Update minio-go 2016-07-29 20:28:44 +02:00
api_functional_v4_test.go Update minio-go 2016-07-29 20:28:44 +02:00
api_unit_test.go Update minio-go 2016-07-29 20:28:44 +02:00
api-datatypes.go Update minio-go 2016-05-07 23:38:41 +02:00
api-error-response_test.go Update minio-go 2016-05-08 11:24:24 +02:00
api-error-response.go Update minio-go 2016-06-08 21:11:48 +02:00
api-get-object-file.go Move things around for gb 2016-02-20 17:31:20 +01:00
api-get-object.go Update minio-go 2016-07-29 20:28:44 +02:00
api-get-policy_test.go Update minio-go 2016-05-08 11:24:24 +02:00
api-get-policy.go Update minio-go 2016-05-08 11:24:24 +02:00
api-list.go Update minio-go 2016-07-29 20:28:44 +02:00
api-notification.go Update minio-go 2016-07-29 20:28:44 +02:00
api-presigned.go Update minio-go 2016-07-29 20:28:44 +02:00
api-put-bucket_test.go Update minio-go 2016-07-29 20:28:44 +02:00
api-put-bucket.go Update minio-go 2016-07-29 20:28:44 +02:00
api-put-object-common.go Update minio-go 2016-07-29 20:28:44 +02:00
api-put-object-copy.go Update minio-go 2016-07-29 20:28:44 +02:00
api-put-object-file.go Update minio-go 2016-07-29 20:28:44 +02:00
api-put-object-multipart.go Update minio-go 2016-07-29 20:28:44 +02:00
api-put-object-progress.go Update minio-go 2016-05-07 23:38:41 +02:00
api-put-object-readat.go Update minio-go 2016-07-29 20:28:44 +02:00
api-put-object.go Update minio-go 2016-07-29 20:28:44 +02:00
api-remove.go Update minio-go 2016-07-29 20:28:44 +02:00
api-s3-datatypes.go Update minio-go 2016-07-29 20:28:44 +02:00
api-stat.go Update minio-go 2016-05-07 23:38:41 +02:00
api.go Update minio-go 2016-07-29 20:28:44 +02:00
appveyor.yml Update minio-go 2016-05-07 23:38:41 +02:00
bucket-cache_test.go Update minio-go 2016-07-29 20:28:44 +02:00
bucket-cache.go Update minio-go 2016-07-29 20:28:44 +02:00
bucket-notification.go Update minio-go 2016-07-29 20:28:44 +02:00
bucket-policy_test.go Update minio-go 2016-07-29 20:28:44 +02:00
bucket-policy.go Update minio-go 2016-07-29 20:28:44 +02:00
constants.go Update minio-go 2016-07-29 20:28:44 +02:00
CONTRIBUTING.md Update minio-go 2016-05-07 23:38:41 +02:00
copy-conditions.go Update minio-go 2016-07-29 20:28:44 +02:00
hook-reader.go Update minio-go 2016-05-07 23:38:41 +02:00
LICENSE Move things around for gb 2016-02-20 17:31:20 +01:00
MAINTAINERS.md Move things around for gb 2016-02-20 17:31:20 +01:00
post-policy.go Move things around for gb 2016-02-20 17:31:20 +01:00
README.md Update minio-go 2016-07-29 20:28:44 +02:00
request-signature-v2_test.go Update minio-go 2016-05-07 23:38:41 +02:00
request-signature-v2.go Update minio-go 2016-07-29 20:28:44 +02:00
request-signature-v4.go Move things around for gb 2016-02-20 17:31:20 +01:00
retry.go Update minio-go 2016-05-08 11:24:24 +02:00
s3-endpoints.go Update minio-go 2016-05-07 23:38:41 +02:00
signature-type.go Move things around for gb 2016-02-20 17:31:20 +01:00
tempfile.go Move things around for gb 2016-02-20 17:31:20 +01:00
test-utils_test.go Update minio-go 2016-05-08 11:24:24 +02:00
utils_test.go Update minio-go 2016-07-29 20:28:44 +02:00
utils.go Update minio-go 2016-07-29 20:28:44 +02:00

Minio Golang Library for Amazon S3 Compatible Cloud Storage Gitter

The Minio Golang Client SDK provides simple APIs to access any Amazon S3 compatible object storage server.

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

This quickstart guide will show you how to install the client SDK and execute an example Golang program. For a complete list of APIs and examples, please take a look at the Golang Client API Reference documentation.

This document assumes that you have a working Golang setup in place.

Download from Github


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

Initialize Minio Client

You need four items in order to connect to Minio object storage server.

Params Description
endpoint URL to object storage service.
accessKeyID Access key is like user ID that uniquely identifies your account.
secretAccessKey Secret key is the password to your account.
secure Set this value to 'true' to enable secure (HTTPS) access.

package main

import (
  "fmt"

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

func main() {
        // Use a secure connection.
        ssl := true

        // Initialize minio client object.
        minioClient, err := minio.New("play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", ssl)
        if err != nil {
                fmt.Println(err)
                return
        }
}

Quick Start Example - File Uploader

This example program connects to an object storage server, makes a bucket on the server and then uploads a file to the bucket.

We will use the Minio server running at https://play.minio.io:9000 in this example. Feel free to use this service for testing and development. Access credentials shown in this example are open to the public.

FileUploader.go


package main

import "fmt"
import (
        "log"

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

func main() {
        // Use a secure connection.
        ssl := true

        // Initialize minio client object.
        minioClient, err := minio.New("play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", ssl)
        if err != nil {
                log.Fatalln(err)
        }
  
        // Make a new bucket called mymusic.
        err = minioClient.MakeBucket("mymusic", "us-east-1")
        if err != nil {
                log.Fatalln(err)
        }
        fmt.Println("Successfully created mymusic")
  
        // Upload the zip file with FPutObject.
        n, err := minioClient.FPutObject("mymusic", "golden-oldies.zip", "/tmp/golden-oldies.zip", "application/zip")
        if err != nil {
                log.Fatalln(err)
        }
        log.Printf("Successfully uploaded golden-oldies.zip of size %d\n", n)
}

Run FileUploader


$ go run file-uploader.go
$ Successfully created mymusic 
$ Successfully uploaded golden-oldies.zip of size 17MiB

$ mc ls play/mymusic/
[2016-05-27 16:02:16 PDT]  17MiB golden-oldies.zip

API Reference

The full API Reference is available here.

API Reference : Bucket Operations

API Reference : Bucket policy Operations

API Reference : Bucket notification Operations

API Reference : File Object Operations

API Reference : Object Operations

API Reference : Presigned Operations

Full Examples

Full Examples : Bucket Operations

Full Examples : Bucket policy Operations

Full Examples : Bucket notification Operations

Full Examples : File Object Operations

Full Examples : Object Operations

Full Examples : Presigned Operations

Explore Further

Contribute

Contributors Guide

Build Status Build status