@@ -71,6 +71,32 @@ def validate(self, resource_id: str, resource_data: ResourceData | None = None)
7171 )
7272
7373
74+ class BlockableMixin [Model ]:
75+ """Blockable mixin for blocking and unblocking resources."""
76+
77+ def block (self , resource_id : str , resource_data : ResourceData | None = None ) -> Model :
78+ """Block a resource.
79+
80+ Args:
81+ resource_id: Resource ID
82+ resource_data: Resource data will be updated
83+ """
84+ return self ._resource_action ( # type: ignore[attr-defined, no-any-return]
85+ resource_id , "POST" , "block" , json = resource_data
86+ )
87+
88+ def unblock (self , resource_id : str , resource_data : ResourceData | None = None ) -> Model :
89+ """Unblock a resource.
90+
91+ Args:
92+ resource_id: Resource ID
93+ resource_data: Resource data will be updated
94+ """
95+ return self ._resource_action ( # type: ignore[attr-defined, no-any-return]
96+ resource_id , "POST" , "unblock" , json = resource_data
97+ )
98+
99+
74100class AsyncActivatableMixin [Model ]:
75101 """Async activatable mixin for activating, enabling, disabling and deactivating resources."""
76102
@@ -138,3 +164,29 @@ async def validate(self, resource_id: str, resource_data: ResourceData | None =
138164 return await self ._resource_action ( # type: ignore[attr-defined, no-any-return]
139165 resource_id , "POST" , "validate" , json = resource_data
140166 )
167+
168+
169+ class AsyncBlockableMixin [Model ]:
170+ """Asynchronous Blockable mixin for blocking and unblocking resources."""
171+
172+ async def block (self , resource_id : str , resource_data : ResourceData | None = None ) -> Model :
173+ """Block a resource.
174+
175+ Args:
176+ resource_id: Resource ID
177+ resource_data: Resource data will be updated
178+ """
179+ return await self ._resource_action ( # type: ignore[attr-defined, no-any-return]
180+ resource_id , "POST" , "block" , json = resource_data
181+ )
182+
183+ async def unblock (self , resource_id : str , resource_data : ResourceData | None = None ) -> Model :
184+ """Unblock a resource.
185+
186+ Args:
187+ resource_id: Resource ID
188+ resource_data: Resource data will be updated
189+ """
190+ return await self ._resource_action ( # type: ignore[attr-defined, no-any-return]
191+ resource_id , "POST" , "unblock" , json = resource_data
192+ )
0 commit comments