-
Notifications
You must be signed in to change notification settings - Fork 10
@W-22135727 adding operations, scheduling, user and email management in ODS #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
charithaT07
wants to merge
11
commits into
main
Choose a base branch
from
W-21766978-Add-scheduling-user-email-management-ODS
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3148d6c
@W-21766978 adding scheduling, user and email management in ODS
charithaT07 b74d199
Merge remote-tracking branch 'upstream/main' into W-21766978-Add-sche…
charithaT07 80aa373
adding operations command support for ODS - claude
charithaT07 f44ac32
Merge remote-tracking branch 'upstream/main' into W-21766978-Add-sche…
charithaT07 4489ce7
Merge remote-tracking branch 'upstream/main' into W-21766978-Add-sche…
charithaT07 9c636e2
Merge branch 'main' into W-21766978-Add-scheduling-user-email-managem…
charithaT07 d4ec147
Merge branch 'main' into W-21766978-Add-scheduling-user-email-managem…
charithaT07 bac2368
addressing review comments
charithaT07 76cc29d
Merge remote-tracking branch 'upstream/main' into W-21766978-Add-sche…
charithaT07 b2f00fe
Merge branch 'main' into W-21766978-Add-scheduling-user-email-managem…
charithaT07 219217f
Merge branch 'main' into W-21766978-Add-scheduling-user-email-managem…
charithaT07 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| '@salesforce/b2c-cli': minor | ||
| '@salesforce/b2c-dx-docs': patch | ||
| --- | ||
|
|
||
| ODS CLI: **`b2c sandbox create`** adds **`--emails`** for notification addresses; **`b2c sandbox update`** adds **`--start-scheduler`** and **`--stop-scheduler`** (JSON or `"null"` to clear); **`b2c realm update`** adds **`--emails`** and **`--local-users-allowed`** / **`--no-local-users-allowed`**. | ||
|
|
||
| Sandbox API: **`b2c sandbox operations list`** and **`b2c sandbox operations get`** (inspect lifecycle operations); **`b2c sandbox alias get`** (get one alias by ID, same endpoint as **`alias list --alias-id`**). | ||
|
|
||
| User guide updated for scheduling flags, sandbox operations, and **`b2c sandbox alias get`**. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| /* | ||
| * Copyright (c) 2025, Salesforce, Inc. | ||
| * SPDX-License-Identifier: Apache-2 | ||
| * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| import {Args, ux} from '@oclif/core'; | ||
| import cliui from 'cliui'; | ||
| import {OdsCommand} from '@salesforce/b2c-tooling-sdk/cli'; | ||
| import {getApiErrorMessage, type OdsComponents} from '@salesforce/b2c-tooling-sdk'; | ||
| import {t, withDocs} from '../../../i18n/index.js'; | ||
|
|
||
| type SandboxAliasModel = OdsComponents['schemas']['SandboxAliasModel']; | ||
|
|
||
| /** | ||
| * Get details for a single sandbox hostname alias (ODS API GET /sandboxes/{sandboxId}/aliases/{sandboxAliasId}). | ||
| */ | ||
| export default class SandboxAliasGet extends OdsCommand<typeof SandboxAliasGet> { | ||
| static aliases = ['ods:alias:get']; | ||
|
|
||
| static args = { | ||
| sandboxId: Args.string({ | ||
| description: 'Sandbox ID (UUID or realm-instance, e.g., abcd-123)', | ||
| required: true, | ||
| }), | ||
| aliasId: Args.string({ | ||
| description: 'Alias UUID', | ||
| required: true, | ||
| }), | ||
| }; | ||
|
|
||
| static description = withDocs( | ||
| t('commands.sandbox.alias.get.description', 'Show details for a specific sandbox hostname alias'), | ||
| '/cli/sandbox.html#b2c-sandbox-alias-get', | ||
| ); | ||
|
|
||
| static enableJsonFlag = true; | ||
|
|
||
| static examples = [ | ||
| '<%= config.bin %> <%= command.id %> zzzv-123 alias-uuid-here', | ||
| '<%= config.bin %> <%= command.id %> abc12345-1234-1234-1234-abc123456789 alias-uuid-here --json', | ||
| ]; | ||
|
|
||
| async run(): Promise<SandboxAliasModel | undefined> { | ||
| const sandboxId = await this.resolveSandboxId(this.args.sandboxId); | ||
| const {aliasId} = this.args; | ||
|
|
||
| this.log( | ||
| t('commands.sandbox.alias.get.fetching', 'Fetching alias {{aliasId}} for sandbox {{sandboxId}}...', { | ||
| aliasId, | ||
| sandboxId: this.args.sandboxId, | ||
| }), | ||
| ); | ||
|
|
||
| const result = await this.odsClient.GET('/sandboxes/{sandboxId}/aliases/{sandboxAliasId}', { | ||
| params: { | ||
| path: {sandboxId, sandboxAliasId: aliasId}, | ||
| }, | ||
| }); | ||
|
|
||
| if (result.error) { | ||
| this.error( | ||
| t('commands.sandbox.alias.get.error', 'Failed to fetch alias: {{message}}', { | ||
| message: getApiErrorMessage(result.error, result.response), | ||
| }), | ||
| ); | ||
| } | ||
|
|
||
| const alias = result.data?.data; | ||
| if (!alias) { | ||
| this.log(t('commands.sandbox.alias.get.noData', 'No alias details were returned.')); | ||
| return undefined; | ||
| } | ||
|
|
||
| if (this.jsonEnabled()) { | ||
| return alias; | ||
| } | ||
|
|
||
| this.printAlias(alias); | ||
| return alias; | ||
| } | ||
|
|
||
| private printAlias(alias: SandboxAliasModel): void { | ||
| const ui = cliui({width: process.stdout.columns || 80}); | ||
| ui.div({text: 'Alias Details', padding: [1, 0, 0, 0]}); | ||
| ui.div({text: '─'.repeat(50), padding: [0, 0, 0, 0]}); | ||
|
|
||
| const labelWidth = 22; | ||
| const rows: [string, string | undefined][] = [ | ||
| ['ID', alias.id], | ||
| ['Hostname', alias.name], | ||
| ['Status', alias.status], | ||
| ['Unique', alias.unique === undefined ? undefined : String(alias.unique)], | ||
| ['Sandbox ID', alias.sandboxId], | ||
| [ | ||
| 'Let’s Encrypt', | ||
| alias.requestLetsEncryptCertificate === undefined ? undefined : String(alias.requestLetsEncryptCertificate), | ||
| ], | ||
| ['DNS verification (TXT)', alias.domainVerificationRecord], | ||
| ['Registration URL', alias.registration], | ||
| ]; | ||
|
|
||
| for (const [label, value] of rows) { | ||
| if (value !== undefined) { | ||
| ui.div({text: `${label}:`, width: labelWidth, padding: [0, 2, 0, 0]}, {text: value, padding: [0, 0, 0, 0]}); | ||
| } | ||
| } | ||
|
|
||
| if (alias.cookie) { | ||
| const c = alias.cookie; | ||
| ui.div( | ||
| {text: 'Cookie:', width: labelWidth, padding: [0, 2, 0, 0]}, | ||
| {text: `${c.name}=${c.value}${c.path ? ` (path: ${c.path})` : ''}`, padding: [0, 0, 0, 0]}, | ||
| ); | ||
| } | ||
|
|
||
| ux.stdout(ui.toString()); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I like the UX of using the JSON null in the CLI.
Can we add a bit of UX and a separate --clear-start-scheduler / --clear-stop-scheduler boolean flags that perform the same action as a null start-scheduler. These should be exclusive flag (oclif convention) to their "set" counterparts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced "null" string with dedicated --clear-start-scheduler / --clear-stop-scheduler flags