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

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