Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/stretchr/testify v1.11.1
github.com/temporalio/cli/cliext v0.0.0-20260602200703-8bb57b77ad55
go.temporal.io/api v1.63.6-0.20260811224032-89570b10e9e2
go.temporal.io/cloud-sdk v0.16.0
go.temporal.io/cloud-sdk v0.16.1-0.20260826195225-e4c5e7f3aa55
go.temporal.io/sdk v1.44.1
go.temporal.io/sdk/contrib/envconfig v1.0.0
golang.org/x/oauth2 v0.36.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09
go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0=
go.temporal.io/api v1.63.6-0.20260811224032-89570b10e9e2 h1:VeNTxlOHETym01zX6kSXHIVw4nc2RrX/KVgepQ/dr/8=
go.temporal.io/api v1.63.6-0.20260811224032-89570b10e9e2/go.mod h1:SrlW2JMwVlDP4nRWSNznUFqnSHd+YeMDS1BkYo63HCQ=
go.temporal.io/cloud-sdk v0.16.0 h1:8EgFMyc3M1XV2+OIOOuKeyhUI8Kjy7YCCbmGYlRw1No=
go.temporal.io/cloud-sdk v0.16.0/go.mod h1:W2O9t9tvo3Q/LhGgYdj8JijWbN5C84os+cz/BadIHYI=
go.temporal.io/cloud-sdk v0.16.1-0.20260826195225-e4c5e7f3aa55 h1:XVb15Q93gtvLnF7u4y3EHEZLfeVIHf5cIxwGmnpDTrQ=
go.temporal.io/cloud-sdk v0.16.1-0.20260826195225-e4c5e7f3aa55/go.mod h1:W2O9t9tvo3Q/LhGgYdj8JijWbN5C84os+cz/BadIHYI=
go.temporal.io/sdk v1.44.1 h1:Mt2OZLZpqkzDIdg9YyQzO0Rb/HqCDnnqHlIAGAJ5gqM=
go.temporal.io/sdk v1.44.1/go.mod h1:vkApR12F9/Y8OR+hkxe7WyXQFuCX6clhzqnAk6rzDAM=
go.temporal.io/sdk/contrib/envconfig v1.0.0 h1:1Q/swVgB4EW/p3k7rI9/4hpU4/DC57FSRbU90+UisXw=
Expand Down
85 changes: 85 additions & 0 deletions temporalcloudcli/commands.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -1888,6 +1888,7 @@ func NewCloudNamespaceCommand(cctx *CommandContext, parent *CloudCommand) *Cloud
s.Command.AddCommand(&NewCloudNamespaceConnectivityCommand(cctx, &s).Command)
s.Command.AddCommand(&NewCloudNamespaceCreateCommand(cctx, &s).Command)
s.Command.AddCommand(&NewCloudNamespaceDeleteCommand(cctx, &s).Command)
s.Command.AddCommand(&NewCloudNamespaceDescriptionCommand(cctx, &s).Command)
s.Command.AddCommand(&NewCloudNamespaceEditCommand(cctx, &s).Command)
s.Command.AddCommand(&NewCloudNamespaceExportCommand(cctx, &s).Command)
s.Command.AddCommand(&NewCloudNamespaceFairnessCommand(cctx, &s).Command)
Expand Down Expand Up @@ -2406,6 +2407,7 @@ type CloudNamespaceCreateCommand struct {
SearchAttribute []string
ConnectionRuleId []string
ProjectId string
Description string
}

