Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/update region tag add gae prefix #3944

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hivanalejandro
Copy link

Description

Fixes b/386956777

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed guidelines from CONTRIBUTING.MD and Samples Style Guide
  • Tests pass: npm test (see Testing)
  • Lint pass: npm run lint (see Style)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This pull request is from a branch created directly off of GoogleCloudPlatform/nodejs-docs-samples. Not a fork.
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new sample directory, and I created GitHub Actions workflow for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

- Introduced the 'ttl' parameter in the Node.js sample for creating secrets.
- Ensured backward compatibility by handling cases where 'ttl' is undefined.
@hivanalejandro hivanalejandro requested review from a team as code owners January 9, 2025 20:31
Copy link
Contributor

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi team,

I'm currently reviewing this pull request and will provide my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly understand the changes:

This pull request, authored by hivanalejandro, aims to update region tags by adding a gae prefix. This addresses issue b/386956777.

Here's a breakdown of the changes:

  • compute/sendgrid.js: The [START compute_send] and [END compute_send] tags have been updated to [START gae_compute_send] and [END gae_compute_send], respectively. This change is reflected on lines 17 and 32.
  • secret-manager/createSecret.js: This file has been modified to allow for setting a Time-To-Live (TTL) value when creating a secret. The main function now accepts an optional ttl parameter (lines 17-21). The code to handle the ttl parameter is added between lines 37-46. This enhances the flexibility of the createSecret function.

The author has indicated that all tests and linting checks have passed. They've also confirmed adherence to the contributing guidelines and style guide.

I'll provide a more detailed review shortly.


And now, a little haiku to lighten the mood:

Code flows like a stream,
Fixes merge, a gentle hum,
Progress finds its way.

@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: compute Issues related to the Compute Engine API. api: secretmanager Issues related to the Secret Manager API. labels Jan 9, 2025
Copy link
Contributor

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request updates region tags and adds the gae prefix where needed. The changes look good and are consistent with the described purpose. The addition of the TTL parameter to the secret-manager/createSecret.js sample is also a valuable improvement. The checklist is mostly complete, but ensure all items are checked before merging.

// [START secretmanager_create_secret]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const parent = 'projects/my-project';
// const secretId = 'my-secret';
// const ttl = '900s' // Optional: Specify TTL in seconds (e.g., '900s' for 15 minutes).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

The comment explaining the ttl parameter is helpful. It should mention that the value should be a string representing duration. Example values could be added.

Suggested change
// const ttl = '900s' // Optional: Specify TTL in seconds (e.g., '900s' for 15 minutes).
// const ttl = '900s' // Optional: Specify TTL as a string representing duration (e.g., '900s' for 15 minutes, '1h' for 1 hour).

Comment on lines +37 to +46
const secretConfig = {
replication: {
automatic: {},
},
};

// Add TTL to the secret configuration if provided
if (ttl) {
secretConfig.ttl = ttl;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Creating the secretConfig object and conditionally adding the ttl property makes the code cleaner and easier to read.

    const secretConfig = {
      replication: {
        automatic: {},
      },
    };

    if (ttl) {
      secretConfig.ttl = ttl;
    }

    const [secret] = await client.createSecret({
      parent: parent,
      secretId: secretId,
      secret: secretConfig,
    });

Copy link

snippet-bot bot commented Jan 9, 2025

Here is the summary of possible violations 😱

There is a possible violation for removing region tag in use.

The end of the violation section. All the stuff below is FYI purposes only.


Here is the summary of changes.

You are about to add 1 region tag.
You are about to delete 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: compute Issues related to the Compute Engine API. api: secretmanager Issues related to the Secret Manager API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant