def update()

in functions/source/CfnCrossRegion/lambda_function.py [0:0]


def update(event, context):
    """
    Update a cfn stack using an assumed role
    """
    stack_id = event["PhysicalResourceId"]
    cfn_capabilities = []
    if 'capabilities' in event['ResourceProperties'].keys():
        cfn_capabilities = event['ResourceProperties']['capabilities']
    cfn_client = get_client("cloudformation", event, context)
    physical_resource_id = stack_id
    try:
        cfn_client.update_stack(
            StackName=stack_id,
            TemplateURL=event['ResourceProperties']['TemplateURL'],
            Parameters=get_cfn_parameters(event),
            Capabilities=cfn_capabilities,
            Tags=[{
                'Key': 'ParentStackId',
                'Value': event['ResourceProperties']['ParentStackId']
            }]
        )
    except ClientError as e:
        if "No updates are to be performed" not in str(e):
            raise
    event["Poll"] = True
    setup_poll(event, context)
    return physical_resource_id, {}