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

MINIFICPP-1376 Create PutS3Object processor #915

Closed
wants to merge 56 commits into from

Conversation

lordgamez
Copy link
Contributor

@lordgamez lordgamez commented Sep 30, 2020

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:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

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.

@lordgamez lordgamez force-pushed the MINIFICPP-1376 branch 2 times, most recently from 1dc3e95 to 5ecdec8 Compare October 21, 2020 09:11
PROCESSORS.md Outdated Show resolved Hide resolved
cmake/BundledAwsSdkCpp.cmake Outdated Show resolved Hide resolved
Copy link
Contributor

@arpadboda arpadboda left a 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"
Copy link
Contributor

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;
Copy link
Contributor

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 :)

Copy link
Contributor Author

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) {
Copy link
Contributor

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()) {
Copy link
Contributor

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.

Copy link
Contributor Author

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 += ", ";
Copy link
Contributor

@arpadboda arpadboda Oct 27, 2020

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);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e994558

@arpadboda arpadboda closed this in ac943dd Oct 27, 2020
fgerlits pushed a commit to fgerlits/nifi-minifi-cpp that referenced this pull request Oct 29, 2020
Signed-off-by: Arpad Boda <aboda@apache.org>

This closes apache#915
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants