Best Python code snippet using localstack_python
describe_ssm_ops_items.py
Source:describe_ssm_ops_items.py
...13 managedinstanceinventory_client = boto3.client('ssm', region_name = j )14 managedinstanceinventory = []15 next_token = None16 while True:17 response = managedinstanceinventory_client.describe_ops_items(18 NextToken= next_token19 ) if next_token else managedinstanceinventory_client.describe_ops_items()20 print(response['OpsItemSummaries']) 21 for i in response['OpsItemSummaries']:22 #if i['Name'] == "AWS-GatherSoftwareInventory": #check if the association is created to configure an inventory to collect metadata . i['Name'] is the documant name for the association23 managedinstanceinventory.append(i['OpsItemId'])24 #print(i['Name'] ) #document name25 # print(response['Associations'])26 print(i['OpsItemId']) # name of the association2728 2930 print("count ---- " + str(len(managedinstanceinventory)))31 #print(response['pipelines'])3233 if 'NextToken' in response.keys():
...
clear_OpsItems.py
Source:clear_OpsItems.py
2import sys3try:4 region = sys.argv[1]5 ssm = boto3.client('ssm', region_name=region)6 response = ssm.describe_ops_items(7 OpsItemFilters=[8 {9 'Key': 'Source',10 'Values': [11 'Well-Architected',12 ],13 'Operator': 'Equal'14 },15 {16 'Key': 'Status',17 'Values': [18 'Open',19 ],20 'Operator': 'Equal'21 }22 ]23 )24 for i,val in enumerate(response['OpsItemSummaries']):25 opsitem = response['OpsItemSummaries'][i]['OpsItemId']26 update = ssm.update_ops_item(27 Status='Resolved',28 OpsItemId=opsitem29 )30 while 'NextToken' in response:31 response = ssm.describe_ops_items(32 OpsItemFilters=[33 {34 'Key': 'Source',35 'Values': [36 'Well-Architected',37 ],38 'Operator': 'Equal'39 },40 {41 'Key': 'Status',42 'Values': [43 'Open',44 ],45 'Operator': 'Equal'...
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!!