-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: (secretmanaer) readd legacy path templates (#5290)
* fix: readd legacy path templates --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e769b8b
commit 5e14553
Showing
2 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# 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. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import synthtool as s | ||
import synthtool.languages.node_mono_repo as node | ||
import pathlib | ||
|
||
|
||
node.owlbot_main(relative_dir="packages/google-cloud-secretmanager", | ||
staging_excludes=["README.md", "package.json"] | ||
) | ||
|
||
s.replace('packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts', | ||
r"return\sPromise\.resolve\(\);\s+}\s+}", | ||
r"""return Promise.resolve(); | ||
} | ||
/** | ||
* Return a fully-qualified project resource name string. | ||
* | ||
* @param {string} project | ||
* @returns {string} Resource name string. | ||
*/ | ||
secretPath(project: string, secret: string) { | ||
return this.pathTemplates.secretPathTemplate.render({ | ||
project: project, | ||
secret: secret, | ||
}); | ||
} | ||
/** | ||
* Parse the project from Secret resource. | ||
* | ||
* @param {string} secretName | ||
* A fully-qualified path representing Secret resource. | ||
* @returns {string} A string representing the project. | ||
*/ | ||
matchProjectFromSecretName(secretName: string) { | ||
return this.pathTemplates.secretPathTemplate.match(secretName).project; | ||
} | ||
/** | ||
* Parse the secret from Secret resource. | ||
* | ||
* @param {string} secretName | ||
* A fully-qualified path representing Secret resource. | ||
* @returns {string} A string representing the secret. | ||
*/ | ||
matchSecretFromSecretName(secretName: string) { | ||
return this.pathTemplates.secretPathTemplate.match(secretName).secret; | ||
} | ||
/** | ||
* Return a fully-qualified secretVersion resource name string. | ||
* | ||
* @param {string} project | ||
* @param {string} secret | ||
* @param {string} secret_version | ||
* @returns {string} Resource name string. | ||
*/ | ||
secretVersionPath(project: string, secret: string, secretVersion: string) { | ||
return this.pathTemplates.secretVersionPathTemplate.render({ | ||
project: project, | ||
secret: secret, | ||
secret_version: secretVersion, | ||
}); | ||
} | ||
/** | ||
* Parse the project from SecretVersion resource. | ||
* | ||
* @param {string} secretVersionName | ||
* A fully-qualified path representing SecretVersion resource. | ||
* @returns {string} A string representing the project. | ||
*/ | ||
matchProjectFromSecretVersionName(secretVersionName: string) { | ||
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName) | ||
.project; | ||
} | ||
} | ||
""") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters