示例#1
0
        //--- Methods ---
        public override Task InitializeAsync(LambdaConfig config)
        {
            // initialize clients
            _s3Client     = new AmazonS3Client();
            _dynamoClient = new AmazonDynamoDBClient();
            _SNSClient    = new AmazonSimpleNotificationServiceClient();

            // read location of adventure files
            var adventureFiles = new Uri(config.ReadText("AdventureFiles"));

            _adventureFileBucket = adventureFiles.Host;
            _adventureFileKey    = adventureFiles.AbsolutePath.TrimStart('/') + config.ReadText("AdventureFile");
            LogInfo($"ADVENTURE_FILE = s3://{_adventureFileBucket}/{_adventureFileKey}");

            // read location of sound files
            var adventureSoundFiles = new Uri(config.ReadText("SoundFiles"));

            _adventureSoundFilesPublicUrl = $"https://{adventureSoundFiles.Host}.s3.amazonaws.com{adventureSoundFiles.AbsolutePath}";
            LogInfo($"SOUND_FILES = {_adventureSoundFilesPublicUrl}");

            // read topic ARN for sending notifications
            _adventurePlayerFinishedTopic = config.ReadText("AdventureFinishedTopic");

            // read DynamoDB name for player state
            _adventurePlayerTable = config.ReadText("PlayerTable");
            return(Task.CompletedTask);
        }
示例#2
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            _twitterQuery = config.ReadText("TwitterQuery");

            // initialize SNS client
            _snsClient         = new AmazonSimpleNotificationServiceClient();
            _notificationTopic = config.ReadText("FoundTopic");
        }
示例#3
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            _restApiId = config.ReadText("RestApi");
            _stageName = config.ReadText("RestApiStage");

            // initialize clients
            _apiGatewayClient = new AmazonAPIGatewayClient();
        }
 //--Methods--
 public override Task InitializeAsync(LambdaConfig config)
 {
     _rand             = new Random();
     _textBucket       = new S3Bucket(config.ReadText("TextForPolly"));
     _audioBucket      = new S3Bucket(config.ReadText("AudioForTranscribe"));
     _pollyClient      = new AmazonPollyClient();
     _transcribeClient = new AmazonTranscribeServiceClient();
     return(Task.CompletedTask);
 }
示例#5
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            var tableName      = AwsConverters.ConvertDynamoDBArnToName(config.ReadText("GoFishSessions"));
            var accountRegion  = config.ReadText("AccountRegion");
            var bucketName     = AwsConverters.ConvertBucketArnToName(config.ReadText("GoFishSumerianBucket"));
            var uriToCardImage = $"http://{bucketName}.s3-website-{accountRegion}.amazonaws.com";

            _dependencyProvider = new DependencyProvider(new AmazonDynamoDBClient(), tableName);
            _processIntent      = new ProcessIntent(_dependencyProvider, Logger, uriToCardImage);
        }
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration
            _contentCreatedTopicArn = config.ReadText("ContentCreatedTopicArn");
            _contentUpdatedTopicArn = config.ReadText("ContentUpdatedTopicArn");
            _contentDeletedTopicArn = config.ReadText("ContentDeletedTopicArn");

            // initialize clients
            _snsClient = new AmazonSimpleNotificationServiceClient();
        }
示例#7
0
        //--- Constructors ---
        public override Task InitializeAsync(LambdaConfig config)
        {
            var tableName                  = AwsConverters.ConvertDynamoDBArnToName(config.ReadText(("DynamoDbSongs")));
            var indexNameSearchTitle       = config.ReadText("DynamoDbIndexNameSearchTitleName");
            var indexNameSearchTitleArtist = config.ReadText("DynamoDbIndexNameSearchTitleArtistName");
            var indexTableName             = AwsConverters.ConvertDynamoDBArnToName(config.ReadText("DynamoDbTitleWordCache"));

            _jukeboxDynamoDb = new JukeboxDynamoDb(new AmazonDynamoDBClient(), tableName, indexNameSearchTitle, indexNameSearchTitleArtist, indexTableName);
            _songlistUpload  = new Logic(this);
            return(Task.CompletedTask);
        }
示例#8
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");
 }
示例#9
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");
        }
示例#10
0
 //--Methods--
 public override Task InitializeAsync(LambdaConfig config)
 {
     _audioBucket      = AwsConverters.ConvertBucketArnToName(config.ReadText("AudioForTranscribe"));
     _textBucket       = AwsConverters.ConvertBucketArnToName(config.ReadText("TextForPolly"));
     _topic            = config.ReadText("Loop");
     _rand             = new Random();
     _s3Client         = new AmazonS3Client();
     _pollyClient      = new AmazonPollyClient();
     _transcribeClient = new AmazonTranscribeServiceClient();
     _snsClient        = new AmazonSimpleNotificationServiceClient();
     return(Task.CompletedTask);
 }
示例#11
0
        //--- Constructors ---
        public override Task InitializeAsync(LambdaConfig config)
        {
            var queueName                  = config.ReadText("SqsSongQueue");
            var tableName                  = AwsConverters.ConvertDynamoDBArnToName(config.ReadText("DynamoDbSongs"));
            var indexNameSearchTitle       = config.ReadText("DynamoDbIndexNameSearchTitleName");
            var indexNameSearchTitleArtist = config.ReadText("DynamoDbIndexNameSearchTitleArtistName");
            var indexTableName             = AwsConverters.ConvertDynamoDBArnToName(config.ReadText("DynamoDbTitleWordCache"));

            _jukeboxDynamoDb = new JukeboxDynamoDb(new AmazonDynamoDBClient(), tableName, indexNameSearchTitle, indexNameSearchTitleArtist, indexTableName);
            _playSongRequest = new PlaySongNumberRequest(this, new AmazonSQSClient(), queueName, this);
            return(Task.CompletedTask);
        }
示例#12
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");
 }
示例#13
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));
        }
示例#14
0
 //--- Methods ---
 public override Task InitializeAsync(LambdaConfig config)
 {
     // check if an alternative name for the slack token was given
     if (_slackVerificationTokenName != null)
     {
         _slackVerificationToken = config.ReadText(_slackVerificationTokenName);
     }
     else
     {
         _slackVerificationToken = config.ReadText("SlackToken", null);
     }
     return(Task.CompletedTask);
 }
示例#15
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());
        }
示例#16
0
文件: Function.cs 项目: bgkyer/Chat
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            _issuer   = config.ReadText("Issuer");
            _audience = config.ReadText("Audience");
            _enabled  = config.ReadText("Enabled", "true").Equals("true", StringComparison.OrdinalIgnoreCase);

            // fetch JsonWebKeySet from issuer
            var jsonWebKeySetUrl = _issuer.EndsWith("/")
                ? _issuer + ".well-known/jwks.json"
                : _issuer + "/.well-known/jwks.json";
            var response = await HttpClient.GetAsync(jsonWebKeySetUrl);

            _issuerJsonWebKeySet = new JsonWebKeySet(await response.Content.ReadAsStringAsync());
        }
示例#17
0
 //--- Methods ---
 public override Task InitializeAsync(LambdaConfig config)
 {
     _manifestBucket  = config.ReadText("ManifestBucket");
     _s3Client        = new AmazonS3Client();
     _transferUtility = new TransferUtility(_s3Client);
     return(Task.CompletedTask);
 }
示例#18
0
        //--- Methods ---
        public override Task InitializeAsync(LambdaConfig config)
        {
            var tableName = config.ReadText("MessageTable");

            _table = new MessageTable(tableName);
            return(Task.CompletedTask);
        }
示例#19
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());
        }
示例#20
0
文件: Function.cs 项目: bgkyer/Chat
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            _cloudfrontDistributionId = config.ReadText("WebsiteCloudFront");

            // initialize AWS clients
            _cloudfrontClient = new AmazonCloudFrontClient();
        }
