예제 #1
0
def update_iam(role, s3_buckets, kms_key_arns, role_policies):
    iam = IAM(role.client("iam"))
    iam.update_iam_roles(
        s3_buckets,
        kms_key_arns,
        role_policies
    )
def update_iam(role, s3_bucket, kms_key_arn, role_policies):
    iam = IAM(role)
    iam.update_iam_roles(
        s3_bucket,
        kms_key_arn,
        role_policies
    )
class IAMUpdater():

    target_role_policies = {
        'adf-cloudformation-deployment-role':
        'adf-cloudformation-deployment-role-policy',
        'adf-cloudformation-role': 'adf-cloudformation-role-policy'
    }

    role_policies = {'adf-codepipeline-role': 'adf-codepipeline-role-policy'}

    def __init__(self, kms_key_arn, s3_bucket, role):
        self.iam = IAM(boto3)
        self.iam.update_iam_roles(s3_bucket, kms_key_arn,
                                  IAMUpdater.role_policies)
        self.iam_target_account = IAM(role)
        self.iam_target_account.update_iam_target_account_roles(
            kms_key_arn, IAMUpdater.target_role_policies)