cloud-sql-postgres-admin

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

脚本

clone_instance

clone_instance

Clone an existing Cloud SQL instance into a new instance. The clone can be a direct copy of the source instance, or a point-in-time-recovery (PITR) clone from a specific timestamp. The call returns a Cloud SQL Operation object. Call wait_for_operation tool after this, make sure to use multiplier as 4 to poll the opertation status till it is marked DONE.
将现有Cloud SQL实例克隆到新实例中。克隆可以是源实例的直接副本,也可以是从特定时间点进行的时间点恢复(PITR)克隆。调用将返回一个Cloud SQL Operation对象。在此之后调用wait_for_operation工具,请确保使用乘数4来轮询操作状态,直到其标记为DONE。

Parameters

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
sourceInstanceNamestringThe name of the instance to be cloned.Yes
destinationInstanceNamestringThe name of the new instance that will be created by cloning the source instance.Yes
pointInTimestringThe timestamp in RFC 3339 format to which the source instance should be cloned.No
preferredZonestringThe preferred zone for the new instance.No
preferredSecondaryZonestringThe preferred secondary zone for the new instance.No

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则不要询问。
sourceInstanceNamestring要克隆的实例名称。
destinationInstanceNamestring通过克隆源实例创建的新实例名称。
pointInTimestring要克隆到的源实例时间戳,格式为RFC 3339。
preferredZonestring新实例的首选可用区。
preferredSecondaryZonestring新实例的首选辅助可用区。

create_database

create_database

Parameters

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
instancestringThe ID of the instance where the database will be created.Yes
namestringThe name for the new database. Must be unique within the instance.Yes

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则不要询问。
instancestring要创建数据库的实例ID。
namestring新数据库的名称。必须在实例内唯一。

create_instance

create_instance

Parameters

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
namestringThe name of the instanceYes
databaseVersionstringThe database version for Postgres. If not specified, defaults to the latest available version (e.g., POSTGRES_17).No
POSTGRES_17
rootPasswordstringThe root password for the instanceYes
editionPresetstringThe edition of the instance. Can be
Production
or
Development
. This determines the default machine type and availability. Defaults to
Development
.
No
Development

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则不要询问。
namestring实例名称
databaseVersionstringPostgres的数据库版本。如果未指定,默认使用最新可用版本(例如POSTGRES_17)。
POSTGRES_17
rootPasswordstring实例的root密码
editionPresetstring实例版本。可以是
Production
Development
。这将决定默认的机器类型和可用性。默认值为
Development
Development

create_user

create_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
instancestringThe ID of the instance where the user will be created.Yes
namestringThe name for the new user. Must be unique within the instance.Yes
passwordstringA secure password for the new user. Not required for IAM users.No
iamUserbooleanSet to true to create a Cloud IAM user.Yes

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则不要询问。
instancestring要创建用户的实例ID。
namestring新用户的名称。必须在实例内唯一。
passwordstring新用户的安全密码。IAM用户不需要此参数。
iamUserboolean设置为true以创建Cloud IAM用户。

get_instance

get_instance

Parameters

参数

NameTypeDescriptionRequiredDefault
projectIdstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
instanceIdstringThe instance IDYes

名称类型描述必填默认值
projectIdstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则不要询问。
instanceIdstring实例ID

list_databases

list_databases

Lists all databases for a Cloud SQL instance.
列出Cloud SQL实例的所有数据库。

Parameters

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
instancestringThe instance IDYes

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则不要询问。
instancestring实例ID

list_instances

list_instances

Lists all type of Cloud SQL instances for a project.
列出项目中所有类型的Cloud SQL实例。

Parameters

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则不要询问。

wait_for_operation

wait_for_operation

Parameters

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
operationstringThe operation IDYes

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则不要询问。
operationstring操作ID