Best Python code snippet using localstack_python
__init__.py
Source:__init__.py
...95 print("%s" %e)96 97def UpdateLinuxBaseline(ssm, BaselineID, group, product, severity, classification, rejectpatches):98 try:99 Baseline = ssm.update_patch_baseline(100 BaselineId=BaselineID,101 Name=group,102 ApprovalRules={103 'PatchRules': [104 {105 'PatchFilterGroup': {106 'PatchFilters': [107 {108 'Key': 'PRODUCT',109 'Values': product110 },111 {112 'Key': 'CLASSIFICATION',113 'Values': classification114 },115 {116 'Key': 'SEVERITY',117 'Values': severity118 }119 ]120 },121 'ApproveAfterDays': 0,122 'EnableNonSecurity': True123 }124 ]125 },126 ApprovedPatchesEnableNonSecurity=True,127 RejectedPatches=rejectpatches,128 RejectedPatchesAction='BLOCK'129 )130 print("Update %s Baseline %s Successfully!" %(group, BaselineID))131 except:132 print("Update %s Baseline %s Failed!" %(group, BaselineID))133 e=sys.exc_info()[1]134 print("%s" %e)135 136def UpdateWindowsBaseline(ssm, BaselineID, group, product, severity, classification, rejectpatches):137 try:138 Baseline = ssm.update_patch_baseline(139 BaselineId=BaselineID,140 Name=group,141 ApprovalRules={142 'PatchRules': [143 {144 'PatchFilterGroup': {145 'PatchFilters': [146 {147 'Key': 'PRODUCT',148 'Values': product149 },150 {151 'Key': 'CLASSIFICATION',152 'Values': classification...
lambda_function.py
Source:lambda_function.py
...49 return False50def updated_rejected_patches(client, to_be_modified_baselines, rejected_patches=[]):51 response_list = []52 for each_base_line in to_be_modified_baselines:53 response = client.update_patch_baseline(BaselineId=each_base_line,54 RejectedPatches=rejected_patches)55 response_list.append(response)56 return response_list57def collect_rejected_patches(s3bucket, filename):58 """59 implement logic to read the file from s3 bucket60 :return:61 """62 s3client = boto3.client('s3', region_name='us-east-1')63 file_obj = s3client.get_object(64 Bucket=s3bucket,65 Key=filename66 )67 file_data = file_obj['Body'].read().decode("utf-8")...
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!!