Skip to content

feat: add gcloud utility to enable Service Usage API org-wide#994

Open
bob-bot wants to merge 4 commits into
mainfrom
add-enable-serviceusage-util
Open

feat: add gcloud utility to enable Service Usage API org-wide#994
bob-bot wants to merge 4 commits into
mainfrom
add-enable-serviceusage-util

Conversation

@bob-bot

@bob-bot bob-bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What

Adds guardrails_utilities/shell_utils/enable-serviceusage/ — a shell utility that lists every project under a GCP organization and enables the Service Usage API (serviceusage.googleapis.com) on each one.

Behavior

  • Dry-run by default — lists the projects and prints what it would do. Pass --dry-run false to actually enable the service.
  • --org-id (required), --service (default serviceusage.googleapis.com), --skip-system (skip non-ACTIVE projects), --help.
  • Follows existing shell_utils conventions: [INFO]/[ERROR] logging, gcloud/jq dependency check, argument parser, summary counts.

Notes

  • Uses a parent.id filter, which returns projects whose direct parent is the org. The script warns when that returns nothing (projects nested in folders); the README documents the gcloud asset search-all-resources alternative for a full org-wide sweep.

🤖 Generated with Claude Code

bob-bot and others added 4 commits June 23, 2026 13:36
Adds a shell utility that lists all projects under a GCP organization and
enables serviceusage.googleapis.com on each. Dry-run by default; pass
--dry-run false to apply. Follows the existing shell_utils conventions
([INFO]/[ERROR] logging, dependency check, --help).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CDDFT1aHLHzV2eSynthEZH
The parent.id filter only returned projects whose direct parent was the
org, missing folder-nested ones. Walk the org's folder tree (folders only,
no Cloud Asset API) and filter the project list locally by parent id so
projects at any depth are covered.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CDDFT1aHLHzV2eSynthEZH
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CDDFT1aHLHzV2eSynthEZH
gcloud services enable accepts multiple services in one call, so --service
now takes a comma-separated list (e.g.
serviceusage.googleapis.com,orgpolicy.googleapis.com). Docs and examples
updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CDDFT1aHLHzV2eSynthEZH
@bob-bot bob-bot self-assigned this Jun 23, 2026
@bob-bot bob-bot requested a review from rajlearner17 June 23, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant