MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / download_and_encode_file

Function download_and_encode_file

examples/s3/main.cpp:106–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106std::string download_and_encode_file(
107 Aws::S3::S3Client const& client,
108 Aws::String const& bucket,
109 Aws::String const& key,
110 Aws::String& encoded_output)
111{
112 using namespace Aws;
113
114 S3::Model::GetObjectRequest request;
115 request.WithBucket(bucket).WithKey(key);
116
117 auto outcome = client.GetObject(request);
118 if (outcome.IsSuccess()) {
119 AWS_LOGSTREAM_INFO(TAG, "Download completed!");
120 auto& s = outcome.GetResult().GetBody();
121 return encode(s, encoded_output);
122 }
123 else {
124 AWS_LOGSTREAM_ERROR(TAG, "Failed with error: " << outcome.GetError());
125 return outcome.GetError().GetMessage();
126 }
127}

Callers 1

my_handlerFunction · 0.85

Calls 1

encodeFunction · 0.85

Tested by

no test coverage detected