def create_templates()

in clone_mediaconvert_resources/clone_mediaconvert_resources.py [0:0]


def create_templates(destination_client, template_file):
    with open(template_file) as template:
        template_data = json.load(template)
    try:
        for template in template_data:
            response = destination_client.create_job_template(
                Name=template['Name'],
                Settings=template['Settings'],
                Category=template['Category'],
                Description=template['Description'],
                Queue=template['Queue'],
                AccelerationSettings=template['AccelerationSettings'],
                Priority=template['Priority'],
                StatusUpdateInterval=template['StatusUpdateInterval'],
                HopDestinations=template['HopDestinations']
            )
        account_id = response['JobTemplate']['Arn'].split('/')[0].split(":")[4]
        resource_type = "jobTemplates"
        create_resource_tags(destination_client, account_id, resource_type)

    except botocore.exceptions.ClientError as error:
        if error.response['Error']['Code'] == 'BadRequestException':
            print("Problem processing job template name:" + template['Name'])
        elif error.response['Error']['Code'] == 'ParamValidationError':
            print("Problem processing job template name:" + template['Name'])
            print("Boto3 is out of date, please upgrade boto3 library on this machine")
        elif error.response['Error']['Code'] == 'TooManyRequestsException':
            print("Number of job templates  allowed exceeded, please open a service quota request")
        elif error.response['Error']['Code'] == 'NotFoundException':
            print(error)
            print("Make sure to import your output presets and queues before cloning job templates")
        elif error.response['Error']['Code'] == 'AccessDeniedException':
            print("No permissions to access the MediaConvert API and create job templates,"
                  " please check the AWS CLI credentials")
            exit(-1)