Ejemplo n.º 1
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            _logic = new Logic(this);

            // read configuration settings
            var tableName = config.ReadDynamoDBTableName("RegistrationTable");

            // initialize clients
            var dynamoClient = new AmazonDynamoDBClient();

            _registrations       = new RegistrationTable(dynamoClient, tableName);
            _cachedRegistrations = new Dictionary <string, OwnerMetaData>();
            _rollbarClient       = new RollbarClient(
                httpClient: null,
                accountReadAccessToken: null,
                accountWriteAccessToken: null,
                message => LogInfo(message)
                );
            _eventsClient   = new AmazonCloudWatchEventsClient();
            _firehoseClient = new AmazonKinesisFirehoseClient();
            _selfMetaData   = new OwnerMetaData {
                ModuleInfo           = Info.ModuleInfo,
                Module               = Info.ModuleFullName,
                ModuleId             = Info.ModuleId,
                FunctionId           = Info.FunctionId,
                FunctionName         = Info.FunctionName,
                FunctionLogGroupName = CurrentContext.LogGroupName,
                FunctionPlatform     = "AWS Lambda",
                FunctionFramework    = Info.FunctionFramework,
                FunctionLanguage     = "csharp"
            };
        }
Ejemplo n.º 2
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _connections = new ConnectionsTable(
         config.ReadDynamoDBTableName("ConnectionsTable"),
         new AmazonDynamoDBClient()
         );
 }
Ejemplo n.º 3
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _table = new DynamoTable(
         config.ReadDynamoDBTableName("RobotStateTable"),
         new AmazonDynamoDBClient()
         );
 }
Ejemplo n.º 4
0
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // initialize AWS clients
            _dynamoDbClient = new AmazonDynamoDBClient();

            // read settings
            _table = Table.LoadTable(_dynamoDbClient, config.ReadDynamoDBTableName("BookmarksTable"));
        }
Ejemplo n.º 5
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _transcribe = new AmazonTranscribeServiceClient();
     _table      = new IndexingStatusTable(
         config.ReadDynamoDBTableName("IndexingStatusTable"),
         new AmazonDynamoDBClient()
         );
 }
Ejemplo n.º 6
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            var dataTableName = config.ReadDynamoDBTableName("DataTable");

            // initialize AWS clients
            _dataTable = new DataTable(dataTableName, new AmazonDynamoDBClient());
        }
Ejemplo n.º 7
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            var tableName = config.ReadDynamoDBTableName("DataTable");

            // initialize clients
            _dataAccessClient = new ThriftBooksDataAccessClient(tableName);
        }
Ejemplo n.º 8
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read function settings
            _tableName = config.ReadDynamoDBTableName("Table");
            _priceRetentionInMinutes = config.ReadInt("PriceRetentionInMinutes");

            // initialize clients
            _dynamoClient = new AmazonDynamoDBClient();
        }
Ejemplo n.º 9
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _amaClient = new AmazonApiGatewayManagementApiClient(new AmazonApiGatewayManagementApiConfig {
         ServiceURL = config.ReadText("Module::WebSocket::Url")
     });
     _connections = new ConnectionsTable(
         config.ReadDynamoDBTableName("ConnectionsTable"),
         new AmazonDynamoDBClient()
         );
 }
Ejemplo n.º 10
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _table = new DynamoTable(
         config.ReadDynamoDBTableName("GameTable"),
         new AmazonDynamoDBClient()
         );
     _gameStateMachine    = config.ReadText("GameLoopStateMachine");
     _stepFunctionsClient = new AmazonStepFunctionsClient();
     _lambdaClient        = new AmazonLambdaClient();
     _gameTurnFunctionArn = config.ReadText("GameTurnFunction");
 }
Ejemplo n.º 11
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            var dataTableName = config.ReadDynamoDBTableName("DataTable");

            _notifyQueueUrl = config.ReadSqsQueueUrl("NotifyQueue");

            // initialize AWS clients
            _sqsClient = new AmazonSQSClient();
            _dataTable = new DataTable(dataTableName, new AmazonDynamoDBClient());
        }
