Skip to content

Commit

Permalink
chore!: promote SecretManager to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Dec 6, 2024
1 parent d5e825d commit 23b7839
Show file tree
Hide file tree
Showing 114 changed files with 571 additions and 9,037 deletions.
2 changes: 0 additions & 2 deletions SecretManager/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
deep-copy-regex:
- source: /google/cloud/secrets/(v1beta1)/.*-php/(.*)
dest: /owl-bot-staging/SecretManager/$1/$2
- source: /google/cloud/secretmanager/(v1|v1beta2)/.*-php/(.*)
dest: /owl-bot-staging/SecretManager/$1/$2
api-name: SecretManager
Binary file removed SecretManager/metadata/V1Beta1/Resources.php
Binary file not shown.
111 changes: 0 additions & 111 deletions SecretManager/metadata/V1Beta1/Service.php

This file was deleted.

53 changes: 22 additions & 31 deletions SecretManager/owlbot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 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'])
2 changes: 1 addition & 1 deletion SecretManager/src/V1/AccessSecretVersionRequest.php

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

4 changes: 2 additions & 2 deletions SecretManager/src/V1/AccessSecretVersionResponse.php

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

4 changes: 2 additions & 2 deletions SecretManager/src/V1/AddSecretVersionRequest.php

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

33 changes: 21 additions & 12 deletions SecretManager/src/V1/Client/SecretManagerServiceClient.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 @@ -113,9 +113,7 @@ final class SecretManagerServiceClient
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 @@ -198,8 +196,12 @@ public static function projectLocationSecretName(string $project, string $locati
*
* @return string The formatted project_location_secret_secret_version resource.
*/
public static function projectLocationSecretSecretVersionName(string $project, string $location, string $secret, string $secretVersion): string
{
public static function projectLocationSecretSecretVersionName(
string $project,
string $location,
string $secret,
string $secretVersion
): string {
return self::getPathTemplate('projectLocationSecretSecretVersion')->render([
'project' => $project,
'location' => $location,
Expand Down Expand Up @@ -235,8 +237,11 @@ public static function projectSecretName(string $project, string $secret): strin
*
* @return string The formatted project_secret_secret_version resource.
*/
public static function projectSecretSecretVersionName(string $project, string $secret, string $secretVersion): string
{
public static function projectSecretSecretVersionName(
string $project,
string $secret,
string $secretVersion
): string {
return self::getPathTemplate('projectSecretSecretVersion')->render([
'project' => $project,
'secret' => $secret,
Expand Down Expand Up @@ -426,8 +431,10 @@ public function __call($method, $args)
*
* @throws ApiException Thrown if the API call fails.
*/
public function accessSecretVersion(AccessSecretVersionRequest $request, array $callOptions = []): AccessSecretVersionResponse
{
public function accessSecretVersion(
AccessSecretVersionRequest $request,
array $callOptions = []
): AccessSecretVersionResponse {
return $this->startApiCall('AccessSecretVersion', $request, $callOptions)->wait();
}

Expand Down Expand Up @@ -803,8 +810,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();
}

Expand Down
6 changes: 3 additions & 3 deletions SecretManager/src/V1/CreateSecretRequest.php

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

2 changes: 1 addition & 1 deletion SecretManager/src/V1/CustomerManagedEncryption.php

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

2 changes: 1 addition & 1 deletion SecretManager/src/V1/CustomerManagedEncryptionStatus.php

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

4 changes: 2 additions & 2 deletions SecretManager/src/V1/DeleteSecretRequest.php

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

4 changes: 2 additions & 2 deletions SecretManager/src/V1/DestroySecretVersionRequest.php

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

4 changes: 2 additions & 2 deletions SecretManager/src/V1/DisableSecretVersionRequest.php

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

Loading

0 comments on commit 23b7839

Please sign in to comment.