@@ -148,6 +148,18 @@ def _delete(self, url: str) -> Optional[str]:
148148 except (AttributeError , KeyError ):
149149 return None
150150
151+ def _remove (self , resource_id : str , asynchronous : bool = True ) -> Optional [str ]:
152+ url = "%s%s/%s" % (self .target_endpoint , self .entity_uri , resource_id )
153+ job_location = self ._delete (url )
154+ if job_location is not None :
155+ job_url = urlparse (job_location )
156+ job_guid = job_url .path .rsplit ("/" , 1 )[- 1 ]
157+ if not asynchronous :
158+ self .client .v3 .jobs .wait_for_job_completion (job_guid )
159+ else :
160+ return job_guid
161+ return None
162+
151163 def _list (self , requested_path : str , entity_type : Optional [ENTITY_TYPE ] = None , ** kwargs ) -> PaginateEntities :
152164 url_requested = EntityManager ._get_url_with_encoded_params ("%s%s" % (self .target_endpoint , requested_path ), ** kwargs )
153165 for element in self ._paginate (url_requested , entity_type ):
@@ -194,14 +206,6 @@ def _update(self, resource_id: str, data: dict) -> Entity:
194206 url = "%s%s/%s" % (self .target_endpoint , self .entity_uri , resource_id )
195207 return self ._patch (url , data )
196208
197- def _remove (self , resource_id : str , asynchronous : bool = True ):
198- url = "%s%s/%s" % (self .target_endpoint , self .entity_uri , resource_id )
199- job_location = self ._delete (url )
200- if not asynchronous and job_location is not None :
201- job_url = urlparse (job_location )
202- job_guid = job_url .path .rsplit ("/" , 1 )[- 1 ]
203- self .client .v3 .jobs .wait_for_job_completion (job_guid )
204-
205209 def __iter__ (self ) -> PaginateEntities :
206210 return self .list ()
207211
0 commit comments