Skip to content

Commit 2e5fe96

Browse files
authored
fix: readd path templates for secret manager (#5333)
* fix: readd path templates for secret manager
1 parent 947ab79 commit 2e5fe96

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

packages/google-cloud-secretmanager/owlbot.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,42 @@
9090
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
9191
.project;
9292
}
93+
/**
94+
* Parse the secret from SecretVersion resource.
95+
*
96+
* @param {string} secretVersionName
97+
* A fully-qualified path representing SecretVersion resource.
98+
* @returns {string} A string representing the secret.
99+
*/
100+
matchSecretFromSecretVersionName(secretVersionName: string) {
101+
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
102+
.secret;
103+
}
104+
105+
/**
106+
* Parse the secret_version from SecretVersion resource.
107+
*
108+
* @param {string} secretVersionName
109+
* A fully-qualified path representing SecretVersion resource.
110+
* @returns {string} A string representing the secret_version.
111+
*/
112+
matchSecretVersionFromSecretVersionName(secretVersionName: string) {
113+
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
114+
.secret_version;
93115
94116
}
95117
""")
118+
119+
s.replace('packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts',
120+
r"topicPathTemplate:\s+new\s+this\._gaxModule\.PathTemplate\(\s+'projects\/{project}\/topics\/{topic}'\s+\),\s+};",
121+
r"""topicPathTemplate: new this._gaxModule.PathTemplate(
122+
'projects/{project}/topics/{topic}'
123+
),
124+
secretPathTemplate: new this._gaxModule.PathTemplate(
125+
'projects/{project}/secrets/{secret}'
126+
),
127+
secretVersionPathTemplate: new this._gaxModule.PathTemplate(
128+
'projects/{project}/secrets/{secret}/versions/{secret_version}'
129+
),
130+
};
131+
""")

packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ export class SecretManagerServiceClient {
231231
topicPathTemplate: new this._gaxModule.PathTemplate(
232232
'projects/{project}/topics/{topic}'
233233
),
234+
secretPathTemplate: new this._gaxModule.PathTemplate(
235+
'projects/{project}/secrets/{secret}'
236+
),
237+
secretVersionPathTemplate: new this._gaxModule.PathTemplate(
238+
'projects/{project}/secrets/{secret}/versions/{secret_version}'
239+
),
234240
};
235241

236242
// Some of the methods on this service return "paged" results,
@@ -2629,4 +2635,27 @@ export class SecretManagerServiceClient {
26292635
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
26302636
.project;
26312637
}
2638+
/**
2639+
* Parse the secret from SecretVersion resource.
2640+
*
2641+
* @param {string} secretVersionName
2642+
* A fully-qualified path representing SecretVersion resource.
2643+
* @returns {string} A string representing the secret.
2644+
*/
2645+
matchSecretFromSecretVersionName(secretVersionName: string) {
2646+
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
2647+
.secret;
2648+
}
2649+
2650+
/**
2651+
* Parse the secret_version from SecretVersion resource.
2652+
*
2653+
* @param {string} secretVersionName
2654+
* A fully-qualified path representing SecretVersion resource.
2655+
* @returns {string} A string representing the secret_version.
2656+
*/
2657+
matchSecretVersionFromSecretVersionName(secretVersionName: string) {
2658+
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
2659+
.secret_version;
2660+
}
26322661
}

0 commit comments

Comments
 (0)