def update()

in custom_resource/handler.py [0:0]


def update(event, context):
    # If the update resulted in a new resource being created, return an id for the new resource. 
    # CloudFormation will send a delete event with the old id when stack update completes

    arn = event['PhysicalResourceId']
    original_name = deserialize_sampling_rule_name(arn)
    new_name = event['ResourceProperties']['Name']

    # handle change of the sampling rule's name by creating a new one (name is immutable)
    if original_name != new_name:
        return create(event, context)

    config = create_configuration(event)  
    response = client.update_sampling_rule(SamplingRuleUpdate=config)
    setup_resource_properties_and_return_arn(response)