def get_queues()

in clone_mediaconvert_resources/clone_mediaconvert_resources.py [0:0]


def get_queues(source_client, file):
    try:
        response = source_client.list_queues(ListBy='NAME')
        results = response['Queues']
        while "NextToken" in response:
            response = source_client.list_queues(NextToken=response["NextToken"])
            results.extend(response["Queues"])

        # Check to see if there is only 1 queue:
        if len(results) == 1:
            print("You only have 1 queue, which is the Default queue, in the region. ")
            print("All MediaConvert regions come with an Default queue, there is no need to clone this ")
            return
        else:
            path = clean_queues(results, file)
            return path
    except botocore.exceptions.ClientError as error:
        if error.response['Error']['Code'] == 'AccessDeniedException':
            print("No permissions to access the MediaConvert API and get queues,"
                  " please check the AWS CLI credentials")
            exit(-1)
    except:
        print("Error processing queue resources in source region")