diff --git a/mistralclient/api/v2/client.py b/mistralclient/api/v2/client.py index c293c726..338ff391 100644 --- a/mistralclient/api/v2/client.py +++ b/mistralclient/api/v2/client.py @@ -27,7 +27,6 @@ from mistralclient.api.v2 import environments from mistralclient.api.v2 import event_triggers from mistralclient.api.v2 import executions from mistralclient.api.v2 import members -from mistralclient.api.v2 import services from mistralclient.api.v2 import tasks from mistralclient.api.v2 import workbooks from mistralclient.api.v2 import workflows @@ -51,7 +50,6 @@ class Client(object): 'event_triggers': event_triggers.EventTriggerManager, 'environments': environments.EnvironmentManager, 'action_executions': action_executions.ActionExecutionManager, - 'services': services.ServiceManager, 'members': members.MemberManager, 'code_sources': code_sources.CodeSourceManager, 'dynamic_actions': dynamic_actions.DynamicActionManager, diff --git a/mistralclient/api/v2/services.py b/mistralclient/api/v2/services.py deleted file mode 100644 index 81125d71..00000000 --- a/mistralclient/api/v2/services.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2015 Huawei Technologies Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from mistralclient.api import base - - -class Service(base.Resource): - resource_name = 'Service' - - -class ServiceManager(base.ResourceManager): - resource_class = Service - - def list(self): - return self._list('/services', response_key='services') diff --git a/mistralclient/commands/v2/services.py b/mistralclient/commands/v2/services.py deleted file mode 100644 index 3d49afd1..00000000 --- a/mistralclient/commands/v2/services.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2015 Huawei Technologies Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from mistralclient.commands.v2 import base - - -def format_list(service=None): - columns = ('Name', 'Type') - - if service: - data = (service.name, service.type) - else: - data = (tuple('' for _ in range(len(columns))),) - - return columns, data - - -class List(base.MistralLister): - """List all services.""" - - def _get_format_function(self): - return format_list - - def _get_resources(self, parsed_args): - mistral_client = self.app.client_manager.workflow_engine - return mistral_client.services.list() diff --git a/mistralclient/shell.py b/mistralclient/shell.py index 9f78fe55..e122ef65 100644 --- a/mistralclient/shell.py +++ b/mistralclient/shell.py @@ -36,7 +36,6 @@ import mistralclient.commands.v2.environments import mistralclient.commands.v2.event_triggers import mistralclient.commands.v2.executions import mistralclient.commands.v2.members -import mistralclient.commands.v2.services import mistralclient.commands.v2.tasks import mistralclient.commands.v2.workbooks import mistralclient.commands.v2.workflows @@ -767,7 +766,6 @@ class MistralShell(app.App): mistralclient.commands.v2.event_triggers.Create, 'event-trigger-delete': mistralclient.commands.v2.event_triggers.Delete, - 'service-list': mistralclient.commands.v2.services.List, 'member-create': mistralclient.commands.v2.members.Create, 'member-delete': mistralclient.commands.v2.members.Delete, 'member-update': mistralclient.commands.v2.members.Update, diff --git a/mistralclient/tests/unit/v2/base.py b/mistralclient/tests/unit/v2/base.py index 640c284a..3080349e 100644 --- a/mistralclient/tests/unit/v2/base.py +++ b/mistralclient/tests/unit/v2/base.py @@ -38,5 +38,4 @@ class BaseClientV2Test(base.BaseClientTest): self.environments = self._client.environments self.action_executions = self._client.action_executions self.actions = self._client.actions - self.services = self._client.services self.members = self._client.members diff --git a/mistralclient/tests/unit/v2/test_cli_services.py b/mistralclient/tests/unit/v2/test_cli_services.py deleted file mode 100644 index 534abe93..00000000 --- a/mistralclient/tests/unit/v2/test_cli_services.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2015 Huawei Technologies Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from unittest import mock - -from mistralclient.api.v2 import services -from mistralclient.commands.v2 import services as service_cmd -from mistralclient.tests.unit import base - - -SERVICE_DICT = { - 'name': 'service_name', - 'type': 'service_type', -} - -SERVICE = services.Service(mock, SERVICE_DICT) - - -class TestCLIServicesV2(base.BaseCommandTest): - def test_list(self): - self.client.services.list.return_value = [SERVICE] - expected = (SERVICE_DICT['name'], SERVICE_DICT['type'],) - - result = self.call(service_cmd.List) - - self.assertListEqual([expected], result[1]) diff --git a/mistralclient/tests/unit/v2/test_services.py b/mistralclient/tests/unit/v2/test_services.py deleted file mode 100644 index 40b24ab7..00000000 --- a/mistralclient/tests/unit/v2/test_services.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2015 Huawei Technologies Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from mistralclient.api.v2 import services -from mistralclient.tests.unit.v2 import base - - -SERVICE = { - 'name': 'service_name', - 'type': 'service_type', -} - -URL_TEMPLATE = '/services' - - -class TestServicesV2(base.BaseClientV2Test): - def test_list(self): - self.requests_mock.get(self.TEST_URL + URL_TEMPLATE, - json={'services': [SERVICE]}) - - service_list = self.services.list() - - self.assertEqual(1, len(service_list)) - - srv = service_list[0] - - self.assertDictEqual( - services.Service(self.services, SERVICE).to_dict(), - srv.to_dict() - ) diff --git a/setup.cfg b/setup.cfg index cbf08b37..88ddf11a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -96,8 +96,6 @@ openstack.workflow_engine.v2 = event_trigger_create = mistralclient.commands.v2.event_triggers:Create event_trigger_delete = mistralclient.commands.v2.event_triggers:Delete - workflow_engine_service_list = mistralclient.commands.v2.services:List - resource_member_list = mistralclient.commands.v2.members:List resource_member_show = mistralclient.commands.v2.members:Get resource_member_create = mistralclient.commands.v2.members:Create