Best Python code snippet using localstack_python
provider.py
Source:provider.py
...79def get_pattern_matcher(pattern: str) -> Callable[[str, Dict], bool]:80 """Returns a pattern matcher. Can be patched by plugins to return a more sophisticated pattern matcher."""81 return lambda _pattern, _log_event: True82@patch(LogsBackend.put_subscription_filter)83def moto_put_subscription_filter(fn, self, *args, **kwargs):84 log_group_name = args[0]85 filter_name = args[1]86 filter_pattern = args[2]87 destination_arn = args[3]88 role_arn = args[4]89 log_group = self.groups.get(log_group_name)90 if not log_group:91 raise ResourceNotFoundException("The specified log group does not exist.")92 if ":lambda:" in destination_arn:93 client = aws_stack.connect_to_service("lambda")94 lambda_name = aws_stack.lambda_function_name(destination_arn)95 try:96 client.get_function(FunctionName=lambda_name)97 except Exception:...
logs_listener.py
Source:logs_listener.py
...126 client.put_record(127 DeliveryStreamName=firehose_name,128 Record={"Data": json.dumps(payload_gz_encoded)},129 )130def moto_put_subscription_filter(fn, self, *args, **kwargs):131 log_group_name = args[0]132 filter_name = args[1]133 filter_pattern = args[2]134 destination_arn = args[3]135 role_arn = args[4]136 log_group = self.groups.get(log_group_name)137 if not log_group:138 raise ResourceNotFoundException("The specified log group does not exist.")139 if ":lambda:" in destination_arn:140 client = aws_stack.connect_to_service("lambda")141 lambda_name = aws_stack.lambda_function_name(destination_arn)142 try:143 client.get_function(FunctionName=lambda_name)144 except Exception:...
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!!