Remove services from client

Following the deleting of coordination from Mistral, remove services list from client
See https://review.opendev.org/c/openstack/mistral/+/948018

Change-Id: Ic2a27866cb32152dd7a77f9880d96a97f49c037f
This commit is contained in:
Axel Vanzaghi
2025-05-02 14:29:23 +02:00
parent 60bcaf11f6
commit b87667016a
8 changed files with 0 additions and 148 deletions

View File

@@ -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,

View File

@@ -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')

View File

@@ -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()

View File

@@ -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,

View File

@@ -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

View File

@@ -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])

View File

@@ -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()
)

View File

@@ -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