nipyapi
nipyapi copied to clipboard
Gitlab and Github registry client missing!
Hi!
In Apache NiFi version 2.2.0, I found these new registry clients in addition to NifiRegistryFlowRegistryClient:
https://nipyapi.readthedocs.io/en/latest/nipyapi-docs/nipyapi.html#nipyapi.versioning.create_registry_client
The create_registry_client function only returns a FlowRegistryClientEntity object, but GitHubFlowRegistryClient and GitLabFlowRegistryClient expect a different object type.
The GitLabFlowRegistryClient registry client was created by NIFI WEB UI and the second one was created by NIPYAPI, acording de following images:
By Nifi Web UI
By Nipyapi
How can I work around this issue?
Thanks!
Hi @marcelo225 - NiPy is currently built on the NiFi-1.27 API spec, and while that has some forward compatibility with the 2.x API spec, I haven't yet had the time to do the necessary refactoring to fully move to 2.x as there are a significant breaking changes in the OAS version used.
I do hope to get to it over the next month or so.
@Chaffelson, thanks for your reply!
For anyone else landing here, here's a code snippet I just used successfully with NiFi 2.2.0. It's a workaround until create_registry_client is extended:
organization = "myorg"
repository = "myrepo"
branch = "mybranch"
version = "commit_or_branch_or_tag"
directory = "my/directory"
flow_name = "myflow"
# Register client
github_client = nipyapi.nifi.ControllerApi().create_flow_registry_client(
body={
"revision": {"version": 0},
"component": {
"name": "GitHubFlowRegistryClient",
"type": "org.apache.nifi.github.GitHubFlowRegistryClient",
"properties": {
"Repository Owner": organization,
"Repository Name": repository,
},
"bundle": {
"group": "org.apache.nifi",
"artifact": "nifi-github-nar",
"version": "2.2.0",
},
},
}
)
# Restore a process group
pg_id = get_root_pg_id()
nipyapi.nifi.ProcessGroupsApi().create_process_group(
id = pg_id,
body = {
"revision": { "version": 0 },
"component": {
"position": { "x": 0, "y": 0 },
"versionControlInformation": {
"registryId": github_client.component.id,
"flowId": flow_name,
"bucketId": directory,
"branch": branch,
"version": version,
},
},
},
)
Apologies I should've updated this with the NiPyAPI 1.0 release - this should be resolved now if you move to ver1, as it supports NiFi v2.x, including the new git* clients.