in clone_mediaconvert_resources/clone_mediaconvert_resources.py [0:0]
def create_presets(destination_client, presets_file):
with open(presets_file) as presets:
preset_data = json.load(presets)
try:
for preset in preset_data:
response = destination_client.create_preset(
Name=preset['Name'],
Settings=preset['Settings'],
Category=preset['Category'],
Description=preset['Description']
)
account_id = response['Preset']['Arn'].split('/')[0].split(":")[4]
resource_type = response['Preset']['Arn'].split('/')[0].split(":")[5]
create_resource_tags(destination_client, account_id, resource_type)
except botocore.exceptions.ClientError as error:
if error.response['Error']['Code'] == 'BadRequestException':
print("Problem processing preset name:" + preset['Name'])
elif error.response['Error']['Code'] == 'ParamValidationError':
print("Problem processing preset name:" + preset['Name'])
print("Boto3 is out of date, please upgrade boto3 library on this machine")
elif error.response['Error']['Code'] == 'TooManyRequestsException':
print("Number of presets allowed exceeded, please open a service quota request")
elif error.response['Error']['Code'] == 'AccessDeniedException':
print("No Permissions to access the MediaConvert API and create output presets,"
" please check the AWS CLI credentials")
exit(-1)