How to use lambda_keys_to_lower method in localstack

Best Python code snippet using localstack_python

apigateway.py

Source: apigateway.py Github

copy

Full Screen

...409 "function": "create_usage_plan",410 "parameters": {411 "name": "UsagePlanName",412 "description": "Description",413 "apiStages": lambda_keys_to_lower("ApiStages"),414 "quota": lambda_keys_to_lower("Quota"),415 "throttle": lambda_keys_to_lower("Throttle"),416 "tags": params_list_to_dict("Tags"),417 },418 "types": {419 "limit": int,420 "burstLimit": int,421 "rateLimit": float,422 },423 }424 }425 def get_physical_resource_id(self, attribute=None, **kwargs):426 return self.props.get("id")427class GatewayApiKey(GenericBaseModel):428 @staticmethod429 def cloudformation_type():430 return "AWS::ApiGateway::ApiKey"431 def fetch_state(self, stack_name, resources):432 props = self.props433 key_name = self.resolve_refs_recursively(stack_name, props.get("Name"), resources)434 cust_id = props.get("CustomerId")435 result = aws_stack.connect_to_service("apigateway").get_api_keys().get("items", [])436 result = [437 r438 for r in result439 if r.get("name") == key_name and cust_id in (None, r.get("customerId"))440 ]441 return (result or [None])[0]442 @staticmethod443 def add_defaults(resource, stack_name: str):444 role_name = resource.get("Properties", {}).get("Name")445 if not role_name:446 resource["Properties"]["Name"] = generate_default_name(447 stack_name, resource["LogicalResourceId"]448 )449 @staticmethod450 def get_deploy_templates():451 return {452 "create": {453 "function": "create_api_key",454 "parameters": {455 "description": "Description",456 "customerId": "CustomerId",457 "name": "Name",458 "value": "Value",459 "enabled": "Enabled",460 "stageKeys": lambda_keys_to_lower("StageKeys"),461 "tags": params_list_to_dict("Tags"),462 },463 "types": {"enabled": bool},464 }465 }466 def get_physical_resource_id(self, attribute=None, **kwargs):467 return self.props.get("id")468class GatewayUsagePlanKey(GenericBaseModel):469 @staticmethod470 def cloudformation_type():471 return "AWS::ApiGateway::UsagePlanKey"472 def fetch_state(self, stack_name, resources):473 client = aws_stack.connect_to_service("apigateway")474 key_id = self.resolve_refs_recursively(stack_name, self.props.get("KeyId"), resources)475 key_type = self.resolve_refs_recursively(stack_name, self.props.get("KeyType"), resources)476 plan_id = self.resolve_refs_recursively(477 stack_name, self.props.get("UsagePlanId"), resources478 )479 result = client.get_usage_plan_keys(usagePlanId=plan_id).get("items", [])480 result = [r for r in result if r["id"] == key_id and key_type in [None, r.get("type")]]481 return (result or [None])[0]482 @staticmethod483 def get_deploy_templates():484 return {485 "create": {486 "function": "create_usage_plan_key",487 "parameters": lambda_keys_to_lower(),488 }489 }490 def get_physical_resource_id(self, attribute=None, **kwargs):491 return self.props.get("id")492# TODO: add tests for this resource type493class GatewayDomain(GenericBaseModel):494 @staticmethod495 def cloudformation_type():496 return "AWS::ApiGateway::DomainName"497 def fetch_state(self, stack_name, resources):498 return aws_stack.connect_to_service("apigateway").get_domain_name(499 domainName=self.props["DomainName"]500 )501 @staticmethod502 def get_deploy_templates():503 return {504 "create": {505 "function": "create_domain_name",506 "parameters": {507 "certificateArn": lambda_keys_to_lower("CertificateArn"),508 "domainName": lambda_keys_to_lower("DomainName"),509 "endpointConfiguration": lambda_keys_to_lower("EndpointConfiguration"),510 "mutualTlsAuthentication": lambda_keys_to_lower("MutualTlsAuthentication"),511 "ownershipVerificationCertificateArn": lambda_keys_to_lower(512 "OwnershipVerificationCertificateArn"513 ),514 "regionalCertificateArn": lambda_keys_to_lower("RegionalCertificateArn"),515 "securityPolicy": lambda_keys_to_lower("SecurityPolicy"),516 "tags": params_list_to_dict("Tags"),517 },518 }519 }520 def get_physical_resource_id(self, attribute=None, **kwargs):521 return self.props.get("domainName")522# TODO: add tests for this resource type523class GatewayBasePathMapping(GenericBaseModel):524 @staticmethod525 def cloudformation_type():526 return "AWS::ApiGateway::BasePathMapping"527 def fetch_state(self, stack_name, resources):528 resources = (529 aws_stack.connect_to_service("apigateway")...

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