2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 14:56:29 +00:00
restic/vendor/github.com/minio/minio-go
2018-03-30 12:33:40 +02:00
..
docs Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
examples Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
pkg Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
.gitignore Update minio-go 2017-12-08 20:45:59 +01:00
.travis.yml Update minio-go 2017-12-08 20:45:59 +01:00
api_unit_test.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-compose-object_test.go Update minio-go 2017-12-08 20:45:59 +01:00
api-compose-object.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-datatypes.go Update dependencies 2018-01-23 19:40:42 +01:00
api-error-response_test.go Update minio-go 2017-12-08 20:45:59 +01:00
api-error-response.go Update minio-go 2017-12-08 20:45:59 +01:00
api-get-object-context.go Update minio-go 2017-12-08 20:45:59 +01:00
api-get-object-file.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-get-object.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-get-options.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-get-policy.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-list.go Update minio-go 2017-12-08 20:45:59 +01:00
api-notification.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-presigned.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-put-bucket.go Update minio-go 2017-12-08 20:45:59 +01:00
api-put-object_test.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-put-object-common.go Update minio-go 2017-12-08 20:45:59 +01:00
api-put-object-context.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-put-object-copy.go Update minio-go 2017-12-08 20:45:59 +01:00
api-put-object-file-context.go Update minio-go 2017-12-08 20:45:59 +01:00
api-put-object-file.go Update minio-go 2017-12-08 20:45:59 +01:00
api-put-object-multipart.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-put-object-streaming.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-put-object.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-remove.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api-s3-datatypes.go Update minio-go 2017-12-08 20:45:59 +01:00
api-stat.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
api.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
appveyor.yml Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
bucket-cache_test.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
bucket-cache.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
bucket-notification.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
constants.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
CONTRIBUTING.md Vendor dependencies with dep 2017-07-23 14:25:38 +02:00
core_test.go Update dependencies 2018-01-23 19:40:42 +01:00
core.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
functional_tests.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
get-options_test.go Update minio-go 2017-12-08 20:45:59 +01:00
hook-reader.go Update minio-go 2017-12-08 20:45:59 +01:00
LICENSE Vendor dependencies with dep 2017-07-23 14:25:38 +02:00
MAINTAINERS.md Update minio-go 2017-12-08 20:45:59 +01:00
Makefile Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
NOTICE Update minio-go 2017-12-08 20:45:59 +01:00
post-policy.go Update minio-go 2017-12-08 20:45:59 +01:00
README_zh_CN.md Update dependencies 2018-01-23 19:40:42 +01:00
README.md Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
retry-continous.go Update minio-go 2017-12-08 20:45:59 +01:00
retry.go Update dependencies 2018-01-23 19:40:42 +01:00
s3-endpoints.go Update dependencies 2018-01-23 19:40:42 +01:00
s3-error.go Update minio-go 2017-12-08 20:45:59 +01:00
test-utils_test.go Update minio-go 2017-12-08 20:45:59 +01:00
transport.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
utils_test.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00
utils.go Update vendored library github.com/minio/minio-go 2018-03-30 12:33:40 +02:00

Minio Go Client SDK for Amazon S3 Compatible Cloud Storage Slack Sourcegraph Apache V2 License

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

This quickstart guide will show you how to install the Minio client SDK, connect to Minio, and provide a walkthrough for a simple file uploader. For a complete list of APIs and examples, please take a look at the Go Client API Reference.

This document assumes that you have a working Go development environment.

Download from Github

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

Initialize Minio Client

Minio client requires the following four parameters specified to connect to an Amazon S3 compatible object storage.

Parameter Description
endpoint URL to object storage service.
accessKeyID Access key is the 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 (
	"github.com/minio/minio-go"
	"log"
)

func main() {
	endpoint := "play.minio.io:9000"
	accessKeyID := "Q3AM3UQ867SPQQA43P2F"
	secretAccessKey := "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
	useSSL := true

	// Initialize minio client object.
	minioClient, err := minio.New(endpoint, accessKeyID, secretAccessKey, useSSL)
	if err != nil {
		log.Fatalln(err)
	}

	log.Printf("%#v\n", minioClient) // minioClient is now setup
}

Quick Start Example - File Uploader

This example program connects to an object storage server, creates a bucket and 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 (
	"github.com/minio/minio-go"
	"log"
)

func main() {
	endpoint := "play.minio.io:9000"
	accessKeyID := "Q3AM3UQ867SPQQA43P2F"
	secretAccessKey := "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
	useSSL := true

	// Initialize minio client object.
	minioClient, err := minio.New(endpoint, accessKeyID, secretAccessKey, useSSL)
	if err != nil {
		log.Fatalln(err)
	}

	// Make a new bucket called mymusic.
	bucketName := "mymusic"
	location := "us-east-1"

	err = minioClient.MakeBucket(bucketName, location)
	if err != nil {
		// Check to see if we already own this bucket (which happens if you run this twice)
		exists, err := minioClient.BucketExists(bucketName)
		if err == nil && exists {
			log.Printf("We already own %s\n", bucketName)
		} else {
			log.Fatalln(err)
		}
	}
	log.Printf("Successfully created %s\n", bucketName)

	// Upload the zip file
	objectName := "golden-oldies.zip"
	filePath := "/tmp/golden-oldies.zip"
	contentType := "application/zip"

	// Upload the zip file with FPutObject
	n, err := minioClient.FPutObject(bucketName, objectName, filePath, minio.PutObjectOptions{ContentType:contentType})
	if err != nil {
		log.Fatalln(err)
	}

	log.Printf("Successfully uploaded %s of size %d\n", objectName, n)
}

Run FileUploader

go run file-uploader.go
2016/08/13 17:03:28 Successfully created mymusic 
2016/08/13 17:03:40 Successfully uploaded golden-oldies.zip of size 16253413

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

API Reference : Client custom settings

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 : Encrypted Object Operations

Full Examples : Presigned Operations

Explore Further

Contribute

Contributors Guide

Build Status Build status

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE and NOTICE for more information.