Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ S3CrtClient::S3CrtClient(const std::shared_ptr<AWSCredentialsProvider>& credenti
signPayloads,
false),
Aws::MakeShared<S3CrtErrorMarshaller>(ALLOCATION_TAG)),
m_clientConfiguration(clientConfiguration, signPayloads),
m_clientConfiguration(clientConfiguration),
m_credProvider(credentialsProvider),
m_identityProvider(Aws::MakeShared<DefaultS3ExpressIdentityProvider>(ALLOCATION_TAG, *this))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ namespace
static std::string BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME = "largeeventstream";
static std::string BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME = "errorsinevent";
static std::string BASE_CHECKSUMS_BUCKET_NAME = "checksums-crt";
static std::string BASE_CRT_CREDENTIALS_TEST_BUCKET_NAME = "crt-credentials-test";
static const char* ALLOCATION_TAG = "BucketAndObjectOperationTest";
static const char* TEST_OBJ_KEY = "TestObjectKey";
static const char* TEST_NOT_MODIFIED_OBJ_KEY = "TestNotModifiedObjectKey";
Expand Down Expand Up @@ -123,7 +124,8 @@ namespace
std::ref(BASE_EVENT_STREAM_TEST_BUCKET_NAME),
std::ref(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME),
std::ref(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME),
std::ref(BASE_CHECKSUMS_BUCKET_NAME)
std::ref(BASE_CHECKSUMS_BUCKET_NAME),
std::ref(BASE_CRT_CREDENTIALS_TEST_BUCKET_NAME)
};

for (auto& testBucketName : TEST_BUCKETS)
Expand Down Expand Up @@ -171,6 +173,7 @@ namespace
DeleteBucket(CalculateBucketName(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME.c_str()));
DeleteBucket(CalculateBucketName(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME.c_str()));
DeleteBucket(CalculateBucketName(BASE_CHECKSUMS_BUCKET_NAME.c_str()));
DeleteBucket(CalculateBucketName(BASE_CRT_CREDENTIALS_TEST_BUCKET_NAME.c_str()));

Client = nullptr;
oregonClient = nullptr;
Expand Down Expand Up @@ -1565,6 +1568,46 @@ namespace
AWS_EXPECT_SUCCESS(response);
}

TEST_F(BucketAndObjectOperationTest, ExplicitCredentialsProviderShouldWork) {
const Aws::String fullBucketName = CalculateBucketName(BASE_CHECKSUMS_BUCKET_NAME.c_str());
const Aws::String testKey = "test-key.txt";
SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName);
CreateBucketRequest createBucketRequest;
createBucketRequest.SetBucket(fullBucketName);
createBucketRequest.SetACL(BucketCannedACL::private_);
CreateBucketOutcome createBucketOutcome = Client->CreateBucket(createBucketRequest);
AWS_ASSERT_SUCCESS(createBucketOutcome);

Aws::S3Crt::ClientConfiguration s3ClientConfig;
s3ClientConfig.region = Aws::Region::US_EAST_1;
s3ClientConfig.scheme = Scheme::HTTPS;
s3ClientConfig.executor = Aws::MakeShared<Aws::Utils::Threading::PooledThreadExecutor>(ALLOCATION_TAG, 4);
s3ClientConfig.throughputTargetGbps = 2.0;
s3ClientConfig.partSize = 5 * 1024 * 1024;
s3ClientConfig.contentLengthConfiguration = Aws::S3Crt::S3CrtClientConfiguration::CONTENT_LENGTH_CONFIGURATION::SKIP_CONTENT_LENGTH;

// Assume that something in the default credentials provider chain works
const auto credsProvder = Aws::MakeShared<Aws::Auth::DefaultAWSCredentialsProviderChain>(ALLOCATION_TAG);
S3CrtClient client{credsProvder, s3ClientConfig};

auto request = PutObjectRequest{}.WithBucket(fullBucketName)
.WithKey(testKey);

// create 30 MiB test body
auto data = Aws::MakeShared<Aws::StringStream>(ALLOCATION_TAG);
*data << Aws::String(30 * 1024 * 1024, '*');
request.SetBody(data);

const auto putObjectOutcome = client.PutObject(request);
AWS_EXPECT_SUCCESS(putObjectOutcome);

const auto headObjectResponse = client.HeadObject(HeadObjectRequest{}.WithBucket(fullBucketName)
.WithKey(testKey));
AWS_EXPECT_SUCCESS(headObjectResponse);
const int THIRTY_MiB{31457280};
EXPECT_EQ(THIRTY_MiB, headObjectResponse.GetResult().GetContentLength());
}

class TestMonitoring: public Aws::Monitoring::MonitoringInterface
{
mutable std::shared_ptr<Aws::Vector<Aws::String>> m_sequence;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ ${className}::${className}(const std::shared_ptr<AWSCredentialsProvider>& creden
false),
Aws::MakeShared<${metadata.classNamePrefix}ErrorMarshaller>(ALLOCATION_TAG)),
#if($serviceModel.endpointRules)
m_clientConfiguration(clientConfiguration${signPayloadsParam}),
m_clientConfiguration(clientConfiguration),
${credentialsProviderMember},
#else
${credentialsProviderMember}${virtualAddressingInit}${USEast1RegionalEndpointInitString},
Expand Down
Loading