func NewCloudNamespaceCreateCommand(cctx *CommandContext, parent *CloudNamespaceCommand) *CloudNamespaceCreateCommand {
Expand All @@ -2432,6 +2434,7 @@ func NewCloudNamespaceCreateCommand(cctx *CommandContext, parent *CloudNamespace
s.Command.Flags().StringArrayVar(&s.SearchAttribute, "search-attribute", nil, "Custom search attribute as 'name=Type' (e.g. --search-attribute myAttr=Keyword). Valid types: Text, Keyword, Int, Double, Bool, Datetime, KeywordList. Repeat to add multiple.")
s.Command.Flags().StringArrayVar(&s.ConnectionRuleId, "connection-rule-id", nil, "Private connectivity rule ID. Repeat to specify multiple.")
s.Command.Flags().StringVar(&s.ProjectId, "project-id", "", "The ID of the project to create the namespace in. If omitted, the namespace is created in the account's default project.")
s.Command.Flags().StringVar(&s.Description, "description", "", "The description is a human-readable description of the namespace purpose. Must be at most 255 printable ASCII characters plus whitespace. Optional, default is empty.")
s.ClientOptions.BuildFlags(s.Command.Flags())
s.AsyncOperationOptions.BuildFlags(s.Command.Flags())
s.CodecServerOptions.BuildFlags(s.Command.Flags())
Expand Down Expand Up @@ -2483,6 +2486,88 @@ func NewCloudNamespaceDeleteCommand(cctx *CommandContext, parent *CloudNamespace
return &s
}

type CloudNamespaceDescriptionCommand struct {
Parent *CloudNamespaceCommand
Command cobra.Command
}

func NewCloudNamespaceDescriptionCommand(cctx *CommandContext, parent *CloudNamespaceCommand) *CloudNamespaceDescriptionCommand {
var s CloudNamespaceDescriptionCommand
s.Parent = parent
s.Command.Use = "description"
s.Command.Short = "Manage namespace description"
s.Command.Long = "Commands for viewing and updating the description of a Temporal Cloud\nnamespace. The description is a human-readable description of the\nnamespace purpose. Must be at most 255 printable ASCII characters plus\nwhitespace. Optional, default is empty."
s.Command.Args = cobra.NoArgs
s.Command.AddCommand(&NewCloudNamespaceDescriptionGetCommand(cctx, &s).Command)
s.Command.AddCommand(&NewCloudNamespaceDescriptionSetCommand(cctx, &s).Command)
return &s
}

type CloudNamespaceDescriptionGetCommand struct {
Parent *CloudNamespaceDescriptionCommand
Command cobra.Command
ClientOptions
NamespaceOptions
}

func NewCloudNamespaceDescriptionGetCommand(cctx *CommandContext, parent *CloudNamespaceDescriptionCommand) *CloudNamespaceDescriptionGetCommand {
var s CloudNamespaceDescriptionGetCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "get [flags]"
s.Command.Short = "Get namespace description"
if hasHighlighting {
s.Command.Long = "Retrieve the current description for a Temporal Cloud namespace. The\ndescription is a human-readable description of the namespace purpose.\n\nExample:\n\n\x1b[1mtemporal cloud namespace description get --namespace my-namespace.my-account\x1b[0m"
} else {
s.Command.Long = "Retrieve the current description for a Temporal Cloud namespace. The\ndescription is a human-readable description of the namespace purpose.\n\nExample:\n\n```\ntemporal cloud namespace description get --namespace my-namespace.my-account\n```"
}
s.Command.Args = cobra.NoArgs
s.ClientOptions.BuildFlags(s.Command.Flags())
s.NamespaceOptions.BuildFlags(s.Command.Flags())
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}

type CloudNamespaceDescriptionSetCommand struct {
Parent *CloudNamespaceDescriptionCommand
Command cobra.Command
ClientOptions
NamespaceOptions
AsyncOperationOptions
ResourceVersionOptions
Value string
}

func NewCloudNamespaceDescriptionSetCommand(cctx *CommandContext, parent *CloudNamespaceDescriptionCommand) *CloudNamespaceDescriptionSetCommand {
var s CloudNamespaceDescriptionSetCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "set [flags]"
s.Command.Short = "Set namespace description"
if hasHighlighting {
s.Command.Long = "Set the description for a Temporal Cloud namespace without changing other\nnamespace settings. The description is a human-readable description of\nthe namespace purpose. Must be at most 255 printable ASCII characters\nplus whitespace. Pass an empty string to clear the description.\n\nExample:\n\n\x1b[1mtemporal cloud namespace description set --namespace my-namespace.my-account --value \"Updated namespace description\"\x1b[0m"
} else {
s.Command.Long = "Set the description for a Temporal Cloud namespace without changing other\nnamespace settings. The description is a human-readable description of\nthe namespace purpose. Must be at most 255 printable ASCII characters\nplus whitespace. Pass an empty string to clear the description.\n\nExample:\n\n```\ntemporal cloud namespace description set --namespace my-namespace.my-account --value \"Updated namespace description\"\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().StringVar(&s.Value, "value", "", "New description for the namespace. Must be at most 255 printable ASCII characters plus whitespace. Pass an empty string to clear it. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "value")
s.ClientOptions.BuildFlags(s.Command.Flags())
s.NamespaceOptions.BuildFlags(s.Command.Flags())
s.AsyncOperationOptions.BuildFlags(s.Command.Flags())
s.ResourceVersionOptions.BuildFlags(s.Command.Flags())
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}

type CloudNamespaceEditCommand struct {
Parent *CloudNamespaceCommand
Command cobra.Command
Expand Down
2 changes: 2 additions & 0 deletions temporalcloudcli/commands.namespace.create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func TestCreateNamespace_BuildsSpec(t *testing.T) {
"MyText": namespacev1.NamespaceSpec_SEARCH_ATTRIBUTE_TYPE_TEXT,
"MyKeyword": namespacev1.NamespaceSpec_SEARCH_ATTRIBUTE_TYPE_KEYWORD,
},
Description: "Example namespace description",
}

mockCloud := cloudmock.NewMockCloudServiceClient(t)
Expand Down Expand Up @@ -176,6 +177,7 @@ func TestCreateNamespace_BuildsSpec(t *testing.T) {
},
},
SearchAttribute: []string{"MyText=Text", "MyKeyword=Keyword"},
Description: "Example namespace description",
Cloud: mockCloud,
Printer: &printer.Printer{Output: &buf, JSON: true},
Prompter: mockPrompter,
Expand Down
66 changes: 66 additions & 0 deletions temporalcloudcli/commands.namespace.description.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package temporalcloudcli

import (
"errors"

cloudservice "go.temporal.io/cloud-sdk/api/cloudservice/v1"
namespacev1 "go.temporal.io/cloud-sdk/api/namespace/v1"
"google.golang.org/protobuf/proto"

"github.com/temporalio/cloud-cli/temporalcloudcli/internal/printer"
)

func (c *CloudNamespaceDescriptionGetCommand) run(cctx *CommandContext, _ []string) error {
client, err := cctx.GetCloudClient(c.ClientOptions)
if err != nil {
return err
}
res, err := client.GetNamespace(cctx, &cloudservice.GetNamespaceRequest{Namespace: c.Namespace})
if err != nil {
return err
}

result := struct {
Namespace string `json:"namespace"`
Description string `json:"description"`
}{
Namespace: res.Namespace.Namespace,
Description: res.Namespace.Spec.GetDescription(),
}
return cctx.Printer.PrintStructured(result, printer.StructuredOptions{})
}

func (c *CloudNamespaceDescriptionSetCommand) run(cctx *CommandContext, _ []string) error {
client, err := cctx.GetCloudClient(c.ClientOptions)
if err != nil {
return err
}
res, err := client.GetNamespace(cctx, &cloudservice.GetNamespaceRequest{Namespace: c.Namespace})
if err != nil {
return err
}

ns := res.Namespace
newSpec := proto.Clone(ns.Spec).(*namespacev1.NamespaceSpec)
newSpec.Description = c.Value

yes, err := cctx.GetPrompter().PromptApply(ns.Spec, newSpec, false)
if err != nil {
return err
}
if !yes {
return errors.New("Aborting.")
}

rv := ns.ResourceVersion
if c.ResourceVersion != "" {
rv = c.ResourceVersion
}
resp, err := client.UpdateNamespace(cctx, &cloudservice.UpdateNamespaceRequest{
Namespace: c.Namespace,
Spec: newSpec,
ResourceVersion: rv,
AsyncOperationId: c.AsyncOperationId,
})
return cctx.GetPoller(client, c.AsyncOperationOptions).HandleUpdateOperation(cctx, resp, err)
}
Loading
Loading