Best Python code snippet using localstack_python
iamhandler.py
Source:iamhandler.py
...29 if (testcase['action'] == 'attach_group_policy'):30 result = iamclient.attach_group_policy(GroupName=testcase['fulltestcase']['groupname'],PolicyArn=testcase['fulltestcase']['policyarn'])31 return(successHandler(result))32 if (testcase['action'] == 'detach_group_policy'):33 result = iamclient.detach_group_policy(GroupName=testcase['fulltestcase']['groupname'],PolicyArn=testcase['fulltestcase']['policyarn'])34 return(successHandler(result))35 if (testcase['action'] == 'delete_group'):36 result = iamclient.delete_group(GroupName=testcase['fulltestcase']['groupname'])37 return(successHandler(result))38 if (testcase['action'] == 'create_role_without_pb'):39 result = iamclient.create_role(RoleName=testcase['fulltestcase']['rolename'],AssumeRolePolicyDocument=json.dumps(testcase['fulltestcase']['assumepolicy']))40 return(successHandler(result))41 if (testcase['action'] == 'create_role_with_pb'):42 result = iamclient.create_role(RoleName=testcase['fulltestcase']['rolename'],PermissionsBoundary=testcase['fulltestcase']['permissionboundary'],AssumeRolePolicyDocument=json.dumps(testcase['fulltestcase']['assumepolicy']))43 return(successHandler(result))44 if (testcase['action'] == 'create_user_without_pb'):45 result = iamclient.create_user(UserName=testcase['fulltestcase']['username'])46 return(successHandler(result))47 if (testcase['action'] == 'create_user_with_pb'):
...
reset_kops_aws_creds.py
Source:reset_kops_aws_creds.py
...58 )59 client.delete_user(60 UserName=user_name61 )62 client.detach_group_policy(63 PolicyArn="arn:aws:iam::aws:policy/AmazonEC2FullAccess",64 GroupName=group_name65 )66 client.detach_group_policy(67 PolicyArn="arn:aws:iam::aws:policy/AmazonRoute53FullAccess",68 GroupName=group_name69 )70 client.detach_group_policy(71 PolicyArn="arn:aws:iam::aws:policy/AmazonS3FullAccess",72 GroupName=group_name73 )74 client.detach_group_policy(75 PolicyArn="arn:aws:iam::aws:policy/IAMFullAccess",76 GroupName=group_name77 )78 client.detach_group_policy(79 PolicyArn="arn:aws:iam::aws:policy/AmazonVPCFullAccess",80 GroupName=group_name81 )82 client.delete_group(83 GroupName=group_name84 )85# launch the program86if __name__ == '__main__':...
iam_manager.py
Source:iam_manager.py
...30 :param policy_arn: policy arn31 :return:32 '''33 return self.cli.attach_group_policy(GroupName=group_name, PolicyArn=policy_arn)34 def detach_group_policy(self, group_name, policy_arn):35 '''36 Removes the specified managed policy from the specified IAM group.37 :param group_name: group name38 :param policy_arn: policy arn39 :return:40 '''41 return self.cli.detach_group_policy(GroupName=group_name, PolicyArn=policy_arn)42 def list_group_policies(self, user_group_name, max_items=100):43 '''44 Lists the names of the inline policies that are embedded in the specified IAM group.45 :param user_group_name: user group name46 :param max_items: max items, default=10047 :return:48 '''...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!