Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganizing storage samples. #92

Merged
merged 1 commit into from
Sep 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ This repository holds the samples used in the python documentation on [cloud.goo
For more detailed introduction to a product, check the README in the
corresponding folder.

## Running the samples

Most samples must be run as modules instead of directly, for example:

```
$ python -m bigquery.samples.async_query [your-project-id] [your-query]
```

Refer to the README in the corresponding folder for any special instructions.

## Contributing changes

* See [CONTRIBUTING.md](CONTRIBUTING.md)
Expand Down
8 changes: 0 additions & 8 deletions bigquery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

This section contains samples for [Google BigQuery](https://cloud.google.com/bigquery).

## Running the samples

These samples must be run as modules, for example:

```
$ python -m bigquery.samples.async_query [your-project-id] [your-query]
```

## Other Samples

* [Using BigQuery from Google App Engine](../appengine/bigquery).
Empty file added storage/api/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#
import os

from storage.compose_objects import main
from .compose_objects import main
from tests import CloudBaseTest


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from storage.list_objects import main
from .list_objects import main
from tests import CloudBaseTest


Expand Down
39 changes: 0 additions & 39 deletions storage/storage_transfer/test_aws_request.py

This file was deleted.

44 changes: 0 additions & 44 deletions storage/storage_transfer/test_create_client.py

This file was deleted.

39 changes: 0 additions & 39 deletions storage/storage_transfer/test_nearline_request.py

This file was deleted.

31 changes: 0 additions & 31 deletions storage/storage_transfer/test_transfer_check.py

This file was deleted.

File renamed without changes.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
import json
import logging

import create_client
from apiclient import discovery
from oauth2client.client import GoogleCredentials


logging.basicConfig(level=logging.DEBUG)


def main():
"""Create a one-off transfer from Amazon S3 to GCS."""
logging.getLogger().setLevel(logging.DEBUG)
transfer_service_client = create_client.create_transfer_client()
credentials = GoogleCredentials.get_application_default()
storagetransfer = discovery.build(
'storagetransfer', 'v1', credentials=credentials)

# Edit this template with desired parameters.
# Specify times below using US Pacific Time Zone.
Expand Down Expand Up @@ -61,7 +66,7 @@ def main():
}
'''

result = transfer_service_client.transferJobs().create(body=json.loads(
result = storagetransfer.transferJobs().create(body=json.loads(
transfer_job)).execute()
logging.info('Returned transferJob: %s', json.dumps(result, indent=4))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
import json
import logging

import create_client
from apiclient import discovery
from oauth2client.client import GoogleCredentials


logging.basicConfig(level=logging.DEBUG)


def main():
"""Transfer from standard Cloud Storage to Cloud Storage Nearline."""
logging.getLogger().setLevel(logging.DEBUG)
transfer_service_client = create_client.create_transfer_client()
credentials = GoogleCredentials.get_application_default()
storagetransfer = discovery.build(
'storagetransfer', 'v1', credentials=credentials)

# Edit this template with desired parameters.
# Specify times below using US Pacific Time Zone.
Expand Down Expand Up @@ -57,7 +62,7 @@ def main():
}
}
'''
result = transfer_service_client.transferJobs().create(body=json.loads(
result = storagetransfer.transferJobs().create(body=json.loads(
transfer_job)).execute()
logging.info('Returned transferJob: %s', json.dumps(result, indent=4))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,34 @@
import json
import logging

import create_client
from apiclient import discovery
from oauth2client.client import GoogleCredentials


logging.basicConfig(level=logging.DEBUG)

# Edit these values with desired parameters.
PROJECT_ID = 'YOUR_PROJECT_ID'
JOB_NAME = 'YOUR_JOB_NAME'


def check_operation(transfer_service_client, project_id, job_name):
def check_operation(storagetransfer, project_id, job_name):
"""Review the transfer operations associated with a transfer job."""
filterString = (
'{{"project_id": "{project_id}", '
'"job_names": ["{job_name}"]}}').format(
project_id=project_id, job_name=job_name)
return transfer_service_client.transferOperations().list(
'"job_names": ["{job_name}"]}}'
).format(project_id=project_id, job_name=job_name)
return storagetransfer.transferOperations().list(
name="transferOperations",
filter=filterString).execute()


def main():
logging.getLogger().setLevel(logging.DEBUG)
transfer_service_client = create_client.create_transfer_client()
credentials = GoogleCredentials.get_application_default()
storagetransfer = discovery.build(
'storagetransfer', 'v1', credentials=credentials)

result = check_operation(transfer_service_client, PROJECT_ID, JOB_NAME)
result = check_operation(storagetransfer, PROJECT_ID, JOB_NAME)
logging.info('Result of transferOperations/list: %s',
json.dumps(result, indent=4, sort_keys=True))

Expand Down