Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Latest commit

 

History

History
 
 

README.rst

Google Cloud Storage Python Samples

https://gstatic.com/cloudssh/images/open-btn.png

This directory contains samples for Google Cloud Storage. Google Cloud Storage allows world-wide storage and retrieval of any amount of data at any time.

These samples demonstrate how to transfer data between Google Cloud Storage and other storage systems.

Setup

Authentication

This sample requires you to have authentication setup. Refer to the Authentication Getting Started Guide for instructions on setting up credentials for applications.

Install Dependencies

  1. Install pip and virtualenv if you do not already have them. You may want to refer to the Python Development Environment Setup Guide for Google Cloud Platform for instructions.
  1. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.

    $ virtualenv env
    $ source env/bin/activate
  2. Install the dependencies needed to run the samples.

    $ pip install -r requirements.txt

Samples

Transfer to GCS Nearline

https://gstatic.com/cloudssh/images/open-btn.png

To run this sample:

$ python nearline_request.py

usage: nearline_request.py [-h]
                           description project_id date time source_bucket
                           sink_bucket

Command-line sample that creates a one-time transfer from Google Cloud
Storage standard class to the Nearline storage class."

This sample is used on this page:

    https://cloud.google.com/storage/transfer/create-transfer

For more information, see README.md.

positional arguments:
  description    Transfer description.
  project_id     Your Google Cloud project ID.
  date           Date YYYY/MM/DD.
  time           Time (24hr) HH:MM.
  source_bucket  Source bucket name.
  sink_bucket    Sink bucket name.

optional arguments:
  -h, --help     show this help message and exit

Transfer from AWS

https://gstatic.com/cloudssh/images/open-btn.png

To run this sample:

$ python aws_request.py

usage: aws_request.py [-h]
                      description project_id date time source_bucket
                      access_key secret_access_key sink_bucket

Command-line sample that creates a one-time transfer from Amazon S3 to
Google Cloud Storage.

This sample is used on this page:

    https://cloud.google.com/storage/transfer/create-transfer

For more information, see README.md.

positional arguments:
  description        Transfer description.
  project_id         Your Google Cloud project ID.
  date               Date YYYY/MM/DD.
  time               Time (24hr) HH:MM.
  source_bucket      Source bucket name.
  access_key         Your AWS access key id.
  secret_access_key  Your AWS secret access key.
  sink_bucket        Sink bucket name.

optional arguments:
  -h, --help         show this help message and exit

Check transfer status

https://gstatic.com/cloudssh/images/open-btn.png

To run this sample:

$ python transfer_check.py

usage: transfer_check.py [-h] project_id job_name

Command-line sample that checks the status of an in-process transfer.

This sample is used on this page:

    https://cloud.google.com/storage/transfer/create-transfer

For more information, see README.md.

positional arguments:
  project_id  Your Google Cloud project ID.
  job_name    Your job name.

optional arguments:
  -h, --help  show this help message and exit