Skip to content

Commit 5817615

Browse files
anekkanticlddx-agent[bot]claude
authored
Sync cloud-sdk-go v0.14.1 (#85)
* Sync cloud-sdk-go v0.14.1 Bump cloud-sdk dependency to the v0.14.1 release candidate and expose the new read-only namespace-assignment RPCs as CLI commands. - go.mod: go.temporal.io/cloud-sdk v0.13.0 -> v0.14.1-0.20260616191445-e6c2bafd1bf5 (pinned to RC commit e6c2bafd1bf5e2fcbdbfcb7ff1086cabcbb47b7a) - New commands (additive only): - cloud namespace user list - cloud namespace service-account list - cloud namespace user-group list - Regenerated commands.gen.go and cloudservice mock for the new RPCs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Adddress bot review comment * Fix namespace access list table columns Address Cursor Bugbot review on PR #85: - Service-account and user-group list commands requested an "Email" column, but those assignment types expose "Name" and "DisplayName" respectively — the identity column was omitted from table output. - All three commands omitted "InheritedAccess", so inherited-only access rendered as a blank permission with no indication of source. Select the correct per-type identity column and add InheritedAccess to all three. Add table-output guard tests (previously only JSON output, which bypasses the Fields list, was covered). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: clddx-agent[bot] <clddx-agent[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 52cd401 commit 5817615

4 files changed

Lines changed: 662 additions & 0 deletions

File tree

‎temporalcloudcli/commands.gen.go‎

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,10 @@ func NewCloudNamespaceCommand(cctx *CommandContext, parent *CloudCommand) *Cloud
18571857
s.Command.AddCommand(&NewCloudNamespaceMtlsCommand(cctx, &s).Command)
18581858
s.Command.AddCommand(&NewCloudNamespaceRetentionCommand(cctx, &s).Command)
18591859
s.Command.AddCommand(&NewCloudNamespaceSearchAttributeCommand(cctx, &s).Command)
1860+
s.Command.AddCommand(&NewCloudNamespaceServiceAccountCommand(cctx, &s).Command)
18601861
s.Command.AddCommand(&NewCloudNamespaceTagCommand(cctx, &s).Command)
1862+
s.Command.AddCommand(&NewCloudNamespaceUserCommand(cctx, &s).Command)
1863+
s.Command.AddCommand(&NewCloudNamespaceUserGroupCommand(cctx, &s).Command)
18611864
return &s
18621865
}
18631866

@@ -3955,6 +3958,55 @@ func NewCloudNamespaceSearchAttributeRenameCommand(cctx *CommandContext, parent
39553958
return &s
39563959
}
39573960

