alloydb-postgres-access-management
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUsage
使用说明
All scripts can be executed using Node.js. Replace and with actual values.
<param_name><param_value>Bash:
node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'PowerShell:
node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence.
所有脚本均可通过Node.js执行。将和替换为实际值。
<param_name><param_value>Bash:
node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'PowerShell:
node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'注意:脚本会自动从各种.env文件加载环境变量。除非因缺少环境变量导致技能执行失败,否则不要要求用户设置变量。
Scripts
脚本
create_user
创建用户
Creates a new AlloyDB user within a cluster. Takes the new user's name and a secure password. Optionally, a list of database roles can be assigned. Always ask the user for the type of user to create. ALLOYDB_IAM_USER is recommended.
在集群中创建一个新的AlloyDB用户。需要提供新用户的名称和安全密码。还可以选择性地分配一组数据库角色。务必询问用户要创建的用户类型。推荐使用ALLOYDB_IAM_USER。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | |
| location | string | The location of the cluster (e.g., 'us-central1'). | Yes | |
| cluster | string | The ID of the cluster where the user will be created. | Yes | |
| user | string | The name for the new user. Must be unique within the cluster. | Yes | |
| password | string | A secure password for the new user. Required only for ALLOYDB_BUILT_IN userType. | No | |
| databaseRoles | array | Optional. A list of database roles to grant to the new user (e.g., ['pg_read_all_data']). | No | |
| userType | string | The type of user to create. Valid values are: ALLOYDB_BUILT_IN and ALLOYDB_IAM_USER. ALLOYDB_IAM_USER is recommended. | Yes |
| 名称 | 类型 | 描述 | 必填 | 默认值 |
|---|---|---|---|---|
| project | string | GCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则无需询问。 | 否 | |
| location | string | 集群所在位置(例如:'us-central1')。 | 是 | |
| cluster | string | 要创建用户的集群ID。 | 是 | |
| user | string | 新用户的名称。必须在集群内唯一。 | 是 | |
| password | string | 新用户的安全密码。仅当userType为ALLOYDB_BUILT_IN时必填。 | 否 | |
| databaseRoles | array | 可选。要授予新用户的数据库角色列表(例如:['pg_read_all_data'])。 | 否 | |
| userType | string | 要创建的用户类型。有效值为:ALLOYDB_BUILT_IN和ALLOYDB_IAM_USER。推荐使用ALLOYDB_IAM_USER。 | 是 |
database_overview
数据库概览
Fetches the current state of the PostgreSQL server, returning the version, whether it's a replica, uptime duration, maximum connection limit, number of current connections, number of active connections, and the percentage of connections in use.
获取PostgreSQL服务器的当前状态,返回版本信息、是否为副本、运行时长、最大连接限制、当前连接数、活跃连接数以及连接使用率百分比。
get_user
获取用户信息
Retrieves details about a specific AlloyDB user.
检索特定AlloyDB用户的详细信息。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | |
| location | string | The location of the cluster (e.g., 'us-central1'). | Yes | |
| cluster | string | The ID of the cluster. | Yes | |
| user | string | The ID of the user. | Yes |
| 名称 | 类型 | 描述 | 必填 | 默认值 |
|---|---|---|---|---|
| project | string | GCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则无需询问。 | 否 | |
| location | string | 集群所在位置(例如:'us-central1')。 | 是 | |
| cluster | string | 集群ID。 | 是 | |
| user | string | 用户ID。 | 是 |
list_pg_settings
列出PostgreSQL配置
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| setting_name | string | Optional: A specific configuration parameter name pattern to search for. | No | `` |
| limit | integer | Optional: The maximum number of rows to return. | No | |
| 名称 | 类型 | 描述 | 必填 | 默认值 |
|---|---|---|---|---|
| setting_name | string | 可选:要搜索的特定配置参数名称模式。 | 否 | `` |
| limit | integer | 可选:要返回的最大行数。 | 否 | |
list_roles
列出角色
Lists all the user-created roles in the instance . It returns the role name, Object ID, the maximum number of concurrent connections the role can make, along with boolean indicators for: superuser status, privilege inheritance from member roles, ability to create roles, ability to create databases, ability to log in, replication privilege, and the ability to bypass row-level security, the password expiration timestamp, a list of direct members belonging to this role, and a list of other roles/groups that this role is a member of.
列出实例中所有用户创建的角色。返回角色名称、对象ID、角色允许的最大并发连接数,以及以下布尔值指标:超级用户状态、是否继承成员角色的权限、是否能创建角色、是否能创建数据库、是否能登录、复制权限、是否能绕过行级安全、密码过期时间戳、属于该角色的直接成员列表,以及该角色所属的其他角色/组列表。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| role_name | string | Optional: a text to filter results by role name. The input is used within a LIKE clause. | No | `` |
| limit | integer | Optional: The maximum number of rows to return. Default is 10 | No | |
| 名称 | 类型 | 描述 | 必填 | 默认值 |
|---|---|---|---|---|
| role_name | string | 可选:用于按角色名称过滤结果的文本。输入将用于LIKE子句中。 | 否 | `` |
| limit | integer | 可选:要返回的最大行数。默认值为10 | 否 | |
list_users
列出用户
Lists all AlloyDB users in a given project, location and cluster.
列出指定项目、位置和集群中的所有AlloyDB用户。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | |
| location | string | The location of the cluster (e.g., 'us-central1'). | Yes | |
| cluster | string | The ID of the cluster to list users from. | Yes |
| 名称 | 类型 | 描述 | 必填 | 默认值 |
|---|---|---|---|---|
| project | string | GCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则无需询问。 | 否 | |
| location | string | 集群所在位置(例如:'us-central1')。 | 是 | |
| cluster | string | 要列出用户的集群ID。 | 是 |