Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat scopes and collections docs #474

Merged
merged 1 commit into from
Sep 17, 2024
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
146 changes: 2 additions & 144 deletions docs/commands.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,151 +5,9 @@ them with built-in other shell commands as well as executables from your environ

include::commands/buckets.adoc[]

=== Working with `scopes` and `collections`
include::commands/scopes.adoc[]

The `scopes` and `collections` commands can be used for managing scopes and collection respectively.

==== Scopes

```
> scopes -h
Fetches scopes through the HTTP API

Usage:
> scopes {flags}

Subcommands:
scopes create - Creates scopes through the HTTP API
scopes drop - Deletes scopes through the HTTP API

Flags:
-h, --help - Display the help message for this command
--bucket <String> - the name of the bucket
--clusters <String> - the clusters to query against
```

To list all scopes in the bucket you would use:

```
> scopes
╭───┬─────────────────┬───────────╮
│ # │ scope │ cluster │
├───┼─────────────────┼───────────┤
│ 0 │ inventory │ dev.local │
│ 1 │ tenant_agent_00 │ dev.local │
│ 2 │ tenant_agent_01 │ dev.local │
│ 3 │ tenant_agent_02 │ dev.local │
│ 4 │ tenant_agent_03 │ dev.local │
│ 5 │ tenant_agent_04 │ dev.local │
│ 6 │ _default │ dev.local │
╰───┴─────────────────┴───────────╯
```

You can also create and remove scopes:

```
> scopes create tenant_agent_05
> scopes
╭───┬─────────────────┬───────────╮
│ # │ scope │ cluster │
├───┼─────────────────┼───────────┤
│ 0 │ tenant_agent_05 │ dev.local │
│ 1 │ inventory │ dev.local │
│ 2 │ tenant_agent_00 │ dev.local │
│ 3 │ tenant_agent_01 │ dev.local │
│ 4 │ tenant_agent_02 │ dev.local │
│ 5 │ tenant_agent_03 │ dev.local │
│ 6 │ tenant_agent_04 │ dev.local │
│ 7 │ _default │ dev.local │
╰───┴─────────────────┴───────────╯
```

```
> scopes drop tenant_agent_05
> scopes
╭───┬─────────────────┬───────────╮
│ # │ scope │ cluster │
├───┼─────────────────┼───────────┤
│ 0 │ inventory │ dev.local │
│ 1 │ tenant_agent_00 │ dev.local │
│ 2 │ tenant_agent_01 │ dev.local │
│ 3 │ tenant_agent_02 │ dev.local │
│ 4 │ tenant_agent_03 │ dev.local │
│ 5 │ tenant_agent_04 │ dev.local │
│ 6 │ _default │ dev.local │
╰───┴─────────────────┴───────────╯
```

==== Collections

```
> collections -h
Fetches collections through the HTTP API

Usage:
> collections {flags}

Subcommands:
collections create - Creates collections through the HTTP API
collections drop - Deletes collections through the HTTP API

Flags:
-h, --help - Display the help message for this command
--bucket <String> - the name of the bucket
--scope <String> - the name of the scope
--clusters <String> - the clusters to query against
```

To list all collection in the bucket you would use:

```
> collections
╭────┬─────────────────┬────────────┬────────────┬───────────╮
│ # │ scope │ collection │ max_expiry │ cluster │
├────┼─────────────────┼────────────┼────────────┼───────────┤
│ 0 │ inventory │ landmark │ 0sec │ dev.local │
│ 1 │ inventory │ hotel │ 0sec │ dev.local │
│ 2 │ inventory │ airport │ 0sec │ dev.local │
│ 3 │ inventory │ airline │ 0sec │ dev.local │
│ 4 │ inventory │ route │ 0sec │ dev.local │
│ 5 │ tenant_agent_00 │ bookings │ 0sec │ dev.local │
│ 6 │ tenant_agent_00 │ users │ 0sec │ dev.local │
│ 7 │ tenant_agent_01 │ users │ 0sec │ dev.local │
│ 8 │ tenant_agent_01 │ bookings │ 0sec │ dev.local │
│ 9 │ tenant_agent_02 │ users │ 0sec │ dev.local │
│ 10 │ tenant_agent_02 │ bookings │ 0sec │ dev.local │
│ 11 │ tenant_agent_03 │ users │ 0sec │ dev.local │
│ 12 │ tenant_agent_03 │ bookings │ 0sec │ dev.local │
│ 13 │ tenant_agent_04 │ users │ 0sec │ dev.local │
│ 14 │ tenant_agent_04 │ bookings │ 0sec │ dev.local │
│ 15 │ _default │ _default │ 0sec │ dev.local │
╰────┴─────────────────┴────────────┴────────────┴───────────╯
```

You can also create and remove collections:

```
> collections create staff --scope tenant_agent_00
> collections --scope tenant_agent_00
╭───┬─────────────────┬────────────┬────────────┬───────────╮
│ # │ scope │ collection │ max_expiry │ cluster │
├───┼─────────────────┼────────────┼────────────┼───────────┤
│ 0 │ tenant_agent_00 │ staff │ 0sec │ dev.local │
│ 1 │ tenant_agent_00 │ bookings │ 0sec │ dev.local │
│ 2 │ tenant_agent_00 │ users │ 0sec │ dev.local │
╰───┴─────────────────┴────────────┴────────────┴───────────╯
```

