Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 496abdd

Browse files
committed
feat(admin): add orgunit management
1 parent ff3ce7a commit 496abdd

23 files changed

Lines changed: 969 additions & 44 deletions

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66

77
- Admin: expand `admin users create` with GAM-style aliases, generated passwords, suspended/archived creation, recovery contact fields, and password hash metadata; add `admin users delete` for cleanup.
8+
- Admin: add `admin orgunits` commands to list, inspect, create, update, and delete Workspace organizational units.
89
- Sites: add Drive-backed `sites` commands to list, search, inspect, and open New Google Sites. (#574) — thanks @thewilloftheshadow.
910
- Analytics/Search Console: add GA4 `analytics accounts|report` plus Search Console site, search analytics, and sitemap commands. (#402) — thanks @haresh-seenivasagan.
1011
- Gmail: add `gmail send --body-html-file` for sending HTML email bodies from files without shell command substitution. (#575) — thanks @toruvieI.
@@ -19,6 +20,7 @@
1920
### Fixed
2021

2122
- Auth: make `auth service-account status` show `stored`, a clear missing-key message, and the exact setup hint when no service-account key is configured.
23+
- Admin: retry the post-create state update so `admin users create --suspended` and `--archived` remain reliable while the Admin SDK finishes provisioning the new user.
2224
- Calendar: make `calendar update --with-meet` idempotent when an event already has conference data, add explicit `--regenerate-meet`, and show `recurringEventId` in plain event output. (#576 / #573) — thanks @alexisperumal and @NodeJSmith.
2325
- Release: fail closed when macOS signing secrets are missing and verify Darwin release assets are not ad-hoc signed, so Homebrew upgrades keep stable Keychain trust. (#569) — thanks @aaroneden.
2426
- Auth: list one row per OAuth client when the same account is authorized under multiple clients, and let `auth list --client` filter that token bucket. (#563) — thanks @UnPractical91.

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,14 @@ gog --account [email protected] admin users create [email protected] \
364364

365365
Omit `--password` to generate a temporary password. See
366366
[docs/workspace-admin.md](docs/workspace-admin.md) for service-account setup,
367-
user cleanup, recovery fields, and group examples.
367+
user cleanup, recovery fields, organizational units, and group examples.
368+
369+
Workspace organizational units are covered too:
370+
371+
```bash
372+
gog --account [email protected] admin orgunits list --type all
373+
gog --account [email protected] admin orgunits create Engineering --parent /
374+
```
368375

369376
Generated service scope table:
370377

@@ -409,7 +416,7 @@ go run scripts/gen-auth-services-md.go
409416
- [docs/commands/README.md](docs/commands/README.md): generated command index
410417
- [docs/safety-profiles.md](docs/safety-profiles.md): command guards and baked safe binaries
411418
- [docs/auth-clients.md](docs/auth-clients.md): OAuth clients, account mapping, and service accounts
412-
- [docs/workspace-admin.md](docs/workspace-admin.md): Workspace user and group administration
419+
- [docs/workspace-admin.md](docs/workspace-admin.md): Workspace user, org unit, and group administration
413420
- [docs/sheets-tables.md](docs/sheets-tables.md): structured Sheets tables
414421
- [docs/backup.md](docs/backup.md): encrypted Google account backups
415422
- [CHANGELOG.md](CHANGELOG.md): release notes

docs/auth-clients.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Shows stored credential files plus any configured domain mappings.
6767

6868
## Workspace service accounts
6969

70-
Workspace Admin, group, and Keep automation commonly run through a
70+
Workspace Admin, group, org-unit, and Keep automation commonly run through a
7171
service-account key with domain-wide delegation. Store the key for the
7272
Workspace admin identity you want to impersonate:
7373

@@ -85,5 +85,5 @@ gog --account [email protected] admin users create [email protected] \
8585
--change-password
8686
```
8787

88-
See [Workspace Admin](workspace-admin.md) for user creation, cleanup, and group
89-
examples.
88+
See [Workspace Admin](workspace-admin.md) for user creation, organizational
89+
units, cleanup, and group examples.

docs/commands.generated.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Generated from `gog schema --json`.
1010
- [`gog admin groups members add (invite) <groupEmail> <memberEmail> [flags]`](commands/gog-admin-groups-members-add.md) - Add a member to a group
1111
- [`gog admin groups members list (ls) <groupEmail> [flags]`](commands/gog-admin-groups-members-list.md) - List group members
1212
- [`gog admin groups members remove (rm,del,delete) <groupEmail> <memberEmail>`](commands/gog-admin-groups-members-remove.md) - Remove a member from a group
13+
- [`gog admin orgunits (org-units,ou) <command>`](commands/gog-admin-orgunits.md) - Manage Workspace organizational units
14+
- [`gog admin orgunits (org-units,ou) create (add,new) <name> [flags]`](commands/gog-admin-orgunits-create.md) - Create an organizational unit
15+
- [`gog admin orgunits (org-units,ou) delete (rm,del,remove) <path>`](commands/gog-admin-orgunits-delete.md) - Delete an organizational unit
16+
- [`gog admin orgunits (org-units,ou) get (info,show) <path>`](commands/gog-admin-orgunits-get.md) - Get organizational unit details
17+
- [`gog admin orgunits (org-units,ou) list (ls) [flags]`](commands/gog-admin-orgunits-list.md) - List organizational units
18+
- [`gog admin orgunits (org-units,ou) update (edit,set) <path> [flags]`](commands/gog-admin-orgunits-update.md) - Update an organizational unit
1319
- [`gog admin users <command>`](commands/gog-admin-users.md) - Manage Workspace users
1420
- [`gog admin users create (add,new) <email> [flags]`](commands/gog-admin-users-create.md) - Create a new user
1521
- [`gog admin users delete (rm,del,remove) <userEmail>`](commands/gog-admin-users-delete.md) - Delete a user account

docs/commands/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Every `gog` command has a generated docs page. The source of truth is the live CLI schema; run `make docs-commands` after changing command names, flags, help text, aliases, or arguments.
44

5-
Generated pages: 517.
5+
Generated pages: 523.
66

77
## Top-level Commands
88

@@ -58,6 +58,12 @@ Generated pages: 517.
5858
- [gog admin groups members add](gog-admin-groups-members-add.md) - Add a member to a group
5959
- [gog admin groups members list](gog-admin-groups-members-list.md) - List group members
6060
- [gog admin groups members remove](gog-admin-groups-members-remove.md) - Remove a member from a group
61+
- [gog admin orgunits](gog-admin-orgunits.md) - Manage Workspace organizational units
62+
- [gog admin orgunits create](gog-admin-orgunits-create.md) - Create an organizational unit
63+
- [gog admin orgunits delete](gog-admin-orgunits-delete.md) - Delete an organizational unit
64+
- [gog admin orgunits get](gog-admin-orgunits-get.md) - Get organizational unit details
65+
- [gog admin orgunits list](gog-admin-orgunits-list.md) - List organizational units
66+
- [gog admin orgunits update](gog-admin-orgunits-update.md) - Update an organizational unit
6167
- [gog admin users](gog-admin-users.md) - Manage Workspace users
6268
- [gog admin users create](gog-admin-users-create.md) - Create a new user
6369
- [gog admin users delete](gog-admin-users-delete.md) - Delete a user account
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# `gog admin orgunits create`
2+
3+
> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.
4+
5+
Create an organizational unit
6+
7+
## Usage
8+
9+
```bash
10+
gog admin orgunits (org-units,ou) create (add,new) <name> [flags]
11+
```
12+
13+
## Parent
14+
15+
- [gog admin orgunits](gog-admin-orgunits.md)
16+
17+
## Flags
18+
19+
| Flag | Type | Default | Help |
20+
| --- | --- | --- | --- |
21+
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
22+
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
23+
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
24+
| `--color` | `string` | auto | Color output: auto\|always\|never |
25+
| `--description` | `string` | | Description |
26+
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
27+
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
28+
| `--enable-commands` | `string` | | Comma-separated list of enabled commands; dot paths allowed (restricts CLI) |
29+
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
30+
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
31+
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
32+
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
33+
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
34+
| `--parent` | `string` | / | Parent org unit path |
35+
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
36+
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
37+
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
38+
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
39+
| `--version` | `kong.VersionFlag` | | Print version and exit |
40+
41+
## See Also
42+
43+
- [gog admin orgunits](gog-admin-orgunits.md)
44+
- [Command index](README.md)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# `gog admin orgunits delete`
2+
3+
> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.
4+
5+
Delete an organizational unit
6+
7+
## Usage
8+
9+
```bash
10+
gog admin orgunits (org-units,ou) delete (rm,del,remove) <path>
11+
```
12+
13+
## Parent
14+
15+
- [gog admin orgunits](gog-admin-orgunits.md)
16+
17+
## Flags
18+
19+
| Flag | Type | Default | Help |
20+
| --- | --- | --- | --- |
21+
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
22+
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
23+
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
24+
| `--color` | `string` | auto | Color output: auto\|always\|never |
25+
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
26+
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
27+
| `--enable-commands` | `string` | | Comma-separated list of enabled commands; dot paths allowed (restricts CLI) |
28+
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
29+
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
30+
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
31+
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
32+
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
33+
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
34+
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
35+
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
36+
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
37+
| `--version` | `kong.VersionFlag` | | Print version and exit |
38+
39+
## See Also
40+
41+
- [gog admin orgunits](gog-admin-orgunits.md)
42+
- [Command index](README.md)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# `gog admin orgunits get`
2+
3+
> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.
4+
5+
Get organizational unit details
6+
7+
## Usage
8+
9+
```bash
10+
gog admin orgunits (org-units,ou) get (info,show) <path>
11+
```
12+
13+
## Parent
14+
15+
- [gog admin orgunits](gog-admin-orgunits.md)
16+
17+
## Flags
18+
19+
| Flag | Type | Default | Help |
20+
| --- | --- | --- | --- |
21+
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
22+
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
23+
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
24+
| `--color` | `string` | auto | Color output: auto\|always\|never |
25+
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
26+
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
27+
| `--enable-commands` | `string` | | Comma-separated list of enabled commands; dot paths allowed (restricts CLI) |
28+
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
29+
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
30+
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
31+
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
32+
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
33+
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
34+
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
35+
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
36+
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
37+
| `--version` | `kong.VersionFlag` | | Print version and exit |
38+
39+
## See Also
40+
41+
- [gog admin orgunits](gog-admin-orgunits.md)
42+
- [Command index](README.md)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# `gog admin orgunits list`
2+
3+
> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.
4+
5+
List organizational units
6+
7+
## Usage
8+
9+
```bash
10+
gog admin orgunits (org-units,ou) list (ls) [flags]
11+
```
12+
13+
## Parent
14+
15+
- [gog admin orgunits](gog-admin-orgunits.md)
16+
17+
## Flags
18+
19+
| Flag | Type | Default | Help |
20+
| --- | --- | --- | --- |
21+
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
22+
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
23+
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
24+
| `--color` | `string` | auto | Color output: auto\|always\|never |
25+
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
26+
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
27+
| `--enable-commands` | `string` | | Comma-separated list of enabled commands; dot paths allowed (restricts CLI) |
28+
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
29+
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
30+
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
31+
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
32+
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
33+
| `--parent` | `string` | / | Parent org unit path or ID |
34+
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
35+
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
36+
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
37+
| `--type` | `string` | children | Return all descendants, children, or all including parent |
38+
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
39+
| `--version` | `kong.VersionFlag` | | Print version and exit |
40+
41+
## See Also
42+
43+
- [gog admin orgunits](gog-admin-orgunits.md)
44+
- [Command index](README.md)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# `gog admin orgunits update`
2+
3+
> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.
4+
5+
Update an organizational unit
6+
7+
## Usage
8+
9+
```bash
10+
gog admin orgunits (org-units,ou) update (edit,set) <path> [flags]
11+
```
12+
13+
## Parent
14+
15+
- [gog admin orgunits](gog-admin-orgunits.md)
16+
17+
## Flags
18+
19+
| Flag | Type | Default | Help |
20+
| --- | --- | --- | --- |
21+
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
22+
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
23+
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
24+
| `--color` | `string` | auto | Color output: auto\|always\|never |
25+
| `--description` | `*string` | | Description |
26+
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
27+
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
28+
| `--enable-commands` | `string` | | Comma-separated list of enabled commands; dot paths allowed (restricts CLI) |
29+
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
30+
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
31+
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
32+
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
33+
| `--name` | `*string` | | New org unit name |
34+
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
35+
| `--parent` | `*string` | | New parent org unit path |
36+
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
37+
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
38+
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
39+
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
40+
| `--version` | `kong.VersionFlag` | | Print version and exit |
41+
42+
## See Also
43+
44+
- [gog admin orgunits](gog-admin-orgunits.md)
45+
- [Command index](README.md)

0 commit comments

Comments
 (0)