How to use execute_resource_action method in localstack

Best Python code snippet using localstack_python

template_deployer.py

Source:template_deployer.py Github

copy

Full Screen

...663# TODO remove this method664def prepare_template_body(req_data):665 return template_preparer.prepare_template_body(req_data)666def deploy_resource(resource_id, resources, stack_name):667 result = execute_resource_action(resource_id, resources, stack_name, ACTION_CREATE)668 return result669def delete_resource(resource_id, resources, stack_name):670 return execute_resource_action(resource_id, resources, stack_name, ACTION_DELETE)671def execute_resource_action_fallback(672 action_name, resource_id, resources, stack_name, resource, resource_type673):674 # using moto as fallback for now - TODO remove in the future!675 msg = 'Action "%s" for resource type %s not yet implemented' % (676 action_name,677 resource_type,678 )679 long_type = canonical_resource_type(resource_type)680 clazz = parsing.MODEL_MAP.get(long_type)681 if not clazz:682 LOG.warning(msg)683 return684 LOG.info("%s - using fallback mechanism" % msg)685 if action_name == ACTION_CREATE:686 resource_name = get_resource_name(resource) or resource_id687 result = clazz.create_from_cloudformation_json(688 resource_name, resource, aws_stack.get_region()689 )690 return result691def execute_resource_action(resource_id, resources, stack_name, action_name):692 resource = resources[resource_id]693 resource_type = get_resource_type(resource)694 func_details = get_deployment_config(resource_type)695 if not func_details or action_name not in func_details:696 if resource_type in ["Parameter"]:697 return698 return execute_resource_action_fallback(699 action_name, resource_id, resources, stack_name, resource, resource_type700 )701 LOG.debug(702 'Running action "%s" for resource type "%s" id "%s"'703 % (action_name, resource_type, resource_id)704 )705 func_details = func_details[action_name]...

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