adamdebreceni commented on a change in pull request #915:
URL: https://github.com/apache/nifi-minifi-cpp/pull/915#discussion_r498792335



##########
File path: extensions/aws/processors/PutS3Object.h
##########
@@ -0,0 +1,188 @@
+/**
+ * @file PutS3Object.h
+ * PutS3Object class declaration
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include <sstream>
+#include <utility>
+#include <vector>
+#include <memory>
+#include <string>
+
+#include "aws/core/auth/AWSCredentialsProvider.h"
+
+#include "S3Wrapper.h"
+#include "core/Property.h"
+#include "core/Processor.h"
+#include "core/logging/Logger.h"
+#include "core/logging/LoggerConfiguration.h"
+#include "utils/OptionalUtils.h"
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace aws {
+namespace processors {
+
+namespace region {
+
+  constexpr const char *US_GOV_WEST_1 = "us-gov-west-1";
+  constexpr const char *US_EAST_1 = "us-east-1";
+  constexpr const char *US_EAST_2 = "us-east-2";
+  constexpr const char *US_WEST_1 = "us-west-1";
+  constexpr const char *US_WEST_2 = "us-west-2";
+  constexpr const char *EU_WEST_1 = "eu-west-1";
+  constexpr const char *EU_WEST_2 = "eu-west-2";
+  constexpr const char *EU_CENTRAL_1 = "eu-central-1";
+  constexpr const char *AP_SOUTH_1 = "ap-south-1";
+  constexpr const char *AP_SOUTHEAST_1 = "ap-southeast-1";
+  constexpr const char *AP_SOUTHEAST_2 = "ap-southeast-2";
+  constexpr const char *AP_NORTHEAST_1 = "ap-northeast-1";
+  constexpr const char *AP_NORTHEAST_2 = "ap-northeast-2";
+  constexpr const char *SA_EAST_1 = "sa-east-1";
+  constexpr const char *CN_NORTH_1 = "cn-north-1";
+  constexpr const char *CA_CENTRAL_1 = "ca-central-1";
+
+}  // namespace region
+
+class PutS3Object : public core::Processor {
+ public:
+  static constexpr char const* ProcessorName = "PutS3Object";
+
+  static const std::set<std::string> CANNED_ACLS;
+  static const std::set<std::string> REGIONS;
+  static const std::set<std::string> STORAGE_CLASSES;
+  static const std::set<std::string> SERVER_SIDE_ENCRYPTIONS;
+
+  // Supported Properties
+  static const core::Property ObjectKey;
+  static const core::Property Bucket;
+  static const core::Property ContentType;
+  static const core::Property AccessKey;
+  static const core::Property SecretKey;
+  static const core::Property CredentialsFile;
+  static const core::Property AWSCredentialsProviderService;
+  static const core::Property StorageClass;
+  static const core::Property ServerSideEncryption;
+  static const core::Property Region;
+  static const core::Property CommunicationsTimeout;
+  static const core::Property FullControlUserList;
+  static const core::Property ReadPermissionUserList;
+  static const core::Property ReadACLUserList;
+  static const core::Property WriteACLUserList;
+  static const core::Property CannedACL;
+  static const core::Property EndpointOverrideURL;
+  static const core::Property ProxyHost;
+  static const core::Property ProxyPort;
+  static const core::Property ProxyUsername;
+  static const core::Property ProxyPassword;
+
+  // Supported Relationships
+  static const core::Relationship Failure;
+  static const core::Relationship Success;
+
+  explicit PutS3Object(std::string name, minifi::utils::Identifier uuid = 
minifi::utils::Identifier())
+      : PutS3Object(name, uuid, 
minifi::utils::make_unique<aws::s3::S3Wrapper>()) {
+  }
+
+  explicit PutS3Object(std::string name, minifi::utils::Identifier uuid, 
std::unique_ptr<aws::s3::S3WrapperBase> s3_wrapper)
+      : core::Processor(std::move(name), uuid)
+      , s3_wrapper_(std::move(s3_wrapper)) {
+  }
+
+  ~PutS3Object() override = default;
+
+  bool supportsDynamicProperties() override { return true; }
+  void initialize() override;
+  void onSchedule(const std::shared_ptr<core::ProcessContext> &context, const 
std::shared_ptr<core::ProcessSessionFactory> &sessionFactory) override;
+  void onTrigger(const std::shared_ptr<core::ProcessContext> &context, const 
std::shared_ptr<core::ProcessSession> &session) override;
+
+  class ReadCallback : public InputStreamCallback {
+   public:
+    static const uint64_t MAX_SIZE = 5UL * 1024UL * 1024UL * 1024UL;  // 5GB 
limit on AWS
+    static const uint64_t BUFFER_SIZE = 4096;
+
+    ReadCallback(uint64_t flow_size, const 
minifi::aws::s3::PutObjectRequestParameters& options, aws::s3::S3WrapperBase* 
s3_wrapper)
+      : flow_size_(flow_size)
+      , options_(std::move(options))
+      , s3_wrapper_(s3_wrapper) {
+    }
+
+    ~ReadCallback() = default;
+
+    int64_t process(std::shared_ptr<io::BaseStream> stream) {

Review comment:
       we should add `override` to `~ReadCallback` and `process`




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to