Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
55f6e2c
feat(Spanner): run backup tests only when requested explicitly (#1691)
saranshdhingra Sep 28, 2022
55a102f
chore: add typehints for storage samples (#1703)
yash30201 Oct 3, 2022
5c4fd35
chore: Add return types and signature arguments for spanner samples. …
ajupazhamayil Oct 4, 2022
34de141
feat(Storage): Added sample to print bucket website configuration
yash30201 Oct 6, 2022
ef403b5
feat(Storage): Added sample to print bucket default acl (#1692)
yash30201 Oct 6, 2022
db431bc
fix(functions): add 2nd-gen cloudevent tags (#1678)
Oct 6, 2022
7d64905
feat(Spanner): Dml batch update request priority (#1699)
ajupazhamayil Oct 10, 2022
2e3407f
feat: support customer managed instance configurations (#1696)
rahul2393 Oct 17, 2022
9144c25
chore(storage): move commented example value to docblocks in Storage …
ajupazhamayil Nov 3, 2022
fa4a1e2
feat(Spanner): Added samples for PG JSONB (#1687)
saranshdhingra Nov 3, 2022
4447ca7
fix (bigquery): add order into test query (#1716)
vishwarajanand Nov 4, 2022
7dfeeda
feat(Bigquery): Append column samples (#1709)
yash30201 Nov 7, 2022
01ca49c
docs: [IOT] typo fix (#1712)
mwlebour Nov 7, 2022
b2a3e07
chore: upgrade speech to new sample format (#1642)
bshaffer Nov 7, 2022
660a460
chore: update logging to new samples format (#1643)
bshaffer Nov 7, 2022
81498af
feat(storage): sample for autoclass (#1685)
vishwarajanand Nov 8, 2022
049d6dd
chore(firestore): remove obsolete region tags (#1718)
meredithslota Nov 8, 2022
c6dd242
feat(Storage): sample for get bucket class and location (#1690)
yash30201 Nov 10, 2022
576286e
feat(Storage): object get kms key (#1695)
yash30201 Nov 10, 2022
5a20734
chore: update all translate samples to new format (#1719)
bshaffer Nov 14, 2022
87e6ba7
fix(#1704): Refractored all BigQuery samples as functions (#1720)
yash30201 Nov 14, 2022
f4b1e30
feat(BigQuery): Added sample to Insert rows into table without insert…
yash30201 Nov 14, 2022
9450de4
feat(Spanner): Added DML returning samples (#1721)
yash30201 Nov 21, 2022
3168ea5
fix(Spanner): Add sample for add and drop database roles for Spanner …
ajupazhamayil Nov 22, 2022
660a57d
feat(Spanner): Add read write retry sample (#1694)
ajupazhamayil Nov 22, 2022
a81cf3e
feat: add Video Stitcher samples and tests (#1725)
irataxy Nov 22, 2022
68f35d2
chore: upgrade error_reporting samples to new format (#1726)
bshaffer Nov 24, 2022
3f81a7c
fix(deps): update dependency google/analytics-data to ^0.9.0 (#1710)
renovate-bot Nov 29, 2022
11fb77a
fix(deps): update dependency google/analytics-data to ^0.9.0 (#1711)
renovate-bot Nov 29, 2022
30b7eba
chore: upgrade vision samples to new format (#1638)
bshaffer Nov 29, 2022
1ac0841
fix(deps): update dependency google/cloud-language to ^0.27.0 (#1731)
renovate-bot Nov 29, 2022
1f494d3
fix(Bigquery): remove redundant ExponentialBackoff (#1724)
vishwarajanand Nov 30, 2022
e5ddf59
chore: switch master branch to main (#1667)
bshaffer Nov 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ Install that by running
composer global require friendsofphp/php-cs-fixer
```

Then to fix your directory or file run
Then to fix your directory or file run

```
php-cs-fixer fix . --config .php-cs-fixer.dist.php
php-cs-fixer fix path/to/file --config .php-cs-fixer.dist.php
```

The [DLP snippets](https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/dlp) are an example of snippets following the latest style guidelines.
The [DLP snippets](https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/dlp) are an example of snippets following the latest style guidelines.

[psr2]: http://www.php-fig.org/psr/psr-2/
[psr4]: http://www.php-fig.org/psr/psr-4/
Expand Down
2 changes: 1 addition & 1 deletion analyticsdata/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"google/analytics-data": "^0.8.0"
"google/analytics-data": "^0.9.0"
}
}
2 changes: 1 addition & 1 deletion analyticsdata/quickstart_oauth2/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"google/analytics-data": "^0.8.0",
"google/analytics-data": "^0.9.0",
"ext-bcmath": "*"
}
}
2 changes: 1 addition & 1 deletion appengine/flexible/tasks/src/create_task.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/appengine/flexible/tasks/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/appengine/flexible/tasks/README.md
*/

namespace Google\Cloud\Samples\Tasks;
Expand Down
2 changes: 1 addition & 1 deletion appengine/standard/auth/src/auth_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/auth/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/auth/README.md
*/

# [START gae_auth_api_implicit]
Expand Down
2 changes: 1 addition & 1 deletion appengine/standard/auth/src/auth_cloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/auth/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/auth/README.md
*/

# [START gae_auth_cloud_implicit]
Expand Down
2 changes: 1 addition & 1 deletion appengine/standard/errorreporting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ these two steps:
The [`prepend.php`][prepend] file will be executed prior to each request, which
registers the client library's error handler.

[prepend]: https://github.com/GoogleCloudPlatform/google-cloud-php-errorreporting/blob/master/src/prepend.php
[prepend]: https://github.com/GoogleCloudPlatform/google-cloud-php-errorreporting/blob/main/src/prepend.php

If you cannot modify your `php.ini`, the `prepend.php` file can be manually
included to register the error handler:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Handler extends ExceptionHandler
* Report or log an exception to Google Cloud Stackdriver Error Reporting
*
* For a full tutorial on deploying Laravel to Google Cloud,
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/blob/master/appengine/standard/laravel-framework/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/blob/main/appengine/standard/laravel-framework/README.md
*
* @param \Exception $exception
* @return void
Expand Down
2 changes: 1 addition & 1 deletion appengine/standard/tasks/snippets/src/create_task.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/appengine/standard/tasks/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/appengine/standard/tasks/README.md
*/

// Include Google Cloud dependendencies using Composer
Expand Down
2 changes: 1 addition & 1 deletion appengine/standard/wordpress/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"ext-phar": "*",
"ext-zip": "*",
"paragonie/random_compat": "^9.0.0",
"google/cloud-tools": "dev-master"
"google/cloud-tools": "dev-main"
}
}
2 changes: 1 addition & 1 deletion auth/src/auth_api_explicit.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/auth/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/auth/README.md
*/

# [START auth_api_explicit]
Expand Down
2 changes: 1 addition & 1 deletion auth/src/auth_api_explicit_compute.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/auth/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/auth/README.md
*/

# [START auth_api_explicit_compute]
Expand Down
2 changes: 1 addition & 1 deletion auth/src/auth_api_implicit.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/auth/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/auth/README.md
*/

# [START auth_api_implicit]
Expand Down
2 changes: 1 addition & 1 deletion auth/src/auth_cloud_explicit.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/auth/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/auth/README.md
*/

# [START auth_cloud_explicit]
Expand Down
2 changes: 1 addition & 1 deletion auth/src/auth_cloud_explicit_compute.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/auth/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/auth/README.md
*/

# [START auth_cloud_explicit_compute]
Expand Down
2 changes: 1 addition & 1 deletion auth/src/auth_cloud_implicit.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/auth/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/auth/README.md
*/

namespace Google\Cloud\Samples\Auth;
Expand Down
2 changes: 1 addition & 1 deletion auth/src/auth_http_explicit.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/auth/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/auth/README.md
*/

# [START auth_http_explicit]
Expand Down
2 changes: 1 addition & 1 deletion auth/src/auth_http_implicit.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/auth/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/auth/README.md
*/

# [START auth_http_implicit]
Expand Down
79 changes: 79 additions & 0 deletions bigquery/api/src/add_column_load_append.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
/**
* Copyright 2022 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/bigquery/api/README.md
*/

namespace Google\Cloud\Samples\BigQuery;

# [START bigquery_add_column_load_append]
use Google\Cloud\BigQuery\BigQueryClient;

/**
* Append a column using a load job.
*
* @param string $projectId The project Id of your Google Cloud Project.
* @param string $datasetId The BigQuery dataset ID.
* @param string $tableId The BigQuery table ID.
*/
function add_column_load_append(
string $projectId,
string $datasetId,
string $tableId
): void {
$bigQuery = new BigQueryClient([
'projectId' => $projectId,
]);
$dataset = $bigQuery->dataset($datasetId);
$table = $dataset->table($tableId);
// In this example, the existing table contains only the 'Name' and 'Title'.
// A new column 'Description' gets added after load job.

$schema = [
'fields' => [
['name' => 'name', 'type' => 'string', 'mode' => 'nullable'],
['name' => 'title', 'type' => 'string', 'mode' => 'nullable'],
['name' => 'description', 'type' => 'string', 'mode' => 'nullable']
]
];

$source = __DIR__ . '/../test/data/test_data_extra_column.csv';

// Set job configs
$loadConfig = $table->load(fopen($source, 'r'));
$loadConfig->destinationTable($table);
$loadConfig->schema($schema);
$loadConfig->schemaUpdateOptions(['ALLOW_FIELD_ADDITION']);
$loadConfig->sourceFormat('CSV');
$loadConfig->writeDisposition('WRITE_APPEND');

// Run the job with load config
$job = $bigQuery->runJob($loadConfig);

// Print all the columns
$columns = $table->info()['schema']['fields'];
printf('The columns in the table are ');
foreach ($columns as $column) {
printf('%s ', $column['name']);
}
}
# [END bigquery_add_column_load_append]
require_once __DIR__ . '/../../../testing/sample_helpers.php';
\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv);
71 changes: 71 additions & 0 deletions bigquery/api/src/add_column_query_append.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
/**
* Copyright 2022 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/bigquery/api/README.md
*/

namespace Google\Cloud\Samples\BigQuery;

# [START bigquery_add_column_query_append]
use Google\Cloud\BigQuery\BigQueryClient;

/**
* Append a column using a query job.
*
* @param string $projectId The project Id of your Google Cloud Project.
* @param string $datasetId The BigQuery dataset ID.
* @param string $tableId The BigQuery table ID.
*/
function add_column_query_append(
string $projectId,
string $datasetId,
string $tableId
): void {
$bigQuery = new BigQueryClient([
'projectId' => $projectId,
]);
$dataset = $bigQuery->dataset($datasetId);
$table = $dataset->table($tableId);

// In this example, the existing table contains only the 'Name' and 'Title'.
// A new column 'Description' gets added after the query job.

// Define query
$query = sprintf('SELECT "John" as name, "Unknown" as title, "Dummy person" as description;');

// Set job configs
$queryJobConfig = $bigQuery->query($query);
$queryJobConfig->destinationTable($table);
$queryJobConfig->schemaUpdateOptions(['ALLOW_FIELD_ADDITION']);
$queryJobConfig->writeDisposition('WRITE_APPEND');

// Run query with query job configuration
$bigQuery->runQuery($queryJobConfig);

// Print all the columns
$columns = $table->info()['schema']['fields'];
printf('The columns in the table are ');
foreach ($columns as $column) {
printf('%s ', $column['name']);
}
}
# [END bigquery_add_column_query_append]
require_once __DIR__ . '/../../../testing/sample_helpers.php';
\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv);
2 changes: 1 addition & 1 deletion bigquery/api/src/bigquery_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* For instructions on how to run the full sample:
*
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/bigquery/api/README.md
* @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/bigquery/api/README.md
*/

if (isset($argv)) {
Expand Down
Loading