The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

cloudstorage_bucket_example.pl

Provides an OAUTH'd client interface to https://cloud.google.com/storage/docs/json_api/v1/

    perl cloudstorage_bucket_example.pl sample.png

NB:

file must exist and will be uploaded to the first bucket in the project list
must have export GOOGLE_PROJECT_ID= set with project ID

PRE-REQUISITES

Setup a Google Project in the Google Console and add the Translate API Library. You may need to enable billing to access Google Cloud Services. Setup an OAUTH Credential set and feed this into the CLI goauth included in WebService::GoogleAPI::Client and use the tool to authorise your user to access the project which will also create the local gapi.json config.

assumes gapi.json configuration in working directory with scoped project and user authorization

RELEVANT SCOPES

https://www.googleapis.com/auth/devstorage.full_control - Read/write and ACL management access to Google Cloud Storage.
https://www.googleapis.com/auth/devstorage.read_write - Read/write access to Google Cloud Storage.
https://www.googleapis.com/auth/devstorage.read_only - Read-only access to Google Cloud Storage.
https://console.developers.google.com/apis/
https://cloud.google.com/storage/docs/json_api/v1/
https://developers.google.com/apis-explorer/

As per https://cloud.google.com/storage/docs/uploading-objects "https://www.googleapis.com/upload/storage/v1/b/[BUCKET_NAME]/o?uploadType=media&name=[OBJECT_NAME]

$config->{MIMETYPE} $config->{file_content} $config->{selected_bucket}

NB _ to make publicly accessible you need to add { "entity": "allUsers", "role": "READER" } to the file or bucket through the browser - will include example on API in future.

as per https://cloud.google.com/storage/docs/access-control/making-data-public

OTHER INTERFACES TO THE GOOGLE CLOUD BUCKET STORAGE

Google Cloud Storage Browser https://console.cloud.google.com/storage/browser

Includes a bucket file browser

Transfer

Transfer data to your Cloud Storage buckets from Amazon Simple Storage Service (S3), HTTP/HTTPS servers, or other buckets. You can schedule one-time or daily transfers, and you can filter files based on name prefix and when they were changed.

Transfer Appliance

Transfer Appliance lets you quickly and securely transfer large amounts of data to Google Cloud Platform via a high capacity storage server you lease from Google and ship to our datacenter. Transfer Appliance is recommended for data that exceeds 20 TB or would take more than a week to upload.

gcloud Google SDK https://cloud.google.com/sdk/install

The Cloud SDK is a set of tools for Cloud Platform. It contains gcloud, gsutil, and bq, which you can use to access Google Compute Engine, Google Cloud Storage, Google BigQuery, and other products and services from the command-line.

You can run these tools interactively or in your automated scripts.

    gcloud compute backend-buckets list
    Listed 0 items.

gsutil https://cloud.google.com/storage/docs/gsutil

I believe gsutil is installed as part of the gcloud Google SDK.

gsutil is a Python application that lets you access Cloud Storage from the command line. You can use gsutil to do a wide range of bucket and object management tasks, including:

  • Creating and deleting buckets.

  • Uploading, downloading, and deleting objects.

  • Listing buckets and objects.

  • Moving, copying, and renaming objects.

  • Editing object and bucket ACLs.

    bash$ gsutil ls
    gs://computerproscomau-vcm/
    gs://perl-webservice/

1 POD Error

The following errors were encountered while parsing the POD:

Around line 179:

=pod directives shouldn't be over one line long! Ignoring all 14 lines of content