lordgamez commented on a change in pull request #939:
URL: https://github.com/apache/nifi-minifi-cpp/pull/939#discussion_r529463251



##########
File path: extensions/aws/AWSCredentialsProvider.cpp
##########
@@ -0,0 +1,94 @@
+/**
+ * @file AWSCredentialsProvider.cpp
+ * AWSCredentialsProvider class implementation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "AWSCredentialsProvider.h"
+
+#include "aws/core/auth/AWSCredentialsProviderChain.h"
+#include "properties/Properties.h"
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace aws {
+
+AWSCredentialsProvider::AWSCredentialsProvider(
+    bool use_default_credentials,
+    const std::string &access_key,
+    const std::string &secret_key,
+    const std::string &credentials_file)
+  : use_default_credentials_(use_default_credentials)
+  , access_key_(access_key)
+  , secret_key_(secret_key)
+  , credentials_file_(credentials_file) {
+}
+
+void AWSCredentialsProvider::setUseDefaultCredentials(bool 
use_default_credentials) {
+  use_default_credentials_ = use_default_credentials;
+}
+
+void AWSCredentialsProvider::setAccessKey(const std::string &access_key) {
+  access_key_ = access_key;
+}
+
+void AWSCredentialsProvider::setSecretKey(const std::string &secret_key) {
+  secret_key_ = secret_key;
+}
+
+void AWSCredentialsProvider::setCredentialsFile(const std::string 
&credentials_file) {
+  credentials_file_ = credentials_file;
+}
+
+minifi::utils::optional<Aws::Auth::AWSCredentials> 
AWSCredentialsProvider::getAWSCredentials() {
+  if (use_default_credentials_) {
+    logger_->log_debug("Trying to use default AWS credentials provider 
chain.");

Review comment:
       Currently it is called for every onTrigger instance in the PutS3Object 
as the credentials can come from flowfile attributes as expression language 
variables. It may be too frequent in some use cases if we change it to info 
level.




----------------------------------------------------------------
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]


Reply via email to