GoToSocial/vendor/github.com/minio/minio-go/v7
dependabot[bot] bdc43a98da
[chore]: Bump github.com/minio/minio-go/v7 from 7.0.63 to 7.0.65 (#2415)
Bumps [github.com/minio/minio-go/v7](https://github.com/minio/minio-go) from 7.0.63 to 7.0.65.
- [Release notes](https://github.com/minio/minio-go/releases)
- [Commits](https://github.com/minio/minio-go/compare/v7.0.63...v7.0.65)

---
updated-dependencies:
- dependency-name: github.com/minio/minio-go/v7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-05 11:46:40 +01:00
..
pkg [chore]: Bump github.com/minio/minio-go/v7 from 7.0.63 to 7.0.65 (#2415) 2023-12-05 11:46:40 +01:00
.gitignore [chore]: Bump github.com/minio/minio-go/v7 from 7.0.47 to 7.0.48 (#1486) 2023-02-13 07:46:15 +00:00
.golangci.yml [chore] Bump github.com/minio/minio-go/v7 from 7.0.37 to 7.0.43 (#983) 2022-11-07 11:20:43 +01:00
CNAME [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
CONTRIBUTING.md [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
LICENSE [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
MAINTAINERS.md [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
Makefile [chore]: Bump github.com/minio/minio-go/v7 from 7.0.50 to 7.0.52 (#1703) 2023-04-19 13:43:42 +02:00
NOTICE [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
README.md [chore]: Bump github.com/minio/minio-go/v7 from 7.0.63 to 7.0.65 (#2415) 2023-12-05 11:46:40 +01:00
api-bucket-encryption.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
api-bucket-lifecycle.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.53 to 7.0.55 (#1844) 2023-05-29 13:47:11 +01:00
api-bucket-notification.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.52 to 7.0.53 (#1808) 2023-05-22 20:05:27 +02:00
api-bucket-policy.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.44 to 7.0.47 (#1348) 2023-01-16 10:29:47 +01:00
api-bucket-replication.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
api-bucket-tagging.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.44 to 7.0.47 (#1348) 2023-01-16 10:29:47 +01:00
api-bucket-versioning.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
api-compose-object.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
api-copy-object.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.44 to 7.0.47 (#1348) 2023-01-16 10:29:47 +01:00
api-datatypes.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.59 to 7.0.60 (#1992) 2023-07-21 14:22:17 +00:00
api-error-response.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.56 to 7.0.58 (#1928) 2023-06-26 20:45:49 +00:00
api-get-object-acl.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
api-get-object-file.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
api-get-object.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.63 to 7.0.65 (#2415) 2023-12-05 11:46:40 +01:00
api-get-options.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.47 to 7.0.48 (#1486) 2023-02-13 07:46:15 +00:00
api-list.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
api-object-legal-hold.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
api-object-lock.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
api-object-retention.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
api-object-tagging.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
api-presigned.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
api-put-bucket.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
api-put-object-common.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
api-put-object-fan-out.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.56 to 7.0.58 (#1928) 2023-06-26 20:45:49 +00:00
api-put-object-file-context.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
api-put-object-multipart.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.56 to 7.0.58 (#1928) 2023-06-26 20:45:49 +00:00
api-put-object-streaming.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.53 to 7.0.55 (#1844) 2023-05-29 13:47:11 +01:00
api-put-object.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.63 to 7.0.65 (#2415) 2023-12-05 11:46:40 +01:00
api-putobject-snowball.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.63 to 7.0.65 (#2415) 2023-12-05 11:46:40 +01:00
api-remove.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.58 to 7.0.59 (#1941) 2023-07-04 11:22:40 +02:00
api-restore.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
api-s3-datatypes.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.59 to 7.0.60 (#1992) 2023-07-21 14:22:17 +00:00
api-select.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.44 to 7.0.47 (#1348) 2023-01-16 10:29:47 +01:00
api-stat.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.52 to 7.0.53 (#1808) 2023-05-22 20:05:27 +02:00
api.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.63 to 7.0.65 (#2415) 2023-12-05 11:46:40 +01:00
bucket-cache.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
checksum.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.53 to 7.0.55 (#1844) 2023-05-29 13:47:11 +01:00
code_of_conduct.md [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
constants.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.58 to 7.0.59 (#1941) 2023-07-04 11:22:40 +02:00
core.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
functional_tests.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
hook-reader.go [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
post-policy.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
retry-continous.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
retry.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00
s3-endpoints.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.63 to 7.0.65 (#2415) 2023-12-05 11:46:40 +01:00
s3-error.go [feature] S3 support (#674) 2022-07-03 12:08:30 +02:00
transport.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.44 to 7.0.47 (#1348) 2023-01-16 10:29:47 +01:00
utils.go [chore]: Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.61 (#2041) 2023-07-31 09:47:25 +01:00

README.md

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

The MinIO Go Client SDK provides straightforward APIs to access any Amazon S3 compatible object storage.

This Quickstart Guide covers how to install the MinIO client SDK, connect to MinIO, and create a sample file uploader. For a complete list of APIs and examples, see the godoc documentation or Go Client API Reference.

These examples presume a working Go development environment and the MinIO mc command line tool.

Download from Github

From your project directory:

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

Initialize a MinIO Client Object

The MinIO client requires the following parameters 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
}

Example - File Uploader

This sample code connects to an object storage server, creates a bucket, and uploads a file to the bucket. It uses the MinIO play server, a public MinIO cluster located at https://play.min.io.

The play server runs the latest stable version of MinIO and may be used for testing and development. The access credentials shown in this example are open to the public and all data uploaded to play should be considered public and non-protected.

FileUploader.go

This example does the following:

  • Connects to the MinIO play server using the provided credentials.
  • Creates a bucket named testbucket.
  • Uploads a file named testdata from /tmp.
  • Verifies the file was created using mc ls.
// FileUploader.go MinIO example
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 testbucket.
	bucketName := "testbucket"
	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 test file
	// Change the value of filePath if the file is in another location
	objectName := "testdata"
	filePath := "/tmp/testdata"
	contentType := "application/octet-stream"

	// Upload the test 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)
}

1. Create a test file containing data:

You can do this with dd on Linux or macOS systems:

dd if=/dev/urandom of=/tmp/testdata bs=2048 count=10

or fsutil on Windows:

fsutil file createnew "C:\Users\<username>\Desktop\sample.txt" 20480

2. Run FileUploader with the following commands:

go mod init example/FileUploader
go get github.com/minio/minio-go/v7
go get github.com/minio/minio-go/v7/pkg/credentials
go run FileUploader.go

The output resembles the following:

2023/11/01 14:27:55 Successfully created testbucket
2023/11/01 14:27:55 Successfully uploaded testdata of size 20480

3. Verify the Uploaded File With mc ls:

mc ls play/testbucket
[2023-11-01 14:27:55 UTC]  20KiB STANDARD TestDataFile

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.