Exemple #1
1
        static int Main()
        {
            /// Note: s3 AccessKey and SecretKey needs to be added in App.config file
            /// See instructions in README.md on running examples for more information.
            var client = new MinioClient("s3.amazonaws.com", ConfigurationManager.AppSettings["s3AccessKey"],
                                         ConfigurationManager.AppSettings["s3SecretKey"]);

            byte[] data = System.Text.Encoding.UTF8.GetBytes("hello world");
            client.PutObject("my-bucketname", "my-objectname", new MemoryStream(data), 11, "application/octet-stream");
            return 0;
        }
 static int Main(string[] args)
 {
     var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");
     client.RemoveIncompleteUpload("bucketName", "objectName");
     return 0;
 }
Exemple #3
0
        public SingleBucketFileStorageService(
            string bucket,
            string endpoint,
            string?publicEndpoint,
            string accessKey,
            string secretKey,
            bool hasSsl,
            bool hasPublicSsl,
            ILogger <SingleBucketFileStorageService> logger,
            MinioRequestLogger?minioRequestLogger
            )
        {
            client = new Minio.MinioClient(endpoint, accessKey, secretKey);
            client.SetTraceOn(minioRequestLogger);
            if (hasSsl)
            {
                client = client.WithSSL();
            }
            this.bucket         = bucket;
            this.endpoint       = endpoint;
            this.publicEndpoint = publicEndpoint;
            var endpointUri = new UriBuilder(publicEndpoint ?? this.endpoint);

            if (endpointUri.Host == null || endpointUri.Host == "" || endpointUri.Scheme != null || endpointUri.Scheme != "")
            {
            }
            else
            {
                endpointUri.Scheme = hasPublicSsl ? "https" : "http";
            }
            this.publicEndpointUri = new Uri(endpointUri.Uri, bucket + "/");
            logger.LogInformation("Set up public endpoint as {0}", publicEndpointUri.ToString());
            this.hasSsl = hasSsl;
            this.logger = logger;
        }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");

            client.DropIncompleteUpload("bucket", "key")

            return 0;
        }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");

            client.RemoveObject("bucket");

            return 0;
        }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");

            client.MakeBucket("bucketName");

            return 0;
        }
Exemple #7
0
 static int Main()
 {
     /// Note: s3 AccessKey and SecretKey needs to be added in App.config file
     /// See instructions in README.md on running examples for more information.
     var client = new MinioClient("s3.amazonaws.com", ConfigurationManager.AppSettings["s3AccessKey"],
                                  ConfigurationManager.AppSettings["s3SecretKey"]);
     client.RemoveObject("my-bucketname", "my-objectname");
     return 0;
 }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");

            var statObject = client.StatObject("bucket", "object");

            Console.Out.WriteLine("{0} {1} {2} {3} {4}", statObject.Key, statObject.Size, statObject.LastModified, statObject.ETag, statObject.ContentType)

            return 0;
        }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");

            client.GetPartialObject("bucketName", "objectName", 5, 10, (stream) =>
            {
                stream.CopyTo(Console.OpenStandardOutput());
            });

            return 0;
        }
Exemple #10
0
        static int Main()
        {
            /// Note: s3 AccessKey and SecretKey needs to be added in App.config file
            /// See instructions in README.md on running examples for more information.
            var client = new MinioClient("s3.amazonaws.com", ConfigurationManager.AppSettings["s3AccessKey"],
                                         ConfigurationManager.AppSettings["s3SecretKey"]);
            /// This operation will only work if your bucket is empty.
            client.RemoveBucket("my-bucketname");

            return 0;
        }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");

            var items = client.ListIncompleteUploads("bucketName", "prefix", true);

            foreach (Upload item in items)
            {
                Console.Out.WriteLine(item.Key);
            }
            return 0;
        }
Exemple #12
0
        static int Main(string[] args)
        {
            /// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname and my-objectname
              /// are dummy values, please replace them with original values.
            var client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");

            var statObject = client.StatObject("my-bucketname", "my-objectname");

            Console.Out.WriteLine("{0} {1} {2} {3} {4}", statObject.Key, statObject.Size, statObject.LastModified, statObject.ETag, statObject.ContentType);

            return 0;
        }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");

            client.GetObject("bucket", "object", (stream) =>
            {
                byte[] buffer = new byte[10];
                stream.Read(buffer, 0, 10);
            });

            return 0;
        }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");

            var buckets = client.ListBuckets();
            foreach (Bucket bucket in buckets)
            {
                Console.Out.WriteLine(bucket.Name + " " + bucket.CreationDateDateTime);
            }

            return 0;
        }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");

            var items = client.ListObjects("bucket");

            foreach (Item item in items)
            {
                Console.Out.WriteLine("{0} {1} {2} {3}", item.Key, item.LastModifiedDateTime, item.Size, item.ETag);
            }

            return 0;
        }
        static int Main()
        {
            /// Note: s3 AccessKey and SecretKey needs to be added in App.config file
            /// See instructions in README.md on running examples for more information.
            var client = new MinioClient("s3.amazonaws.com", ConfigurationManager.AppSettings["s3AccessKey"],
                                         ConfigurationManager.AppSettings["s3SecretKey"]);

            client.GetPartialObject("my-bucketname", "my-objectname", 5, 10, (stream) =>
            {
                stream.CopyTo(Console.OpenStandardOutput());
            });

            return 0;
        }
