Exemplo n.º 1
0
        /// <summary>
        /// Setup the SimpleDb service
        /// This setup is going to work if the resource using this peace of code is already authorized to use the SimpleDb service.
        /// Example for this can be if the code is executed from an AWS Lambda function which already has permissions to use the service.
        /// In that case, credentials are not required.
        /// </summary>
        static void SetupSimpleDbService()
        {
            _domainName = _configuration.GetSection("DomainConfiguration:Name").Value;
            var region = _configuration.GetSection("DomainConfiguration:Region").Value;

            Console.WriteLine($"Configuring SimpleDb service for region: {region} and domain: {_domainName}...");
            _sdbService = new Service.SimpleDbService(_domainName, region);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new <c>Cucumber.SimpleDb.ISimpleDbContext</c> instance with the specified <c>Cucumber.SimpleDb.ISimpleDbService</c> configuration.
 /// </summary>
 /// <see cref="Cucumber.SimpleDb.ISimpleDbContext"/>
 /// <see cref="Cucumber.SimpleDb.ISimpleDbService"/>
 /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="service"/> is null.</exception>
 /// <param name="service">The <c>Cucumber.SimpleDb.ISimpleDbService</c> implementation to use.</param>
 /// <returns>The <c>Cucumber.SimpleDb.ISimpleDbContext</c> instance</returns>
 public static ISimpleDbContext Create(ISimpleDbService service)
 {
     if (service == null)
     {
         throw new ArgumentNullException("service");
     }
     return new SessionSimpleDbContext(service);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Setup the SimpleDb service with credentials provided from the settings file.
        /// This configuration can work even from anywhere. If valid credentials are provided from the appSettings.json file,
        /// the service request are going to be authenticated and therefore can perform all the authorized actions on the service.
        /// </summary>
        static void SetupSimpleDbServiceWithAuth()
        {
            _domainName = _configuration.GetSection("DomainConfiguration:Name").Value;
            var region      = RegionEndpoint.GetBySystemName(_configuration.GetSection("DomainConfiguration:Region").Value);
            var accessKey   = _configuration.GetSection("DomainConfiguration:AccessKey").Value;
            var secretKey   = _configuration.GetSection("DomainConfiguration:SecretKey").Value;
            var credentials = new BasicAWSCredentials(accessKey, secretKey);

            Console.WriteLine($"Configuring SimpleDb service for region: {region.DisplayName} and domain: {_domainName}...");
            _sdbService = new Service.SimpleDbService(credentials, _domainName, region);
        }
Exemplo n.º 4
0
 public SimpleDbSession(ISimpleDbService service)
 {
     _service = service;
     _trackedItems = new HashSet<ISessionItem>();
 }
 internal SessionSimpleDbContext(ISimpleDbService service)
 {
     _service = service;
     _session = new SimpleDbSession(_service);
 }
Exemplo n.º 6
0
 internal SessionSimpleDbContext(ISimpleDbService service)
 {
     _service = new StatisticsCollectorProxy(service);
     _statistics = (ISimpleDbStatistics)_service; //this feels dirty
     _session = new SimpleDbSession(_service);
 }
Exemplo n.º 7
0
 public StatisticsCollectorProxy(ISimpleDbService service)
 {
     _service = service;
 }