Best Python code snippet using localstack_python
provider.py
Source:provider.py
...603 def get_firewall_config(604 self, context: RequestContext, resource_id: ResourceId605 ) -> GetFirewallConfigResponse:606 region_details = Route53ResolverBackend.get()607 firewall_config = region_details.get_or_create_firewall_config(608 resource_id, context.region, context.account_id609 )610 return GetFirewallConfigResponse(FirewallConfig=firewall_config)611 def list_firewall_configs(612 self,613 context: RequestContext,614 max_results: ListFirewallConfigsMaxResult = None,615 next_token: NextToken = None,616 ) -> ListFirewallConfigsResponse:617 region_details = Route53ResolverBackend.get()618 firewall_configs = []619 backend = ec2_backends[context.region]620 for vpc in backend.vpcs:621 if vpc not in region_details.firewall_configs:622 region_details.get_or_create_firewall_config(623 vpc, context.region, context.account_id624 )625 for firewall_config in region_details.firewall_configs.values():626 firewall_configs.append(select_from_typed_dict(FirewallConfig, firewall_config))627 return ListFirewallConfigsResponse(FirewallConfigs=firewall_configs)628 def update_firewall_config(629 self,630 context: RequestContext,631 resource_id: ResourceId,632 firewall_fail_open: FirewallFailOpenStatus,633 ) -> UpdateFirewallConfigResponse:634 region_details = Route53ResolverBackend.get()635 backend = ec2_backends[context.region]636 for resource_id in backend.vpcs:637 if resource_id not in region_details.firewall_configs:638 firewall_config = region_details.get_or_create_firewall_config(639 resource_id, context.region, context.account_id640 )641 firewall_config["FirewallFailOpen"] = firewall_fail_open642 else:643 firewall_config = region_details.firewall_configs[resource_id]644 firewall_config["FirewallFailOpen"] = firewall_fail_open645 return UpdateFirewallConfigResponse(FirewallConfig=firewall_config)646@patch(MotoRoute53ResolverBackend._matched_arn)647def Route53ResolverBackend_matched_arn(fn, self, resource_arn):648 """Given ARN, raise exception if there is no corresponding resource."""649 region_details = Route53ResolverBackend.get()650 for firewall_rule_group in region_details.firewall_rule_groups.values():651 if firewall_rule_group.get("Arn") == resource_arn:652 return...
models.py
Source:models.py
...119 )120 association["Status"] = "DELETING"121 association_id = association.get("Id")122 return self.resolver_query_log_config_associations.pop(association_id)123 def get_or_create_firewall_config(self, resource_id, region, owner_id):124 """returns the firewall config with the given id if it exists or creates a new one"""125 validate_vpc(resource_id, region)126 firewall_config: FirewallConfig127 if self.firewall_configs.get(resource_id):128 firewall_config = self.firewall_configs[resource_id]129 else:130 id = get_firewall_config_id()131 firewall_config = FirewallConfig(132 Id=id,133 ResourceId=resource_id,134 OwnerId=owner_id,135 FirewallFailOpen="DISABLED",136 )137 self.firewall_configs[resource_id] = firewall_config...
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!!