Exemple #17
0
        static int Main()
        {
            /// Note: s3 AccessKey and SecretKey needs to be added in App.config file
              /// See instructions in README.md on running examples for more information.
            var client = new MinioClient("s3.amazonaws.com", ConfigurationManager.AppSettings["s3AccessKey"],
                                         ConfigurationManager.AppSettings["s3SecretKey"]);

            var buckets = client.ListBuckets();
            foreach (Bucket bucket in buckets)
            {
                Console.Out.WriteLine(bucket.Name + " " + bucket.CreationDateDateTime);
            }

            return 0;
        }
        static int Main()
        {
            /// Note: s3 AccessKey and SecretKey needs to be added in App.config file
            /// See instructions in README.md on running examples for more information.
            var client = new MinioClient("s3.amazonaws.com", ConfigurationManager.AppSettings["s3AccessKey"],
                                         ConfigurationManager.AppSettings["s3SecretKey"]);

            var items = client.ListIncompleteUploads("my-bucketname", "my-prefixname", true);

            foreach (Upload item in items)
            {
                Console.Out.WriteLine(item.Key);
            }
            return 0;
        }
Exemple #19
0
        static int Main()
        {
            /// Note: s3 AccessKey and SecretKey needs to be added in App.config file
            /// See instructions in README.md on running examples for more information.
            var client = new MinioClient("s3.amazonaws.com", ConfigurationManager.AppSettings["s3AccessKey"],
                                         ConfigurationManager.AppSettings["s3SecretKey"]);

            var items = client.ListObjects("my-bucketname");

            foreach (Item item in items)
            {
                Console.Out.WriteLine("{0} {1} {2} {3}", item.Key, item.LastModifiedDateTime, item.Size, item.ETag);
            }

            return 0;
        }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");

            var bucketExists = client.BucketExists("bucketName");

            if (bucketExists)
            {
                Console.Out.WriteLine("Bucket: {0} exists..", "bucketName");
            }
            else
            {
                Console.Out.WriteLine("Bucket: {0} does not exist..", "bucketName");
            }

            return 0;
        }
        static int Main(string[] args)
        {
            var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");
            PostPolicy form = new PostPolicy();
            DateTime expiration = DateTime.UtcNow;
            form.SetExpires(expiration.AddDays(10));
            form.SetKey("objectName");
            form.SetBucket("bucketName");

            Dictionary <string, string> formData = client.PresignedPostPolicy(form);
            string curlCommand = "curl ";
            foreach (KeyValuePair<string, string> pair in formData)
            {
                    curlCommand = curlCommand + " -F " + pair.Key + "=" + pair.Value;
            }
            curlCommand = curlCommand + " -F file=@/etc/bashrc https://s3.amazonaws.com/bucketName";
            Console.Out.WriteLine(curlCommand);
            return 0;
        }
Exemple #22
0
        private static MinioClient CreateMiniotClient_(S3StorageConfig s3Config)
        {
            var minioClient = new Minio.MinioClient(
                s3Config.Provider.EndPoint,
                s3Config.AccessKey,
                s3Config.SecretKey
                );

            if (s3Config.Proxies.Any())
            {
                var proxyInfo = s3Config.Proxies.First();
                minioClient.WithProxy(proxyInfo.CreateWebProxy());
            }
            clientDict_.Add(s3Config.Provider, minioClient);

            #if RELEASE
            return(minioClient.WithSSL());
            #else
            return(minioClient);
            #endif
        }
        static int Main()
        {
            /// Note: s3 AccessKey and SecretKey needs to be added in App.config file
            /// See instructions in README.md on running examples for more information.
            var client = new MinioClient("s3.amazonaws.com", ConfigurationManager.AppSettings["s3AccessKey"],
                                         ConfigurationManager.AppSettings["s3SecretKey"]);
            PostPolicy form = new PostPolicy();
            DateTime expiration = DateTime.UtcNow;
            form.SetExpires(expiration.AddDays(10));
            form.SetKey("my-objectname");
            form.SetBucket("my-bucketname");

            Dictionary <string, string> formData = client.PresignedPostPolicy(form);
            string curlCommand = "curl ";
            foreach (KeyValuePair<string, string> pair in formData)
            {
                    curlCommand = curlCommand + " -F " + pair.Key + "=" + pair.Value;
            }
            curlCommand = curlCommand + " -F file=@/etc/bashrc https://s3.amazonaws.com/my-bucketname";
            Console.Out.WriteLine(curlCommand);
            return 0;
        }
 internal MinioClientAdvanced(MinioClient client)
 {
     this.client = client;
 }
 public MediaController(Minio.MinioClient minioClient, IConfiguration configuration)
 {
     this.minioClient = minioClient;
 }
 static int Main(string[] args)
 {
     var client = new MinioClient("https://s3.amazonaws.com", "ACCESSKEY", "SECRETKEY");
     Console.Out.WriteLine(client.PresignedGetObject("bucketName", "objectName", 1000));
     return 0;
 }