How to use delete_user_permissions_boundary method in localstack

Best Python code snippet using localstack_python

aws_ad_accounts_sync.py

Source:aws_ad_accounts_sync.py Github

copy

Full Screen

...179 if changed_attributes:180 message = 'account id: %s - account name: %s - user: %s has been disabled. These attributes were disabled: %s' % (account_id, account_name, user_name, str(changed_attributes))181 logger.info(message)182 message_slack(message)183def delete_user_permissions_boundary(iam, user_name):184 action_taken = False185 aws_user = iam.get_user(UserName=user_name)186 if 'PermissionsBoundary' in aws_user['User']:187 iam.delete_user_permissions_boundary(UserName=user_name)188 action_taken = True189 return action_taken190def delete_aws_user_account(iam, user_name, account_id, account_name):191 changed_attributes = []192 if delete_user_ssh_keys(iam, user_name):193 changed_attributes.append('ssh key(s)')194 if delete_user_access_keys(iam, user_name):195 changed_attributes.append('access key(s)')196 if remove_user_from_all_groups(iam, user_name):197 changed_attributes.append('group attachment(s)')198 if delete_user_signing_certificates(iam, user_name):199 changed_attributes.append('signing certificate(s)')200 if delete_inline_user_policies(iam, user_name):201 changed_attributes.append('inline user policy attachment(s)')202 if detach_managed_user_policies(iam, user_name):203 changed_attributes.append('managed user policy attachment(s)')204 if delete_user_mfa_devices(iam, user_name):205 changed_attributes.append('user mfa devices')206 if delete_user_permissions_boundary(iam, user_name):207 changed_attributes.append('permissions boundary')208 iam.delete_user(UserName=user_name)209 delete_message = 'account id: %s - account name: %s - user: %s has been deleted after no activity for %s days.' % (account_id, account_name, user_name, aws_delete_grace_period)210 attributes_message = ' These attributes were deleted: %s' % str(changed_attributes)211 message = delete_message.ljust(70, ' ') + attributes_message212 message_slack(message)213 logger.info(message)214def get_sts_iam_object(sts_client, role_arn, role_session_name):215 try:216 assumed_role_object = sts_client.assume_role(RoleArn=role_arn, RoleSessionName=role_session_name)217 credentials = assumed_role_object['Credentials']218 return boto3.client(219 'iam',220 aws_access_key_id = credentials['AccessKeyId'],...

Full Screen

Full Screen

iamhandler.py

Source:iamhandler.py Github

copy

Full Screen

...53 if (testcase['action'] == 'delete_user'):54 result = iamclient.delete_user(UserName=testcase['fulltestcase']['username'])55 return(successHandler(result))56 if (testcase['action'] == 'delete_user_permissions_boundary'):57 result = iamclient.delete_user_permissions_boundary(UserName=testcase['fulltestcase']['username'])58 return(successHandler(result))59 if (testcase['action'] == 'delete_role_permissions_boundary'):60 result = iamclient.delete_role_permissions_boundary(RoleName=testcase['fulltestcase']['rolename'])61 return(successHandler(result))62 if (testcase['action'] == 'attach_role_policy'):63 result = iamclient.attach_role_policy(RoleName=testcase['fulltestcase']['rolename'],PolicyArn=testcase['fulltestcase']['policyarn'])64 return(successHandler(result))65 if (testcase['action'] == 'detach_role_policy'):66 result = iamclient.detach_role_policy(RoleName=testcase['fulltestcase']['rolename'],PolicyArn=testcase['fulltestcase']['policyarn'])67 return(successHandler(result))68 if (testcase['action'] == 'rename_group'):69 result = iamclient.update_group(GroupName=testcase['fulltestcase']['groupname'],NewGroupName=testcase['fulltestcase']['newgroupname'])70 return(successHandler(result))71 if (testcase['action'] == 'delete_group_renamed'): ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful