| 1286 | |
| 1287 | template <typename ObjectResult> |
| 1288 | std::shared_ptr<const KeyValueMetadata> GetObjectMetadata(const ObjectResult& result) { |
| 1289 | auto md = std::make_shared<KeyValueMetadata>(); |
| 1290 | |
| 1291 | auto push = [&](std::string k, const Aws::String& v) { |
| 1292 | if (!v.empty()) { |
| 1293 | md->Append(std::move(k), std::string(FromAwsString(v))); |
| 1294 | } |
| 1295 | }; |
| 1296 | auto push_datetime = [&](std::string k, const Aws::Utils::DateTime& v) { |
| 1297 | if (v != Aws::Utils::DateTime(0.0)) { |
| 1298 | push(std::move(k), v.ToGmtString(Aws::Utils::DateFormat::ISO_8601)); |
| 1299 | } |
| 1300 | }; |
| 1301 | |
| 1302 | md->Append("Content-Length", ToChars(result.GetContentLength())); |
| 1303 | push("Cache-Control", result.GetCacheControl()); |
| 1304 | push("Content-Type", result.GetContentType()); |
| 1305 | push("Content-Language", result.GetContentLanguage()); |
| 1306 | push("ETag", result.GetETag()); |
| 1307 | push("VersionId", result.GetVersionId()); |
| 1308 | push_datetime("Last-Modified", result.GetLastModified()); |
| 1309 | push_datetime("Expires", result.GetExpires()); |
| 1310 | // NOTE the "canned ACL" isn't available for reading (one can get an expanded |
| 1311 | // ACL using a separate GetObjectAcl request) |
| 1312 | return md; |
| 1313 | } |
| 1314 | |
| 1315 | template <typename ObjectRequest> |
| 1316 | struct ObjectMetadataSetter { |
no test coverage detected