{ "info": { "author": "Patrick Titzler", "author_email": "ptitzler@us.ibm.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# Cloud Object Storage CLI\n\n[![Build Status](https://travis-ci.com/CODAIT/cos-utils.svg)](https://travis-ci.com/CODAIT/cos-utils) [![PyPI release](https://img.shields.io/pypi/v/cos-utils.svg)](https://pypi.org/project/cos-utils/) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cos-utils)\n\nTable of content:\n- [Getting Started](#getting-started)\n- [Listing Cloud Object Storage buckets](#listing-cloud-object-storage-buckets)\n- [Listing the content of a Cloud Object Storage bucket](#listing-the-content-of-a-cloud-object-storage-bucket)\n- [Uploading files to a Cloud Object Storage bucket](#uploading-files-to-a-cloud-object-storage-bucket)\n- [Downloading files from a Cloud Object Storage bucket](#downloading-files-from-a-cloud-object-storage-bucket)\n- [Removing files from a Cloud Object Storage bucket](#removing-files-from-a-cloud-object-storage-bucket)\n\n---\n\n## Getting started\n\nThe utility requires Python 3.6 or above. \n\n### Installation\n\nYou can install the utility from [PyPI](https://pypi.org/project/cos-utils) or from the [source](#install-from-source).\n\n#### Install from pypi.org\n\n```\n$ pip install cos-utils --upgrade\n```\n\n#### Install from source code\n\n```\n$ git clone https://github.com/CODAIT/cos-utils.git\n$ cd cos-utils\n$ pip install .\n```\n\n#### Configuration\n\nSet the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`environment variables based on your [Cloud Object Storage HMAC credentials](https://cloud.ibm.com/docs/services/cloud-object-storage/iam?topic=cloud-object-storage-service-credentials).\n```\n$ export AWS_ACCESS_KEY_ID=...\n$ export AWS_SECRET_ACCESS_KEY=...\n```\n\n# Listing Cloud Object Storage buckets\n\nYou can run the list utility in a terminal window using the generated console script\n\n```\n$ list_buckets --help\n```\n\nor explicitly\n\n```\n$ python -m cos_utils.list_buckets --help\n```\n\nThe help lists required and optional parameters.\n\n```\nusage: list_buckets [-h] pattern\n\nList buckets in Cloud Object Storage instance.\n\npositional arguments:\n pattern Bucket name spec (supported wildcards: * and ?)\n\noptional arguments:\n -h, --help show this help message and exit\n\nEnvironment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be\ndefined to run the utility.\n```\n\n## List all buckets\n\n```\n$ list_buckets *\n```\n\n> On Linux, Unix and MacOS wildcards need to be escaped to prevent shell expansion: `list_files \\*`.\n\n## Apply a filter\n\nUse the `*` (any character) and `?` (one character) wildcards to define a filter condition.\n\nFor example, to limit output to buckets starting with `data-`:\n\n```\n$ list_buckets data-*\n```\n\n# Listing the content of a Cloud Object Storage bucket\n\nYou can run the list utility in a terminal window using the generated console script\n\n```\n$ list_files --help\n```\n\nor explicitly\n\n```\n$ python -m cos_utils.list_files --help\n```\n\nThe help lists required and optional parameters.\n\n```\nusage: list_files [-h] bucket pattern\n\nList the content of a Cloud Object Storage bucket.\n\npositional arguments:\n bucket Bucket name\n pattern Object key spec (supported wildcards: * and ?)\n\noptional arguments:\n -h, --help show this help message and exit\n\nEnvironment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be\ndefined to run the utility.\n```\n\n## List the content of ``\n\n```\n$ list_files *\n```\n\n> On Linux, Unix and MacOS wildcards need to be escaped to prevent shell expansion: `list_files \\*`.\n\n## Apply a filter\n\nUse the `*` (any character) and `?` (one character) wildcards to define a filter condition.\n\nFor example, to limit output to files ending in `.png`:\n\n```\n$ list_files *.png\n```\n\n# Uploading files to a Cloud Object Storage bucket\n\nYou can run the upload utility in a terminal window using the generated console script\n\n```\n$ upload_files --help\n```\n\nor explicitly\n\n```\n$ python -m cos_utils.upload_files --help\n```\n\nThe help lists required and optional parameters. The examples listed below explain them in detail.\n\n```\nusage: upload_files [-h] [-p PREFIX] [-r] [-s] [-w] bucket pattern\n\nUpload files to a Cloud Object Storage bucket.\n\npositional arguments:\n bucket Bucket name\n pattern File or directory spec (supported wildcards: * and ?)\n\noptional arguments:\n -h, --help show this help message and exit\n -p PREFIX, --prefix PREFIX\n Key name prefix\n -r, --recursive Include files in subdirectories\n -s, --squash Exclude subdirectory name from key name\n -w, --wipe Clear bucket prior to upload\n\nEnvironment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be\ndefined to run the utility.\n```\n\n## Example scenario\n\nThe `` contains the following directories and files:\n```\nfile1.png\nfile2.png\nfile3.jpg\nfile4.txt\ndir1/file5.gif\ndir1/file6.png\ndir1/dir2/file7.png\ndir1/dir3/file8.jpg\ndir1/dir3/file1.png\n```\n\nIn the examples given below `` refers to an existing bucket in Cloud Object Storage.\n\n## Upload directories\n\nYou can upload the content of any directory.\n\n### Upload the content of `` to bucket ``\n\n```\n$ upload_files \n```\n\nBucket `` contains the following objects:\n\n```\nfile1.png\nfile2.png\nfile3.jpg\nfile4.txt\n```\n\n### Same as before but clear the bucket first before uploading\n\nSpecify the optional `--wipe` parameter to clear the bucket before upload.\n\n```\n$ upload_files --wipe\n```\n\nBucket `` contains the following objects:\n\n```\nfile1.png\nfile2.png\nfile3.jpg\nfile4.txt\n```\n\n### Same as before but include subdirectories\n\nSpecify the optional `--recursive` parameter include files in subdirectories.\n\n```\n$ upload_files --wipe --recursive\n```\n\nBucket `` contains the following objects:\n\n```\nfile1.png\nfile2.png\nfile3.jpg\nfile4.txt\ndir1/file5.gif\ndir1/file6.png\ndir1/dir2/file7.png\ndir1/dir3/file8.jpg\ndir1/dir3/file1.png\n```\n\n### Same as before but don't use subdirectory names during object key generation\n\nSpecify the optional `--squash` parameter to ignore subdirectory names during object key generation.\n\n```\n$ upload_files --wipe --recursive --squash\n```\n\nBucket `` contains the following objects. Note that `` contains two files named `file1.png`. First `file1.png` is uploaded and later overwritten with the content of `dir1/dir3/file1.png`.\n\n```\nfile2.png\nfile3.jpg\nfile4.txt\nfile5.gif\nfile6.png\nfile7.png\nfile8.jpg\nfile1.png\n```\n\n### Same as before but include a static key name prefix\n\nSpecify the optional `--prefix ` parameter to add `` to the object key for every file.\n\n```\n$ upload_files --wipe --recursive --squash --prefix data\n```\n\nBucket `` contains the following objects:\n\n```\ndata/file2.png\ndata/file3.jpg\ndata/file4.txt\ndata/file5.gif\ndata/file6.png\ndata/file7.png\ndata/file8.jpg\ndata/file1.png\n```\n\n## Upload files\n\nYou can upload a single file by specifying ``.\n\n```\n$ upload_files /path/to/local/directory/file1.png --wipe \n```\n\nBucket `` contains the following object:\n\n```\nfile1.png\n```\n\nYou can upload multiple files by specifying a pattern ``\n\n```\n$ upload_files /path/to/local/directory/*.png --wipe \n```\n\n> On Linux, Unix and MacOS wildcards need to be escaped to prevent shell expansion: `/path/to/local/directory/\\*.png`.\n\nBucket `` contains the following objects:\n\n```\nfile1.png\nfile2.png\n```\n\nUse the `--recursive` parameter to extend the search to subdirectories of `/path/to/local/directory/`.\n\n```\n$ upload_files /path/to/local/directory/*.png --wipe --recursive\n```\n\n```\nfile1.png\nfile2.png\ndir1/file6.png\ndir1/dir2/file7.png\ndir1/dir3/file1.png\n```\n\n# Downloading files from a Cloud Object Storage bucket\n\nYou can run the download utility in a terminal window using the generated console script\n\n```\n$ download_files --help\n```\n\nor explicitly\n\n```\n$ python -m cos_utils.dowload_files --help\n```\n\nThe help lists required and optional parameters. The examples listed below explain them in detail.\n\n```\nusage: download_files [-h] [-d TARGET_DIR] bucket pattern\n\nDownload objects from a Cloud Object Storage bucket.\n\npositional arguments:\n bucket Bucket name\n pattern Object key spec (supported wildcards: * and ?)\n\noptional arguments:\n -h, --help show this help message and exit\n -d TARGET_DIR, --target_dir TARGET_DIR\n Local target directory. Defaults to the current\n directory.\n\nEnvironment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be\ndefined to run the utility.\n```\n\n### Download complete bucket content\n\nYou can download the complete content of a bucket to the current directory:\n\n```\n$ download_files *\n```\n\n> On Linux, Unix and MacOS wildcards need to be escaped to prevent shell expansion: `download_files \\*`.\n\n### Same as before but specify a target directory\n\nUse the `--target_dir ` parameter to specify an existing directory where the downloaded files will be stored:\n\n```\n$ download_files * --target_dir /tmp/downloads\n```\n\n### Use wildcards to selectively download files\n\nUse the `*` (any character) and `?` (one character) wildcards to define a filter condition.\n\n#### Download only png files\n\n```\n$ download_files *.png\n```\n\n#### Download files that contain a certain string in their name\n\n```\n$ download_files *fil*\n```\n\n# Removing files from a Cloud Object Storage bucket\n\nYou can run the remove utility in a terminal window using the generated console script\n\n```\n$ remove_files --help\n```\n\nor explicitly\n\n```\n$ python -m cos_utils.remove_files --help\n```\n\n### Remove all files from a bucket\n\n```\n$ remove_files \n```\n\n# License\n\n[Apache-2.0](LICENSE)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/CODAIT/cos-utils", "keywords": "Cloud Object Storage,upload,download,list", "license": "Apache-2.0", "maintainer": "", "maintainer_email": "", "name": "cos-utils", "package_url": "https://pypi.org/project/cos-utils/", "platform": "", "project_url": "https://pypi.org/project/cos-utils/", "project_urls": { "Homepage": "https://github.com/CODAIT/cos-utils" }, "release_url": "https://pypi.org/project/cos-utils/0.0.13/", "requires_dist": null, "requires_python": "", "summary": "Cloud Object Storage utility", "version": "0.0.13", "yanked": false, "yanked_reason": null }, "last_serial": 6159339, "releases": { "0.0.10": [ { "comment_text": "", "digests": { "md5": "95a89caa9fb99cefb5be2de3b5d171b2", "sha256": "4ab82ce7a809823bdf4d49cf95941b2e06dccc1cc4ec23fc2439d6dda43c99ac" }, "downloads": -1, "filename": "cos-utils-0.0.10.tar.gz", "has_sig": false, "md5_digest": "95a89caa9fb99cefb5be2de3b5d171b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11567, "upload_time": "2019-10-25T22:46:49", "upload_time_iso_8601": "2019-10-25T22:46:49.498710Z", "url": "https://files.pythonhosted.org/packages/64/d2/7961445def080d2b06ee9b1e9f218a97f67aa4f3f877900eef8bf68381d9/cos-utils-0.0.10.tar.gz", "yanked": false, "yanked_reason": null } ], "0.0.11": [ { "comment_text": "", "digests": { "md5": "e900b56fe4bd75095b4f80fea2d1aeb8", "sha256": "32194e7219d9ce46037c80983475469e5c93a086942df26352d67de7ae4696b4" }, "downloads": -1, "filename": "cos-utils-0.0.11.tar.gz", "has_sig": false, "md5_digest": "e900b56fe4bd75095b4f80fea2d1aeb8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12401, "upload_time": "2019-10-27T00:18:10", "upload_time_iso_8601": "2019-10-27T00:18:10.532796Z", "url": "https://files.pythonhosted.org/packages/9b/e7/7586c58f5c16c6303b8b2fcf58cbeb8d2f1105c81977ed9b2370a4207885/cos-utils-0.0.11.tar.gz", "yanked": false, "yanked_reason": null } ], "0.0.12": [ { "comment_text": "", "digests": { "md5": "a241f6856d020902a2a3fe46c9b82ed2", "sha256": "07a664bce8659d98cbc3ce1473d8fb902585ac1c8704f74aee01c7ab4da9eabb" }, "downloads": -1, "filename": "cos-utils-0.0.12.tar.gz", "has_sig": false, "md5_digest": "a241f6856d020902a2a3fe46c9b82ed2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13059, "upload_time": "2019-11-05T17:29:32", "upload_time_iso_8601": "2019-11-05T17:29:32.317139Z", "url": "https://files.pythonhosted.org/packages/6d/9b/e4c6db0698f8cefc565b8a013a1963b2ba4c1c05390870b23bce843b3f26/cos-utils-0.0.12.tar.gz", "yanked": false, "yanked_reason": null } ], "0.0.13": [ { "comment_text": "", "digests": { "md5": "c9559225995c6aa6253fb3c12daffbf5", "sha256": "0f1019e7bba423943737ff42274179348fbed83b6dc2a3836d0f0c46b151f065" }, "downloads": -1, "filename": "cos-utils-0.0.13.tar.gz", "has_sig": false, "md5_digest": "c9559225995c6aa6253fb3c12daffbf5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13125, "upload_time": "2019-11-19T01:37:57", "upload_time_iso_8601": "2019-11-19T01:37:57.376337Z", "url": "https://files.pythonhosted.org/packages/aa/0b/0903a9649651fe597018385e37f4dbe9962f0c375d7372658bd6a0f05333/cos-utils-0.0.13.tar.gz", "yanked": false, "yanked_reason": null } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "205d9d1df6605a033c76a9bbc8e47c5b", "sha256": "5d1178738fc7145305f4698a90727554ee88ea81154146ca6d4549428e4d0979" }, "downloads": -1, "filename": "cos-utils-0.0.9.tar.gz", "has_sig": false, "md5_digest": "205d9d1df6605a033c76a9bbc8e47c5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11055, "upload_time": "2019-10-24T17:04:47", "upload_time_iso_8601": "2019-10-24T17:04:47.391700Z", "url": "https://files.pythonhosted.org/packages/44/51/bd6e5cf20ef627c87499a0a93d14f7c70243af767f7977330aeacfceed87/cos-utils-0.0.9.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c9559225995c6aa6253fb3c12daffbf5", "sha256": "0f1019e7bba423943737ff42274179348fbed83b6dc2a3836d0f0c46b151f065" }, "downloads": -1, "filename": "cos-utils-0.0.13.tar.gz", "has_sig": false, "md5_digest": "c9559225995c6aa6253fb3c12daffbf5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13125, "upload_time": "2019-11-19T01:37:57", "upload_time_iso_8601": "2019-11-19T01:37:57.376337Z", "url": "https://files.pythonhosted.org/packages/aa/0b/0903a9649651fe597018385e37f4dbe9962f0c375d7372658bd6a0f05333/cos-utils-0.0.13.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }