Skip to content

Add generate-alias command#137

Merged
robert-chiniquy merged 2 commits intomainfrom
feat/generate-alias
Mar 30, 2026
Merged

Add generate-alias command#137
robert-chiniquy merged 2 commits intomainfrom
feat/generate-alias

Conversation

@afalahi
Copy link
Copy Markdown
Contributor

@afalahi afalahi commented Mar 29, 2026

Summary

  • Adds cone generate-alias to automatically generate aliases for entitlements
  • Supports multiple schemas: resource-entitlement, app-entitlement, app-resource-entitlement, resource-type-entitlement, and custom formats
  • Includes --dry-run, --force, --skip-aws, and resource type filtering
  • Adds UpdateEntitlement method to C1Client interface

Usage

# Preview aliases without making changes
cone generate-alias --dry-run

# Generate with default schema (resource-entitlement)
cone generate-alias

# Use app-based schema
cone generate-alias --schema app-entitlement

# Custom format
cone generate-alias --schema custom --format "%a-%r-%e"

Test plan

  • cone generate-alias --dry-run shows preview without modifying
  • cone generate-alias creates aliases with default schema
  • --schema flag switches between schemas correctly
  • --skip-aws excludes AWS permission sets
  • --force overrides existing aliases
  • Skips entitlements that already have aliases by default

afalahi and others added 2 commits March 29, 2026 10:11
Add `cone generate-alias` to automatically generate aliases for
entitlements based on configurable schemas (resource-entitlement,
app-entitlement, etc.) with support for custom formats, dry-run mode,
and AWS permission set handling.

Also adds UpdateEntitlement method to C1Client interface.
Replace the N+1 admin permission check (which listed all apps and all
app users) with a direct role check on AuthIntrospect. Remove the
interactive "are you an admin?" prompt — just check the roles.

Remove duplicate resourceName/isGenericEntitlement computation in
processEntitlement. The first pass was being overwritten by the second.

Move regexp compilation to package-level vars instead of compiling
per-call in cleanText.

Validate --schema flag against known values instead of silently falling
through to the default case.

Unexport Stats and CommandFlags (only used in main package). Replace
hand-rolled contains() with slices.Contains.
@robert-chiniquy robert-chiniquy enabled auto-merge (squash) March 30, 2026 01:52
@robert-chiniquy robert-chiniquy merged commit b6756dc into main Mar 30, 2026
2 checks passed
@robert-chiniquy robert-chiniquy deleted the feat/generate-alias branch March 30, 2026 01:52
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.

2 participants