```
> collections drop staff --scope tenant_agent_00
> collections --scope tenant_agent_00
╭───┬─────────────────┬────────────┬────────────┬───────────╮
│ # │ scope │ collection │ max_expiry │ cluster │
├───┼─────────────────┼────────────┼────────────┼───────────┤
│ 0 │ tenant_agent_00 │ bookings │ 0sec │ dev.local │
│ 1 │ tenant_agent_00 │ users │ 0sec │ dev.local │
╰───┴─────────────────┴────────────┴────────────┴───────────╯
```
include::commands/collections.adoc[]

=== Listing `nodes`

Expand Down
63 changes: 63 additions & 0 deletions docs/commands/collections.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
=== collections

The `collections` commands are used to manage collections.

==== `collections`

Lists all of the collections in the active scope:

```
👤 Charlie 🏠 local in 🗄 travel-sample.inventory._default
> collections
╭───┬────────────┬────────────┬─────────╮
│ # │ collection │ max_expiry │ cluster │
├───┼────────────┼────────────┼─────────┤
│ 0 │ landmark │ inherited │ local │
│ 1 │ hotel │ inherited │ local │
│ 2 │ airport │ inherited │ local │
│ 3 │ airline │ inherited │ local │
│ 4 │ route │ inherited │ local │
╰───┴────────────┴────────────┴─────────╯
```

==== `collections create`

Create a collection with the name supplied:

```
👤 Charlie 🏠 local in 🗄 my-bucket.my-scope._default
> collections
╭────────────╮
│ empty list │
╰────────────╯
👤 Charlie 🏠 local in 🗄 my-bucket.my-scope._default
> collections create new-collection
👤 Charlie 🏠 local in 🗄 my-bucket.my-scope._default
> collections
╭───┬────────────────┬────────────┬─────────╮
│ # │ collection │ max_expiry │ cluster │
├───┼────────────────┼────────────┼─────────┤
│ 0 │ new-collection │ inherited │ local │
╰───┴────────────────┴────────────┴─────────╯
```

==== `collections drop`

Drop the collection matching the name given:

```
👤 Charlie 🏠 local in 🗄 default.my-scope._default
> collections
╭───┬────────────────┬────────────┬─────────╮
│ # │ collection │ max_expiry │ cluster │
├───┼────────────────┼────────────┼─────────┤
│ 0 │ new-collection │ inherited │ local │
╰───┴────────────────┴────────────┴─────────╯
👤 Charlie 🏠 local in 🗄 default.my-scope._default
> collections drop new-collection
👤 Charlie 🏠 local in 🗄 default.my-scope._default
> collections
╭────────────╮
│ empty list │
╰────────────╯
```
73 changes: 73 additions & 0 deletions docs/commands/scopes.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
=== scopes

The `scopes` commands are used to manage scopes.

==== `scopes`

Lists all of the scopes in the active bucket:

```
👤 Charlie 🏠 local in 🗄 travel-sample._default._default
> scopes
╭───┬─────────────────┬─────────╮
│ # │ scope │ cluster │
├───┼─────────────────┼─────────┤
│ 0 │ inventory │ local │
│ 1 │ tenant_agent_00 │ local │
│ 2 │ tenant_agent_01 │ local │
│ 3 │ tenant_agent_02 │ local │
│ 4 │ tenant_agent_03 │ local │
│ 5 │ tenant_agent_04 │ local │
│ 6 │ _default │ local │
╰───┴─────────────────┴─────────╯
```


==== `scopes create`

Creates a scope with the name supplied:

```
👤 Charlie 🏠 local in 🗄 default._default._default
> scopes
╭───┬──────────┬─────────╮
│ # │ scope │ cluster │
├───┼──────────┼─────────┤
│ 0 │ _default │ local │
╰───┴──────────┴─────────╯
👤 Charlie 🏠 local in 🗄 default._default._default
> scopes create new-scope
👤 Charlie 🏠 local in 🗄 default._default._default
> scopes
╭───┬───────────┬─────────╮
│ # │ scope │ cluster │
├───┼───────────┼─────────┤
│ 0 │ new-scope │ local │
│ 1 │ _default │ local │
╰───┴───────────┴─────────╯
```

==== `scopes drop`


Deletes the scope matching the given name:

```
👤 Charlie 🏠 local in 🗄 default._default._default
> scopes
╭───┬───────────┬─────────╮
│ # │ scope │ cluster │
├───┼───────────┼─────────┤
│ 0 │ new-scope │ local │
│ 1 │ _default │ local │
╰───┴───────────┴─────────╯
👤 Charlie 🏠 local in 🗄 default._default._default
> scopes drop new-scope
👤 Charlie 🏠 local in 🗄 default._default._default
> scopes
╭───┬──────────┬─────────╮
│ # │ scope │ cluster │
├───┼──────────┼─────────┤
│ 0 │ _default │ local │
╰───┴──────────┴─────────╯
```
Loading