diff --git a/plugins/digitalocean/resoto_plugin_digitalocean/resources.py b/plugins/digitalocean/resoto_plugin_digitalocean/resources.py index 03d4136d6e..48702b3bfc 100644 --- a/plugins/digitalocean/resoto_plugin_digitalocean/resources.py +++ b/plugins/digitalocean/resoto_plugin_digitalocean/resources.py @@ -1,6 +1,6 @@ import logging from attrs import define -from typing import ClassVar, Dict, List, Optional +from typing import ClassVar, Dict, List, Optional, Tuple, Any from resoto_plugin_digitalocean.client import StreamingWrapper from resoto_plugin_digitalocean.client import get_team_credentials @@ -46,6 +46,11 @@ class DigitalOceanResource(BaseResource): kind: ClassVar[str] = "digitalocean_resource" urn: str = "" + def _keys(self) -> Tuple[Any, ...]: + if self.urn: + return tuple(list(super()._keys()) + [self.urn]) + return super()._keys() + def delete_uri_path(self) -> Optional[str]: return None @@ -75,7 +80,7 @@ def delete(self, graph: Graph) -> bool: raise NotImplementedError def to_json(self) -> Json: - return _to_json(self, strip_nulls=True, keep_untouched=set(["tags"])) + return _to_json(self, strip_nulls=True, keep_untouched={"tags"}) @define(eq=False, slots=False) diff --git a/plugins/gcp/resoto_plugin_gcp/resources/base.py b/plugins/gcp/resoto_plugin_gcp/resources/base.py index f0257ac758..4137fd60d5 100644 --- a/plugins/gcp/resoto_plugin_gcp/resources/base.py +++ b/plugins/gcp/resoto_plugin_gcp/resources/base.py @@ -5,7 +5,7 @@ from concurrent.futures import Future from threading import Lock from types import TracebackType -from typing import Callable, List, ClassVar, Optional, TypeVar, Type, Any, Dict, Set +from typing import Callable, List, ClassVar, Optional, TypeVar, Type, Any, Dict, Set, Tuple from attr import define, field from google.auth.credentials import Credentials as GoogleAuthCredentials @@ -267,6 +267,11 @@ class GcpResource(BaseResource): link: Optional[str] = None label_fingerprint: Optional[str] = None + def _keys(self) -> Tuple[Any, ...]: + if self.link is not None: + return tuple(list(super()._keys()) + [self.link]) + return super()._keys() + def delete(self, graph: Graph) -> bool: if not self.api_spec: return False