Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled import from s3 directory feature on windows #899

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
7 changes: 6 additions & 1 deletion ydb/public/lib/ydb_cli/commands/ydb_service_import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ int TCommandImportFromS3::Run(TConfig& config) {
}

settings.NumberOfRetries(NumberOfRetries);

#if defined(_win32_)
for (const auto& item : Items) {
settings.AppendItem({item.Source, item.Destination});
}
#else
InitAwsAPI();
try {
auto s3Client = CreateS3ClientWrapper(settings);
Expand Down Expand Up @@ -162,6 +166,7 @@ int TCommandImportFromS3::Run(TConfig& config) {
throw;
}
ShutdownAwsAPI();
#endif

TImportClient client(CreateDriver(config));
TImportFromS3Response response = client.ImportFromS3(std::move(settings)).GetValueSync();
Expand Down
16 changes: 16 additions & 0 deletions ydb/public/lib/ydb_cli/common/aws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

#include <ydb/public/sdk/cpp/client/ydb_import/import.h>

#if !defined(_win32_)
#include <aws/core/Aws.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/ListObjectsV2Request.h>
#endif

namespace NYdb::NConsoleClient {

Expand Down Expand Up @@ -41,6 +43,19 @@ TString TCommandWithAwsCredentials::ReadIniKey(const TString& iniKey) {
}
}

#if defined(_win32_)
std::unique_ptr<IS3ClientWrapper> CreateS3ClientWrapper(const NImport::TImportFromS3Settings& settings) {
throw yexception() << "AWS API is not supported for windows platform";
}

void InitAwsAPI() {
throw yexception() << "AWS API is not supported for windows platform";
}

void ShutdownAwsAPI() {
throw yexception() << "AWS API is not supported for windows platform";
}
#else
class TS3ClientWrapper : public IS3ClientWrapper {
public:
TS3ClientWrapper(const NImport::TImportFromS3Settings& settings)
Expand Down Expand Up @@ -100,5 +115,6 @@ void InitAwsAPI() {
void ShutdownAwsAPI() {
Aws::ShutdownAPI(Aws::SDKOptions());
}
#endif

}
Loading