-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Create documentation for Google Cloud Parameter Manager #1835
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
|
|
||
| # Catalog Frontmatter | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
|
|
||
| |element|content| | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This front matter content is in the wrong format. see correct format example here: |
||
| |-----|-----| | ||
| | catalog_title| Google Cloud Parameter Manager| | ||
| | catalog_description | A client for interacting with Google Cloud Parameter Manager | | ||
| --- | ||
|
|
||
| # Google Cloud Secrets Manager | ||
| ## Google Cloud Parameter Manager | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not not stack headings: heading should always have paragraphs after them. |
||
| The Parameter Manager integration is an extension of the Secret Manager class, offering a lightweight client designed to fetch processed parameter data from Google Cloud. This tool is ideal for agents that require configuration settings to be handled independently of the agent’s internal process. If you want to know more about all options, features or capabilities that this integration facilitates, click here. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This tool is ideal for agents --> This tool is useful for agents avoid superlative language in developer documentation ... click here. Revise this sentence. do not use language like "click here" in documentation or as the text of links |
||
| The following code snippets represent the usage of different credential types as shown below. | ||
|
|
||
| # Integration Name | ||
|
|
||
| **ParameterManagerClient** | ||
|
|
||
| This integration provides a small client for fetching Google Cloud parameter values, which is perfect for agents that need to store their configuration settings externally. | ||
|
|
||
| # Use cases | ||
|
|
||
| ## With different authentication credentials | ||
|
|
||
| ### Using default credentials | ||
| ```client = ParameterManagerClient()``` | ||
|
|
||
| ### Or with a service account json string | ||
| ```client = ParameterManagerClient(service_account_json="...")``` | ||
|
|
||
| ### Or with an auth token | ||
| ```client = ParameterManagerClient(auth_token="...")``` | ||
|
|
||
| ### To use a regional Parameter Manager endpoint, pass location: | ||
|
|
||
| ```client = ParameterManagerClient(location="us-central1")``` | ||
|
Comment on lines
+23
to
+36
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use headings to list examples or items. use a list format |
||
|
|
||
| # Prerequisites | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. include an introductory sentence, at the minimum |
||
| ### Only the class ParameterManagerClient | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use headings to list items. use a list format |
||
| ``` from google.adk.integrations.parameter_manager.parameter_client import ParameterManagerClient``` | ||
|
|
||
| # Explaining how to retrieve a parameter | ||
| ```value =client.get_parameter("projects/my-project/locations/global/parameters/my-param/versions/latest")``` | ||
| ## Resources | ||
|
|
||
| - [Deploy Preview](https://deploy-preview-1729--adk-docs-preview.netlify.app/integrations/parameter-manager/#initialize-the-client) | ||
| - [GitHub Repository](src/google/adk/integrations/parameter_manager/parameter_client.py) | ||
| - [Google Cloud](https://docs.cloud.google.com/secret-manager/parameter-manager/docs/overview) | ||
| - [Google AI Studio](https://aistudio-preprod.corp.google.com/prompts/1C4ldgvJkKT6qHtFUeiZKcTiDGOmlP1ze?resourceKey=0-IldDiiPSogAPqBzVfz5jSw) | ||
|
|
||
| ## Complete usage of ParameterManagerClient | ||
| Here is a complete example of how to initialize the client and use it to fetch a parameter within an ADK application. | ||
|
|
||
| ==python== | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
|
|
||
| ```python | ||
| import os | ||
| from google.adk.integrations.parameter_manager.parameter_client import ParameterManagerClient | ||
|
|
||
| def fetch_external_api_key(): | ||
| -- 1. Initialize the Client | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not the correct format for Python comment. As written this code will not compile. update all the comments in this code. |
||
| client = ParameterManagerClient() | ||
|
|
||
| -- 2. Define the resource name | ||
| # Format: projects/{project_id}/locations/{location}/parameters/{parameter_id} | ||
| project_id = "your-gcp-project" | ||
| param_name = f"projects/{project_id}/locations/global/parameters/my-api-key" | ||
|
|
||
| try: | ||
| -- 3. Fetch the parameter payload | ||
| -- This automatically resolves linked secrets if configured | ||
| parameter_payload = client.get_parameter(param_name) | ||
|
|
||
| print(f"Successfully fetched parameter: {parameter_payload}") | ||
| return parameter_payload | ||
|
|
||
| except Exception as e: | ||
| print(f"Error retrieving parameter: {e}") | ||
| return None | ||
|
|
||
| -- Example usage in an agent tool | ||
| result = fetch_external_api_key() | ||
| ``` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have not followed the contribution guide for headings and content. Review the guide and update: |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do NOT use spaces in file names. Use
git mvand rename this file to:parameter-manager.md