Skip to content

Commit

Permalink
[Hyperdrive] Fixing create Wrangler command (#16919)
Browse files Browse the repository at this point in the history
* Fixing incorrect Hyperdrive command in Wrangler command list.

* Making Hyperdrive and KV commands a partical render.

* Update src/content/partials/workers/wrangler-commands/hyperdrive.mdx

Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and elithrar committed Oct 15, 2024
1 parent 3fb2fe9 commit bc331f4
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 107 deletions.
98 changes: 1 addition & 97 deletions src/content/docs/workers/wrangler/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -480,103 +480,7 @@ wrangler d1 migrations apply <DATABASE_NAME> [OPTIONS]

Manage [Hyperdrive](/hyperdrive/) database configurations.

### `create`

Create a new Hyperdrive configuration.

```txt
wrangler hyperdrive create <ID> [OPTIONS]
```

- `ID` string required
- The ID of the Hyperdrive configuration to create.
- `--connection-string` string optional
- The database connection string in the form `postgres://user:password@hostname:port/database`.
- `--host` string optional
- The hostname or IP address Hyperdrive should connect to.
- `--port` number optional
- The database port to connect to.
- `--scheme` string optional
- The scheme used to connect to the origin database - e.g. postgresql or postgres.
- `--database` string optional
- The database (name) to connect to. For example, Postgres or defaultdb.
- `--user` string optional
- The username used to authenticate to the database.
- `--password` string optional
- The password used to authenticate to the database.
- `--access-client-id` string optional
- The Client ID of the Access token to use when connecting to the origin database, must be set with a Client Access Secret. Mutually exclusive with `port`.
- `--access-client-secret` string optional
- The Client Secret of the Access token to use when connecting to the origin database, must be set with a Client Access ID. Mutually exclusive with `port`.
- `--caching-disabled` boolean optional
- Disables the caching of SQL responses.
- `--max-age` number optional
- Specifies max duration for which items should persist in the cache, cannot be set when caching is disabled.
- `--swr` number optional
- Stale While Revalidate - Indicates the number of seconds cache may serve the response after it becomes stale, cannot be set when caching is disabled.

### `update`

Update an existing Hyperdrive configuration.

```txt
wrangler hyperdrive update <ID> [OPTIONS]
```

- `ID` string required
- The ID of the Hyperdrive configuration to update.
- `--name` string optional
- The new name of the Hyperdrive configuration.
- `--origin-host` string optional
- The new database hostname or IP address Hyperdrive should connect to.
- `--origin-port` string optional
- The new database port to connect to.
- `--database` string optional
- The new database (name) to connect to. For example, Postgres or defaultdb.
- `--origin-user` string optional
- The new username used to authenticate to the database.
- `--origin-password` string optional
- The new password used to authenticate to the database.
- `--access-client-id` string optional
- The Client ID of the Access token to use when connecting to the origin database, must be set with a Client Access Secret. Mutually exclusive with `origin-port`.
- `--access-client-secret` string optional
- The Client Secret of the Access token to use when connecting to the origin database, must be set with a Client Access ID. Mutually exclusive with `origin-port`.
- `--caching-disabled` boolean optional
- Disables the caching of SQL responses.
- `--max-age` number optional
- Specifies max duration for which items should persist in the cache, cannot be set when caching is disabled.
- `--swr` number optional
- Stale While Revalidate - Indicates the number of seconds cache may serve the response after it becomes stale, cannot be set when caching is disabled.

### `list`

List all Hyperdrive configurations.

```txt
wrangler hyperdrive list
```

### `delete`

Delete an existing Hyperdrive configuration.

```txt
wrangler hyperdrive delete <ID>
```

- `ID` string required
- The name of the Hyperdrive configuration to delete.

### `get`

Get an existing Hyperdrive configuration.

```txt
wrangler hyperdrive get <ID>
```

- `ID` string required
- The name of the Hyperdrive configuration to get.
<Render file="wrangler-commands/hyperdrive" product="workers" />

---

Expand Down
103 changes: 103 additions & 0 deletions src/content/partials/workers/wrangler-commands/hyperdrive.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
{}
---

import { AnchorHeading } from "~/components";

<AnchorHeading title="`create`" slug="hyperdrive-create" depth={3} />

Create a new Hyperdrive configuration.

```txt
wrangler hyperdrive create <CONFIG_NAME> [OPTIONS]
```

- `CONFIG_NAME` string required
- The name of the Hyperdrive configuration to create.
- `--connection-string` string optional
- The database connection string in the form `postgres://user:password@hostname:port/database`.
- `--host` string optional
- The hostname or IP address Hyperdrive should connect to.
- `--port` number optional
- The database port to connect to.
- `--scheme` string optional
- The scheme used to connect to the origin database, for example, postgresql or postgres.
- `--database` string optional
- The database (name) to connect to. For example, Postgres or defaultdb.
- `--user` string optional
- The username used to authenticate to the database.
- `--password` string optional
- The password used to authenticate to the database.
- `--access-client-id` string optional
- The Client ID of the Access token to use when connecting to the origin database, must be set with a Client Access Secret. Mutually exclusive with `port`.
- `--access-client-secret` string optional
- The Client Secret of the Access token to use when connecting to the origin database, must be set with a Client Access ID. Mutually exclusive with `port`.
- `--caching-disabled` boolean optional
- Disables the caching of SQL responses.
- `--max-age` number optional
- Specifies max duration for which items should persist in the cache, cannot be set when caching is disabled.
- `--swr` number optional
- Stale While Revalidate - Indicates the number of seconds cache may serve the response after it becomes stale, cannot be set when caching is disabled.

<AnchorHeading title="`update`" slug="hyperdrive-update" depth={3} />

Update an existing Hyperdrive configuration.

```txt
wrangler hyperdrive update <ID> [OPTIONS]
```

- `ID` string required
- The ID of the Hyperdrive configuration to update.
- `--name` string optional
- The new name of the Hyperdrive configuration.
- `--origin-host` string optional
- The new database hostname or IP address Hyperdrive should connect to.
- `--origin-port` string optional
- The new database port to connect to.
- `--database` string optional
- The new database (name) to connect to. For example, Postgres or defaultdb.
- `--origin-user` string optional
- The new username used to authenticate to the database.
- `--origin-password` string optional
- The new password used to authenticate to the database.
- `--access-client-id` string optional
- The Client ID of the Access token to use when connecting to the origin database, must be set with a Client Access Secret. Mutually exclusive with `origin-port`.
- `--access-client-secret` string optional
- The Client Secret of the Access token to use when connecting to the origin database, must be set with a Client Access ID. Mutually exclusive with `origin-port`.
- `--caching-disabled` boolean optional
- Disables the caching of SQL responses.
- `--max-age` number optional
- Specifies max duration for which items should persist in the cache, cannot be set when caching is disabled.
- `--swr` number optional
- Stale While Revalidate - Indicates the number of seconds cache may serve the response after it becomes stale, cannot be set when caching is disabled.

<AnchorHeading title="`list`" slug="hyperdrive-list" depth={3} />

List all Hyperdrive configurations.

```txt
wrangler hyperdrive list
```

<AnchorHeading title="`delete`" slug="hyperdrive-delete" depth={3} />

Delete an existing Hyperdrive configuration.

```txt
wrangler hyperdrive delete <ID>
```

- `ID` string required
- The name of the Hyperdrive configuration to delete.

<AnchorHeading title="`get`" slug="hyperdrive-get" depth={3} />

Get an existing Hyperdrive configuration.

```txt
wrangler hyperdrive get <ID>
```

- `ID` string required
- The name of the Hyperdrive configuration to get.
21 changes: 11 additions & 10 deletions src/content/partials/workers/wrangler-commands/kv.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
{}

---

import { AnchorHeading } from "~/components";

## `kv namespace`

Manage Workers KV namespaces.
Expand All @@ -17,7 +18,7 @@ The `kv ...` commands allow you to manage your Workers KV resources in the Cloud
Since version 3.60.0, Wrangler supports the `kv ...` syntax. If you are using versions below 3.60.0, the command follows the `kv:...` syntax. Learn more about the deprecation of the `kv:...` syntax in the [Wrangler commands](/kv/reference/kv-commands/#deprecations) for KV page.
:::

### `create`
<AnchorHeading title="`create`" slug="kv-namespace-create" depth={3} />

Create a new namespace.

Expand Down Expand Up @@ -62,7 +63,7 @@ kv_namespaces = [
]
```
### `list`
<AnchorHeading title="`list`" slug="kv-namespace-list" depth={3} />
List all KV namespaces associated with the current account ID.
Expand All @@ -89,7 +90,7 @@ npx wrangler kv namespace list | jq "."
]
```
### `delete`
<AnchorHeading title="`delete`" slug="kv-namespace-delete" depth={3} />
Delete a given namespace.
Expand Down Expand Up @@ -151,7 +152,7 @@ The `kv ...` commands allow you to manage your Workers KV resources in the Cloud
Since version 3.60.0, Wrangler supports the `kv ...` syntax. If you are using versions below 3.60.0, the command follows the `kv:...` syntax. Learn more about the deprecation of the `kv:...` syntax in the [Wrangler commands](/kv/reference/kv-commands/) for KV page.
:::
### `put`
<AnchorHeading title="`put`" slug="kv-key-put" depth={3} />
Write a single key-value pair to a particular namespace.
Expand Down Expand Up @@ -230,7 +231,7 @@ npx wrangler kv key put --binding=MY_KV "my-key" --path=value.txt
Writing the contents of value.txt to the key "my-key" on namespace f7b02e7fc70443149ac906dd81ec1791.
```
### `list`
<AnchorHeading title="`list`" slug="kv-key-list" depth={3} />
Output a list of all keys in a given namespace.
Expand Down Expand Up @@ -276,7 +277,7 @@ npx wrangler kv key list --binding=MY_KV --prefix="public" | jq "."
]
```
### `get`
<AnchorHeading title="`get`" slug="kv-key-get" depth={3} />
Read a single value by key from the given namespace.
Expand Down Expand Up @@ -316,7 +317,7 @@ npx wrangler kv key get --binding=MY_KV "my-key"
value
```
### `delete`
<AnchorHeading title="`delete`" slug="kv-key-delete" depth={3} />
Remove a single key value pair from the given namespace.
Expand Down Expand Up @@ -368,7 +369,7 @@ The `kv ...` commands allow you to manage your Workers KV resources in the Cloud
Since version 3.60.0, Wrangler supports the `kv ...` syntax. If you are using versions below 3.60.0, the command follows the `kv:...` syntax. Learn more about the deprecation of the `kv:...` syntax in the [Wrangler commands](/kv/reference/kv-commands/) for KV page.
:::
### `put`
<AnchorHeading title="`put`" slug="kv-bulk-put" depth={3} />
Write a JSON file containing an array of key-value pairs to the given namespace.
Expand Down Expand Up @@ -450,7 +451,7 @@ npx wrangler kv bulk put --binding=MY_KV allthethingsupload.json
Success!
```
### `delete`
<AnchorHeading title="`delete`" slug="kv-bulk-delete" depth={3} />
Delete all keys read from a JSON file within a given namespace.
Expand Down

0 comments on commit bc331f4

Please sign in to comment.