Best Python code snippet using localstack_python
provider.py
Source:provider.py  
...154        firewall_domain_list: FirewallDomainList = delete_firewall_domain_list(155            firewall_domain_list_id156        )157        return DeleteFirewallDomainListResponse(FirewallDomainList=firewall_domain_list)158    def get_firewall_domain_list(159        self, context: RequestContext, firewall_domain_list_id: ResourceId160    ) -> GetFirewallDomainListResponse:161        """Get the details of a Firewall Domain List."""162        firewall_domain_list: FirewallDomainList = get_firewall_domain_list(firewall_domain_list_id)163        return GetFirewallDomainListResponse(FirewallDomainList=firewall_domain_list)164    def list_firewall_domain_lists(165        self, context: RequestContext, max_results: MaxResults = None, next_token: NextToken = None166    ) -> ListFirewallDomainListsResponse:167        """List all Firewall Domain Lists."""168        region_details = Route53ResolverBackend.get()169        firewall_domain_lists = []170        for firewall_domain_list in region_details.firewall_domain_lists.values():171            firewall_domain_list.append(172                select_from_typed_dict(FirewallDomainListMetadata, firewall_domain_list)173            )174        return ListFirewallDomainListsResponse(FirewallDomainLists=firewall_domain_lists)175    def update_firewall_domains(176        self,177        context: RequestContext,178        firewall_domain_list_id: ResourceId,179        operation: FirewallDomainUpdateOperation,180        domains: FirewallDomains,181    ) -> UpdateFirewallDomainsResponse:182        """Update the domains in a Firewall Domain List."""183        region_details = Route53ResolverBackend.get()184        firewall_domain_list: FirewallDomainList = get_firewall_domain_list(firewall_domain_list_id)185        firewall_domain_list: FirewallDomainList = get_firewall_domain_list(firewall_domain_list_id)186        firewall_domains = get_firewall_domain(firewall_domain_list_id)187        if operation == FirewallDomainUpdateOperation.ADD:188            if not firewall_domains:189                region_details.firewall_domains[firewall_domain_list_id] = domains190            else:191                region_details.firewall_domains[firewall_domain_list_id].append(domains)192        if operation == FirewallDomainUpdateOperation.REMOVE:193            if firewall_domains:194                for domain in domains:195                    if domain in firewall_domains:196                        firewall_domains.remove(domain)197                    else:198                        raise ValidationException(199                            f"[RSLVR-02502] The following domains don't exist in the DNS Firewall domain list '{firewall_domain_list_id}'. You can't delete a domain that isn't in a domain list. Example unknown domain: '{domain}'. Trace Id: '{aws_stack.get_trace_id()}'"...get_firewall_domain_list.py
Source:get_firewall_domain_list.py  
...133            modification_time=self.modification_time,134            status=self.status,135            status_message=self.status_message,136            tags=self.tags)137def get_firewall_domain_list(id: Optional[str] = None,138                             opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetFirewallDomainListResult:139    """140    Resource schema for AWS::Route53Resolver::FirewallDomainList.141    :param str id: ResourceId142    """143    __args__ = dict()144    __args__['id'] = id145    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)146    __ret__ = pulumi.runtime.invoke('aws-native:route53resolver:getFirewallDomainList', __args__, opts=opts, typ=GetFirewallDomainListResult).value147    return AwaitableGetFirewallDomainListResult(148        arn=__ret__.arn,149        creation_time=__ret__.creation_time,150        creator_request_id=__ret__.creator_request_id,151        domain_count=__ret__.domain_count,...models.py
Source:models.py  
...49    # firewall_domain can return none50    region_details = Route53ResolverBackend.get()51    firewall_domain = region_details.firewall_domains.get(id)52    return firewall_domain53def get_firewall_domain_list(id):54    """returns firewall domain list with the given id if it exists"""55    region_details = Route53ResolverBackend.get()56    firewall_domain_list = region_details.firewall_domain_lists.get(id)57    if not firewall_domain_list:58        raise ResourceNotFoundException(59            f"Can't find the resource with ID '{id}'. Trace Id: '{aws_stack.get_trace_id()}'"60        )61    return firewall_domain_list62def delete_firewall_domain_list(id):63    """deletes the firewall domain list with the given id"""64    # if firewall_domain_lists doesn't exist it will throw an error65    region_details = Route53ResolverBackend.get()66    firewall_domain_list = get_firewall_domain_list(id)67    region_details.firewall_domain_lists.pop(id)68    return firewall_domain_list69def get_firewall_rule(firewall_rule_group_id, firewall_domain_list_id):70    """returns firewall rule with the given id if it exists"""71    region_details = Route53ResolverBackend.get()72    firewall_rule = region_details.firewall_rules.get(firewall_rule_group_id, {}).get(73        firewall_domain_list_id74    )75    if not firewall_rule:76        raise ResourceNotFoundException(77            f"Can't find the resource with ID '{firewall_rule_group_id}'. Trace Id: '{aws_stack.get_trace_id()}'"78        )79    return firewall_rule80def delete_firewall_rule(firewall_rule_group_id, firewall_domain_list_id):...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!!
