Skip to content

Commit e8a5a0e

Browse files
davidporter-id-augazi-yestemirova
authored andcommitted
feat: Updating warning for UpdateDomain cli command (#7375)
<!-- Describe what has changed in this PR --> **What changed?** The UpdateDomain API is (optionally) undergoing changes where it's administrative functions are being protected by authorization checks and it's failover / user-facing functionality is being made available in the new endpoint `Failover`. This - if enforced - may affect users who're not aware of this change. <!-- Tell your future self why have you made these changes --> **Why?** <!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? --> **How did you test it?** <!-- Assuming the worst case, what can be broken when deploying this change to production? --> **Potential risks** <!-- Is it notable for release? e.g. schema updates, configuration or data migration required? If so, please mention it, and also update CHANGELOG.md --> **Release notes** <!-- Is there any documentation updates should be made for config, https://cadenceworkflow.io/docs/operation-guide/setup/ ? If so, please open an PR in https://github.com/cadence-workflow/cadence-docs --> **Documentation Changes** Signed-off-by: David Porter <[email protected]> Signed-off-by: Gaziza Yestemirova <[email protected]>
1 parent aa010d0 commit e8a5a0e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/cli/domain_commands.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,16 @@ func (d *domainCLIImpl) UpdateDomain(c *cli.Context) error {
320320
updateRequest.SecurityToken = securityToken
321321
_, err = d.updateDomain(ctx, updateRequest)
322322
if err != nil {
323-
if _, ok := err.(*types.EntityNotExistsError); ok {
323+
var entityNotExistsErr *types.EntityNotExistsError
324+
if errors.As(err, &entityNotExistsErr) {
324325
return commoncli.Problem(fmt.Sprintf("Domain %s does not exist.", domainName), err)
325326
}
327+
var accessDeniedErr *types.AccessDeniedError
328+
if errors.As(err, &accessDeniedErr) {
329+
fmt.Fprintf(os.Stderr, "WARNING: Update domain operation may not be available for general user use and is reserved for administrative operations.\n")
330+
fmt.Fprintf(os.Stderr, "Please use the 'cadence domain failover' cli-command instead for domain management.\n")
331+
return commoncli.Problem("Operation UpdateDomain failed due to authorization.", err)
332+
}
326333
return commoncli.Problem("Operation UpdateDomain failed.", err)
327334
}
328335
fmt.Printf("Domain %s successfully updated.\n", domainName)

0 commit comments

Comments
 (0)