Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: owlbot updates for Spanner V2 #7840

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 4 additions & 45 deletions Spanner/owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,56 +70,15 @@
# copy GPBMetadata file to metadata
s.move(admin_library / f'proto/src/GPBMetadata/Google/Spanner', f'metadata/', merge=php._merge)


# Fix test namespaces
s.replace(
'tests/Unit/Admin/Database/*/*.php',
r'namespace Google\\Cloud\\Spanner\\Admin\\Database\\Tests\\Unit',
r'namespace Google\\Cloud\\Spanner\\Tests\\Unit\\Admin\\Database')
# remove class_alias code
s.replace(
'tests/Unit/Admin/Instance/*/*.php',
r'namespace Google\\Cloud\\Spanner\\Admin\\Instance\\Tests\\Unit',
r'namespace Google\\Cloud\\Spanner\\Tests\\Unit\\Admin\\Instance')

# fix test group
s.replace(
'tests/**/Admin/Database/V1/*Test.php',
'@group database',
'@group spanner-admin-database')

s.replace(
'tests/**/Admin/Instance/V1/*Test.php',
'@group instance',
'@group spanner-admin-instance')

# remove ReadOnly class_alias code
s.replace(
"src/V*/**/PBReadOnly.php",
r"^// Adding a class alias for backwards compatibility with the \"readonly\" keyword.$"
"src/V*/**/*.php",
r"^// Adding a class alias for backwards compatibility with the previous class name.$"
+ "\n"
+ r"^class_alias\(PBReadOnly::class, __NAMESPACE__ . '\\ReadOnly'\);$"
+ r"^class_alias\(.*\);$"
+ "\n",
'')

### [START] protoc backwards compatibility fixes

# roll back to private properties.
s.replace(
"src/**/V*/**/*.php",
r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$",
r"""Generated from protobuf field \1
*/
private $""")

# Replace "Unwrapped" with "Value" for method names.
s.replace(
"src/**/V*/**/*.php",
r"public function ([s|g]\w{3,})Unwrapped",
r"public function \1Value"
)

### [END] protoc backwards compatibility fixes

# fix relative cloud.google.com links
s.replace(
"src/**/V*/**/*.php",
Expand Down
18 changes: 9 additions & 9 deletions Spanner/src/Admin/Database/V1/Backup.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Spanner/src/Admin/Database/V1/BackupInfo.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions Spanner/src/Admin/Database/V1/Backup_State.php

This file was deleted.

23 changes: 21 additions & 2 deletions Spanner/src/Admin/Database/V1/Client/DatabaseAdminClient.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright 2023 Google LLC
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,6 @@
use Google\ApiCore\CredentialsWrapper;
use Google\ApiCore\GapicClientTrait;
use Google\ApiCore\InsecureCredentialsWrapper;
use Google\ApiCore\LongRunning\OperationsClient;
use Google\ApiCore\OperationResponse;
use Google\ApiCore\PagedListResponse;
use Google\ApiCore\ResourceHelperTrait;
Expand Down Expand Up @@ -73,6 +72,7 @@
use Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseDdlRequest;
use Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseMetadata;
use Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest;
use Google\LongRunning\Client\OperationsClient;
use Google\LongRunning\Operation;
use Grpc\ChannelCredentials;
use GuzzleHttp\Promise\PromiseInterface;
Expand Down Expand Up @@ -200,6 +200,25 @@ public function resumeOperation($operationName, $methodName = null)
return $operation;
}

/**
* Create the default operation client for the service.
*
* @param array $options ClientOptions for the client.
*
* @return OperationsClient
*/
private function createOperationsClient(array $options)
{
// Unset client-specific configuration options
unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']);

if (isset($options['operationsClient'])) {
return $options['operationsClient'];
}

return new OperationsClient($options);
}

/**
* Formats a string containing the fully-qualified path to represent a backup
* resource.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

8 changes: 4 additions & 4 deletions Spanner/src/Admin/Database/V1/CopyBackupMetadata.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Spanner/src/Admin/Database/V1/CopyBackupRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Loading
Loading