How to use validate_mutation_protection method in localstack

Best Python code snippet using localstack_python

provider.py

Source: provider.py Github

copy

Full Screen

...344 ) -> AssociateFirewallRuleGroupResponse:345 """Associate a firewall rule group with a VPC."""346 region_details = Route53ResolverBackend.get()347 validate_priority(priority=priority)348 validate_mutation_protection(mutation_protection=mutation_protection)349 for (350 firewall_rule_group_association351 ) in region_details.firewall_rule_group_associations.values():352 if (353 firewall_rule_group_association.get("VpcId") == vpc_id354 and firewall_rule_group_association.get("FirewallRuleGroupId")355 == firewall_rule_group_id356 ):357 raise ValidationException(358 f"[RSLVR-02302] This DNS Firewall rule group can't be associated to a VPC: '{vpc_id}'. It is already associated to VPC '{firewall_rule_group_id}'. Try again with another VPC or DNS Firewall rule group. Trace Id: '{aws_stack.get_trace_id()}'"359 )360 id = get_route53_resolver_firewall_rule_group_association_id()361 arn = aws_stack.get_route53_resolver_firewall_rule_group_associations_arn(id)362 firewall_rule_group_association = FirewallRuleGroupAssociation(363 Id=id,364 Arn=arn,365 FirewallRuleGroupId=firewall_rule_group_id,366 VpcId=vpc_id,367 Name=name,368 Priority=priority,369 MutationProtection=mutation_protection or "DISABLED",370 Status="COMPLETE",371 StatusMessage="Creating Firewall Rule Group Association",372 CreatorRequestId=creator_request_id,373 CreationTime=datetime.now(timezone.utc).isoformat(),374 ModificationTime=datetime.now(timezone.utc).isoformat(),375 )376 region_details.firewall_rule_group_associations[id] = firewall_rule_group_association377 moto_route53resolver_backends[context.region].tagger.tag_resource(arn, tags or [])378 return AssociateFirewallRuleGroupResponse(379 FirewallRuleGroupAssociation=firewall_rule_group_association380 )381 def disassociate_firewall_rule_group(382 self, context: RequestContext, firewall_rule_group_association_id: ResourceId383 ) -> DisassociateFirewallRuleGroupResponse:384 """Disassociate a DNS Firewall rule group from a VPC."""385 firewall_rule_group_association: FirewallRuleGroupAssociation = (386 delete_firewall_rule_group_association(firewall_rule_group_association_id)387 )388 return DisassociateFirewallRuleGroupResponse(389 FirewallRuleGroupAssociation=firewall_rule_group_association390 )391 def get_firewall_rule_group_association(392 self, context: RequestContext, firewall_rule_group_association_id: ResourceId393 ) -> GetFirewallRuleGroupAssociationResponse:394 """Returns the Firewall Rule Group Association that you specified."""395 firewall_rule_group_association: FirewallRuleGroupAssociation = (396 get_firewall_rule_group_association(firewall_rule_group_association_id)397 )398 return GetFirewallRuleGroupAssociationResponse(399 FirewallRuleGroupAssociation=firewall_rule_group_association400 )401 def update_firewall_rule_group_association(402 self,403 context: RequestContext,404 firewall_rule_group_association_id: ResourceId,405 priority: Priority = None,406 mutation_protection: MutationProtectionStatus = None,407 name: Name = None,408 ) -> UpdateFirewallRuleGroupAssociationResponse:409 """Updates the specified Firewall Rule Group Association."""410 validate_priority(priority=priority)411 validate_mutation_protection(mutation_protection=mutation_protection)412 firewall_rule_group_association: FirewallRuleGroupAssociation = (413 get_firewall_rule_group_association(firewall_rule_group_association_id)414 )415 if priority:416 firewall_rule_group_association["Priority"] = priority417 if mutation_protection:418 firewall_rule_group_association["MutationProtection"] = mutation_protection419 if name:420 firewall_rule_group_association["Name"] = name421 return UpdateFirewallRuleGroupAssociationResponse(422 FirewallRuleGroupAssociation=firewall_rule_group_association423 )424@patch(MotoRoute53ResolverBackend._matched_arn)425def Route53ResolverBackend_matched_arn(fn, self, resource_arn):...

Full Screen

Full Screen

utils.py

Source: utils.py Github

copy

Full Screen

...13 if priority not in range(100, 9900):14 raise ValidationException(15 f"[RSLVR-02017] The priority value you provided is reserved. Provide a number between '100' and '9900'. Trace Id: '{aws_stack.get_trace_id()}'"16 )17def validate_mutation_protection(mutation_protection):18 if mutation_protection:19 if mutation_protection not in ["ENABLED", "DISABLED"]:20 raise ValidationException(21 f"[RSLVR-02018] The mutation protection value you provided is reserved. Provide a value of 'ENABLED' or 'DISABLED'. Trace Id: '{aws_stack.get_trace_id()}'"...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

13 Best Java Testing Frameworks For 2023

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 Innovation – Using the senseshaping concept to discover customer needs

QA Innovation - Using the senseshaping concept to discover customer needsQA 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.

Best 23 Web Design Trends To Follow In 2023

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.

Acquiring Employee Support for Change Management Implementation

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.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful