in clone_mediaconvert_resources/clone_mediaconvert_resources.py [0:0]
def get_resource_tags(arns, file):
try:
region = arns[0].split('/')[0].split(':')[3]
resource_client = create_clients(region)
tagged_resource = []
for arn in arns:
results = resource_client.list_tags_for_resource(Arn=arn)
if results['ResourceTags']['Tags'] != {}:
tagged_resource.append(results['ResourceTags'])
if len(tagged_resource) > 0:
clean_resource_tags(tagged_resource, file)
except botocore.exceptions.ClientError as error:
if error.response['Error']['Code'] == 'AccessDeniedException':
print("No permissions to access the MediaConvert API and get resource tags,"
" please check the AWS CLI credentials")
exit(-1)