示例#21
0
        //--- Methods ---
        public override Task InitializeAsync(LambdaConfig config)
        {
            var sqsClient = new AmazonSQSClient();
            var queueName = AwsConverters.ConvertQueueArnToUrl(config.ReadText("SqsSongQueue"));

            SpeakerRequest = new SpeakerRequest(this, sqsClient, queueName);
            return(Task.CompletedTask);
        }
示例#22
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            _secretArn = config.ReadText("CredentialsSecret");

            // create clients
            _secretManagerClient = new AmazonSecretsManagerClient();
        }
示例#23
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read function settings
            _topicArn = config.ReadText("Topic");

            // initialize clients
            _snsClient = new AmazonSimpleNotificationServiceClient();
        }
示例#24
0
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            var dynamoDbSubscriptionTableName = AwsConverters.ConvertDynamoDBArnToName(config.ReadText("UserSubscriptions"));
            var dynamoDbVideoTableName        = AwsConverters.ConvertDynamoDBArnToName(config.ReadText("CacheVideos"));
            var dynamoDbPlaylistsTableName    = AwsConverters.ConvertDynamoDBArnToName(config.ReadText("CachePlaylists"));
            var fromEmail        = config.ReadText("FromEmail");
            var youtubeApiKey    = config.ReadText("YouTubeApiKey");
            var youtubeApiClient = new YouTubeService(new BaseClientService.Initializer {
                ApiKey          = youtubeApiKey,
                ApplicationName = GetType().ToString()
            });
            var dynamoDbClient = new AmazonDynamoDBClient();
            var sesClient      = new AmazonSimpleEmailServiceV2Client();
            var provider       = new DependencyProvider(youtubeApiClient, dynamoDbPlaylistsTableName, dynamoDbSubscriptionTableName, dynamoDbVideoTableName, dynamoDbClient, sesClient);
            var dataAccess     = new DataAccess(provider);

            _logic = new Logic(fromEmail, dataAccess, Logger);
        }
示例#25
0
 //--- Methods ---
 public override Task InitializeAsync(LambdaConfig config)
 {
     Polly             = new AmazonPollyClient();
     S3                = new AmazonS3Client();
     SnsClient         = new AmazonSimpleNotificationServiceClient();
     Bucket            = config.ReadS3BucketName("ArticlesBucket");
     NotificationTopic = config.ReadText("ArticleAudioDone");
     return(Task.CompletedTask);
 }
示例#26
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     // check if an alternative name for the slack token was given
     _slackVerificationToken = config.ReadText("SlackToken", defaultValue: null);
     if (_slackVerificationToken == "")
     {
         _slackVerificationToken = null;
     }
 }
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            var dynamoDbUserSubscriptionTableName = AwsConverters.ConvertDynamoDBArnToName(config.ReadText("UserSubscriptions"));
            var compareTopicArn = config.ReadText("CompareTopicPublish");
            var dynamoDbClient  = new AmazonDynamoDBClient();
            var snsClient       = new AmazonSimpleNotificationServiceClient();
            var provider        = new DependencyProvider(dynamoDbClient, snsClient, dynamoDbUserSubscriptionTableName, compareTopicArn);

            _logic = new Logic(provider, Logger);
        }
示例#28
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()
         );
 }
        //--- Methods ---
        public override Task InitializeAsync(LambdaConfig config)
        {
            // Clients
            _rekognitionClient = new AmazonRekognitionClient();
            _s3Client          = new AmazonS3Client();

            // social media keys
            // _consumerKey = config.ReadText("TwitterConsumerKey");
            // _consumerSecret = config.ReadText("TwitterConsumerSecret");
            // _accessToken = config.ReadText("TwitterAccessToken");
            // _accessTokenSecret = config.ReadText("TwitterAccessSecret");

            // Headshot paths
            _headshotFileName = config.ReadText("HeadshotFileName");
            var headshotS3Path = config.ReadText("HeadshotPhotos").Replace("s3://", "").Split("/");

            _comparingImageBucket = headshotS3Path[0];
            _comparingImageKey    = $"{headshotS3Path[1]}/{_headshotFileName}";
            return(Task.CompletedTask);
        }
示例#30
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());
        }