Skip to content

Commit

Permalink
fix: readd path templates for secret manager (#5333)
Browse files Browse the repository at this point in the history
* fix: readd path templates for secret manager
  • Loading branch information
sofisl authored May 17, 2024
1 parent 947ab79 commit 2e5fe96
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
36 changes: 36 additions & 0 deletions packages/google-cloud-secretmanager/owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,42 @@
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
.project;
}
/**
* Parse the secret from SecretVersion resource.
*
* @param {string} secretVersionName
* A fully-qualified path representing SecretVersion resource.
* @returns {string} A string representing the secret.
*/
matchSecretFromSecretVersionName(secretVersionName: string) {
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
.secret;
}
/**
* Parse the secret_version from SecretVersion resource.
*
* @param {string} secretVersionName
* A fully-qualified path representing SecretVersion resource.
* @returns {string} A string representing the secret_version.
*/
matchSecretVersionFromSecretVersionName(secretVersionName: string) {
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
.secret_version;
}
""")

s.replace('packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts',
r"topicPathTemplate:\s+new\s+this\._gaxModule\.PathTemplate\(\s+'projects\/{project}\/topics\/{topic}'\s+\),\s+};",
r"""topicPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/topics/{topic}'
),
secretPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/secrets/{secret}'
),
secretVersionPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/secrets/{secret}/versions/{secret_version}'
),
};
""")
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ export class SecretManagerServiceClient {
topicPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/topics/{topic}'
),
secretPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/secrets/{secret}'
),
secretVersionPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/secrets/{secret}/versions/{secret_version}'
),
};

// Some of the methods on this service return "paged" results,
Expand Down Expand Up @@ -2629,4 +2635,27 @@ export class SecretManagerServiceClient {
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
.project;
}
/**
* Parse the secret from SecretVersion resource.
*
* @param {string} secretVersionName
* A fully-qualified path representing SecretVersion resource.
* @returns {string} A string representing the secret.
*/
matchSecretFromSecretVersionName(secretVersionName: string) {
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
.secret;
}

/**
* Parse the secret_version from SecretVersion resource.
*
* @param {string} secretVersionName
* A fully-qualified path representing SecretVersion resource.
* @returns {string} A string representing the secret_version.
*/
matchSecretVersionFromSecretVersionName(secretVersionName: string) {
return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName)
.secret_version;
}
}

0 comments on commit 2e5fe96

Please sign in to comment.