@@ -69,21 +69,23 @@ namespace AwsDoc {
6969
7070// ! Scenario to create, copy, and delete S3 buckets and objects.
7171/* !
72+ \param bucketNamePrefix: A prefix for a bucket name.
7273 \param uploadFilePath: Path to file to upload to an Amazon S3 bucket.
7374 \param saveFilePath: Path for saving a downloaded S3 object.
7475 \param clientConfig: Aws client configuration.
7576 \return bool: Function succeeded.
7677 */
77- bool AwsDoc::S3::S3_GettingStartedScenario (const Aws::String &uploadFilePath,
78+ bool AwsDoc::S3::S3_GettingStartedScenario (const Aws::String &bucketNamePrefix,
79+ const Aws::String &uploadFilePath,
7880 const Aws::String &saveFilePath,
7981 const Aws::Client::ClientConfiguration &clientConfig) {
8082
8183 Aws::S3::S3Client client (clientConfig);
8284
8385 // Create a unique bucket name which is only temporary and will be deleted.
84- // Format: "amzn-s3-demo-bucket -" + lowercase UUID.
86+ // Format: <bucketNamePrefix> + " -" + lowercase UUID.
8587 Aws::String uuid = Aws::Utils::UUID::RandomUUID ();
86- Aws::String bucketName = " amzn-s3-demo-bucket- " +
88+ Aws::String bucketName = bucketNamePrefix +
8789 Aws::Utils::StringUtils::ToLower (uuid.c_str ());
8890
8991 // 1. Create a bucket.
@@ -292,26 +294,28 @@ AwsDoc::S3::deleteBucket(const Aws::String &bucketName, Aws::S3::S3Client &clien
292294
293295int main (int argc, const char *argv[]) {
294296
295- if (argc != 3 ) {
297+ if (argc != 4 ) {
296298 std::cout << " Usage:\n " <<
297- " <uploadFilePath> <saveFilePath>\n\n " <<
299+ " <bucketNamePrefix> < uploadFilePath> <saveFilePath>\n\n " <<
298300 " Where:\n " <<
301+ " bucketNamePrefix - A prefix for a bucket name..\n "
299302 " uploadFilePath - The path where the file is located (for example, C:/AWS/book2.pdf).\n "
300303 <<
301304 " saveFilePath - The path where the file is saved after it's " <<
302305 " downloaded (for example, C:/AWS/book2.pdf). " << std::endl;
303306 return 1 ;
304307 }
305308
306- Aws::String objectPath = argv[1 ];
307- Aws::String savePath = argv[2 ];
309+ Aws::String bucketNamePrefix = argv[1 ];
310+ Aws::String objectPath = argv[2 ];
311+ Aws::String savePath = argv[3 ];
308312
309313 Aws::SDKOptions options;
310314 InitAPI (options);
311315
312316 {
313317 Aws::Client::ClientConfiguration clientConfig;
314- AwsDoc::S3::S3_GettingStartedScenario (objectPath, savePath, clientConfig);
318+ AwsDoc::S3::S3_GettingStartedScenario (bucketNamePrefix, objectPath, savePath, clientConfig);
315319 }
316320
317321 ShutdownAPI (options);
0 commit comments