Best Python code snippet using localstack_python
ssm.py
Source:ssm.py
...14 self.logger = logger15 self.instance_id = instance_id16 self.region = region17 self.client = retryable_client.RetryableClient("ssm", self.instance_id, self.region, self.logger)18 def describe_patch_baselines(self, operating_system, parser=None):19 """20 Method for calling describe_patch_baseline.21 :param - operating_system is the operating_system of the current instance.22 :param - parser is an object with a .parse() method that will take as input the result of a page of describe_patch_baselines() result.23 :return - the result of parser.parse or a list of pages form the request.24 """25 try:26 operation_parameters = None27 return self.client.call_pageable_client(self.client.default_client, "describe_patch_baselines", operation_parameters, parser)28 29 except ClientError as e:30 if e.response['Error']['Code'] == 'AccessDeniedException':31 raise PatchManagerError("DescribePatchBaselines had access denied.",32 ExitCodes.DESCRIBE_PATCH_BASELINES_ACCESS_DENIED)33 else:34 raise PatchManagerError("DescribePatchBaselines failed", ExitCodes.DESCRIBE_PATCH_BASELINES_API_ERROR, e)35 except Exception as e:36 raise PatchManagerError("DescribePatchBaselines failed.", ExitCodes.DESCRIBE_PATCH_BASELINES_ERROR, e)...
register-default-patch-baseline.py
Source:register-default-patch-baseline.py
...12 checkOperatingSystem = True13 return checkAction and checkOperatingSystem14def retrieveAWSDefaultPatchBaselineForOperatingSystem(client,operatingSystem):15 # the AWS default Patch Baseline are the same in any AWS Account, depending of the region16 response = client.describe_patch_baselines(Filters=[17 {18 'Key': 'OWNER',19 'Values': [20 'AWS',21 ]22 },23 ],24 )25 baseLineIdentities = response['BaselineIdentities']26 for baselineIdentity in baseLineIdentities:27 if baselineIdentity['OperatingSystem'] == operatingSystem:28 return baselineIdentity['BaselineId']29###########################30# MAIN...
describe_ssm_patch_baselines.py
Source:describe_ssm_patch_baselines.py
...13 managedinstanceinventory_client = boto3.client('ssm', region_name = j )14 managedinstanceinventory = []15 next_token = None16 while True:17 response = managedinstanceinventory_client.describe_patch_baselines(18 NextToken= next_token19 ) if next_token else managedinstanceinventory_client.describe_patch_baselines()20 print(response['BaselineIdentities']) 21 for i in response['BaselineIdentities']: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['BaselineName'])24 #print(i['Name'] ) #document name25 # print(response['Associations'])26 print(i['BaselineName']) # name of the association2728 293031 #arn = i['name']32 #print(len(i['FunctionArn']))33 #print(arn)
...
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!!