Best Python code snippet using localstack_python
framework_nuke_environment.py
Source: framework_nuke_environment.py
...75 'logs', options.management_east_id, region='us-gov-east-1')76org_client = boto3.client('organizations')77delete_stack(cfn_clients['Central']['West1'], 'federation-stack')78delete_stack(cfn_clients['Logging']['West1'], 'federation-stack')79delete_stack_set(cfn_client=cfn_clients['Central']['West1'],80 org_client=org_client,81 stack_set_name='federation-stackset-us-gov-west-1',82 ou_name='environment-usgw1',83 region='us-gov-west-1')84delete_stack_set(cfn_client=cfn_clients['Central']['West1'], # Stacksets are in west85 org_client=org_client,86 stack_set_name='federation-stackset-us-gov-east-1',87 ou_name='environment-usge1',88 region='us-gov-east-1')89delete_stack_set(cfn_client=cfn_clients['Central']['West1'],90 org_client=org_client,91 stack_set_name='backup-services-stackset-us-gov-west-1',92 ou_name='environment-usgw1',93 region='us-gov-west-1')94delete_stack_set(cfn_client=cfn_clients['Central']['West1'], # Stacksets are in west95 org_client=org_client,96 stack_set_name='backup-services-stackset-us-gov-east-1',97 ou_name='environment-usge1',98 region='us-gov-east-1')99delete_stack_set(cfn_client=cfn_clients['Central']['West1'],100 org_client=org_client,101 stack_set_name='security-baseline-stackset-us-gov-west-1',102 ou_name='environment-usgw1',103 region='us-gov-west-1')104delete_stack_set(cfn_client=cfn_clients['Central']['West1'], # Stacksets are in west105 org_client=org_client,106 stack_set_name='security-baseline-stackset-us-gov-east-1',107 ou_name='environment-usge1',108 region='us-gov-east-1')109if (options.transit_west_id):110 delete_stack(cfn_clients['Transit']['West1'], 'transit-gateway-routes')111if (options.transit_east_id):112 delete_stack(cfn_clients['Transit']['East1'], 'transit-gateway-routes')113if (options.management_west_id):114 delete_stack(cfn_clients['Management']['West1'],115 'management-services-init')116if (options.management_east_id):117 delete_stack(cfn_clients['Management']['East1'],118 'management-services-init')...
delete_stack_set.py
Source: delete_stack_set.py
...8import time9Helpers = helpers.Helpers()10Cfn_helpers = cfn_helpers.CfnHelpers()11Org_helpers = org_helpers.Organization_Helpers()12def delete_stack_set(session,stack_set_name, accounts):13 cfn = session.client('cloudformation')14 print()15 try:16 print(f"Deleting Stack Set Instances for {stack_set_name}")17 response = cfn.delete_stack_instances(18 StackSetName=stack_set_name,19 Accounts=accounts,20 Regions=[session.region_name],21 RetainStacks=False,22 OperationId=str(uuid.uuid1())23 )24 print(response)25 inprogress = True26 while inprogress:27 try:28 response = cfn.delete_stack_set(29 StackSetName=stack_set_name30 )31 inprogress = False32 except botocore.exceptions.ClientError as e:33 if e.response['Error']['Code'] == 'OperationInProgressException':34 print(e.response['Error']['Code'])35 inprogress = True36 time.sleep(30)37 except Exception as e:38 raise e39 print(f"Operation Out of Progress")40 response = cfn.delete_stack_set(41 StackSetName=stack_set_name42 )43 except botocore.exceptions.ClientError as e:44 if e.response['Error']['Code'] == 'StackSetNotFoundException':45 print(f"Stack Set Not Found: {stack_set_name}")46 response = cfn.delete_stack_set(47 StackSetName=stack_set_name48 )49 print(response)50 else:51 print(e)52 return53def main():54 shared_session = boto3.session.Session(profile_name='aws2')55 shared_session = boto3.session.Session(profile_name='orgmaster')56 org_session = boto3.session.Session(profile_name='orgmaster')57 org_accounts = Org_helpers.get_org_accounts(org_session,remove_org_master=False)58 print(org_accounts)59 cfn = org_session.client('cloudformation')60 stack_set_name = 'devops-boundary'61 response = cfn.list_stack_sets(62 Status='ACTIVE'63 )64 stack_sets = [s['StackSetName'] for s in response['Summaries']]65 print(stack_sets)66 for stack_set_name in stack_sets:67 delete_stack_set(shared_session, stack_set_name, org_accounts)68 return69if __name__ == '__main__':...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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!!