def run()

in roles/gcs-upload/library/gcs_upload.py [0:0]


def run(container, prefix, root, credentials_file=None, project=None,
        cache_control=None):
    if credentials_file:
        cred = Credentials()
        cred._set_path(credentials_file)
        client = storage.Client(credentials=cred, project=project)
    else:
        client = storage.Client()

    file_list = []
    if root.endswith('/'):
        root = root[:-1]
    for path, folders, files in os.walk(root):
        for filename in files:
            full_path = os.path.join(path, filename)
            relative_path = full_path[len(root)+1:]
            file_list.append((full_path, relative_path))

    uploader = Uploader(client, container, prefix, cache_control)
    uploader.upload(file_list)
    return file_list