blob: 9dcafcc37652c2ff10cb501645c48e3bd1c9d319 [file] [log] [blame]
/**
*
* 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 <memory>
#include <optional>
#include <string>
#include "aws/core/auth/AWSCredentials.h"
#include "utils/AWSInitializer.h"
#include "minifi-cpp/core/logging/Logger.h"
#include "core/logging/LoggerFactory.h"
namespace org::apache::nifi::minifi::aws {
class AWSCredentialsProvider {
public:
explicit AWSCredentialsProvider(
bool use_default_credentials = false,
std::string access_key = "",
std::string secret_key = "",
std::string credentials_file = "");
void setUseDefaultCredentials(bool use_default_credentials);
void setAccessKey(const std::string &access_key);
void setSecretKey(const std::string &secret_key);
void setCredentialsFile(const std::string &credentials_file);
[[nodiscard]] bool getUseDefaultCredentials() const;
[[nodiscard]] std::optional<Aws::Auth::AWSCredentials> getAWSCredentials();
private:
const utils::AWSInitializer& AWS_INITIALIZER = utils::AWSInitializer::get();
bool use_default_credentials_;
std::string access_key_;
std::string secret_key_;
std::string credentials_file_;
std::shared_ptr<core::logging::Logger> logger_{core::logging::LoggerFactory<AWSCredentialsProvider>::getLogger()};
};
} // namespace org::apache::nifi::minifi::aws