Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timeit issue with policytype #294

Merged
merged 1 commit into from
Apr 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions cartography/intel/aws/iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,15 +522,15 @@ def sync_users(neo4j_session, boto3_session, current_aws_account_id, aws_update_
@timeit
def sync_user_managed_policies(boto3_session, data, neo4j_session, aws_update_tag):
managed_policy_data = get_user_managed_policy_data(boto3_session, data['Users'])
transform_policy_data(managed_policy_data, PolicyType.managed)
load_policy_data(neo4j_session, managed_policy_data, PolicyType.managed, aws_update_tag)
transform_policy_data(managed_policy_data, PolicyType.managed.value)
load_policy_data(neo4j_session, managed_policy_data, PolicyType.managed.value, aws_update_tag)


@timeit
def sync_user_inline_policies(boto3_session, data, neo4j_session, aws_update_tag):
policy_data = get_user_policy_data(boto3_session, data['Users'])
transform_policy_data(policy_data, PolicyType.inline)
load_policy_data(neo4j_session, policy_data, PolicyType.inline, aws_update_tag)
transform_policy_data(policy_data, PolicyType.inline.value)
load_policy_data(neo4j_session, policy_data, PolicyType.inline.value, aws_update_tag)


@timeit
Expand All @@ -548,14 +548,14 @@ def sync_groups(neo4j_session, boto3_session, current_aws_account_id, aws_update

def sync_group_managed_policies(boto3_session, data, neo4j_session, aws_update_tag):
managed_policy_data = get_group_managed_policy_data(boto3_session, data["Groups"])
transform_policy_data(managed_policy_data, PolicyType.managed)
load_policy_data(neo4j_session, managed_policy_data, PolicyType.managed, aws_update_tag)
transform_policy_data(managed_policy_data, PolicyType.managed.value)
load_policy_data(neo4j_session, managed_policy_data, PolicyType.managed.value, aws_update_tag)


def sync_groups_inline_policies(boto3_session, data, neo4j_session, aws_update_tag):
policy_data = get_group_policy_data(boto3_session, data["Groups"])
transform_policy_data(policy_data, PolicyType.inline)
load_policy_data(neo4j_session, policy_data, PolicyType.inline, aws_update_tag)
transform_policy_data(policy_data, PolicyType.inline.value)
load_policy_data(neo4j_session, policy_data, PolicyType.inline.value, aws_update_tag)


@timeit
Expand All @@ -574,15 +574,15 @@ def sync_roles(neo4j_session, boto3_session, current_aws_account_id, aws_update_
def sync_role_managed_policies(current_aws_account_id, boto3_session, data, neo4j_session, aws_update_tag):
logger.debug("Syncing IAM role managed policies for account '%s'.", current_aws_account_id)
managed_policy_data = get_role_managed_policy_data(boto3_session, data["Roles"])
transform_policy_data(managed_policy_data, PolicyType.managed)
load_policy_data(neo4j_session, managed_policy_data, PolicyType.managed, aws_update_tag)
transform_policy_data(managed_policy_data, PolicyType.managed.value)
load_policy_data(neo4j_session, managed_policy_data, PolicyType.managed.value, aws_update_tag)


def sync_role_inline_policies(current_aws_account_id, boto3_session, data, neo4j_session, aws_update_tag):
logger.debug("Syncing IAM role inline policies for account '%s'.", current_aws_account_id)
inline_policy_data = get_role_policy_data(boto3_session, data["Roles"])
transform_policy_data(inline_policy_data, PolicyType.inline)
load_policy_data(neo4j_session, inline_policy_data, PolicyType.inline, aws_update_tag)
transform_policy_data(inline_policy_data, PolicyType.inline.value)
load_policy_data(neo4j_session, inline_policy_data, PolicyType.inline.value, aws_update_tag)


@timeit
Expand Down