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.
Nitish Tiwari 9c4985b98a Revert ListObject_Test5() test case to upload 1050 objects (#204) 8 years ago
.vscode Rewrite SDK to support .NetCore and .Net 4.5.2 (#124) 8 years ago
Docs Translate minio-dotnet API docs to Chinese. (#200) 8 years ago
FileUploader Update MAINTAINERS.md for instructions to build SDK packages in Linux (#180) 8 years ago
Minio Delete unused project files (#191) 8 years ago
Minio.Core Update version to next release 1.0.6 8 years ago
Minio.Examples Api: Add RemoveObjectAsync call for multi-object delete (#185) 8 years ago
Minio.Functional.Tests Revert ListObject_Test5() test case to upload 1050 objects (#204) 8 years ago
Minio.Net452 Update version to next release 1.0.6 8 years ago
Minio.Tests fix: Add missing AWS region endpoints (#184) 8 years ago
SimpleTest Update MAINTAINERS.md for instructions to build SDK packages in Linux (#180) 8 years ago
.gitattributes Initial code commit with working MakeBucket and V4 signing 10 years ago
.gitignore Add out/ to git ignore list (#188) 8 years ago
.travis.yml Delete unused project files (#191) 8 years ago
LICENSE Add nuspec config for SDK (#128) 8 years ago
MAINTAINERS.md Update MAINTAINERS.md for instructions to build SDK packages in Linux (#180) 8 years ago
Minio.core.nuspec Update version to next release 1.0.6 8 years ago
Minio.nuspec Update version to next release 1.0.6 8 years ago
Minio.sln Delete unused project files (#191) 8 years ago
README.md Delete unused project files (#191) 8 years ago
README_zh_CN.md Translate minio-dotnet API docs to Chinese. (#200) 8 years ago
appveyor.yml Modify functional tests for Mint (#150) 8 years ago
mono_install.sh Fix adding dotnet repo in mono_install script (#167) 8 years ago

README.md

Minio Client SDK for .NET Slack Build status

Minio Client SDK provides higher level APIs for Minio and Amazon S3 compatible cloud storage services.For a complete list of APIs and examples, please take a look at the Dotnet Client API Reference.This document assumes that you have a working VisualStudio development environment.

Minimum Requirements

  • .NET 4.5.2, .NetStandard1.6 or higher
  • Visual Studio 2017 RC

Install from NuGet

To install Minio .NET package for .NET Framework, run the following command in Nuget Package Manager Console.

PM> Install-Package Minio 

To install Minio .NET package for .NetCore, run the following command in Nuget Package Manager Console.

PM> Install-Package Minio.NetCore

Minio Client Example

To connect to an Amazon S3 compatible cloud storage service, you will need to specify the following parameters.

Parameter Description
endpoint URL to object storage service.
accessKey Access key is the user ID that uniquely identifies your account.
secretKey Secret key is the password to your account.
secure Enable/Disable HTTPS support.

The following examples uses a freely hosted public Minio service 'play.minio.io' for development purposes.

using Minio;

// Initialize the client with access credentials.
private static MinioClient minio = new MinioClient("play.minio.io:9000",
                "Q3AM3UQ867SPQQA43P2F",
                "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
                ).WithSSL();

// Create an async task for listing buckets.
var getListBucketsTask = minio.ListBucketsAsync();

// Iterate over the list of buckets.
foreach (Bucket bucket in getListBucketsTask.Result.Buckets)          
{                
    Console.Out.WriteLine(bucket.Name + " " + bucket.CreationDate.DateTime);
}

Complete File Uploader Example

This example program connects to an object storage server, creates a bucket and uploads a file to the bucket. To run the following example, click on [Link] and start the project

using System;
using Minio;
using Minio.Exceptions;
using Minio.DataModel;
using System.Threading.Tasks;

namespace FileUploader
{
    class FileUpload
    {
        static void Main(string[] args)
        {
            var endpoint  = "play.minio.io:9000";
            var accessKey = "Q3AM3UQ867SPQQA43P2F";
            var secretKey = "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG";
            try
            { 
                var minio = new MinioClient(endpoint, accessKey, secretKey).WithSSL();
                FileUpload.Run(minio).Wait();
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine(ex.Message);
            }
            Console.ReadLine();
        }
        
        // File uploader task.
        private async static Task Run(MinioClient minio)
        {
            var bucketName = "mymusic";
            var location   = "us-east-1";
            var objectName = "golden-oldies.zip";
            var filePath = "C:\\Users\\username\\Downloads\\golden_oldies.mp3";
            var contentType = "application/zip";

            try
            {
                // Make a bucket on the server, if not already present.
                bool found = await minio.BucketExistsAsync(bucketName);
                if (!found)
                {
                    await minio.MakeBucketAsync(bucketName, location);
                }
                // Upload a file to bucket.
                await minio.PutObjectAsync(bucketName, objectName, filePath, contentType);  
                Console.Out.WriteLine("Successfully uploaded " + objectName );
            }
            catch (MinioException e)
            {
                Console.WriteLine("File Upload Error: {0}", e.Message);
            }
        }
    }
}

Running Minio Client Examples

On Windows

  • Clone this repository and open the Minio.Sln in Visual Studio 2017.

  • Enter your credentials and bucket name, object name etc.in Minio.Examples/Program.cs Uncomment the example test cases such as below in Program.cs to run an example.

  //Cases.MakeBucket.Run(minioClient, bucketName).Wait();
  • Run the Minio.Client.Examples.NET452 or Minio.Client.Examples.NetCore project from Visual Studio

On Linux (Ubuntu 16.04)

Setting up Mono and .NETCore on Linux
NOTE: minio-dotnet requires mono 5.0.1 stable release and .NET Core 1.0 SDK to build on Linux.
$ ./mono_install.sh    
Running Minio.Examples
  • Clone this project.
$ git clone https://github.com/minio/minio-dotnet && cd minio-dotnet 
  • Enter your credentials and bucket name, object name etc. in Minio.Examples/Program.cs Uncomment the example test cases such as below in Program.cs to run an example.
  //Cases.MakeBucket.Run(minioClient, bucketName).Wait();
  • To run .NET4.5.2 example,
$ mono nuget.exe restore
$ msbuild /p:Configuration=Release.Net452 /t:Clean 
$ msbuild /p:Configuration=Release.Net452
$ ./Minio.Examples/Minio.Client.Examples.Net452/bin/Release.Net452/Minio.Client.Examples.Net452.exe 
  • To run .NetCore example,
$ dotnet msbuild /p:Configuration=Release.Core
$ cd Minio.Examples/Minio.Client.Examples.Core
$ dotnet restore
$ dotnet run

Bucket Operations

Bucket policy Operations

Bucket notification Operations

File Object Operations

Object Operations

Presigned Operations

Client Custom Settings

Explore Further