diff --git a/generated/src/aws-cpp-sdk-s3-crt/include/aws/s3-crt/S3CrtClientConfiguration.h b/generated/src/aws-cpp-sdk-s3-crt/include/aws/s3-crt/S3CrtClientConfiguration.h index 1c4f7b52c00..89edd98a890 100644 --- a/generated/src/aws-cpp-sdk-s3-crt/include/aws/s3-crt/S3CrtClientConfiguration.h +++ b/generated/src/aws-cpp-sdk-s3-crt/include/aws/s3-crt/S3CrtClientConfiguration.h @@ -143,6 +143,16 @@ namespace Aws uint32_t maxBackoffSecs = 20; } config; } crtRetryStrategyConfig; + + /** + * Optional. + * The size threshold in bytes for when to use multipart uploads. + * Uploads larger than this will use the multipart upload strategy. + * Uploads smaller or equal to this will use a single HTTP request. + * If set, this should be at least `partSize`. + * If not set, the max of `partSize` and 5 MiB will be used. + */ + Crt::Optional multipartUploadThreshold{}; /* End of S3 CRT specifics */ private: void LoadS3CrtSpecificConfig(const Aws::String& profileName); diff --git a/generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp b/generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp index ec34e2f3729..836e50eed33 100644 --- a/generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp +++ b/generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp @@ -381,6 +381,10 @@ void S3CrtClient::init(const S3Crt::ClientConfiguration& config, static const size_t DEFAULT_PART_SIZE = 8 * 1024 * 1024; // 8MB s3CrtConfig.part_size = config.partSize < DEFAULT_PART_SIZE ? DEFAULT_PART_SIZE : config.partSize; + static const uint64_t FIVE_MB = 5 * 1024 * 1024; + s3CrtConfig.multipart_upload_threshold = config.multipartUploadThreshold.has_value() ? + config.multipartUploadThreshold.value() : + std::max(s3CrtConfig.part_size, FIVE_MB); Aws::Crt::Io::TlsConnectionOptions *rawPTlsConnectionOptions = nullptr; if (config.tlsConnectionOptions) diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtClientConfigHeader.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtClientConfigHeader.vm index 203ee41789f..cb725795544 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtClientConfigHeader.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtClientConfigHeader.vm @@ -76,4 +76,14 @@ uint32_t maxBackoffSecs = 20; } config; } crtRetryStrategyConfig; + + /** + * Optional. + * The size threshold in bytes for when to use multipart uploads. + * Uploads larger than this will use the multipart upload strategy. + * Uploads smaller or equal to this will use a single HTTP request. + * If set, this should be at least `partSize`. + * If not set, the max of `partSize` and 5 MiB will be used. + */ + Crt::Optional multipartUploadThreshold{}; /* End of S3 CRT specifics */ diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtServiceClientSourceInit.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtServiceClientSourceInit.vm index 30d3759628a..37d47f0dd1a 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtServiceClientSourceInit.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtServiceClientSourceInit.vm @@ -408,6 +408,10 @@ void ${className}::init(const ${clientConfigurationNamespace}::ClientConfigurati static const size_t DEFAULT_PART_SIZE = 8 * 1024 * 1024; // 8MB s3CrtConfig.part_size = config.partSize < DEFAULT_PART_SIZE ? DEFAULT_PART_SIZE : config.partSize; + static const uint64_t FIVE_MB = 5 * 1024 * 1024; + s3CrtConfig.multipart_upload_threshold = config.multipartUploadThreshold.has_value() ? + config.multipartUploadThreshold.value() : + std::max(s3CrtConfig.part_size, FIVE_MB); Aws::Crt::Io::TlsConnectionOptions *rawPTlsConnectionOptions = nullptr; if (config.tlsConnectionOptions)