Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Outline

Google Cloud Storage Insights Samples

Description

All code in the snippets directory demonstrate how to invoke Cloud Storage Insights from PHP.

Setup:

  1. Enable APIs - Enable the Storage Insights Service API and create a new project or select an existing project.

  2. Download The Credentials - Click "Go to credentials" after enabling the APIs. Click "New Credentials" and select "Service Account Key". Create a new service account, use the JSON key type, and select "Create". Once downloaded, set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the JSON key that was downloaded.

  3. Clone the repo and cd into this directory

    $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
    $ cd php-docs-samples/storageinsights
  4. Install dependencies via Composer. Run php composer.phar install (if composer is installed locally) or composer install (if composer is installed globally).

Samples

To run the Storage Insights Samples, run any of the files in src/ on the CLI:

$ php src/create_inventory_report_config.php

Usage: create_inventory_report_config.php $bucketName $sourceGcsBucketName $sinkGcsBucketName

  @param string $projectId The Project ID
  @param string $location The location of bucket
  @param string $sourceBucketName The Storage bucket name
  @param string $destinationBucketName The Storage bucket name

The client library

This sample uses the Cloud Storage Insights Client Library for PHP. You can read the documentation for more details on API usage and use GitHub to browse the source and report issues.

Contributing changes

Licensing

Morty Proxy This is a proxified and sanitized view of the page, visit original site.