/// <summary> /// Begins an export job to move the data from DynamoDB to S3 /// </summary> /// <param name="request"></param> /// <param name="context"></param> /// <returns></returns> public async Task ScheduledExportDataFromDynamoDB(ScheduledEvent request, ILambdaContext context) { this._context = context; context.LogInfo($"Load data request\r\n{JsonConvert.SerializeObject(request)}"); ExportTableToPointInTimeResponse response = await ExportDataFromDynamoDB(Environment.GetEnvironmentVariable("DYNAMODB_TABLE_ARN"), Environment.GetEnvironmentVariable("EXPORT_BUCKET")); this._context.LogInfo(JsonConvert.SerializeObject(response)); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ExportTableToPointInTimeResponse response = new ExportTableToPointInTimeResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("ExportDescription", targetDepth)) { var unmarshaller = ExportDescriptionUnmarshaller.Instance; response.ExportDescription = unmarshaller.Unmarshall(context); continue; } } return(response); }
/// <summary> /// Begins an export job to move the data from DynamoDB to S3 /// </summary> /// <param name="request"></param> /// <param name="context"></param> /// <returns></returns> public async Task <APIGatewayProxyResponse> ManualExportDataFromDynamoDB(APIGatewayProxyRequest request, ILambdaContext context) { this._context = context; context.LogInfo($"Load data request\r\n{JsonConvert.SerializeObject(request)}"); ExportTableToPointInTimeResponse response = await ExportDataFromDynamoDB(Environment.GetEnvironmentVariable("DYNAMODB_TABLE_ARN"), Environment.GetEnvironmentVariable("EXPORT_BUCKET")); string text = JsonConvert.SerializeObject(response); this._context.LogInfo(text); return(new APIGatewayProxyResponse() { StatusCode = (int)HttpStatusCode.OK, Body = text, Headers = new Dictionary <string, string> { { "Content-Type", "application/json" }, { "Access-Control-Allow-Origin", "*" } } }); }