Best Python code snippet using localstack_python
lambda_function.py
Source: lambda_function.py
...80 aliases.extend(page['Aliases'])81 return aliases82@timeit83@aws_handle_regions84def get_event_source_mappings(lambda_function: Dict, client: botocore.client.BaseClient) -> List[Any]:85 event_source_mappings: List[Any] = []86 paginator = client.get_paginator('list_event_source_mappings')87 for page in paginator.paginate(FunctionName=lambda_function['FunctionName']):88 event_source_mappings.extend(page['EventSourceMappings'])89 return event_source_mappings90@timeit91@aws_handle_regions92def get_lambda_function_details(93 boto3_session: boto3.session.Session, data: List[Dict], region: str,94) -> Generator[Any, Any, None]:95 client = boto3_session.client('lambda', region_name=region)96 for lambda_function in data:97 function_aliases = get_function_aliases(lambda_function, client)98 event_source_mappings = get_event_source_mappings(lambda_function, client)99 layers = lambda_function.get('Layers', [])100 yield lambda_function['FunctionArn'], function_aliases, event_source_mappings, layers101@timeit102def load_lambda_function_details(103 neo4j_session: neo4j.Session, lambda_function_details: List[Tuple[str, List[Dict], List[Dict], List[Dict]]],104 update_tag: int,105) -> None:106 lambda_aliases: List[Dict] = []107 lambda_event_source_mappings: List[Dict] = []108 lambda_layers: List[Dict] = []109 for function_arn, aliases, event_source_mappings, layers in lambda_function_details:110 if len(aliases) > 0:111 for alias in aliases:112 alias['FunctionArn'] = function_arn...
lambda_functions.py
Source: lambda_functions.py
...12 else self.client.list_functions(MaxItems=20),13 "NextMarker",14 "Functions",15 )16 def get_event_source_mappings(self):17 return self.get_paginated_results(18 lambda marker: self.client.list_event_source_mappings(19 Marker=marker, MaxItems=2020 )21 if marker22 else self.client.list_event_source_mappings(MaxItems=20),23 "NextMarker",24 "EventSourceMappings",25 )26class LambdaResultsParser:27 def create_function_nodes(self, items):28 function_nodes = []29 for item in items:30 function_nodes.append(self.create_function_node(item))31 return function_nodes32 @staticmethod33 def create_function_node(function):34 return models.Resource(35 name=function["FunctionName"],36 resource_type="Lambda-Function",37 id=function["FunctionArn"],38 service="AWS-Lambda",39 category="COMPUTE",40 )41 def create_event_source_links(self, items):42 event_source_links = []43 for event_source in items:44 event_source_links.append(self.create_event_source_link(event_source))45 event_source_links.extend(46 self.create_destination_config_links(event_source)47 )48 return event_source_links49 @staticmethod50 def create_event_source_link(event_source):51 return models.Link(52 source=event_source["EventSourceArn"],53 destination=event_source["FunctionArn"],54 link_type="",55 )56 def create_destination_config_links(self, item):57 config_links = []58 config = item.get("DestinationConfig", {})59 self._create_config_link(config, "OnSuccess", config_links, "")60 self._create_config_link(config, "OnFailure", config_links, "DLQ")61 return config_links62 @staticmethod63 def _create_config_link(item, config_name, config_links, link_name):64 config = item.get(config_name, {})65 if config:66 config_links.append(67 models.Link(68 source=config["FunctionArn"],69 destination=config["Destination"],70 link_type=link_name,71 )72 )73def get(nodes, links, region):74 logging.info("Starting Lambda collection")75 collector = LambdaDataCollector(region)76 items = collector.get_functions()77 parser = LambdaResultsParser()78 nodes.extend(parser.create_function_nodes(items))79 event_sources = collector.get_event_source_mappings()80 links.extend(parser.create_event_source_links(event_sources))...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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!!