From 593059ffb808bc520c6b1ef9f8b9db8e4b3e91d6 Mon Sep 17 00:00:00 2001 From: Dan Chaffelson Date: Thu, 2 Aug 2018 11:12:15 +0100 Subject: [PATCH] Add NiFi-Registry-0.2.0 support (#67) * Reworked pytest parametrization to support multiple nifi-registry versions Improved processor scheduling call to check if start was successful, changed test to component.state from status.run_status as it's more reliable Minor logging cleanups and changes Deprecated testing against NiFi-1.5.0, added testing against NiFi-Registry-0.2.0 Added pytest fixture cleanups for NiFi-Registry testing Renamed 'regress' to 'regress_nifi' for clarity when working with tests Finally realised that fixture ordering matters and cleaned up a few things Added default log control for tox run as a convenience --- nipyapi/canvas.py | 27 +- nipyapi/config.py | 2 +- nipyapi/demo/fdlc.py | 22 +- nipyapi/registry/__init__.py | 7 +- nipyapi/registry/api_client.py | 7 +- nipyapi/registry/apis/access_api.py | 24 +- nipyapi/registry/apis/bucket_flows_api.py | 153 ++++- nipyapi/registry/apis/buckets_api.py | 34 +- nipyapi/registry/apis/flows_api.py | 547 +++++++++++++++++- nipyapi/registry/apis/items_api.py | 16 +- nipyapi/registry/apis/policies_api.py | 44 +- nipyapi/registry/apis/tenants_api.py | 22 +- nipyapi/registry/configuration.py | 11 +- nipyapi/registry/models/__init__.py | 7 +- nipyapi/registry/models/access_policy.py | 2 +- .../registry/models/access_policy_summary.py | 2 +- nipyapi/registry/models/batch_size.py | 2 +- nipyapi/registry/models/bucket.py | 2 +- nipyapi/registry/models/bucket_item.py | 2 +- nipyapi/registry/models/bundle.py | 2 +- .../registry/models/component_difference.py | 237 ++++++++ .../models/component_difference_group.py | 237 ++++++++ .../registry/models/connectable_component.py | 2 +- .../registry/models/controller_service_api.py | 2 +- nipyapi/registry/models/current_user.py | 2 +- nipyapi/registry/models/fields.py | 2 +- nipyapi/registry/models/link.py | 140 ++--- nipyapi/registry/models/permissions.py | 2 +- ..._component_on_the_graph.py => position.py} | 24 +- nipyapi/registry/models/resource.py | 2 +- .../registry/models/resource_permissions.py | 2 +- nipyapi/registry/models/tenant.py | 2 +- nipyapi/registry/models/uri_builder.py | 2 +- nipyapi/registry/models/user.py | 2 +- nipyapi/registry/models/user_group.py | 2 +- .../registry/models/versioned_connection.py | 14 +- .../models/versioned_controller_service.py | 8 +- nipyapi/registry/models/versioned_flow.py | 2 +- .../models/versioned_flow_coordinates.py | 2 +- .../models/versioned_flow_difference.py | 235 ++++++++ .../models/versioned_flow_snapshot.py | 2 +- .../versioned_flow_snapshot_metadata.py | 2 +- nipyapi/registry/models/versioned_funnel.py | 8 +- nipyapi/registry/models/versioned_label.py | 8 +- nipyapi/registry/models/versioned_port.py | 8 +- .../models/versioned_process_group.py | 8 +- .../registry/models/versioned_processor.py | 8 +- .../models/versioned_property_descriptor.py | 36 +- .../models/versioned_remote_group_port.py | 8 +- .../models/versioned_remote_process_group.py | 8 +- nipyapi/registry/rest.py | 2 +- nipyapi/utils.py | 17 +- nipyapi/versioning.py | 36 +- .../docker-compose.yml | 20 +- tests/conftest.py | 245 +++++--- tests/test_canvas.py | 35 +- tests/test_system.py | 2 +- tests/test_templates.py | 16 +- tests/test_utils.py | 4 +- tests/test_versioning.py | 115 ++-- tox.ini | 2 +- 61 files changed, 2006 insertions(+), 440 deletions(-) create mode 100644 nipyapi/registry/models/component_difference.py create mode 100644 nipyapi/registry/models/component_difference_group.py rename nipyapi/registry/models/{the_position_of_a_component_on_the_graph.py => position.py} (80%) create mode 100644 nipyapi/registry/models/versioned_flow_difference.py diff --git a/nipyapi/canvas.py b/nipyapi/canvas.py index c8bdc4a9..ac004d8d 100644 --- a/nipyapi/canvas.py +++ b/nipyapi/canvas.py @@ -5,6 +5,7 @@ """ from __future__ import absolute_import +import logging import six import nipyapi @@ -19,6 +20,8 @@ 'get_bulletins', 'get_bulletin_board' ] +log = logging.getLogger(__name__) + def get_root_pg_id(): """ @@ -516,6 +519,7 @@ def schedule_processor(processor, scheduled, refresh=True): Note that this doesn't guarantee that it will change state, merely that it will be instructed to try. + Some effort is made to wait and see if the processor starts Args: processor (ProcessorEntity): The Processor to target @@ -531,10 +535,21 @@ def schedule_processor(processor, scheduled, refresh=True): assert isinstance(refresh, bool) def _running_schedule_processor(processor_): - test_obj = nipyapi.nifi.ProcessorsApi().get_processor(processor_.id) + test_obj = nipyapi.canvas.get_processor(processor_.id, 'id') if test_obj.status.aggregate_snapshot.active_thread_count == 0: return True + log.info("Processor not stopped, active thread count %s", + test_obj.status.aggregate_snapshot.active_thread_count) return False + + def _starting_schedule_processor(processor_): + test_obj = nipyapi.canvas.get_processor(processor_.id, 'id') + if test_obj.component.state == 'RUNNING': + return True + log.info("Processor not started, run_status %s", + test_obj.component.state) + return False + assert isinstance(scheduled, bool) if refresh: target = nipyapi.canvas.get_processor(processor.id, 'id') @@ -559,8 +574,14 @@ def _running_schedule_processor(processor_): return result # Return False if we scheduled a stop, but it didn't stop return False - # Return the True or False result if we were trying to start the processor - return result + else: + # Test that the Processor started + start_test = nipyapi.utils.wait_to_complete( + _starting_schedule_processor, target + ) + if start_test: + return result + return False def update_processor(processor, update): diff --git a/nipyapi/config.py b/nipyapi/config.py index 6c8a5322..c975eab0 100644 --- a/nipyapi/config.py +++ b/nipyapi/config.py @@ -21,7 +21,7 @@ # Note that changing the default hosts below will not # affect an API connection that's already running. # You'll need to change the .api_client.host for that, and there is a -# convenience function for this in nipyapi.utils +# convenience function for this in nipyapi.utils.set_endpoint # Set Default Host for NiFi nifi_config.host = 'http://localhost:8080/nifi-api' diff --git a/nipyapi/demo/fdlc.py b/nipyapi/demo/fdlc.py index deddbc41..2c70abd8 100644 --- a/nipyapi/demo/fdlc.py +++ b/nipyapi/demo/fdlc.py @@ -2,6 +2,7 @@ import logging import nipyapi from nipyapi.utils import DockerContainer +from time import sleep log = logging.getLogger(__name__) log.setLevel(logging.INFO) @@ -56,8 +57,8 @@ ) ] -dev_pg_name = 'dev_pg_0' -dev_proc_name = 'dev_proc_0' +dev_pg_name = 'my_pg_0' +dev_proc_name = 'my_proc_0' dev_reg_client_name = 'dev_reg_client_0' dev_bucket_name = 'dev_bucket_0' dev_ver_flow_name = 'dev_ver_flow_0' @@ -74,13 +75,13 @@ "in hex (0,1,2,3,4,5,6,7,8,9,a,b,c,d) and should be called in order." "\nEach step will log activities to INFO, and you are encouraged to " "look at the code in this script to see how each step is completed." - "\nEach step will also issue instructions through print statements like" + "\nhttp://github.com/Chaffelson/nipyapi/blob/master/nipyapi/demo/fdlc.py" + "\nEach step will also issue instructions through print statements like " "this one, these instructions will vary so please read them as you go." - "\nNote that the first call will log a lot of information while it boots " - "the Docker containers, further instructions will follow." + "\nNote that the first call will log a lot of information while it boots" + " the Docker containers, further instructions will follow." "\nNote that you can reset it at any time by calling step_1 again.\n" - "\nPlease start by calling the function 'step_1_boot_demo_env()'." - ) + "\nPlease start by calling the function 'step_1_boot_demo_env()'.") def step_1_boot_demo_env(): @@ -109,6 +110,8 @@ def step_1_boot_demo_env(): nipyapi_delay=nipyapi.config.long_retry_delay, nipyapi_max_wait=nipyapi.config.long_max_wait ) + # Sleeping to wait for all startups to return before printing guide + sleep(1) print("Your Docker containers should now be ready, please find them at the" "following URLs:" "\nnifi-dev ", dev_nifi_url, @@ -116,8 +119,7 @@ def step_1_boot_demo_env(): "\nreg-prod ", prod_reg_url, "\nnifi-prod ", prod_nifi_url, "\nPlease open each of these in a browser tab." - "\nPlease then call the function 'step_2_create_reg_clients()'\n" - ) + "\nPlease then call the function 'step_2_create_reg_clients()'\n") def step_2_create_reg_clients(): @@ -272,7 +274,7 @@ def step_9_deploy_prod_flow_to_nifi(): reg_client = nipyapi.versioning.get_registry_client(prod_reg_client_name) nipyapi.versioning.deploy_flow_version( parent_id=nipyapi.canvas.get_root_pg_id(), - location=(0,0), + location=(0, 0), bucket_id=bucket.identifier, flow_id=flow.identifier, reg_client_id=reg_client.id, diff --git a/nipyapi/registry/__init__.py b/nipyapi/registry/__init__.py index 12244c3e..fa7308d9 100644 --- a/nipyapi/registry/__init__.py +++ b/nipyapi/registry/__init__.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -20,16 +20,18 @@ from .models.bucket import Bucket from .models.bucket_item import BucketItem from .models.bundle import Bundle +from .models.component_difference import ComponentDifference +from .models.component_difference_group import ComponentDifferenceGroup from .models.connectable_component import ConnectableComponent from .models.controller_service_api import ControllerServiceAPI from .models.current_user import CurrentUser from .models.fields import Fields from .models.link import Link from .models.permissions import Permissions +from .models.position import Position from .models.resource import Resource from .models.resource_permissions import ResourcePermissions from .models.tenant import Tenant -from .models.the_position_of_a_component_on_the_graph import ThePositionOfAComponentOnTheGraph from .models.uri_builder import UriBuilder from .models.user import User from .models.user_group import UserGroup @@ -37,6 +39,7 @@ from .models.versioned_controller_service import VersionedControllerService from .models.versioned_flow import VersionedFlow from .models.versioned_flow_coordinates import VersionedFlowCoordinates +from .models.versioned_flow_difference import VersionedFlowDifference from .models.versioned_flow_snapshot import VersionedFlowSnapshot from .models.versioned_flow_snapshot_metadata import VersionedFlowSnapshotMetadata from .models.versioned_funnel import VersionedFunnel diff --git a/nipyapi/registry/api_client.py b/nipyapi/registry/api_client.py index 7afed4a7..9f263e9b 100644 --- a/nipyapi/registry/api_client.py +++ b/nipyapi/registry/api_client.py @@ -4,7 +4,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -178,7 +178,8 @@ def sanitize_for_serialization(self, obj): If obj is None, return None. If obj is str, int, long, float, bool, return directly. - If obj is datetime.datetime, datetime.date convert to string in iso8601 format. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is swagger model, return the properties dict. @@ -627,6 +628,6 @@ def __deserialize_model(self, data, klass): value = data[klass.attribute_map[attr]] kwargs[attr] = self.__deserialize(value, attr_type) - instance = klass(**kwargs) + instance = klass(**kwargs) return instance diff --git a/nipyapi/registry/apis/access_api.py b/nipyapi/registry/apis/access_api.py index 9f081275..8ef3d720 100644 --- a/nipyapi/registry/apis/access_api.py +++ b/nipyapi/registry/apis/access_api.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -121,7 +121,7 @@ def create_access_token_by_trying_all_providers_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = [] + auth_settings = ['tokenAuth'] return self.api_client.call_api('/access/token', 'POST', path_params, @@ -219,7 +219,7 @@ def create_access_token_using_basic_auth_credentials_with_http_info(self, **kwar select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['BasicAuth'] + auth_settings = ['tokenAuth', 'BasicAuth'] return self.api_client.call_api('/access/token/login', 'POST', path_params, @@ -317,7 +317,7 @@ def create_access_token_using_identity_provider_credentials_with_http_info(self, select_header_content_type(['*/*']) # Authentication setting - auth_settings = [] + auth_settings = ['tokenAuth'] return self.api_client.call_api('/access/token/identity-provider', 'POST', path_params, @@ -415,7 +415,7 @@ def create_access_token_using_kerberos_ticket_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = [] + auth_settings = ['tokenAuth'] return self.api_client.call_api('/access/token/kerberos', 'POST', path_params, @@ -435,7 +435,7 @@ def create_access_token_using_kerberos_ticket_with_http_info(self, **kwargs): def get_access_status(self, **kwargs): """ Returns the current client's authenticated identity and permissions to top-level resources - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -460,7 +460,7 @@ def get_access_status(self, **kwargs): def get_access_status_with_http_info(self, **kwargs): """ Returns the current client's authenticated identity and permissions to top-level resources - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -513,7 +513,7 @@ def get_access_status_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/access', 'GET', path_params, @@ -533,7 +533,7 @@ def get_access_status_with_http_info(self, **kwargs): def get_identity_provider_usage_instructions(self, **kwargs): """ Provides a description of how the currently configured identity provider expects credentials to be passed to POST /access/token/identity-provider - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -558,7 +558,7 @@ def get_identity_provider_usage_instructions(self, **kwargs): def get_identity_provider_usage_instructions_with_http_info(self, **kwargs): """ Provides a description of how the currently configured identity provider expects credentials to be passed to POST /access/token/identity-provider - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -611,7 +611,7 @@ def get_identity_provider_usage_instructions_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = [] + auth_settings = ['tokenAuth'] return self.api_client.call_api('/access/token/identity-provider/usage', 'GET', path_params, @@ -709,7 +709,7 @@ def test_identity_provider_recognizes_credentials_format_with_http_info(self, ** select_header_content_type(['*/*']) # Authentication setting - auth_settings = [] + auth_settings = ['tokenAuth'] return self.api_client.call_api('/access/token/identity-provider/test', 'POST', path_params, diff --git a/nipyapi/registry/apis/bucket_flows_api.py b/nipyapi/registry/apis/bucket_flows_api.py index 5c8e6827..34c087dd 100644 --- a/nipyapi/registry/apis/bucket_flows_api.py +++ b/nipyapi/registry/apis/bucket_flows_api.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -136,7 +136,7 @@ def create_flow_with_http_info(self, bucket_id, body, **kwargs): select_header_content_type(['application/json']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}/flows', 'POST', path_params, @@ -256,7 +256,7 @@ def create_flow_version_with_http_info(self, bucket_id, flow_id, body, **kwargs) select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}/flows/{flowId}/versions', 'POST', path_params, @@ -369,7 +369,7 @@ def delete_flow_with_http_info(self, bucket_id, flow_id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}/flows/{flowId}', 'DELETE', path_params, @@ -482,7 +482,7 @@ def get_flow_with_http_info(self, bucket_id, flow_id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}/flows/{flowId}', 'GET', path_params, @@ -499,6 +499,137 @@ def get_flow_with_http_info(self, bucket_id, flow_id, **kwargs): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def get_flow_diff(self, bucket_id, flow_id, version_a, version_b, **kwargs): + """ + Returns a list of differences between 2 versions of a flow + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.get_flow_diff(bucket_id, flow_id, version_a, version_b, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str bucket_id: The bucket identifier (required) + :param str flow_id: The flow identifier (required) + :param int version_a: The first version number (required) + :param int version_b: The second version number (required) + :return: VersionedFlowDifference + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.get_flow_diff_with_http_info(bucket_id, flow_id, version_a, version_b, **kwargs) + else: + (data) = self.get_flow_diff_with_http_info(bucket_id, flow_id, version_a, version_b, **kwargs) + return data + + def get_flow_diff_with_http_info(self, bucket_id, flow_id, version_a, version_b, **kwargs): + """ + Returns a list of differences between 2 versions of a flow + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.get_flow_diff_with_http_info(bucket_id, flow_id, version_a, version_b, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str bucket_id: The bucket identifier (required) + :param str flow_id: The flow identifier (required) + :param int version_a: The first version number (required) + :param int version_b: The second version number (required) + :return: VersionedFlowDifference + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['bucket_id', 'flow_id', 'version_a', 'version_b'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_flow_diff" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'bucket_id' is set + if ('bucket_id' not in params) or (params['bucket_id'] is None): + raise ValueError("Missing the required parameter `bucket_id` when calling `get_flow_diff`") + # verify the required parameter 'flow_id' is set + if ('flow_id' not in params) or (params['flow_id'] is None): + raise ValueError("Missing the required parameter `flow_id` when calling `get_flow_diff`") + # verify the required parameter 'version_a' is set + if ('version_a' not in params) or (params['version_a'] is None): + raise ValueError("Missing the required parameter `version_a` when calling `get_flow_diff`") + # verify the required parameter 'version_b' is set + if ('version_b' not in params) or (params['version_b'] is None): + raise ValueError("Missing the required parameter `version_b` when calling `get_flow_diff`") + + if 'version_a' in params and not re.search('\\d+', params['version_a']): + raise ValueError("Invalid value for parameter `version_a` when calling `get_flow_diff`, must conform to the pattern `/\\d+/`") + if 'version_b' in params and not re.search('\\d+', params['version_b']): + raise ValueError("Invalid value for parameter `version_b` when calling `get_flow_diff`, must conform to the pattern `/\\d+/`") + + collection_formats = {} + + path_params = {} + if 'bucket_id' in params: + path_params['bucketId'] = params['bucket_id'] + if 'flow_id' in params: + path_params['flowId'] = params['flow_id'] + if 'version_a' in params: + path_params['versionA'] = params['version_a'] + if 'version_b' in params: + path_params['versionB'] = params['version_b'] + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['*/*']) + + # Authentication setting + auth_settings = ['tokenAuth', 'Authorization'] + + return self.api_client.call_api('/buckets/{bucketId}/flows/{flowId}/diff/{versionA}/{versionB}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionedFlowDifference', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + def get_flow_version(self, bucket_id, flow_id, version_number, **kwargs): """ Gets the given version of a flow @@ -604,7 +735,7 @@ def get_flow_version_with_http_info(self, bucket_id, flow_id, version_number, ** select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}/flows/{flowId}/versions/{versionNumber}', 'GET', path_params, @@ -717,7 +848,7 @@ def get_flow_versions_with_http_info(self, bucket_id, flow_id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}/flows/{flowId}/versions', 'GET', path_params, @@ -823,7 +954,7 @@ def get_flows_with_http_info(self, bucket_id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}/flows', 'GET', path_params, @@ -936,7 +1067,7 @@ def get_latest_flow_version_with_http_info(self, bucket_id, flow_id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}/flows/{flowId}/versions/latest', 'GET', path_params, @@ -1049,7 +1180,7 @@ def get_latest_flow_version_metadata_with_http_info(self, bucket_id, flow_id, ** select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}/flows/{flowId}/versions/latest/metadata', 'GET', path_params, @@ -1169,7 +1300,7 @@ def update_flow_with_http_info(self, bucket_id, flow_id, body, **kwargs): select_header_content_type(['application/json']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}/flows/{flowId}', 'PUT', path_params, diff --git a/nipyapi/registry/apis/buckets_api.py b/nipyapi/registry/apis/buckets_api.py index 2b4ff785..939512c7 100644 --- a/nipyapi/registry/apis/buckets_api.py +++ b/nipyapi/registry/apis/buckets_api.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -43,7 +43,7 @@ def __init__(self, api_client=None): def create_bucket(self, body, **kwargs): """ Creates a bucket - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -69,7 +69,7 @@ def create_bucket(self, body, **kwargs): def create_bucket_with_http_info(self, body, **kwargs): """ Creates a bucket - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -129,7 +129,7 @@ def create_bucket_with_http_info(self, body, **kwargs): select_header_content_type(['application/json']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets', 'POST', path_params, @@ -149,7 +149,7 @@ def create_bucket_with_http_info(self, body, **kwargs): def delete_bucket(self, bucket_id, **kwargs): """ Deletes a bucket along with all objects stored in the bucket - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -175,7 +175,7 @@ def delete_bucket(self, bucket_id, **kwargs): def delete_bucket_with_http_info(self, bucket_id, **kwargs): """ Deletes a bucket along with all objects stored in the bucket - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -235,7 +235,7 @@ def delete_bucket_with_http_info(self, bucket_id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}', 'DELETE', path_params, @@ -255,7 +255,7 @@ def delete_bucket_with_http_info(self, bucket_id, **kwargs): def get_available_bucket_fields(self, **kwargs): """ Retrieves field names for searching or sorting on buckets. - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -280,7 +280,7 @@ def get_available_bucket_fields(self, **kwargs): def get_available_bucket_fields_with_http_info(self, **kwargs): """ Retrieves field names for searching or sorting on buckets. - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -333,7 +333,7 @@ def get_available_bucket_fields_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/fields', 'GET', path_params, @@ -353,7 +353,7 @@ def get_available_bucket_fields_with_http_info(self, **kwargs): def get_bucket(self, bucket_id, **kwargs): """ Gets a bucket - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -379,7 +379,7 @@ def get_bucket(self, bucket_id, **kwargs): def get_bucket_with_http_info(self, bucket_id, **kwargs): """ Gets a bucket - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -439,7 +439,7 @@ def get_bucket_with_http_info(self, bucket_id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}', 'GET', path_params, @@ -537,7 +537,7 @@ def get_buckets_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets', 'GET', path_params, @@ -557,7 +557,7 @@ def get_buckets_with_http_info(self, **kwargs): def update_bucket(self, bucket_id, body, **kwargs): """ Updates a bucket - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -584,7 +584,7 @@ def update_bucket(self, bucket_id, body, **kwargs): def update_bucket_with_http_info(self, bucket_id, body, **kwargs): """ Updates a bucket - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -650,7 +650,7 @@ def update_bucket_with_http_info(self, bucket_id, body, **kwargs): select_header_content_type(['application/json']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/buckets/{bucketId}', 'PUT', path_params, diff --git a/nipyapi/registry/apis/flows_api.py b/nipyapi/registry/apis/flows_api.py index f996d879..ff29c113 100644 --- a/nipyapi/registry/apis/flows_api.py +++ b/nipyapi/registry/apis/flows_api.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -43,7 +43,7 @@ def __init__(self, api_client=None): def get_available_flow_fields(self, **kwargs): """ Retrieves the available field names that can be used for searching or sorting on flows. - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -68,7 +68,7 @@ def get_available_flow_fields(self, **kwargs): def get_available_flow_fields_with_http_info(self, **kwargs): """ Retrieves the available field names that can be used for searching or sorting on flows. - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -121,7 +121,7 @@ def get_available_flow_fields_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/flows/fields', 'GET', path_params, @@ -137,3 +137,542 @@ def get_available_flow_fields_with_http_info(self, **kwargs): _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + + def global_get_flow(self, flow_id, **kwargs): + """ + Gets a flow + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.global_get_flow(flow_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str flow_id: The flow identifier (required) + :return: VersionedFlow + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.global_get_flow_with_http_info(flow_id, **kwargs) + else: + (data) = self.global_get_flow_with_http_info(flow_id, **kwargs) + return data + + def global_get_flow_with_http_info(self, flow_id, **kwargs): + """ + Gets a flow + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.global_get_flow_with_http_info(flow_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str flow_id: The flow identifier (required) + :return: VersionedFlow + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['flow_id'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method global_get_flow" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'flow_id' is set + if ('flow_id' not in params) or (params['flow_id'] is None): + raise ValueError("Missing the required parameter `flow_id` when calling `global_get_flow`") + + + collection_formats = {} + + path_params = {} + if 'flow_id' in params: + path_params['flowId'] = params['flow_id'] + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['*/*']) + + # Authentication setting + auth_settings = ['tokenAuth', 'Authorization'] + + return self.api_client.call_api('/flows/{flowId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionedFlow', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def global_get_flow_version(self, flow_id, version_number, **kwargs): + """ + Gets the given version of a flow + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.global_get_flow_version(flow_id, version_number, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str flow_id: The flow identifier (required) + :param int version_number: The version number (required) + :return: VersionedFlowSnapshot + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.global_get_flow_version_with_http_info(flow_id, version_number, **kwargs) + else: + (data) = self.global_get_flow_version_with_http_info(flow_id, version_number, **kwargs) + return data + + def global_get_flow_version_with_http_info(self, flow_id, version_number, **kwargs): + """ + Gets the given version of a flow + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.global_get_flow_version_with_http_info(flow_id, version_number, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str flow_id: The flow identifier (required) + :param int version_number: The version number (required) + :return: VersionedFlowSnapshot + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['flow_id', 'version_number'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method global_get_flow_version" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'flow_id' is set + if ('flow_id' not in params) or (params['flow_id'] is None): + raise ValueError("Missing the required parameter `flow_id` when calling `global_get_flow_version`") + # verify the required parameter 'version_number' is set + if ('version_number' not in params) or (params['version_number'] is None): + raise ValueError("Missing the required parameter `version_number` when calling `global_get_flow_version`") + + if 'version_number' in params and not re.search('\\d+', params['version_number']): + raise ValueError("Invalid value for parameter `version_number` when calling `global_get_flow_version`, must conform to the pattern `/\\d+/`") + + collection_formats = {} + + path_params = {} + if 'flow_id' in params: + path_params['flowId'] = params['flow_id'] + if 'version_number' in params: + path_params['versionNumber'] = params['version_number'] + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['*/*']) + + # Authentication setting + auth_settings = ['tokenAuth', 'Authorization'] + + return self.api_client.call_api('/flows/{flowId}/versions/{versionNumber}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionedFlowSnapshot', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def global_get_flow_versions(self, flow_id, **kwargs): + """ + Gets summary information for all versions of a flow. Versions are ordered newest->oldest. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.global_get_flow_versions(flow_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str flow_id: The flow identifier (required) + :return: list[VersionedFlowSnapshotMetadata] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.global_get_flow_versions_with_http_info(flow_id, **kwargs) + else: + (data) = self.global_get_flow_versions_with_http_info(flow_id, **kwargs) + return data + + def global_get_flow_versions_with_http_info(self, flow_id, **kwargs): + """ + Gets summary information for all versions of a flow. Versions are ordered newest->oldest. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.global_get_flow_versions_with_http_info(flow_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str flow_id: The flow identifier (required) + :return: list[VersionedFlowSnapshotMetadata] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['flow_id'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method global_get_flow_versions" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'flow_id' is set + if ('flow_id' not in params) or (params['flow_id'] is None): + raise ValueError("Missing the required parameter `flow_id` when calling `global_get_flow_versions`") + + + collection_formats = {} + + path_params = {} + if 'flow_id' in params: + path_params['flowId'] = params['flow_id'] + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['*/*']) + + # Authentication setting + auth_settings = ['tokenAuth', 'Authorization'] + + return self.api_client.call_api('/flows/{flowId}/versions', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[VersionedFlowSnapshotMetadata]', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def global_get_latest_flow_version(self, flow_id, **kwargs): + """ + Get the latest version of a flow + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.global_get_latest_flow_version(flow_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str flow_id: The flow identifier (required) + :return: VersionedFlowSnapshot + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.global_get_latest_flow_version_with_http_info(flow_id, **kwargs) + else: + (data) = self.global_get_latest_flow_version_with_http_info(flow_id, **kwargs) + return data + + def global_get_latest_flow_version_with_http_info(self, flow_id, **kwargs): + """ + Get the latest version of a flow + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.global_get_latest_flow_version_with_http_info(flow_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str flow_id: The flow identifier (required) + :return: VersionedFlowSnapshot + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['flow_id'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method global_get_latest_flow_version" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'flow_id' is set + if ('flow_id' not in params) or (params['flow_id'] is None): + raise ValueError("Missing the required parameter `flow_id` when calling `global_get_latest_flow_version`") + + + collection_formats = {} + + path_params = {} + if 'flow_id' in params: + path_params['flowId'] = params['flow_id'] + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['*/*']) + + # Authentication setting + auth_settings = ['tokenAuth', 'Authorization'] + + return self.api_client.call_api('/flows/{flowId}/versions/latest', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionedFlowSnapshot', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def global_get_latest_flow_version_metadata(self, flow_id, **kwargs): + """ + Get the metadata for the latest version of a flow + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.global_get_latest_flow_version_metadata(flow_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str flow_id: The flow identifier (required) + :return: VersionedFlowSnapshotMetadata + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.global_get_latest_flow_version_metadata_with_http_info(flow_id, **kwargs) + else: + (data) = self.global_get_latest_flow_version_metadata_with_http_info(flow_id, **kwargs) + return data + + def global_get_latest_flow_version_metadata_with_http_info(self, flow_id, **kwargs): + """ + Get the metadata for the latest version of a flow + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.global_get_latest_flow_version_metadata_with_http_info(flow_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str flow_id: The flow identifier (required) + :return: VersionedFlowSnapshotMetadata + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['flow_id'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method global_get_latest_flow_version_metadata" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'flow_id' is set + if ('flow_id' not in params) or (params['flow_id'] is None): + raise ValueError("Missing the required parameter `flow_id` when calling `global_get_latest_flow_version_metadata`") + + + collection_formats = {} + + path_params = {} + if 'flow_id' in params: + path_params['flowId'] = params['flow_id'] + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['*/*']) + + # Authentication setting + auth_settings = ['tokenAuth', 'Authorization'] + + return self.api_client.call_api('/flows/{flowId}/versions/latest/metadata', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionedFlowSnapshotMetadata', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/nipyapi/registry/apis/items_api.py b/nipyapi/registry/apis/items_api.py index 960957f3..59a17f72 100644 --- a/nipyapi/registry/apis/items_api.py +++ b/nipyapi/registry/apis/items_api.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -43,7 +43,7 @@ def __init__(self, api_client=None): def get_available_bucket_item_fields(self, **kwargs): """ Retrieves the available field names for searching or sorting on bucket items. - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -68,7 +68,7 @@ def get_available_bucket_item_fields(self, **kwargs): def get_available_bucket_item_fields_with_http_info(self, **kwargs): """ Retrieves the available field names for searching or sorting on bucket items. - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -121,7 +121,7 @@ def get_available_bucket_item_fields_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/items/fields', 'GET', path_params, @@ -219,7 +219,7 @@ def get_items_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/items', 'GET', path_params, @@ -239,7 +239,7 @@ def get_items_with_http_info(self, **kwargs): def get_items_in_bucket(self, bucket_id, **kwargs): """ Gets items of the given bucket - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -265,7 +265,7 @@ def get_items_in_bucket(self, bucket_id, **kwargs): def get_items_in_bucket_with_http_info(self, bucket_id, **kwargs): """ Gets items of the given bucket - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -325,7 +325,7 @@ def get_items_in_bucket_with_http_info(self, bucket_id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/items/{bucketId}', 'GET', path_params, diff --git a/nipyapi/registry/apis/policies_api.py b/nipyapi/registry/apis/policies_api.py index d027007c..1a3c1f14 100644 --- a/nipyapi/registry/apis/policies_api.py +++ b/nipyapi/registry/apis/policies_api.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -43,7 +43,7 @@ def __init__(self, api_client=None): def create_access_policy(self, body, **kwargs): """ Creates an access policy - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -69,7 +69,7 @@ def create_access_policy(self, body, **kwargs): def create_access_policy_with_http_info(self, body, **kwargs): """ Creates an access policy - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -129,7 +129,7 @@ def create_access_policy_with_http_info(self, body, **kwargs): select_header_content_type(['application/json']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/policies', 'POST', path_params, @@ -149,7 +149,7 @@ def create_access_policy_with_http_info(self, body, **kwargs): def get_access_policies(self, **kwargs): """ Gets all access policies - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -174,7 +174,7 @@ def get_access_policies(self, **kwargs): def get_access_policies_with_http_info(self, **kwargs): """ Gets all access policies - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -227,7 +227,7 @@ def get_access_policies_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/policies', 'GET', path_params, @@ -247,7 +247,7 @@ def get_access_policies_with_http_info(self, **kwargs): def get_access_policy(self, id, **kwargs): """ Gets an access policy - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -273,7 +273,7 @@ def get_access_policy(self, id, **kwargs): def get_access_policy_with_http_info(self, id, **kwargs): """ Gets an access policy - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -333,7 +333,7 @@ def get_access_policy_with_http_info(self, id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/policies/{id}', 'GET', path_params, @@ -353,7 +353,7 @@ def get_access_policy_with_http_info(self, id, **kwargs): def get_access_policy_for_resource(self, action, resource, **kwargs): """ Gets an access policy for the specified action and resource - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -380,7 +380,7 @@ def get_access_policy_for_resource(self, action, resource, **kwargs): def get_access_policy_for_resource_with_http_info(self, action, resource, **kwargs): """ Gets an access policy for the specified action and resource - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -448,7 +448,7 @@ def get_access_policy_for_resource_with_http_info(self, action, resource, **kwar select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/policies/{action}/{resource}', 'GET', path_params, @@ -468,7 +468,7 @@ def get_access_policy_for_resource_with_http_info(self, action, resource, **kwar def get_resources(self, **kwargs): """ Gets the available resources that support access/authorization policies - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -493,7 +493,7 @@ def get_resources(self, **kwargs): def get_resources_with_http_info(self, **kwargs): """ Gets the available resources that support access/authorization policies - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -546,7 +546,7 @@ def get_resources_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/policies/resources', 'GET', path_params, @@ -566,7 +566,7 @@ def get_resources_with_http_info(self, **kwargs): def remove_access_policy(self, id, **kwargs): """ Deletes an access policy - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -592,7 +592,7 @@ def remove_access_policy(self, id, **kwargs): def remove_access_policy_with_http_info(self, id, **kwargs): """ Deletes an access policy - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -652,7 +652,7 @@ def remove_access_policy_with_http_info(self, id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/policies/{id}', 'DELETE', path_params, @@ -672,7 +672,7 @@ def remove_access_policy_with_http_info(self, id, **kwargs): def update_access_policy(self, id, body, **kwargs): """ Updates a access policy - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -699,7 +699,7 @@ def update_access_policy(self, id, body, **kwargs): def update_access_policy_with_http_info(self, id, body, **kwargs): """ Updates a access policy - + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. @@ -765,7 +765,7 @@ def update_access_policy_with_http_info(self, id, body, **kwargs): select_header_content_type(['application/json']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/policies/{id}', 'PUT', path_params, diff --git a/nipyapi/registry/apis/tenants_api.py b/nipyapi/registry/apis/tenants_api.py index 2a79471c..4ba4fc69 100644 --- a/nipyapi/registry/apis/tenants_api.py +++ b/nipyapi/registry/apis/tenants_api.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -129,7 +129,7 @@ def create_user_with_http_info(self, body, **kwargs): select_header_content_type(['application/json']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/tenants/users', 'POST', path_params, @@ -235,7 +235,7 @@ def create_user_group_with_http_info(self, body, **kwargs): select_header_content_type(['application/json']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/tenants/user-groups', 'POST', path_params, @@ -341,7 +341,7 @@ def get_user_with_http_info(self, id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/tenants/users/{id}', 'GET', path_params, @@ -447,7 +447,7 @@ def get_user_group_with_http_info(self, id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/tenants/user-groups/{id}', 'GET', path_params, @@ -545,7 +545,7 @@ def get_user_groups_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/tenants/user-groups', 'GET', path_params, @@ -643,7 +643,7 @@ def get_users_with_http_info(self, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/tenants/users', 'GET', path_params, @@ -749,7 +749,7 @@ def remove_user_with_http_info(self, id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/tenants/users/{id}', 'DELETE', path_params, @@ -855,7 +855,7 @@ def remove_user_group_with_http_info(self, id, **kwargs): select_header_content_type(['*/*']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/tenants/user-groups/{id}', 'DELETE', path_params, @@ -968,7 +968,7 @@ def update_user_with_http_info(self, id, body, **kwargs): select_header_content_type(['application/json']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/tenants/users/{id}', 'PUT', path_params, @@ -1081,7 +1081,7 @@ def update_user_group_with_http_info(self, id, body, **kwargs): select_header_content_type(['application/json']) # Authentication setting - auth_settings = ['Authorization'] + auth_settings = ['tokenAuth', 'Authorization'] return self.api_client.call_api('/tenants/user-groups/{id}', 'PUT', path_params, diff --git a/nipyapi/registry/configuration.py b/nipyapi/registry/configuration.py index 9a9a4937..814e1de9 100644 --- a/nipyapi/registry/configuration.py +++ b/nipyapi/registry/configuration.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -209,6 +209,13 @@ def auth_settings(self): :return: The Auth Settings information dict. """ return { + 'tokenAuth': + { + 'type': 'api_key', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_api_key_with_prefix('tokenAuth') + }, 'Authorization': { 'type': 'api_key', @@ -235,6 +242,6 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 0.2.0-SNAPSHOT\n"\ + "Version of the API: 0.2.0\n"\ "SDK Package Version: 1.0.0".\ format(env=sys.platform, pyversion=sys.version) diff --git a/nipyapi/registry/models/__init__.py b/nipyapi/registry/models/__init__.py index ab9933a0..b0cc63f4 100644 --- a/nipyapi/registry/models/__init__.py +++ b/nipyapi/registry/models/__init__.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -20,16 +20,18 @@ from .bucket import Bucket from .bucket_item import BucketItem from .bundle import Bundle +from .component_difference import ComponentDifference +from .component_difference_group import ComponentDifferenceGroup from .connectable_component import ConnectableComponent from .controller_service_api import ControllerServiceAPI from .current_user import CurrentUser from .fields import Fields from .link import Link from .permissions import Permissions +from .position import Position from .resource import Resource from .resource_permissions import ResourcePermissions from .tenant import Tenant -from .the_position_of_a_component_on_the_graph import ThePositionOfAComponentOnTheGraph from .uri_builder import UriBuilder from .user import User from .user_group import UserGroup @@ -37,6 +39,7 @@ from .versioned_controller_service import VersionedControllerService from .versioned_flow import VersionedFlow from .versioned_flow_coordinates import VersionedFlowCoordinates +from .versioned_flow_difference import VersionedFlowDifference from .versioned_flow_snapshot import VersionedFlowSnapshot from .versioned_flow_snapshot_metadata import VersionedFlowSnapshotMetadata from .versioned_funnel import VersionedFunnel diff --git a/nipyapi/registry/models/access_policy.py b/nipyapi/registry/models/access_policy.py index c6a58179..2319b8c6 100644 --- a/nipyapi/registry/models/access_policy.py +++ b/nipyapi/registry/models/access_policy.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/access_policy_summary.py b/nipyapi/registry/models/access_policy_summary.py index 57a99c79..722510be 100644 --- a/nipyapi/registry/models/access_policy_summary.py +++ b/nipyapi/registry/models/access_policy_summary.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/batch_size.py b/nipyapi/registry/models/batch_size.py index b3969825..81681579 100644 --- a/nipyapi/registry/models/batch_size.py +++ b/nipyapi/registry/models/batch_size.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/bucket.py b/nipyapi/registry/models/bucket.py index 7b8478da..ffef8a14 100644 --- a/nipyapi/registry/models/bucket.py +++ b/nipyapi/registry/models/bucket.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/bucket_item.py b/nipyapi/registry/models/bucket_item.py index 4aeef9a6..5dd60ffe 100644 --- a/nipyapi/registry/models/bucket_item.py +++ b/nipyapi/registry/models/bucket_item.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/bundle.py b/nipyapi/registry/models/bundle.py index 512f5c42..30ce092f 100644 --- a/nipyapi/registry/models/bundle.py +++ b/nipyapi/registry/models/bundle.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/component_difference.py b/nipyapi/registry/models/component_difference.py new file mode 100644 index 00000000..8b311362 --- /dev/null +++ b/nipyapi/registry/models/component_difference.py @@ -0,0 +1,237 @@ +# coding: utf-8 + +""" + NiFi Registry REST API + + The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. + + OpenAPI spec version: 0.2.0 + Contact: dev@nifi.apache.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ComponentDifference(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'value_a': 'str', + 'value_b': 'str', + 'change_description': 'str', + 'difference_type': 'str', + 'difference_type_description': 'str' + } + + attribute_map = { + 'value_a': 'valueA', + 'value_b': 'valueB', + 'change_description': 'changeDescription', + 'difference_type': 'differenceType', + 'difference_type_description': 'differenceTypeDescription' + } + + def __init__(self, value_a=None, value_b=None, change_description=None, difference_type=None, difference_type_description=None): + """ + ComponentDifference - a model defined in Swagger + """ + + self._value_a = None + self._value_b = None + self._change_description = None + self._difference_type = None + self._difference_type_description = None + + if value_a is not None: + self.value_a = value_a + if value_b is not None: + self.value_b = value_b + if change_description is not None: + self.change_description = change_description + if difference_type is not None: + self.difference_type = difference_type + if difference_type_description is not None: + self.difference_type_description = difference_type_description + + @property + def value_a(self): + """ + Gets the value_a of this ComponentDifference. + The earlier value from the difference. + + :return: The value_a of this ComponentDifference. + :rtype: str + """ + return self._value_a + + @value_a.setter + def value_a(self, value_a): + """ + Sets the value_a of this ComponentDifference. + The earlier value from the difference. + + :param value_a: The value_a of this ComponentDifference. + :type: str + """ + + self._value_a = value_a + + @property + def value_b(self): + """ + Gets the value_b of this ComponentDifference. + The newer value from the difference. + + :return: The value_b of this ComponentDifference. + :rtype: str + """ + return self._value_b + + @value_b.setter + def value_b(self, value_b): + """ + Sets the value_b of this ComponentDifference. + The newer value from the difference. + + :param value_b: The value_b of this ComponentDifference. + :type: str + """ + + self._value_b = value_b + + @property + def change_description(self): + """ + Gets the change_description of this ComponentDifference. + The description of the change. + + :return: The change_description of this ComponentDifference. + :rtype: str + """ + return self._change_description + + @change_description.setter + def change_description(self, change_description): + """ + Sets the change_description of this ComponentDifference. + The description of the change. + + :param change_description: The change_description of this ComponentDifference. + :type: str + """ + + self._change_description = change_description + + @property + def difference_type(self): + """ + Gets the difference_type of this ComponentDifference. + The key to the difference. + + :return: The difference_type of this ComponentDifference. + :rtype: str + """ + return self._difference_type + + @difference_type.setter + def difference_type(self, difference_type): + """ + Sets the difference_type of this ComponentDifference. + The key to the difference. + + :param difference_type: The difference_type of this ComponentDifference. + :type: str + """ + + self._difference_type = difference_type + + @property + def difference_type_description(self): + """ + Gets the difference_type_description of this ComponentDifference. + The description of the change type. + + :return: The difference_type_description of this ComponentDifference. + :rtype: str + """ + return self._difference_type_description + + @difference_type_description.setter + def difference_type_description(self, difference_type_description): + """ + Sets the difference_type_description of this ComponentDifference. + The description of the change type. + + :param difference_type_description: The difference_type_description of this ComponentDifference. + :type: str + """ + + self._difference_type_description = difference_type_description + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ComponentDifference): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/nipyapi/registry/models/component_difference_group.py b/nipyapi/registry/models/component_difference_group.py new file mode 100644 index 00000000..9dd87582 --- /dev/null +++ b/nipyapi/registry/models/component_difference_group.py @@ -0,0 +1,237 @@ +# coding: utf-8 + +""" + NiFi Registry REST API + + The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. + + OpenAPI spec version: 0.2.0 + Contact: dev@nifi.apache.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ComponentDifferenceGroup(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'component_id': 'str', + 'component_name': 'str', + 'component_type': 'str', + 'process_group_id': 'str', + 'differences': 'list[ComponentDifference]' + } + + attribute_map = { + 'component_id': 'componentId', + 'component_name': 'componentName', + 'component_type': 'componentType', + 'process_group_id': 'processGroupId', + 'differences': 'differences' + } + + def __init__(self, component_id=None, component_name=None, component_type=None, process_group_id=None, differences=None): + """ + ComponentDifferenceGroup - a model defined in Swagger + """ + + self._component_id = None + self._component_name = None + self._component_type = None + self._process_group_id = None + self._differences = None + + if component_id is not None: + self.component_id = component_id + if component_name is not None: + self.component_name = component_name + if component_type is not None: + self.component_type = component_type + if process_group_id is not None: + self.process_group_id = process_group_id + if differences is not None: + self.differences = differences + + @property + def component_id(self): + """ + Gets the component_id of this ComponentDifferenceGroup. + The id of the component whose changes are grouped together. + + :return: The component_id of this ComponentDifferenceGroup. + :rtype: str + """ + return self._component_id + + @component_id.setter + def component_id(self, component_id): + """ + Sets the component_id of this ComponentDifferenceGroup. + The id of the component whose changes are grouped together. + + :param component_id: The component_id of this ComponentDifferenceGroup. + :type: str + """ + + self._component_id = component_id + + @property + def component_name(self): + """ + Gets the component_name of this ComponentDifferenceGroup. + The name of the component whose changes are grouped together. + + :return: The component_name of this ComponentDifferenceGroup. + :rtype: str + """ + return self._component_name + + @component_name.setter + def component_name(self, component_name): + """ + Sets the component_name of this ComponentDifferenceGroup. + The name of the component whose changes are grouped together. + + :param component_name: The component_name of this ComponentDifferenceGroup. + :type: str + """ + + self._component_name = component_name + + @property + def component_type(self): + """ + Gets the component_type of this ComponentDifferenceGroup. + The type of component these changes relate to. + + :return: The component_type of this ComponentDifferenceGroup. + :rtype: str + """ + return self._component_type + + @component_type.setter + def component_type(self, component_type): + """ + Sets the component_type of this ComponentDifferenceGroup. + The type of component these changes relate to. + + :param component_type: The component_type of this ComponentDifferenceGroup. + :type: str + """ + + self._component_type = component_type + + @property + def process_group_id(self): + """ + Gets the process_group_id of this ComponentDifferenceGroup. + The process group id for this component. + + :return: The process_group_id of this ComponentDifferenceGroup. + :rtype: str + """ + return self._process_group_id + + @process_group_id.setter + def process_group_id(self, process_group_id): + """ + Sets the process_group_id of this ComponentDifferenceGroup. + The process group id for this component. + + :param process_group_id: The process_group_id of this ComponentDifferenceGroup. + :type: str + """ + + self._process_group_id = process_group_id + + @property + def differences(self): + """ + Gets the differences of this ComponentDifferenceGroup. + The list of changes related to this component between the 2 versions. + + :return: The differences of this ComponentDifferenceGroup. + :rtype: list[ComponentDifference] + """ + return self._differences + + @differences.setter + def differences(self, differences): + """ + Sets the differences of this ComponentDifferenceGroup. + The list of changes related to this component between the 2 versions. + + :param differences: The differences of this ComponentDifferenceGroup. + :type: list[ComponentDifference] + """ + + self._differences = differences + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ComponentDifferenceGroup): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/nipyapi/registry/models/connectable_component.py b/nipyapi/registry/models/connectable_component.py index adb205d3..7f0ee4f9 100644 --- a/nipyapi/registry/models/connectable_component.py +++ b/nipyapi/registry/models/connectable_component.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/controller_service_api.py b/nipyapi/registry/models/controller_service_api.py index fa803672..67bed7e2 100644 --- a/nipyapi/registry/models/controller_service_api.py +++ b/nipyapi/registry/models/controller_service_api.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/current_user.py b/nipyapi/registry/models/current_user.py index fae4ffa5..171db684 100644 --- a/nipyapi/registry/models/current_user.py +++ b/nipyapi/registry/models/current_user.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/fields.py b/nipyapi/registry/models/fields.py index 1bae48ee..9cf505ad 100644 --- a/nipyapi/registry/models/fields.py +++ b/nipyapi/registry/models/fields.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/link.py b/nipyapi/registry/models/link.py index 661e048f..e3f362a5 100644 --- a/nipyapi/registry/models/link.py +++ b/nipyapi/registry/models/link.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -32,49 +32,49 @@ class Link(object): """ swagger_types = { 'type': 'str', - 'rel': 'str', - 'uri': 'str', - 'title': 'str', 'params': 'dict(str, str)', + 'title': 'str', 'rels': 'list[str]', + 'uri': 'str', + 'rel': 'str', 'uri_builder': 'UriBuilder' } attribute_map = { 'type': 'type', - 'rel': 'rel', - 'uri': 'uri', - 'title': 'title', 'params': 'params', + 'title': 'title', 'rels': 'rels', + 'uri': 'uri', + 'rel': 'rel', 'uri_builder': 'uriBuilder' } - def __init__(self, type=None, rel=None, uri=None, title=None, params=None, rels=None, uri_builder=None): + def __init__(self, type=None, params=None, title=None, rels=None, uri=None, rel=None, uri_builder=None): """ Link - a model defined in Swagger """ self._type = None - self._rel = None - self._uri = None - self._title = None self._params = None + self._title = None self._rels = None + self._uri = None + self._rel = None self._uri_builder = None if type is not None: self.type = type - if rel is not None: - self.rel = rel - if uri is not None: - self.uri = uri - if title is not None: - self.title = title if params is not None: self.params = params + if title is not None: + self.title = title if rels is not None: self.rels = rels + if uri is not None: + self.uri = uri + if rel is not None: + self.rel = rel if uri_builder is not None: self.uri_builder = uri_builder @@ -100,46 +100,25 @@ def type(self, type): self._type = type @property - def rel(self): - """ - Gets the rel of this Link. - - :return: The rel of this Link. - :rtype: str - """ - return self._rel - - @rel.setter - def rel(self, rel): - """ - Sets the rel of this Link. - - :param rel: The rel of this Link. - :type: str - """ - - self._rel = rel - - @property - def uri(self): + def params(self): """ - Gets the uri of this Link. + Gets the params of this Link. - :return: The uri of this Link. - :rtype: str + :return: The params of this Link. + :rtype: dict(str, str) """ - return self._uri + return self._params - @uri.setter - def uri(self, uri): + @params.setter + def params(self, params): """ - Sets the uri of this Link. + Sets the params of this Link. - :param uri: The uri of this Link. - :type: str + :param params: The params of this Link. + :type: dict(str, str) """ - self._uri = uri + self._params = params @property def title(self): @@ -162,27 +141,6 @@ def title(self, title): self._title = title - @property - def params(self): - """ - Gets the params of this Link. - - :return: The params of this Link. - :rtype: dict(str, str) - """ - return self._params - - @params.setter - def params(self, params): - """ - Sets the params of this Link. - - :param params: The params of this Link. - :type: dict(str, str) - """ - - self._params = params - @property def rels(self): """ @@ -204,6 +162,48 @@ def rels(self, rels): self._rels = rels + @property + def uri(self): + """ + Gets the uri of this Link. + + :return: The uri of this Link. + :rtype: str + """ + return self._uri + + @uri.setter + def uri(self, uri): + """ + Sets the uri of this Link. + + :param uri: The uri of this Link. + :type: str + """ + + self._uri = uri + + @property + def rel(self): + """ + Gets the rel of this Link. + + :return: The rel of this Link. + :rtype: str + """ + return self._rel + + @rel.setter + def rel(self, rel): + """ + Sets the rel of this Link. + + :param rel: The rel of this Link. + :type: str + """ + + self._rel = rel + @property def uri_builder(self): """ diff --git a/nipyapi/registry/models/permissions.py b/nipyapi/registry/models/permissions.py index eadfbc04..e82da6fb 100644 --- a/nipyapi/registry/models/permissions.py +++ b/nipyapi/registry/models/permissions.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/the_position_of_a_component_on_the_graph.py b/nipyapi/registry/models/position.py similarity index 80% rename from nipyapi/registry/models/the_position_of_a_component_on_the_graph.py rename to nipyapi/registry/models/position.py index 3748f7c4..c3c6da41 100644 --- a/nipyapi/registry/models/the_position_of_a_component_on_the_graph.py +++ b/nipyapi/registry/models/position.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -16,7 +16,7 @@ import re -class ThePositionOfAComponentOnTheGraph(object): +class Position(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. @@ -42,7 +42,7 @@ class ThePositionOfAComponentOnTheGraph(object): def __init__(self, x=None, y=None): """ - ThePositionOfAComponentOnTheGraph - a model defined in Swagger + Position - a model defined in Swagger """ self._x = None @@ -56,10 +56,10 @@ def __init__(self, x=None, y=None): @property def x(self): """ - Gets the x of this ThePositionOfAComponentOnTheGraph. + Gets the x of this Position. The x coordinate. - :return: The x of this ThePositionOfAComponentOnTheGraph. + :return: The x of this Position. :rtype: float """ return self._x @@ -67,10 +67,10 @@ def x(self): @x.setter def x(self, x): """ - Sets the x of this ThePositionOfAComponentOnTheGraph. + Sets the x of this Position. The x coordinate. - :param x: The x of this ThePositionOfAComponentOnTheGraph. + :param x: The x of this Position. :type: float """ @@ -79,10 +79,10 @@ def x(self, x): @property def y(self): """ - Gets the y of this ThePositionOfAComponentOnTheGraph. + Gets the y of this Position. The y coordinate. - :return: The y of this ThePositionOfAComponentOnTheGraph. + :return: The y of this Position. :rtype: float """ return self._y @@ -90,10 +90,10 @@ def y(self): @y.setter def y(self, y): """ - Sets the y of this ThePositionOfAComponentOnTheGraph. + Sets the y of this Position. The y coordinate. - :param y: The y of this ThePositionOfAComponentOnTheGraph. + :param y: The y of this Position. :type: float """ @@ -141,7 +141,7 @@ def __eq__(self, other): """ Returns true if both objects are equal """ - if not isinstance(other, ThePositionOfAComponentOnTheGraph): + if not isinstance(other, Position): return False return self.__dict__ == other.__dict__ diff --git a/nipyapi/registry/models/resource.py b/nipyapi/registry/models/resource.py index a7bb6efd..63bf5318 100644 --- a/nipyapi/registry/models/resource.py +++ b/nipyapi/registry/models/resource.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/resource_permissions.py b/nipyapi/registry/models/resource_permissions.py index a7e9dc5b..4cb95bfd 100644 --- a/nipyapi/registry/models/resource_permissions.py +++ b/nipyapi/registry/models/resource_permissions.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/tenant.py b/nipyapi/registry/models/tenant.py index be2af7e4..7100761d 100644 --- a/nipyapi/registry/models/tenant.py +++ b/nipyapi/registry/models/tenant.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/uri_builder.py b/nipyapi/registry/models/uri_builder.py index b899ab3c..efc01c79 100644 --- a/nipyapi/registry/models/uri_builder.py +++ b/nipyapi/registry/models/uri_builder.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/user.py b/nipyapi/registry/models/user.py index ace6351f..9892e2e7 100644 --- a/nipyapi/registry/models/user.py +++ b/nipyapi/registry/models/user.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/user_group.py b/nipyapi/registry/models/user_group.py index 8833e77a..5277edb6 100644 --- a/nipyapi/registry/models/user_group.py +++ b/nipyapi/registry/models/user_group.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/versioned_connection.py b/nipyapi/registry/models/versioned_connection.py index e811c407..f621ca67 100644 --- a/nipyapi/registry/models/versioned_connection.py +++ b/nipyapi/registry/models/versioned_connection.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -34,7 +34,7 @@ class VersionedConnection(object): 'identifier': 'str', 'name': 'str', 'comments': 'str', - 'position': 'ThePositionOfAComponentOnTheGraph', + 'position': 'Position', 'source': 'ConnectableComponent', 'destination': 'ConnectableComponent', 'label_index': 'int', @@ -44,7 +44,7 @@ class VersionedConnection(object): 'back_pressure_data_size_threshold': 'str', 'flow_file_expiration': 'str', 'prioritizers': 'list[str]', - 'bends': 'list[ThePositionOfAComponentOnTheGraph]', + 'bends': 'list[Position]', 'component_type': 'str', 'group_identifier': 'str' } @@ -199,7 +199,7 @@ def position(self): The component's position on the graph :return: The position of this VersionedConnection. - :rtype: ThePositionOfAComponentOnTheGraph + :rtype: Position """ return self._position @@ -210,7 +210,7 @@ def position(self, position): The component's position on the graph :param position: The position of this VersionedConnection. - :type: ThePositionOfAComponentOnTheGraph + :type: Position """ self._position = position @@ -429,7 +429,7 @@ def bends(self): The bend points on the connection. :return: The bends of this VersionedConnection. - :rtype: list[ThePositionOfAComponentOnTheGraph] + :rtype: list[Position] """ return self._bends @@ -440,7 +440,7 @@ def bends(self, bends): The bend points on the connection. :param bends: The bends of this VersionedConnection. - :type: list[ThePositionOfAComponentOnTheGraph] + :type: list[Position] """ self._bends = bends diff --git a/nipyapi/registry/models/versioned_controller_service.py b/nipyapi/registry/models/versioned_controller_service.py index d0261ef8..452a2ee3 100644 --- a/nipyapi/registry/models/versioned_controller_service.py +++ b/nipyapi/registry/models/versioned_controller_service.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -34,7 +34,7 @@ class VersionedControllerService(object): 'identifier': 'str', 'name': 'str', 'comments': 'str', - 'position': 'ThePositionOfAComponentOnTheGraph', + 'position': 'Position', 'type': 'str', 'bundle': 'Bundle', 'controller_service_apis': 'list[ControllerServiceAPI]', @@ -179,7 +179,7 @@ def position(self): The component's position on the graph :return: The position of this VersionedControllerService. - :rtype: ThePositionOfAComponentOnTheGraph + :rtype: Position """ return self._position @@ -190,7 +190,7 @@ def position(self, position): The component's position on the graph :param position: The position of this VersionedControllerService. - :type: ThePositionOfAComponentOnTheGraph + :type: Position """ self._position = position diff --git a/nipyapi/registry/models/versioned_flow.py b/nipyapi/registry/models/versioned_flow.py index bf5eb108..b4f04130 100644 --- a/nipyapi/registry/models/versioned_flow.py +++ b/nipyapi/registry/models/versioned_flow.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/versioned_flow_coordinates.py b/nipyapi/registry/models/versioned_flow_coordinates.py index 9e68185a..496d1d33 100644 --- a/nipyapi/registry/models/versioned_flow_coordinates.py +++ b/nipyapi/registry/models/versioned_flow_coordinates.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/versioned_flow_difference.py b/nipyapi/registry/models/versioned_flow_difference.py new file mode 100644 index 00000000..d604cc14 --- /dev/null +++ b/nipyapi/registry/models/versioned_flow_difference.py @@ -0,0 +1,235 @@ +# coding: utf-8 + +""" + NiFi Registry REST API + + The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. + + OpenAPI spec version: 0.2.0 + Contact: dev@nifi.apache.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class VersionedFlowDifference(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bucket_id': 'str', + 'flow_id': 'str', + 'version_a': 'int', + 'version_b': 'int', + 'component_difference_groups': 'list[ComponentDifferenceGroup]' + } + + attribute_map = { + 'bucket_id': 'bucketId', + 'flow_id': 'flowId', + 'version_a': 'versionA', + 'version_b': 'versionB', + 'component_difference_groups': 'componentDifferenceGroups' + } + + def __init__(self, bucket_id=None, flow_id=None, version_a=None, version_b=None, component_difference_groups=None): + """ + VersionedFlowDifference - a model defined in Swagger + """ + + self._bucket_id = None + self._flow_id = None + self._version_a = None + self._version_b = None + self._component_difference_groups = None + + if bucket_id is not None: + self.bucket_id = bucket_id + if flow_id is not None: + self.flow_id = flow_id + if version_a is not None: + self.version_a = version_a + if version_b is not None: + self.version_b = version_b + if component_difference_groups is not None: + self.component_difference_groups = component_difference_groups + + @property + def bucket_id(self): + """ + Gets the bucket_id of this VersionedFlowDifference. + The id of the bucket that the flow is stored in. + + :return: The bucket_id of this VersionedFlowDifference. + :rtype: str + """ + return self._bucket_id + + @bucket_id.setter + def bucket_id(self, bucket_id): + """ + Sets the bucket_id of this VersionedFlowDifference. + The id of the bucket that the flow is stored in. + + :param bucket_id: The bucket_id of this VersionedFlowDifference. + :type: str + """ + + self._bucket_id = bucket_id + + @property + def flow_id(self): + """ + Gets the flow_id of this VersionedFlowDifference. + The id of the flow that is being examined. + + :return: The flow_id of this VersionedFlowDifference. + :rtype: str + """ + return self._flow_id + + @flow_id.setter + def flow_id(self, flow_id): + """ + Sets the flow_id of this VersionedFlowDifference. + The id of the flow that is being examined. + + :param flow_id: The flow_id of this VersionedFlowDifference. + :type: str + """ + + self._flow_id = flow_id + + @property + def version_a(self): + """ + Gets the version_a of this VersionedFlowDifference. + The earlier version from the diff operation. + + :return: The version_a of this VersionedFlowDifference. + :rtype: int + """ + return self._version_a + + @version_a.setter + def version_a(self, version_a): + """ + Sets the version_a of this VersionedFlowDifference. + The earlier version from the diff operation. + + :param version_a: The version_a of this VersionedFlowDifference. + :type: int + """ + + self._version_a = version_a + + @property + def version_b(self): + """ + Gets the version_b of this VersionedFlowDifference. + The latter version from the diff operation. + + :return: The version_b of this VersionedFlowDifference. + :rtype: int + """ + return self._version_b + + @version_b.setter + def version_b(self, version_b): + """ + Sets the version_b of this VersionedFlowDifference. + The latter version from the diff operation. + + :param version_b: The version_b of this VersionedFlowDifference. + :type: int + """ + + self._version_b = version_b + + @property + def component_difference_groups(self): + """ + Gets the component_difference_groups of this VersionedFlowDifference. + + :return: The component_difference_groups of this VersionedFlowDifference. + :rtype: list[ComponentDifferenceGroup] + """ + return self._component_difference_groups + + @component_difference_groups.setter + def component_difference_groups(self, component_difference_groups): + """ + Sets the component_difference_groups of this VersionedFlowDifference. + + :param component_difference_groups: The component_difference_groups of this VersionedFlowDifference. + :type: list[ComponentDifferenceGroup] + """ + + self._component_difference_groups = component_difference_groups + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, VersionedFlowDifference): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/nipyapi/registry/models/versioned_flow_snapshot.py b/nipyapi/registry/models/versioned_flow_snapshot.py index 53cdf37b..883e2f52 100644 --- a/nipyapi/registry/models/versioned_flow_snapshot.py +++ b/nipyapi/registry/models/versioned_flow_snapshot.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/versioned_flow_snapshot_metadata.py b/nipyapi/registry/models/versioned_flow_snapshot_metadata.py index a9a9799f..90170e1f 100644 --- a/nipyapi/registry/models/versioned_flow_snapshot_metadata.py +++ b/nipyapi/registry/models/versioned_flow_snapshot_metadata.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/registry/models/versioned_funnel.py b/nipyapi/registry/models/versioned_funnel.py index eb5b8bd2..1cbf8ed5 100644 --- a/nipyapi/registry/models/versioned_funnel.py +++ b/nipyapi/registry/models/versioned_funnel.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -34,7 +34,7 @@ class VersionedFunnel(object): 'identifier': 'str', 'name': 'str', 'comments': 'str', - 'position': 'ThePositionOfAComponentOnTheGraph', + 'position': 'Position', 'component_type': 'str', 'group_identifier': 'str' } @@ -149,7 +149,7 @@ def position(self): The component's position on the graph :return: The position of this VersionedFunnel. - :rtype: ThePositionOfAComponentOnTheGraph + :rtype: Position """ return self._position @@ -160,7 +160,7 @@ def position(self, position): The component's position on the graph :param position: The position of this VersionedFunnel. - :type: ThePositionOfAComponentOnTheGraph + :type: Position """ self._position = position diff --git a/nipyapi/registry/models/versioned_label.py b/nipyapi/registry/models/versioned_label.py index 2c339c2b..b264c56f 100644 --- a/nipyapi/registry/models/versioned_label.py +++ b/nipyapi/registry/models/versioned_label.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -34,7 +34,7 @@ class VersionedLabel(object): 'identifier': 'str', 'name': 'str', 'comments': 'str', - 'position': 'ThePositionOfAComponentOnTheGraph', + 'position': 'Position', 'label': 'str', 'width': 'float', 'height': 'float', @@ -169,7 +169,7 @@ def position(self): The component's position on the graph :return: The position of this VersionedLabel. - :rtype: ThePositionOfAComponentOnTheGraph + :rtype: Position """ return self._position @@ -180,7 +180,7 @@ def position(self, position): The component's position on the graph :param position: The position of this VersionedLabel. - :type: ThePositionOfAComponentOnTheGraph + :type: Position """ self._position = position diff --git a/nipyapi/registry/models/versioned_port.py b/nipyapi/registry/models/versioned_port.py index 30dc2579..12113fc1 100644 --- a/nipyapi/registry/models/versioned_port.py +++ b/nipyapi/registry/models/versioned_port.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -34,7 +34,7 @@ class VersionedPort(object): 'identifier': 'str', 'name': 'str', 'comments': 'str', - 'position': 'ThePositionOfAComponentOnTheGraph', + 'position': 'Position', 'type': 'str', 'concurrently_schedulable_task_count': 'int', 'component_type': 'str', @@ -159,7 +159,7 @@ def position(self): The component's position on the graph :return: The position of this VersionedPort. - :rtype: ThePositionOfAComponentOnTheGraph + :rtype: Position """ return self._position @@ -170,7 +170,7 @@ def position(self, position): The component's position on the graph :param position: The position of this VersionedPort. - :type: ThePositionOfAComponentOnTheGraph + :type: Position """ self._position = position diff --git a/nipyapi/registry/models/versioned_process_group.py b/nipyapi/registry/models/versioned_process_group.py index e2e29a64..8ea60db0 100644 --- a/nipyapi/registry/models/versioned_process_group.py +++ b/nipyapi/registry/models/versioned_process_group.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -34,7 +34,7 @@ class VersionedProcessGroup(object): 'identifier': 'str', 'name': 'str', 'comments': 'str', - 'position': 'ThePositionOfAComponentOnTheGraph', + 'position': 'Position', 'process_groups': 'list[VersionedProcessGroup]', 'remote_process_groups': 'list[VersionedRemoteProcessGroup]', 'processors': 'list[VersionedProcessor]', @@ -204,7 +204,7 @@ def position(self): The component's position on the graph :return: The position of this VersionedProcessGroup. - :rtype: ThePositionOfAComponentOnTheGraph + :rtype: Position """ return self._position @@ -215,7 +215,7 @@ def position(self, position): The component's position on the graph :param position: The position of this VersionedProcessGroup. - :type: ThePositionOfAComponentOnTheGraph + :type: Position """ self._position = position diff --git a/nipyapi/registry/models/versioned_processor.py b/nipyapi/registry/models/versioned_processor.py index d54620b4..719ee4cf 100644 --- a/nipyapi/registry/models/versioned_processor.py +++ b/nipyapi/registry/models/versioned_processor.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -34,7 +34,7 @@ class VersionedProcessor(object): 'identifier': 'str', 'name': 'str', 'comments': 'str', - 'position': 'ThePositionOfAComponentOnTheGraph', + 'position': 'Position', 'bundle': 'Bundle', 'style': 'dict(str, str)', 'type': 'str', @@ -224,7 +224,7 @@ def position(self): The component's position on the graph :return: The position of this VersionedProcessor. - :rtype: ThePositionOfAComponentOnTheGraph + :rtype: Position """ return self._position @@ -235,7 +235,7 @@ def position(self, position): The component's position on the graph :param position: The position of this VersionedProcessor. - :type: ThePositionOfAComponentOnTheGraph + :type: Position """ self._position = position diff --git a/nipyapi/registry/models/versioned_property_descriptor.py b/nipyapi/registry/models/versioned_property_descriptor.py index dd630f8e..384c3dd7 100644 --- a/nipyapi/registry/models/versioned_property_descriptor.py +++ b/nipyapi/registry/models/versioned_property_descriptor.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -33,16 +33,18 @@ class VersionedPropertyDescriptor(object): swagger_types = { 'name': 'str', 'display_name': 'str', - 'identifies_controller_service': 'bool' + 'identifies_controller_service': 'bool', + 'sensitive': 'bool' } attribute_map = { 'name': 'name', 'display_name': 'displayName', - 'identifies_controller_service': 'identifiesControllerService' + 'identifies_controller_service': 'identifiesControllerService', + 'sensitive': 'sensitive' } - def __init__(self, name=None, display_name=None, identifies_controller_service=None): + def __init__(self, name=None, display_name=None, identifies_controller_service=None, sensitive=None): """ VersionedPropertyDescriptor - a model defined in Swagger """ @@ -50,6 +52,7 @@ def __init__(self, name=None, display_name=None, identifies_controller_service=N self._name = None self._display_name = None self._identifies_controller_service = None + self._sensitive = None if name is not None: self.name = name @@ -57,6 +60,8 @@ def __init__(self, name=None, display_name=None, identifies_controller_service=N self.display_name = display_name if identifies_controller_service is not None: self.identifies_controller_service = identifies_controller_service + if sensitive is not None: + self.sensitive = sensitive @property def name(self): @@ -127,6 +132,29 @@ def identifies_controller_service(self, identifies_controller_service): self._identifies_controller_service = identifies_controller_service + @property + def sensitive(self): + """ + Gets the sensitive of this VersionedPropertyDescriptor. + Whether or not the property is considered sensitive + + :return: The sensitive of this VersionedPropertyDescriptor. + :rtype: bool + """ + return self._sensitive + + @sensitive.setter + def sensitive(self, sensitive): + """ + Sets the sensitive of this VersionedPropertyDescriptor. + Whether or not the property is considered sensitive + + :param sensitive: The sensitive of this VersionedPropertyDescriptor. + :type: bool + """ + + self._sensitive = sensitive + def to_dict(self): """ Returns the model properties as a dict diff --git a/nipyapi/registry/models/versioned_remote_group_port.py b/nipyapi/registry/models/versioned_remote_group_port.py index 7fcea4fb..fdfbe768 100644 --- a/nipyapi/registry/models/versioned_remote_group_port.py +++ b/nipyapi/registry/models/versioned_remote_group_port.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -34,7 +34,7 @@ class VersionedRemoteGroupPort(object): 'identifier': 'str', 'name': 'str', 'comments': 'str', - 'position': 'ThePositionOfAComponentOnTheGraph', + 'position': 'Position', 'remote_group_id': 'str', 'concurrently_schedulable_task_count': 'int', 'use_compression': 'bool', @@ -174,7 +174,7 @@ def position(self): The component's position on the graph :return: The position of this VersionedRemoteGroupPort. - :rtype: ThePositionOfAComponentOnTheGraph + :rtype: Position """ return self._position @@ -185,7 +185,7 @@ def position(self, position): The component's position on the graph :param position: The position of this VersionedRemoteGroupPort. - :type: ThePositionOfAComponentOnTheGraph + :type: Position """ self._position = position diff --git a/nipyapi/registry/models/versioned_remote_process_group.py b/nipyapi/registry/models/versioned_remote_process_group.py index 3a42b3ad..83390872 100644 --- a/nipyapi/registry/models/versioned_remote_process_group.py +++ b/nipyapi/registry/models/versioned_remote_process_group.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -34,7 +34,7 @@ class VersionedRemoteProcessGroup(object): 'identifier': 'str', 'name': 'str', 'comments': 'str', - 'position': 'ThePositionOfAComponentOnTheGraph', + 'position': 'Position', 'target_uri': 'str', 'target_uris': 'str', 'communications_timeout': 'str', @@ -204,7 +204,7 @@ def position(self): The component's position on the graph :return: The position of this VersionedRemoteProcessGroup. - :rtype: ThePositionOfAComponentOnTheGraph + :rtype: Position """ return self._position @@ -215,7 +215,7 @@ def position(self, position): The component's position on the graph :param position: The position of this VersionedRemoteProcessGroup. - :type: ThePositionOfAComponentOnTheGraph + :type: Position """ self._position = position diff --git a/nipyapi/registry/rest.py b/nipyapi/registry/rest.py index 521d07e7..2aac91d9 100644 --- a/nipyapi/registry/rest.py +++ b/nipyapi/registry/rest.py @@ -5,7 +5,7 @@ The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components. - OpenAPI spec version: 0.2.0-SNAPSHOT + OpenAPI spec version: 0.2.0 Contact: dev@nifi.apache.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/nipyapi/utils.py b/nipyapi/utils.py index 677cd111..a2af031b 100644 --- a/nipyapi/utils.py +++ b/nipyapi/utils.py @@ -219,15 +219,15 @@ def wait_to_complete(test_function, *args, **kwargs): max_wait = kwargs.pop('nipyapi_max_wait', nipyapi.config.short_max_wait) timeout = time.time() + max_wait while time.time() < timeout: - log.debug("- Calling test_function") + log.debug("Calling test_function") test_result = test_function(*args, **kwargs) - log.debug("- Checking result") + log.debug("Checking result") if test_result: - log.info("- Function output evaluated to True, returning output") + log.info("Function output evaluated to True, returning output") return test_result - log.info("- Function output evaluated to False, sleeping...") + log.info("Function output evaluated to False, sleeping...") time.sleep(delay) - log.info("- Hit Timeout, raising TimeOut Error") + log.info("Hit Timeout, raising TimeOut Error") raise ValueError("Timed Out waiting for {0} to complete".format( test_function.__name__)) @@ -244,16 +244,15 @@ def is_endpoint_up(endpoint_url): """ log.info("Called is_endpoint_up with args %s", locals()) try: - log.debug("- Calling endpoint") response = requests.get(endpoint_url) if response.status_code == 200: - log.info("- Got 200, returning True") + log.info("Got 200 response from endpoint, returning True") return True - log.info("- Got status code %s, returning False", + log.info("Got status code %s from endpoint, returning False", response.status_code) return False except requests.ConnectionError: - log.info("- Got ConnectionError, returning False") + log.info("Got ConnectionError, returning False") return False diff --git a/nipyapi/versioning.py b/nipyapi/versioning.py index 6530992f..5bb43781 100644 --- a/nipyapi/versioning.py +++ b/nipyapi/versioning.py @@ -5,6 +5,7 @@ """ from __future__ import absolute_import +import logging import six import nipyapi # Due to line lengths, creating shortened names for these objects @@ -22,6 +23,8 @@ 'deploy_flow_version' ] +log = logging.getLogger(__name__) + def create_registry_client(name, uri, description): """ @@ -35,6 +38,9 @@ def create_registry_client(name, uri, description): Returns: (RegistryClientEntity): The new registry client object """ + assert isinstance(uri, six.string_types) and uri is not False + assert isinstance(name, six.string_types) and name is not False + assert isinstance(description, six.string_types) try: return nipyapi.nifi.ControllerApi().create_registry_client( body={ @@ -52,20 +58,28 @@ def create_registry_client(name, uri, description): raise ValueError(e.body) -def delete_registry_client(client): +def delete_registry_client(client, refresh=True): """ Deletes a Registry Client from the list of NiFI Controller Services Args: client (RegistryClientEntity): The client to delete + refresh (bool): Whether to refresh the object before action Returns: (RegistryClientEntity): The updated client object """ + assert isinstance(client, nipyapi.nifi.RegistryClientEntity) try: + if refresh: + target = nipyapi.nifi.ControllerApi().get_registry_client( + client.id + ) + else: + target = client return nipyapi.nifi.ControllerApi().delete_registry_client( - id=client.id, - version=client.revision.version + id=target.id, + version=target.revision.version ) except (nipyapi.nifi.rest.ApiException, AttributeError) as e: raise ValueError(e) @@ -127,11 +141,15 @@ def create_registry_bucket(name): (Bucket): The new Bucket object """ try: - return nipyapi.registry.BucketsApi().create_bucket( + bucket = nipyapi.registry.BucketsApi().create_bucket( body={ 'name': name } ) + log.debug("Created bucket %s against registry connection at %s", + bucket.identifier, + nipyapi.config.registry_config.api_client.host) + return bucket except nipyapi.registry.rest.ApiException as e: raise ValueError(e.body) @@ -221,9 +239,9 @@ def save_flow_ver(process_group, registry_client, bucket, flow_name=None, registry_client (RegistryClient): The Client linked to the Registry which contains the Bucket to save to bucket (Bucket): the Bucket on the NiFi Registry to save to + flow_name (str): A name for the VersionedFlow in the Bucket Note you need either a name for a new VersionedFlow, or the ID of an existing one to save a new version - flow_name (str): A name for the VersionedFlow in the Bucket flow_id (Optional [str]): Identifier of an existing VersionedFlow in the bucket, if saving a new version to an existing flow comment (str): A comment for the version commit @@ -698,11 +716,11 @@ def deploy_flow_version(parent_id, location, bucket_id, flow_id, reg_client_id, new process group in. location (tuple[x, y]): the x,y coordinates to place the new Process Group under the parent - bucket_id (str): ID of the bucket containing the versioned flow to deploy. + bucket_id (str): ID of the bucket containing the versioned flow to + deploy. flow_id (str): ID of the versioned flow to deploy. - registry_id (str): ID of the Registry client configured in NiFi. - version (Optional [int]): version to deploy, if not provided latest version - will be deployed. + version (Optional [int]): version to deploy, if not provided latest + version will be deployed. Returns: (ProcessGroupEntity) of the newly deployed Process Group diff --git a/test_env_config/docker_compose_full_test/docker-compose.yml b/test_env_config/docker_compose_full_test/docker-compose.yml index 7fd7ba91..ef7bf57d 100644 --- a/test_env_config/docker_compose_full_test/docker-compose.yml +++ b/test_env_config/docker_compose_full_test/docker-compose.yml @@ -15,13 +15,6 @@ services: container_name: nifi-140 ports: - "10140:8080" - nifi-150: - image: apache/nifi:1.5.0 - container_name: nifi-150 - ports: - - "10150:10150" - environment: - - NIFI_WEB_HTTP_PORT=10150 nifi-160: image: apache/nifi:1.6.0 container_name: nifi-160 @@ -29,6 +22,15 @@ services: - "8080:8080" registry-010: image: apache/nifi-registry:0.1.0 - container_name: registry + container_name: registry-010 ports: - - "18080:18080" + - "18010:18010" + environment: + - NIFI_REGISTRY_WEB_HTTP_PORT=18010 + registry-020: + image: apache/nifi-registry:0.2.0 + container_name: registry-020 + ports: + - "18020:18020" + environment: + - NIFI_REGISTRY_WEB_HTTP_PORT=18020 diff --git a/tests/conftest.py b/tests/conftest.py index be1e9036..3103fddb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,7 +13,7 @@ log = logging.getLogger(__name__) # Test Configuration parameters -test_docker_registry_endpoint = 'http://registry:18080' +test_host = 'localhost' test_basename = "nipyapi_test" test_pg_name = test_basename + "_ProcessGroup" test_registry_client_name = test_basename + "_reg_client" @@ -37,71 +37,159 @@ 'complex': test_basename + 'Template_01' } - # Determining test environment # Can't use skiptest with parametrize for Travis # Mostly because loading up all the environments takes too long if "TRAVIS" in environ and environ["TRAVIS"] == "true": - print("Running tests on TRAVIS, skipping regression suite") - nifi_test_endpoints = [nipyapi.config.nifi_config.host] - registry_test_endpoints = [nipyapi.config.registry_config.host] + log.info("Running tests on TRAVIS, skipping regression suite") + nifi_test_endpoints = ['http://localhost:8080/nifi-api'] + registry_test_endpoints = [ + ('http://localhost:18080/nifi-registry-api', + 'http://registry:18080', + 'http://localhost:8080/nifi-api' + ) + ] else: - print("Running tests on NOT TRAVIS, enabling regression suite") + log.info("Running tests on NOT TRAVIS, enabling regression suite") + # Note that these endpoints are assumed to be available + # look in Nipyapi/test_env_config/docker_compose_full_test for + # convenient Docker configs and port mappings. + + # NOTE: it is important that the latest version is the last in the list + # So that after a parametrized test we leave the single tests against + # The latest release without bulking the test suite ensuring they change + # back each time. nifi_test_endpoints = [ - 'http://localhost:10112/nifi-api', # add earlier as required - 'http://localhost:10120/nifi-api', - 'http://localhost:10140/nifi-api', - 'http://localhost:10150/nifi-api', - nipyapi.config.nifi_config.host # reset to default - ] - registry_test_endpoints = [nipyapi.config.registry_config.host] - - -# 'regress' generates tests against previous versions of NiFi + 'http://' + test_host + ':10112/nifi-api', + 'http://' + test_host + ':10120/nifi-api', + 'http://' + test_host + ':10140/nifi-api', + 'http://' + test_host + ':8080/nifi-api' # Default to latest + ] + # These are paired into api & docker labels with a paired nifi instance + registry_test_endpoints = [ + ('http://' + test_host + ':18010/nifi-registry-api', + 'http://registry-010:18010', + 'http://' + test_host + ':8080/nifi-api' + ), + ('http://' + test_host + ':18020/nifi-registry-api', + 'http://registry-020:18020', + 'http://' + test_host + ':8080/nifi-api' + ) # Default to latest version + ] + + +# 'regress' generates tests against previous versions of NiFi or sub-projects. # If you are using regression, note that you have to create NiFi objects within # the Test itself. This is because the fixture is generated before the # PyTest parametrize call, making the order # new test_func > fixtures > parametrize > run_test_func > teardown > next def pytest_generate_tests(metafunc): - if 'regress' in metafunc.fixturenames: - # print("Regression testing requested for ({0})." - # .format(metafunc.function.__name__)) + log.info("Metafunc Fixturenames are %s", metafunc.fixturenames) + if 'regress_nifi' in metafunc.fixturenames: + log.info("NiFi Regression testing requested for ({0})." + .format(metafunc.function.__name__)) metafunc.parametrize( - argnames='regress', + argnames='regress_nifi', argvalues=nifi_test_endpoints, indirect=True ) + elif 'regress_flow_reg' in metafunc.fixturenames: + log.info("NiFi Flow Registry Regression testing requested for ({0})." + .format(metafunc.function.__name__)) + metafunc.parametrize( + argnames='regress_flow_reg', + argvalues=registry_test_endpoints, + indirect=True + ) + + +# Note that it's important that the regress function is the first called if +# you are stacking fixtures +@pytest.fixture(scope="function") +def regress_nifi(request): + log.info("NiFi Regression test setup called against endpoint %s", + request.param) + nipyapi.utils.set_endpoint(request.param) + + +def remove_test_registry_client(): + _ = [nipyapi.versioning.delete_registry_client(li) for + li in nipyapi.versioning.list_registry_clients().registries + if test_registry_client_name in li.component.name + ] + + +def ensure_registry_client(uri): + client = nipyapi.versioning.create_registry_client( + name=test_registry_client_name + uri, + uri=uri, + description=uri + ) + if isinstance(client, nipyapi.nifi.RegistryClientEntity): + return client + else: + raise ValueError("Could not create Registry Client") @pytest.fixture(scope="function") -def regress(request): - # print("\nSetting nifi endpoint to ({0}).".format(request.param)) - nipyapi.config.nifi_config.api_client.host = request.param +def regress_flow_reg(request): + log.info("NiFi-Registry regression test called against endpoints %s", + request.param) + # Set Registry connection + nipyapi.utils.set_endpoint(request.param[0]) + # Set paired NiFi connection + nipyapi.utils.set_endpoint(request.param[2]) + # because pytest won't let you eaily cascade parameters through fixtures + # we set the docker URI in the config for retrieval later on + nipyapi.config.registry_local_name = request.param[1] # Tests that the Docker test environment is available before running test suite @pytest.fixture(scope="session", autouse=True) def session_setup(request): - for url in nifi_test_endpoints + registry_test_endpoints: + log.info("Commencing test session setup") + for url in nifi_test_endpoints + [x[0] for x in registry_test_endpoints]: nipyapi.utils.set_endpoint(url) target_url = url.replace('-api', '') - if not nipyapi.utils.wait_to_complete(nipyapi.utils.is_endpoint_up, - target_url, - nipyapi_delay=5, - nipyapi_max_wait=60): + if not nipyapi.utils.wait_to_complete( + nipyapi.utils.is_endpoint_up, + target_url, + nipyapi_delay=nipyapi.config.long_retry_delay, + nipyapi_max_wait=nipyapi.config.long_max_wait): pytest.exit( "Expected Service endpoint ({0}) is not responding" .format(target_url) ) - # This cleans each environment at the start of the session - cleanup() - request.addfinalizer(cleanup) + else: + # Test API client connection + if 'nifi-api' in url: + if nipyapi.canvas.get_root_pg_id(): + log.info("Tested Nifi client connection for test suite to" + "service endpoint at %s", url) + cleanup() + request.addfinalizer(cleanup) + else: + raise ValueError("No Response from NiFi test call") + elif 'nifi-registry-api' in url: + if nipyapi.registry.FlowsApi().get_available_flow_fields(): + log.info("Tested NiFi-Registry client connection, got " + "response from %s", url) + cleanup_reg() + request.addfinalizer(cleanup_reg) + else: + raise ValueError("No Response from NiFi-Registry test call" + ) + else: + raise ValueError("Bad API Endpoint") + log.info("Completing Test Session Setup") def remove_test_templates(): - for this_template in nipyapi.templates.list_all_templates().templates: - if test_basename in this_template.template.name: - nipyapi.templates.delete_template(this_template.id) + all_templates = nipyapi.templates.list_all_templates().templates + if all_templates is not None: + for this_template in all_templates: + if test_basename in this_template.template.name: + nipyapi.templates.delete_template(this_template.id) def remove_test_pgs(): @@ -132,13 +220,6 @@ def remove_test_processors(): nipyapi.canvas.delete_processor(target, force=True) -def remove_test_registry_client(): - _ = [nipyapi.versioning.delete_registry_client(li) for - li in nipyapi.versioning.list_registry_clients().registries - if test_registry_client_name in li.component.name - ] - - def remove_test_buckets(): _ = [nipyapi.versioning.delete_registry_bucket(li) for li in nipyapi.versioning.list_registry_buckets() if @@ -149,11 +230,20 @@ def cleanup(): # Only bulk-cleanup universally compatible components # Ideally we would clean each test environment, but it's too slow to do it # per test, so we rely on individual fixture cleanup + log.info("Running bulk cleanup on %s", + nipyapi.config.nifi_config.api_client.host) remove_test_templates() remove_test_processors() remove_test_pgs() +def cleanup_reg(): + # Bulk cleanup for tests involving NiFi Registry + remove_test_pgs() + remove_test_buckets() + remove_test_registry_client() + + @pytest.fixture(name='fix_templates', scope='function') def fixture_templates(request, fix_pg): log.info("Creating PyTest Fixture fix_templates on endpoint %s", @@ -187,12 +277,6 @@ def fixture_templates(request, fix_pg): return out -@pytest.fixture() -def regress(request): - # print("\nSetting nifi endpoint to ({0}).".format(request.param)) - nipyapi.config.nifi_config.api_client.host = request.param - - @pytest.fixture(name='fix_pg') def fixture_pg(request): class Dummy: @@ -216,17 +300,6 @@ def generate(self, parent_pg=None, suffix=''): return Dummy() -@pytest.fixture(name='fix_reg_client') -def fixture_reg_client(request): - request.addfinalizer(remove_test_registry_client) - remove_test_registry_client() - return nipyapi.versioning.create_registry_client( - name=test_registry_client_name, - uri=test_docker_registry_endpoint, - description='NiPyApi Test Wrapper' - ) - - @pytest.fixture(name='fix_proc') def fixture_proc(request): class Dummy: @@ -260,47 +333,54 @@ def generate(self, parent_pg=None, suffix='', valid=True): return Dummy() -@pytest.fixture(name='fix_bucket') -def fixture_bucket(request, fix_reg_client): +@pytest.fixture(name='fix_bucket', scope='function') +def fixture_bucket(request): + class Dummy: + def __init__(self): + pass + + def __call__(self, name=test_bucket_name, suffix=''): + return nipyapi.versioning.create_registry_bucket( + test_bucket_name + suffix + ) request.addfinalizer(remove_test_buckets) - remove_test_buckets() - FixtureBucket = namedtuple( - 'FixtureBucket', ('client', 'bucket') - ) - return FixtureBucket( - client=fix_reg_client, - bucket=nipyapi.versioning.create_registry_bucket(test_bucket_name) - ) + return Dummy() -@pytest.fixture(name='fix_ver_flow') -def fixture_ver_flow(fix_bucket, fix_pg, fix_proc): +@pytest.fixture(name='fix_ver_flow', scope='function') +def fixture_ver_flow(request, fix_bucket, fix_pg, fix_proc): + log.info("Starting setup of Fixture fix_ver_flow") FixtureVerFlow = namedtuple( - 'FixtureVerFlow', getattr(fix_bucket, '_fields') + ( - 'pg', 'proc', 'info', 'flow', 'snapshot', 'dto') + 'FixtureVerFlow', ('client', 'bucket', 'pg', 'proc', 'info', + 'flow', 'snapshot', 'dto') ) + f_reg_client = ensure_registry_client(nipyapi.config.registry_local_name) f_pg = fix_pg.generate() + f_bucket = fix_bucket() f_proc = fix_proc.generate(parent_pg=f_pg) f_info = nipyapi.versioning.save_flow_ver( process_group=f_pg, - registry_client=fix_bucket.client, - bucket=fix_bucket.bucket, + registry_client=f_reg_client, + bucket=f_bucket, flow_name=test_versioned_flow_name, comment='NiPyApi Test', desc='NiPyApi Test' ) f_flow = nipyapi.versioning.get_flow_in_bucket( - bucket_id=fix_bucket.bucket.identifier, + bucket_id=f_bucket.identifier, identifier=f_info.version_control_information.flow_id, identifier_type='id' ) f_snapshot = nipyapi.versioning.get_latest_flow_ver( - fix_bucket.bucket.identifier, + f_bucket.identifier, f_flow.identifier ) f_dto = ('registry', 'VersionedFlowSnapshot') + request.addfinalizer(cleanup_reg) + log.info("Finished setting up Fixture fix_ver_flow") return FixtureVerFlow( - *fix_bucket, + client=f_reg_client, + bucket=f_bucket, pg=f_pg, proc=f_proc, info=f_info, @@ -310,8 +390,8 @@ def fixture_ver_flow(fix_bucket, fix_pg, fix_proc): ) -@pytest.fixture(name='fix_flow_serde') -def fixture_flow_serde(tmpdir, fix_ver_flow): +@pytest.fixture(name='fix_flow_serde', scope='function') +def fixture_flow_serde(request, tmpdir, fix_ver_flow): FixtureFlowSerde = namedtuple( 'FixtureFlowSerde', getattr(fix_ver_flow, '_fields') + ('filepath', 'json', 'yaml', 'raw') @@ -335,6 +415,7 @@ def fixture_flow_serde(tmpdir, fix_ver_flow): file_path=f_filepath + '.yaml', mode='yaml' ) + request.addfinalizer(cleanup_reg) return FixtureFlowSerde( *fix_ver_flow, filepath=f_filepath, @@ -344,8 +425,8 @@ def fixture_flow_serde(tmpdir, fix_ver_flow): ) -@pytest.fixture(name='fix_ctv') -def fixture_complex_template_versioning(fix_ver_flow): +@pytest.fixture(name='fix_ctv', scope='function') +def fixture_complex_template_versioning(request, fix_ver_flow): FixtureCTV = namedtuple( 'FixtureCTV', getattr(fix_ver_flow, '_fields') + ( 'template', 'info_w_template', 'snapshot_w_template' @@ -380,6 +461,8 @@ def fixture_complex_template_versioning(fix_ver_flow): fix_ver_flow.bucket.identifier, fix_ver_flow.flow.identifier ) + request.addfinalizer(cleanup) + request.addfinalizer(cleanup_reg) return FixtureCTV( *fix_ver_flow, template=f_template, diff --git a/tests/test_canvas.py b/tests/test_canvas.py index 45599f95..7fb3b045 100644 --- a/tests/test_canvas.py +++ b/tests/test_canvas.py @@ -16,7 +16,7 @@ def test_get_root_pg_id(): assert isinstance(r, str) -def test_get_process_group_status(regress): +def test_get_process_group_status(regress_nifi): r = canvas.get_process_group_status(pg_id='root', detail='names') assert isinstance(r, dict) r = canvas.get_process_group_status('root', 'all') @@ -35,7 +35,7 @@ def test_get_flow(): _ = canvas.get_flow('definitelyNotAPG') -def test_recurse_flow(fix_pg, regress): +def test_recurse_flow(regress_nifi, fix_pg): _ = fix_pg.generate() r = canvas.recurse_flow('root') assert isinstance(r, ProcessGroupFlowEntity) @@ -46,7 +46,7 @@ def test_recurse_flow(fix_pg, regress): ) -def test_list_all_process_groups(fix_pg, regress): +def test_list_all_process_groups(regress_nifi, fix_pg): _ = fix_pg.generate() r = canvas.list_all_process_groups() assert isinstance(r, list) @@ -54,7 +54,7 @@ def test_list_all_process_groups(fix_pg, regress): assert isinstance(pg, ProcessGroupEntity) -def test_create_process_group(regress): +def test_create_process_group(regress_nifi): r = canvas.create_process_group( parent_pg=canvas.get_process_group(canvas.get_root_pg_id(), 'id'), new_pg_name=conftest.test_pg_name, @@ -74,7 +74,7 @@ def test_create_process_group(regress): ) -def test_get_process_group(fix_pg, regress): +def test_get_process_group(regress_nifi, fix_pg): with pytest.raises(AssertionError): _ = canvas.get_process_group('nipyapi_test', 'invalid') f_pg = fix_pg.generate() @@ -89,7 +89,7 @@ def test_get_process_group(fix_pg, regress): assert len(pg_list) == 3 -def test_delete_process_group(fix_pg, regress, fix_proc): +def test_delete_process_group(regress_nifi, fix_pg, fix_proc): # Delete stopped PG f_pg1 = fix_pg.generate() r1 = canvas.delete_process_group(f_pg1) @@ -134,13 +134,13 @@ def test_schedule_process_group(fix_proc, fix_pg): ) -def test_list_all_processor_types(regress): +def test_list_all_processor_types(regress_nifi): r = canvas.list_all_processor_types() assert isinstance(r, ProcessorTypesEntity) assert len(r.processor_types) > 1 -def test_get_processor_type(regress): +def test_get_processor_type(regress_nifi): r1 = canvas.get_processor_type('twitter') assert r1.type == 'org.apache.nifi.processors.twitter.GetTwitter' assert isinstance(r1, DocumentedTypeDTO) @@ -151,7 +151,7 @@ def test_get_processor_type(regress): assert len(r3) > 10 -def test_create_processor(fix_pg, regress): +def test_create_processor(regress_nifi, fix_pg): f_pg = fix_pg.generate() r1 = canvas.create_processor( parent_pg=f_pg, @@ -163,7 +163,7 @@ def test_create_processor(fix_pg, regress): assert r1.status.name == conftest.test_processor_name -def test_list_all_processors(fix_proc, regress): +def test_list_all_processors(regress_nifi, fix_proc): _ = fix_proc.generate() _ = fix_proc.generate() r = canvas.list_all_processors() @@ -171,7 +171,7 @@ def test_list_all_processors(fix_proc, regress): assert isinstance(r[0], nifi.ProcessorEntity) -def test_get_processor(fix_proc, regress): +def test_get_processor(regress_nifi, fix_proc): f_p1 = fix_proc.generate() r1 = canvas.get_processor(f_p1.status.name) assert isinstance(r1, nifi.ProcessorEntity) @@ -185,21 +185,22 @@ def test_get_processor(fix_proc, regress): assert r4.id != r1.id -def test_schedule_processor(fix_proc): +def test_schedule_processor(regress_nifi, fix_proc): f_p1 = fix_proc.generate() r1 = canvas.schedule_processor( f_p1, True ) - status = canvas.get_processor(f_p1.id, 'id') + processor_info = canvas.get_processor(f_p1.id, 'id') assert r1 is True - assert status.status.run_status == 'Running' + assert isinstance(processor_info, nifi.ProcessorEntity) + assert processor_info.component.state == 'RUNNING' r2 = canvas.schedule_processor( f_p1, False ) status = canvas.get_processor(f_p1.id, 'id') - assert status.status.run_status == 'Stopped' + assert status.component.state == 'STOPPED' assert r2 is True with pytest.raises(AssertionError): _ = canvas.schedule_processor( @@ -208,7 +209,7 @@ def test_schedule_processor(fix_proc): ) -def test_delete_processor(fix_proc, regress): +def test_delete_processor(regress_nifi, fix_proc): f_p1 = fix_proc.generate() r1 = canvas.delete_processor(f_p1) assert r1.status is None @@ -226,7 +227,7 @@ def test_delete_processor(fix_proc, regress): assert r2.status is None -def test_update_processor(fix_proc, regress): +def test_update_processor(regress_nifi, fix_proc): # TODO: Add way more tests to this f_p1 = fix_proc.generate() update = nifi.ProcessorConfigDTO( diff --git a/tests/test_system.py b/tests/test_system.py index 2f8943fb..e318e2c1 100644 --- a/tests/test_system.py +++ b/tests/test_system.py @@ -8,7 +8,7 @@ from nipyapi.nifi import models -def test_get_nifi_version_info(regress): +def test_get_nifi_version_info(regress_nifi): r = system.get_nifi_version_info() assert isinstance(r, models.version_info_dto.VersionInfoDTO) assert "ni_fi_version" in r.to_dict().keys() diff --git a/tests/test_templates.py b/tests/test_templates.py index defbc170..87362d49 100644 --- a/tests/test_templates.py +++ b/tests/test_templates.py @@ -15,7 +15,7 @@ from StringIO import StringIO -def test_upload_template(fix_templates, regress): +def test_upload_template(regress_nifi, fix_templates): pg = fix_templates.pg.generate() r0 = nipyapi.templates.upload_template( pg_id=pg.id, @@ -55,7 +55,7 @@ def test_upload_template(fix_templates, regress): ) -def test_all_templates(fix_templates, regress): +def test_all_templates(regress_nifi, fix_templates): pg = fix_templates.pg.generate() _ = nipyapi.templates.upload_template( pg.id, @@ -66,7 +66,7 @@ def test_all_templates(fix_templates, regress): assert len(r.templates) > 0 -def test_get_templates_by_name(fix_templates, regress): +def test_get_templates_by_name(regress_nifi, fix_templates): pg = fix_templates.pg.generate() _ = nipyapi.templates.upload_template( pg.id, @@ -77,7 +77,7 @@ def test_get_templates_by_name(fix_templates, regress): assert isinstance(r, nipyapi.nifi.TemplateEntity) -def test_deploy_template(fix_templates, regress): +def test_deploy_template(regress_nifi, fix_templates): pg = fix_templates.pg.generate() t1 = nipyapi.templates.upload_template( pg.id, @@ -90,13 +90,13 @@ def test_deploy_template(fix_templates, regress): assert isinstance(r, nipyapi.nifi.FlowEntity) -def test_get_snippet(fix_pg, regress): +def test_get_snippet(regress_nifi, fix_pg): t_pg = fix_pg.generate() r = nipyapi.templates.create_pg_snippet(t_pg.id) assert isinstance(r, nipyapi.nifi.SnippetEntity) -def test_create_template(fix_pg, regress): +def test_create_template(regress_nifi, fix_pg): t_pg = fix_pg.generate() r = nipyapi.templates.create_template( pg_id=t_pg.id, @@ -106,7 +106,7 @@ def test_create_template(fix_pg, regress): assert isinstance(r, nipyapi.nifi.TemplateEntity) -def test_export_template(fix_templates, regress): +def test_export_template(regress_nifi, fix_templates): pg = fix_templates.pg.generate() t1 = nipyapi.templates.upload_template( pg.id, @@ -135,7 +135,7 @@ def test_export_template(fix_templates, regress): ) -def test_delete_template(fix_templates, regress): +def test_delete_template(regress_nifi, fix_templates): pg = fix_templates.pg.generate() t1 = nipyapi.templates.upload_template( pg.id, diff --git a/tests/test_utils.py b/tests/test_utils.py index 34cdc4e3..7211a9eb 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -12,7 +12,7 @@ from nipyapi import utils, nifi -def test_dump(fix_flow_serde): +def test_dump(regress_flow_reg, fix_flow_serde): # Testing that we don't modify or lose information in the round trip # Processing in memory for json export_obj = json.loads(fix_flow_serde.raw) @@ -41,7 +41,7 @@ def test_dump(fix_flow_serde): ) == {} -def test_load(fix_flow_serde): +def test_load(regress_flow_reg, fix_flow_serde): # Validating load testing again in case we break the 'dump' test r1 = utils.load( obj=fix_flow_serde.json, diff --git a/tests/test_versioning.py b/tests/test_versioning.py index f84dcd03..a31c3a3d 100644 --- a/tests/test_versioning.py +++ b/tests/test_versioning.py @@ -7,10 +7,10 @@ import pytest from deepdiff import DeepDiff from tests import conftest -from nipyapi import registry, config, nifi, versioning, canvas, utils, templates +from nipyapi import registry, nifi, versioning, canvas, utils, config -def test_create_registry_client(): +def test_create_registry_client(regress_flow_reg): # First remove any leftover test client connections [versioning.delete_registry_client(li) for li in versioning.list_registry_clients().registries @@ -18,7 +18,7 @@ def test_create_registry_client(): ] r = versioning.create_registry_client( name=conftest.test_registry_client_name, - uri=conftest.test_docker_registry_endpoint, + uri=conftest.registry_test_endpoints[0][0], description='a test connection' ) assert isinstance(r, nifi.RegistryClientEntity) @@ -26,28 +26,21 @@ def test_create_registry_client(): with pytest.raises(ValueError): _ = versioning.create_registry_client( name=conftest.test_registry_client_name, - uri=conftest.test_docker_registry_endpoint, + uri=conftest.registry_test_endpoints[0][0], description='who cares?' ) -def test_list_registry_clients(fix_reg_client): +def test_list_registry_clients(): r = versioning.list_registry_clients() assert isinstance(r, nifi.RegistryClientsEntity) -def test_delete_registry_client(fix_reg_client): - r = versioning.delete_registry_client(fix_reg_client) - assert isinstance(r, nifi.RegistryClientEntity) - assert r.uri is None - assert r.component.name == conftest.test_registry_client_name - with pytest.raises(ValueError): - _ = versioning.delete_registry_client('FakeClient') - # TODO Add test for when a PG is attached to the client - - -def test_get_registry_client(fix_reg_client): - r1 = versioning.get_registry_client(conftest.test_registry_client_name) +def test_get_registry_client(): + f_reg_client = versioning.get_registry_client( + conftest.test_registry_client_name + ) + r1 = versioning.get_registry_client(f_reg_client.component.name) assert isinstance(r1, nifi.RegistryClientEntity) assert r1.component.name == conftest.test_registry_client_name r2 = versioning.get_registry_client(r1.id, 'id') @@ -56,30 +49,48 @@ def test_get_registry_client(fix_reg_client): _ = versioning.get_registry_client('', 'NotIDorName') -def test_list_registry_buckets(fix_bucket): +def test_delete_registry_client(): + f_reg_client = versioning.get_registry_client( + conftest.test_registry_client_name + ) + r = versioning.delete_registry_client(f_reg_client) + assert isinstance(r, nifi.RegistryClientEntity) + assert r.uri is None + assert r.component.name == conftest.test_registry_client_name + with pytest.raises(AssertionError): + _ = versioning.delete_registry_client('FakeClient') + # TODO Add test for when a PG is attached to the client + + +def test_list_registry_buckets(regress_flow_reg, fix_bucket): + _ = fix_bucket() r = versioning.list_registry_buckets() assert isinstance(r, list) assert len(r) >= 1 -def test_create_registry_bucket(fix_reg_client): +def test_create_registry_bucket(regress_flow_reg, fix_bucket): + # We include fix_bucket to handle the cleanup r = versioning.create_registry_bucket(conftest.test_bucket_name) assert isinstance(r, registry.Bucket) assert r.name == conftest.test_bucket_name # Bucket names are unique with pytest.raises(ValueError) as v: _ = versioning.create_registry_bucket(conftest.test_bucket_name) + # Cleanup, as no test fixture to do so here -def test_delete_registry_bucket(fix_bucket): - r = versioning.delete_registry_bucket(fix_bucket.bucket) - assert r.identifier == fix_bucket.bucket.identifier +def test_delete_registry_bucket(regress_flow_reg, fix_bucket): + f_bucket = fix_bucket() + r = versioning.delete_registry_bucket(f_bucket) + assert r.identifier == f_bucket.identifier with pytest.raises(ValueError): _ = versioning.delete_registry_bucket('FakeNews') -def test_get_registry_bucket(fix_bucket): - r1 = versioning.get_registry_bucket(conftest.test_bucket_name) +def test_get_registry_bucket(regress_flow_reg, fix_bucket): + f_bucket = fix_bucket() + r1 = versioning.get_registry_bucket(f_bucket.name) assert r1.name == conftest.test_bucket_name r2 = versioning.get_registry_bucket(r1.identifier, 'id') assert r2.name == r1.name @@ -89,12 +100,18 @@ def test_get_registry_bucket(fix_bucket): assert r3 is None -def test_save_flow_ver(fix_bucket, fix_pg, fix_proc): +def test_save_flow_ver(regress_flow_reg, fix_bucket, fix_pg, fix_proc): + f_reg_client = conftest.ensure_registry_client( + config.registry_local_name + ) + f_bucket = fix_bucket() f_pg = fix_pg.generate() + test_bucket = versioning.get_registry_bucket(f_bucket.identifier, 'id') + assert test_bucket.name == conftest.test_bucket_name r1 = versioning.save_flow_ver( process_group=f_pg, - registry_client=fix_bucket.client, - bucket=fix_bucket.bucket, + registry_client=f_reg_client, + bucket=test_bucket, flow_name=conftest.test_versioned_flow_name, comment='a test comment', desc='a test description' @@ -104,8 +121,8 @@ def test_save_flow_ver(fix_bucket, fix_pg, fix_proc): with pytest.raises(ValueError): _ = versioning.save_flow_ver( process_group=f_pg, - registry_client=fix_bucket.client, - bucket=fix_bucket.bucket, + registry_client=f_reg_client, + bucket=f_bucket, flow_name=conftest.test_versioned_flow_name, comment='NiPyApi Test', desc='NiPyApi Test' @@ -115,8 +132,8 @@ def test_save_flow_ver(fix_bucket, fix_pg, fix_proc): f_pg = canvas.get_process_group(f_pg.id, 'id') r2 = versioning.save_flow_ver( process_group=f_pg, - registry_client=fix_bucket.client, - bucket=fix_bucket.bucket, + registry_client=f_reg_client, + bucket=f_bucket, flow_id=r1.version_control_information.flow_id, comment='a test comment' ) @@ -126,16 +143,18 @@ def test_save_flow_ver(fix_bucket, fix_pg, fix_proc): with pytest.raises(ValueError): _ = versioning.save_flow_ver( process_group=f_pg, - registry_client=fix_bucket.client, - bucket=fix_bucket.bucket, + registry_client=f_reg_client, + bucket=f_bucket, flow_name=conftest.test_versioned_flow_name, comment='a test comment', desc='a test description', refresh=False ) + # shortcut to clean up the test objects when not using the fixture + conftest.cleanup_reg() -def test_stop_flow_ver(fix_ver_flow): +def test_stop_flow_ver(regress_flow_reg, fix_ver_flow): r1 = versioning.stop_flow_ver(fix_ver_flow.pg) assert isinstance(r1, nifi.VersionControlInformationEntity) assert r1.version_control_information is None @@ -146,7 +165,7 @@ def test_stop_flow_ver(fix_ver_flow): _ = versioning.stop_flow_ver(fix_ver_flow.pg, refresh=False) -def test_revert_flow_ver(fix_ver_flow): +def test_revert_flow_ver(regress_flow_reg, fix_ver_flow): r1 = versioning.revert_flow_ver(fix_ver_flow.pg) assert isinstance(r1, nifi.VersionedFlowUpdateRequestEntity) # TODO: Add Tests for flows with data loss on reversion @@ -154,15 +173,15 @@ def test_revert_flow_ver(fix_ver_flow): _ = versioning.revert_flow_ver('NotAPg') -def test_list_flows_in_bucket(fix_ver_flow): +def test_list_flows_in_bucket(regress_flow_reg, fix_ver_flow): r1 = versioning.list_flows_in_bucket(fix_ver_flow.bucket.identifier) assert isinstance(r1, list) assert isinstance(r1[0], registry.VersionedFlow) - with pytest.raises(ValueError, match='Bucket does not exist'): + with pytest.raises(ValueError, match='does not exist'): _ = versioning.list_flows_in_bucket('NiPyApi-FakeNews') -def test_get_flow_in_bucket(fix_ver_flow): +def test_get_flow_in_bucket(regress_flow_reg, fix_ver_flow): r1 = versioning.get_flow_in_bucket( fix_ver_flow.bucket.identifier, fix_ver_flow.flow.identifier, @@ -176,13 +195,13 @@ def test_get_flow_in_bucket(fix_ver_flow): assert r2 is None -def test_get_latest_flow_ver(fix_ver_flow): +def test_get_latest_flow_ver(regress_flow_reg, fix_ver_flow): r1 = versioning.get_latest_flow_ver( fix_ver_flow.bucket.identifier, fix_ver_flow.flow.identifier ) assert isinstance(r1, registry.VersionedFlowSnapshot) - with pytest.raises(ValueError, match='Versioned flow does not exist'): + with pytest.raises(ValueError, match='does not exist'): _ = versioning.get_latest_flow_ver( fix_ver_flow.bucket.identifier, 'fakenews' @@ -199,14 +218,14 @@ def test_list_flow_versions(): pass -def test_get_version_info(fix_ver_flow): +def test_get_version_info(regress_flow_reg, fix_ver_flow): r1 = versioning.get_version_info(fix_ver_flow.pg) assert isinstance(r1, nifi.VersionControlInformationEntity) with pytest.raises(ValueError): _ = versioning.get_version_info('NotAPG') -def test_create_flow(fix_ver_flow): +def test_create_flow(regress_flow_reg, fix_ver_flow): r1 = versioning.create_flow( bucket_id=fix_ver_flow.bucket.identifier, flow_name=conftest.test_cloned_ver_flow_name, @@ -221,7 +240,7 @@ def test_create_flow(fix_ver_flow): ) -def test_create_flow_version(fix_ver_flow): +def test_create_flow_version(regress_flow_reg, fix_ver_flow): new_ver_stub = versioning.create_flow( bucket_id=fix_ver_flow.bucket.identifier, flow_name=conftest.test_cloned_ver_flow_name, @@ -257,7 +276,7 @@ def test_create_flow_version(fix_ver_flow): ) == {} -def test_complex_template_versioning(fix_ctv): +def test_complex_template_versioning(regress_flow_reg, fix_ctv): # There is a complex bug where a new flow version cannot be switched to # and generates a NiFi NPE if attempted when create_flow_version is used # BUG FIXED: issue with variable name found in Swagger definition @@ -294,7 +313,7 @@ def test_complex_template_versioning(fix_ctv): _ = versioning.update_flow_ver(fix_ctv.pg, '9999999') -def test_get_flow_version(fix_ver_flow): +def test_get_flow_version(regress_flow_reg, fix_ver_flow): r1 = versioning.get_flow_version( fix_ver_flow.bucket.identifier, fix_ver_flow.flow.identifier @@ -329,7 +348,7 @@ def test_get_flow_version(fix_ver_flow): assert isinstance(utils.load(r4), dict) -def test_export_flow_version(fix_flow_serde): +def test_export_flow_version(regress_flow_reg, fix_flow_serde): # Test we can turn a flow snapshot into a json string r1 = versioning.export_flow_version( fix_flow_serde.bucket.identifier, @@ -366,7 +385,7 @@ def test_export_flow_version(fix_flow_serde): assert r3l['snapshotMetadata'].__contains__('flowIdentifier') -def test_import_flow_version(fix_flow_serde): +def test_import_flow_version(regress_flow_reg, fix_flow_serde): compare_obj = fix_flow_serde.snapshot test_obj = fix_flow_serde.raw # Test that our test_obj serialises and deserialises through the layers of @@ -447,7 +466,7 @@ def test_import_flow_version(fix_flow_serde): ) == {} -def test_deploy_flow_version(fix_ver_flow): +def test_deploy_flow_version(regress_flow_reg, fix_ver_flow): r1 = versioning.deploy_flow_version( parent_id=canvas.get_root_pg_id(), location=(0,0), diff --git a/tox.ini b/tox.ini index a0802858..0d62704d 100644 --- a/tox.ini +++ b/tox.ini @@ -42,5 +42,5 @@ deps = -r{toxinidir}/requirements.txt commands = pip install -U pip - coverage run -m py.test --basetemp={envtmpdir} -s -x + coverage run -m py.test --basetemp={envtmpdir} -s -x --log-cli-level=INFO - coveralls