Nipyapi
Nipyapi
Release 0.19.1
Daniel Chaffelson
1 NiPyApi 3
1.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Background and Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 NiFi Version Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Python Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Installation 7
2.1 Stable release . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 From sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
i
3.3.2.4 nipyapi.registry.configuration module . . . . . . . . . . . . . . . . . . . . . . . . . 621
3.3.2.5 nipyapi.registry.rest module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
4 ToDo 623
5 Contributing 625
5.1 Types of Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
5.1.1 Report Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
5.1.2 Fix Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
5.1.3 Implement Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
5.1.4 Write Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
5.1.5 Submit Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
5.2 Get Started! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
5.3 Pull Request Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627
7 Credits 633
7.1 Development Lead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
7.2 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
7.3 Shout Outs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
8 History 635
8.1 0.19.1 (2022-08-08) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
8.2 0.19.0 (2022-05-13) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
8.3 0.18.0 (2021-11-29) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
8.4 0.17.1 (2021-10-21) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
8.5 0.17.0 (2021-10-13) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
8.6 0.16.3 (2021-10-11) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
8.7 0.16.2 (2021-02-10) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
8.8 0.16.3 (2021-10-11) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
8.9 0.16.2 (2021-02-10) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
8.10 0.15.0 (2020-11-06) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
8.11 0.14.0 (2019-11-06) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
8.12 0.13.3 (2019-10-09) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
8.13 0.13.0 (2019-04-22) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
8.14 0.12.0 (2018-12-20) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
8.15 0.11.0 (2018-10-12) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
8.16 0.10.3 (2018-08-28) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
8.17 0.10.2 (2018-08-27) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
8.18 0.10.1 (2018-08-21) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
8.19 0.10.0 (2018-08-03) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
8.20 0.9.1 (2018-05-18) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
8.21 0.9.0 (2018-05-16) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
8.22 0.8.0 (2018-03-06) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642
8.23 0.7.0 (2018-01-30) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643
ii
8.24 0.6.1 (2018-01-04) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
8.25 0.6.0 (2017-12-31) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
8.26 0.5.1 (2017-12-07) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
8.27 0.5.0 (2017-12-06) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
8.28 0.4.0 (2017-10-29) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
8.29 0.3.2 (2017-09-04) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
8.30 0.3.1 (2017-09-04) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
8.31 0.3.0 (2017-09-04) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
8.32 0.2.1 (2017-08-26) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
8.33 0.2.0 (2017-08-25) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
8.34 0.1.2 (2017-08-24) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
8.35 0.1.1 (2017-08-24) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
8.36 0.1.0 (2017-08-24) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
Index 655
iii
iv
Nipyapi Documentation, Release 0.19.1
Contents:
Contents 1
Nipyapi Documentation, Release 0.19.1
2 Contents
CHAPTER 1
NiPyApi
1.1 Features
3
Nipyapi Documentation, Release 0.19.1
Please see the issue register for more information on current development.
You can set the config for your endpoints in the central config file:
# in python
import nipyapi
nipyapi.config.nifi_config.host = 'http://localhost:8080/nifi-api'
nipyapi.config.registry_config.host = 'http://localhost:18080/nifi-registry-api'
You can use the Docker demos to create a secured interactive console showing many features:
from nipyapi.demo.secured_console import *
from nipyapi.demo.console import *
You can also explore the scripts to get ideas for how NiPyAPi can be used to automate your environment.
Please check out the Contribution Guide if you are interested in contributing to the feature set.
Currently we are testing against NiFi versions 1.1.2 - 1.15.0, and NiFi-Registry versions 0.1.0 - 1.15.0.
If you find a version compatibility problem please raise an issue
Python 2.7 or 3.6-9 supported, though other versions may work. We will shortly stop supporting Python2 There are
known issues on Python 3.10
4 Chapter 1. NiPyApi
Nipyapi Documentation, Release 0.19.1
Tested on AL2 and OSX 10.14.x - Windows automated testing not attempted
Outside of the standard Python modules, we make use of lxml, DeepDiff, ruamel.yaml and xmltodict in processing,
and Docker for demo/tests.
6 Chapter 1. NiPyApi
CHAPTER 2
Installation
This is the preferred method to install Nipyapi, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
The sources for Nipyapi can be downloaded from the Github repo.
You can either clone the public repository:
Once you have a copy of the source, you can install it with:
7
Nipyapi Documentation, Release 0.19.1
8 Chapter 2. Installation
CHAPTER 3
3.1 Demos
These modules leverage functionality within the rest of the Package to demonstrate various capabilities
3.1.1 FDLC
Importing this module provides further instructions for it’s use. It will guide you through the steps involved in flow
promotion.
Note that it makes extensive use of Docker Containers.
Usage:
3.1.2 Console
Importing this module will run a script which populates the NiFi canvas with a Process Group containing a processor,
and creates a sequence of Versioned Flow Objects from it, along with a Template and various export versions.
This is intended to give the user a base set of objects to explore the API.
Usage:
Importing this module will pull recent Docker containers from Dockerhub, deploy them in a secured configuration,
and prepare the environment for access via TLS in NiFi-Registry’s case, and public LDAP username/password for
9
Nipyapi Documentation, Release 0.19.1
NiFi.
This is intended to give the user an example of a secured environment. May be combined with the Console to produce
a secured environment with demo objects.
Note that this demo makes extensive use of Docker Containers.
Usage:
An incomplete version of BBende’s excellent demo. It currently deploys some Docker NiFi and Registry instances.
These wrapper modules contain collections of convenience functions for daily operations of your NiFi and NiFi-
Registry environment. They wrap and surface underlying data structures and calls to the full SDK swagger clients
which are also included in the package.
3.2.1 Canvas
nipyapi.canvas.get_flow(pg_id=’root’)
Returns information about a Process Group and flow.
This surfaces the native implementation, for the recursed implementation see ‘recurse_flow’
Parameters pg_id (str) – id of the Process Group to retrieve, defaults to the root process group
if not set
Returns The Process Group object
Return type (ProcessGroupFlowEntity)
nipyapi.canvas.get_process_group_status(pg_id=’root’, detail=’names’)
Returns an entity containing the status of the Process Group. Optionally may be configured to return a simple
dict of name:id pairings
Note that there is also a ‘process group status’ command available, but it returns a subset of this data anyway,
and this call is more useful
Parameters
• pg_id (str) – The UUID of the Process Group
• detail (str) – ‘names’ or ‘all’; whether to return a simple dict of name:id pairings, or
the full details. Defaults to ‘names’
Returns The Process Group Entity including the status
Return type (ProcessGroupEntity)
nipyapi.canvas.get_process_group(identifier, identifier_type=’name’, greedy=True)
Filters the list of all process groups against a given identifier string occurring in a given identifier_type field.
Parameters
• identifier (str) – the string to filter the list for
• identifier_type (str) – the field to filter on, set in config.py
• greedy (bool) – True for partial match, False for exact match
Returns None for no matches, Single Object for unique match, list(Objects) for multiple matches
nipyapi.canvas.list_all_process_groups(pg_id=’root’)
Returns a flattened list of all Process Groups on the canvas. Potentially slow if you have a large canvas.
Note that the ProcessGroupsApi().get_process_groups(pg_id) command only provides the first layer of pgs,
whereas this trawls the entire canvas
Parameters pg_id (str) – The UUID of the Process Group to start from, defaults to the Canvas
root
Returns list[ProcessGroupEntity]
nipyapi.canvas.delete_process_group(process_group, force=False, refresh=True)
Deletes a given Process Group, with optional prejudice.
Parameters
• process_group (ProcessGroupEntity) – The target Process Group
• force (bool) – Stop, purge and clean the target Process Group before deletion. Experi-
mental.
• refresh (bool) – Whether to refresh the state first
Returns The updated object state
Return type (ProcessGroupEntity
nipyapi.canvas.schedule_process_group(process_group_id, scheduled)
Start or Stop a Process Group and all components.
Note that this doesn’t guarantee that all components have started, as some may be in Invalid states.
Parameters
• process_group_id (str) – The UUID of the target Process Group
• scheduled (bool) – True to start, False to stop
Parameters
• source – Object to initiate the connection, e.g. ProcessorEntity
• target – Object to terminate the connection, e.g. FunnelEntity
• relationships (list) – list of strings of relationships to connect, may be collected
from the object ‘relationships’ property (optional)
• name (str) – Defaults to None, String of Name for Connection (optional)
Returns for the created connection
Return type (ConnectionEntity)
nipyapi.canvas.delete_connection(connection, purge=False)
Deletes a connection, optionally purges it first
Parameters
• connection (ConnectionEntity) – Connection to delete
• purge (bool) – True to Purge, Defaults to False
Returns the modified Connection
Return type (ConnectionEntity)
nipyapi.canvas.get_component_connections(component)
Returns list of Connections related to a given Component, e.g. Processor
Parameters component – Component Object to filter by, e.g. a ProcessorEntity
Returns List of ConnectionEntity Objects
Return type (list)
nipyapi.canvas.create_controller(parent_pg, controller, name=None)
Creates a new Controller Service in a given Process Group of the given Controller type, with the given
Name
Parameters
• parent_pg (ProcessGroupEntity) – Target Parent PG
• controller (DocumentedTypeDTO) – Type of Controller to create, found via the
list_all_controller_types method
• name (str[Optional]) – Name for the new Controller as a String
Returns (ControllerServiceEntity)
nipyapi.canvas.list_all_controllers(pg_id=’root’, descendants=True)
Lists all controllers under a given Process Group, defaults to Root Optionally recurses all child Process
Groups as well
Parameters
• pg_id (str) – String of the ID of the Process Group to list from
• descendants (bool) – True to recurse child PGs, False to not
Returns None, ControllerServiceEntity, or list(ControllerServiceEntity)
nipyapi.canvas.delete_controller(controller, force=False)
Delete a Controller service, with optional prejudice
Parameters
• controller (ControllerServiceEntity) – Target Controller to delete
• force (bool) – True to attempt Disable the Controller before deletion
Returns (ControllerServiceEntity)
nipyapi.canvas.update_controller(controller, update)
Updates the Configuration of a Controller Service
Parameters
• controller (ControllerServiceEntity) – Target Controller to update
• update (ControllerServiceDTO) – Controller Service configuration object contain-
ing the new config params and properties
Returns (ControllerServiceEntity)
nipyapi.canvas.schedule_controller(controller, scheduled, refresh=False)
Start/Enable or Stop/Disable a Controller Service
Parameters
• controller (ControllerServiceEntity) – Target Controller to schedule
• scheduled (bool) – True to start, False to stop
• refresh (bool) – Whether to refresh the component revision before execution
Returns (ControllerServiceEntity)
nipyapi.canvas.get_controller(identifier, identifier_type=’name’, bool_response=False)
Retrieve a given Controller
Parameters
• identifier (str) – ID or Name of a Controller to find
• identifier_type (str) – ‘id’ or ‘name’, defaults to name
• bool_response (bool) – If True, will return False if the Controller is not found - useful
when testing for deletion completion
Returns:
nipyapi.canvas.list_all_controller_types()
Lists all Controller Service types available on the environment
Returns list(DocumentedTypeDTO)
nipyapi.canvas.list_all_by_kind(kind, pg_id=’root’, descendants=True)
Retrieves a list of all instances of a supported object type
Parameters
• kind (str) – one of input_ports, output_ports, funnels, controllers, connections, re-
mote_process_groups
• pg_id (str) – optional, ID of the Process Group to use as search base
• descendants (bool) – optional, whether to collect child group info
Returns list of the Entity type of the kind, or single instance, or None
nipyapi.canvas.list_all_input_ports(pg_id=’root’, descendants=True)
Convenience wrapper for list_all_by_kind for input ports
nipyapi.canvas.list_all_output_ports(pg_id=’root’, descendants=True)
Convenience wrapper for list_all_by_kind for output ports
nipyapi.canvas.list_all_funnels(pg_id=’root’, descendants=True)
Convenience wrapper for list_all_by_kind for funnels
nipyapi.canvas.list_all_remote_process_groups(pg_id=’root’, descendants=True)
Convenience wrapper for list_all_by_kind for remote process groups
nipyapi.canvas.delete_funnel(funnel, refresh=True)
Deletes a Funnel Object
Parameters
• funnel (FunnelEntity) – The Funnel to delete
• refresh (bool) – Whether to refresh the object state before execution
Returns (FunnelEntity) Deleted FunnelEntity reference
nipyapi.canvas.get_remote_process_group(rpg_id, summary=False)
Fetch a remote process group object, with optional summary of just ports
nipyapi.canvas.update_process_group(pg, update, refresh=True)
Updates a given Process Group.
Parameters
• pg (ProcessGroupEntity) – The Process Group to target for update
• update (dict) – key:value pairs to update
• refresh (bool) – Whether to refresh the Process Group before applying the update
Returns The updated ProcessorEntity
Return type (ProcessGroupEntity)
nipyapi.canvas.create_funnel(pg_id, position=None)
Creates a Funnel Object
Parameters
• pg_id (str) – ID of the parent Process Group
• position (tuple[int, int]) – Position on canvas
Returns (FunnelEntity) Created Funnel
nipyapi.canvas.create_remote_process_group(target_uris, transport=’RAW’, pg_id=’root’,
position=None)
Creates a new Remote Process Group with given parameters
Parameters
• target_uris (str) – Comma separated list of target URIs
• transport (str) – optional, RAW or HTTP
• pg_id (str) – optional, UUID of parent Process Group for remote process group
• position (tuple) – optional, tuple of location ints
Returns (RemoteProcessGroupEntity)
nipyapi.canvas.delete_remote_process_group(rpg, refresh=True)
Deletes a given remote process group
Parameters
• rpg (RemoteProcessGroupEntity) – Remote Process Group to remove
• refresh (bool) – Whether to refresh the object before action
Returns (RemoteProcessGroupEntity)
nipyapi.canvas.set_remote_process_group_transmission(rpg, enable=True, re-
fresh=True)
Enable or Disable Transmission for an RPG
Parameters
• rpg (RemoteProcessGroupEntity) – The ID of the remote process group to modify
• enable (bool) – True to enable, False to disable
• refresh (bool) – Whether to refresh the object before action
Returns:
nipyapi.canvas.get_pg_parents_ids(pg_id)
Retrieve the ids of the parent Process Groups.
Parameters pg_id (str) – Process group id
Returns (list) List of ids of the input PG parents
nipyapi.canvas.delete_port(port)
Deletes a given port from the canvas if possible
nipyapi.canvas.create_port(pg_id, port_type, name, state, position=None)
Creates a new input or output port of given characteristics
Parameters
• pg_id (str) – ID of the parent Process Group
• port_type (str) – Either of INPUT_PORT or OUTPUT_PORT
• name (str) – optional, Name to assign to the port
• state (str) – One of RUNNING, STOPPED, DISABLED
• position (tuple) – optional, tuple of ints like (400, 400)
Returns (PortEntity) of the created port
3.2.2 Config
A set of defaults and parameters used elsewhere in the project. Also provides a handy link to the low-level client SDK
configuration singleton objects.
3.2.3 Parameters
Returns list(ParameterContextEntity)
nipyapi.parameters.create_parameter_context(name, description=None, parameters=None,
inherited_contexts=None)
Create a new Parameter Context with optional description and initial Parameters
Parameters
• name (str) – The Name for the new Context
• description (str) – An optional description
• parameters (list[ParameterEntity]) – A list of prepared Parameters
• inherited_contexts (list[ParameterContextEntity]) – A list of inherited
Parameter Contexts
Returns (ParameterContextEntity) The New Parameter Context
nipyapi.parameters.delete_parameter_context(context, refresh=True)
Removes a Parameter Context
Parameters
• context (ParameterContextEntity) – Parameter Context to be deleted
• refresh (bool) – Whether to refresh the Context before Deletion
Returns (ParameterContextEntity) The removed Parameter Context
nipyapi.parameters.get_parameter_context(identifier, identifier_type=’name’, greedy=True)
Gets one or more Parameter Contexts matching a given identifier
Parameters
• identifier (str) – The Name or ID matching Parameter Context(s)
• identifier_type (str) – ‘name’ or ‘id’
• greedy (bool) – False for exact match, True for string match
Returns None for no matches, Single Object for unique match, list(Objects) for multiple matches
nipyapi.parameters.update_parameter_context(context)
Update an already existing Parameter Context
Parameters
• context (ParameterContextEntity) – Parameter Context updated to be applied
• refresh (bool) – Whether to refresh the object before Updating
Returns (ParameterContextEntity) The updated Parameter Context
nipyapi.parameters.prepare_parameter(name, value, description=None, sensitive=False)
Parses basic inputs into a Parameter object ready for submission
Parameters
• name (str) – The Name for the Parameter
• value (str, int, float) – The Value for the Parameter
• description (str) – Optional Description for the Parameter
• sensitive (bool) – Whether to mark the Parameter Value as sensitive
Returns (ParameterEntity) The ParameterEntity ready for use
nipyapi.parameters.delete_parameter_from_context(context, parameter_name)
Delete a specific Parameter from a Parameter Context :param context: The Parameter Context to Update :type
context: ParameterContextEntity :param parameter_name: The Parameter to delete :type parameter_name: str
Returns (ParameterContextEntity) The updated Parameter Context
nipyapi.parameters.upsert_parameter_to_context(context, parameter)
Insert or Update Parameter within a Parameter Context
Parameters
• context (ParameterContextEntity) – The Parameter Context to Modify
• parameter (ParameterEntity) – The ParameterEntity to insert or update
Returns (ParameterContextEntity) The updated Parameter Context
nipyapi.parameters.assign_context_to_process_group(pg, context_id, cascade=False)
Assigns a given Parameter Context to a specific Process Group Optionally cascades down to direct children
Process Groups
Parameters
• pg (ProcessGroupEntity) – The Process Group to target
• context_id (str) – The ID of the Parameter Context
• cascade (bool) – Cascade Parameter Context down to child Process Groups?
Returns (ProcessGroupEntity) The updated Process Group
nipyapi.parameters.remove_context_from_process_group(pg)
Clears any Parameter Context from the given Process Group
Parameters pg (ProcessGroupEntity) – The Process Group to target
Returns (ProcessGroupEntity) The updated Process Group
3.2.4 Security
If you are using one-way TLS with a certificate signed by a root CA trusted by your system/platform, this step
is not necessary as the default TLS-handshake should “just work.”
Parameters
• service (str) – ‘nifi’ or ‘registry’ to indicate which service config to set the ssl context
to
• ca_file (str) – A PEM file containing certs for the root CA(s) for the NiFi Registry
server
• client_cert_file (str) – A PEM file containing the public certificates for the
user/client identity
• client_key_file (str) – An encrypted (password-protected) PEM file containing the
client’s secret key
• client_key_password (str) – The password to decrypt the client_key_file
• check_hostname (bool) – Enable or Disable hostname checking
Returns (None)
nipyapi.security.add_user_group_to_access_policy(user_group, policy, service=’nifi’, re-
fresh=True)
Attempts to add the given user group object to the given access policy
Parameters
• user_group (UserGroup) or (UserGroupEntity) – User group object to add
• policy (AccessPolicyEntity) or (AccessPolicy) – Access Policy object
• service (str) – ‘nifi’ or ‘registry’ to identify the target service
• refresh (bool) – Whether to refresh the policy object before submission
Returns Updated Policy object
nipyapi.security.bootstrap_security_policies(service, user_identity=None,
group_identity=None)
Creates a default security context within NiFi or Nifi-Registry
Parameters
• service (str) – ‘nifi’ or ‘registry’ to indicate which service
• user_identity – a service user to establish in the security context
• group_identity – a service group to establish in the security context
Returns None
nipyapi.security.service_login(service=’nifi’, username=None, password=None,
bool_response=False)
Login to the currently configured NiFi or NiFi-Registry server.
Login requires a secure connection over https. Prior to calling this method, the host must be specified and the
SSLContext should be configured (if necessary).
Successful login will result in a generated token (JWT) being cached in the api_client config that will be passed
in all future REST API calls. To clear that token, call service_logout.
The token is temporary and will expire after a duration set by the server. After a token expires, you must call
this method again to generate a new token.
Parameters
3.2.5 System
For system and cluster level functions interacting with the underlying NiFi Services
nipyapi.system.get_system_diagnostics()
Returns NiFi Sytems diagnostics page
Returns (json):
nipyapi.system.get_cluster()
EXPERIMENTAL Returns the contents of the NiFi cluster
Returns (json):
nipyapi.system.get_node(nid)
Returns the cluster node information
Parameters nid (str) – The UUID of the Node to target
Returns:
nipyapi.system.get_nifi_version_info()
Returns the version information of the connected NiFi instance
Returns (VersionInfoDTO):
3.2.6 Templates
3.2.7 Utils
Convenience utility functions for NiPyApi, not really intended for external use
nipyapi.utils.dump(obj, mode=’json’)
Dumps a native datatype object or swagger entity to json or yaml defaults to json
Parameters
• obj (varies) – The native datatype object or swagger type to serialise
• mode (str) – ‘json’ or ‘yaml’, the supported export modes
Returns: Either the loaded object in native Python datatypes, or the constructed native datatype object
nipyapi.utils.fs_read(file_path)
Convenience function to read an Object from a FilePath
Parameters file_path (str) – The Full path including filename to read from
Returns: The object that was read
nipyapi.utils.fs_write(obj, file_path)
Convenience function to write an Object to a FilePath
Parameters
• obj (varies) – The Object to write out
nipyapi.utils.bypass_slash_encoding(service, bypass)
Instructs the API Client to bypass encoding the ‘/’ character
Parameters
• service (str) – ‘nifi’ or ‘registry’
• bypass (bool) – True will not encode ‘/’ in fields via API calls
Returns None
nipyapi.utils.exception_handler(status_code=None, response=None)
Simple Function wrapper to handle HTTP Status Exceptions
nipyapi.utils.enforce_min_ver(min_version, bool_response=False, service=’nifi’)
Raises an error if target NiFi environment is not minimum version :param min_version: Version to check against
:type min_version: str :param bool_response: If True, will return True instead of
raising error
Since NiFi is java, it may return a version with -SNAPSHOT as part of it. As such, that will be stripped from
either the comparator version or the version returned from NiFi
Parameters
• base (str) – The base version for the comparison test
• comparator (optional[str]) – The version to compare against
• default_version (optional[str]) – The version to assume the service is if the
check cannot be completed
• service (str) – The service to test the version against, currently only supports NiFi
Returns (int): -1/0/1 if base is lower/equal/newer than comparator
nipyapi.utils.validate_parameters_versioning_support(verify_nifi=True, ver-
ify_registry=True)
Convenience method to check if Parameters are supported :param verify_nifi: If True, check NiFi meets the
min version :type verify_nifi: bool :param verify_registry: If True, check Registry meets the min version :type
verify_registry: bool
3.2.8 Versioning
For interactions with the NiFi Registry Service and related functions
nipyapi.versioning.create_registry_client(name, uri, description)
Creates a Registry Client in the NiFi Controller Services
Parameters
• name (str) – The name of the new Client
• uri (str) – The URI for the connection, such as ‘http://registry:18080’
• description (str) – A description for the Client
Returns The new registry client object
Return type (RegistryClientEntity)
nipyapi.versioning.list_registry_clients()
Lists the available Registry Clients in the NiFi Controller Services
Returns (list[RegistryClientEntity]) objects
nipyapi.versioning.delete_registry_client(client, refresh=True)
Deletes a Registry Client from the list of NiFI Controller Services
Parameters
• client (RegistryClientEntity) – The client to delete
• refresh (bool) – Whether to refresh the object before action
Returns The updated client object
Return type (RegistryClientEntity)
nipyapi.versioning.get_registry_client(identifier, identifier_type=’name’)
Filters the Registry clients to a particular identifier
Parameters
• identifier (str) – the filter string