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

Batch branch update from master #547

Merged
merged 49 commits into from
Jun 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
77ca88f
Add ext-grpc as a dep for services that only provides grpc lib (#475)
May 4, 2017
942a0c4
Choose rest over grpc for now. (#477)
May 4, 2017
7d17699
project to projectId (#484)
dwsupplee May 11, 2017
e3c8005
RFC: Adds removePolicy to Iam Policy Builder (#480)
bshaffer May 12, 2017
462629f
Introduce support for Cloud Spanner (#333)
jdpedrie May 15, 2017
6636b40
introduce cache based session pool and streaming execute/read
dwsupplee Apr 7, 2017
1629272
Implement remaining API, add system tests.
jdpedrie Apr 10, 2017
097170f
Buffer result sets and retry only with error code unavailable
dwsupplee May 5, 2017
201e6b7
Fix parameterization and value mapping
jdpedrie May 8, 2017
927b919
allow user determined row formatting
dwsupplee May 12, 2017
9becfc7
Update README and Spanner composer.json
jdpedrie May 16, 2017
b78a47e
update verbiage
dwsupplee May 16, 2017
57849d3
small tweaks
dwsupplee May 17, 2017
22b994d
Add resource-prefix header to outgoing spanner requests
jdpedrie May 17, 2017
867517b
Add Video Intelligence GAPIC client (#492)
michaelbausor May 18, 2017
0386fab
Merge branch 'master' into spanner
dwsupplee May 18, 2017
33f743a
inverse retry condition
dwsupplee May 18, 2017
49a598e
Prepare v0.29.0 (#493)
dwsupplee May 18, 2017
6c9e9a2
Update docs to include new core types (#494)
dwsupplee May 18, 2017
f78600b
README updates / Add VI to list of includes (#495)
dwsupplee May 18, 2017
452e730
increase ServiceBuilder version for v0.29.0 release (#496)
dwsupplee May 18, 2017
d15968c
Merge branch 'spanner'
jdpedrie May 18, 2017
71680dd
Prepare v0.30.0 (#497)
jdpedrie May 18, 2017
203e5c5
make param type more specific (#500)
dwsupplee May 18, 2017
c48e546
fixes extraStatements bug for Spanner\Instance::createDatabase (#499)
bshaffer May 18, 2017
0632d3a
corrects spanner dependency on core and removes symfony/lock requirem…
bshaffer May 19, 2017
f9fad9a
Cast keySet keys to arrays instead of wrapping them (#505)
bshaffer May 19, 2017
06239ea
Prepare v0.30.1 (#501)
dwsupplee May 19, 2017
216f519
Update GAPICs for Spanner (#508)
michaelbausor May 19, 2017
b0ecc19
Modify exceptions when a whitelist may be present (#482)
jdpedrie May 22, 2017
53afa7a
Prepare v0.31.0 (#510)
jdpedrie May 22, 2017
63d529b
Prepare v0.31.1 (#511)
jdpedrie May 22, 2017
c864895
Request Tracing (#456)
chingor13 May 23, 2017
ecae3e8
Update required symfony/lock dependency version (#515)
jdpedrie May 25, 2017
ae772db
Test component composer integration, bump gax requirement (#507)
jdpedrie May 25, 2017
8412656
Prepare v0.32.0 (#516)
jdpedrie May 25, 2017
63255af
Fix TraceClient example on the main README.md (#517)
chingor13 May 25, 2017
1ad53b4
Correct the suggested commit for symfony/lock (#518)
dwsupplee May 26, 2017
cd43667
Add Query system tests, fix value mapping bugs (#520)
jdpedrie May 31, 2017
846f2f9
Update Translate service definition, add system tests, remove documen…
jdpedrie May 31, 2017
3c917dc
Prepare v0.32.1 (#523)
jdpedrie Jun 1, 2017
bd4bcc8
Add support for bucket labels (#529)
jdpedrie Jun 8, 2017
c43bbad
Added new option "uploadProgressCallback" to method $bucket->upload()…
pvm1987 Jun 8, 2017
d75e733
Move type constants to Database (#532)
jdpedrie Jun 14, 2017
f0856c7
Skip creating the labels info until there are labels. (#542)
chingor13 Jun 16, 2017
62dcea0
upgrade to google/auth ^1.0 (#535)
bshaffer Jun 19, 2017
71e3492
Fixing a documentation comment in SpannerClient class construct (#543)
Jun 19, 2017
f0ec021
Add support for Storage - Requester Pays (#527)
jdpedrie Jun 19, 2017
f199794
Merge remote-tracking branch 'upstream/master' into batch-update-master
chingor13 Jun 22, 2017
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ before_script:

script:
- ./dev/sh/tests
- ./dev/sh/test-composer
- vendor/bin/phpcs --standard=./phpcs-ruleset.xml
- ./dev/sh/build-docs

Expand Down
113 changes: 101 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ This client supports the following Google Cloud Platform services at a [Beta](#v

This client supports the following Google Cloud Platform services at an [Alpha](#versioning) quality level:
* [Google Cloud Pub/Sub](#google-cloud-pubsub-alpha) (Alpha)
* [Cloud Spanner](#cloud-spanner-alpha) (Alpha)
* [Google Cloud Speech](#google-cloud-speech-alpha) (Alpha)
* [Google Cloud Video Intelligence](#google-cloud-video-intelligence-alpha) (Alpha)
* [Google Stackdriver Trace](#google-stackdriver-trace-alpha) (Alpha)

If you need support for other Google APIs, please check out the [Google APIs Client Library for PHP](https://github.com/google/google-api-php-client).
Expand Down Expand Up @@ -390,6 +392,43 @@ Google Cloud Pub/Sub can be installed separately by requiring the `google/cloud-
$ require google/cloud-pubsub
```

## Cloud Spanner (Alpha)

- [API Documentation](http://googlecloudplatform.github.io/google-cloud-php/#/docs/latest/spanner/spannerclient)
- [Official Documentation](https://cloud.google.com/spanner/docs)

#### Preview

```php
require 'vendor/autoload.php';

use Google\Cloud\Spanner\SpannerClient;

$spanner = new SpannerClient([
'projectId' => 'my_project'
]);

$db = $spanner->connect('my-instance', 'my-database');

$userQuery = $db->execute('SELECT * FROM Users WHERE id = @id', [
'parameters' => [
'id' => $userId
]
]);

$user = $userQuery->rows()->current();

echo 'Hello ' . $user['firstName'];
```

#### google/cloud-spanner

Cloud Spanner can be installed separately by requiring the `google/cloud-spanner` composer package:

```
$ require google/cloud-spanner
```

## Google Cloud Speech (Alpha)

- [API Documentation](http://googlecloudplatform.github.io/google-cloud-php/#/docs/latest/speech/speechclient)
Expand Down Expand Up @@ -425,24 +464,46 @@ Google Cloud Speech can be installed separately by requiring the `google/cloud-s
$ require google/cloud-speech
```

## Caching Access Tokens
## Google Cloud Video Intelligence (Alpha)

By default the library will use a simple in-memory caching implementation, however it is possible to override this behavior by passing a [PSR-6](http://www.php-fig.org/psr/psr-6/) caching implementation in to the desired client.
- [API Documentation](http://googlecloudplatform.github.io/google-cloud-php/#/docs/latest/videointelligence/readme)
- [Official Documentation](https://cloud.google.com/video-intelligence/docs)

The following example takes advantage of [Symfony's Cache Component](https://github.com/symfony/cache).
#### Preview

```php
require 'vendor/autoload.php';
require __DIR__ . '/vendor/autoload.php';

use Google\Cloud\VideoIntelligence\V1beta1\VideoIntelligenceServiceClient;
use google\cloud\videointelligence\v1beta1\Feature;

$client = new VideoIntelligenceServiceClient();

$inputUri = "gs://example-bucket/example-video.mp4";
$features = [
Feature::LABEL_DETECTION,
];
$operationResponse = $client->annotateVideo($inputUri, $features);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$results = $operationResponse->getResult();
foreach ($results->getAnnotationResultsList() as $result) {
foreach ($result->getLabelAnnotationsList() as $labelAnnotation) {
echo "Label: " . $labelAnnotation->getDescription() . "\n";
}
}
} else {
$error = $operationResponse->getError();
echo "error: " . $error->getMessage() . "\n";
}
```

use Google\Cloud\Storage\StorageClient;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
#### google/cloud-videointelligence

// Please take the proper precautions when storing your access tokens in a cache no matter the implementation.
$cache = new ArrayAdapter();
Cloud Video Intelligence can be installed separately by requiring the `google/cloud-videointelligence` composer package:

$storage = new StorageClient([
'authCache' => $cache
]);
```
$ require google/cloud-videointelligence
```

## Google Stackdriver Trace (Alpha)
Expand All @@ -457,7 +518,7 @@ require 'vendor/autoload.php';

use Google\Cloud\Trace\TraceClient;

$traceClient = new SpeechClient([
$traceClient = new TraceClient([
'projectId' => 'my_project'
]);

Expand All @@ -478,6 +539,34 @@ foreach($traceClient->traces() as $trace) {
}
```

#### google/cloud-trace

Stackdriver Trace can be installed separately by requiring the `google/cloud-trace` composer package:

```
$ require google/cloud-trace
```

## Caching Access Tokens

By default the library will use a simple in-memory caching implementation, however it is possible to override this behavior by passing a [PSR-6](http://www.php-fig.org/psr/psr-6/) caching implementation in to the desired client.

The following example takes advantage of [Symfony's Cache Component](https://github.com/symfony/cache).

```php
require 'vendor/autoload.php';

use Google\Cloud\Storage\StorageClient;
use Symfony\Component\Cache\Adapter\ArrayAdapter;

// Please take the proper precautions when storing your access tokens in a cache no matter the implementation.
$cache = new ArrayAdapter();

$storage = new StorageClient([
'authCache' => $cache
]);
```

## Versioning

This library follows [Semantic Versioning](http://semver.org/).
Expand Down
17 changes: 11 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"natural language",
"pubsub",
"pub sub",
"spanner",
"speech",
"storage",
"gcs",
Expand All @@ -41,11 +42,12 @@
"require": {
"php": ">=5.5",
"rize/uri-template": "~0.3",
"google/auth": "^0.11",
"google/auth": "^1.0",
"guzzlehttp/guzzle": "^5.3|^6.0",
"guzzlehttp/psr7": "^1.2",
"monolog/monolog": "~1",
"psr/http-message": "1.0.*"
"psr/http-message": "1.0.*",
"ramsey/uuid": "~3"
},
"require-dev": {
"phpunit/phpunit": "4.8.*",
Expand All @@ -55,12 +57,14 @@
"league/json-guard": "^0.3",
"erusev/parsedown": "^1.6",
"vierbergenlars/php-semver": "^3.0",
"google/proto-client-php": "^0.12",
"google/gax": "^0.8"
"google/proto-client-php": "^0.13",
"google/gax": "^0.10",
"symfony/lock": "3.3.x-dev#1ba6ac9"
},
"suggest": {
"google/gax": "Required to support gRPC",
"google/proto-client-php": "Required to support gRPC"
"google/proto-client-php": "Required to support gRPC",
"symfony/lock": "Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9"
},
"autoload": {
"psr-4": {
Expand All @@ -72,7 +76,8 @@
"Google\\Cloud\\Dev\\": "dev/src",
"Google\\Cloud\\Tests\\System\\": "tests/system",
"Google\\Cloud\\Tests\\Unit\\": "tests/unit"
}
},
"files": ["dev/src/Functions.php"]
},
"scripts": {
"google-cloud": "dev/google-cloud"
Expand Down
5 changes: 5 additions & 0 deletions dev/sh/test-composer
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

echo "Checking Component Installability"

php $(dirname $0)/../../tests/component/TestComposerInstall.php
6 changes: 3 additions & 3 deletions dev/sh/tests
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ set -e
function unit () {
echo "Running Unit Test Suite"

vendor/bin/phpunit
$(dirname $0)/../../vendor/bin/phpunit
}

function system () {
echo "Running System Test Suite"

vendor/bin/phpunit -c phpunit-system.xml.dist
$(dirname $0)/../../vendor/bin/phpunit -c phpunit-system.xml.dist
}

function snippets() {
echo "Running Snippet Test Suite"

vendor/bin/phpunit -c phpunit-snippets.xml.dist
$(dirname $0)/../../vendor/bin/phpunit -c phpunit-snippets.xml.dist
}

unit
Expand Down
29 changes: 29 additions & 0 deletions dev/src/Functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Google\Cloud\Dev;

/**
* Create a test stub which extends a real class and allows overriding of private properties.
*
* @param string $extends The fully-qualified name of the class to extend.
* @param array $args An array of constructor arguments to use when creating the stub.
* @param array $props A list of private properties on which to enable overrriding.
* @return mixed
*/
function stub($extends, array $args = [], array $props = [])
{
if (empty($props)) {
$props = ['connection'];
}

$tpl = 'class %s extends %s {private $___props = \'%s\'; use \Google\Cloud\Dev\StubTrait; }';

$name = 'Stub'. sha1($extends);

if (!class_exists($name)) {
eval(sprintf($tpl, $name, $extends, json_encode($props)));
}

$reflection = new \ReflectionClass($name);
return $reflection->newInstanceArgs($args);
}
6 changes: 3 additions & 3 deletions dev/src/Snippet/SnippetTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function snippetFromClass($class, $indexOrName = 0)

self::$coverage->cover($snippet->identifier());

return $snippet;
return clone $snippet;
}

/**
Expand All @@ -77,7 +77,7 @@ public function snippetFromMagicMethod($class, $method, $indexOrName = 0)

self::$coverage->cover($identifier);

return $snippet;
return clone $snippet;
}

/**
Expand All @@ -100,6 +100,6 @@ public function snippetFromMethod($class, $method, $indexOrName = 0)

self::$coverage->cover($identifier);

return $snippet;
return clone $snippet;
}
}
55 changes: 55 additions & 0 deletions dev/src/StubTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* Copyright 2016 Google Inc.
*
* 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.
*/

namespace Google\Cloud\Dev;

trait StubTrait
{
public function ___getProperty($prop)
{
$property = $this->___getPropertyReflector($prop);

$property->setAccessible(true);
return $property->getValue($this);
}

public function ___setProperty($prop, $value)
{
if (!in_array($prop, json_decode($this->___props))) {
throw new \BadMethodCallException(sprintf('Property %s cannot be overloaded', $prop));
}

$property = $this->___getPropertyReflector($prop);

$property->setAccessible(true);
$property->setValue($this, $value);
}

private function ___getPropertyReflector($property)
{
$trait = new \ReflectionClass($this);
$ref = $trait->getParentClass();

try {
$property = $ref->getProperty($property);
} catch (\ReflectionException $e) {
throw new \BadMethodCallException($e->getMessage());
}

return $property;
}
}
6 changes: 6 additions & 0 deletions docs/contents/cloud-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@
"title": "StreamableUploader",
"type": "core/upload/streamableuploader"
}]
}, {
"title": "Duration",
"type": "core/duration"
}, {
"title": "Int64",
"type": "core/int64"
}, {
"title": "Timestamp",
"type": "core/timestamp"
}]
}
6 changes: 0 additions & 6 deletions docs/contents/cloud-pubsub.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
}, {
"title": "Topic",
"type": "pubsub/topic"
}, {
"title": "Duration",
"type": "pubsub/duration"
}, {
"title": "Timestamp",
"type": "pubsub/timestamp"
}, {
"title": "v1",
"type": "pubsub/v1/readme",
Expand Down
Loading