diff --git a/compute/instances/composer.json b/compute/instances/composer.json index 4f0bf93c86..b65563baa8 100644 --- a/compute/instances/composer.json +++ b/compute/instances/composer.json @@ -1,6 +1,6 @@ { "require": { - "google/cloud-compute": "^1.14", + "google/cloud-compute": "^2.0", "google/cloud-storage": "^1.36" } } diff --git a/compute/instances/src/create_instance.php b/compute/instances/src/create_instance.php index c8e0fe6589..c59353dde6 100644 --- a/compute/instances/src/create_instance.php +++ b/compute/instances/src/create_instance.php @@ -25,9 +25,9 @@ # [START compute_instances_create] use Google\Cloud\Compute\V1\AttachedDisk; +use Google\Cloud\Compute\V1\AttachedDisk\Type; use Google\Cloud\Compute\V1\AttachedDiskInitializeParams; use Google\Cloud\Compute\V1\Client\InstancesClient; -use Google\Cloud\Compute\V1\Enums\AttachedDisk\Type; use Google\Cloud\Compute\V1\InsertInstanceRequest; /** @@ -67,7 +67,7 @@ function create_instance( $disk = (new AttachedDisk()) ->setBoot(true) ->setAutoDelete(true) - ->setType(Type::PERSISTENT) + ->setType(Type::name(Type::PERSISTENT)) ->setInitializeParams($diskInitializeParams); // Use the network interface provided in the $networkName argument. diff --git a/compute/instances/src/create_instance_with_encryption_key.php b/compute/instances/src/create_instance_with_encryption_key.php index cd1474ce3b..b469fa6947 100644 --- a/compute/instances/src/create_instance_with_encryption_key.php +++ b/compute/instances/src/create_instance_with_encryption_key.php @@ -25,10 +25,10 @@ # [START compute_instances_create_encrypted] use Google\Cloud\Compute\V1\AttachedDisk; +use Google\Cloud\Compute\V1\AttachedDisk\Type; use Google\Cloud\Compute\V1\AttachedDiskInitializeParams; use Google\Cloud\Compute\V1\Client\InstancesClient; use Google\Cloud\Compute\V1\CustomerEncryptionKey; -use Google\Cloud\Compute\V1\Enums\AttachedDisk\Type; use Google\Cloud\Compute\V1\InsertInstanceRequest; /** @@ -78,7 +78,7 @@ function create_instance_with_encryption_key( $disk = (new AttachedDisk()) ->setBoot(true) ->setAutoDelete(true) - ->setType(Type::PERSISTENT) + ->setType(Type::name(Type::PERSISTENT)) ->setInitializeParams($diskInitializeParams) ->setDiskEncryptionKey($customerEncryptionKey); diff --git a/spanner/composer.json b/spanner/composer.json index f06d93f93f..cfa4184bc3 100755 --- a/spanner/composer.json +++ b/spanner/composer.json @@ -1,6 +1,6 @@ { "require": { - "google/cloud-spanner": "^1.97" + "google/cloud-spanner": "^2.0" }, "autoload": { "psr-4": { diff --git a/spanner/src/read_stale_data.php b/spanner/src/read_stale_data.php index f06695410c..977d3ebb20 100644 --- a/spanner/src/read_stale_data.php +++ b/spanner/src/read_stale_data.php @@ -24,7 +24,7 @@ namespace Google\Cloud\Samples\Spanner; // [START spanner_read_stale_data] -use Google\Cloud\Spanner\Duration; +use Google\Protobuf\Duration; use Google\Cloud\Spanner\SpannerClient; /** @@ -49,7 +49,7 @@ function read_stale_data(string $instanceId, string $databaseId): void 'Albums', $keySet, ['SingerId', 'AlbumId', 'AlbumTitle'], - ['exactStaleness' => new Duration(15)] + ['exactStaleness' => new Duration(['seconds' => 15])] ); foreach ($results->rows() as $row) { diff --git a/speech/src/create_recognizer.php b/speech/src/create_recognizer.php index ded01ee85c..37a49aa164 100644 --- a/speech/src/create_recognizer.php +++ b/speech/src/create_recognizer.php @@ -33,7 +33,7 @@ function create_recognizer( string $projectId, string $location, string $recognizerId, - string $model = "latest_short" + string $model = 'latest_short' ): void { $apiEndpoint = $location === 'global' ? null : sprintf('%s-speech.googleapis.com', $location); $speech = new SpeechClient(['apiEndpoint' => $apiEndpoint]); diff --git a/speech/src/transcribe_async_gcs.php b/speech/src/transcribe_async_gcs.php index 14504cb54d..217f5f71dd 100644 --- a/speech/src/transcribe_async_gcs.php +++ b/speech/src/transcribe_async_gcs.php @@ -77,7 +77,7 @@ function transcribe_async_gcs(string $projectId, string $location, string $recog $response = $operation->getResult(); foreach ($response->getResults() as $result) { if ($result->getError()) { - print('Error: '. $result->getError()->getMessage()); + print('Error: ' . $result->getError()->getMessage()); } // get the most likely transcription $transcript = $result->getInlineResult()->getTranscript(); diff --git a/speech/src/transcribe_async_words.php b/speech/src/transcribe_async_words.php index e89a6028ff..a393885520 100644 --- a/speech/src/transcribe_async_words.php +++ b/speech/src/transcribe_async_words.php @@ -91,7 +91,7 @@ function transcribe_async_words(string $projectId, string $location, string $rec $response = $operation->getResult(); foreach ($response->getResults() as $result) { if ($result->getError()) { - print('Error: '. $result->getError()->getMessage()); + print('Error: ' . $result->getError()->getMessage()); } // get the most likely transcription $transcript = $result->getInlineResult()->getTranscript();