Skip to content

Commit 9c5c53f

Browse files
committed
Fix CRT constructor
1 parent 016da33 commit 9c5c53f

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ S3CrtClient::S3CrtClient(const std::shared_ptr<AWSCredentialsProvider>& credenti
283283
signPayloads,
284284
false),
285285
Aws::MakeShared<S3CrtErrorMarshaller>(ALLOCATION_TAG)),
286-
m_clientConfiguration(clientConfiguration, signPayloads),
286+
m_clientConfiguration(clientConfiguration),
287287
m_credProvider(credentialsProvider),
288288
m_identityProvider(Aws::MakeShared<DefaultS3ExpressIdentityProvider>(ALLOCATION_TAG, *this))
289289
{

tests/aws-cpp-sdk-s3-crt-integration-tests/BucketAndObjectOperationTest.cpp

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ namespace
8484
static std::string BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME = "largeeventstream";
8585
static std::string BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME = "errorsinevent";
8686
static std::string BASE_CHECKSUMS_BUCKET_NAME = "checksums-crt";
87+
static std::string BASE_CRT_CREDENTIALS_TEST_BUCKET_NAME = "crt-credentials-test";
8788
static const char* ALLOCATION_TAG = "BucketAndObjectOperationTest";
8889
static const char* TEST_OBJ_KEY = "TestObjectKey";
8990
static const char* TEST_NOT_MODIFIED_OBJ_KEY = "TestNotModifiedObjectKey";
@@ -123,7 +124,8 @@ namespace
123124
std::ref(BASE_EVENT_STREAM_TEST_BUCKET_NAME),
124125
std::ref(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME),
125126
std::ref(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME),
126-
std::ref(BASE_CHECKSUMS_BUCKET_NAME)
127+
std::ref(BASE_CHECKSUMS_BUCKET_NAME),
128+
std::ref(BASE_CRT_CREDENTIALS_TEST_BUCKET_NAME)
127129
};
128130

129131
for (auto& testBucketName : TEST_BUCKETS)
@@ -171,6 +173,7 @@ namespace
171173
DeleteBucket(CalculateBucketName(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME.c_str()));
172174
DeleteBucket(CalculateBucketName(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME.c_str()));
173175
DeleteBucket(CalculateBucketName(BASE_CHECKSUMS_BUCKET_NAME.c_str()));
176+
DeleteBucket(CalculateBucketName(BASE_CRT_CREDENTIALS_TEST_BUCKET_NAME.c_str()));
174177

175178
Client = nullptr;
176179
oregonClient = nullptr;
@@ -1565,6 +1568,46 @@ namespace
15651568
AWS_EXPECT_SUCCESS(response);
15661569
}
15671570

1571+
TEST_F(BucketAndObjectOperationTest, ExplicitCredentialsProviderShouldWork) {
1572+
const Aws::String fullBucketName = CalculateBucketName(BASE_CHECKSUMS_BUCKET_NAME.c_str());
1573+
const Aws::String testKey = "test-key.txt";
1574+
SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName);
1575+
CreateBucketRequest createBucketRequest;
1576+
createBucketRequest.SetBucket(fullBucketName);
1577+
createBucketRequest.SetACL(BucketCannedACL::private_);
1578+
CreateBucketOutcome createBucketOutcome = Client->CreateBucket(createBucketRequest);
1579+
AWS_ASSERT_SUCCESS(createBucketOutcome);
1580+
1581+
Aws::S3Crt::ClientConfiguration s3ClientConfig;
1582+
s3ClientConfig.region = Aws::Region::US_EAST_1;
1583+
s3ClientConfig.scheme = Scheme::HTTPS;
1584+
s3ClientConfig.executor = Aws::MakeShared<Aws::Utils::Threading::PooledThreadExecutor>(ALLOCATION_TAG, 4);
1585+
s3ClientConfig.throughputTargetGbps = 2.0;
1586+
s3ClientConfig.partSize = 5 * 1024 * 1024;
1587+
s3ClientConfig.contentLengthConfiguration = Aws::S3Crt::S3CrtClientConfiguration::CONTENT_LENGTH_CONFIGURATION::SKIP_CONTENT_LENGTH;
1588+
1589+
// Assume that something in the default credentials provider chain works
1590+
const auto credsProvder = Aws::MakeShared<Aws::Auth::DefaultAWSCredentialsProviderChain>(ALLOCATION_TAG);
1591+
S3CrtClient client{credsProvder, s3ClientConfig};
1592+
1593+
auto request = PutObjectRequest{}.WithBucket(fullBucketName)
1594+
.WithKey(testKey);
1595+
1596+
// create 30 MiB test body
1597+
auto data = Aws::MakeShared<Aws::StringStream>(ALLOCATION_TAG);
1598+
*data << Aws::String(30 * 1024 * 1024, '*');
1599+
request.SetBody(data);
1600+
1601+
const auto putObjectOutcome = client.PutObject(request);
1602+
AWS_EXPECT_SUCCESS(putObjectOutcome);
1603+
1604+
const auto headObjectResponse = client.HeadObject(HeadObjectRequest{}.WithBucket(fullBucketName)
1605+
.WithKey(testKey));
1606+
AWS_EXPECT_SUCCESS(headObjectResponse);
1607+
const int THIRTY_MiB{31457280};
1608+
EXPECT_EQ(THIRTY_MiB, headObjectResponse.GetResult().GetContentLength());
1609+
}
1610+
15681611
class TestMonitoring: public Aws::Monitoring::MonitoringInterface
15691612
{
15701613
mutable std::shared_ptr<Aws::Vector<Aws::String>> m_sequence;

tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtServiceClientSourceInit.vm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ ${className}::${className}(const std::shared_ptr<AWSCredentialsProvider>& creden
177177
false),
178178
Aws::MakeShared<${metadata.classNamePrefix}ErrorMarshaller>(ALLOCATION_TAG)),
179179
#if($serviceModel.endpointRules)
180-
m_clientConfiguration(clientConfiguration${signPayloadsParam}),
180+
m_clientConfiguration(clientConfiguration),
181181
${credentialsProviderMember},
182182
#else
183183
${credentialsProviderMember}${virtualAddressingInit}${USEast1RegionalEndpointInitString},

0 commit comments

Comments
 (0)