Пример #1
0
 public BlobstoreClient(BlobstoreOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException("options");
     }
     this.options = options;
 }
Пример #2
0
 public BlobstoreClient(BlobstoreOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException("options");
     }
     this.options = options;
 }
Пример #3
0
        public SimpleBlobstoreClient(BlobstoreOptions options) : base(options)
        {
            this.client = new RestClient();

            if (false == String.IsNullOrWhiteSpace(options.User) &&
                false == String.IsNullOrWhiteSpace(options.Password))
            {
                string authInfo   = String.Format("{0}:{1}", options.User, options.Password);
                string authHeader = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(authInfo));
                client.AddDefaultHeader("Authorization", authHeader);
            }
        }
        public SimpleBlobstoreClient(BlobstoreOptions options)
            : base(options)
        {
            this.client = new RestClient();

            if (false == String.IsNullOrWhiteSpace(options.User) &&
                false == String.IsNullOrWhiteSpace(options.Password))
            {
                string authInfo = String.Format("{0}:{1}", options.User, options.Password);
                string authHeader = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(authInfo));
                client.AddDefaultHeader("Authorization", authHeader);
            }
        }
Пример #5
0
        public IBlobstoreClient Create()
        {
            BlobstoreClient rv;

            var options = new BlobstoreOptions(config.BlobstoreEndpoint, config.BlobstoreUser, config.BlobstorePassword);

            switch (config.BlobstorePlugin)
            {
            case "simple":
                rv = new SimpleBlobstoreClient(options);
                break;

            default:
                string msg = String.Format(Resources.BlobstoreClientFactory_UnknownPlugin_Fmt, config.BlobstorePlugin);
                @log.Error(msg);
                throw new BlobstoreException(msg);
            }

            return(rv);
        }
Пример #6
0
 public void Can_Upload_File()
 {
     var options = new BlobstoreOptions(new Uri("http://172.21.10.181:25250"), "agent", "agent");
     var client = new SimpleBlobstoreClient(options);
     string response = client.Create(@"C:\proj\tmp\env.iso");
 }