Ejemplo n.º 12
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            _s3Client = new AmazonS3Client();
            _destinationBucketName = config.ReadS3BucketName("ExtractedAudioBucket");
            _table = new IndexingStatusTable(
                config.ReadDynamoDBTableName("IndexingStatusTable"),
                new AmazonDynamoDBClient()
                );

            // show contents of /opt folder; the 'ffmpeg' file must have execution permissions to be invocable
            LogInfo(Exec("/bin/bash", "-c \"ls -al /opt\"").Output);
        }
Ejemplo n.º 13
0
        //--- Methods ---
        public async override Task InitializeAsync(LambdaConfig config)
        {
            var tableName = config.ReadDynamoDBTableName("RegistrationTable");

            _registrations = new RegistrationTable(new AmazonDynamoDBClient(), tableName);
            _rollbarClient = new RollbarClient(
                config.ReadText("RollbarReadAccessToken", defaultValue: null),
                config.ReadText("RollbarWriteAccessToken", defaultValue: null),
                message => LogInfo(message)
                );
            _rollbarProjectPrefix = config.ReadText("RollbarProjectPrefix");
        }
Ejemplo n.º 14
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            var dataTableName = config.ReadDynamoDBTableName("DataTable");
            var webSocketUrl  = config.ReadText("Module::WebSocket::Url");

            // initialize AWS clients
            _amaClient = new AmazonApiGatewayManagementApiClient(new AmazonApiGatewayManagementApiConfig {
                ServiceURL = webSocketUrl
            });
            _dataTable = new DataTable(dataTableName, new AmazonDynamoDBClient());
        }
Ejemplo n.º 15
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     // initialize Lambda function
     _lambdaClient = new AmazonLambdaClient();
     _amaClient    = new AmazonApiGatewayManagementApiClient(new AmazonApiGatewayManagementApiConfig {
         ServiceURL = config.ReadText("Module::WebSocket::Url")
     });
     _table = new DynamoTable(
         config.ReadDynamoDBTableName("GameTable"),
         new AmazonDynamoDBClient()
         );
     _gameApiUrl = config.ReadText("RestApiUrl");
 }
Ejemplo n.º 16
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            _logic      = new Logic(this);
            _snsClient  = new AmazonSimpleNotificationServiceClient();
            _errorTopic = config.ReadText("ErrorReportTopic");
            _usageTopic = config.ReadText("UsageReportTopic");
            var tableName    = config.ReadDynamoDBTableName("RegistrationTable");
            var dynamoClient = new AmazonDynamoDBClient();

            _registrations       = new RegistrationTable(dynamoClient, tableName);
            _cachedRegistrations = new Dictionary <string, OwnerMetaData>();
            _rollbarClient       = new RollbarClient(null, null, message => LogInfo(message));
        }
Ejemplo n.º 17
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            var dataTableName = config.ReadDynamoDBTableName("DataTable");

            _eventTopicArn   = config.ReadText("EventTopic");
            _broadcastApiUrl = config.ReadText("EventBroadcastApiUrl");
            _httpApiToken    = config.ReadText("HttpApiInvocationToken");
            _clientApiKey    = config.ReadText("ClientApiKey");

            // initialize AWS clients
            _snsClient = new AmazonSimpleNotificationServiceClient();
            _dataTable = new DataTable(dataTableName, new AmazonDynamoDBClient());
        }
Ejemplo n.º 18
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            var dataTableName = config.ReadDynamoDBTableName("DataTable");
            var webSocketUrl  = config.ReadText("Module::WebSocket::Url");

            _eventTopicArn    = config.ReadText("EventTopic");
            _keepAliveRuleArn = config.ReadText("KeepAliveRuleArn");
            _httpApiToken     = config.ReadText("HttpApiInvocationToken");

            // initialize AWS clients
            _amaClient = new AmazonApiGatewayManagementApiClient(new AmazonApiGatewayManagementApiConfig {
                ServiceURL = webSocketUrl
            });
            _dataTable = new DataTable(dataTableName, new AmazonDynamoDBClient());
        }
