예제 #1
0
        public BucketModule(IS3Storage storage, IS3Responder responder)
        {
            this.storage   = storage;
            this.responder = responder;

            Get["/{bucket}"]    = x => GetBucket(x.bucket, Request.Method);
            Put["/{bucket}"]    = x => AddBucket(x.bucket);
            Delete["/{bucket}"] = x => DeleteBucket(x.bucket);
        }
예제 #2
0
        public BucketModule(IS3Storage storage, IS3Responder responder)
        {
            this.storage = storage;
              this.responder = responder;

              Get["/{bucket}"] = x => GetBucket(x.bucket, Request.Method);
              Put["/{bucket}"] = x => AddBucket(x.bucket);
              Delete["/{bucket}"] = x => DeleteBucket(x.bucket);
        }
 public S3Controller(IS3Storage storage, IS3Responder responder, ILoggerFactory loggerFactory)
 {
     _storage   = storage ?? throw new ArgumentNullException(nameof(storage));
     _responder = responder ?? throw new ArgumentNullException(nameof(responder));
     if (loggerFactory == null)
     {
         throw new ArgumentNullException(nameof(loggerFactory));
     }
     _logger = loggerFactory.CreateLogger <S3Controller>();
 }
예제 #4
0
        public S3ObjectModule(S3Configuration configuration, IS3Storage storage, IS3Responder responder)
        {
            this.configuration = configuration;
              this.storage = storage;
              this.responder = responder;

              Get["/{bucket}/{key}"] = x => GetObject(x.bucket, x.key);
              Put["/{bucket}/{key}"] = x => AddObject(x.bucket, x.key, Request.Body);
              Delete["/{bucket}/{key}"] = x => DeleteObject(x.bucket, x.key);
              Post["/{bucket}"] = x => CheckDelete(x.bucket);
        }
예제 #5
0
        public S3ObjectModule(S3Configuration configuration, IS3Storage storage, IS3Responder responder)
        {
            this.configuration = configuration;
            this.storage       = storage;
            this.responder     = responder;

            Get["/{bucket}/{key}"]    = x => GetObject(x.bucket, x.key);
            Put["/{bucket}/{key}"]    = x => AddObject(x.bucket, x.key, Request.Body);
            Delete["/{bucket}/{key}"] = x => DeleteObject(x.bucket, x.key);
            Post["/{bucket}"]         = x => CheckDelete(x.bucket);
        }
        public void Background()
        {
            $"Given a new ServiceFabricStorage instance"
            .x(() =>
            {
                _stateManager   = new MockReliableStateManager();
                var optionsMock = new Mock <IOptionsSnapshot <ServiceFabricStorageOptions> >();
                optionsMock.Setup(m => m.Value).Returns(new ServiceFabricStorageOptions {
                    DefaultTimeoutFromSeconds = 10
                });

                _storage = new S3.Storage.ServiceFabricStorage(_stateManager, optionsMock.Object);
            });
        }
예제 #7
0
 public void Background()
 {
     "Given a new ServiceFabricStorage instance"
     .x(() =>
     {
         _stateManager   = new MockReliableStateManager();
         var optionsMock = new Mock <IOptionsSnapshot <ServiceFabricStorageOptions> >();
         optionsMock.Setup(m => m.Value).Returns(new ServiceFabricStorageOptions {
             DefaultTimeoutFromSeconds = 10
         });
         _storage = new S3.Storage.ServiceFabricStorage(_stateManager, optionsMock.Object);
     });
     $"And a saved Bucket named {BucketId}"
     .x(async() =>
     {
         await _storage.AddBucketAsync(new Bucket {
             CreationDate = DateTime.UtcNow, Id = BucketId
         });
     });
 }
        public VaultCommunicationListener(ServiceContext serviceContext, IS3Storage s3Storage, ILoggerFactory loggerFactory, string endpointName, string fileName, string workingDirectory, int storagePort)
        {
            _serviceContext = serviceContext ?? throw new ArgumentNullException(nameof(serviceContext));
            _s3Storage      = s3Storage ?? throw new ArgumentNullException(nameof(s3Storage));

            if (loggerFactory is null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            if (string.IsNullOrEmpty(endpointName))
            {
                throw new ArgumentException($"Argument {nameof(endpointName)} must not be null or empty!", nameof(endpointName));
            }

            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentException($"Argument {nameof(fileName)} must not be null or empty!", nameof(fileName));
            }

            if (string.IsNullOrEmpty(workingDirectory))
            {
                throw new ArgumentException($"Argument {nameof(workingDirectory)} must not be null or empty!", nameof(workingDirectory));
            }

            if (storagePort < 1)
            {
                throw new ArgumentException($"Argument {nameof(storagePort)} must be higher than 0!", nameof(storagePort));
            }

            _logger            = loggerFactory.CreateLogger <VaultCommunicationListener>();
            _vaultLogger       = loggerFactory.CreateLogger("vault");
            EndpointName       = endpointName;
            _fileName          = fileName;
            _workingDirectory  = workingDirectory;
            _storagePort       = storagePort;
            _processWaitHandle = new ManualResetEventSlim(false);
        }
예제 #9
0
 public VaultCommunicationListenerFactory(ServiceContext serviceContext, IS3Storage s3Storage, ILoggerFactory loggerFactory)
 {
     _serviceContext = serviceContext ?? throw new ArgumentNullException(nameof(serviceContext));
     _s3Storage      = s3Storage ?? throw new ArgumentNullException(nameof(s3Storage));
     _loggerFactory  = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
 }
예제 #10
0
 public ServiceModule(IS3Storage storage, IS3Responder responder)
 {
     this.storage = storage;
       this.responder = responder;
       Get["/"] = x => ListBuckets();
 }
예제 #11
0
 public ServiceModule(IS3Storage storage, IS3Responder responder)
 {
     this.storage   = storage;
     this.responder = responder;
     Get["/"]       = x => ListBuckets();
 }