|
| 1 | +--- |
| 2 | +name: cloud-sql-postgres-admin |
| 3 | +description: Use these tools when you need to provision new Cloud SQL instances, create databases and users, clone existing environments, and monitor the progress of long-running operations. |
| 4 | +--- |
| 5 | + |
| 6 | +## Usage |
| 7 | + |
| 8 | +All scripts can be executed using Node.js. Replace `<param_name>` and `<param_value>` with actual values. |
| 9 | + |
| 10 | +**Bash:** |
| 11 | +`node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'` |
| 12 | + |
| 13 | +**PowerShell:** |
| 14 | +`node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'` |
| 15 | + |
| 16 | +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. |
| 17 | + |
| 18 | +## Scripts |
| 19 | + |
| 20 | +### clone_instance |
| 21 | + |
| 22 | +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. |
| 23 | + |
| 24 | +#### Parameters |
| 25 | + |
| 26 | +| Name | Type | Description | Required | Default | |
| 27 | +| :---------------------- | :----- | :----------------------------------------------------------------------------------------------------------------- | :------- | :------ | |
| 28 | +| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | |
| 29 | +| sourceInstanceName | string | The name of the instance to be cloned. | Yes | | |
| 30 | +| destinationInstanceName | string | The name of the new instance that will be created by cloning the source instance. | Yes | | |
| 31 | +| pointInTime | string | The timestamp in RFC 3339 format to which the source instance should be cloned. | No | | |
| 32 | +| preferredZone | string | The preferred zone for the new instance. | No | | |
| 33 | +| preferredSecondaryZone | string | The preferred secondary zone for the new instance. | No | | |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +### create_database |
| 38 | + |
| 39 | +#### Parameters |
| 40 | + |
| 41 | +| Name | Type | Description | Required | Default | |
| 42 | +| :------- | :----- | :----------------------------------------------------------------------------------------------------------------- | :------- | :------ | |
| 43 | +| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | |
| 44 | +| instance | string | The ID of the instance where the database will be created. | Yes | | |
| 45 | +| name | string | The name for the new database. Must be unique within the instance. | Yes | | |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +### create_instance |
| 50 | + |
| 51 | +#### Parameters |
| 52 | + |
| 53 | +| Name | Type | Description | Required | Default | |
| 54 | +| :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------------ | |
| 55 | +| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | |
| 56 | +| name | string | The name of the instance | Yes | | |
| 57 | +| databaseVersion | string | The database version for Postgres. If not specified, defaults to the latest available version (e.g., POSTGRES_17). | No | `POSTGRES_17` | |
| 58 | +| rootPassword | string | The root password for the instance | Yes | | |
| 59 | +| editionPreset | string | The edition of the instance. Can be `Production` or `Development`. This determines the default machine type and availability. Defaults to `Development`. | No | `Development` | |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +### create_user |
| 64 | + |
| 65 | +#### Parameters |
| 66 | + |
| 67 | +| Name | Type | Description | Required | Default | |
| 68 | +| :------- | :------ | :----------------------------------------------------------------------------------------------------------------- | :------- | :------ | |
| 69 | +| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | |
| 70 | +| instance | string | The ID of the instance where the user will be created. | Yes | | |
| 71 | +| name | string | The name for the new user. Must be unique within the instance. | Yes | | |
| 72 | +| password | string | A secure password for the new user. Not required for IAM users. | No | | |
| 73 | +| iamUser | boolean | Set to true to create a Cloud IAM user. | Yes | | |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +### get_instance |
| 78 | + |
| 79 | +#### Parameters |
| 80 | + |
| 81 | +| Name | Type | Description | Required | Default | |
| 82 | +| :--------- | :----- | :----------------------------------------------------------------------------------------------------------------- | :------- | :------ | |
| 83 | +| projectId | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | |
| 84 | +| instanceId | string | The instance ID | Yes | | |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +### list_databases |
| 89 | + |
| 90 | +Lists all databases for a Cloud SQL instance. |
| 91 | + |
| 92 | +#### Parameters |
| 93 | + |
| 94 | +| Name | Type | Description | Required | Default | |
| 95 | +| :------- | :----- | :----------------------------------------------------------------------------------------------------------------- | :------- | :------ | |
| 96 | +| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | |
| 97 | +| instance | string | The instance ID | Yes | | |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +### list_instances |
| 102 | + |
| 103 | +Lists all type of Cloud SQL instances for a project. |
| 104 | + |
| 105 | +#### Parameters |
| 106 | + |
| 107 | +| Name | Type | Description | Required | Default | |
| 108 | +| :------ | :----- | :----------------------------------------------------------------------------------------------------------------- | :------- | :------ | |
| 109 | +| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +### wait_for_operation |
| 114 | + |
| 115 | +#### Parameters |
| 116 | + |
| 117 | +| Name | Type | Description | Required | Default | |
| 118 | +| :-------- | :----- | :----------------------------------------------------------------------------------------------------------------- | :------- | :------ | |
| 119 | +| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | |
| 120 | +| operation | string | The operation ID | Yes | | |
| 121 | + |
| 122 | +--- |
0 commit comments