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
MINIFICPP-1376 Create PutS3Object processor #915
Conversation
e72f185
to
f1ac6c8
Compare
1dc3e95
to
5ecdec8
Compare
d1f6d68
to
e83b4f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mosty looks good, added some minor comments
EXCLUDE_FROM_ALL TRUE | ||
) | ||
ExternalProject_Add( | ||
aws-sdk-cpp-external | ||
GIT_REPOSITORY "https://github.com/aws/aws-sdk-cpp.git" | ||
GIT_TAG "1.7.109" | ||
GIT_TAG "1.8.52" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
buffer.reserve(BUFFER_SIZE); | ||
read_size_ = 0; | ||
while (read_size_ < flow_size_) { | ||
auto next_read_size = flow_size_ - read_size_ < BUFFER_SIZE ? flow_size_ - read_size_ : BUFFER_SIZE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The right side looks like an std::min to me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e994558
} | ||
|
||
void AWSSdkLogger::LogStream(Aws::Utils::Logging::LogLevel log_level, const char* tag, const Aws::OStringStream &message_stream) { | ||
switch (log_level) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of copy-pasting the logic, can't this simply call the one above?
logger_->log_debug("PutS3Object: Storage Class [%s]", put_s3_request_params_.storage_class); | ||
|
||
std::string value; | ||
if (!context->getProperty(Region.getName(), value) || value.empty() || REGIONS.find(value) == REGIONS.end()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just fancy: in case you use set, you can rely on count instead of comparing the result of find to end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e994558
if (is_first) { | ||
is_first = false; | ||
} else { | ||
result_list += ", "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already implemented in join.
I bit more simple way of doing this:
auto users : minifi::utils::StringUtils::split(comma_separated_list, ",")
for(auto& user: users) {
auto trimmed_user = minifi::utils::StringUtils::trim(user);
if (trimmed_user.find('@') != std::string::npos) {
user = "emailAddress=\"" + trimmed_user + "\"";
} else {
user = "id=" + trimmed_user;
}
}
return minifi::utils::StringUtils::join(", ", users);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e994558
- Uplift requires initializing AWS API earlier (before initializing client config) - Moving S3 wrapper to S3 namespace - Moving implementations to cpp files
e994558
to
7f5c2cb
Compare
Signed-off-by: Arpad Boda <aboda@apache.org> This closes apache#915
Implementation of PutS3Object processor. The purpose of the processor is to upload an S3 object created from a flow file to AWS storage.
Jira issue: https://issues.apache.org/jira/browse/MINIFICPP-1376
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically main)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.