Skip to content

Commit 7369971

Browse files
yoshi-automationjdpedrie
authored andcommitted
feat: Add support for apiEndpoint and deprecate serviceAddress… (#2222)
* [CHANGE ME] Re-generated Spanner to pick up changes in the API or client library generator. * Fix synth.py replacement logic
1 parent db51fdd commit 7369971

5 files changed

Lines changed: 36 additions & 58 deletions

File tree

Spanner/src/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private static function getClientDefaults()
140140
{
141141
return [
142142
'serviceName' => self::SERVICE_NAME,
143-
'serviceAddress' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
143+
'apiEndpoint' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
144144
'clientConfig' => __DIR__.'/../resources/database_admin_client_config.json',
145145
'descriptorsConfigPath' => __DIR__.'/../resources/database_admin_descriptor_config.php',
146146
'gcpApiConfigPath' => __DIR__.'/../resources/database_admin_grpc_config.json',
@@ -307,6 +307,9 @@ public function resumeOperation($operationName, $methodName = null)
307307
* Optional. Options for configuring the service API wrapper.
308308
*
309309
* @type string $serviceAddress
310+
* **Deprecated**. This option will be removed in a future major release. Please
311+
* utilize the `$apiEndpoint` option instead.
312+
* @type string $apiEndpoint
310313
* The address of the API remote host. May optionally include the port, formatted
311314
* as "<uri>:<port>". Default 'spanner.googleapis.com:443'.
312315
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
@@ -334,7 +337,7 @@ public function resumeOperation($operationName, $methodName = null)
334337
* or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
335338
* *Advanced usage*: Additionally, it is possible to pass in an already instantiated
336339
* {@see \Google\ApiCore\Transport\TransportInterface} object. Note that when this
337-
* object is provided, any settings in $transportConfig, and any $serviceAddress
340+
* object is provided, any settings in $transportConfig, and any `$apiEndpoint`
338341
* setting, will be ignored.
339342
* @type array $transportConfig
340343
* Configuration options that will be used to construct the transport. Options for

Spanner/src/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private static function getClientDefaults()
160160
{
161161
return [
162162
'serviceName' => self::SERVICE_NAME,
163-
'serviceAddress' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
163+
'apiEndpoint' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
164164
'clientConfig' => __DIR__.'/../resources/instance_admin_client_config.json',
165165
'descriptorsConfigPath' => __DIR__.'/../resources/instance_admin_descriptor_config.php',
166166
'gcpApiConfigPath' => __DIR__.'/../resources/instance_admin_grpc_config.json',
@@ -352,6 +352,9 @@ public function resumeOperation($operationName, $methodName = null)
352352
* Optional. Options for configuring the service API wrapper.
353353
*
354354
* @type string $serviceAddress
355+
* **Deprecated**. This option will be removed in a future major release. Please
356+
* utilize the `$apiEndpoint` option instead.
357+
* @type string $apiEndpoint
355358
* The address of the API remote host. May optionally include the port, formatted
356359
* as "<uri>:<port>". Default 'spanner.googleapis.com:443'.
357360
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
@@ -379,7 +382,7 @@ public function resumeOperation($operationName, $methodName = null)
379382
* or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
380383
* *Advanced usage*: Additionally, it is possible to pass in an already instantiated
381384
* {@see \Google\ApiCore\Transport\TransportInterface} object. Note that when this
382-
* object is provided, any settings in $transportConfig, and any $serviceAddress
385+
* object is provided, any settings in $transportConfig, and any `$apiEndpoint`
383386
* setting, will be ignored.
384387
* @type array $transportConfig
385388
* Configuration options that will be used to construct the transport. Options for

Spanner/src/V1/Gapic/SpannerGapicClient.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private static function getClientDefaults()
131131
{
132132
return [
133133
'serviceName' => self::SERVICE_NAME,
134-
'serviceAddress' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
134+
'apiEndpoint' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
135135
'clientConfig' => __DIR__.'/../resources/spanner_client_config.json',
136136
'descriptorsConfigPath' => __DIR__.'/../resources/spanner_descriptor_config.php',
137137
'gcpApiConfigPath' => __DIR__.'/../resources/spanner_grpc_config.json',
@@ -267,6 +267,9 @@ public static function parseName($formattedName, $template = null)
267267
* Optional. Options for configuring the service API wrapper.
268268
*
269269
* @type string $serviceAddress
270+
* **Deprecated**. This option will be removed in a future major release. Please
271+
* utilize the `$apiEndpoint` option instead.
272+
* @type string $apiEndpoint
270273
* The address of the API remote host. May optionally include the port, formatted
271274
* as "<uri>:<port>". Default 'spanner.googleapis.com:443'.
272275
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
@@ -294,7 +297,7 @@ public static function parseName($formattedName, $template = null)
294297
* or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
295298
* *Advanced usage*: Additionally, it is possible to pass in an already instantiated
296299
* {@see \Google\ApiCore\Transport\TransportInterface} object. Note that when this
297-
* object is provided, any settings in $transportConfig, and any $serviceAddress
300+
* object is provided, any settings in $transportConfig, and any `$apiEndpoint`
298301
* setting, will be ignored.
299302
* @type array $transportConfig
300303
* Configuration options that will be used to construct the transport. Options for

Spanner/synth.metadata

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"updateTime": "2019-07-25T10:02:41.870117Z",
2+
"updateTime": "2019-08-07T19:41:10.660248Z",
33
"sources": [
44
{
55
"generator": {
@@ -12,8 +12,8 @@
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "4b12afe72950f36bef6f196a05f4430e4421a873",
16-
"internalRef": "259790363"
15+
"sha": "3a1b46a6668194a527e532a2c355b404c79b0e6a",
16+
"internalRef": "262167956"
1717
}
1818
}
1919
],

Spanner/synth.py

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,6 @@
4343
# copy GPBMetadata file to metadata
4444
s.move(library / f'proto/src/GPBMetadata/Google/Spanner', f'metadata/')
4545

46-
# document and utilize apiEndpoint instead of serviceAddress
47-
s.replace(
48-
"**/Gapic/*GapicClient.php",
49-
r"'serviceAddress' =>",
50-
r"'apiEndpoint' =>")
51-
s.replace(
52-
"**/Gapic/*GapicClient.php",
53-
r"@type string \$serviceAddress",
54-
r"""@type string $serviceAddress
55-
* **Deprecated**. This option will be removed in a future major release. Please
56-
* utilize the `$apiEndpoint` option instead.
57-
* @type string $apiEndpoint""")
58-
s.replace(
59-
"**/Gapic/*GapicClient.php",
60-
r"\$transportConfig, and any \$serviceAddress",
61-
r"$transportConfig, and any `$apiEndpoint`")
62-
63-
# fix year
64-
s.replace(
65-
'**/Gapic/*GapicClient.php',
66-
r'Copyright \d{4}',
67-
r'Copyright 2017')
68-
s.replace(
69-
'tests/**/V1/*Test.php',
70-
r'Copyright \d{4}',
71-
r'Copyright 2018')
72-
7346
# Spanner Database Admin also lives here
7447
admin_library = gapic.php_library(
7548
service='spanner-admin-database',
@@ -88,16 +61,6 @@
8861
# copy GPBMetadata file to metadata
8962
s.move(admin_library / f'proto/src/GPBMetadata/Google/Spanner', f'metadata/')
9063

91-
# fix year
92-
s.replace(
93-
'**/Gapic/*GapicClient.php',
94-
r'Copyright \d{4}',
95-
r'Copyright 2017')
96-
s.replace(
97-
'tests/**/Admin/Database/V1/*Test.php',
98-
r'Copyright \d{4}',
99-
r'Copyright 2018')
100-
10164
# Spanner Instance Admin also lives here
10265
admin_library = gapic.php_library(
10366
service='spanner-admin-instance',
@@ -116,27 +79,33 @@
11679
# copy GPBMetadata file to metadata
11780
s.move(admin_library / f'proto/src/GPBMetadata/Google/Spanner', f'metadata/')
11881

82+
# document and utilize apiEndpoint instead of serviceAddress
83+
s.replace(
84+
"**/Gapic/*GapicClient.php",
85+
r"'serviceAddress' =>",
86+
r"'apiEndpoint' =>")
87+
s.replace(
88+
"**/Gapic/*GapicClient.php",
89+
r"@type string \$serviceAddress",
90+
r"""@type string $serviceAddress
91+
* **Deprecated**. This option will be removed in a future major release. Please
92+
* utilize the `$apiEndpoint` option instead.
93+
* @type string $apiEndpoint""")
94+
s.replace(
95+
"**/Gapic/*GapicClient.php",
96+
r"\$transportConfig, and any \$serviceAddress",
97+
r"$transportConfig, and any `$apiEndpoint`")
98+
11999
# fix year
120100
s.replace(
121101
'**/Gapic/*GapicClient.php',
122102
r'Copyright \d{4}',
123103
r'Copyright 2017')
124104
s.replace(
125-
'tests/**/Admin/Instance/V1/*Test.php',
105+
'tests/**/V1/*Test.php',
126106
r'Copyright \d{4}',
127107
r'Copyright 2018')
128108

129-
# Use new namespaces
130-
s.replace(
131-
'src/V1/Gapic/SpannerGapicClient.php',
132-
r'ExecuteSqlRequest_QueryMode',
133-
'ExecuteSqlRequest\\QueryMode')
134-
135-
s.replace(
136-
'src/V1/Gapic/SpannerGapicClient.php',
137-
r'ExecuteBatchDmlRequest_Statement',
138-
'ExecuteBatchDmlRequest\\Statement')
139-
140109
# Fix test namespaces
141110
s.replace(
142111
'tests/Unit/Admin/Database/*/*.php',

0 commit comments

Comments
 (0)