diff --git a/prowler/providers/aws/services/appsync/appsync_service.py b/prowler/providers/aws/services/appsync/appsync_service.py index b7443559016..dd2985b828b 100644 --- a/prowler/providers/aws/services/appsync/appsync_service.py +++ b/prowler/providers/aws/services/appsync/appsync_service.py @@ -11,7 +11,7 @@ class AppSync(AWSService): def __init__(self, provider): # Call AWSService's __init__ super().__init__(__class__.__name__, provider) - self.graphqlapis = {} + self.graphql_apis = {} self.__threading_call__(self._list_graphql_apis) def _list_graphql_apis(self, regional_client): @@ -29,20 +29,17 @@ def _list_graphql_apis(self, regional_client): self.audit_resources, ) ): - aux_tags = [] - if api.get("tags"): - aux_tags.append(api.get("tags")) - self.graphqlapis[api_arn] = GraphqlApi( + self.graphql_apis[api_arn] = GraphqlApi( id=api["apiId"], name=api["name"], arn=api_arn, region=regional_client.region, - type=api.get("apiType"), + type=api.get("apiType", "GRAPHQL"), field_log_level=api.get("logConfig", {}).get( "fieldLogLevel", "" ), authentication_type=api.get("authenticationType", ""), - tags=aux_tags, + tags=[api.get("tags", {})], ) except Exception as error: @@ -56,7 +53,7 @@ class GraphqlApi(BaseModel): name: str arn: str region: str - type: Optional[str] - field_log_level: Optional[str] - authentication_type: Optional[str] + type: str + field_log_level: str + authentication_type: str tags: Optional[list] = [] diff --git a/tests/providers/aws/services/appsync/appsync_service_test.py b/tests/providers/aws/services/appsync/appsync_service_test.py index 20f81bcb282..510a19d766a 100644 --- a/tests/providers/aws/services/appsync/appsync_service_test.py +++ b/tests/providers/aws/services/appsync/appsync_service_test.py @@ -60,7 +60,7 @@ def test_list_graphql_apis(self): api_arn = api["graphqlApi"]["arn"] appsync_client = AppSync(aws_provider) - assert appsync_client.graphqlapis[api_arn].name == "test-api" - assert appsync_client.graphqlapis[api_arn].field_log_level == "ALL" - assert appsync_client.graphqlapis[api_arn].authentication_type == "API_KEY" - assert appsync_client.graphqlapis[api_arn].tags == [] + assert appsync_client.graphql_apis[api_arn].name == "test-api" + assert appsync_client.graphql_apis[api_arn].field_log_level == "ALL" + assert appsync_client.graphql_apis[api_arn].authentication_type == "API_KEY" + assert appsync_client.graphql_apis[api_arn].tags == [{}]