from app import clients, models from app.logging import LogLevelContext, handler_logging from app.models.post.enums import PostStatus, PostType from app.models.post.exceptions import PostException from . import xray S3_UPLOADS_BUCKET = os.environ.get('S3_UPLOADS_BUCKET') logger = logging.getLogger() xray.patch_all() secrets_manager_client = clients.SecretsManagerClient() clients = { 'appsync': clients.AppSyncClient(), 'cloudfront': clients.CloudFrontClient(secrets_manager_client.get_cloudfront_key_pair), 'dynamo': clients.DynamoClient(), 'mediaconvert': clients.MediaConvertClient(), 'post_verification': clients.PostVerificationClient(secrets_manager_client.get_post_verification_api_creds), 's3_uploads': clients.S3Client(S3_UPLOADS_BUCKET), } managers = {} post_manager = managers.get('post') or models.PostManager(clients, managers=managers) @handler_logging def image_post_uploaded(event, context): # Seems the boto s3 client deals with non-urlencoded keys to objects everywhere, but # apparenttly this falls outside that scope. The event emitter passes us a urlencoded path.
from app.models.user.enums import UserStatus, UserSubscriptionLevel from .dispatch import DynamoDispatch DYNAMO_FEED_TABLE = os.environ.get('DYNAMO_FEED_TABLE') S3_UPLOADS_BUCKET = os.environ.get('S3_UPLOADS_BUCKET') logger = logging.getLogger() xray.patch_all() 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), }
def appsync_client(): yield mock.Mock( clients.AppSyncClient(appsync_graphql_url='my-graphql-url'))