google / google/stellar-engine
[Feature Request] gem4gov: add a license-assignment command (batchUpdateUserLicenses)
- Dominant language
- HCL
- Stars
- 49
- Forks
- 20
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 28
Description
## Feature Description
The `gem4gov license` group wraps `distributeLicenseConfig` (`distribute`) and lists configs (`list`), but has no user-assignment command. Add `gem4gov license assign` (plus `unassign`/`reconcile`) wrapping the public Discovery Engine `batchUpdateUserLicenses` REST method, mirroring the existing `distribute` command's structure.
## Use Case
Assigning a license to an individual user currently requires the Gemini Enterprise console "Manage users" page or a manually created REST call (`grep -n batchUpdateUserLicenses gem4gov.py` → no matches). A CLI command makes assignment scriptable, idempotent, and auditable — producing cleaner audit evidence for license oversight.
## Proposed Solution
Add `gem4gov license assign` wrapping the documented API. Verified schema (Google's public "Get subscriptions and assign licenses" docs):
`POST https://{us|eu|}discoveryengine.googleapis.com/v1/projects/{PROJECT_ID}/locations/{LOCATION}/userStores/default_user_store:batchUpdateUserLicenses`
body `{ inlineSource: { userLicenses: [{ userPrincipal, licenseConfig }], updateMask: { paths: ["userPrincipal","licenseConfig"] } }, deleteUnassignedUserLicenses: bool }`.
Note: **v1** (not v1alpha), `default_user_store`, `licenseConfig` is the project-level config path. Unassign = omit `licenseConfig` + `deleteUnassignedUserLicenses: true`.
## Compliance & Deployment Context
* **Target Deployment Type(s):**
* [ ] US Region Restricted (e.g., Access Policy constraint)
* [ ] FedRAMP Medium
* [x] FedRAMP High
* [ ] DoD IL4
* [ ] DoD IL5
* [ ] All / General
* **Relevant NIST 800-53r5 Controls:** AC-2 (account management) — auditable, repeatable license assignment.
## Reusability Check
Stellar Engine prioritizes reusability.
* [x] I have checked if this functionality can be achieved by extending an existing module or blueprint. (Extends the existing `license` group; no wrapper exists anywhere in the repo.)
* [x] I have verified that this does not duplicate existing functionality. (Checked all 61 open/closed issues; #100 proposes converting the CLI to Terraform — if that lands, this ask translates to the TF implementation.)
## Alternatives Considered
Console clicks (not scriptable/auditable at scale); hand-rolled REST calls (works, but every operator reinvents the request shape).
## Additional Context
Verified at `main` @ `3728fc98`. Related: #100 (CLI→Terraform conversion).
Contributor guide
Research direction
Start in gem4gov.py by locating the existing `gem4gov license` group and `distribute` command, then compare them with the documented v1 `batchUpdateUserLicenses` request in the issue. Implement the requested assign, unassign, and reconcile behavior using the stated endpoint and payload shape. Done means the commands support the described assignment and removal workflows and produce auditable CLI requests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, python
- Domain
- api, cli, cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100