Skip to content

Commit

Permalink
feat: Add support for apiEndpoint and deprecate serviceAddress… (#2211)
Browse files Browse the repository at this point in the history
* [CHANGE ME] Re-generated Firestore to pick up changes in the API or client library generator.

* Fix synth.py replacement logic
  • Loading branch information
yoshi-automation authored and jdpedrie committed Aug 7, 2019
1 parent 0c289dd commit 367becf
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 28 deletions.
7 changes: 5 additions & 2 deletions Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private static function getClientDefaults()
{
return [
'serviceName' => self::SERVICE_NAME,
'serviceAddress' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
'apiEndpoint' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
'clientConfig' => __DIR__.'/../resources/firestore_admin_client_config.json',
'descriptorsConfigPath' => __DIR__.'/../resources/firestore_admin_descriptor_config.php',
'gcpApiConfigPath' => __DIR__.'/../resources/firestore_admin_grpc_config.json',
Expand Down Expand Up @@ -316,6 +316,9 @@ public static function parseName($formattedName, $template = null)
* Optional. Options for configuring the service API wrapper.
*
* @type string $serviceAddress
* **Deprecated**. This option will be removed in a future major release. Please
* utilize the `$apiEndpoint` option instead.
* @type string $apiEndpoint
* The address of the API remote host. May optionally include the port, formatted
* as "<uri>:<port>". Default 'firestore.googleapis.com:443'.
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
Expand Down Expand Up @@ -343,7 +346,7 @@ public static function parseName($formattedName, $template = null)
* 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 $serviceAddress
* object is provided, any settings in $transportConfig, and any `$apiEndpoint`
* setting, will be ignored.
* @type array $transportConfig
* Configuration options that will be used to construct the transport. Options for
Expand Down
7 changes: 5 additions & 2 deletions Firestore/src/V1/Gapic/FirestoreGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private static function getClientDefaults()
{
return [
'serviceName' => self::SERVICE_NAME,
'serviceAddress' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
'apiEndpoint' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
'clientConfig' => __DIR__.'/../resources/firestore_client_config.json',
'descriptorsConfigPath' => __DIR__.'/../resources/firestore_descriptor_config.php',
'gcpApiConfigPath' => __DIR__.'/../resources/firestore_grpc_config.json',
Expand Down Expand Up @@ -340,6 +340,9 @@ public static function parseName($formattedName, $template = null)
* Optional. Options for configuring the service API wrapper.
*
* @type string $serviceAddress
* **Deprecated**. This option will be removed in a future major release. Please
* utilize the `$apiEndpoint` option instead.
* @type string $apiEndpoint
* The address of the API remote host. May optionally include the port, formatted
* as "<uri>:<port>". Default 'firestore.googleapis.com:443'.
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
Expand Down Expand Up @@ -367,7 +370,7 @@ public static function parseName($formattedName, $template = null)
* 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 $serviceAddress
* object is provided, any settings in $transportConfig, and any `$apiEndpoint`
* setting, will be ignored.
* @type array $transportConfig
* Configuration options that will be used to construct the transport. Options for
Expand Down
7 changes: 5 additions & 2 deletions Firestore/src/V1beta1/Gapic/FirestoreGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private static function getClientDefaults()
{
return [
'serviceName' => self::SERVICE_NAME,
'serviceAddress' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
'apiEndpoint' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
'clientConfig' => __DIR__.'/../resources/firestore_client_config.json',
'descriptorsConfigPath' => __DIR__.'/../resources/firestore_descriptor_config.php',
'gcpApiConfigPath' => __DIR__.'/../resources/firestore_grpc_config.json',
Expand Down Expand Up @@ -340,6 +340,9 @@ public static function parseName($formattedName, $template = null)
* Optional. Options for configuring the service API wrapper.
*
* @type string $serviceAddress
* **Deprecated**. This option will be removed in a future major release. Please
* utilize the `$apiEndpoint` option instead.
* @type string $apiEndpoint
* The address of the API remote host. May optionally include the port, formatted
* as "<uri>:<port>". Default 'firestore.googleapis.com:443'.
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
Expand Down Expand Up @@ -367,7 +370,7 @@ public static function parseName($formattedName, $template = null)
* 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 $serviceAddress
* object is provided, any settings in $transportConfig, and any `$apiEndpoint`
* setting, will be ignored.
* @type array $transportConfig
* Configuration options that will be used to construct the transport. Options for
Expand Down
10 changes: 5 additions & 5 deletions Firestore/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-06-04T19:25:07.486260Z",
"updateTime": "2019-08-07T19:47:06.964219Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.23.0",
"dockerImage": "googleapis/artman@sha256:846102ebf7ea2239162deea69f64940443b4147f7c2e68d64b332416f74211ba"
"version": "0.29.1",
"dockerImage": "googleapis/artman@sha256:b2a73f4dda03ef8fcaa973e3ba26d0cf34091f6c22c70add663af325931aef4d"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "0026f4b890ed9e2388fb0573c0727defa6f5b82e",
"internalRef": "251265049"
"sha": "3a1b46a6668194a527e532a2c355b404c79b0e6a",
"internalRef": "262167956"
}
}
],
Expand Down
34 changes: 17 additions & 17 deletions Firestore/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@
# copy GPBMetadata file to metadata
s.move(library / f'proto/src/GPBMetadata/Google/Firestore', f'metadata/')

# Firestore Admin also lives here
admin_library = gapic.php_library(
service='firestore-admin',
version='v1',
config_path='/google/firestore/admin/artman_firestore_v1.yaml',
artman_output_name='google-cloud-firestore-admin-v1')

# copy all src
s.move(admin_library / f'src', 'src/Admin')

# copy proto files to src also
s.move(admin_library / f'proto/src/Google/Cloud/Firestore', f'src/')
s.move(admin_library / f'tests/Unit', 'tests/Unit/Admin')

# copy GPBMetadata file to metadata
s.move(admin_library / f'proto/src/GPBMetadata/Google/Firestore', f'metadata/')

# document and utilize apiEndpoint instead of serviceAddress
s.replace(
"**/Gapic/*GapicClient.php",
Expand Down Expand Up @@ -96,23 +113,6 @@
r'Copyright \d{4}',
'Copyright 2019')

# Firestore Admin also lives here
admin_library = gapic.php_library(
service='firestore-admin',
version='v1',
config_path='/google/firestore/admin/artman_firestore_v1.yaml',
artman_output_name='google-cloud-firestore-admin-v1')

# copy all src
s.move(admin_library / f'src', 'src/Admin')

# copy proto files to src also
s.move(admin_library / f'proto/src/Google/Cloud/Firestore', f'src/')
s.move(admin_library / f'tests/Unit', 'tests/Unit/Admin')

# copy GPBMetadata file to metadata
s.move(admin_library / f'proto/src/GPBMetadata/Google/Firestore', f'metadata/')

# fix year
s.replace(
'src/Admin/V1/Gapic/*GapicClient.php',
Expand Down

0 comments on commit 367becf

Please sign in to comment.