lordgamez commented on a change in pull request #1178:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1178#discussion_r720322653
##########
File path: extensions/azure/storage/AzureStorageCredentials.h
##########
@@ -21,53 +21,32 @@
#include <string>
-#include "utils/StringUtils.h"
-
-namespace org {
-namespace apache {
-namespace nifi {
-namespace minifi {
-namespace azure {
-namespace storage {
-
-struct AzureStorageCredentials {
- std::string storage_account_name;
- std::string storage_account_key;
- std::string sas_token;
- std::string endpoint_suffix;
- std::string connection_string;
-
- std::string getConnectionString() const {
- if (!connection_string.empty()) {
- return connection_string;
- }
-
- if (storage_account_name.empty() || (storage_account_key.empty() &&
sas_token.empty())) {
- return "";
- }
-
- std::string credentials;
- credentials += "AccountName=" + storage_account_name;
-
- if (!storage_account_key.empty()) {
- credentials += ";AccountKey=" + storage_account_key;
- }
-
- if (!sas_token.empty()) {
- credentials += ";SharedAccessSignature=" + (sas_token[0] == '?' ?
sas_token.substr(1) : sas_token);
- }
-
- if (!endpoint_suffix.empty()) {
- credentials += ";EndpointSuffix=" + endpoint_suffix;
- }
-
- return credentials;
- }
+namespace org::apache::nifi::minifi::azure::storage {
+
+class AzureStorageCredentials {
+ public:
+ void setStorageAccountName(const std::string& storage_account_name);
+ void setStorageAccountKey(const std::string& storage_account_key);
+ void setSasToken(const std::string& sas_token);
+ void setEndpontSuffix(const std::string& endpoint_suffix);
+ void setConnectionString(const std::string& connection_string);
+ void setUseManagedIdentityCredentials(bool use_managed_identity_credentials);
+
+ std::string getStorageAccountName() const;
+ std::string getEndpointSuffix() const;
+ bool getUseManagedIdentityCredentials() const;
+ std::string buildConnectionString() const;
+ bool isValid() const;
Review comment:
I only provided getter for the `use_managed_identity_credentials_`
member and the `storage_account_name_` and `endpoint_suffix_` members to be
retrievable if managed identity is used. The goal was that every other member
should only be settable and if managed identity is not used only the full
connectionstring should be built and retrieved with the `buildConnectionString`
member. (The built connection string is not stored in the `connection_string_`
member, it is a separate member for overriding credentials if needed).
--
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]