Skip to content

Commit 2a30342

Browse files
feat: [Memorystore] Synchronize new proto/yaml changes. (#9153)
* Synchronize new proto/yaml changes. PiperOrigin-RevId: 908269410 Source-Link: googleapis/googleapis@01f1127 Source-Link: googleapis/googleapis-gen@132672d Copy-Tag: eyJwIjoiTWVtb3J5c3RvcmUvLk93bEJvdC55YW1sIiwiaCI6IjEzMjY3MmRkMzZkOWIzM2I1ZWM0ZDNmMDliMjk3NjE5Mjg0ODBmZGEifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a430e29 commit 2a30342

8 files changed

Lines changed: 26 additions & 32 deletions

File tree

Memorystore/samples/V1/MemorystoreClient/list_backup_collections.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// [START memorystore_v1_generated_Memorystore_ListBackupCollections_sync]
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\PagedListResponse;
28+
use Google\Cloud\Memorystore\V1\BackupCollection;
2829
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
2930
use Google\Cloud\Memorystore\V1\ListBackupCollectionsRequest;
3031

@@ -55,6 +56,7 @@ function list_backup_collections_sample(string $formattedParent): void
5556
/** @var PagedListResponse $response */
5657
$response = $memorystoreClient->listBackupCollections($request);
5758

59+
/** @var BackupCollection $element */
5860
foreach ($response as $element) {
5961
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
6062
}

Memorystore/samples/V1/MemorystoreClient/list_backups.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// [START memorystore_v1_generated_Memorystore_ListBackups_sync]
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\PagedListResponse;
28+
use Google\Cloud\Memorystore\V1\Backup;
2829
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
2930
use Google\Cloud\Memorystore\V1\ListBackupsRequest;
3031

@@ -49,6 +50,7 @@ function list_backups_sample(string $formattedParent): void
4950
/** @var PagedListResponse $response */
5051
$response = $memorystoreClient->listBackups($request);
5152

53+
/** @var Backup $element */
5254
foreach ($response as $element) {
5355
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
5456
}

Memorystore/samples/V1/MemorystoreClient/list_instances.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\PagedListResponse;
2828
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
29+
use Google\Cloud\Memorystore\V1\Instance;
2930
use Google\Cloud\Memorystore\V1\ListInstancesRequest;
3031

3132
/**
@@ -49,6 +50,7 @@ function list_instances_sample(string $formattedParent): void
4950
/** @var PagedListResponse $response */
5051
$response = $memorystoreClient->listInstances($request);
5152

53+
/** @var Instance $element */
5254
foreach ($response as $element) {
5355
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
5456
}

Memorystore/samples/V1/MemorystoreClient/list_locations.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\PagedListResponse;
2828
use Google\Cloud\Location\ListLocationsRequest;
29+
use Google\Cloud\Location\Location;
2930
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
3031

3132
/**
@@ -50,6 +51,7 @@ function list_locations_sample(): void
5051
/** @var PagedListResponse $response */
5152
$response = $memorystoreClient->listLocations($request);
5253

54+
/** @var Location $element */
5355
foreach ($response as $element) {
5456
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
5557
}

Memorystore/samples/V1beta/MemorystoreClient/list_instances.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\PagedListResponse;
2828
use Google\Cloud\Memorystore\V1beta\Client\MemorystoreClient;
29+
use Google\Cloud\Memorystore\V1beta\Instance;
2930
use Google\Cloud\Memorystore\V1beta\ListInstancesRequest;
3031

3132
/**
@@ -49,6 +50,7 @@ function list_instances_sample(string $formattedParent): void
4950
/** @var PagedListResponse $response */
5051
$response = $memorystoreClient->listInstances($request);
5152

53+
/** @var Instance $element */
5254
foreach ($response as $element) {
5355
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
5456
}

Memorystore/samples/V1beta/MemorystoreClient/list_locations.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\PagedListResponse;
2828
use Google\Cloud\Location\ListLocationsRequest;
29+
use Google\Cloud\Location\Location;
2930
use Google\Cloud\Memorystore\V1beta\Client\MemorystoreClient;
3031

3132
/**
@@ -50,6 +51,7 @@ function list_locations_sample(): void
5051
/** @var PagedListResponse $response */
5152
$response = $memorystoreClient->listLocations($request);
5253

54+
/** @var Location $element */
5355
foreach ($response as $element) {
5456
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
5557
}

Memorystore/src/V1/Client/MemorystoreClient.php

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ private static function getClientDefaults()
128128
'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
129129
'clientConfig' => __DIR__ . '/../resources/memorystore_client_config.json',
130130
'descriptorsConfigPath' => __DIR__ . '/../resources/memorystore_descriptor_config.php',
131+
'gcpApiConfigPath' => __DIR__ . '/../resources/memorystore_grpc_config.json',
131132
'credentialsConfig' => [
132133
'defaultScopes' => self::$serviceScopes,
133-
'useJwtAccessWithScope' => false,
134134
],
135135
'transportConfig' => [
136136
'rest' => [
@@ -140,18 +140,6 @@ private static function getClientDefaults()
140140
];
141141
}
142142

143-
/** Implements GapicClientTrait::defaultTransport. */
144-
private static function defaultTransport()
145-
{
146-
return 'rest';
147-
}
148-
149-
/** Implements ClientOptionsTrait::supportedTransports. */
150-
private static function supportedTransports()
151-
{
152-
return ['rest'];
153-
}
154-
155143
/**
156144
* Return an OperationsClient object with the same endpoint as $this.
157145
*
@@ -493,8 +481,9 @@ public static function parseName(string $formattedName, ?string $template = null
493481
* default this settings points to the default client config file, which is
494482
* provided in the resources folder.
495483
* @type string|TransportInterface $transport
496-
* The transport used for executing network requests. At the moment, supports only
497-
* `rest`. *Advanced usage*: Additionally, it is possible to pass in an already
484+
* The transport used for executing network requests. May be either the string
485+
* `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
486+
* *Advanced usage*: Additionally, it is possible to pass in an already
498487
* instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note
499488
* that when this object is provided, any settings in $transportConfig, and any
500489
* $apiEndpoint setting, will be ignored.
@@ -503,9 +492,11 @@ public static function parseName(string $formattedName, ?string $template = null
503492
* each supported transport type should be passed in a key for that transport. For
504493
* example:
505494
* $transportConfig = [
495+
* 'grpc' => [...],
506496
* 'rest' => [...],
507497
* ];
508-
* See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the
498+
* See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
499+
* {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
509500
* supported options.
510501
* @type callable $clientCertSource
511502
* A callable which returns the client cert as a string. This can be used to

Memorystore/src/V1beta/Client/MemorystoreClient.php

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ private static function getClientDefaults()
114114
'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
115115
'clientConfig' => __DIR__ . '/../resources/memorystore_client_config.json',
116116
'descriptorsConfigPath' => __DIR__ . '/../resources/memorystore_descriptor_config.php',
117+
'gcpApiConfigPath' => __DIR__ . '/../resources/memorystore_grpc_config.json',
117118
'credentialsConfig' => [
118119
'defaultScopes' => self::$serviceScopes,
119-
'useJwtAccessWithScope' => false,
120120
],
121121
'transportConfig' => [
122122
'rest' => [
@@ -126,18 +126,6 @@ private static function getClientDefaults()
126126
];
127127
}
128128

129-
/** Implements GapicClientTrait::defaultTransport. */
130-
private static function defaultTransport()
131-
{
132-
return 'rest';
133-
}
134-
135-
/** Implements ClientOptionsTrait::supportedTransports. */
136-
private static function supportedTransports()
137-
{
138-
return ['rest'];
139-
}
140-
141129
/**
142130
* Return an OperationsClient object with the same endpoint as $this.
143131
*
@@ -402,8 +390,9 @@ public static function parseName(string $formattedName, ?string $template = null
402390
* default this settings points to the default client config file, which is
403391
* provided in the resources folder.
404392
* @type string|TransportInterface $transport
405-
* The transport used for executing network requests. At the moment, supports only
406-
* `rest`. *Advanced usage*: Additionally, it is possible to pass in an already
393+
* The transport used for executing network requests. May be either the string
394+
* `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
395+
* *Advanced usage*: Additionally, it is possible to pass in an already
407396
* instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note
408397
* that when this object is provided, any settings in $transportConfig, and any
409398
* $apiEndpoint setting, will be ignored.
@@ -412,9 +401,11 @@ public static function parseName(string $formattedName, ?string $template = null
412401
* each supported transport type should be passed in a key for that transport. For
413402
* example:
414403
* $transportConfig = [
404+
* 'grpc' => [...],
415405
* 'rest' => [...],
416406
* ];
417-
* See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the
407+
* See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
408+
* {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
418409
* supported options.
419410
* @type callable $clientCertSource
420411
* A callable which returns the client cert as a string. This can be used to

0 commit comments

Comments
 (0)