| 1346 | |
| 1347 | template <typename ObjectResult> |
| 1348 | std::shared_ptr<const KeyValueMetadata> GetObjectMetadata(const ObjectResult& result) { |
| 1349 | auto md = std::make_shared<KeyValueMetadata>(); |
| 1350 | |
| 1351 | auto push = [&](std::string k, const Aws::String& v) { |
| 1352 | if (!v.empty()) { |
| 1353 | md->Append(std::move(k), std::string(FromAwsString(v))); |
| 1354 | } |
| 1355 | }; |
| 1356 | auto push_datetime = [&](std::string k, const Aws::Utils::DateTime& v) { |
| 1357 | if (v != Aws::Utils::DateTime(0.0)) { |
| 1358 | push(std::move(k), v.ToGmtString(Aws::Utils::DateFormat::ISO_8601)); |
| 1359 | } |
| 1360 | }; |
| 1361 | |
| 1362 | md->Append("Content-Length", ToChars(result.GetContentLength())); |
| 1363 | push("Cache-Control", result.GetCacheControl()); |
| 1364 | push("Content-Type", result.GetContentType()); |
| 1365 | push("Content-Language", result.GetContentLanguage()); |
| 1366 | push("ETag", result.GetETag()); |
| 1367 | push("VersionId", result.GetVersionId()); |
| 1368 | push_datetime("Last-Modified", result.GetLastModified()); |
| 1369 | push_datetime("Expires", result.GetExpires()); |
| 1370 | // NOTE the "canned ACL" isn't available for reading (one can get an expanded |
| 1371 | // ACL using a separate GetObjectAcl request) |
| 1372 | return md; |
| 1373 | } |
| 1374 | |
| 1375 | template <typename ObjectRequest> |
| 1376 | struct ObjectMetadataSetter { |
no test coverage detected