Skip to content

@W-21766828 add storage,multi realm usage and settings support#309

Merged
charithaT07 merged 4 commits intomainfrom
W-21766828-storage-multi-realm-usage-support
Apr 3, 2026
Merged

@W-21766828 add storage,multi realm usage and settings support#309
charithaT07 merged 4 commits intomainfrom
W-21766828-storage-multi-realm-usage-support

Conversation

@charithaT07
Copy link
Copy Markdown
Collaborator

@charithaT07 charithaT07 commented Mar 31, 2026

Summary

Brief description of what this PR does.

Summary

Enhances the B2C CLI with three new sandbox management capabilities: storage monitoring, settings inspection, and multi-realm usage reporting.


What's New

Sandbox Storage Command

Command: b2c sandbox storage <SANDBOXID>

  • Purpose: Display filesystem storage usage for a sandbox
  • Output: Table showing filesystem name, total space, used space, and usage percentage
  • Supports: --json flag for raw API response

Example:

b2c sandbox storage zzzz-001

Sandbox Settings Command

Command: b2c sandbox settings <SANDBOXID>

  • Purpose: Show effective OCAPI and WebDAV settings for a sandbox
  • Output: Number of OCAPI/WebDAV client entries with per-client breakdown
  • Supports: --json flag for full settings payload

Example:

b2c sandbox settings zzzz-001

Realm Configuration Command

Command: b2c realm configuration <REALM>

  • Purpose: Get sandbox configuration for a specific realm
  • Input: Four-letter realm ID
  • Returns: Realm-specific sandbox configuration settings

Example:

b2c realm configuration zzzz

📊 Multi-Realm Usage Command

Command: b2c realm usages [FLAGS]

  • Purpose: Query usage information across multiple realms in a single request
  • Auto-discovery: If no realms specified, queries all realms accessible to current user (via /me)
  • Flags:
    • --realm - Specify realm IDs (comma-separated or repeated)
    • --from - Start date (ISO 8601)
    • --to - End date (ISO 8601)
    • --detailed-report - Include detailed usage data

Examples:

# All realms for current user
b2c realm usages

# Specific realms with date range
b2c realm usages --realm zzzz,yyyy --from 2026-03-01 --to 2026-03-31

Files Changed

New Commands (4 files):

  • packages/b2c-cli/src/commands/sandbox/storage.ts (+88 lines)
  • packages/b2c-cli/src/commands/sandbox/settings.ts (+99 lines)
  • packages/b2c-cli/src/commands/sandbox/realm/configuration.ts (+113 lines)
  • packages/b2c-cli/src/commands/sandbox/realm/usages.ts (+134 lines)

Modified:

  • 📝 packages/b2c-cli/src/commands/sandbox/realm/list.ts (refactored -43 lines)
  • 📚 docs/cli/sandbox.md (+150 lines of documentation)

Test Coverage (4 files):

  • test/commands/sandbox/storage.test.ts (+96 lines)
  • test/commands/sandbox/settings.test.ts (+99 lines)
  • test/commands/sandbox/realm/configuration.test.ts (+80 lines)
  • test/commands/sandbox/realm/usages.test.ts (+92 lines)

Testing

✅ All tests pass
✅ Code formatted and linted
✅ No new third-party dependencies


Impact

For DevOps/Platform Teams:

  • Monitor sandbox storage usage to prevent disk space issues
  • Audit OCAPI/WebDAV settings across sandboxes
  • Track multi-realm usage metrics in a single query

For Developers:

  • Quick access to sandbox configuration and settings
  • Better visibility into resource consumption
  • Simplified realm management workflows

API Endpoints Used

This PR leverages existing ODS API endpoints:

  • GET /api/v1/sandboxes/{sandboxId}/storage - Storage usage
  • GET /api/v1/sandboxes/{sandboxId}/settings - OCAPI/WebDAV settings
  • GET /api/v1/realms/{realmId}/configuration - Realm sandbox config
  • POST /api/v1/realms/usages - Multi-realm usage query

Testing

How was this tested?

Dependencies

  • No net-new third-party dependencies were added
  • If net-new third-party dependencies were added, rationale/discussion is included and 3pl-approved is set by a maintainer

  • Tests pass (pnpm test)
  • Code is formatted (pnpm run format)

@charithaT07 charithaT07 marked this pull request as ready for review March 31, 2026 14:46
@charithaT07 charithaT07 requested a review from clavery as a code owner March 31, 2026 14:46
@clavery
Copy link
Copy Markdown
Collaborator

clavery commented Mar 31, 2026

@charithaT07 can you add a summary

@charithaT07
Copy link
Copy Markdown
Collaborator Author

@charithaT07 can you add a summary

Hi @clavery , Thanks, I have added the PR summary

@charithaT07 charithaT07 merged commit ca22f4d into main Apr 3, 2026
5 checks passed
@charithaT07 charithaT07 deleted the W-21766828-storage-multi-realm-usage-support branch April 3, 2026 17:24
Copy link
Copy Markdown
Collaborator

@clavery clavery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If b2c realm is for sandbox realms only it needs to be under the sandbox/ods topic

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