Skip to content

Commit

Permalink
chore!: promote DataprocMetastore to v1 (#7400)
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer authored Jun 13, 2024
1 parent 9e68cd2 commit 71f9410
Show file tree
Hide file tree
Showing 319 changed files with 641 additions and 49,083 deletions.
2 changes: 1 addition & 1 deletion .repo-metadata-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@
"DataprocMetastore": {
"language": "php",
"distribution_name": "google/cloud-dataproc-metastore",
"release_level": "preview",
"release_level": "stable",
"client_documentation": "https://cloud.google.com/php/docs/reference/cloud-dataproc-metastore/latest",
"library_type": "GAPIC_AUTO",
"api_shortname": "metastore"
Expand Down
2 changes: 1 addition & 1 deletion DataprocMetastore/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
deep-copy-regex:
- source: /google/cloud/metastore/(.*)/.*-php/(.*)
- source: /google/cloud/metastore/(v1)/.*-php/(.*)
dest: /owl-bot-staging/DataprocMetastore/$1/$2
api-name: DataprocMetastore
5 changes: 2 additions & 3 deletions DataprocMetastore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Version

This component is considered beta. As such, it should be expected to be mostly
stable and we're working towards a release candidate. We will address issues
and requests with a higher priority.
This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in
any minor or patch releases. We will address issues and requests with the highest priority.

### Next Steps

Expand Down
Binary file removed DataprocMetastore/metadata/V1Alpha/Metastore.php
Binary file not shown.
Binary file not shown.
Binary file removed DataprocMetastore/metadata/V1Beta/Metastore.php
Binary file not shown.
Binary file not shown.
53 changes: 22 additions & 31 deletions DataprocMetastore/owlbot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Google LLC
# Copyright 2023 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 @@ -32,34 +32,25 @@

php.owlbot_main(src=src, dest=dest)

# Change the wording for the deprecation warning.
# remove class_alias code
s.replace(
'src/*/*_*.php',
r'will be removed in the next major release',
'will be removed in a future release')

### [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",
r"(.{0,})\]\((/.{0,})\)",
r"\1](https://cloud.google.com\2)"
)
"src/V*/**/*.php",
r"^// Adding a class alias for backwards compatibility with the previous class name.$"
+ "\n"
+ r"^class_alias\(.*\);$"
+ "\n",
'')

# format generated clients
subprocess.run([
'npm',
'exec',
'--yes',
'--package=@prettier/plugin-php@^0.16',
'--',
'prettier',
'**/Client/*',
'--write',
'--parser=php',
'--single-quote',
'--print-width=120'])

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

4 changes: 2 additions & 2 deletions DataprocMetastore/src/V1/AuxiliaryVersionConfig.php

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

4 changes: 2 additions & 2 deletions DataprocMetastore/src/V1/BackendMetastore.php

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

2 changes: 0 additions & 2 deletions DataprocMetastore/src/V1/BackendMetastore/MetastoreType.php

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

16 changes: 0 additions & 16 deletions DataprocMetastore/src/V1/BackendMetastore_MetastoreType.php

This file was deleted.

12 changes: 6 additions & 6 deletions DataprocMetastore/src/V1/Backup.php

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

2 changes: 0 additions & 2 deletions DataprocMetastore/src/V1/Backup/State.php

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

16 changes: 0 additions & 16 deletions DataprocMetastore/src/V1/Backup_State.php

This file was deleted.

63 changes: 47 additions & 16 deletions DataprocMetastore/src/V1/Client/DataprocMetastoreClient.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 All @@ -27,7 +27,6 @@
use Google\ApiCore\ApiException;
use Google\ApiCore\CredentialsWrapper;
use Google\ApiCore\GapicClientTrait;
use Google\ApiCore\LongRunning\OperationsClient;
use Google\ApiCore\OperationResponse;
use Google\ApiCore\PagedListResponse;
use Google\ApiCore\ResourceHelperTrait;
Expand Down Expand Up @@ -65,6 +64,7 @@
use Google\Cloud\Metastore\V1\Service;
use Google\Cloud\Metastore\V1\UpdateMetadataImportRequest;
use Google\Cloud\Metastore\V1\UpdateServiceRequest;
use Google\LongRunning\Client\OperationsClient;
use Google\LongRunning\Operation;
use GuzzleHttp\Promise\PromiseInterface;

Expand Down Expand Up @@ -144,9 +144,7 @@ final class DataprocMetastoreClient
private const CODEGEN_NAME = 'gapic';

/** The default scopes required by the service. */
public static $serviceScopes = [
'https://www.googleapis.com/auth/cloud-platform',
];
public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform'];

private $operationsClient;

Expand Down Expand Up @@ -192,12 +190,33 @@ public function getOperationsClient()
*/
public function resumeOperation($operationName, $methodName = null)
{
$options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : [];
$options = isset($this->descriptors[$methodName]['longRunning'])
? $this->descriptors[$methodName]['longRunning']
: [];
$operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
$operation->reload();
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 Expand Up @@ -247,8 +266,12 @@ public static function locationName(string $project, string $location): string
*
* @return string The formatted metadata_import resource.
*/
public static function metadataImportName(string $project, string $location, string $service, string $metadataImport): string
{
public static function metadataImportName(
string $project,
string $location,
string $service,
string $metadataImport
): string {
return self::getPathTemplate('metadataImport')->render([
'project' => $project,
'location' => $location,
Expand Down Expand Up @@ -438,8 +461,10 @@ public function __call($method, $args)
*
* @throws ApiException Thrown if the API call fails.
*/
public function alterMetadataResourceLocation(AlterMetadataResourceLocationRequest $request, array $callOptions = []): OperationResponse
{
public function alterMetadataResourceLocation(
AlterMetadataResourceLocationRequest $request,
array $callOptions = []
): OperationResponse {
return $this->startApiCall('AlterMetadataResourceLocation', $request, $callOptions)->wait();
}

Expand Down Expand Up @@ -491,8 +516,10 @@ public function createBackup(CreateBackupRequest $request, array $callOptions =
*
* @throws ApiException Thrown if the API call fails.
*/
public function createMetadataImport(CreateMetadataImportRequest $request, array $callOptions = []): OperationResponse
{
public function createMetadataImport(
CreateMetadataImportRequest $request,
array $callOptions = []
): OperationResponse {
return $this->startApiCall('CreateMetadataImport', $request, $callOptions)->wait();
}

Expand Down Expand Up @@ -859,8 +886,10 @@ public function restoreService(RestoreServiceRequest $request, array $callOption
*
* @throws ApiException Thrown if the API call fails.
*/
public function updateMetadataImport(UpdateMetadataImportRequest $request, array $callOptions = []): OperationResponse
{
public function updateMetadataImport(
UpdateMetadataImportRequest $request,
array $callOptions = []
): OperationResponse {
return $this->startApiCall('UpdateMetadataImport', $request, $callOptions)->wait();
}

Expand Down Expand Up @@ -1026,8 +1055,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions =
*
* @throws ApiException Thrown if the API call fails.
*/
public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse
{
public function testIamPermissions(
TestIamPermissionsRequest $request,
array $callOptions = []
): TestIamPermissionsResponse {
return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait();
}
}
Loading

0 comments on commit 71f9410

Please sign in to comment.