Skip to content

Commit 5198593

Browse files
committed
init
- added S3_express_bucket tracking
1 parent 41e9c4e commit 5198593

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/aws-cpp-sdk-core/include/aws/core/client/UserAgent.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ enum class UserAgentFeature {
1717
S3_TRANSFER,
1818
S3_CRYPTO_V1N,
1919
S3_CRYPTO_V2,
20+
S3_EXPRESS_BUCKET,
21+
S3_ACCESS_GRANTS,
2022
FLEXIBLE_CHECKSUMS_REQ_CRC32,
2123
FLEXIBLE_CHECKSUMS_REQ_CRC32C,
2224
FLEXIBLE_CHECKSUMS_REQ_CRC64,

src/aws-cpp-sdk-core/source/client/UserAgent.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const std::pair<UserAgentFeature, const char*> BUSINESS_METRIC_MAPPING[] = {
2727
{UserAgentFeature::S3_TRANSFER, "G"},
2828
{UserAgentFeature::S3_CRYPTO_V1N, "H"},
2929
{UserAgentFeature::S3_CRYPTO_V2, "I"},
30+
{UserAgentFeature::S3_EXPRESS_BUCKET, "J"},
31+
{UserAgentFeature::S3_ACCESS_GRANTS, "K"},
3032
{UserAgentFeature::FLEXIBLE_CHECKSUMS_REQ_CRC32, "U"},
3133
{UserAgentFeature::FLEXIBLE_CHECKSUMS_REQ_CRC32C, "V"},
3234
{UserAgentFeature::FLEXIBLE_CHECKSUMS_REQ_CRC64, "W"},
@@ -207,6 +209,8 @@ const std::pair<const char*, UserAgentFeature> LEGACY_FEATURE_MAPPING[] = {
207209
{"ft/s3-transfer", UserAgentFeature::S3_TRANSFER},
208210
{"ft/S3CryptoV1n", UserAgentFeature::S3_CRYPTO_V1N},
209211
{"ft/S3CryptoV2", UserAgentFeature::S3_CRYPTO_V2},
212+
{"ft/s3-express", UserAgentFeature::S3_EXPRESS_BUCKET},
213+
{"ft/s3-access-grants", UserAgentFeature::S3_ACCESS_GRANTS},
210214
};
211215
}
212216

src/aws-cpp-sdk-transfer/source/transfer/TransferManager.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ namespace Aws
151151
const Aws::Map<Aws::String, Aws::String>& metadata,
152152
const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context,
153153
const Aws::String& precalculatedChecksum) {
154+
// Track S3 Express bucket usage
155+
m_transferConfig.s3Client->AppendToUserAgent("ft/s3-express");
156+
154157
// destructor of FStream will close stream automatically (when out of scope), no need to call close explicitly
155158
#ifdef _MSC_VER
156159
auto wide = Aws::Utils::StringUtils::ToWString(fileName.c_str());
@@ -169,6 +172,9 @@ namespace Aws
169172
const Aws::Map<Aws::String, Aws::String>& metadata,
170173
const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context,
171174
const Aws::String& precalculatedChecksum) {
175+
// Track S3 Express bucket usage
176+
m_transferConfig.s3Client->AppendToUserAgent("ft/s3-express");
177+
172178
auto handle =
173179
CreateUploadFileHandle(fileStream.get(), bucketName, keyName, contentType, metadata, context, "", precalculatedChecksum);
174180
return SubmitUpload(handle, fileStream);
@@ -181,6 +187,9 @@ namespace Aws
181187
const Aws::String& writeToFile,
182188
const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context)
183189
{
190+
// Track S3 Express bucket usage
191+
m_transferConfig.s3Client->AppendToUserAgent("ft/s3-express");
192+
184193
auto handle = Aws::MakeShared<TransferHandle>(CLASS_TAG, bucketName, keyName, writeToStreamfn, writeToFile);
185194
handle->ApplyDownloadConfiguration(downloadConfig);
186195
handle->SetContext(context);
@@ -205,6 +214,9 @@ namespace Aws
205214
const Aws::String& writeToFile,
206215
const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context)
207216
{
217+
// Track S3 Express bucket usage
218+
m_transferConfig.s3Client->AppendToUserAgent("ft/s3-express");
219+
208220
auto handle = Aws::MakeShared<TransferHandle>(CLASS_TAG, bucketName, keyName, fileOffset, downloadBytes, writeToStreamfn, writeToFile);
209221
handle->ApplyDownloadConfiguration(downloadConfig);
210222
handle->SetContext(context);
@@ -226,6 +238,9 @@ namespace Aws
226238
const DownloadConfiguration& downloadConfig,
227239
const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context)
228240
{
241+
// Track S3 Express bucket usage
242+
m_transferConfig.s3Client->AppendToUserAgent("ft/s3-express");
243+
229244
#ifdef _MSC_VER
230245
auto createFileFn = [=]() { return Aws::New<Aws::FStream>(CLASS_TAG, Aws::Utils::StringUtils::ToWString(writeToFile.c_str()).c_str(),
231246
std::ios_base::out | std::ios_base::in | std::ios_base::binary | std::ios_base::trunc);};
@@ -1504,4 +1519,4 @@ namespace Aws
15041519
}
15051520
}
15061521
}
1507-
}
1522+
}

0 commit comments

Comments
 (0)