@@ -253,13 +253,9 @@ class BaseResource(ABC):
253253 the resource within the Graph. The name is used for display purposes. Tags are
254254 key/value pairs that get exported in the GRAPHML view.
255255
256- There's also class variables, kind, phantom and reference_kinds.
256+ There's also class variables, kind, and reference_kinds.
257257 `kind` is a string describing the type of resource, e.g. 'aws_ec2_instance'
258258 or 'some_cloud_load_balancer'.
259- `phantom` is a bool describing whether the resource actually exists within
260- the cloud or if it's just a phantom resource like pricing information
261- or usage quota. I.e. some information relevant to the cloud account
262- but not actually existing in the form of a usable resource.
263259 `reference_kinds` is a list of kinds that can be connected to this resource for
264260 the related edge type as successor or predecessor.
265261 """
@@ -268,7 +264,6 @@ class BaseResource(ABC):
268264 kind_display : ClassVar [str ] = "Resource"
269265 kind_description : ClassVar [str ] = "A generic resource."
270266 kind_service : ClassVar [Optional [str ]] = None
271- phantom : ClassVar [bool ] = False
272267 reference_kinds : ClassVar [ModelReference ] = {}
273268 metadata : ClassVar [Dict [str , Any ]] = {"icon" : "resource" , "group" : "misc" }
274269
@@ -455,7 +450,7 @@ def clean(self) -> bool:
455450 @clean .setter
456451 @unless_protected
457452 def clean (self , value : bool ) -> None :
458- if self . phantom and value :
453+ if isinstance ( self , PhantomBaseResource ) and value :
459454 raise ValueError (f"Can't cleanup phantom resource { self .rtdname } " )
460455
461456 clean_str = "" if value else "not "
@@ -491,7 +486,7 @@ def protected(self, value: bool) -> None:
491486 @metrics_resource_cleanup .time ()
492487 @unless_protected
493488 def cleanup (self , graph : Optional [Any ] = None ) -> bool :
494- if self . phantom :
489+ if isinstance ( self , PhantomBaseResource ) :
495490 raise RuntimeError (f"Can't cleanup phantom resource { self .rtdname } " )
496491
497492 if self .cleaned :
@@ -540,7 +535,7 @@ def pre_cleanup(self, graph: Optional[Any] = None) -> bool:
540535 if graph is None :
541536 graph = self ._graph
542537
543- if self . phantom :
538+ if isinstance ( self , PhantomBaseResource ) :
544539 raise RuntimeError (f"Can't cleanup phantom resource { self .rtdname } " )
545540
546541 if self .cleaned :
@@ -759,7 +754,6 @@ class PhantomBaseResource(BaseResource):
759754 kind : ClassVar [str ] = "phantom_resource"
760755 kind_display : ClassVar [str ] = "Phantom Resource"
761756 kind_description : ClassVar [str ] = "A generic phantom resource."
762- phantom : ClassVar [bool ] = True
763757
764758 def update_tag (self , key : str , value : str ) -> bool :
765759 log .error (f"Resource { self .rtdname } is a phantom resource and does not maintain tags" )
0 commit comments