def startTrail()

in CloudTrailRemediation/CloudTrailRemediation.py [0:0]


def startTrail(trailArn):
    """Priority action.
       Verifies if the provided trail is running and if not starts it.

    Args:
        trailArn (String): ARN for the triggered trail.

    Returns:
        TYPE: String
    """
    client = boto3.client('cloudtrail')
    response = client.get_trail_status(
        Name=trailArn
    )
    # Check if someone already started the trail
    if response['IsLogging']:
        print "Logging already started"
        return "NoActionNeeded"
    else:
        print "Starting trail: ", trailArn
        response = client.start_logging(
            Name=trailArn
        )
        return "Trail started"