Ejemplo n.º 19
0
        //--- Methods ---
        public async override Task InitializeAsync(LambdaConfig config)
        {
            var tableName = config.ReadDynamoDBTableName("RegistrationTable");

            _registrations = new RegistrationTable(new AmazonDynamoDBClient(), tableName);
            _rollbarClient = new RollbarClient(
                config.ReadText("RollbarReadAccessToken", defaultValue: null),
                config.ReadText("RollbarWriteAccessToken", defaultValue: null),
                message => LogInfo(message)
                );
            _rollbarProjectPattern = config.ReadText("RollbarProjectPattern");
            _coreSecretsKey        = config.ReadText("CoreSecretsKey");

            // set default project pattern if none is specified
            if (string.IsNullOrEmpty(_rollbarProjectPattern))
            {
                var rollbarProjectPrefix = config.ReadText("RollbarProjectPrefix");
                _rollbarProjectPattern = $"{rollbarProjectPrefix}{{ModuleFullName}}";
            }
        }
Ejemplo n.º 20
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            _xmlNamespaces = new XmlNamespaceManager(new NameTable());
            _xmlNamespaces.AddNamespace("sns", "http://sns.amazonaws.com/doc/2010-03-31/");

            // read configuration settings
            var dataTableName = config.ReadDynamoDBTableName("DataTable");
            var webSocketUrl  = config.ReadText("Module::WebSocket::Url");

            _eventTopicArn    = config.ReadText("EventTopic");
            _keepAliveRuleArn = config.ReadText("KeepAliveRuleArn");
            _httpApiToken     = config.ReadText("HttpApiInvocationToken");

            // initialize clients
            _snsClient = new AmazonSimpleNotificationServiceClient();
            _amaClient = new AmazonApiGatewayManagementApiClient(new AmazonApiGatewayManagementApiConfig {
                ServiceURL = webSocketUrl
            });
            _dataTable = new DataTable(dataTableName, new AmazonDynamoDBClient());
        }
Ejemplo n.º 21
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // initialize twitter client
            Auth.SetApplicationOnlyCredentials(
                config.ReadText("TwitterApiKey"),
                config.ReadText("TwitterApiSecretKey"),
                true
                );
            _twitterSearchQuery     = config.ReadText("TwitterQuery");
            _twitterLanguageFilter  = new HashSet <string>(config.ReadCommaDelimitedList("TwitterLanguageFilter"));
            _twitterSentimentFilter = config.ReadText("TwitterSentimentFilter");

            // initialize Comprehend client
            _comprehendClient = new AmazonComprehendClient();

            // initialize DynamoDB table
            _dynamoClient = new AmazonDynamoDBClient();
            _table        = Table.LoadTable(_dynamoClient, config.ReadDynamoDBTableName("Table"));

            // initialize SNS client
            _snsClient         = new AmazonSimpleNotificationServiceClient();
            _notificationTopic = config.ReadText("TweetTopic");
        }
Ejemplo n.º 22
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _dataClient          = new DataAccessClient(config.ReadDynamoDBTableName("GameTable"));
     _gameLoopFunctionArn = config.ReadText("GameLoopFunction");
 }
Ejemplo n.º 23
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _table = new TaskTable(config.ReadDynamoDBTableName("TaskTable"));
 }
Ejemplo n.º 24
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _dataClient = new DataAccessClient(config.ReadDynamoDBTableName("GameTable"));
 }
Ejemplo n.º 25
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _dynamoDbClient   = new AmazonDynamoDBClient();
     _table            = Table.LoadTable(_dynamoDbClient, config.ReadDynamoDBTableName("Table"));
     _encryptionKeyArn = config.ReadText("EncryptionKey");
 }