@@ -513,14 +513,16 @@ def called_mutator_apis(cls) -> List[AwsApiSpec]:
513513 ]
514514
515515 @classmethod
516- def collect (cls : Type [AwsResource ], json : List [Json ], builder : GraphBuilder ) -> None :
516+ def collect (cls : Type [AwsResource ], json : List [Json ], builder : GraphBuilder ) -> List [AwsResource ]:
517+ instances : List [AwsResource ] = []
517518 for js in json :
518519 if api_instance := cls .from_api (js , builder ):
519520 api_instance .set_arn (
520521 builder = builder ,
521522 account = "" ,
522523 resource = f"/restapis/{ api_instance .id } " ,
523524 )
525+ instances .append (api_instance )
524526 builder .add_node (api_instance , js )
525527 for deployment in builder .client .list (
526528 service_name , "get-deployments" , "items" , restApiId = api_instance .id
@@ -532,6 +534,7 @@ def collect(cls: Type[AwsResource], json: List[Json], builder: GraphBuilder) ->
532534 resource = f"/restapis/{ api_instance .id } /deployments/{ deploy_instance .id } " ,
533535 )
534536 deploy_instance .api_link = api_instance .id
537+ instances .append (deploy_instance )
535538 builder .add_node (deploy_instance , deployment )
536539 builder .add_edge (api_instance , EdgeType .default , node = deploy_instance )
537540 for stage in builder .client .list (
@@ -544,6 +547,7 @@ def collect(cls: Type[AwsResource], json: List[Json], builder: GraphBuilder) ->
544547 stage ["syntheticId" ] = f'{ api_instance .id } _{ stage ["stageName" ]} ' # create unique id
545548 if stage_instance := AwsApiGatewayStage .from_api (stage , builder ):
546549 stage_instance .api_link = api_instance .id
550+ instances .append (stage_instance )
547551 builder .add_node (stage_instance , stage )
548552 # reference kinds for this edge are maintained in AwsApiGatewayDeployment.reference_kinds # noqa: E501
549553 builder .add_edge (deploy_instance , EdgeType .default , node = stage_instance )
@@ -552,18 +556,21 @@ def collect(cls: Type[AwsResource], json: List[Json], builder: GraphBuilder) ->
552556 ):
553557 if auth_instance := AwsApiGatewayAuthorizer .from_api (authorizer , builder ):
554558 auth_instance .api_link = api_instance .id
559+ instances .append (auth_instance )
555560 builder .add_node (auth_instance , authorizer )
556561 builder .add_edge (api_instance , EdgeType .default , node = auth_instance )
557562 for resource in builder .client .list (service_name , "get-resources" , "items" , restApiId = api_instance .id ):
558563 if resource_instance := AwsApiGatewayResource .from_api (resource , builder ):
559564 resource_instance .api_link = api_instance .id
565+ instances .append (resource_instance )
560566 if resource_instance .resource_methods :
561567 for method in resource_instance .resource_methods :
562568 mapped = bend (AwsApiGatewayMethod .mapping , resource ["resourceMethods" ][method ])
563569 if gm := parse_json (mapped , AwsApiGatewayMethod , builder ):
564570 resource_instance .resource_methods [method ] = gm
565571 builder .add_node (resource_instance , resource )
566572 builder .add_edge (api_instance , EdgeType .default , node = resource_instance )
573+ return instances
567574
568575 def connect_in_graph (self , builder : GraphBuilder , source : Json ) -> None :
569576 if self .api_endpoint_configuration :
0 commit comments