Skip to content

Commit

Permalink
chore: revision
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCloudSec committed Nov 6, 2024
1 parent 08e5438 commit 25eda2b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
17 changes: 7 additions & 10 deletions prowler/providers/aws/services/appsync/appsync_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand All @@ -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] = []
8 changes: 4 additions & 4 deletions tests/providers/aws/services/appsync/appsync_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 == [{}]

0 comments on commit 25eda2b

Please sign in to comment.