3961+
type CloudNamespaceServiceAccountCommand struct {
3962+
Parent *CloudNamespaceCommand
3963+
Command cobra.Command
3964+
}
3965+
3966+
func NewCloudNamespaceServiceAccountCommand(cctx *CommandContext, parent *CloudNamespaceCommand) *CloudNamespaceServiceAccountCommand {
3967+
var s CloudNamespaceServiceAccountCommand
3968+
s.Parent = parent
3969+
s.Command.Use = "service-account"
3970+
s.Command.Short = "Inspect service accounts with access to a namespace"
3971+
s.Command.Long = "Commands for inspecting the service accounts that have access to a\nTemporal Cloud namespace."
3972+
s.Command.Args = cobra.NoArgs
3973+
s.Command.AddCommand(&NewCloudNamespaceServiceAccountListCommand(cctx, &s).Command)
3974+
return &s
3975+
}
3976+
3977+
type CloudNamespaceServiceAccountListCommand struct {
3978+
Parent *CloudNamespaceServiceAccountCommand
3979+
Command cobra.Command
3980+
ClientOptions
3981+
NamespaceOptions
3982+
PageSize int
3983+
PageToken string
3984+
}
3985+
3986+
func NewCloudNamespaceServiceAccountListCommand(cctx *CommandContext, parent *CloudNamespaceServiceAccountCommand) *CloudNamespaceServiceAccountListCommand {
3987+
var s CloudNamespaceServiceAccountListCommand
3988+
s.Parent = parent
3989+
s.Command.DisableFlagsInUseLine = true
3990+
s.Command.Use = "list [flags]"
3991+
s.Command.Short = "List service accounts with access to a namespace"
3992+
if hasHighlighting {
3993+
s.Command.Long = "List the service accounts that have access to a Temporal Cloud namespace,\nincluding both directly-assigned and inherited access.\n\nExample:\n\n\x1b[1mtemporal cloud namespace service-account list --namespace my-namespace.my-account\x1b[0m"
3994+
} else {
3995+
s.Command.Long = "List the service accounts that have access to a Temporal Cloud namespace,\nincluding both directly-assigned and inherited access.\n\nExample:\n\n```\ntemporal cloud namespace service-account list --namespace my-namespace.my-account\n```"
3996+
}
3997+
s.Command.Args = cobra.NoArgs
3998+
s.Command.Flags().IntVar(&s.PageSize, "page-size", 0, "Number of service accounts to return per page. Use for paginated results.")
3999+
s.Command.Flags().StringVar(&s.PageToken, "page-token", "", "Token for retrieving the next page of results in a paginated list.")
4000+
s.ClientOptions.BuildFlags(s.Command.Flags())
4001+
s.NamespaceOptions.BuildFlags(s.Command.Flags())
4002+
s.Command.Run = func(c *cobra.Command, args []string) {
4003+
if err := s.run(cctx, args); err != nil {
4004+
cctx.Options.Fail(err)
4005+
}
4006+
}
4007+
return &s
4008+
}
4009+
39584010
type CloudNamespaceTagCommand struct {
39594011
Parent *CloudNamespaceCommand
39604012
Command cobra.Command
@@ -4111,6 +4163,104 @@ func NewCloudNamespaceTagUpdateCommand(cctx *CommandContext, parent *CloudNamesp
41114163
return &s
41124164
}
41134165

4166+
type CloudNamespaceUserCommand struct {
4167+
Parent *CloudNamespaceCommand
4168+
Command cobra.Command
4169+
}
4170+
4171+
func NewCloudNamespaceUserCommand(cctx *CommandContext, parent *CloudNamespaceCommand) *CloudNamespaceUserCommand {
4172+
var s CloudNamespaceUserCommand
4173+
s.Parent = parent
4174+
s.Command.Use = "user"
4175+
s.Command.Short = "Inspect users with access to a namespace"
4176+
s.Command.Long = "Commands for inspecting the users that have access to a Temporal Cloud\nnamespace."
4177+
s.Command.Args = cobra.NoArgs
4178+
s.Command.AddCommand(&NewCloudNamespaceUserListCommand(cctx, &s).Command)
4179+
return &s
4180+
}
4181+
4182+
type CloudNamespaceUserListCommand struct {
4183+
Parent *CloudNamespaceUserCommand
4184+
Command cobra.Command
4185+
ClientOptions
4186+
NamespaceOptions
4187+
PageSize int
4188+
PageToken string
4189+
}
4190+
4191+
func NewCloudNamespaceUserListCommand(cctx *CommandContext, parent *CloudNamespaceUserCommand) *CloudNamespaceUserListCommand {
4192+
var s CloudNamespaceUserListCommand
4193+
s.Parent = parent
4194+
s.Command.DisableFlagsInUseLine = true
4195+
s.Command.Use = "list [flags]"
4196+
s.Command.Short = "List users with access to a namespace"
4197+
if hasHighlighting {
4198+
s.Command.Long = "List the users that have access to a Temporal Cloud namespace, including\nboth directly-assigned and inherited access.\n\nExample:\n\n\x1b[1mtemporal cloud namespace user list --namespace my-namespace.my-account\x1b[0m"
4199+
} else {
4200+
s.Command.Long = "List the users that have access to a Temporal Cloud namespace, including\nboth directly-assigned and inherited access.\n\nExample:\n\n```\ntemporal cloud namespace user list --namespace my-namespace.my-account\n```"
4201+
}
4202+
s.Command.Args = cobra.NoArgs
4203+
s.Command.Flags().IntVar(&s.PageSize, "page-size", 0, "Number of users to return per page. Use for paginated results.")
4204+
s.Command.Flags().StringVar(&s.PageToken, "page-token", "", "Token for retrieving the next page of results in a paginated list.")
4205+
s.ClientOptions.BuildFlags(s.Command.Flags())
4206+
s.NamespaceOptions.BuildFlags(s.Command.Flags())
4207+
s.Command.Run = func(c *cobra.Command, args []string) {
4208+
if err := s.run(cctx, args); err != nil {
4209+
cctx.Options.Fail(err)
4210+
}
4211+
}
4212+
return &s
4213+
}
4214+
4215+
type CloudNamespaceUserGroupCommand struct {
4216+
Parent *CloudNamespaceCommand
4217+
Command cobra.Command
4218+
}
4219+
4220+
func NewCloudNamespaceUserGroupCommand(cctx *CommandContext, parent *CloudNamespaceCommand) *CloudNamespaceUserGroupCommand {
4221+
var s CloudNamespaceUserGroupCommand
4222+
s.Parent = parent
4223+
s.Command.Use = "user-group"
4224+
s.Command.Short = "Inspect user groups with access to a namespace"
4225+
s.Command.Long = "Commands for inspecting the user groups that have access to a Temporal\nCloud namespace."
4226+
s.Command.Args = cobra.NoArgs
4227+
s.Command.AddCommand(&NewCloudNamespaceUserGroupListCommand(cctx, &s).Command)
4228+
return &s
4229+
}
4230+
4231+
type CloudNamespaceUserGroupListCommand struct {
4232+
Parent *CloudNamespaceUserGroupCommand
4233+
Command cobra.Command
4234+
ClientOptions
4235+
NamespaceOptions
4236+
PageSize int
4237+
PageToken string
4238+
}
4239+
4240+
func NewCloudNamespaceUserGroupListCommand(cctx *CommandContext, parent *CloudNamespaceUserGroupCommand) *CloudNamespaceUserGroupListCommand {
4241+
var s CloudNamespaceUserGroupListCommand
4242+
s.Parent = parent
4243+
s.Command.DisableFlagsInUseLine = true
4244+
s.Command.Use = "list [flags]"
4245+
s.Command.Short = "List user groups with access to a namespace"
4246+
if hasHighlighting {
4247+
s.Command.Long = "List the user groups that have access to a Temporal Cloud namespace,\nincluding both directly-assigned and inherited access.\n\nExample:\n\n\x1b[1mtemporal cloud namespace user-group list --namespace my-namespace.my-account\x1b[0m"
4248+
} else {
4249+
s.Command.Long = "List the user groups that have access to a Temporal Cloud namespace,\nincluding both directly-assigned and inherited access.\n\nExample:\n\n```\ntemporal cloud namespace user-group list --namespace my-namespace.my-account\n```"
4250+
}
4251+
s.Command.Args = cobra.NoArgs
4252+
s.Command.Flags().IntVar(&s.PageSize, "page-size", 0, "Number of user groups to return per page. Use for paginated results.")
4253+
s.Command.Flags().StringVar(&s.PageToken, "page-token", "", "Token for retrieving the next page of results in a paginated list.")
4254+
s.ClientOptions.BuildFlags(s.Command.Flags())
4255+
s.NamespaceOptions.BuildFlags(s.Command.Flags())
4256+
s.Command.Run = func(c *cobra.Command, args []string) {
4257+
if err := s.run(cctx, args); err != nil {
4258+
cctx.Options.Fail(err)
4259+
}
4260+
}
4261+
return &s
4262+
}
4263+
41144264
type CloudNexusCommand struct {
41154265
Parent *CloudCommand
41164266
Command cobra.Command
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package temporalcloudcli
2+
3+
import (
4+
cloudservice "go.temporal.io/cloud-sdk/api/cloudservice/v1"
5+
identityv1 "go.temporal.io/cloud-sdk/api/identity/v1"
6+
7+
"github.com/temporalio/cloud-cli/temporalcloudcli/internal/printer"
8+
)
9+
10+
// AIDEV-NOTE: These commands wrap the read-only Get*NamespaceAssignments RPCs
11+
// added in cloud-sdk-go v0.14.x. They list the identities (users, service
12+
// accounts, user groups) that have explicit access to a namespace.
13+
14+
func (c *CloudNamespaceUserListCommand) run(cctx *CommandContext, _ []string) error {
15+
client, err := cctx.GetCloudClient(c.ClientOptions)
16+
if err != nil {
17+
return err
18+
}
19+
res, err := client.GetUserNamespaceAssignments(cctx, &cloudservice.GetUserNamespaceAssignmentsRequest{
20+
Namespace: c.Namespace,
21+
PageSize: int32(c.PageSize),
22+
PageToken: c.PageToken,
23+
})
24+
if err != nil {
25+
return err
26+
}
27+
return cctx.Printer.PrintResourceList(
28+
struct {
29+
Users []*identityv1.UserNamespaceAssignment
30+
NextPageToken string
31+
}{
32+
Users: res.Users,
33+
NextPageToken: res.NextPageToken,
34+
},
35+
printer.PrintResourceOptions{
36+
Fields: []string{"Id", "Email", "NamespaceAccess", "InheritedAccess"},
37+
},
38+
printer.TableOptions{},
39+
)
40+
}
41+
42+
func (c *CloudNamespaceServiceAccountListCommand) run(cctx *CommandContext, _ []string) error {
43+
client, err := cctx.GetCloudClient(c.ClientOptions)
44+
if err != nil {
45+
return err
46+
}
47+
res, err := client.GetServiceAccountNamespaceAssignments(cctx, &cloudservice.GetServiceAccountNamespaceAssignmentsRequest{
48+
Namespace: c.Namespace,
49+
PageSize: int32(c.PageSize),
50+
PageToken: c.PageToken,
51+
})
52+
if err != nil {
53+
return err
54+
}
55+
return cctx.Printer.PrintResourceList(
56+
struct {
57+
ServiceAccounts []*identityv1.ServiceAccountNamespaceAssignment
58+
NextPageToken string
59+
}{
60+
ServiceAccounts: res.ServiceAccounts,
61+
NextPageToken: res.NextPageToken,
62+
},
63+
printer.PrintResourceOptions{
64+
Fields: []string{"Id", "Name", "NamespaceAccess", "InheritedAccess"},
65+
},
66+
printer.TableOptions{},
67+
)
68+
}
69+
70+
func (c *CloudNamespaceUserGroupListCommand) run(cctx *CommandContext, _ []string) error {
71+
client, err := cctx.GetCloudClient(c.ClientOptions)
72+
if err != nil {
73+
return err
74+
}
75+
res, err := client.GetUserGroupNamespaceAssignments(cctx, &cloudservice.GetUserGroupNamespaceAssignmentsRequest{
76+
Namespace: c.Namespace,
77+
PageSize: int32(c.PageSize),
78+
PageToken: c.PageToken,
79+
})
80+
if err != nil {
81+
return err
82+
}
83+
return cctx.Printer.PrintResourceList(
84+
struct {
85+
Groups []*identityv1.UserGroupNamespaceAssignment
86+
NextPageToken string
87+
}{
88+
Groups: res.Groups,
89+
NextPageToken: res.NextPageToken,
90+
},
91+
printer.PrintResourceOptions{
92+
Fields: []string{"Id", "DisplayName", "NamespaceAccess", "InheritedAccess"},
93+
},
94+
printer.TableOptions{},
95+
)
96+
}

0 commit comments

Comments
 (0)