import pendulum from app import clients, models from app.logging import LogLevelContext, handler_logging from . import xray logger = logging.getLogger() xray.patch_all() clients = { 'appsync': clients.AppSyncClient(), 'dynamo': clients.DynamoClient(), 'cognito': clients.CognitoClient(), 'pinpoint': clients.PinpointClient(), } managers = {} chat_manager = managers.get('chat') or models.ChatManager(clients, managers=managers) chat_message_manager = managers.get('chat_message') or models.ChatMessageManager(clients, managers=managers) user_manager = managers.get('user') or models.UserManager(clients, managers=managers) @handler_logging(event_to_extras=lambda event: {'event': event}) def create_dating_chat(event, context): with LogLevelContext(logger, logging.INFO): logger.info('create_dating_chat() called') user_id = event['userId'] chat_id = event['chatId']
secrets_manager_client = clients.SecretsManagerClient() clients = { 'appstore': clients.AppStoreClient(secrets_manager_client.get_apple_appstore_params), 'appsync': clients.AppSyncClient(), 'cognito': clients.CognitoClient(), 'dynamo': clients.DynamoClient(), 'dynamo_feed': clients.DynamoClient(table_name=DYNAMO_FEED_TABLE), 'elasticsearch': clients.ElasticSearchClient(), 'pinpoint': clients.PinpointClient(), 'real_dating': clients.RealDatingClient(), 's3_uploads': clients.S3Client(S3_UPLOADS_BUCKET), } managers = {} album_manager = managers.get('album') or models.AlbumManager(clients, managers=managers) appstore_manager = managers.get('appstore') or models.AppStoreManager( clients, managers=managers) block_manager = managers.get('block') or models.BlockManager(clients, managers=managers) card_manager = managers.get('card') or models.CardManager(clients, managers=managers)
def pinpoint_client(): yield mock.Mock(clients.PinpointClient(app_id='my-app-id'))