diff --git a/Memorystore/samples/V1/MemorystoreClient/list_backup_collections.php b/Memorystore/samples/V1/MemorystoreClient/list_backup_collections.php index 24752316186..69a6f19a988 100644 --- a/Memorystore/samples/V1/MemorystoreClient/list_backup_collections.php +++ b/Memorystore/samples/V1/MemorystoreClient/list_backup_collections.php @@ -25,6 +25,7 @@ // [START memorystore_v1_generated_Memorystore_ListBackupCollections_sync] use Google\ApiCore\ApiException; use Google\ApiCore\PagedListResponse; +use Google\Cloud\Memorystore\V1\BackupCollection; use Google\Cloud\Memorystore\V1\Client\MemorystoreClient; use Google\Cloud\Memorystore\V1\ListBackupCollectionsRequest; @@ -55,6 +56,7 @@ function list_backup_collections_sample(string $formattedParent): void /** @var PagedListResponse $response */ $response = $memorystoreClient->listBackupCollections($request); + /** @var BackupCollection $element */ foreach ($response as $element) { printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); } diff --git a/Memorystore/samples/V1/MemorystoreClient/list_backups.php b/Memorystore/samples/V1/MemorystoreClient/list_backups.php index 3f58de5af3b..b8fecda9600 100644 --- a/Memorystore/samples/V1/MemorystoreClient/list_backups.php +++ b/Memorystore/samples/V1/MemorystoreClient/list_backups.php @@ -25,6 +25,7 @@ // [START memorystore_v1_generated_Memorystore_ListBackups_sync] use Google\ApiCore\ApiException; use Google\ApiCore\PagedListResponse; +use Google\Cloud\Memorystore\V1\Backup; use Google\Cloud\Memorystore\V1\Client\MemorystoreClient; use Google\Cloud\Memorystore\V1\ListBackupsRequest; @@ -49,6 +50,7 @@ function list_backups_sample(string $formattedParent): void /** @var PagedListResponse $response */ $response = $memorystoreClient->listBackups($request); + /** @var Backup $element */ foreach ($response as $element) { printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); } diff --git a/Memorystore/samples/V1/MemorystoreClient/list_instances.php b/Memorystore/samples/V1/MemorystoreClient/list_instances.php index 9b85db8fe6d..addf717a619 100644 --- a/Memorystore/samples/V1/MemorystoreClient/list_instances.php +++ b/Memorystore/samples/V1/MemorystoreClient/list_instances.php @@ -26,6 +26,7 @@ use Google\ApiCore\ApiException; use Google\ApiCore\PagedListResponse; use Google\Cloud\Memorystore\V1\Client\MemorystoreClient; +use Google\Cloud\Memorystore\V1\Instance; use Google\Cloud\Memorystore\V1\ListInstancesRequest; /** @@ -49,6 +50,7 @@ function list_instances_sample(string $formattedParent): void /** @var PagedListResponse $response */ $response = $memorystoreClient->listInstances($request); + /** @var Instance $element */ foreach ($response as $element) { printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); } diff --git a/Memorystore/samples/V1/MemorystoreClient/list_locations.php b/Memorystore/samples/V1/MemorystoreClient/list_locations.php index 6b2a92cce2d..0f96705f49d 100644 --- a/Memorystore/samples/V1/MemorystoreClient/list_locations.php +++ b/Memorystore/samples/V1/MemorystoreClient/list_locations.php @@ -26,6 +26,7 @@ use Google\ApiCore\ApiException; use Google\ApiCore\PagedListResponse; use Google\Cloud\Location\ListLocationsRequest; +use Google\Cloud\Location\Location; use Google\Cloud\Memorystore\V1\Client\MemorystoreClient; /** @@ -50,6 +51,7 @@ function list_locations_sample(): void /** @var PagedListResponse $response */ $response = $memorystoreClient->listLocations($request); + /** @var Location $element */ foreach ($response as $element) { printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); } diff --git a/Memorystore/samples/V1beta/MemorystoreClient/list_instances.php b/Memorystore/samples/V1beta/MemorystoreClient/list_instances.php index df2eb462d0e..782cb8db5e8 100644 --- a/Memorystore/samples/V1beta/MemorystoreClient/list_instances.php +++ b/Memorystore/samples/V1beta/MemorystoreClient/list_instances.php @@ -26,6 +26,7 @@ use Google\ApiCore\ApiException; use Google\ApiCore\PagedListResponse; use Google\Cloud\Memorystore\V1beta\Client\MemorystoreClient; +use Google\Cloud\Memorystore\V1beta\Instance; use Google\Cloud\Memorystore\V1beta\ListInstancesRequest; /** @@ -49,6 +50,7 @@ function list_instances_sample(string $formattedParent): void /** @var PagedListResponse $response */ $response = $memorystoreClient->listInstances($request); + /** @var Instance $element */ foreach ($response as $element) { printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); } diff --git a/Memorystore/samples/V1beta/MemorystoreClient/list_locations.php b/Memorystore/samples/V1beta/MemorystoreClient/list_locations.php index 12993b3a7e9..60fd00ef769 100644 --- a/Memorystore/samples/V1beta/MemorystoreClient/list_locations.php +++ b/Memorystore/samples/V1beta/MemorystoreClient/list_locations.php @@ -26,6 +26,7 @@ use Google\ApiCore\ApiException; use Google\ApiCore\PagedListResponse; use Google\Cloud\Location\ListLocationsRequest; +use Google\Cloud\Location\Location; use Google\Cloud\Memorystore\V1beta\Client\MemorystoreClient; /** @@ -50,6 +51,7 @@ function list_locations_sample(): void /** @var PagedListResponse $response */ $response = $memorystoreClient->listLocations($request); + /** @var Location $element */ foreach ($response as $element) { printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); } diff --git a/Memorystore/src/V1/Client/MemorystoreClient.php b/Memorystore/src/V1/Client/MemorystoreClient.php index 8a4d6226b16..8afbcb926f9 100644 --- a/Memorystore/src/V1/Client/MemorystoreClient.php +++ b/Memorystore/src/V1/Client/MemorystoreClient.php @@ -128,9 +128,9 @@ private static function getClientDefaults() 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, 'clientConfig' => __DIR__ . '/../resources/memorystore_client_config.json', 'descriptorsConfigPath' => __DIR__ . '/../resources/memorystore_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/memorystore_grpc_config.json', 'credentialsConfig' => [ 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, ], 'transportConfig' => [ 'rest' => [ @@ -140,18 +140,6 @@ private static function getClientDefaults() ]; } - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements ClientOptionsTrait::supportedTransports. */ - private static function supportedTransports() - { - return ['rest']; - } - /** * Return an OperationsClient object with the same endpoint as $this. * @@ -493,8 +481,9 @@ public static function parseName(string $formattedName, ?string $template = null * default this settings points to the default client config file, which is * provided in the resources folder. * @type string|TransportInterface $transport - * The transport used for executing network requests. At the moment, supports only - * `rest`. *Advanced usage*: Additionally, it is possible to pass in an already + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note * that when this object is provided, any settings in $transportConfig, and any * $apiEndpoint setting, will be ignored. @@ -503,9 +492,11 @@ public static function parseName(string $formattedName, ?string $template = null * each supported transport type should be passed in a key for that transport. For * example: * $transportConfig = [ + * 'grpc' => [...], * 'rest' => [...], * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * @type callable $clientCertSource * A callable which returns the client cert as a string. This can be used to diff --git a/Memorystore/src/V1beta/Client/MemorystoreClient.php b/Memorystore/src/V1beta/Client/MemorystoreClient.php index ddc12e564cc..2aa46757d4a 100644 --- a/Memorystore/src/V1beta/Client/MemorystoreClient.php +++ b/Memorystore/src/V1beta/Client/MemorystoreClient.php @@ -114,9 +114,9 @@ private static function getClientDefaults() 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, 'clientConfig' => __DIR__ . '/../resources/memorystore_client_config.json', 'descriptorsConfigPath' => __DIR__ . '/../resources/memorystore_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/memorystore_grpc_config.json', 'credentialsConfig' => [ 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, ], 'transportConfig' => [ 'rest' => [ @@ -126,18 +126,6 @@ private static function getClientDefaults() ]; } - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements ClientOptionsTrait::supportedTransports. */ - private static function supportedTransports() - { - return ['rest']; - } - /** * Return an OperationsClient object with the same endpoint as $this. * @@ -402,8 +390,9 @@ public static function parseName(string $formattedName, ?string $template = null * default this settings points to the default client config file, which is * provided in the resources folder. * @type string|TransportInterface $transport - * The transport used for executing network requests. At the moment, supports only - * `rest`. *Advanced usage*: Additionally, it is possible to pass in an already + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note * that when this object is provided, any settings in $transportConfig, and any * $apiEndpoint setting, will be ignored. @@ -412,9 +401,11 @@ public static function parseName(string $formattedName, ?string $template = null * each supported transport type should be passed in a key for that transport. For * example: * $transportConfig = [ + * 'grpc' => [...], * 'rest' => [...], * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * @type callable $clientCertSource * A callable which returns the client cert as a string. This can be used to