From c6255fe80d07cd1db970bb4aaea6e00048434ff6 Mon Sep 17 00:00:00 2001 From: Core <64761294@qq.com> Date: Wed, 18 Aug 2021 10:28:04 +0800 Subject: [PATCH] =?UTF-8?q?minor:ResourceProvider=E6=B7=BB=E5=8A=A0search?= =?UTF-8?q?=5Finstance=E6=8A=BD=E8=B1=A1=E6=96=B9=E6=B3=95=20(#48)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * minor:ResourceProvider添加search_instance抽象方法 --- iam/resource/provider.py | 8 ++++++++ tests/contrib/django/dispatcher/test_dispatchers.py | 3 +++ 2 files changed, 11 insertions(+) diff --git a/iam/resource/provider.py b/iam/resource/provider.py index c7718e5..9dc5b08 100644 --- a/iam/resource/provider.py +++ b/iam/resource/provider.py @@ -72,3 +72,11 @@ def list_instance_by_policy(self, filter, page, **options): return: ListResult """ raise NotImplementedError() + + @abc.abstractmethod + def search_instance(self, filter, page, **options): + """ + 处理来自 iam 的 search_instance 请求 + return: ListResult + """ + raise NotImplementedError() diff --git a/tests/contrib/django/dispatcher/test_dispatchers.py b/tests/contrib/django/dispatcher/test_dispatchers.py index 766a576..9e92439 100644 --- a/tests/contrib/django/dispatcher/test_dispatchers.py +++ b/tests/contrib/django/dispatcher/test_dispatchers.py @@ -50,6 +50,9 @@ def fetch_instance_info(self, filter, **options): def list_instance_by_policy(self, filter, page, **options): return ListResult(results=[filter, page], count=100) + def search_instance(self, filter, page, **options): + return ListResult(results=[filter, page], count=100) + with pytest.raises(AuthInvalidOperation): dispatcher.register("type", "provider")