lordgamez commented on code in PR #1895:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1895#discussion_r1918782976
##########
CONFIGURE.md:
##########
@@ -204,46 +206,170 @@ An example for using parameters in a JSON configuration
file:
An example for using parameters in a YAML configuration file:
```yaml
- MiNiFi Config Version: 3
- Flow Controller:
- name: MiNiFi Flow
- Parameter Contexts:
- - id: 235e6b47-ea22-45cd-a472-545801db98e6
- name: common-parameter-context
- description: Common parameter context
- Parameters:
- - name: common_timeout
- description: 'Common timeout seconds'
- sensitive: false
- value: 30
- - id: 804e6b47-ea22-45cd-a472-545801db98e6
- name: root-process-group-context
- description: Root process group parameter context
- Parameters:
- - name: tail_base_dir
- description: 'Base dir of tailed files'
- sensitive: false
- value: /tmp/tail/file/path
- Inherited Parameter Contexts:
- - common-parameter-context
- Processors:
- - name: Tail test_file1.log
- id: 83b58f9f-e661-4634-96fb-0e82b92becdf
- class: org.apache.nifi.minifi.processors.TailFile
- scheduling strategy: TIMER_DRIVEN
- scheduling period: 1000 ms
- Properties:
- File to Tail: "#{tail_base_dir}/test_file1.log"
- - name: Tail test_file2.log
- id: 8a772a10-7c34-48e7-b152-b1a32c5db83e
- class: org.apache.nifi.minifi.processors.TailFile
- scheduling strategy: TIMER_DRIVEN
- scheduling period: 1000 ms
- Properties:
- File to Tail: "#{tail_base_dir}/test_file2.log"
- Parameter Context Name: root-process-group-context
+MiNiFi Config Version: 3
+Flow Controller:
+ name: MiNiFi Flow
+Parameter Contexts:
+ - id: 235e6b47-ea22-45cd-a472-545801db98e6
+ name: common-parameter-context
+ description: Common parameter context
+ Parameters:
+ - name: common_timeout
+ description: 'Common timeout seconds'
+ sensitive: false
+ value: 30
+ - id: 804e6b47-ea22-45cd-a472-545801db98e6
+ name: root-process-group-context
+ description: Root process group parameter context
+ Parameters:
+ - name: tail_base_dir
+ description: 'Base dir of tailed files'
+ sensitive: false
+ value: /tmp/tail/file/path
+ Inherited Parameter Contexts:
+ - common-parameter-context
+Processors:
+- name: Tail test_file1.log
+ id: 83b58f9f-e661-4634-96fb-0e82b92becdf
+ class: org.apache.nifi.minifi.processors.TailFile
+ scheduling strategy: TIMER_DRIVEN
+ scheduling period: 1000 ms
+ Properties:
+ File to Tail: "#{tail_base_dir}/test_file1.log"
+- name: Tail test_file2.log
+ id: 8a772a10-7c34-48e7-b152-b1a32c5db83e
+ class: org.apache.nifi.minifi.processors.TailFile
+ scheduling strategy: TIMER_DRIVEN
+ scheduling period: 1000 ms
+ Properties:
+ File to Tail: "#{tail_base_dir}/test_file2.log"
+Parameter Context Name: root-process-group-context
+```
+
+### Parameter Providers
+
+Parameter contexts can be generated by Parameter Providers. Parameter
Providers can be added to the flow configuration, after which parameter
contexts and parameters generated by these providers can be referenced in the
properties. The parameter contexts generated are persisted in the flow
configuration file and are only regenerated on MiNiFi C++ restart if the
context is removed from the flow configuration. Other parameter contexts can be
also inherited from provider generated parameter contexts.
+
+There are two properties that can be set for all parameter providers for
selecting which properties should be sensitive parameters:
+
+- `Sensitive Parameter Scope`: This property can be set to `none`, `selected`
or `all`. If set to `All`, all parameters generated by the provider will be
marked as sensitive. If set to `none`, all parameters generated by the provider
will be marked as non-sensitive. If set to `selected`, the `Sensitive Parameter
List` property should be set to a list of parameter names that should be marked
as sensitive.
+- `Sensitive Parameter List`: This property should be set to a comma-separated
list of parameter names that should be marked as sensitive. This property is
only used if the `Sensitive Parameter Scope` property is set to `selected`.
+
+An example for using parameter providers in a JSON configuration file:
+
+```json
+{
+ "parameterProviders": [
+ {
+ "identifier": "d26ee5f5-0192-1000-0482-4e333725e089",
+ "name": "EnvironmentVariableParameterProvider",
+ "type": "EnvironmentVariableParameterProvider",
+ "properties": {
+ "Parameter Group Name":
"environment-variable-parameter-context",
+ "Environment Variable Inclusion Strategy": "Regular
Expression",
+ "Include Environment Variables": "INPUT_.*"
+ }
+ }
+ ],
+ "rootGroup": {
+ "name": "MiNiFi Flow",
+ "processors": [
+ {
+ "identifier": "00000000-0000-0000-0000-000000000001",
+ "name": "MyProcessor",
+ "type": "org.apache.nifi.processors.GetFile",
+ "schedulingStrategy": "TIMER_DRIVEN",
+ "schedulingPeriod": "3 sec",
+ "properties": {
+ "Input Directory": "#{INPUT_DIR}"
+ }
+ }
+ ],
+ "parameterContextName": "environment-variable-parameter-context"
+ }
+}
+```
+
+The same example in YAML configuration file:
+
+```yaml
+MiNiFi Config Version: 3
+Flow Controller:
+name: MiNiFi Flow
+Parameter Providers:
+ - id: d26ee5f5-0192-1000-0482-4e333725e089
+ name: EnvironmentVariableParameterProvider
+ type: EnvironmentVariableParameterProvider
+ Properties:
+ Parameter Group Name: environment-variable-parameter-context
+ Environment Variable Inclusion Strategy: Regular Expression
+ Include Environment Variables: INPUT_.*
+Processors:
+ - name: MyProcessor
+ id: 00000000-0000-0000-0000-000000000001
+ class: org.apache.nifi.processors.GetFile
+ scheduling strategy: TIMER_DRIVEN
+ scheduling period: 3 sec
+ Properties:
+ Input Directory: "#{INPUT_DIR}"
+Parameter Context Name: environment-variable-parameter-context
```
+In the above example, the `EnvironmentVariableParameterProvider` is used to
generate a parameter context with the name
`environment-variable-parameter-context` that includes all environment
variables starting with `INPUT_`. The generated parameter context is assigned
to the root process group and the `INPUT_DIR` environment variable is used in
the `Input Directory` property of the `MyProcessor` processor which is a
generated parameter in the `environment-variable-parameter-context` parameter
context.
+
+After the parameter contexts are generated successfully, the parameter
contexts are persisted in the flow configuration file, which looks like this
for the above example:
Review Comment:
Added Jira ticket for the option to reload parameter context values from
parameter providers: https://issues.apache.org/jira/browse/MINIFICPP-2509
--
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]