alloydb-postgres-access-management

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Usage

使用说明

All scripts can be executed using Node.js. Replace
<param_name>
and
<param_value>
with actual values.
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

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
locationstringThe location of the cluster (e.g., 'us-central1').Yes
clusterstringThe ID of the cluster where the user will be created.Yes
userstringThe name for the new user. Must be unique within the cluster.Yes
passwordstringA secure password for the new user. Required only for ALLOYDB_BUILT_IN userType.No
databaseRolesarrayOptional. A list of database roles to grant to the new user (e.g., ['pg_read_all_data']).No
[]
userTypestringThe type of user to create. Valid values are: ALLOYDB_BUILT_IN and ALLOYDB_IAM_USER. ALLOYDB_IAM_USER is recommended.Yes

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则无需询问。
locationstring集群所在位置(例如:'us-central1')。
clusterstring要创建用户的集群ID。
userstring新用户的名称。必须在集群内唯一。
passwordstring新用户的安全密码。仅当userType为ALLOYDB_BUILT_IN时必填。
databaseRolesarray可选。要授予新用户的数据库角色列表(例如:['pg_read_all_data'])。
[]
userTypestring要创建的用户类型。有效值为: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

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
locationstringThe location of the cluster (e.g., 'us-central1').Yes
clusterstringThe ID of the cluster.Yes
userstringThe ID of the user.Yes

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则无需询问。
locationstring集群所在位置(例如:'us-central1')。
clusterstring集群ID。
userstring用户ID。

list_pg_settings

列出PostgreSQL配置

Parameters

参数

NameTypeDescriptionRequiredDefault
setting_namestringOptional: A specific configuration parameter name pattern to search for.No``
limitintegerOptional: The maximum number of rows to return.No
50

名称类型描述必填默认值
setting_namestring可选:要搜索的特定配置参数名称模式。``
limitinteger可选:要返回的最大行数。
50

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

参数

NameTypeDescriptionRequiredDefault
role_namestringOptional: a text to filter results by role name. The input is used within a LIKE clause.No``
limitintegerOptional: The maximum number of rows to return. Default is 10No
50

名称类型描述必填默认值
role_namestring可选:用于按角色名称过滤结果的文本。输入将用于LIKE子句中。``
limitinteger可选:要返回的最大行数。默认值为10
50

list_users

列出用户

Lists all AlloyDB users in a given project, location and cluster.
列出指定项目、位置和集群中的所有AlloyDB用户。

Parameters

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
locationstringThe location of the cluster (e.g., 'us-central1').Yes
clusterstringThe ID of the cluster to list users from.Yes

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则无需询问。
locationstring集群所在位置(例如:'us-central1')。
clusterstring要列出用户的集群ID。