Best Python code snippet using localstack_python
ct_configrecorder_override_consumer.py
Source:ct_configrecorder_override_consumer.py
...69 CONFIG_RECORDER_RESOURCE_STRING = os.getenv('CONFIG_RECORDER_RESOURCE_LIST')70 CONFIG_RECORDER_RESOURCE_LIST = CONFIG_RECORDER_RESOURCE_STRING.split(',')71 # Event = Delete is when stack is deleted, we rollback changed made and leave it as ControlTower Intended72 if event == 'Delete':73 response = configservice.put_configuration_recorder(74 ConfigurationRecorder={75 'name': 'aws-controltower-BaselineConfigRecorder',76 'roleARN': role_arn,77 'recordingGroup': {78 'allSupported': True,79 'includeGlobalResourceTypes': False80 }81 })82 else:83 response = configservice.put_configuration_recorder(84 ConfigurationRecorder={85 'name': 'aws-controltower-BaselineConfigRecorder',86 'roleARN': role_arn,87 'recordingGroup': {88 'allSupported': False,89 'includeGlobalResourceTypes': False,90 'resourceTypes': CONFIG_RECORDER_RESOURCE_LIST91 }92 })93 logging.info(f'Response for put_configuration_recorder :{response} ')94 #lets describe for configuration recorder after the update95 configrecorder = configservice.describe_configuration_recorders()96 logging.info(f'Post Change Configuration recorder : {configrecorder}')97 except ClientError as exe:...
aws_config.py
Source:aws_config.py
...8logger.setLevel(logging.INFO)9class ConfigService:10 def __init__(self):11 self.session = boto3.session.Session()12 def put_configuration_recorder(13 self,14 role_arn: str,15 resource_types: List,16 region_name: str,17 name="default",18 all_supported=False,19 include_global_resource_types=False,20 ) -> None:21 """22 refs: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/config.html#ConfigService.Client.put_configuration_recorder23 """24 try:25 client: ConfigServiceClient = self.session.client(26 "config",27 region_name=str(region_name),28 config=Config(),29 )30 client.put_configuration_recorder(31 ConfigurationRecorder={32 "name": name,33 "roleARN": role_arn,34 "recordingGroup": {35 "allSupported": all_supported,36 "includeGlobalResourceTypes": include_global_resource_types,37 "resourceTypes": resource_types,38 },39 }40 )41 except Exception as e:42 logger.error(e)43 return44 else:...
responses.py
Source:responses.py
...4class ConfigResponse(BaseResponse):5 @property6 def config_backend(self):7 return config_backends[self.region]8 def put_configuration_recorder(self):9 self.config_backend.put_configuration_recorder(self._get_param('ConfigurationRecorder'))10 return ""11 def describe_configuration_recorders(self):12 recorders = self.config_backend.describe_configuration_recorders(self._get_param('ConfigurationRecorderNames'))13 schema = {'ConfigurationRecorders': recorders}14 return json.dumps(schema)15 def describe_configuration_recorder_status(self):16 recorder_statuses = self.config_backend.describe_configuration_recorder_status(17 self._get_param('ConfigurationRecorderNames'))18 schema = {'ConfigurationRecordersStatus': recorder_statuses}19 return json.dumps(schema)20 def put_delivery_channel(self):21 self.config_backend.put_delivery_channel(self._get_param('DeliveryChannel'))22 return ""23 def describe_delivery_channels(self):...
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!!