fgerlits commented on a change in pull request #939:
URL: https://github.com/apache/nifi-minifi-cpp/pull/939#discussion_r529406100
##########
File path: extensions/aws/processors/PutS3Object.cpp
##########
@@ -220,57 +227,29 @@ minifi::utils::optional<Aws::Auth::AWSCredentials>
PutS3Object::getAWSCredential
return minifi::utils::nullopt;
}
-minifi::utils::optional<Aws::Auth::AWSCredentials>
PutS3Object::getAWSCredentialsFromProperties(
- const std::shared_ptr<core::ProcessContext> &context,
- const std::shared_ptr<core::FlowFile> &flow_file) const {
- std::string access_key;
- context->getProperty(AccessKey, access_key, flow_file);
- std::string secret_key;
- context->getProperty(SecretKey, secret_key, flow_file);
- if (!access_key.empty() && !secret_key.empty()) {
- Aws::Auth::AWSCredentials creds(access_key, secret_key);
- return minifi::utils::make_optional<Aws::Auth::AWSCredentials>(creds);
- }
- return minifi::utils::nullopt;
-}
-
-minifi::utils::optional<Aws::Auth::AWSCredentials>
PutS3Object::getAWSCredentialsFromFile(const
std::shared_ptr<core::ProcessContext> &context) const {
- std::string credential_file;
- if (context->getProperty(CredentialsFile.getName(), credential_file) &&
!credential_file.empty()) {
- auto properties = std::make_shared<minifi::Properties>();
- properties->loadConfigureFile(credential_file.c_str());
- std::string access_key;
- std::string secret_key;
- if (properties->getString("accessKey", access_key) && !access_key.empty()
&& properties->getString("secretKey", secret_key) && !secret_key.empty()) {
- Aws::Auth::AWSCredentials creds(access_key, secret_key);
- return minifi::utils::make_optional<Aws::Auth::AWSCredentials>(creds);
- }
- }
- return minifi::utils::nullopt;
-}
-
minifi::utils::optional<Aws::Auth::AWSCredentials>
PutS3Object::getAWSCredentials(
const std::shared_ptr<core::ProcessContext> &context,
- const std::shared_ptr<core::FlowFile> &flow_file) const {
- auto prop_cred = getAWSCredentialsFromProperties(context, flow_file);
- if (prop_cred) {
- logger_->log_info("AWS Credentials successfully set from properties");
- return prop_cred.value();
- }
-
- auto file_cred = getAWSCredentialsFromFile(context);
- if (file_cred) {
- logger_->log_info("AWS Credentials successfully set from file");
- return file_cred.value();
- }
-
+ const std::shared_ptr<core::FlowFile> &flow_file) {
Review comment:
why is this function no longer const?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]