Skip to content

Commit 70de09e

Browse files
fix(secretmanager): address gemini review comments
1 parent 5fdb290 commit 70de09e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

secret-manager/deleteSecretAnnotation.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ async function main(name, annotationKey) {
3838

3939
async function deleteSecretAnnotation() {
4040
const oldSecret = await getSecret();
41+
if (!oldSecret.annotations) {
42+
console.info(
43+
`Secret ${oldSecret.name} has no annotations, skipping update.`
44+
);
45+
return;
46+
}
4147
delete oldSecret.annotations[annotationKey];
4248
const [secret] = await client.updateSecret({
4349
secret: {

secret-manager/regional_samples/deleteRegionalSecretAnnotation.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ async function main(projectId, locationId, secretId, annotationKey) {
4545

4646
async function deleteRegionalSecretAnnotation() {
4747
const oldSecret = await getSecret();
48+
if (!oldSecret.annotations) {
49+
console.info(
50+
`Secret ${oldSecret.name} has no annotations, skipping update.`
51+
);
52+
return;
53+
}
4854
delete oldSecret.annotations[annotationKey];
4955
const [secret] = await client.updateSecret({
5056
secret: {

0 commit comments

Comments
 (0)