Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/vendor/github.com/minio/minio-go/v7
dependabot[bot] 8a5877ccf1
Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007)
3 years ago
..
pkg Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
.gitignore revendor cortex to latest master (#2543) 5 years ago
.golangci.yml Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
CNAME Revendor/cortex (#3446) 4 years ago
CONTRIBUTING.md Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
LICENSE revendor cortex to latest master (#2543) 5 years ago
MAINTAINERS.md revendor cortex to latest master (#2543) 5 years ago
Makefile Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
NOTICE revendor cortex to latest master (#2543) 5 years ago
README.md Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
README_zh_CN.md Revendor/cortex (#3446) 4 years ago
api-bucket-encryption.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-bucket-lifecycle.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-bucket-notification.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-bucket-policy.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-bucket-replication.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-bucket-tagging.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-bucket-versioning.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-compose-object.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-copy-object.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-datatypes.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-error-response.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-get-object-acl.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-get-object-file.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-get-object.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-get-options.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-list.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-object-legal-hold.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-object-lock.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-object-retention.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-object-tagging.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-presigned.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-put-bucket.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-put-object-common.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-put-object-file-context.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-put-object-multipart.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-put-object-streaming.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-put-object.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-putobject-snowball.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-remove.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-restore.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-s3-datatypes.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-select.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api-stat.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
api.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
bucket-cache.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
code_of_conduct.md revendor cortex to latest master (#2543) 5 years ago
constants.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
core.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
functional_tests.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
hook-reader.go revendor cortex to latest master (#2543) 5 years ago
post-policy.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
retry-continous.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
retry.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
s3-endpoints.go Revendor/cortex (#3446) 4 years ago
s3-error.go revendor cortex to latest master (#2543) 5 years ago
transport.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago
utils.go Bump github.com/minio/minio-go/v7 from 7.0.10 to 7.0.24 (#6007) 3 years ago

README.md

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 github.com/minio/minio-go/v7

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.
minio.Options All the options such as credentials, custom transport etc.
package main

import (
	"log"

	"github.com/minio/minio-go/v7"
	"github.com/minio/minio-go/v7/pkg/credentials"
)

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

	// Initialize minio client object.
	minioClient, err := minio.New(endpoint, &minio.Options{
		Creds:  credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
		Secure: useSSL,
	})
	if err != nil {
		log.Fatalln(err)
	}

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

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.min.io 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 (
	"context"
	"log"

	"github.com/minio/minio-go/v7"
	"github.com/minio/minio-go/v7/pkg/credentials"
)

func main() {
	ctx := context.Background()
	endpoint := "play.min.io"
	accessKeyID := "Q3AM3UQ867SPQQA43P2F"
	secretAccessKey := "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
	useSSL := true

	// Initialize minio client object.
	minioClient, err := minio.New(endpoint, &minio.Options{
		Creds:  credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
		Secure: useSSL,
	})
	if err != nil {
		log.Fatalln(err)
	}

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

	err = minioClient.MakeBucket(ctx, bucketName, minio.MakeBucketOptions{Region: location})
	if err != nil {
		// Check to see if we already own this bucket (which happens if you run this twice)
		exists, errBucketExists := minioClient.BucketExists(ctx, bucketName)
		if errBucketExists == nil && exists {
			log.Printf("We already own %s\n", bucketName)
		} else {
			log.Fatalln(err)
		}
	} else {
		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
	info, err := minioClient.FPutObject(ctx, bucketName, objectName, filePath, minio.PutObjectOptions{ContentType: contentType})
	if err != nil {
		log.Fatalln(err)
	}

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

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 lifecycle Operations

Full Examples : Bucket encryption Operations

Full Examples : Bucket replication 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

License

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