Skip to content

Commit

Permalink
chore!: migrate PrivateCatalog to new surface (#7947)
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer authored Jan 6, 2025
1 parent b536921 commit 69e40a8
Show file tree
Hide file tree
Showing 22 changed files with 111 additions and 1,015 deletions.
53 changes: 22 additions & 31 deletions PrivateCatalog/owlbot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 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 @@ -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'])
16 changes: 8 additions & 8 deletions PrivateCatalog/src/V1beta1/AssetReference.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.

16 changes: 0 additions & 16 deletions PrivateCatalog/src/V1beta1/AssetReference_AssetValidationState.php

This file was deleted.

10 changes: 5 additions & 5 deletions PrivateCatalog/src/V1beta1/Catalog.php

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

10 changes: 2 additions & 8 deletions PrivateCatalog/src/V1beta1/Client/PrivateCatalogClient.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 @@ -38,7 +38,6 @@
use Google\Cloud\PrivateCatalog\V1beta1\SearchProductsRequest;
use Google\Cloud\PrivateCatalog\V1beta1\SearchVersionsRequest;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;

/**
* Service Description: `PrivateCatalog` allows catalog consumers to retrieve `Catalog`, `Product`
Expand Down Expand Up @@ -96,9 +95,7 @@ final class PrivateCatalogClient
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 static function getClientDefaults()
{
Expand Down Expand Up @@ -169,9 +166,6 @@ private static function getClientDefaults()
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
Loading

0 comments on commit 69e40a8

Please sign in to comment.