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



##########
File path: extensions/azure/processors/PutAzureBlobStorage.h
##########
@@ -77,11 +77,8 @@ class PutAzureBlobStorage final : public 
AzureStorageProcessorBase {
         return -1;
       }
 
-      result_ = blob_storage_wrapper_.uploadBlob(blob_name_, buffer.data(), 
flow_size_);
-      if (!result_) {
-        return read_ret;
-      }
-      return result_->length;
+      result_ = azure_blob_storage_.uploadBlob(params_, gsl::span<const 
uint8_t>{buffer.data(), flow_size_});

Review comment:
       Updated in 32d6542825310892eed3e5648dd55bc5b0d66257

##########
File path: extensions/azure/storage/AzureStorageClient.h
##########
@@ -0,0 +1,34 @@
+/**
+ * @file AzureStorageClient.h
+ * AzureStorageClient 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 "AzureStorageCredentials.h"
+
+namespace org::apache::nifi::minifi::azure::storage {
+
+class AzureStorageClient {
+ public:
+  virtual ~AzureStorageClient() = default;
+
+ protected:
+  AzureStorageCredentials credentials_;
+};

Review comment:
       Updated in 32d6542825310892eed3e5648dd55bc5b0d66257

##########
File path: extensions/azure/storage/BlobStorageClient.h
##########
@@ -24,40 +24,23 @@
 #include <utility>
 #include <vector>
 
-namespace org {
-namespace apache {
-namespace nifi {
-namespace minifi {
-namespace azure {
-namespace storage {
+#include "azure/storage/blobs/protocol/blob_rest_client.hpp"
+#include "AzureStorageClient.h"
+#include "gsl/gsl-lite.hpp"
 
-struct UploadBlobResult {
-  std::string primary_uri;
-  std::string etag;
-  std::size_t length;
-  std::string timestamp;
+namespace org::apache::nifi::minifi::azure::storage {
+
+struct PutAzureBlobStorageParameters {
+  AzureStorageCredentials credentials;
+  std::string container_name;
+  std::string blob_name;
 };
 
-class BlobStorage {
+class BlobStorageClient : public AzureStorageClient {

Review comment:
       Updated in 32d6542825310892eed3e5648dd55bc5b0d66257

##########
File path: extensions/azure/storage/AzureBlobStorage.cpp
##########
@@ -23,61 +23,39 @@
 #include <memory>
 #include <utility>
 
-namespace org {
-namespace apache {
-namespace nifi {
-namespace minifi {
-namespace azure {
-namespace storage {
+#include "azure/identity.hpp"
+#include "AzureBlobStorageClient.h"
 
-AzureBlobStorage::AzureBlobStorage(std::string connection_string, std::string 
container_name)
-  : BlobStorage(std::move(connection_string), std::move(container_name))
-  , 
container_client_(std::make_unique<Azure::Storage::Blobs::BlobContainerClient>(
-      
Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString(connection_string_,
 container_name_))) {
-}
+namespace org::apache::nifi::minifi::azure::storage {
 
-void AzureBlobStorage::resetClientIfNeeded(const std::string 
&connection_string, const std::string &container_name) {
-  if (connection_string == connection_string_ && container_name_ == 
container_name) {
-    logger_->log_debug("Client credentials have not changed, no need to reset 
client");
-    return;
-  }
-  connection_string_ = connection_string;
-  container_name_ = container_name;
-  logger_->log_debug("Client has been reset with new credentials");
-  container_client_ = 
std::make_unique<Azure::Storage::Blobs::BlobContainerClient>(Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString(connection_string,
 container_name));
+AzureBlobStorage::AzureBlobStorage(std::unique_ptr<BlobStorageClient> 
blob_storage_client)
+  : blob_storage_client_(blob_storage_client ? std::move(blob_storage_client) 
: std::make_unique<AzureBlobStorageClient>()) {

Review comment:
       Updated in 32d6542825310892eed3e5648dd55bc5b0d66257




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to