diff --git a/PARAMETER_PROVIDERS.md b/PARAMETER_PROVIDERS.md index fe6598a566..27daa655d5 100644 --- a/PARAMETER_PROVIDERS.md +++ b/PARAMETER_PROVIDERS.md @@ -12,26 +12,28 @@ 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. --> + ## Table of Contents - [EnvironmentVariableParameterProvider](#EnvironmentVariableParameterProvider) + ## EnvironmentVariableParameterProvider ### Description -Fetches parameters from environment variables +Fetches parameters from environment variables. + +This provider generates a single Parameter Context with the name specified in the `Parameter Group Name` property, if it doesn't exist yet. The parameters generated match the name of the environment variables that are included. ### Properties -In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values. +In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language. | Name | Default Value | Allowable Values | Description | |---------------------------------------------|---------------|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Sensitive Parameter Scope** | none | none
all
selected | Define which parameters are considered sensitive. If 'selected' is chosen, the 'Sensitive Parameter List' property must be set. | +| Sensitive Parameter List | | | List of sensitive parameters, if 'Sensitive Parameter Scope' is set to 'selected'. | | **Environment Variable Inclusion Strategy** | Include All | Include All
Comma-Separated
Regular Expression | Indicates how Environment Variables should be included | | Include Environment Variables | | | Specifies comma separated environment variable names or regular expression (depending on the Environment Variable Inclusion Strategy) that should be used to fetch environment variables. | | **Parameter Group Name** | | | The name of the parameter group that will be fetched. This indicates the name of the Parameter Context that may receive the fetched parameters. | - -### Generated Parameter Contexts - -This provider generates a single Parameter Context with the name specified in the `Parameter Group Name` property, if it doesn't exist yet. The parameters generated match the name of the environment variables that are included. diff --git a/libminifi/include/core/ParameterProvider.h b/libminifi/include/core/ParameterProvider.h index 62bdc253dd..f756feb10f 100644 --- a/libminifi/include/core/ParameterProvider.h +++ b/libminifi/include/core/ParameterProvider.h @@ -60,7 +60,7 @@ class ParameterProvider : public ConfigurableComponentImpl, public CoreComponent ~ParameterProvider() override = default; MINIFIAPI static constexpr auto SensitiveParameterScope = core::PropertyDefinitionBuilder()>::createProperty("Sensitive Parameter Scope") - .withDescription("Define which parameters are considered sensitive, being either 'none', 'all' or 'selected'. If 'selected' is chosen, the 'Sensitive Parameter List' property must be set.") + .withDescription("Define which parameters are considered sensitive. If 'selected' is chosen, the 'Sensitive Parameter List' property must be set.") .isRequired(true) .withDefaultValue(magic_enum::enum_name(SensitiveParameterScopeOptions::none)) .withAllowedValues(magic_enum::enum_names()) diff --git a/libminifi/include/parameter-providers/EnvironmentVariableParameterProvider.h b/libminifi/include/parameter-providers/EnvironmentVariableParameterProvider.h index 4a374f77eb..7ed3c6d4b0 100644 --- a/libminifi/include/parameter-providers/EnvironmentVariableParameterProvider.h +++ b/libminifi/include/parameter-providers/EnvironmentVariableParameterProvider.h @@ -52,7 +52,9 @@ class EnvironmentVariableParameterProvider final : public core::ParameterProvide public: using ParameterProvider::ParameterProvider; - MINIFIAPI static constexpr const char* Description = "Fetches parameters from environment variables"; + MINIFIAPI static constexpr const char* Description = "Fetches parameters from environment variables.\n\n" + "This provider generates a single Parameter Context with the name specified in the `Parameter Group Name` property, if it doesn't exist yet. " + "The parameters generated match the name of the environment variables that are included."; MINIFIAPI static constexpr auto EnvironmentVariableInclusionStrategy = core::PropertyDefinitionBuilder()>::createProperty("Environment Variable Inclusion Strategy") @@ -70,9 +72,11 @@ class EnvironmentVariableParameterProvider final : public core::ParameterProvide .isRequired(true) .build(); + MINIFIAPI static constexpr auto Properties = minifi::utils::array_cat(core::ParameterProvider::Properties, + std::to_array({EnvironmentVariableInclusionStrategy, IncludeEnvironmentVariables, ParameterGroupName})); + void initialize() override { - setSupportedProperties(minifi::utils::array_cat(core::ParameterProvider::Properties, - std::to_array({EnvironmentVariableInclusionStrategy, IncludeEnvironmentVariables, ParameterGroupName}))); + setSupportedProperties(Properties); } private: diff --git a/minifi-api/include/minifi-cpp/agent/agent_docs.h b/minifi-api/include/minifi-cpp/agent/agent_docs.h index ccbf100d57..21106cec14 100644 --- a/minifi-api/include/minifi-cpp/agent/agent_docs.h +++ b/minifi-api/include/minifi-cpp/agent/agent_docs.h @@ -52,10 +52,11 @@ struct ClassDescription { struct Components { std::vector processors_; std::vector controller_services_; + std::vector parameter_providers_; std::vector other_components_; [[nodiscard]] bool empty() const noexcept { - return processors_.empty() && controller_services_.empty() && other_components_.empty(); + return processors_.empty() && controller_services_.empty() && parameter_providers_.empty() && other_components_.empty(); } }; diff --git a/minifi_main/AgentDocs.cpp b/minifi_main/AgentDocs.cpp index 97a609dd4a..eeb8afe962 100644 --- a/minifi_main/AgentDocs.cpp +++ b/minifi_main/AgentDocs.cpp @@ -17,13 +17,12 @@ #include "AgentDocs.h" +#include #include #include #include #include -#include "range/v3/algorithm.hpp" -#include "range/v3/action/transform.hpp" #include "range/v3/algorithm/lexicographical_compare.hpp" #include "range/v3/range/conversion.hpp" #include "range/v3/view/transform.hpp" @@ -32,11 +31,9 @@ #include "agent/agent_docs.h" #include "agent/agent_version.h" #include "core/Core.h" -#include "core/PropertyValue.h" #include "core/PropertyType.h" #include "core/Relationship.h" #include "TableFormatter.h" -#include "utils/file/FileUtils.h" #include "utils/StringUtils.h" namespace { @@ -190,6 +187,7 @@ namespace org::apache::nifi::minifi::docs { void AgentDocs::generate(const std::filesystem::path& docs_dir) { std::vector> controller_services; std::vector> processors; + std::vector> parameter_providers; for (const auto &group : minifi::AgentBuild::getExtensions()) { struct Components descriptions = build_description_.getClassDescriptions(group); for (const auto &controller_service_description : descriptions.controller_services_) { @@ -198,9 +196,13 @@ void AgentDocs::generate(const std::filesystem::path& docs_dir) { for (const auto &processor_description : descriptions.processors_) { processors.emplace_back(extractClassName(processor_description.full_name_), processor_description); } + for (const auto& parameter_provider_description : descriptions.parameter_providers_) { + parameter_providers.emplace_back(extractClassName(parameter_provider_description.full_name_), parameter_provider_description); + } } - ranges::sort(controller_services, std::less(), lowercaseFirst); - ranges::sort(processors, std::less(), lowercaseFirst); + std::ranges::sort(controller_services, std::less(), lowercaseFirst); + std::ranges::sort(processors, std::less(), lowercaseFirst); + std::ranges::sort(parameter_providers, std::less(), lowercaseFirst); std::ofstream controllers_md(docs_dir / "CONTROLLERS.md"); writeHeader(controllers_md, controller_services); @@ -220,6 +222,14 @@ void AgentDocs::generate(const std::filesystem::path& docs_dir) { writeRelationships(processors_md, documentation); writeOutputAttributes(processors_md, documentation); } + + std::ofstream parameter_providers_md(docs_dir / "PARAMETER_PROVIDERS.md"); + writeHeader(parameter_providers_md, parameter_providers); + for (const auto& [name, documentation] : parameter_providers) { + writeName(parameter_providers_md, name); + writeDescription(parameter_providers_md, documentation); + writeProperties(parameter_providers_md, documentation); + } } } // namespace org::apache::nifi::minifi::docs diff --git a/utils/include/agent/agent_docs.h b/utils/include/agent/agent_docs.h index 2073b8e9c3..a3282d2fd3 100644 --- a/utils/include/agent/agent_docs.h +++ b/utils/include/agent/agent_docs.h @@ -80,6 +80,14 @@ void AgentDocs::createClassDescription(const std::string& group, const std::stri .class_properties_ = detail::toVector(Class::Properties), .supports_dynamic_properties_ = Class::SupportsDynamicProperties, }); + } else if constexpr (Type == ResourceType::ParameterProvider) { + components.parameter_providers_.push_back(ClassDescription{ + .type_ = Type, + .short_name_ = name, + .full_name_ = detail::classNameWithDots(), + .description_ = Class::Description, + .class_properties_ = detail::toVector(Class::Properties) + }); } else if constexpr (Type == ResourceType::DescriptionOnly) { components.other_components_.push_back(ClassDescription{ .type_ = Type,