Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 63 additions & 42 deletions skills/cloud-sql-postgres-admin/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,73 +15,88 @@ All scripts can be executed using Node.js. Replace `<param_name>` and `<param_va

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.


## Scripts


### 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.

#### 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 | |
| sourceInstanceName | string | The name of the instance to be cloned. | Yes | |
| destinationInstanceName | string | The name of the new instance that will be created by cloning the source instance. | Yes | |
| pointInTime | string | The timestamp in RFC 3339 format to which the source instance should be cloned. | No | |
| preferredZone | string | The preferred zone for the new instance. | No | |
| preferredSecondaryZone | string | The preferred secondary zone for the new instance. | No | |
| 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 | |
| sourceInstanceName | string | The name of the instance to be cloned. | Yes | |
| destinationInstanceName | string | The name of the new instance that will be created by cloning the source instance. | Yes | |
| pointInTime | string | The timestamp in RFC 3339 format to which the source instance should be cloned. | No | |
| preferredZone | string | The preferred zone for the new instance. | No | |
| preferredSecondaryZone | string | The preferred secondary zone for the new instance. | No | |


---

### create_database



#### 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 | |
| instance | string | The ID of the instance where the database will be created. | Yes | |
| name | string | The name for the new database. Must be unique within the instance. | Yes | |
| 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 | |
| instance | string | The ID of the instance where the database will be created. | Yes | |
| name | string | The name for the new database. Must be unique within the instance. | Yes | |


---

### create_instance



#### 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 | |
| name | string | The name of the instance | Yes | |
| databaseVersion | string | The database version for Postgres. If not specified, defaults to the latest available version (e.g., POSTGRES_17). | No | `POSTGRES_17` |
| rootPassword | string | The root password for the instance | Yes | |
| 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` |
| 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 | |
| name | string | The name of the instance | Yes | |
| databaseVersion | string | The database version for Postgres. If not specified, defaults to the latest available version (e.g., POSTGRES_17). | No | `POSTGRES_17` |
| rootPassword | string | The root password for the instance | Yes | |
| 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` |


---

### create_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 | |
| instance | string | The ID of the instance where the user will be created. | Yes | |
| name | string | The name for the new user. Must be unique within the instance. | Yes | |
| password | string | A secure password for the new user. Not required for IAM users. | No | |
| iamUser | boolean | Set to true to create a Cloud IAM user. | Yes | |
| 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 | |
| instance | string | The ID of the instance where the user will be created. | Yes | |
| name | string | The name for the new user. Must be unique within the instance. | Yes | |
| password | string | A secure password for the new user. Not required for IAM users. | No | |
| iamUser | boolean | Set to true to create a Cloud IAM user. | Yes | |


---

### get_instance



#### Parameters

| Name | Type | Description | Required | Default |
| :--------- | :----- | :----------------------------------------------------------------------------------------------------------------- | :------- | :------ |
| projectId | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | |
| instanceId | string | The instance ID | Yes | |
| Name | Type | Description | Required | Default |
| :--- | :--- | :--- | :--- | :--- |
| projectId | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | |
| instanceId | string | The instance ID | Yes | |


---

Expand All @@ -91,10 +106,11 @@ Lists all databases for a Cloud SQL instance.

#### 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 | |
| instance | string | The instance ID | Yes | |
| 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 | |
| instance | string | The instance ID | Yes | |


---

Expand All @@ -104,19 +120,24 @@ Lists all type of Cloud SQL instances for a project.

#### 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 | |
| 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 | |


---

### wait_for_operation



#### 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 | |
| operation | string | The operation ID | Yes | |
| 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 | |
| operation | string | The operation ID | Yes | |


---

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function main() {

const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx';
const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args;
const npxArgs = ["--yes", "@toolbox-sdk/server@1.0.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];
const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];

const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function main() {

const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx';
const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args;
const npxArgs = ["--yes", "@toolbox-sdk/server@1.0.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];
const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];

const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function main() {

const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx';
const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args;
const npxArgs = ["--yes", "@toolbox-sdk/server@1.0.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];
const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];

const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env });

Expand Down
2 changes: 1 addition & 1 deletion skills/cloud-sql-postgres-admin/scripts/create_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function main() {

const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx';
const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args;
const npxArgs = ["--yes", "@toolbox-sdk/server@1.0.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];
const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];

const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env });

Expand Down
2 changes: 1 addition & 1 deletion skills/cloud-sql-postgres-admin/scripts/get_instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function main() {

const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx';
const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args;
const npxArgs = ["--yes", "@toolbox-sdk/server@1.0.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];
const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];

const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function main() {

const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx';
const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args;
const npxArgs = ["--yes", "@toolbox-sdk/server@1.0.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];
const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];

const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function main() {

const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx';
const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args;
const npxArgs = ["--yes", "@toolbox-sdk/server@1.0.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];
const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];

const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function main() {

const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx';
const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args;
const npxArgs = ["--yes", "@toolbox-sdk/server@1.0.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];
const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];

const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env });

Expand Down
Loading
Loading