How to use list_compliance_items method in localstack

Best Python code snippet using localstack_python

ssm.py

Source:ssm.py Github

copy

Full Screen

...20 #print(response['Entities'][i]['Id'])21 ec2_ids.append(response['Entities'][i]['Id'])22 return ec2_ids23 24 def list_compliance_items(self, ec2_id, filter):25 compliance_items = []26 token = "start" 27 #If NextToken is None, mean no more outstanding compliance result.28 while token != None: 29 if token == "start":30 response = self.client.list_compliance_items(31 Filters=[32 {33 'Key': 'ComplianceType',34 'Values': [ 'Custom:InSpec' ],35 'Type': 'EQUAL'36 },37 {38 'Key': 'Status',39 'Values': [ filter ],40 'Type': 'EQUAL'41 }42 ],43 ResourceTypes=[ 'ManagedInstance' ],44 ResourceIds=[ ec2_id ],45 MaxResults=5046 )47 compliance_items.append(response)48 if 'NextToken' not in response.keys():49 token = None50 else:51 token = response['NextToken']52 else:53 response = self.client.list_compliance_items(54 Filters=[55 {56 'Key': 'ComplianceType',57 'Values': [ 'Custom:InSpec' ],58 'Type': 'EQUAL'59 },60 {61 'Key': 'Status',62 'Values': [ filter ],63 'Type': 'EQUAL'64 }65 ],66 ResourceTypes=[ 'ManagedInstance' ],67 ResourceIds=[ ec2_id ],...

Full Screen

Full Screen

list_ssm_compliance_items.py

Source:list_ssm_compliance_items.py Github

copy

Full Screen

...13 managedinstanceinventory_client = boto3.client('ssm', region_name = j )14 managedinstanceinventory = []15 next_token = None16 while True:17 response = managedinstanceinventory_client.list_compliance_items(ResourceIds=['i-0b09826c077d14709'],18 NextToken= next_token19 ) if next_token else managedinstanceinventory_client.list_compliance_items(ResourceIds=['i-0b09826c077d14709'])20 print(response['ComplianceItems']) 21 for i in response['ComplianceItems']: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['ComplianceType'])24 25 # print(i['ComplianceType']) # name of the association2627 282930 print("count ---- " + str(len(managedinstanceinventory)))31 #print(response['pipelines'])32 # print(managedinstanceinventory)33 ...

Full Screen

Full Screen

patching_completion_status.py

Source:patching_completion_status.py Github

copy

Full Screen

...9 10 for instance in instance_list:11 response = ec2_client.describe_instances(InstanceIds=[instance])12 instance_name= [tag['Value'] for tag in response['Reservations'][0]['Instances'][0]['Tags'] if tag['Key'] == 'Name']13 #response = ssm_client.list_compliance_items(ResourceIds=[instance],ResourceTypes=['ManagedInstance'])14 #print(response['ComplianceItems'][0]['Status'])15 response=ssm_client.describe_instance_patch_states(InstanceIds=[instance])16 #if response['ComplianceItems'][0]['Status'] == 'COMPLIANT':17 if response['InstancePatchStates'][0]['MissingCount'] > 0:18 message.append(instance_name[0]+"("+instance+") not patched.\n")19 else:20 message.append(instance_name[0]+"("+instance+") patched.\n")21 22 ...

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