Skip to content

feat(parametermanager): Added samples for create, get, list and render regional parameter & parameter version #4069

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

durgesh-ninave-crest
Copy link

Description

Created samples for creating, listing and rendering parameter and parameter version in specific region

Samples List (regional):

  1. parameter-structured-data
  2. parameter-unstructured-data
  3. add-parameter-version (structured, unstructured)
  4. create-parameter-secret-reference
  5. list-all-parameters
  6. view-parameter-details
  7. list-all-parameters-versions
  8. view-parameter-version-details
  9. render-secret-parameter-version

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

@durgesh-ninave-crest durgesh-ninave-crest requested review from a team as code owners April 9, 2025 07:52
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Apr 9, 2025
Copy link

snippet-bot bot commented Apr 9, 2025

Here is the summary of changes.

You are about to add 10 region tags.

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

Copy link
Contributor

@gemini-code-assist gemini-code-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.

Hello @durgesh-ninave-crest, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request introduces new samples for the Parameter Manager service, specifically focusing on regional parameters and parameter versions. These samples demonstrate how to create, retrieve, list, and render regional parameters and their versions, including examples with structured and unstructured data, as well as referencing secrets. The changes include adding new JavaScript files for each sample and updating the package.json file with necessary dependencies and scripts. Tests have also been added to verify the functionality of the new samples.

Highlights

  • New Samples: The pull request adds nine new samples demonstrating various operations on regional parameters and parameter versions, such as creating, listing, and rendering.
  • Regional Focus: The samples are specifically designed to showcase the regional capabilities of the Parameter Manager service, using regional endpoints.
  • Secret References: One of the samples demonstrates how to create a parameter version that references secrets stored in Secret Manager.
  • Testing: The pull request includes new tests to ensure the functionality of the added samples.

Changelog

Click here to see the changelog
  • parametermanager/package.json
    • Added dependencies for @google-cloud/parametermanager and @google-cloud/secret-manager.
    • Added devDependencies for c8, chai, mocha, and uuid.
    • Configured test script to use c8 mocha.
  • parametermanager/regional_samples/createRegionalParam.js
    • Created a new sample for creating a regional parameter with unstructured data.
    • Demonstrates how to instantiate a ParameterManagerClient with a regional endpoint.
    • Implements the createRegionalParam function to create the parameter.
  • parametermanager/regional_samples/createRegionalParamVersion.js
    • Created a new sample for creating a regional parameter version with unstructured data.
    • Demonstrates how to create a parameter version with a payload.
    • Implements the createRegionalParamVersion function to create the parameter version.
  • parametermanager/regional_samples/createRegionalParamVersionWithSecret.js
    • Created a new sample for creating a regional parameter version with secret references.
    • Demonstrates how to create a parameter version that references secrets stored in Secret Manager.
    • Implements the createRegionalParamVersionWithSecret function to create the parameter version.
  • parametermanager/regional_samples/createStructuredRegionalParam.js
    • Created a new sample for creating a structured regional parameter.
    • Demonstrates how to create a parameter with a specified format type (JSON).
    • Implements the createStructuredRegionalParam function to create the parameter.
  • parametermanager/regional_samples/createStructuredRegionalParamVersion.js
    • Created a new sample for creating a structured regional parameter version.
    • Demonstrates how to create a parameter version with a JSON payload.
    • Implements the createStructuredRegionalParamVersion function to create the parameter version.
  • parametermanager/regional_samples/getRegionalParam.js
    • Created a new sample for retrieving a regional parameter.
    • Demonstrates how to retrieve a parameter using its name.
    • Implements the getRegionalParam function to retrieve the parameter.
  • parametermanager/regional_samples/getRegionalParamVersion.js
    • Created a new sample for retrieving a regional parameter version.
    • Demonstrates how to retrieve a parameter version using its name.
    • Implements the getRegionalParamVersion function to retrieve the parameter version.
  • parametermanager/regional_samples/listRegionalParamVersions.js
    • Created a new sample for listing regional parameter versions.
    • Demonstrates how to list all versions of a parameter.
    • Implements the listRegionalParamVersions function to list the parameter versions.
  • parametermanager/regional_samples/listRegionalParams.js
    • Created a new sample for listing regional parameters.
    • Demonstrates how to list all parameters in a region.
    • Implements the listRegionalParams function to list the parameters.
  • parametermanager/regional_samples/renderRegionalParamVersion.js
    • Created a new sample for rendering a regional parameter version.
    • Demonstrates how to render a parameter version, resolving any secret references.
    • Implements the renderRegionalParamVersion function to render the parameter version.
  • parametermanager/test/.eslintrc.yml
    • Added eslint configuration for mocha tests
  • parametermanager/test/parametermanager.test.js
    • Added tests for all the new samples, covering create, get, list, and render operations.
    • Tests include creating parameters and versions, including those with secret references.
    • Tests verify the output of the samples.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


In regions wide, parameters reside,
Their versions kept with utmost pride.
To list and get,
No cause to fret,
The Manager's samples are your guide.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-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.

Code Review

This pull request introduces samples for creating, listing, and rendering parameters and parameter versions in specific regions using the Google Cloud Parameter Manager SDK. The changes include new JavaScript files for each sample and updates to the package.json file to include necessary dependencies and scripts. Overall, the code appears well-structured and follows a consistent pattern. However, there are a few areas that could be improved for clarity and maintainability.

Summary of Findings

  • Copyright Year: The copyright year in all files is set to 2025. Please confirm that this is the correct year, or update it to the current year if the code was written in 2024.
  • TODO comments: The TODO comments for the developer to uncomment variables are useful, but consider providing a brief explanation of why these variables need to be uncommented and what values should be used in a real-world scenario.
  • Consistent use of template literals: In some files, template literals are used for string concatenation, while in others, regular string concatenation is used. For consistency, consider using template literals throughout the codebase.

Merge Readiness

The pull request is almost ready for merging. However, I recommend addressing the copyright year and TODO comments before merging. I am unable to directly approve the pull request, and users should have others review and approve this code before merging.

@@ -0,0 +1,67 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Please confirm that the copyright year is correct. If the code was written in 2024, update the year accordingly.

@@ -0,0 +1,85 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Please confirm that the copyright year is correct. If the code was written in 2024, update the year accordingly.

@@ -0,0 +1,93 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Please confirm that the copyright year is correct. If the code was written in 2024, update the year accordingly.

@@ -0,0 +1,77 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Please confirm that the copyright year is correct. If the code was written in 2024, update the year accordingly.

@@ -0,0 +1,85 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Please confirm that the copyright year is correct. If the code was written in 2024, update the year accordingly.

@@ -0,0 +1,72 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Please confirm that the copyright year is correct. If the code was written in 2024, update the year accordingly.

@@ -0,0 +1,66 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Please confirm that the copyright year is correct. If the code was written in 2024, update the year accordingly.

@@ -0,0 +1,89 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Please confirm that the copyright year is correct. If the code was written in 2024, update the year accordingly.

@@ -0,0 +1,17 @@
# Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Please confirm that the copyright year is correct. If the code was written in 2024, update the year accordingly.

@@ -0,0 +1,263 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Please confirm that the copyright year is correct. If the code was written in 2024, update the year accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant